I haven't used PIO yet, just trying to ascertain if it has the functionality I need, which is generating a non-uniform pulse pattern. Based on PIO instruction set, it shouldn't be a problem, but my application also needs a pause feature, i.e. when a button is pressed the pulses stop and must resume from exactly the same point when the button is released. Can pio_sm_set_enabled() be used for this purpose? If not, is it possible by other means?
After reading the documentation, I'm rephrasing my question: will the state of PIO be preserved between these actions:
Disable/enable is not listed here:
This paragraph describes only disabling, but seems to indicate "run/halt" with the state preserved:
I've seen a similar topic at viewtopic.php?t=324305, but it doesn't answer my question.
After reading the documentation, I'm rephrasing my question: will the state of PIO be preserved between these actions:
◦ 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.
Disable/enable is not listed here:
Does it mean it can't be used to pause PIO?State machines may momentarily pause execution for a number of reasons:
• A WAIT instruction’s condition is not yet met
• A blocking PULL when the TX FIFO is empty, or a blocking PUSH when the RX FIFO is full
• An IRQ WAIT instruction which has set an IRQ flag, and is waiting for it to clear
• An OUT instruction when autopull is enabled, and OSR has already reached its shift threshold
• An IN instruction when autopush is enabled, ISR reaches its shift threshold, and the RX FIFO is full
In this case, the program counter does not advance, and the state machine will continue executing this instruction on
the next cycle. If the instruction specifies some number of delay cycles before the next instruction starts, these do not
begin until after the stall clears.
This paragraph describes only disabling, but seems to indicate "run/halt" with the state preserved:
Do I read it correctly?SM_ENABLE: Enable/disable each of the four state machines by writing 1/0 to each of these four bits. When disabled, a state machine will cease executing instructions, except those written directly to SMx_INSTR by the system. Multiple bits can be set/cleared at once to run/halt multiple state machines simultaneously.
I've seen a similar topic at viewtopic.php?t=324305, but it doesn't answer my question.
Statistics: Posted by pauljurczak — Sat Dec 13, 2025 8:02 pm — Replies 0 — Views 37