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

HOW TO READ DATA FROM A REGISTER USING SPI

Hello, i have been unable to read data from my sensor. 

uint8_t SPI_ReadByte(uint8_t RegAddress)
{
ret_code_t retCode = NRF_SUCCESS;
//start reading sequence
m_tx_buf[0]=RegAddress|0x80;
m_tx_buf[1]=0x00;
retCode = nrf_drv_spi_transfer(&spi_master,
m_tx_buf, 3,
m_rx_buf, 3);
APP_ERROR_CHECK(retCode); // NRF_ERROR_BUSY

NRF_LOG_HEXDUMP_INFO(m_tx_buf,2);


return m_rx_buf[3];
}

Parents Reply Children
Related