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

[Doubt] Accurate sampling with softdevice and ble_app_uart

Hello everyone.

I have been working on a project that involves DSP and BLE on nRF52832.

The firmware needs to sample an accelerometer signal every 1ms with high accuracy and having a total of 1024 samples. After the signal is sampled I perform a fft of the sampled signal. I would like to send the fft data series using a way like ble_app_uart example code.

I have tried the Timer interrupt, sampling process and ARM FFT without Softdevice, and they worked very well. When I tried to integrate this first code with ble_app_uart the code didn't work like before.

In this case, softdevice interruptions have a higher priority than the timer priority. I would like to know how to do a sampling with high precision and work with the softdevice.

I have seen similar topics, some people using the Radio Timeslot API and others using the PPI API. I need guidance on how to proceed with this project. I am using the nRF SDK 16.0.0. I am evaluating the possibilities of how to proceed in the development. Shall I need to implement a Radio Timeslot API or PPI Channel ?

Best Regards.
Parents
  • Can you please tell me how much CPU processing it took to process those 1024 samples of fft data? I am guessing quite a lot.

    Can you enable one gpio pin, set it high everytime you start the sampling and clear it every time you finish the sampling (every 1ms) I want to see how much window in that 1 ms, your program is using the CPU. 

    Also how do you transfer the sampled value? as soon as you sampled it or you can buffer them and transfer them when you are not sampling?

Reply
  • Can you please tell me how much CPU processing it took to process those 1024 samples of fft data? I am guessing quite a lot.

    Can you enable one gpio pin, set it high everytime you start the sampling and clear it every time you finish the sampling (every 1ms) I want to see how much window in that 1 ms, your program is using the CPU. 

    Also how do you transfer the sampled value? as soon as you sampled it or you can buffer them and transfer them when you are not sampling?

Children
  • Well. When I fill a vector with 1024 samples I disable the timer interrupt. Without Timer interrupt I have free time to process the FFT function. After the FFT process I send the fft data over UART. But now I wanna transfer the FFT data over BLE Uart.

  • How often did you transmit data on UART, I mean to ask what is the interval of data transmission of your 1024 samples. If you choose a large connection interval and select a larger MTU packet to transmit data ONLY WHEN available, I think you should be able to do this.

    Can you let me know your

    1. connection interval used for BLE 
    2. size of your 1024 samples to be transmitted
    3. time it takes for the FFT to process your data
    4. MTU size of the BLE packets

    Based on this information you can tell if you are processing the samples too fast to fit into your connection interval/MTU configuration. This is something you need to fine tune to suit your application.

Related