Change CPU Speed in the program?

Status
Not open for further replies.
Is there a simple way to change CPU speeds inside of the program between 180Mhz and 24 Mhz to reduce power when high clock speeds are not needed?
 
Is there a simple way to change CPU speeds inside of the program between 180Mhz and 24 Mhz to reduce power when high clock speeds are not needed?


It is possible (done for snooze and eeprom libraries) but some libraries rely on F_CPU at compile time and will not work properly is CPU speed is not F_CPU anymore
 
Thank you for your response. Dangit... I was really hoping that it wouldn't be too complicated.

I will dive into the snooze library and see how Duff did it, and see what I break when I try it.

If anyone has done this I'd love to hear some of the challenges you faced.

Thanks again.
 
It's a "simple" matter of writing to the CLKDIV1 register. The 2 tricky parts are the hardware will automatically ignore any write which isn't a valid setting, and even when you do change the speed to something much lower, many peripherals will also run slower when you lower F_BUS.
 
Status
Not open for further replies.
Back
Top