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

SDK • PIO "IN X 1" ERROR?

$
0
0
Hi,
I want to read one input signal to populate a buffer through DMA.
If I read directly this signal with the instruction in pins 1 all works fine, but I need to make a XOR with the status of the same signal at previous acquisition. I have already developed a code to do this but doesn't work.
So I have simplified to debug it in this mode:

Code:

.program write_newbyteloop:sety, 7bitloop:    mov x pins; OR IS THIS TEST THAT DOESEN'T WORK?jmp!x, set_0jmp set_1set_1:set x 1    in x 1; THIS DON'T WORK    in pins 1; THIS WORK    jmp test_byte_completed    set_0:    set x 0    in x 1; THIS DON'T WORK    in pins 1; THIS WORK    jmp test_byte_completedtest_byte_completed:jmp y-- bitloop    push    jmp byteloop% c-sdk {static inline void write_new_program_init(PIO pio, uint sm, uint offset, uint pin) {    pio_sm_config c = write_new_program_get_default_config(offset);    sm_config_set_in_pins(&c, pin);    //pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, false);// NOT NECESSARY ?    pio_gpio_init(pio, pin);    sm_config_set_in_shift(&c, SHIFT_LEFT, false, 8);    sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_RX);    sm_config_set_clkdiv(&c,        pio_sm_init(pio, sm, offset, &c);                       // Load configuration and jump to start of program}%}
I have checked the code with this emulaotr https://github.com/GitJer/Some_RPI-Pico ... e_emulator and works fine, but is an emulator!

Thank's in advance for the help!

Crovy

Statistics: Posted by crovy — Tue Jan 14, 2025 5:23 pm — Replies 1 — Views 41



Viewing all articles
Browse latest Browse all 4640

Trending Articles