GP32 Changing clock speed, anyone any examples?


StudioX64

Still Fresh
Joined
Mar 30, 2003
Messages
71
Location
UK
Website
www.studiox64.com
Does anyone have any good examples of changing clock speed on the GP32. I am looking for the correct way to set the speed at 40mhz, or 60mhz to see if it has any effect on the smoothness of my game.

Thanks.
 
for 66 MHz
the i've found for the moment is:
GpClockSpeedChange(67800000, 0x69032, 3);
 
Here an old table frequence :

////////////////////////////////////////////////////
// CPU FREQUENCE FOR GP32 //
////////////////////////////////////////////////////
// By ThunderZ //
////////////////////////////////////////////////////
// Thanks to all GP32 community for make this //
// table possible. //
////////////////////////////////////////////////////
// WARNING, you use it at your how risk !!! //
////////////////////////////////////////////////////


/*
1 - 16.7 Mhz
2 - 33 MhZ (1)
3 - 33 Mhz (2)
4 - 67.5 Mhz
5 - 80 Mhz
6 - 102 Mhz
7 - 132 Mhz
*/
int clock_settings [7]={16500000,33000000,33000000,67500000,80000000,102000000,132000000};
int div_settings[7]={ 0x71142,0x24003,0x3a013,0x25021,0x48012,0x1a020,0x3a011};
int clockdiv_settings[7]={0,0,0,2,1,2,3};


And here the function i use in my emu :

// pour overclock
#define CLOCK40 0
#define CLOCK66 1
#define CLOCK133 2
#define CLOCK156 3
#define CLOCK166 4
void SetClockSpeed(int nClockSpeed);


void SetClockSpeed(int nClockSpeed)
{
// clkdvn MCLK HCLK PCLK
// 0 1 1 1
// 1 1 1 1/2
// 2 1 1/2 1/2
// 3 1 1/2 1/4

switch (nClockSpeed)
{
case CLOCK40:
// 40, 3
GpClockSpeedChange (40000000, 0x48013, 1);
break;
case CLOCK66:
// 67.8, 3
GpClockSpeedChange(67800000, 0x69032, 3);
break;
case CLOCK133:
// 133, 3
GpClockSpeedChange(132000000, 0x3a011, 3);
break;
case CLOCK156:
GpClockSpeedChange (156000000, 0x2c001, 3);
break;
case CLOCK166:
GpClockSpeedChange (165000000, 0x2f001, 3);
break;
}
}
 
Thanks for that. I did see the table on a French forum but I think the "WARNING, you use it at your how risk !!!" put me off using it :)
 
Yeah currently my engine runs too fast on 66mhz, i will have to reduce speed or may more gfx stuff. But i have parallax scrolling to add and foreground too, i could even add particles. then might have to bump up to 133 mhz. :D
 
I had thought that I might have to up the speed after I couldn't achieve smooth scrolling of my main sprites at 40mhz, however it turned out to be some screwy logic in my programming. All fixed now so keeping my game at 40mhz for the time being. :)
 
A question regarding clock-speed changing:

Do you have to change it back when you exit your program, or will the GP32 set it back automatically? Seems like leaving the clock at 133MHz would drain the battery fast...
 
What I do is to set the clock speed really low when the program doesnt need the power..
For say, just text. But when the graphics go - speed up.
 
Sorry about my previous big head post now it runs too slow on 66mhz, lol
 
Tim posted on May 14 2003 said:
What I do is to set the clock speed really low when the program doesnt need the power..
For say, just text. But when the graphics go - speed up.
I've got a friend who does research on specialisation (i.e. fancy optimisation) for embedded systems on PDAs/embedded systems.

When I said about the software controlled clock on the GP32, he said he had read a paper on an optimisation technique for PDAs which described how to do a program transformation that could increase battery life by around 50%, without reducing performance from the maximum speed. Basically you switch the processor into a lower clock rate whenever its doing something which doesn't require full speed (e.g. waiting for something).

I doubt this would work as well for games, and I haven't read the paper, but it should be possible to do something similar for the GP32. I might ask my friend for the paper when I get my GP32 and see if its something I could have a go at. Not really my field though ;)
 
Last edited by a moderator:
Back
Top