Skip to content

RP2350: lowering cpu.frequency can crash or hang the board #11882

Open

Description

@dhalbert

Claude wrote this:

Problem

Lowering microcontroller.cpu.frequency on RP2350 sometimes crashes or hangs the board. Raising it has not failed in testing. Seen on CircuitPython main (bede374):

Board Sequence Result
Adafruit Fruit Jam 300 MHz, then 48 MHz Crashed and restarted in 1 of 8 tries (reset reason SOFTWARE, no safe mode)
Raspberry Pi Pico 2 W, Wi-Fi connected 250 MHz, write microcontroller.nvm[0], 100 MHz, then wifi.radio.ping(gateway) Hung, and USB stopped enumerating, in 3 of 9 tries

On the Pico 2 W without the nvm write, pings at 100 MHz return None and recover at 150 MHz, with no hang.

Possible cause

common_hal_mcu_processor_set_frequency() in ports/raspberrypi/common-hal/microcontroller/Processor.c sets the core voltage for the new frequency before changing the clock, then waits 10 ms. When lowering the frequency, that runs the old, faster clock at the lower voltage (1.10 V) for those 10 ms. The pico-sdk only shows the other half: runtime_init_clocks() raises the voltage before raising the clock.

Changing the order (raise the voltage before raising the clock, lower it after lowering the clock) did not fix the Pico 2 W hang, which still happened in 3 of 5 tries. So the voltage order is not the only cause, or not the cause. Other candidates are the CYW43 PIO SPI link, whose clock comes from the system clock, and interactions with the flash write.

To reproduce

Fruit Jam (repeat until it fails):

import microcontroller
microcontroller.cpu.frequency = 300_000_000
microcontroller.cpu.frequency = 48_000_000

Pico 2 W, with CIRCUITPY_WIFI_SSID and CIRCUITPY_WIFI_PASSWORD set:

import microcontroller, wifi
gw = wifi.radio.ipv4_gateway
microcontroller.cpu.frequency = 250_000_000
old = microcontroller.nvm[0]
microcontroller.nvm[0] = 42
microcontroller.nvm[0] = old
microcontroller.cpu.frequency = 100_000_000
print([wifi.radio.ping(gw) for _ in range(3)])

Activity

  1. added this to the 11.x.x milestone on Nov 16, 2026
  2. bablokb commented on Nov 16, 2026

    @bablokb

    The last time I checked the SPI PIO link was a compile time setting. @eightycc had a detailed discussion on this in one of the issues related to RM2 support: #9777 (comment)

    I encountered the problem also with a RP2040, so I don't think it is a RP2350 problem.

  3. mikeysklar commented on Nov 16, 2026

    @mikeysklar
    Collaborator

    Two separate bugs.

    Pico 2 W: the Wi-Fi chip's SPI clock is the CPU clock divided by 3, so slowing the CPU slows the link. Below 150 MHz Wi-Fi stops working, and at 100 MHz the board freezes waiting on the chip. Voltage isn't involved: 150 → 135 keeps 1.20 V and still kills Wi-Fi.

    Fruit Jam: when lowering, the voltage drops 10 ms before the clock does, so 300 MHz briefly runs at 1.10 V.

    Board Test Result
    Pico 2 W 150 → 100 MHz 9/10 hang
    Pico 2 W 150 → 135 MHz Wi-Fi dead, no hang
    Pico 2 W 250 → 150 MHz OK
    Fruit Jam 300 → 48 MHz 10/10 fail
    Fruit Jam 250 → 48 MHz OK
    Other RP2 boards all 0/524
  4. mikeysklar commented on Nov 17, 2026

    @mikeysklar
    Collaborator

    The Pico 2 W hang is a Wi-Fi clock problem.

    The Wi-Fi chip's clock divider is fixed when Wi-Fi starts, so a slower CPU makes that link too slow.

    I opened raspberrypi/pico-sdk#3303 so the divider can be changed while Wi-Fi is running.

    Once that merges, CircuitPython can set it after each speed change.

    The Fruit Jam crash is a separate cause, fixed in #11885.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions