Analog-to-digital converter (ADC)
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
6.
Calculate the temperature using the following formula:
–
–
Refer to the datasheet's electrical characteristics section for the actual values of V
and Avg_Slope.
Note:
The sensor has a startup time after waking from power down mode before it can output
V
at the correct level. The ADC also has a startup time after power-on, so to minimize
SENSE
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
the correct operation of the ADC, the V
2. This bridge is automatically enabled when VBATEN is set, to connect V
ADC1_IN18 input channel. As a consequence, the converted digital value is half the V
voltage. To prevent any unwanted consumption on the battery, it is recommended to enable
the bridge divider only when needed, for ADC conversion.
190/742
SENSE
Temperature (in °C) = {(V
Where:
V
= V
value for 25° C
25
SENSE
Avg_Slope = average slope of the temperature vs. V
or µV/°C)
pin. As the V
BAT
Doc ID 018940 Rev 1
data in the ADC_DR register
– V
) / Avg_Slope} + 25
25
SENSE
voltage could be higher than V
BAT
pin is internally connected to a bridge divider by
BAT
RM0091
curve (given in mV/°C
SENSE
, to ensure
DDA
/2 to the
BAT
25
BAT
Need help?
Do you have a question about the STM32F05 series and is the answer not in the manual?
Questions and answers