← index #9003PR #17519
Off-topic · high · value 3.355
QUERY · ISSUE

Pico W ENOMEM error when (re)using PIO (rp2_pio_init, CYW43)

openby scrussopened 2022-08-01updated 2026-03-12
bugport-rp2

First reported here: Pico W ENOMEM error when using PIO - Raspberry Pi Forums.

A program that uses PIO (such as the example code: micropython/pio_1hz.py at master · micropython/micropython) can't be reliably stopped and restarted on a Pico W, while it can on a Pico.

Expected result: being able to stop and start PIO example at will

Actual result: after a small number of attempts OSError: [Errno 12] ENOMEM

The cause appears to be identified as PIO.remove_program() not being usable when the CYW43 driver is loaded, as the CYW43 itself is running a PIO program.

Indeed, comments inside rp2_pio_init() suggest this may be an issue:

void rp2_pio_init(void) {
    // Reset all PIO instruction memory.
    #if MICROPY_PY_NETWORK_CYW43
    // TODO: cannot reset PIO memory when CYW43 driver is enabled and active
    // because it uses a PIO for the bus interface.

Version:

MicroPython v1.19.1 on 2022-07-29; Raspberry Pi Pico W with RP2040
rp2-pico-w-20220729-unstable-v1.19.1-223-g963e599ec.uf2
CANDIDATE · PULL REQUEST

rp2/pio: Fix the RP2350 (PICO2) Port PIO2 prog data structure

mergedby IntergalacticMicrosystemsopened 2025-06-18updated 2025-08-01
port-rp2

Summary

The RP2350 PIO2 State Machines ( 8, 9, 10, 11 ) did not work.
The data structure used to pass the PIO arguments was missing an entry for PIO2, thus causing the PIO2 instances to write wrong data to wrong locations.
Fixes issue https://github.com/micropython/micropython/issues/17509

Testing

RP2530 Pico 2 board - Tested a modified pio_1hz.py, now works on all 12 RP2350 state machines at once or 1 at a time.
RP2040 Pico board - still works, tested a modified pio_1hz.py, works on all 8 state machines at once or 1 at a time.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied