← index #16221Issue #18765
Related · medium · value 0.729
QUERY · ISSUE

ports/rp2: "Uncaught exception in IRQ callback handler" when retrieving PIO FIFO value with MSB set

openby mungewellopened 2024-11-13updated 2026-03-25
bugport-rp2

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

CANDIDATE · ISSUE

rp2: crash on soft reboot with DMA IRQ enabled and DMA active

closedby pdw-mbopened 2026-02-01updated 2026-03-18
bugport-rp2

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_sel parameter 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

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