2025-09-29 8:11 PM
With a stm32c0116-dk, I am attempting to read vrefint, and calculate vref+. From my understanding of the data sheet, and schematic. VDDA is tied to VREF+ . On the development kit, these voltages are 3.3V.
VREF+ = ((VREF _Charac+) * (VREFINT_CAL)) / VREFINT_DATA
From the Datasheet -
VREF _Charac+ = 3.0V
When I calculated VREF+, after reading VREFINT_DATA from the ADC, and VREFINT_CAL from the memory address. I am expecting a result close to 3.3 volts, but instead I am getting 3.04V
I have attempted to increase the sample time to ADC_SAMPLETIME_160CYCLES_5, but it makes no difference.
What am I doing incorrect?
2025-10-01 7:47 AM
Hello @pjhap ,
Your calculation approach is correct in principle, but the discrepancy you observe (3.04 V instead of ~3.3 V) comes from the fact that the VREF_Charac+ value used in the formula is specified as 3.0 V in the datasheet, not 3.3 V. This value is a reference characterization voltage, not the actual VDDA or VREF+ voltage on your board.
You use:
The internal reference calibration is done at a nominal 3.0 V reference voltage, not at your board's actual VDDA (3.3 V).
When you run your measurement at 3.3 V VDDA, the formula scales the measured ADC value back to the 3.0 V calibration reference, so your calculated VREF+ will be close to 3.0 V. This is expected behavior and indicates the internal reference and ADC are working correctly.
Best regards,
Aime