You could of course use a loop to create the 12us delay, but yes if you actually want a fixed 12us delay then a slower clock could be sensible.I don't think I'll run it that fast: I think I'll end up using too much instructions waiting as I need to wait 12us before pulling ACK low (my sideset pin).
Note that if you are using 1 bit of side-set then you've only got 0-15 for the delay field (1-16 including the basic 1 cycle for the instruction itself), though typically when you want a delay like this you can find two or three instructions to spread the delay over.
However, for this application I'm not sure I would use side-set: using SET seems perhaps more convenient. Either way, if this is open-collector then it needs to be SETing or side-setting the PINDIRS rather than the pin.
While that's sensible generic advice, there's one specific aspect that applies when writing PIO programs: the assignment of signals to pins is critical. Certainly you should write your whole PIO program before wiring up a PCB, as the ordering of signals onto GPIO numbers often constrains what the program can do: when seeking best performance or minimal PIO instructions to make it fit, you often find you want the signals wired up in a different order to what you first tried.First, really make sure you understand the protocol inside and out.
Then, before touching C or Python, sketch out your plan using pseudo code in your normal spoken language
(like plain English). Just outline the steps.
Statistics: Posted by arg001 — Sat Apr 12, 2025 1:09 pm