2025-10-07 12:57 AM
MCU:STM32G070CBTx LQFP48
My question is as follows:
Why is it necessary to execute HAL_ADCEx_Calibration_Start() to calibrate EO and EG before using the ADC?
Why isn’t this calibration performed at the factory before shipment?
2025-10-07 1:06 AM
> Why isn’t this calibration performed at the factory before shipment?
It is, in fact.
But since an ADC involves several analogue components suspectible to temperature, a calibration is highly recommended before every usage.
Detail are usually found in the datasheet and reference manual of the specific MCU.
2025-10-07 1:24 AM
If my operating temperature range is from -40°C to 80°C, do I need to run HAL_ADCEx_Calibration_Start() once according to the current temperature?
2025-10-07 1:41 AM
That depends on your requirements and the operating conditions.
The stated range of -40°C to 80°C is the ambient temperature, which only applies when the device was turned off long enough to be at thermal equilibrum. Since the device is most probably enclosed in a casing with little or no ventilation, it will heat up until a new equilibrum is reached. This was (and is) a problem especially with oscillators for radio transmitters were minimum frequency drift is required. Those devices often control the temperature of teh oscillator circuit in a range of a few °C.
What your application requires depends on your needs.
I would suggest run some tests at the required temperature range, record offsets and required calibration values, and decide on a strategy, i.e. if you need recalibration, and how often.
By the way, the "default" assumption for an electronic device to reach thermal equilibrum is about 15 minutes. We talk about minutes here, not milliseconds or seconds.
2025-10-07 6:13 AM
May I ask what reference values are used by the HAL_ADCEx_Calibration_Start() function during calibration?
Are they based on the voltages at the VSSA and VREF+ pins?
2025-10-07 6:28 AM
> Are they based on the voltages at the VSSA and VREF+ pins?
To be honest, I don't know.
As with most STM32 devices, ADC calibration boils down to triggering an in-built self-calibration. Which values it uses the reference manual does not reveal.
And I am not a ST employee, so I have no special insight. But supply/reference voltage and perhaps die temperature might be a good guess.
By the way, although the mentiond Cube function HAL_ADCEx_Calibration_Start() implements the calibration, I would nonetheless recommend to study the respective reference manual section (14 / 14.3.3) for a better understanding.