Overclocking raspberry pi pico in qmk

Overclocking raspberry pi pico in qmk

To overclock the Raspberry Pi Pico's RP2040 in QMK, you will need to modify the PLL divider in the Pico SDK's clock.c file. You can locate this file at qmk_firmware/lib/pico-sdk/src/rp2_common/hardware_clocks/regs/clocks.c

Locate the following block of code:

   // Configure PLLs
    //                   REF     FBDIV VCO            POSTDIV
    // PLL SYS: 12 / 1 = 12MHz * 125 = 1500MHz / 6 / 2 = 125MHz
    // PLL USB: 12 / 1 = 12MHz * 100 = 1200MHz / 5 / 5 =  48MHz
    /// \end::pll_settings[]

    /// \tag::pll_init[]
    // pll_init(pll_sys, 1, 1500 * MHZ, 6, 2);
    pll_init(pll_sys, 1, 1500 * MHZ, 4, 2);
    pll_init(pll_usb, 1, 1200 * MHZ, 5, 5);
    /// \end::pll_init[]

The default divider of 6 yields a clock speed of 125MHz and has a scan rate of:

Gesuspico:God GH60:1: matrix scan frequency: 1962
Gesuspico:God GH60:1: matrix scan frequency: 1963

Setting the divider to 5 yields a clock speed of 150MHz with a scan rate of:

Gesuspico:God GH60:1: matrix scan frequency: 2037
Gesuspico:God GH60:1: matrix scan frequency: 2036

Setting the divider to 4 yields a clock speed of 187.5MHz, just like in the config example:

Gesuspico:God GH60:1: matrix scan frequency: 2044
Gesuspico:God GH60:1: matrix scan frequency: 2044

Setting the divider to 3 yields a clock speed of 250MHz, but this is likely pushing it. It does have a scan rate of:

Gesuspico:God GH60:1: matrix scan frequency: 2118
Gesuspico:God GH60:1: matrix scan frequency: 2116