This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPIM data transfert depends on Rx buffer

Hello,

I have configured the SPI0 module in master mode with EasyDMA. I use the below code to send data 

    uint8_t rx_buffer[24]="";
    uint8_t tx_buffer[] = "SPIM TEST";

    nrfx_spim_xfer_desc_t  spim_xfer_desc =
    {
        .p_rx_buffer = rx_buffer,
        .rx_length   = sizeof(rx_buffer),
    };

    spim_xfer_desc.p_tx_buffer = ( uint8_t*)tx_buffer;
    spim_xfer_desc.tx_length   = strlen(tx_buffer);        

    result = nrfx_spim_xfer(&_t_spi_inst, &spim_xfer_desc, 0);

In the output I get  the string "SPIM TEST" and with extra 0xFF bytes. I noticed that the total number of bytes corresponds to the rx_length ?

I reduced the rx_length to 4 bytes and I was able to receive the right amount of bytes on the output !

I did the same thing with the spi example and got the same results. Is this the normal behavior of the module ?

Thank you

Parents Reply Children
No Data
Related