2024-02-07 08:02 AM
Apologies if I've missed something simple (and I probably have!), but I'm trying to convert ADC readings on the STM32F072 into actual millivolts and I cannot seem to put all the pieces together.
Where I am currently stuck is the formula at the top of page 260 in the reference manual RM0091 Rev 10:
VDDA = VDDA_Charac x VREFINT_CAL / VREFINT_DATA
According to the note just under that formula, "VDDA_Charac is the value of VDDA voltage characterized at VREFINT during the manufacturing process. It is specified in the device datasheet."
I've been all over the STM32F072xB (DS9826 Rev 6) datasheet and I cannot find any reference to such a thing as VDDA_Charac or the voltage at which the VREFINT_CAL is characterized at. Am I supposed to assume it is 3.3V? Is there some constant in the HAL that I should be referencing? I found a "VDD_VALUE" in stm32f0xx_hal_conf.h, but I don't think that's it.
Thank you for any guidance you can provide.
Solved! Go to Solution.
2024-02-07 08:11 AM
The VREFINT_CAL value is taken when VDDA = 3.3V. This is the voltage it's referring to.
2024-02-07 08:11 AM
The VREFINT_CAL value is taken when VDDA = 3.3V. This is the voltage it's referring to.
2024-02-07 08:30 AM
Thank you TDK! I knew it was simple/*** on my part.
2024-02-09 09:21 PM
Check, if you have already the macros provided to do all this calibration and conversion, e.g. on my STM32U5xx with ADC I use this:
VRefInt = __HAL_ADC_CALC_VREFANALOG_VOLTAGE(hadc, ADC_Val[0], hadc.Init.Resolution);
VBat = __HAL_ADC_CALC_DATA_TO_VOLTAGE(hadc, VRefInt, ADC_Val[1], hadc.Init.Resolution);
TSensor = __HAL_ADC_CALC_TEMPERATURE(hadc, VRefInt, ADC_Val[2], hadc.Init.Resolution);
This should take already the formula and the CALibration into account.
2024-02-13 10:39 AM
Sorry for the late reply. As far as I can tell, those macros are not available for the processor I'm using (STM32F072), but thank you for the suggestion!