Use software NRZI encoder to reduce PIO usage #117
Replies: 4 comments 5 replies
-
This can likely reduce three instructions. (not tested) start:
; set x, 0
.wrap_target
set_y:
set y, BIT_REPEAT_COUNT
irq_wait:
wait 1 irq DECODER_TRIGGER ; wait signal from edge detector
+ jmp !y flip ; ignore stuff bit, without error check
jmp PIN pin_high
pin_low:
- jmp !y flip ; ignore stuff bit, without error check
jmp !x K1
K2:
; x==1
- in null, 1
- jmp flip
+ jmp J1
K1:
; x==0
in osr, 1
jmp y-- irq_wait
pin_high:
- jmp !y flip ; ignore stuff bit, without error check
jmp !x J1
J2:
; x==1
- in x, 1
- jmp y-- irq_wait
+ jmp K1 ; y is never 0 at here
J1:
; x==0
in null, 1
flip:
mov x, ~x
.wrap |
Beta Was this translation helpful? Give feedback.
-
TX pio instructions will be like this
|
Beta Was this translation helpful? Give feedback.
-
https://github.com/sekigon-gonnoc/Pico-PIO-USB/tree/single-pio This worked as an FS/LS host with single PIO. I have not yet confirmed the connection via a hub and the devices. |
Beta Was this translation helpful? Give feedback.
-
Will this code that reduces the PIO usage allow an adafruit usb host feather to use the neopixel? I believe it needs PIO for the timing so perhaps this will allow them both to run |
Beta Was this translation helpful? Give feedback.
-
Currently, the TX state machine performs NRZI encoding, utilizing one PIO state machine and 22 instructions. If we pre-execute this encoding in software, we can reduce the number of instructions to three.
Then, if we could reduce the number of instructions used for RX by three, we could reduce the total number of PIOs used for PIO-USB to one.
Beta Was this translation helpful? Give feedback.
All reactions