Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SAADC calibration doesn't generate DONE events consistently

Hi,

I'm working with the SAADC on an NRF52832. I'm using the SAADC driver from SDK15.2.

I have a problem with the calibration routine because it's generating DONE events inconsistently. Every time I get a done event, I queue a new buffer for conversion. The problem happens because I have an APP_ERROR_CHECK after the nrf_drv_saadc_buffer_convert call and this fails sometimes due to the done event generated by the calibration.

In my current implementation, this would consistently crash my application if the calibration triggered done events all the time, but it doesn't.

I "worked around" the problem by just removing the APP_ERROR_CHECK and allowing this call to fail sometimes due to random done events triggered by the calibration procedure.

My question is: Is there an actual pattern in which the calibration procedures triggers DONE events?

The documentation just states the following:

/**
 * @brief Function for triggering the ADC offset calibration.
 *
 * This function is non-blocking. The application is notified about completion by the event handler.
 * Calibration will also trigger DONE and RESULTDONE events.
 *
 * The function will fail if ADC is busy or calibration is already in progress.
 *
 * @retval NRFX_SUCCESS    If calibration was started successfully.
 * @retval NRFX_ERROR_BUSY If the ADC driver is busy.
 */

The sentence "Calibration will also trigger DONE and RESULTDONE events" to me sounds like it should ALWAYS trigger the events.

Related