Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

nrfx_saadc_abort in SAADC API V2

I'm using nrfx_saadc V2 in nRF5 SDK 17.0.2. In nrfx_saadc_abort nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP); is called regardless of if the ADC is currently running. If the ADC is not running this pending task causes several mA of current consumption. It is worth noting that nrfx_saadc_abort is called in nrfx_saadc_uninit, so trying to stop or uninit the SAADC causes excessive current consumption if the ADC was not running.

  • Hello again, 

    Thank you for your continued patience with this.

    I have just gotten back to this, and after examining the driver more closely it seems that the NRFX_ASSERT at the beginning of nrfx_saadc_abort should have triggered to alert you to the fact that the abort call was made when the SAADC was already uninitialized. In general, calling HAL or driver functions on an uninitialized peripheral may produce undefined behavior.

    To avoid this happening in the future, I would recommend that you defined DEBUG_NRF in your preprocessor defines during your development, so that the NRFX_ASSERTS are enabled. This way, you will be notified if this or something similar ever happens again in the future. After having tested and verified your application you can safely remove the DEBUG_NRF define.

    Best regards,
    Karl

Related