
Analog-to-digital converters (ADC)
RM0351
576/1830
DocID024597 Rev 5
Figure 134. Temperature sensor channel block diagram
1. The CH17SEL bit must be set to enable the conversion of the temperature sensor voltage V
TS
.
Reading the temperature
To use the sensor:
1.
Select the ADC1_IN17 or ADC3_IN17 input channels.
2. Program with the appropriate sampling time (refer to electrical characteristics section of
the device datasheet).
3. Set the CH17SEL bit in the ADC_CCR register to wake up the temperature sensor
from power-down mode.
4. Start the ADC conversion.
5. Read the resulting V
TS
data in the ADC data register.
6. Calculate the actual temperature using the following formula:
Where:
•
TS_CAL2 is the temperature sensor calibration value acquired at 110°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 device datasheet for more information about TS_CAL1 and TS_CAL2
calibration points.
Note:
The sensor has a startup time after waking from power-down mode before it can output V
TS
at the correct level. The ADC also has a startup time after power-on, so to minimize the
delay, the ADEN and CH17SEL bits should be set at the same time.
18.4.33 V
BAT
supply monitoring
The CH18SEL bit in the ADC_CCR register is used to switch to the battery voltage. As the
V
BAT
voltage could be higher than V
DDA
, to ensure the correct operation of the ADC, the
V
BAT
pin is internally connected to a bridge divider by 3. This bridge is automatically enabled
when CH18_SEL is set, to connect V
BAT
/3 to the ADC1_IN18 or ADC3_IN18 input
channels. As a consequence, the converted digital value is one third of the V
BAT
voltage. To
prevent any unwanted consumption on the battery, it is recommended to enable the bridge
divider only when needed, for ADC conversion.
06Y9
9
76
&+6(/FRQWUROELW
$'&[
$'&LQSXW
$GGUHVVGDWDEXV
7HPSHUDWXUH
VHQVRU
&RQYHUWHG
GDWD
Temperature in °C
(
)
110 °C 30 °C
–
TS_CAL2 TS_CAL1
–
----------------------------------------------------------
TS_DATA TS_CAL1
–
(
)
30 °C
+
×
=