![ARTERY AT32F435 Series Reference Manual Download Page 357](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592357.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 357
Rev 2.03
ADC1_IN0 to ADC1_IN15 are referred to as the external analog input, ADC1_IN16 as an internal
temperature sensor, ADC1_IN17 as an internal reference voltage, and ADC1_IN18 as a battery
voltage.
ADC2_IN0 to ADC2_IN15 are referred to as the external analog input, and ADC2_IN16 and
ADC2_IN17 as Vss, and ADC1_IN18 as V
REF-.
ADC3_IN0 to ADC3_IN3, and ADC3_IN10 to ADC3_IN13 are referred to as the external analog
input, and ADC3_IN16 and ADC3_IN17 as Vss, and ADC3_IN18 as V
REF-.
Channel conversion
The conversions are divided into two groups: ordinary and preempted channels. The preempted group
has priority over the ordinary group.
If the preempted channel trigger occurs during the ordinary channel conversion, then the ordinary
channel conversion is interrupted, giving the priority to the preempted channel, and the ordinary channel
continues its conversion at the end of the preempted channel conversion. If the ordinary channel trigger
occurs during the preempted channel conversion, the ordinary channel conversion won’t start until the
end of the preempted channel conversion.
Program the ADC_Inx into the ordinary channel sequence (ADC_OSQx) and the preempted channel
sequence (ADC_PSQ), and the same channel can be repeated, the total number of sequences is
determined by OCLEN and PCLEN, then it is ready to enable the ordinary channel or preempted channel
conversion.
18.4.1.1 Internal temperature sensor
The temperature sensor is connected to ADC1_IN16. Before the temperature sensor channel conversion,
it is required to enable the ITSRVEN bit in the ADC_CTRL2 register and wait after power-on time.
Obtain the temperature using the following formula:
Temperature (in °C) = {(V 25 - V
SE N S E
) / Avg_Slope} + 25.
Where,
V
2 5
= V
S E NS E
value for 25° C and
Avg_Slope =
Average Slope for curve between Temperature vs. V
S E N S E
(given in mV/° C).
18.4.1.2 Internal reference voltage
The internal reference voltage of the typical value 1.2 V is connected to ADC1_IN17. It is required to
enable the ITSRVEN bit in the ADC_CTRL2 register before the internal reference channel conversion.
The converted data of such channel can be used to calculate the external reference voltage.
18.4.1.3 Battery voltage
V
BAT
is higher than V
DDA.
Thus the V
BAT
must be divided by 4 before being connected to the ADC1_IN18.
The conversion of battery voltage channels starts only when the VBATEN bit is set in the ADC_CCTRL
register in order to power the divided-by-4 circuit.
Note: When the ADC is used for sampling VBAT voltage, the VBAT keeps consuming as along as the
VBATEN is set. Thus it is recommended to enable VBAT only during the sampling period, and disable it
at the end of the sampling in order to lower power consumption.
18.4.2 ADC operation process
Figure 18-2 shows the basic operation process of the ADC. It is recommended to do the calibration after
the initial power-on in order to improve the accuracy of sampling and conversion. After the calibration,
trigger is used to enable ADC sampling and conversion. Read data at the end of the conversion.