2012-05-23 07:31 AM
I am trying to figure out if the ADC calibration is reset when the ''ADC_DeInit'' function (from the peripheral library) is called after previously calibrating. My guess is that it does, since the ADC_DeInit function is supposed to reset the peripheral to the power-on state.
Here is a contrived example:ADC_Cmd(ADC2, ENABLE);
ADC_ResetCalibration(ADC2);
while
(ADC_GetResetCalibrationStatus(ADC2));
//ADC is now calibrated
ADC_DeInit(ADC1);
//but is it still calibrated now?
I haven't been able to verify this though, since there is no mention of where these values are stored. I can't see anything changing in the ADC1 memory space (other than the data register) before and after calibration. Does anybody know for sure if the calibration is reset?
At this point it is for my owncuriosity, because I am removing the DeInit calls in the actual code. They were being used to place the ADCx into a ''known'' state, but that seems to have many side effects (one of them being lost calibration I think).
#adc
2012-05-23 08:45 AM
You may need to consult the reference manual, or ST if there is no detailed information.
During a ST training seminar I got the following information concerning the DeInit() functions: Where possible, the DeInit function deasserts the (hardware) reset signal of the peripheral, i.e. doing a hardware reset, and reasserting reset afterwards. Where not possible, the configuration registers of this peripheral are just set to their reset state. I'm not sure how that affects the ADC calibration...2012-05-23 10:26 AM
Thanks for the info. I have scoured the reference manual and a couple of other PDFs that are out there concerning the ADC. I still can't find anything specifically about the calibration being affected by resetting the ADC. I will try my hand at contacting ST directly.
Either way, I believe I can assume that the calibration will be OK as long I don't reset the chip or call ADC_DeInit after the initial calibration.2012-05-23 03:59 PM
My reading of the Peripheral Library is that the ADC_DeInit just switches the state of the peripheral clock, not peripheral power. The reference manual says that calibration should be done after each power on, so my guess is that calibration is not affected by DeInit. It should be interesting to see what ST's response is, because the reference manual is not clear on this.
The F2 and F4 series don't have a calibration function. My guess is that calibration is not needed for these series, or it is done automajically at power up. Cheers, Hal2012-05-24 12:46 AM
The F2 and F4 series don't have a calibration function. My guess is that calibration is not needed for these series, or it is done automajically at power up.
I assume the latter.
2012-06-01 06:00 AM
Well ST got back to me here was the response:
The only recommendation is to calibrate the ADC every time it is poweredup to ensure the results will be the most accurate.
I take that to mean that it retains the calibration even if it is de-initialized, though that may be too much of an assumption on my part.