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

ADXL372 integration with nrf51822

I am trying to interface ADXL372 with nrf51822 using SPI interface.

Tried merging this code in SPI master example:

https://github.com/analogdevicesinc/arduino/blob/master/Arduino%20Uno%20R3/examples/ADXL372_example/ADXL372_example.ino

But I am not getting the required data.

Need help to get adxl372 working with SPI.

Below is the function I tried:

int spi_write_then_read(adxl_spi_handle *spiTransfer,
                               unsigned char *txbuf,
                               unsigned n_tx,
                               unsigned char *rxbuf,
                               unsigned n_rx)
{
  unsigned char count;
  int err = 0;
	uint32_t err_code;
	while(spi_master_get_state(SPI_MASTER_0) != SPI_MASTER_STATE_IDLE);
	err_code = spi_master_send_recv(SPI_MASTER_0, txbuf, n_tx, rxbuf,n_rx);
	APP_ERROR_CHECK(err_code);
	return err;
}

Parents Reply Children
No Data
Related