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?