You are wasting two instructions loading r0 with your compare value,
remove these and use a bit test instruction instead (QBBS/QBBC), or
since you're reading r31, you can use wait until bit set/clear (WBS/WBC).
You don't need to jump to a label that represents the next
instruction, just go ahead and fall-through and execute it.
wait_one_to_zero:
qbbs wait_one_to_zero, r31, 16
mov r30, r2
// Now, wait for a low to high transition.
wait_zero_to_one:
qbbc wait_zero_to_one, r31, 16
mov r30, r3
// Now, wait for a high to low transition.
jmp wait_one_to_zero
You can get marginally better performance if you unroll the loop (so
you have 8 or 16 or however many cycles before you perform the jmp
back to wait_one_to_zero), but you may or may not be able to do that.
Also, as you noted, there is likely some latency between the PRU and
the input and output pins. If you are only using one direction, the
latency doesn't matter and you can see or generate 5nS wide pulses,
but if you need to loop input to output (or output to input) any
latency becomes important. I have not measured this latency, but I
would expect it to be at least one clock cycle each way. If you do
measure this in-circuit, please share your results.
> --
> For more options, visit
http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to
beagleboard...@googlegroups.com
> <mailto:
beagleboard...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/beagleboard/37ece5ec-31b9-4ee6-81b9-b3a732b69184%40googlegroups.com
> <
https://groups.google.com/d/msgid/beagleboard/37ece5ec-31b9-4ee6-81b9-b3a732b69184%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit
https://groups.google.com/d/optout.
>
--
Charles Steinkuehler
cha...@steinkuehler.net