2025-12-12 6:34 AM - last edited on 2025-12-12 6:40 AM by mƎALLEm
A new question moved from this thread.
In many examples they use the Vref int for the calculation of the temperature. Do I need it for the C0 also or can it be done without?
2025-12-12 7:28 AM
I only know about some other STM32 types:
for these there's usually the info at which Vref (often VDDA) the internal temperature sensor was calibrated, so in case it's not the same it is needed.
I just see the datasheet excerpt from the other thread, there you can see the formula with VDDA in relation to 3.0
-> and the 3.0 V is probably the voltage at which the sensor was calibrated.
2025-12-12 7:52 AM
I was checking the Cube IDE but didn't find anything which helped me.
2025-12-13 11:14 AM - edited 2025-12-13 11:16 AM
The ADC uses VREF+ pin as its reference voltage. It means, that the number you read out from ADC has to be divided by the steps the ADC has (2^12=4096) and multiplied by that reference voltage. In many small packages, this pin is connected internally to VDDA, i.e. your analog power supply.
If you know the voltage of VREF+/VDDA and you know it's powered from a reliable and stable power source, you simply use that voltage to calculate the voltage of the temperature sensor, and from that, the temperature, given the formulas in the datasheet/reference manual.
But often VREF+/VDDA is powered from a common linear regulator, and those, while stable, are surprisingly imprecise. In that case, you want to find out that VREF+/VDDA voltage in the program - we write programs usually for a mass-produced hardware and may be unfeasible to measure VREF+/VDDA for every single product using some external multimeter or so. That's why there is a stable voltage source built into the STM32, and that's VREFINT.
I have written an article about this, maybe it will help you to understand this further.
JW