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

Having to set NRF_SAADC->TASKS_SAMPLE in continuous mode on ADC

Running the ADC in continuous mode, but it seems we still have to set NRF_SAADC->TASKS_SAMPLE in a while loop. Shouldn't this not have to be set? In continuous mode we shouldn't have to trigger each conversion. I need the CPU to be able to sleep/work on other tasks, but with this it seems like we have to busy wait.

What's the solution to keep running the adc continuously and be able to sleep/work on other things?

  • Hello,

    Running the ADC in continuous mode, but it seems we still have to set NRF_SAADC->TASKS_SAMPLE in a while loop. Shouldn't this not have to be set? In continuous mode we shouldn't have to trigger each conversion.

    The continuous mode needs the SAMPLE task to be called, but you can avoid having to use the CPU for this if you connect the SAMPLE task to another event using PPI instead.

    What's the solution to keep running the adc continuously and be able to sleep/work on other things?

    The recommended way to keep the SAADC sampling continuously without requiring CPU interference is to use PPI and a timer (or other event) to trigger the SAMPLE task.
    You can see how this is done in the SAADC example in the SDK. The example shows how to have the SAADC sampling periodically using PPI and a timer, with double buffering - only requiring the CPU to act when the current buffer is filled.

    I was recently (couple of days ago) made aware that the documentation for the SAADC continuous mode is inaccurate, as it does not mention the need to trigger the SAMPLE task. I have created an internal ticket about this with our technical writers, and marked it for review. Sorry for any confusion this might have caused.

    Best regards,
    Karl

Related