ports/rp2: "Uncaught exception in IRQ callback handler" when retrieving PIO FIFO value with MSB set
Port, board and/or hardware
Official Pico w/rp2040
MicroPython version
MicroPython v1.24.0 on 2024-10-25; Raspberry Pi Pico with RP2040
Reproduction
uncaught_exception_test.py.txt
Expected behaviour
MPY: soft reboot
0x12345678
0x12345678
Observed behaviour
MPY: soft reboot
Uncaught exception in IRQ callback handler
Traceback (most recent call last):
File "<stdin>", line 33, in irq_handler
MemoryError: memory allocation failed, heap is locked
0x00000000
0x00000000
Additional Information
Some discussion/commentary here:
https://github.com/micropython/micropython/blob/master/ports/rp2/rp2_pio.c#L820
Code of Conduct
Yes, I agree
rp2: crash on soft reboot with DMA IRQ enabled and DMA active
Port, board and/or hardware
rp2 / rp2040
MicroPython version
MicroPython v1.27.0 on 2025-12-09; Raspberry Pi Pico with RP2040
Reproduction
Run the following code:
from rp2 import DMA
def dma_in_handler(dma):
pass
buf_src = bytearray(20)
buf_in = bytearray(20)
dma_in = DMA()
dma_in_ctrl = dma_in.pack_ctrl(size=0, treq_sel=0)
dma_in.irq(dma_in_handler, False)
dma_in.config(
read=buf_src,
write=buf_in,
count=20,
ctrl=dma_in_ctrl,
trigger=True
)
#dma_in.active(False)
#dma_in.irq(None)
print("Hello")
Now attempt to soft-reboot the device (e.g. Ctrl-D on REPL). The device becomes unresponsive and requires a hard reboot.
- Calling
dma_in.active(False)before exit avoids the problem - Calling
dma_in.irq(None)before exit avoids the problem - Removing the
treq_selparameter avoids the problem (presumably because the DMA is then inactive at the time of reboot)
Expected behaviour
No response
Observed behaviour
Device becomes unresponsive over serial after program is run and then MP is soft-rebooted.
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree