summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@WG112.localdomain>2025-06-17 23:17:43 -0400
committerDamien George <damien@micropython.org>2025-08-01 22:38:00 +1000
commit769453c7504ebf71d65a57767fbeea41f2de63f4 (patch)
tree46c2eea7535d0ce20df21c56f6f76296646e3300
parentc9b52b2b7f164745eda7210ccf6640fce3737f59 (diff)
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 #17509. Signed-off-by: Matt Westveld <github@intergalacticmicro.com>
-rw-r--r--ports/rp2/modules/rp2.py15
-rw-r--r--ports/rp2/rp2_pio.c1
2 files changed, 9 insertions, 7 deletions
diff --git a/ports/rp2/modules/rp2.py b/ports/rp2/modules/rp2.py
index 606892603..442a802b3 100644
--- a/ports/rp2/modules/rp2.py
+++ b/ports/rp2/modules/rp2.py
@@ -7,12 +7,13 @@ from micropython import const
_PROG_DATA = const(0)
_PROG_OFFSET_PIO0 = const(1)
_PROG_OFFSET_PIO1 = const(2)
-_PROG_EXECCTRL = const(3)
-_PROG_SHIFTCTRL = const(4)
-_PROG_OUT_PINS = const(5)
-_PROG_SET_PINS = const(6)
-_PROG_SIDESET_PINS = const(7)
-_PROG_MAX_FIELDS = const(8)
+_PROG_OFFSET_PIO2 = const(3)
+_PROG_EXECCTRL = const(4)
+_PROG_SHIFTCTRL = const(5)
+_PROG_OUT_PINS = const(6)
+_PROG_SET_PINS = const(7)
+_PROG_SIDESET_PINS = const(8)
+_PROG_MAX_FIELDS = const(9)
class PIOASMError(Exception):
@@ -50,7 +51,7 @@ class PIOASMEmit:
| autopull << 17
| autopush << 16
)
- self.prog = [array("H"), -1, -1, execctrl, shiftctrl, out_init, set_init, sideset_init]
+ self.prog = [array("H"), -1, -1, -1, execctrl, shiftctrl, out_init, set_init, sideset_init]
self.wrap_used = False
diff --git a/ports/rp2/rp2_pio.c b/ports/rp2/rp2_pio.c
index 8fc7c0e78..611e74a15 100644
--- a/ports/rp2/rp2_pio.c
+++ b/ports/rp2/rp2_pio.c
@@ -212,6 +212,7 @@ enum {
PROG_DATA,
PROG_OFFSET_PIO0,
PROG_OFFSET_PIO1,
+ PROG_OFFSET_PIO2,
PROG_EXECCTRL,
PROG_SHIFTCTRL,
PROG_OUT_PINS,