increase cpu speed

I am trying to increase the clock speed of the CPU by using the Dynamic C in-line function to modify the GCSR as follows:
WrPortI(0x00, Epoint, 0x0C); // Bits 4:2 of the GCSR xxx011xx should be osc/2 for cpu & pclk
// Epoint is a null pointer of type char

This compiles but does not work - any suggestions???

1 Like

Try using this to start:

WrPortI(GCSR, &GCSRShadow, (GCSRShadow & ~0x1C) | 0x0C);

You should always make use of the shadow register when calling WrPortI() so that any other code calling WrPortI() will maintain your changes. And you should only touch the bits you want to change ā€“ the ā€œ& ~0x1Cā€ preserves other bits (xxx000xx) and ā€œ| 0x0Cā€ sets the appropriate bits (xxx011xx).

You could also have your code print out the value of GCSRShadow before making that change. What are those bits set to before you try to change them?

Which product are you using? What speed are you trying to attain? Could you make use of existing APIs to configure GCSR (like set_cpu_power_mode() for Rabbit 6000)?

Default configuration for each product is to run at full speed, with the clock doubler enabled if the RAM and flash support it.