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

Busrt read 128 byte FIFO using SPI

Hallo,

I am trying to communicate MAX86140 sensor with nrf52840DK. This is the link to the datasheet of MAX86140/1.  I am able to write and read MAX registers successfully. 

MAX86140 consist of a 128 byte FIFO which has to be burst read for data, The first byte is the address, second byte the command and from third byte onwards i am suppose to read values of MISO lines according to the datasheet (Page 53).

I saw in the nrf SPI example that we use  nrf_drv_spi_transfer() function. Is it possible to burst read the FIFO using the available nrf SPI driver in the example? Could you please suggest the functions and the method that I have to consider here. So I can read and learn those important functions and make use of them. 

Thank you for your time.

Best regards,

Karlz

Parents
  • Hi,

    The nrf_drv_spi API can support up to 255 bytes of read/write in a single transfer. All you need to do is to increase the rx_/tx_buffer_length parameters passed to nrf_drv_spi_transfer() to the desired length. Note that the RX buffer will be filled while the first address byte being written, so if you want to read 128 bytes after this byte have been written, you need to increase the RX length with 1 byte to 129 bytes, and then ignore the first byte in the RX buffer.

    In nRF52840, even longer read/writes can be supported (up to 65535 bytes) using the nrfx_spim driver API.

    Best regards,
    Jørgen

Reply
  • Hi,

    The nrf_drv_spi API can support up to 255 bytes of read/write in a single transfer. All you need to do is to increase the rx_/tx_buffer_length parameters passed to nrf_drv_spi_transfer() to the desired length. Note that the RX buffer will be filled while the first address byte being written, so if you want to read 128 bytes after this byte have been written, you need to increase the RX length with 1 byte to 129 bytes, and then ignore the first byte in the RX buffer.

    In nRF52840, even longer read/writes can be supported (up to 65535 bytes) using the nrfx_spim driver API.

    Best regards,
    Jørgen

Children
Related