neopixel protocol timings depart from set values on Pi Pico 2 W causing failures
Port, board and/or hardware
Pi Pico 2 W (RP2350 based)
MicroPython version
MicroPython v1.26.1 on 2025-09-11; Raspberry Pi Pico 2 W with RP2350
Reproduction
I wrote neopixel-timing.py to test this. I've only run this so far on Pi Pico 2 W.
Expected behaviour
I'd hope all of the invocations of write() for neopixel library would work okay.
Observed behaviour
Visual results
- Test 1 default timing at clock 125000000 MHz: fail
- Test 2 custom timing ([350, 900, 800, 450]) at clock 125000000 MHz: good
- Test 3 default timing at clock 150000000 MHz: fail
- Test 4 custom timing ([350, 900, 800, 450]) at clock 150000000 MHz: good
- Test 5 default timing at clock 160000000 MHz: good
- Test 6 custom timing ([350, 900, 800, 450]) at clock 160000000 MHz: good
Additional Information
I'm running with an RGB LED matrix powered at 3.3V and GP2 signal will be at 3.3V too. This demonstrably works well from a micro:bit.
I have some capture data from my humble Ikalogic SQ25 (only at 25Msps). I'll add them later today.
@gurgleapps @mirkin may be interested in this.
Code of Conduct
Yes, I agree
ports/rp2: Pico 2 W with `PICO_PIO_USE_GPIO_BASE 1` and timer-based blink randomly causes all timers to stop
Port, board and/or hardware
Pico 2 W (actually tested with Pico Plus 2 W)
MicroPython version
v1.24.0-181-g495ce91ca-dirty
Reproduction
- In
lib/pico-sdk/src/boards/include/boards/pico2_w.h, add#define PICO_PIO_USE_GPIO_BASE 1 - Build MicroPython for the Pico 2 W, then flash to the board
- Tested with Pico Plus 2 W, but Pico 2 W probably also works
- Run the code below
- I'm using mpremote to copy/paste everything in paste mode (Ctrl+E)
- The LED starts flashing, and
time.ticks_ms()is printed every 100ms
from machine import Pin, Timer
import time
led = Pin("LED")
def cb1(foo):
print(time.ticks_ms())
def cb2(foo):
led.toggle()
timer1 = Timer(-1)
timer2 = Timer(-1)
timer1.init(freq=10, mode=Timer.PERIODIC, callback=cb1)
timer2.init(freq=10, mode=Timer.PERIODIC, callback=cb2)
Expected behaviour
Both timers should continue to function indefinitely. The LED should continue blinking, and time.ticks_ms() should continue printing.
Observed behaviour
After a random amount of time (a couple seconds to a couple minutes), the LED stops flashing and time.ticks_ms() stops printing. Both timers stop without any apparent reason. The REPL is still usable like normal.
Additional Information
The reproduction steps above are a bit contrived, but it's actually causing problems for my real application; this was just a simple way to replicate the problem. I have a different board with an RP2350B, RM2, and LED connected to the RM2 (very similar to the Pico Plus 2 W). In my application, I have a handful of timers, one of which blinks the LED. After a short amount of time, all timers stop.
I have found that doing either of the following ensures all timers continue working:
- Disable the blink timer
- This is not appropriate for my application.
- Add
#define PICO_PIO_USE_GPIO_BASE 0to my board definition- This prevents me from using PIO on GPIO > 31.
I tried to replicate the problem in Pico SDK 2.1.0 without success. I ran the picow_blink example with the same #define PICO_PIO_USE_GPIO_BASE 1 modification, but never observe any problems after ~30 minutes. So this appears to be a MicroPython bug.
Code of Conduct
Yes, I agree