English
Language : 

RM0377 Datasheet, PDF (298/862 Pages) STMicroelectronics – This reference manual targets application developers
RM0377
Analog-to-digital converter (ADC)
Note:
Reading the temperature
1. Select the ADC_IN18 input channel
2. Select an appropriate sampling time specified in the device datasheet (TS_temp).
3. Set the TSEN bit in the ADC_CCR register to wake up the temperature sensor from
power down mode and wait for its stabilization time (tSTART)
For code example, refer to A.8.16: Temperature configuration code example.
4. Start the ADC conversion by setting the ADSTART bit in the ADC_CR register (or by
external trigger)
5. Read the resulting VSENSE data in the ADC_DR register
6. Calculate the temperature using the following formula:
Temperature (in °C) = T----S----_--1-C--3---A-0---L--°-2-C----–--–---T-3--S--0--_---°-C-C---A----L---1-- × (TS_DATA – TS_CAL1) + 30 °C
Temperature (in °C) = V----A-3--0-v---–g----_-V--S--S--l-o-E---pN---e-S---E-- + 30 °C
Where:
• TS_CAL2 is the temperature sensor calibration value acquired at 130°C
• TS_CAL1 is the temperature sensor calibration value acquired at 30°C
• TS_DATA is the actual temperature sensor output value converted by ADC
Refer to the specific device datasheet for more information about TS_CAL1 and
TS_CAL2 calibration points.
For code example, refer to A.8.17: Temperature computation code example.
The sensor has a startup time after waking from power down mode before it can output
VSENSE at the correct level. The ADC also has a startup time after power-on, so to minimize
the delay, the ADEN and TSEN bits should be set at the same time.
Calculating the actual VDDA voltage using the internal reference voltage
The VDDA power supply voltage applied to the microcontroller may be subject to variation or
not precisely known. The embedded internal voltage reference (VREFINT) and its
calibration data acquired by the ADC during the manufacturing process at VDDA = 3 V can
be used to evaluate the actual VDDA voltage level.
The following formula gives the actual VDDA voltage supplying the device:
VDDA = 3 V x VREFINT_CAL / VREFINT_DATA
Where:
• VREFINT_CAL is the VREFINT calibration value
• VREFINT_DATA is the actual VREFINT output value converted by ADC
Converting a supply-relative ADC measurement to an absolute voltage value
The ADC is designed to deliver a digital value corresponding to the ratio between the analog
power supply and the voltage applied on the converted channel. For most application use
cases, it is necessary to convert this ratio into a voltage independent of VDDA. For
applications where VDDA is known and ADC converted values are right-aligned you can use
the following formula to get this absolute value:
DocID025942 Rev 2
298/862
317