Analog-to-digital converter (ADC) RM0367
312/1043 RM0367 Rev 7
14.3.7 Configuring the ADC
Software must write to the ADCAL and ADEN bits in the ADC_CR register if the ADC is
disabled (ADEN must be 0).
Software must only write to the ADSTART and ADDIS bits in the ADC_CR register only if
the ADC is enabled and there is no pending request to disable the ADC (ADEN = 1 and
ADDIS = 0).
For all the other control bits in the ADC_IER, ADC_CFGRi, ADC_SMPR, ADC_TR,
ADC_CHSELR and ADC_CCR registers, refer to the description of the corresponding
control bit in Section 14.12: ADC registers.
Software must only write to the ADSTP bit in the ADC_CR register if the ADC is enabled
(and possibly converting) and there is no pending request to disable the ADC (ADSTART =
1 and ADDIS = 0).
Note: There is no hardware protection preventing software from making write operations forbidden
by the above rules. If such a forbidden write access occurs, the ADC may enter an
undefined state. To recover correct operation in this case, the ADC must be disabled (clear
ADEN = 0 and all the bits in the ADC_CR register).
14.3.8 Channel selection (CHSEL, SCANDIR)
There are up to 19 multiplexed channels:
• 16 analog inputs from GPIO pins (ADC_INx)
• 3 internal analog inputs (Temperature Sensor, Internal Reference Voltage,
LCD_VLCD1 channel)
It is possible to convert a single channel or a sequence of channels.
The sequence of the channels to be converted can be programmed in the ADC_CHSELR
channel selection register: each analog input channel has a dedicated selection bit
(CHSELx).
The order in which the channels is scanned can be configured by programming the bit
SCANDIR bit in the ADC_CFGR1 register:
• SCANDIR = 0: forward scan Channel 0 to Channel 18
• SCANDIR = 1: backward scan Channel 18 to Channel 0
Temperature sensor, V
REFINT
and LCD_VLCD1 internal channels
The temperature sensor is connected to channel ADC V
IN
[18].
The internal voltage reference V
REFINT
is connected to channel ADC V
IN
[17].
The LCD_VLCD1 channel is connected to ADC V
IN
[16] channel.