Hello Forum,
Im currently using the pio I2C example.
Im using a RP2350 with sdk 2.2.0.
I have noticed that as soon as I start the bus scan example my program gets stuck in an infinite loop.
I have a logic analyser that shows me that it does a address 1 read and it receives a NACK.
I have used the debugger to catch where the problem goes wrong and I narrowed it down to the fact it has still something in the TX buffer.
I assume that it wants to proceed to the next address but somehow the TX buffer is still full so it stays in the following while loop
I have seen that people use the mov isr null option after the jmp deciding if its a ack or nack but this doesnt work.
Am I doing something wrong or is this program just flawed?
Im currently using the pio I2C example.
Im using a RP2350 with sdk 2.2.0.
I have noticed that as soon as I start the bus scan example my program gets stuck in an infinite loop.
I have a logic analyser that shows me that it does a address 1 read and it receives a NACK.
I have used the debugger to catch where the problem goes wrong and I narrowed it down to the fact it has still something in the TX buffer.
I assume that it wants to proceed to the next address but somehow the TX buffer is still full so it stays in the following while loop
Code:
void pio_i2c_put_or_err(PIO pio, uint sm, uint16_t data) { while (pio_sm_is_tx_fifo_full(pio, sm)) if (pio_i2c_check_error(pio, sm)) return; if (pio_i2c_check_error(pio, sm)) return; // some versions of GCC dislike this#ifdef __GNUC__#pragma GCC diagnostic push#pragma GCC diagnostic ignored "-Wstrict-aliasing"#endif *(io_rw_16 *)&pio->txf[sm] = data;#ifdef __GNUC__#pragma GCC diagnostic pop#endif}Am I doing something wrong or is this program just flawed?
Statistics: Posted by Elixz89 — Tue Dec 16, 2025 12:31 pm