CPU clock speed nRF52840

Hello,

I have an application where I need to keep the 32 MHz running with its timer. What may be the best solution to get lowest CPU current consumption while in idle, i.e. just keeping running the 32 MHz and the timer

Is this possible to set the CPU at 1 MHz/ 4 MHz ?

Thanks,

Nop

  • Hi Nop,

    You can collect RTC ticks (based on the 32.768 kHz oscillator) and TIMER ticks (based on the 32 MHz oscillator). Further more, you can for instance use PPI with the fork mechanism to START or STOP both at the same time. Then, if you start, let it run for some time, then stop, you can calculate the expected ratio in ticks (based on the nominal frequency) and the actual difference in ticks (caused by the clocks not being perfect). With this you can compensate.

    I am not sure how good ti will work in practice as the, at least not if the 32.768 kHz clock is based on the internal RC. If you use an external crystal the variation over temperature etc will be less, so that would make this better. We do not have any libraries for doing this, but there are examples on using PPI with TIMERS in the SDK that you can refer to (if using nRF Connect SDK you can look under modules/hal/nordic/nrfx/samples/src/nrfx_gppi/fork/main.c and if using nRF5 SDK, look under examples/peripheral/ppi)

Related