Hello,
I am following reference manual in order to use ADC internal automatic calibration.
- ADC0 is configured for 5MHz frequency, sample time = 2, 12 bit mode
- Software trigger enabled
-Hardware averaging enabled, 32 averages
-Clear registers CLPS, CLP3, CLP2, CLP1, CLP0, CLPX, CLP9
When i write "1" in the CALIBRATION bit in register SC3, it stays "0" when i try debugging.
Is there something i am missing to configure in order for it to work?
How should I check when the calibration has finished?
Thank you
Hello
In order to calibrate the ADC correctly, the following has to be done:
• On startup, wait until the reference voltage (VREFH) has stabilized.
• ADC has to be recalibrated after each system reset.
• Calibrate only one ADC instance at a time.
• You must set ADCK (ADC clock) to a value less than or equal to half of the
maximum specified frequency.
• Before starting calibration, the calibration registers (CLPS, CLP3, CLP2, CLP1,
CLP0, CLPX, and CLP9) must be cleared by writing 0000_0000h into each of them.
• Start ADC calibration by writing SC3[CAL] = 1, SC3[AVGE] = 1, and SC3[AVGS]
= 11b.
• Wait for calibration to finish.
I suggest you use the function "ADC_DRV_AutoCalibration()" that is on the SDK. That function uses register SC3[CAL], this field stays set while the calibration is in progress and is cleared when the calibration sequence is completed.
Let me know if this is helpful, if you have more questions do not hesitate to ask me.
Best regards,
Omar