DocID025202 Rev 7
352/1080
RM0365
Analog-to-digital converters (ADC)
392
1.
Select the ADC1_IN16 input channel (with the appropriate sampling time).
2. Program with the appropriate sampling time (refer to electrical characteristics section of
the STM32F302xx datasheet).
3. Set the TSEN bit in the ADC1_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:
Temperature (in °C) = {(V
25
– V
TS
) / Avg_Slope} + 25
Where:
–
V
25
= V
TS
value for 25° C
–
Avg_Slope = average slope of the temperature vs. V
TS
curve (given in mV/°C or
µV/°C)
Refer to the datasheet 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
TS
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.
15.3.31 V
BAT
supply monitoring
The VBATEN bit in the ADC12_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 2. This bridge is automatically enabled
when VBATEN is set, to connect V
BAT
/2 to the ADC1_IN17 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.
Refer to the electrical characteristics of the STM32F302xx datasheet for the sampling time
value to be applied when converting the V
BAT
/2 voltage.
shows the block diagram of the V
BAT
sensing feature.