RP2: PIO interrupt API for Raspberry Pi Pico
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.
rp2: Add PIO assembler and StateMachine test suite.
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.