RP2040 port, Clock speed not set?

Hello,
I have a small project up and running to test FreeRTOS out. And it is very impressive.

However, I’m trying to understand how the clock frequency and timer calculations work for the RP2040 MCU. I see examples for other MCUs where the clockspeed is set in the config header, but for this one it seems to not be set anywhere.

Just the tickrate is set in the examples.

The main reason I ask is that i want to understand what is needed to be able to run at different clockspeeds. Both overclock and underclock. If anyone can shed some light on this I would appreciate it!

RP2040 is also capable on changing the clockspeed in runtime, so would be great to know if this would be possible with freertos also without causing other issues?

If you configure the FreeRTOS tick carefully, you can make the tick completely independent of the core clock frequency. That way you can change the core clock frequency at runtime without impacting FreeRTOS at all.

FreeRTOS uses the Systick timer to drive the FreeRTOS tick. The RP2040 can optionally drive Systick with a 1MHz clock, which is always 1MHz regardless of the system clock frequency. To tell FreeRTOS to use this alternate clock for Systick, define configSYSTICK_CLOCK_HZ to 1000000. See Customization - FreeRTOS™.

1 Like