
DocID024597 Rev 5
517/1830
RM0351
Analog-to-digital converters (ADC)
614
Note:
There is no hardware protection to prevent these forbidden write accesses and ADC
behavior may become in an unknown state. To recover from this situation, the ADC must be
disabled (clear ADEN=0 as well as all the bits of ADC_CR register).
18.4.11 Channel
selection (SQRx, JSQRx)
There are up to 19 multiplexed channels per ADC:
•
5 fast analog inputs coming from GPIO pads (ADC_IN1..5)
•
Up to 10 slow analog inputs coming from GPIO pads (ADC_IN6..15). Depending on the
products, not all of them are available on GPIO pads.
•
The ADCs are connected to 5 internal analog inputs:
–
the internal reference voltage (V
REFINT
) is connected to ADC1_IN0.
–
the internal temperature sensor (V
TS
) is connected to ADC1_IN17 and
ADC3_IN17.
–
the V
BAT
monitoring channel (V
BAT
/3) is connected to ADC1_IN18 and
ADC3_IN18.
–
the DAC1 internal channel is connected to ADC2_IN17 and ADC3_IN14.
–
the DAC2 internal channel is connected to ADC2_IN18 and ADC3_IN15.
Note:
To convert one of the internal analog channels, the corresponding analog sources must first
be enabled by programming bits VREFEN, CH17_SEL or CH18_SEL in the ADC_CCR
registers.
Caution:
On STM32L475xx/476xx/486xx devices, before any conversion of an input channel coming
from GPIO pads, it is necessary to configure the corresponding GPIOx_ASCR register in
the GPIO, in addition to the I/O configuration in analog mode.
It is possible to organize the conversions in two groups: regular and injected. A group
consists of a sequence of conversions that can be done on any channel and in any order.
For instance, it is possible to implement the conversion sequence in the following order:
ADC_IN3, ADC_IN8, ADC_IN2, ADC_IN2, ADC_IN0, ADC_IN2, ADC_IN2, ADC_IN15.
•
A
regular group
is composed of up to 16 conversions. The regular channels and their
order in the conversion sequence must be selected in the ADC_SQR registers. The
total number of conversions in the regular group must be written in the L[3:0] bits in the
ADC_SQR1 register.
•
An
injected group
is composed of up to 4 conversions. The injected channels and
their order in the conversion sequence must be selected in the ADC_JSQR register.
The total number of conversions in the injected group must be written in the L[1:0] bits
in the ADC_JSQR register.
ADC_SQR registers must not be modified while regular conversions can occur. For this, the
ADC regular conversions must be first stopped by writing ADSTP=1 (refer to
Section 18.4.17: Stopping an ongoing conversion (ADSTP, JADSTP)
).
It is possible to modify the ADC_JSQR registers on-the-fly while injected conversions are
occurring. Refer to