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

nRF52840 - ADS1292

Hi,

I want to read register 0x00 (chip ID) of ads1292. i do following...

=============================================================================================================================

///// init spi /////

spi_config.ss_pin = ARDUINO_7_PIN;
spi_config.miso_pin = ARDUINO_12_PIN;
spi_config.mosi_pin = ARDUINO_11_PIN;
spi_config.sck_pin = ARDUINO_13_PIN;
spi_config.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST;
spi_config.mode = NRF_DRV_SPI_MODE_0;
spi_config.frequency = NRF_DRV_SPI_FREQ_4M;
spi_config.orc = 0x00;
APP_ERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config, spi_event_handler, NULL));
NRF_LOG_INFO("SPI example started.");NRF_LOG_FLUSH();

///// reset the board by pulling low hardware pin /////

nrf_gpio_pin_write(ADS1292_PWDN_PIN, action);

delay(100);

nrf_gpio_pin_write(ADS1292_PWDN_PIN, action);

delay(100);

nrf_gpio_pin_write(ADS1292_PWDN_PIN, action);

delay(100);

/////// stop continues data receive mode ///////

spi_xfer_done=false;memset(m_rx_buf,0,sizeof(m_rx_buf));
spiDataTx[0]=0x11;
APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, spiDataTx, 1, m_rx_buf, sizeof(m_rx_buf)));
while (!spi_xfer_done){__WFE();}
NRF_LOG_FLUSH();

//////// read chip id register (0x00) ///////////

char tempData[3];
tempData[0]=0x20;
tempData[1]=0x00;
tempData[2]=0x00;
spi_xfer_done=false;memset(m_rx_buf,0,sizeof(m_rx_buf));
APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, tempData, 3, m_rx_buf, sizeof(m_rx_buf)));
while (!spi_xfer_done){__WFE();}
NRF_LOG_FLUSH();

=============================================================================================================================

but i always get garbage value. It should come as 0x73 but every time receiving garbage values.

i did exactly same as described in datasheet of ads1292.

Did i anything wrong as far as nRF52 board concern ? Waiting for better solution.

Thanks in advance.

Parents Reply Children
No Data
Related