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

General • Squeezing PIO

$
0
0
I would like to add one instruction to rp2040_sdio.pio (originally from ZuluSCSI-firmware sdio_RP2MCU.pio), but when I tried it, I discovered that it is already at the limit of the PIO block's 32-slot instruction memory.

Specifically, I'd like to change

Code:

wait_resp:    nop                  side 0 [D0]    jmp PIN wait_resp    side 1 [D1]    ; Loop until SDIO_CMD = 0
to

Code:

wait_resp:    nop                  side 0 [D0]    nop                  side 1 [0]    jmp PIN wait_resp    side 1 [0]    ; Loop until SDIO_CMD = 0
I have tried to educate myself about PIO, but I'm still a novice. I haven't been able to find any instructions that I can eliminate. I looked into trying to move some of the instructions outside of the PIO instruction memory by using things like pio_sm_exec, however state machine 0 is used to generate continuous clock on SDIO_CLK and pio_sm_exec disrupts that. Can you see a way to squeeze in one more instruction?

The best alternative I've been able to come up with would be to redesign the whole thing such that I could stop the state machine between transactions, like SdFat's Rp2040Sdio, but that is a lot more change than I was bargaining for, and I would like to maintain similarity to ZuluSCSI-firmware to make it easier to track changes made there. There could also be an adverse impact to performance.

Statistics: Posted by carlk3 — Tue Apr 22, 2025 7:50 pm



Viewing all articles
Browse latest Browse all 8013

Trending Articles