nrf52832.
SDK14.2
Segger ES V3.34a
I am using nrf_drv_saadc_calibrate_offset() and find the next sample immediately after the calibration is erroneous.
There is an errata for this [86]. This suggests the following...
Workaround
Calibration should follow the pattern STOP -> STOPPED -> CALIBRATEOFFSET -> CALIBRATEDONE -> STOP -> STOPPED -> START.
I have tried to implement this, which has improved the problem, although 1 in 4 calibrations still cause the erroneous first sample.
implemented every 100 ADC events
nrf_drv_saadc_abort(); // Abort all ongoing conversions. Calibration cannot be run if SAADC is busy
NRF_LOG_INFO("SAADC calibration starting... \r\n");
while(nrf_drv_saadc_calibrate_offset() != NRF_SUCCESS); //Trigger calibration task
nrf_saadc_disable();
while(NRF_SAADC->STATUS == (SAADC_STATUS_STATUS_Busy << SAADC_STATUS_STATUS_Pos))
{}
nrf_saadc_enable();
while(NRF_SAADC->STATUS == (SAADC_STATUS_STATUS_Busy << SAADC_STATUS_STATUS_Pos))
{}
Then...continue with ADC samples as normal.
I am tempted not to bother with the workaround and just discard the first sample after a calibration.
Has anyone else implemented this workaround successfully?