State Machine IO Mapping #10945
Unanswered
rp2wurm
asked this question in
RP2040 / Pico
Replies: 1 comment
-
Solution found, this is how it works: import rp2 machine.freq(120000000) sm = rp2.StateMachine(0, blink, freq=2000, set_base=Pin(0)) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The PIO state machine of the RP2040 is the highlight of the controller. Unfortunately not quite easy, as I just realize.
The small program generates a signal only on port0, Desired would be also a signal on port1. I suspect it's the IO mapping, but I can't get any further. What do I have to change?
_import rp2
from machine import Pin
@rp2.asm_pio(set_init=rp2.PIO.OUT_LOW)
def blink():
set(pindirs, 0b11) #two pins are output
wrap_target()
set(pins, 3) [1] # 0 and 1 on
set(pins, 0) [1] # all off
wrap()
sm = rp2.StateMachine(0, blink, freq=2000, set_base=Pin(0))
sm.active(1)
Thanks
Beta Was this translation helpful? Give feedback.
All reactions