Skip to content

Commit 769453c

Browse files
rootdpgeorge
authored andcommitted
rp2/rp2_pio: Fix use of PIO2 in prog data structure.
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 micropython#17509. Signed-off-by: Matt Westveld <[email protected]>
1 parent c9b52b2 commit 769453c

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

ports/rp2/modules/rp2.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
_PROG_DATA = const(0)
88
_PROG_OFFSET_PIO0 = const(1)
99
_PROG_OFFSET_PIO1 = const(2)
10-
_PROG_EXECCTRL = const(3)
11-
_PROG_SHIFTCTRL = const(4)
12-
_PROG_OUT_PINS = const(5)
13-
_PROG_SET_PINS = const(6)
14-
_PROG_SIDESET_PINS = const(7)
15-
_PROG_MAX_FIELDS = const(8)
10+
_PROG_OFFSET_PIO2 = const(3)
11+
_PROG_EXECCTRL = const(4)
12+
_PROG_SHIFTCTRL = const(5)
13+
_PROG_OUT_PINS = const(6)
14+
_PROG_SET_PINS = const(7)
15+
_PROG_SIDESET_PINS = const(8)
16+
_PROG_MAX_FIELDS = const(9)
1617

1718

1819
class PIOASMError(Exception):
@@ -50,7 +51,7 @@ def __init__(
5051
| autopull << 17
5152
| autopush << 16
5253
)
53-
self.prog = [array("H"), -1, -1, execctrl, shiftctrl, out_init, set_init, sideset_init]
54+
self.prog = [array("H"), -1, -1, -1, execctrl, shiftctrl, out_init, set_init, sideset_init]
5455

5556
self.wrap_used = False
5657

ports/rp2/rp2_pio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ enum {
212212
PROG_DATA,
213213
PROG_OFFSET_PIO0,
214214
PROG_OFFSET_PIO1,
215+
PROG_OFFSET_PIO2,
215216
PROG_EXECCTRL,
216217
PROG_SHIFTCTRL,
217218
PROG_OUT_PINS,

0 commit comments

Comments
 (0)