Hi,
I am using an nRF52832 with S132 and SDK v15.0.0 and already read in the forum about issues related to the SAADC calibration (inlcuing the erratum [86]). The problem I have is that the ADC constantly (not only once!) delivers wrong data after I call the calibrate_offset function.
The stuff that happens over time is basically:
-> The SAADC is initialised
-> the channels (2) are initialised
-> the buffer_convert function is called
-> (because the buffer-convert funtion was already called and the SAADC is in IDLE although no START or SAMPLE task was triggered yet) -> the nrfx_saadc_abort() function is called
This is the first point, where somthing goes wrong since sometimes the nrfx_saadc_abort() itself hangs when waiting for the SAADC to become IDLE again. Do I have to do a dummy TASK_SAMPLE before calling the abort function so that a conversion is in progress? it seems that simply aborting without issuing a SAMPLE before fails in waiting for "NRFX_WAIT_FOR((m_cb.adc_state != NRF_SAADC_STATE_IDLE), HW_TIMEOUT, 0, result);". (But I have to call the abort function to get into IDLE after calling buffer_convert?)
-> nrfx_saadc_calibrate_offset() is called
-> The values i get from this time by calling TASK_SAMPLE are wrong
Besides of the concrete problem, I have the following questions, wo which I did not yet find an answer to.
1.) I am NOT using SAADC in LP Mode. Is the workaround for the erratum [86] still necessary for SDK V15.0.0 or is ia patch alredy somehow included in v15?
2.) I am unsure about how to implement the workaround. It is described as Stopping the SAADC after calibration, but stopping seems to invole waiting for an STOPPED EVENT. Do i have to wait and therefore somehow poll for that event? What is an easy way to do that?
3.) In all the SAADC examples, I see that the event handler checks for the NRFX_SAADC_EVT_DONE event and gets the data from the buffer. Why is that done, when there is explicitly stated that this event does not guaratee that the samples are already in RAM? Why not waiting for the END event? The p_buffer->type does not even seem to expose the END event? Why is that?
4.) I see that in examples, in the Event handler the occurence of the event CALIBRATEDONE is used to again call buffer_convert to set up the buffer again. If i call the calibrate_offset function before a call to buffer_convert, i guess thats a problem because in the event handler the buffer is set to the last one used, but there is no (useful) "last" buffer in this case?)
5.) Could someone provide a minimal working example (minimal main program plus callback) for just initialising the ADC / the ADC channels, perform calibration and set up the buffer for a "real" conversion directly after a startup? All the examples I found use cyclic turning on/off or inti / uninits that make things a bit unclear for a basic understanding.
Thanks a lot!