SPI read uint16_t

Hi, 

I need to read 16-bit values from a sensor using SPI on the NRF52840. However, since the SPI peripheral only supports an 8-bit word length, what is the best way to handle this?

Would setting spi_buf_set.count to 2 and using two separate spi_buf structures—one for the lower and one for the higher byte—be the correct approach? Or is there a better method?

Could you provide a sample implementation for this?

Parents Reply Children
  • Hi,

    We in tech support try to our best ability to help customers on a daily basis, in this specific case there are no specific issues beyond studying existing examples that already use SPI and implement in your own project. In addition I have provided an example on how to bit shift two bytes into an 16bit value. We do no have resources to make example for each request.

    Kenneth

Related