Caanoo / WIZ Overclocking The Caanoo


hi,

i've ported hugo (pce emu) to caanoo, but it needs a bit of "overclocking power" to reach the 60 fps, so i was wondering if there is an updated pollux_set_caanoo/code working with latest firmware version ? I'm looking for a really simple function that let me overclock the cpuclock as i did for the wiz or the gp2x f100. I've read that it was available on mame4all but i haven't been able to find the source code ... any help would be nice :)
 
thanks for the answer Notaz. I've tried yesterday using old wiz pollux_set functions, but i got weird graphics on the screen (as if there were wrong clock ratio and the image was displayed in double).
 
zx-81 said:
thanks for the answer Notaz. I've tried yesterday using old wiz pollux_set functions, but i got weird graphics on the screen (as if there were wrong clock ratio and the image was displayed in double).
Don't set the lcd_timings=xxx part then, do pollux_set(memregs, "cpuclk=700") and such.

SiENcE said:
Can someone please post the latest overclock code?
apply_cpuclk() in the old http://notaz.gp2x.de/misc/dev/pollux_set_r1.zip should still be good.
 
Last edited by a moderator:
notaz said:
zx-81 said:
thanks for the answer Notaz. I've tried yesterday using old wiz pollux_set functions, but i got weird graphics on the screen (as if there were wrong clock ratio and the image was displayed in double).
Don't set the lcd_timings=xxx part then, do pollux_set(memregs, "cpuclk=700") and such.

Thanks it works just fine that way, but i'm facing sound rate issue, the sound is now playing a bit too fast. I've read your discussion at the beginning of this thread, but i don't understand if i should modify the audio callback to duplicate samples and to play slower (according to cpu clock ratio) or is there anything i can do better ?
 
Last edited by a moderator:
After changing the CPU clock you have to reopen audio device, so that kernel driver recalculates audio dividers correctly (this could be a problem with some libs though). It will still have some drift, but that should comparable to what is there on Wiz for example. It depends on your app if you have to account for that or not.

I still don't understand why GPH/Simon chose to derive audio clock from CPU PLL..
 
notaz said:
After changing the CPU clock you have to reopen audio device, so that kernel driver recalculates audio dividers correctly (this could be a problem with some libs though). It will still have some drift, but that should comparable to what is there on Wiz for example. It depends on your app if you have to account for that or not.

I still don't understand why GPH/Simon chose to derive audio clock from CPU PLL..

Ok big thanks for the hint, i will give it a try. I'm using SDL so i guess it won't be a big deal :)
 
Last edited by a moderator:
ok so it works, but if i launch the emu two times, when it exits it freeze the caanoo ... If i have a ssh session opened at the same time, every command i run give me a seg fault ... (as if the caanoo kernel was completly messed up).

Here is the code i'm using on startup (i'm calling cpu_init in the main() of the emu)
Code:
#define SYS_CLK_FREQ 27
static          unsigned int    gp2x_dev = 0;
static volatile unsigned short *gp2x_memregs;
static volatile unsigned long  *gp2x_memregl;
static void
loc_set_FCLK(unsigned int clock_in_mhz) {
  unsigned int v;
  unsigned int mdiv, pdiv, sdiv = 0;
  pdiv = 9;
  mdiv = (clock_in_mhz * pdiv) / SYS_CLK_FREQ;
  mdiv &= 0x3ff;
  v = (pdiv<<18) | (mdiv<<8) | sdiv;
  gp2x_memregl[0xf004>>2] = v;
  gp2x_memregl[0xf07c>>2] |= 0x8000;
  while (gp2x_memregl[0xf07c>>2] & 0x8000) ;
}

void cpu_init() {
  gp2x_dev = open("/dev/mem", O_RDWR);
  gp2x_memregl = (unsigned long  *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, gp2x_dev, 0xc0000000);
  gp2x_memregs = (unsigned short *)gp2x_memregl;
  loc_set_FCLK(650);
}


And here is the code i'm using on exit


Code:
void
cpu_deinit()
{
  loc_set_FCLK(500);
  sleep(1);
  munmap((void *)gp2x_memregl, 0x10000);
  close(gp2x_dev);
  fcloseall();
  sync();
}
 
finally i'm using a shell script that call set_pollux binary with "cpuclk=xxx" and it works just fine. (but i can't figure out why it doesn't work in caanoo-hugo :( ).
 
All I can see is you are mmaping 64k while pollux register space is 128k, but that shouldn't really be a problem. Maybe you are hitting a compiler bug, you could try disabling optimization.
 
I recently tried adding overclocking to a Caanoo-port of one of my games, but since I don't have a Caanoo I'm not sure it's working. The feedback I got from testers tells me it might not be working.
Perhaps someone here knows if I'm doing it right. I use this line in my start script :

./pollux_set/pollux_set 'lcd_timings=397,1,37,277,341,0,17,337;dpc_clkdiv0=9;cpuclk=700;ram_timings=2,9,4,1,1,1,1'

And I use the pollux_set found previously in this thread called pollux_set_r1.zip. Is there anything that seems like it shouln't work on the Caanoo?
 
Imerion said:
I recently tried adding overclocking to a Caanoo-port of one of my games, but since I don't have a Caanoo I'm not sure it's working. The feedback I got from testers tells me it might not be working.
Perhaps someone here knows if I'm doing it right. I use this line in my start script :

./pollux_set/pollux_set 'lcd_timings=397,1,37,277,341,0,17,337;dpc_clkdiv0=9;cpuclk=700;ram_timings=2,9,4,1,1,1,1'

And I use the pollux_set found previously in this thread called pollux_set_r1.zip. Is there anything that seems like it shouln't work on the Caanoo?
For the first sight, you can't use "lcd_timings=" and "ram_timings=" settings on Caanoo because values are different from Wiz(i'd like to know how calculate new ones). Only string that useful for now is "cpuclk=" which set up CPU clock.
 
Last edited by a moderator:
Thanks! I changed the script to simply say :

Code:
./pollux_set/pollux_set 'cpuclk=700;'

Hope that works. I'll update the script if you or someone else manages to calculate correct RAM/LCD values for the Caanoo. Sorry I can't help, but I have no idea how to do that.
 
notaz said:
After changing the CPU clock you have to reopen audio device, so that kernel driver recalculates audio dividers correctly (this could be a problem with some libs though). It will still have some drift, but that should comparable to what is there on Wiz for example. It depends on your app if you have to account for that or not.

I still don't understand why GPH/Simon chose to derive audio clock from CPU PLL..

Do you know how I can make the kernel recalculate the audio dividers when I didn't open the audio device?
I applied the overclocking code to GMenu2X and depending on the frequency set in the menu I can hear white noise from the speaker. I think it is probably related to the audio clock issue but I'm not sure how I am supposed to fix it.
The application uses SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_JOYSTICK) and it never opens the audio device.
 
Last edited by a moderator:
Hm that's strange, maybe they hacked their SDL to always open audio or maybe they're keeping audio path always running.. Maybe calling dummy sequence of SDL_InitSubSystem(SDL_INIT_AUDIO), SDL_OpenAudio, SDL_CloseAudio, SDL_QuitSubSystem(SDL_INIT_AUDIO) would help.
 
notaz said:
Hm that's strange, maybe they hacked their SDL to always open audio or maybe they're keeping audio path always running.. Maybe calling dummy sequence of SDL_InitSubSystem(SDL_INIT_AUDIO), SDL_OpenAudio, SDL_CloseAudio, SDL_QuitSubSystem(SDL_INIT_AUDIO) would help.

It doesn't seem to solve the problem. Also note that I am not overclocking, but underclocking and the noise seems to appear when I go under 200Mhz.
At 150Mhz it's rather strong and at 50Mhz it's very weak (almost gone).
 
Last edited by a moderator:
Back
Top