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

Separate BLE Tx from SPI/I2C operation

I have an application that first reads ADC sensor data from a SPI device, then transmits out through BLE. I have a 4ms timer; once it times out

  1. Read sensor data through SPI fuction calls
  2. Put data inside a BLE packet and send it out by calling ble_nus_string_send(). I use UART service to implement my application

Now I have an issue with the ADC data, there are spikes in the data values occasionally. We suspect it may be caused by the BLE transmission, because if I sends the data through UART, I see much less spikes in data.

So we want to do an experiment in which SPI calls and BLE tx are separated. For example, if in on_ble_evt() there is something like radio idle or tx done, then I make the SPI call.

For my current implementation, although I do the two things in sequence, I am not sure if ble_nus_string_send() immediately starts BLE tx.

Related