Did I request a "custom clock"?

Building FreeRTOS for RP2040, I get this error from pico-sdk/src/rp2_common/hardware_clocks/include/hardware/clocks.h:

#error PLL_SYS_VCO_FREQ_KHZ, PLL_SYS_POSTDIV1 and PLL_SYS_POSTDIV2 must all be specified when using custom clock setup

What constitutes a “custom clock setup”? In my FreeRTOSConfig.h there is one line about clocks, which I think is just saying the default:

#define configCPU_CLOCK_HZ                   125000000

I plan to later lower that to 48 MHz.

Hi @LessIsMore
From the latest release document for pico-sdk v1.5.1

The set_sys_clock_pll and set_sys_clock_khz methods now reference a pre-processor define PICO_CLOCK_AJDUST_PERI_CLOCK_WITH_SYS_CLOCK. If set to 1, the peripheral clock is updated to match the new system clock, otherwise the preexisting behavior (of setting the peripheral clock to a safe 48Mhz) is preserved.


The new defines PLL_SYS_VCO_FREQ_KHZ, PLL_SYS_POSTDIV1 and PLL_SYS_POSTDIV2 are used to configure the system clock PLL during runtime initialization. These are defaulted for you if SYS_CLK_KHZ=125000, XOSC_KHZ=12000 and PLL_COMMON_REFDIV=1. You can modify these values in your CMakeLists.txt if you want to configure a different system clock during runtime initialization, or are using a non-standard crystal.

You can check the value of PICO_CLOCK_AJDUST_PERI_CLOCK_WITH_SYS_CLOCK to see if custom clock is setup.

My guess, and it is just a guess not having looked at the port, is that you are asking for a frequency the port hasn’t been programmed with how to generate, and the error is telling you what you need to provide to tell it how to make that.

If you look in the clocks.h file just before that statement, there is likely code that shows what it knows how to generate, and maybe comments on how to make other frequencies.