nRF52832 SPI tx rx

Hi

I'm developing nRF52832.

I have a question about SPI communication.(\nRF5_SDK_17.0.0\examples\peripheral\spi I don't understand, so I ask questions.)

I want to read sensor data through SPI communication, but I don't know how to separate Tx and Rx into nrf_drv_spi_transfer.

Example.

1-1. If I want to read the 0x00 register address, is it right to set it up like below?

1-2. When I read the 0x00 register address, do I have to read the register address + 0x00?

2-1. Is this the right way to use data through SPI?

Thank you.

Parents
  • Hi Minseo

    1-1. If I want to read the 0x00 register address, is it right to set it up like below?

    Sensors use different ways to read registers. The datasheet of your sensor should explain how to do this.

    In the SPI Peripheral sample you are using, the spi_event_handler is called after messages are received. You must wait until this is called before reading the m_rx_buf to read your data.

    To ensure that SPI is sending data on the lines, I recommend to use an oscilloscope or logic analyzer to probe the SPI lines. This is also useful to get insight into the workings of SPI.
    And it can be used to verify that the data sent on SPI is correctly formatted.

    Regards,
    Sigurd Hellesvik

Reply
  • Hi Minseo

    1-1. If I want to read the 0x00 register address, is it right to set it up like below?

    Sensors use different ways to read registers. The datasheet of your sensor should explain how to do this.

    In the SPI Peripheral sample you are using, the spi_event_handler is called after messages are received. You must wait until this is called before reading the m_rx_buf to read your data.

    To ensure that SPI is sending data on the lines, I recommend to use an oscilloscope or logic analyzer to probe the SPI lines. This is also useful to get insight into the workings of SPI.
    And it can be used to verify that the data sent on SPI is correctly formatted.

    Regards,
    Sigurd Hellesvik

Children
Related