nrf_drv_saadc_abort doesn't raise SAADC DONE task

I have an application where I am using the SAADC to take ADC samples. At any point during the measurements, I want to be able to stop the samples prior to the ADC buffer filling completely. I've created a mock project of the general issue shown where the app_timer callback successfully calls the SAADC abort, however I don't receive a DONE task as the function description declares it does.

This is using the BLE SoftDevice as my intention is to essentially start ADC sampling from a BLE command. I will also be having a BLE command to provide an early stop to the measurements as well as activity detection to stop ADC sampling during movement, then resume afterwards (hence a timer interrupt occurs to stop the sampling as an expected time the ADC sampling would have completed if no activity was detected).

/**
 * @brief Function for aborting the ongoing and buffered conversions.
 *
 * @note @ref NRFX_SAADC_EVT_DONE event will be generated if there is a conversion in progress.
 *       Event will contain number of words in the sample buffer.
 *
 * @warning This function must not be called from the context of event handler of the SAADC driver
 *          or from the context of interrupt with priority equal to or higher than priority
 *          of the SAADC interrupt.
 */
void nrfx_saadc_abort(void);

Based on the above @warning I have attempted to use the abort directly from main() as well as ensuring the app_timer interrupt is a lower priority without success.

I have attached a dummy project based on the BLE App Template where I added the SAADC example where I also added an App Timer to abort the measurements early.

Any thoughts on the SAADC abort is not raising the DONE task or what I'm doing wrong here?

0654.ble_app_template.zip

Parents
  • Hi,

    I'm guessing that your basing your assumption on this comment regarding the driver function:

    NRFX_SAADC_EVT_DONE is a HW event that isn't propagated to the application in this case. Calling nrfx_saadc_abort() will trigger the task NRF_SAADC_TASK_STOP which again will generate the NRF_SAADC_EVENT_STOPPED.
     
    regards
    Jared 
Reply
  • Hi,

    I'm guessing that your basing your assumption on this comment regarding the driver function:

    NRFX_SAADC_EVT_DONE is a HW event that isn't propagated to the application in this case. Calling nrfx_saadc_abort() will trigger the task NRF_SAADC_TASK_STOP which again will generate the NRF_SAADC_EVENT_STOPPED.
     
    regards
    Jared 
Children
Related