PIO @asm_pio decorator out_init=() limit of 8 gpio

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
thetestdoctor
Posts: 5
Joined: Fri Feb 26, 2021 11:26 pm
Location: Scotland

PIO @asm_pio decorator out_init=() limit of 8 gpio

Post by thetestdoctor » Sat Feb 27, 2021 12:01 am

I am trying set 10 gpio pins using the PIO, with a base pin of 6, gpio 6-15 should be set to low using the code below.
The 2 highest gpio pins (14 & 15) are not driven & float high (checked on a scope). I have tried another Pico & moving
the base bin with the same results, the upper 2 pins don't get driven. The code re-written in C works fine.

Am I missing something here or is there a limit in Micropython of 8 pins in the asm_pio decorator out_init=().

Many thanks.

Code: Select all

from rp2 import PIO, StateMachine, asm_pio
from machine import Pin

@asm_pio(out_init=(PIO.OUT_LOW, PIO.OUT_LOW, PIO.OUT_LOW, PIO.OUT_LOW,
                   PIO.OUT_LOW, PIO.OUT_LOW, PIO.OUT_LOW, PIO.OUT_LOW,
                   PIO.OUT_LOW, PIO.OUT_LOW),
         out_shiftdir=PIO.SHIFT_RIGHT, autopull=True, pull_thresh=10)
def limited():
    out(pins, 10)

sm1 = StateMachine(1, limited, freq=1000, out_base=Pin(6))
sm1.active(1)
sm1.put(0x00)

User avatar
Roberthh
Posts: 3668
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: PIO @asm_pio decorator out_init=() limit of 8 gpio

Post by Roberthh » Sat Feb 27, 2021 6:49 am

I stubled over that too a few day ago. See https://github.com/micropython/micropython/issues/6933 and the PR for fixing the bug: https://github.com/micropython/micropython/pull/6938. I do not know when this will be fixed in the daily builds.

thetestdoctor
Posts: 5
Joined: Fri Feb 26, 2021 11:26 pm
Location: Scotland

Re: PIO @asm_pio decorator out_init=() limit of 8 gpio

Post by thetestdoctor » Sat Feb 27, 2021 1:29 pm

Many Thanks for that, I did think it was a bug. Not a big deal as I am just tinkering about but thought I would mention it in case someone else has the same issue & to push it back so it gets fixed as some point.

Post Reply