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

Advertising and Fast ADC Sampling

Hi, I am a newbie. I understand that a similar question was asked earlier, but I couldn't get an answer specific to my questions. My goal is to sample an analog signal at 40 KHz with 8 bit resolution, do some processing and advertise one integer value as manufacturer specific data. I understand from S110_SoftDevice_Specification_2.0 that the CPU halts during BLE events and there is advertising latency. Without the SoftDevice, I can do this as the ADC of nrf51822 (Rev3) can sample at 50KHz with 8 bit resolution. With the SoftDevice however, I can only sample at 1KHz. Is it possible to actually sample at 40 KHz with the SoftDevice? If not, what's the maximum sampling rate that I can get? Will the Time Slot API help? Thanks in advance!

Parents
  • What you did not mention is how you are timing your ADC acquisition. Are you using a busy loop approach where you take a reading, sleep for 25uS (period of a 40KHz) and then acquire again or are you using a timer?

    If you use a busy loop, it will be much more sensitive to soft device events than a timer based approach.

    In a timer based approach, you set a timer for your sample period and use that timer to trigger the next acquisition. That way the CPU spends as much time as possible "idle" and the soft device does not have to compete with 100% processor load of a no-op busy loop.

    I can't promise 40KHz is achievable, I think it should be. But if you can only achieve 1KHz, you're probably doing it wrong.

    Hope that helps. David

Reply
  • What you did not mention is how you are timing your ADC acquisition. Are you using a busy loop approach where you take a reading, sleep for 25uS (period of a 40KHz) and then acquire again or are you using a timer?

    If you use a busy loop, it will be much more sensitive to soft device events than a timer based approach.

    In a timer based approach, you set a timer for your sample period and use that timer to trigger the next acquisition. That way the CPU spends as much time as possible "idle" and the soft device does not have to compete with 100% processor load of a no-op busy loop.

    I can't promise 40KHz is achievable, I think it should be. But if you can only achieve 1KHz, you're probably doing it wrong.

    Hope that helps. David

Children
No Data
Related