Running nrf_drv_saadc_calibrate_offset() doesn't seem to work. I'm monitoring a 3v battery. Shown below is the debug output where the calibration is run after the event number 4. As you can see, the voltage is reading what is should (scaled by 1000) before the calibration, but reads 3600 on each event after the calibration, never moving.
ADC event number: 0
2960
ADC event number: 1
2960
ADC event number: 2
2949
ADC event number: 3
2953
ADC event number: 4
2953
ADC event number: 5
3600
ADC event number: 6
3600
ADC event number: 7
3600
if (m_saadc_calibrate)
{
nrf_drv_saadc_abort();
while(nrf_drv_saadc_calibrate_offset() != NRF_SUCCESS);
while(!nrf_saadc_event_check(NRF_SAADC_EVENT_CALIBRATEDONE));
m_saadc_calibrate = false;
}
This is the code that runs the calibrate in the main forever loop. m_saadc_calibrate is set in saadc_callback().