← index #8790PR #18974
Related · medium · value 1.818
QUERY · ISSUE

RP2: PIO interrupt API for Raspberry Pi Pico

openby cody82opened 2022-06-20updated 2025-10-03
enhancementport-rp2

In the Micropython port RP2 for the Raspberry Pi Pico it looks like there are some APIs missing.
Especially it seems it is not possible to enable a PIO FIFO interrupt. (Or I did miss something)

In the Raspberry Pico C API there is the function pio_set_irq0_source_enabled that lets you configure FIFO interrupts:
https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__pio.html

I would like to see support for that in Micropython. Without that API you have to poll the FIFO which is in my case bad for performance.

CANDIDATE · PULL REQUEST

rp2: Add PIO assembler and StateMachine test suite.

openby bikeNomadopened 2026-03-21updated 2026-03-23
port-rp2

Tests cover asm_pio encoding (nop, wait, irq, mov, in_count, fifo_join including RP2350-specific modes), StateMachine hardware behavior (loopback, FIFO counts, exec, IRQ, restart, program memory reuse), and RP2350-specific features (3 PIO blocks, 12 SMs, PIO(2) loopback).

Summary

I wanted to update the RP2 PIO code to support the new RP2350 PIO changes.

To make sure that my changes were working, I created this test script to run from mpremote (similarly to rp2_dma.py).

Testing

I've run this on both a RPI_PICO2 board and a RPI_PICO board. I did discover an issue in the existing PIO code, which is fixed by #18976.

This issue causes test_restart to hang.

Some of the RP2350-specific tests depend on functionality that is not yet in mainline code; #18975 adds this functionality.

Generative AI

I used generative AI tools when creating this PR, but a human has checked the
code and is responsible for the code and the description above.

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