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

nRF52 SDK12.2 SPI master and AD7793

Howdy. I have some trouble when trying to communicate with AD7793 using SPI.

I used ble_app_uart example and combined it with the SPI master example and the general driver from analog. I set up SPI at 1Mhz, and I disabled the SPI event by sending a null pointer, like this

nrf_drv_spi_init(&spi, &spi_config, NULL);

i use

CS_low;

nrf_drv_spi_transfer(&spi, &data, 1, m_rx_buf, 1);

CS_high;

where I expect to send one byte of data (0x60, verified with logic analyzer) and recieve another byte (ack from the ADC) - I get no response from the ADC, and I notice the following:

  • SCK is sometimes going for 8 bit, and other times for 16 bit
  • i control chip select manually but it seems to be pulled up much sooner after transfer than before
  • if i use nrf_delay_ms(1) between spi transfers, the signal is very inconsistent/jittery, is it some relative sleep or similar?

I'm stuck at why this is not working. Is there something shady with the SPI driver? I read it has limied throughput due to some interrupts. I am not sure where this interrupt is; but I am assuming it is between clock cycles instead of busywaiting? The final application is to be used with battery so I rather not use busywaits. I took some pictures of the clock thing, it's paused so the jitter was not captured.

Photos:

image description

image description

Best regards

Related