Skip to content

PIO conditional jump based on fifo value #15458

Discussion options

You must be logged in to vote

... and sometimes, it helps to just spell out the problem to find a solution. I think I can use this MSB of the command word as a read/write indicator, as I only have to control 14 GPIO pins:

    READ_MASK = 0b10000000_00000000_00000000_00000000

and

    # Output data bits to pins (DATA, CLK, DIR, STB, ADDR + extra)
    out(pins, 16)
    # Output pindirs bits to set pin directions (MSB of command word is read/write indicator)
    out(pindirs, 15)

    # Wait for falling edge on CLK
    wait(0, pin, CLK_PIN)

    # Skip reading for write cycle (MSB = 0)
    mov(x, osr)
    jmp(not_x, "finish_cycle")

    # Read 8 bits from input pins to ISR.
    in_(pins, 8)
    # Push ISR content to FIFO
…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hanshuebner
Comment options

@hanshuebner
Comment options

Answer selected by hanshuebner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants