nRFX I2S: Using the same buffer for RX and TX in full duplex mode?

Hello,

I'm debugging an I2S issue on the nRF5340 DK, using a third party wrapper around the nRFX I2S API. I noticed that this wrapper uses the same buffer for RX and TX in full duplex mode, i.e the same value for the p_rx_buffer and p_tx_buffer pointers in nrfx_i2s_buffers_t. Before I dig deeper, I just wanted to check if this is reasonable or if two different pointers should be used.

Parents Reply Children
  • The RX buffer will contain the received data, while the TX buffer will contain the data you want to send, so you should use different pointers for the buffers.

    This is how it's done in the nRF5 SDK v17.1 (examples/peripheral/i2s/main.c), which uses the nrfx layer indirectly through the nrf_drv layer.

    static uint32_t m_buffer_rx[2][I2S_DATA_BLOCK_WORDS];
    static uint32_t m_buffer_tx[2][I2S_DATA_BLOCK_WORDS];
    .
    .
    .
    nrf_drv_i2s_buffers_t const initial_buffers = {
        .p_tx_buffer = m_buffer_tx[0],
        .p_rx_buffer = m_buffer_rx[0],
    };

    Is your goal to send out the exact same data as you receive?

Related