Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8042

General • Re: Pico 2 synchronising multiple PIO SMs

$
0
0
With RP2350 can do this:
The system can start and stop each state machine at any time, via the CTRL register. Multiple state machines can be
started simultaneously, and the deterministic nature of PIO means they can stay perfectly synchronised.
Pico Examples: https://github.com/raspberrypi/pico-exa ... uarewave.c Lines 63 - 67
63 // Set the state machine running. The PIO CTRL register is global within a
64 // PIO instance, so you can start/stop multiple state machines
65 // simultaneously. We're using the register's hardware atomic set alias to
66 // make one bit high without doing a read-modify-write on the register.
67 hw_set_bits(&pio->ctrl, 1 << (PIO_CTRL_SM_ENABLE_LSB + 0));
Also can do it across PIO blocks:
• CTRL.NEXT_PIO_MASK and CTRL.PREV_PIO_MASK apply some CTRL register operations to state machines in
neighbouring PIO blocks simultaneously.
◦ CTRL.NEXTPREV_SM_DISABLE stops PIO state machines in multiple PIO blocks simultaneously.
◦ CTRL.NEXTPREV_SM_ENABLE starts PIO state machines in multiple PIO blocks simultaneously.
◦ CTRL.NEXTPREV_CLKDIV_RESTART synchronises the clock dividers of PIO state machines in multiple PIO
blocks
P.S.Better not to use clock divider as arg001 said before.

Statistics: Posted by gmx — Tue Feb 25, 2025 2:00 pm



Viewing all articles
Browse latest Browse all 8042

Trending Articles