Analog-to-digital converter (ADC) RM0091
190/742 Doc ID 018940 Rev 1
Reading the temperature
To use the sensor:
1. Select the ADC1_IN16 input channel
2. Select a sampling time of 17.1 µs
3. Set the TSEN bit in the ADC_CCR register to wake up the temperature sensor from
power down mode
4. Start the ADC conversion by setting the ADSTART bit in the ADC_CR register (or by
external trigger)
5. Read the resulting V
SENSE
data in the ADC_DR register
6. Calculate the temperature using the following formula:
Temperature (in °C) = {(V
25
– V
SENSE
) / Avg_Slope} + 25
Where:
–V
25
= V
SENSE
value for 25° C
– Avg_Slope = average slope of the temperature vs. V
SENSE
curve (given in mV/°C
or µV/°C)
Refer to the datasheet’s electrical characteristics section for the actual values of V
25
and Avg_Slope.
Note: The sensor has a startup time after waking from power down mode before it can output
V
SENSE
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.
12.10 Battery voltage monitoring
The VBATEN bit in the ADC_CCR register allows the application to measure the backup
battery voltage on the V
BAT
pin. 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
2. This bridge is automatically enabled when VBATEN is set, to connect V
BAT
/2 to the
ADC1_IN18 input channel. As a consequence, the converted digital value is half 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.