21. Analog-to-digital converters (ADC)

21.1 Introduction

This section describes the implementation of up to 5 ADCs:

Each ADC consists of a 12-bit successive approximation analog-to-digital converter.

Each ADC has up to 19 multiplexed channels. A/D conversion of the various channels can be performed in single, continuous, scan or discontinuous mode. The result of the ADC is stored in a left-aligned or right-aligned 16-bit data register.

The ADCs are mapped on the AHB bus to allow fast data handling.

The analog watchdog features allow the application to detect if the input voltage goes outside the user-defined high or low thresholds.

A built-in hardware oversampler allows to improve analog performance while off-loading the related computational burden from the CPU.

An efficient low-power mode is implemented to allow very low consumption at low frequency.

21.2 ADC main features

Figure 82 shows the block diagram of one ADC.

Refer to the OPAMP electrical characteristics section of the product datasheet for the ADC sampling time value to be applied when converting the OPAMP output voltage.

21.3 ADC implementation

Table 161. ADC features

ADC modes/featuresADC1ADC2ADC3ADC4ADC5
Dual modeX (coupled together)X (coupled together)-

21.4 ADC functional description

21.4.1 ADC block diagram

Figure 82 shows the ADC block diagram and Table 163 gives the ADC pin description.

Figure 82. ADC block diagram

Functional block diagram of the MSV46143V4 SAR ADC. The diagram shows the internal architecture including the SAR ADC core, input selection, start and stop control, discontinuous mode logic, and analog watchdogs. It details various configuration registers and their connections to the AHB interface, DMA, and external pins.

Functional Block Diagram of the MSV46143V4 SAR ADC

Power and Reference:

Input and Output Channels:

Core and Interface:

Control and Configuration:

Analog Watchdog 1, 2, 3:

Functional block diagram of the MSV46143V4 SAR ADC. The diagram shows the internal architecture including the SAR ADC core, input selection, start and stop control, discontinuous mode logic, and analog watchdogs. It details various configuration registers and their connections to the AHB interface, DMA, and external pins.

21.4.2 ADC pins and internal signals

Table 162. ADC internal input/output signals

Internal signal nameSignal typeDescription
adc_ext_trg[31:0]InputsUp to 32 external trigger inputs for the regular conversions (can be connected to on-chip timers). These inputs are shared between the ADC master and the ADC slave.
adc_jext_trg[31:0]InputsUp to 31 external trigger inputs for the injected conversions (can be connected to on-chip timers). These inputs are shared between the ADC master and the ADC slave.
adc_awdx_outOutputInternal analog watchdog output signal connected to on-chip timers (x = Analog watchdog number 1,2,3)
adc_ker_ckOutputADC kernel clock
adc_hclkInputADC peripheral clock
adc_itOutputADC interrupt
adc_dmaOutputADC DMA request
V TSInputOutput voltage from internal temperature sensor
V REFINTInputOutput voltage from internal reference voltage
V BATInput supplyExternal battery voltage supply

Table 163. ADC input/output pins

Pin nameSignal typeComments
VREF+Input, analog reference positiveThe higher/positive reference voltage for the ADC
VDDAInput, analog supplyAnalog power supply equal V DDA
VREF-Input, analog reference negativeThe lower/negative reference voltage for the ADC. V REF- is internally connected to V SSA
VSSAInput, analog supply groundGround for analog power supply. On device package which do not have a dedicated V SSA pin, V SSA is internally connected to V SS .
V INPiPositive analog input channels for each ADCConnected either to ADC x_INPi external channels or to internal channels. This input is converted in single-ended mode
V INNiNegative analog input channels for each ADCConnected either to V REF- or to external channels: ADC x_INNi and ADC x_INP[i+1] .
Table 163. ADC input/output pins (continued)
Pin nameSignal typeComments
ADCx_INNiNegative external analog input signalsUp to 19 analog input channels (x = ADC number = 1, 2, 3, 4 or 5).
Refer to Section 21.4.4: ADC1/2/3/4/5 connectivity for details.
ADCx_INPiPositive external analog input signalsUp to 19 analog input channels (x = ADC number = 1, 2, 3, 4 or 5).
Refer to Section 21.4.4: ADC1/2/3/4/5 connectivity for details

21.4.3 ADC clocks

Dual clock domain architecture

The dual clock-domain architecture means that the ADC clock is independent from the AHB bus clock.

The input clock is the same for all ADCs and can be selected between two different clock sources (see Figure 83: ADC clock scheme ):

  1. The ADC clock can be a specific clock source, derived from the following clock sources:
    • – The system clock
    • – PLL “P” clock
    Refer to RCC Section for more information on how to generate ADC dedicated clock. To select this scheme, bits CKMODE[1:0] of the ADCx_CCR register must be reset.
  2. The ADC clock can be derived from the AHB clock of the ADC bus interface, divided by a programmable factor (1, 2 or 4). In this mode, a programmable divider factor can be selected (/1, 2 or 4 according to bits CKMODE[1:0]).
    To select this scheme, bits CKMODE[1:0] of the ADCx_CCR register must be different from 00.

Note: For option 2), a prescaling factor of 1 (CKMODE[1:0] = 01) can be used only if the AHB prescaler is set (HPRE[3:0] = 0xxx in RCC_CFGR register).

Option 1) has the advantage of reaching the maximum ADC clock frequency whatever the AHB clock scheme selected. The ADC clock can eventually be divided by the following ratio: 1, 2, 4, 6, 8, 12, 16, 32, 64, 128, 256; using the prescaler configured with bits PRESC[3:0] in the ADCx_CCR register.

Option 2) has the advantage of bypassing the clock domain resynchronizations. This can be useful when the ADC is triggered by a timer and if the application requires that the ADC is precisely triggered without any uncertainty (otherwise, an uncertainty of the trigger instant time is added by the resynchronizations between the two clock domains).

Figure 83. ADC clock scheme

Figure 83. ADC clock scheme diagram showing the clock sources and distribution for ADC1-5. The diagram shows the RCC (Reset and clock controller) providing ad_hclk and adc_ker_ck signals. ad_hclk is connected to the AHB interface. adc_ker_ck is derived from the system clock or PLL 'P' output and is connected to the ADCx_CCR registers. The ADCx_CCR registers contain bits CKMODE[1:0] and PRES[3:0] which control the ADC clock frequency. The ADC clock (F_adc) is distributed to Analog ADC1 or 3 (master), Analog ADC2 or 4 (slave), and Analog ADC5 (single).

The diagram illustrates the ADC clock scheme. On the left, the RCC (Reset and clock controller) block provides two main clock signals: ad_hclk (1) and adc_ker_ck . ad_hclk is connected to the AHB interface of the ADCs. adc_ker_ck is derived from the system clock (1) or the PLL 'P' output (2) . This signal is connected to the ADCx_CCR registers of the ADCs. The ADCx_CCR registers contain bits CKMODE[1:0] and PRES[3:0] which control the ADC clock frequency. The ADC clock ( \( F_{adc} \) ) is distributed to Analog ADC1 or 3 (master), Analog ADC2 or 4 (slave), and Analog ADC5 (single). The diagram also shows the internal structure of the ADCs, including the AHB interface and the clock distribution logic.

(1) Synchronous clock sources
No jitter from trigger to conversion start

(2) Asynchronous clock sources
Better ADC frequency tuning independently from system and AHB clock

MSV46144V4

Figure 83. ADC clock scheme diagram showing the clock sources and distribution for ADC1-5. The diagram shows the RCC (Reset and clock controller) providing ad_hclk and adc_ker_ck signals. ad_hclk is connected to the AHB interface. adc_ker_ck is derived from the system clock or PLL 'P' output and is connected to the ADCx_CCR registers. The ADCx_CCR registers contain bits CKMODE[1:0] and PRES[3:0] which control the ADC clock frequency. The ADC clock (F_adc) is distributed to Analog ADC1 or 3 (master), Analog ADC2 or 4 (slave), and Analog ADC5 (single).

Clock ratio constraint between ADC clock and AHB clock

There are generally no constraints to be respected for the ratio between the ADC clock and the AHB clock except if some injected channels are programmed. In this case, it is mandatory to respect the following ratio:

21.4.4 ADC1/2/3/4/5 connectivity

ADC1, ADC2, ADC3, ADC4 and ADC5 are tightly coupled and share some external channels as described in the below figures.

ADCy_INPx correspond to ADCy_INx pins defined in the product datasheet.

Figure 84. ADC1 connectivity

Figure 84: ADC1 connectivity diagram showing the mapping of external pins and internal signals to ADC1 input channels. The diagram shows 19 channel pairs (V_INP[0..18] and V_INN[0..18]). Channels 0-5 are labeled 'Fast channel', and channels 6-18 (except 13) are labeled 'Slow channel'. Channel 13 is marked 'Reserved'. External pins like ADC12_INP1, ADC12_INN1, etc., are connected to specific channels. Internal signals like V_OPAMP1, V_TS, V_BAT/3, and V_REFINT are also mapped. All channels feed into a 'Channel selection' multiplexer which connects to a SAR ADC1 block with V_REF+ and V_REF- reference inputs.

The diagram illustrates the internal architecture of ADC1 connectivity. It features a series of input channels on the left, each with a positive (V INP ) and negative (V INN ) input. These inputs are connected to a common bus that feeds into a SAR ADC1 block. The channels are categorized as follows:

The SAR ADC1 block has inputs V INP and V INN , and reference inputs V REF+ and V REF- . A dashed line indicates the 'Channel selection' mechanism.

Figure 84: ADC1 connectivity diagram showing the mapping of external pins and internal signals to ADC1 input channels. The diagram shows 19 channel pairs (V_INP[0..18] and V_INN[0..18]). Channels 0-5 are labeled 'Fast channel', and channels 6-18 (except 13) are labeled 'Slow channel'. Channel 13 is marked 'Reserved'. External pins like ADC12_INP1, ADC12_INN1, etc., are connected to specific channels. Internal signals like V_OPAMP1, V_TS, V_BAT/3, and V_REFINT are also mapped. All channels feed into a 'Channel selection' multiplexer which connects to a SAR ADC1 block with V_REF+ and V_REF- reference inputs.

Figure 85. ADC2 connectivity

Schematic diagram of ADC2 connectivity showing 19 channels (0-18) connected to a SAR ADC2 block. Channels are labeled as fast or slow. Connections include external pins (ADC12_INP1-17, ADC2_INN1-15), internal outputs (VOPAMP2, VOPAMP3), and power pins (VSSA, VREF+, VREF-).

The diagram illustrates the connectivity of the ADC2 block. On the left, various pins are listed, including external pins (ADC12_INP1 through ADC12_INP17, ADC2_INN1 through ADC2_INN15) and internal outputs (VOPAMP2 internal output and VOPAMP3 internal output). These are connected to the internal channels of the ADC2 block, which are numbered 0 through 18. Channels 0 through 5 are designated as 'Fast channel', while channels 6 through 18 are designated as 'Slow channel'. Channel 16 is marked as 'Reserved'. The ADC2 block itself is a SAR ADC2, which receives reference voltages VREF+ and VREF- and has differential input pins VINP and VINN. Power pins VSSA are also shown for several channels. A 'Channel selection' block is indicated at the top right of the ADC2 block.

ChannelLabelTypeConnectivity
0V INP [0]Fast channelV SSA
1V INP [1]Fast channelV SSA
2V INP [2]Fast channelADC12_INN1, ADC12_INP2
3V INP [3]Fast channelADC2_INN2, ADC2_INP3
4V INP [4]Fast channelADC2_INN3, ADC2_INP4
5V INP [5]Fast channelADC2_INN4, ADC2_INP5
6V INP [6]Slow channelADC12_INN5, ADC12_INP6
7V INP [7]Slow channelADC12_INN6, ADC12_INP7
8V INP [8]Slow channelADC12_INN7, ADC12_INP8
9V INP [9]Slow channelADC12_INN8, ADC12_INP9
10V INP [10]Slow channelADC2_INN9, ADC2_INP10
11V INP [11]Slow channelADC2_INN10, ADC2_INP11
12V INP [12]Slow channelADC2_INN11, ADC2_INP12
13V INP [13]Slow channelADC2_INN12, ADC2_INP13
14V INP [14]Slow channelADC2_INN13, ADC2_INP14
15V INP [15]Slow channelADC2_INN14, ADC2_INP15
16V INP [16]Slow channelReserved, V OPAMP2 internal output
17V INP [17]Slow channelADC2_INP17, V SSA
18V INP [18]Slow channelV OPAMP3 internal output, V SSA

MSV46146V4

Schematic diagram of ADC2 connectivity showing 19 channels (0-18) connected to a SAR ADC2 block. Channels are labeled as fast or slow. Connections include external pins (ADC12_INP1-17, ADC2_INN1-15), internal outputs (VOPAMP2, VOPAMP3), and power pins (VSSA, VREF+, VREF-).

Figure 86. ADC3 connectivity

ADC3 connectivity diagram showing internal connections between various pins and a central SAR ADC3 block. Pins are labeled with V_INP and V_INN values, categorized as 'Fast channel' or 'Slow channel'. External connections include V_SSA, V_REF+, V_REF-, and various internal outputs like V_OAMP3 and V_OAMP6.

The diagram illustrates the internal connectivity of the ADC3. A central block labeled 'SAR ADC3' has two main input terminals: \( V_{INP} \) and \( V_{INN} \) . The \( V_{INP} \) terminal is connected to a vertical bus of 19 pins, and the \( V_{INN} \) terminal is connected to another vertical bus of 19 pins. These pins are labeled from \( V_{INP}[0] \) to \( V_{INP}[18] \) and \( V_{INN}[0] \) to \( V_{INN}[18] \) . The pins are further categorized as 'Fast channel' (0-5) or 'Slow channel' (6-18). External pins on the left are connected to these internal buses. For example, \( ADC3\_INP1 \) connects to \( V_{INP}[1] \) , and \( ADC3\_INN1 \) connects to \( V_{INN}[2] \) . Other connections include \( V_{SSA} \) , \( V_{REF+} \) , \( V_{REF-} \) , \( V_{OAMP3} \) (internal output), \( V_{BAT}/3 \) (for category 3 devices), \( V_{OAMP6} \) (internal output for category 4 devices), and \( V_{REFINT} \) . A 'Reserved' pin is also shown for \( V_{INN}[13] \) .

(1) For category 3 devices only
(2) For category 4 devices only
Note: in category 4 devices the \( ADC345\_xxx \) pins correspond to \( ADC3\_xxx \) pins.

MSv46147V5

ADC3 connectivity diagram showing internal connections between various pins and a central SAR ADC3 block. Pins are labeled with V_INP and V_INN values, categorized as 'Fast channel' or 'Slow channel'. External connections include V_SSA, V_REF+, V_REF-, and various internal outputs like V_OAMP3 and V_OAMP6.

Figure 87. ADC4 connectivity

Schematic diagram of ADC4 connectivity showing 19 channels (0-18) connected to a SAR ADC4 block. Channels are labeled as fast or slow. External pins are labeled ADC4_INP1 through ADC345_INP16. Internal connections include VSSA, VOPAMP6, and VREFINT.

The diagram illustrates the internal connectivity of the ADC4 block. On the left, external pins are labeled: ADC4_INP1, ADC4_INN1, ADC4_INP2, ADC4_INN2, ADC4_INP3, ADC4_INN3, ADC4_INP4, ADC4_INN4, ADC4_INP5, ADC345_INN5, ADC345_INP6, ADC345_INN6, ADC345_INP7, ADC345_INN7, ADC345_INP8, ADC345_INN8, ADC345_INP9, ADC345_INN9, ADC345_INP10, ADC345_INN10, ADC345_INP11, ADC45_INN11, ADC45_INP12, ADC45_INN12, ADC45_INP13, ADC345_INN13, ADC345_INP14, ADC345_INN14, ADC345_INP15, ADC345_INN15, and ADC345_INP16. These are connected to internal pins V_INP[0] through V_INN[18].

The internal pins are grouped into two columns:

Power and reference connections include:

The SAR ADC4 block on the right has inputs V_INP and V_INN, and reference inputs V_REF+ and V_REF-. A 'Channel selection' block is shown above the SAR ADC4, connected to the internal pins.

MSV46148V1

Schematic diagram of ADC4 connectivity showing 19 channels (0-18) connected to a SAR ADC4 block. Channels are labeled as fast or slow. External pins are labeled ADC4_INP1 through ADC345_INP16. Internal connections include VSSA, VOPAMP6, and VREFINT.

Figure 88. ADC5 connectivity

Schematic diagram of ADC5 connectivity showing internal and external connections to a SAR ADC5 block. The diagram includes 19 channels (0-18), with channels 0-5 labeled as 'Fast channel' and channels 6-18 as 'Slow channel'. External connections include ADC5_INP1, ADC5_INN1, ADC5_INP2, ADC345_INP6, ADC345_INN6, ADC345_INP7, ADC345_INN7, ADC345_INP8, ADC345_INN8, ADC345_INP9, ADC345_INN9, ADC345_INP10, ADC345_INN10, ADC345_INP11, ADC45_INN11, ADC45_INP12, ADC45_INN12, ADC45_INP13, ADC345_INN13, ADC345_INP14, ADC345_INN14, ADC345_INP15, ADC345_INN15, and ADC345_INP16. Internal connections include VSSA, VOPAMP5 internal output, VTS, VOPAMP4 internal output, Reserved, VBAT/3, and VREFINT. The SAR ADC5 block has inputs V_INP and V_INN, and reference inputs V_REF+ and V_REF-.

The diagram illustrates the internal architecture and external connectivity of the ADC5. On the left, various internal and external signals are connected to the ADC5's input channels. The channels are numbered 0 to 18. Channels 0 through 5 are designated as 'Fast channel', while channels 6 through 18 are 'Slow channel'. Channel 6 is marked as 'Reserved'. The SAR ADC5 block on the right receives differential inputs from these channels through V_INP and V_INN lines. Reference voltages V_REF+ and V_REF- are also connected to the SAR ADC5 block. External pins are labeled on the far left, such as ADC5_INP1, ADC345_INP6, and ADC45_INP12. Internal signals include VSSA, VOPAMP5 internal output, VTS, VOPAMP4 internal output, VBAT/3, and VREFINT.

ChannelLabelTypeExternal Pin(s)
0V_INP[0]Fast channel
1V_INN[0]Fast channel
2V_INP[1]Fast channelADC5_INP1
3V_INN[1]Fast channelADC5_INN1
4V_INP[2]Fast channelADC5_INP2
5V_INN[2]Fast channel
6V_INP[3]Reserved
7V_INN[3]Slow channel
8V_INP[4]Slow channelADC345_INP6
9V_INN[4]Slow channelADC345_INN6
10V_INP[5]Slow channelADC345_INP7
11V_INN[5]Slow channelADC345_INN7
12V_INP[6]Slow channelADC345_INP8
13V_INN[6]Slow channelADC345_INN8
14V_INP[7]Slow channelADC345_INP9
15V_INN[7]Slow channelADC345_INN9
16V_INP[8]Slow channelADC345_INP10
17V_INN[8]Slow channelADC345_INN10
18V_INP[9]Slow channelADC345_INP11

MSv46149V4

Schematic diagram of ADC5 connectivity showing internal and external connections to a SAR ADC5 block. The diagram includes 19 channels (0-18), with channels 0-5 labeled as 'Fast channel' and channels 6-18 as 'Slow channel'. External connections include ADC5_INP1, ADC5_INN1, ADC5_INP2, ADC345_INP6, ADC345_INN6, ADC345_INP7, ADC345_INN7, ADC345_INP8, ADC345_INN8, ADC345_INP9, ADC345_INN9, ADC345_INP10, ADC345_INN10, ADC345_INP11, ADC45_INN11, ADC45_INP12, ADC45_INN12, ADC45_INP13, ADC345_INN13, ADC345_INP14, ADC345_INN14, ADC345_INP15, ADC345_INN15, and ADC345_INP16. Internal connections include VSSA, VOPAMP5 internal output, VTS, VOPAMP4 internal output, Reserved, VBAT/3, and VREFINT. The SAR ADC5 block has inputs V_INP and V_INN, and reference inputs V_REF+ and V_REF-.

21.4.5 Slave AHB interface

The ADCs implement an AHB slave port for control/status register and data access. The features of the AHB interface are listed below:

The AHB slave interface does not support split/retry requests, and never generates AHB errors.

21.4.6 ADC Deep-power-down mode (DEEPPWD) and ADC voltage regulator (ADVREGEN)

By default, the ADC is in Deep-power-down mode where its supply is internally switched off to reduce the leakage currents (the reset state of bit DEEPPWD is 1 in the ADC_CR register).

To start ADC operations, follow the sequence below:

  1. 1. Exit Deep-power-down mode by clearing DEEPPWD bit.
  2. 2. Enable the ADC voltage regulator by setting ADVREGEN.
  3. 3. Wait for the startup time to configure the ADC (refer to the device datasheet for the value of the startup time).

When ADC operations are complete, the ADC can be disabled (ADEN = 0). It is possible to save power by also disabling the ADC voltage regulator. This is done by writing bit ADVREGEN = 0.

Then, to save more power by reducing the leakage currents, it is also possible to re-enter in ADC Deep-power-down mode by setting bit DEEPPWD = 1 into ADC_CR register. This is particularly interesting before entering Stop mode.

Note: Writing DEEPPWD = 1 automatically disables the ADC voltage regulator and bit ADVREGEN is automatically cleared.

When the internal voltage regulator is disabled (ADVREGEN = 0), the internal analog calibration is kept.

In ADC Deep-power-down mode (DEEPPWD = 1), the internal analog calibration is lost and it is necessary to either relaunch a calibration or re-apply the calibration factor which was previously saved (refer to Section 21.4.8: Calibration (ADCAL, ADCALDIF, ADC_CALFACT) ).

21.4.7 Single-ended and differential input channels

Channels can be configured to be either single-ended input or differential input by programming DIFSEL[i] bits in the ADC_DIFSEL register. This configuration must be written while the ADC is disabled (ADEN = 0). Note that the DIFSEL[i] bits corresponding to single-ended channels are always programmed at 0.

In single-ended input mode, the analog voltage to be converted for channel “i” is the difference between the ADCy_INPx external voltage equal to \( V_{INP[i]} \) (positive input) and \( V_{REF-} \) (negative input).

In differential input mode, the analog voltage to be converted for channel “i” is the difference between the ADCy_INPx external voltage positive input equal to \( V_{INP[i]} \) , and the ADCy_INNx negative input equal to \( V_{INN[i]} \) .

The input voltage in differential mode ranges from \( V_{REF-} \) to \( V_{REF+} \) , which makes a full scale range of \( 2 \times V_{REF+} \) . When \( V_{INP[i]} \) equals \( V_{REF-} \) , \( V_{INN[i]} \) equals \( V_{REF+} \) and the maximum negative input differential voltage ( \( V_{REF-} \) ) corresponds to 0x000 ADC output. When \( V_{INP[i]} \) equals \( V_{REF+} \) , \( V_{INN[i]} \) equals \( V_{REF-} \) and the maximum positive input differential voltage ( \( V_{REF+} \) ) corresponds to 0xFFF ADC output. When \( V_{INP[i]} \) and \( V_{INN[i]} \) are connected together, the zero input differential voltage corresponds to 0x800 ADC output.

The ADC sensitivity in differential mode is twice smaller than in single-ended mode.

When ADC is configured as differential mode, both inputs should be biased at \( (V_{REF+}) / 2 \) voltage. Refer to the device datasheet for the allowed common mode input voltage \( V_{CMIN} \) .

The input signals are supposed to be differential (common mode voltage should be fixed).

Internal channels (such as \( V_{TS} \) and \( V_{REFINT} \) ) are used in single-ended mode only.

For a complete description of how the input channels are connected for each ADC, refer to Section 21.4.4: ADC1/2/3/4/5 connectivity .

Caution: When configuring the channel “i” in differential input mode, its negative input voltage \( V_{INN[i]} \) is connected to another channel. As a consequence, this channel is no longer usable in single-ended mode or in differential mode and must never be configured to be converted. Some channels are shared between ADC1/ADC2/ADC3/ADC4/ADC5: this can make the channel on the other ADC unusable. The only exception is when ADC master and the slave operate in interleaved mode.

21.4.8 Calibration (ADCAL, ADCALDIF, ADC_CALFACT)

Each ADC provides an automatic calibration procedure which drives all the calibration sequence including the power-on/off sequence of the ADC. During the procedure, the ADC calculates a calibration factor which is 7-bit wide and which is applied internally to the ADC until the next ADC power-off. During the calibration procedure, the application must not use the ADC and must wait until calibration is complete.

Calibration is preliminary to any ADC operation. It removes the offset error which may vary from chip to chip due to process or bandgap variation.

The calibration factor to be applied for single-ended input conversions is different from the factor to be applied for differential input conversions:

The calibration is then initiated by software by setting bit ADCAL = 1. Calibration can only be initiated when the ADC is disabled (when ADEN = 0). ADCAL bit stays at 1 during all the calibration sequence. It is then cleared by hardware as soon the calibration completes. At this time, the associated calibration factor is stored internally in the analog ADC and also in the bits CALFACT_S[6:0] or CALFACT_D[6:0] of ADC_CALFACT register (depending on single-ended or differential input calibration)

The internal analog calibration is kept if the ADC is disabled (ADEN = 0). However, if the ADC is disabled for extended periods, then it is recommended that a new calibration cycle is run before re-enabling the ADC.

The internal analog calibration is lost each time the power of the ADC is removed (example, when the product enters in Standby or \( V_{BAT} \) mode). In this case, to avoid spending time recalibrating the ADC, it is possible to re-write the calibration factor into the ADC_CALFACT register without recalibrating, supposing that the software has previously saved the calibration factor delivered during the previous calibration.

The calibration factor can be written if the ADC is enabled but not converting (ADEN = 1 and ADSTART = 0 and JADSTART = 0). Then, at the next start of conversion, the calibration factor is automatically injected into the analog ADC. This loading is transparent and does not add any cycle latency to the start of the conversion. It is recommended to recalibrate when \( V_{REF+} \) voltage changed more than 10%.

Software procedure to calibrate the ADC

  1. 1. Ensure DEEPPWD = 0, ADVREGEN = 1 and that ADC voltage regulator startup time has elapsed.
  2. 2. Ensure that ADEN = 0.
  3. 3. Select the input mode for this calibration by setting ADCALDIF = 0 (single-ended input) or ADCALDIF = 1 (differential input).
  4. 4. Set ADCAL.
  5. 5. Wait until ADCAL = 0.
  6. 6. The calibration factor can be read from ADC_CALFACT register.

Figure 89. ADC calibration

Timing diagram for ADC calibration showing the sequence of events for ADCALDIF, ADCAL, ADC State, and CALFACT_x[6:0] signals.

The diagram illustrates the timing sequence for ADC calibration across four signal lines:

Legend:
by S/W \( \uparrow \) (Software sets the signal high)
by H/W \( \downarrow \) (Hardware sets the signal low)
Indicative timings (referring to \( t_{CAL} \) )

MSV30263V2

Timing diagram for ADC calibration showing the sequence of events for ADCALDIF, ADCAL, ADC State, and CALFACT_x[6:0] signals.

Software procedure to re-inject a calibration factor into the ADC

  1. 1. Ensure ADEN = 1 and ADSTART = 0 and JADSTART = 0 (ADC enabled and no conversion is ongoing).
  2. 2. Write CALFACT_S and CALFACT_D with the new calibration factors.
  3. 3. When a conversion is launched, the calibration factor is injected into the analog ADC only if the internal analog calibration factor differs from the one stored in bits CALFACT_S for single-ended input channel or bits CALFACT_D for differential input channel.

Figure 90. Updating the ADC calibration factor

Timing diagram showing the process of updating the ADC calibration factor. The diagram illustrates the relationship between ADC state, internal calibration factor, start conversion signal, WRITE ADC_CALFACT signal, and the CALFACT_S register. The ADC state transitions from 'Ready (not converting)' to 'Converting channel (Single ended)' and back to 'Ready'. The internal calibration factor changes from F1 to F2. The start conversion signal is triggered by hardware or software. The WRITE ADC_CALFACT signal is set by software. The CALFACT_S register is updated by software. The diagram shows that the calibration factor is updated when the ADC is in the 'Converting channel' state and the WRITE ADC_CALFACT signal is set. The legend indicates that 'by s/w' means by software and 'by h/w' means by hardware.

The diagram illustrates the timing for updating the ADC calibration factor. It shows five horizontal timelines:

A legend at the bottom left indicates that an upward arrow labeled 'by s/w' represents a software action and an upward arrow labeled 'by h/w' represents a hardware action.

Timing diagram showing the process of updating the ADC calibration factor. The diagram illustrates the relationship between ADC state, internal calibration factor, start conversion signal, WRITE ADC_CALFACT signal, and the CALFACT_S register. The ADC state transitions from 'Ready (not converting)' to 'Converting channel (Single ended)' and back to 'Ready'. The internal calibration factor changes from F1 to F2. The start conversion signal is triggered by hardware or software. The WRITE ADC_CALFACT signal is set by software. The CALFACT_S register is updated by software. The diagram shows that the calibration factor is updated when the ADC is in the 'Converting channel' state and the WRITE ADC_CALFACT signal is set. The legend indicates that 'by s/w' means by software and 'by h/w' means by hardware.

MSV30529V2

Converting single-ended and differential analog inputs with a single ADC

If the ADC is supposed to convert both differential and single-ended inputs, two calibrations must be performed, one with ADCALDIF = 0 and one with ADCALDIF = 1. The procedure is the following:

  1. 1. Disable the ADC.
  2. 2. Calibrate the ADC in single-ended input mode (with ADCALDIF = 0). This updates the register CALFACT_S[6:0].
  3. 3. Calibrate the ADC in differential input modes (with ADCALDIF = 1). This updates the register CALFACT_D[6:0].
  4. 4. Enable the ADC, configure the channels and launch the conversions. Each time there is a switch from a single-ended to a differential inputs channel (and vice-versa), the calibration is automatically injected into the analog ADC.

Figure 91. Mixing single-ended and differential channels

Timing diagram showing the sequence of ADC conversions triggered by a common trigger event. The diagram illustrates four conversion channels: CONV CH 1 (Single ended inputs channel), CONV CH 2 (Differential inputs channel), CONV CH 3 (Differential inputs channel), and CONV CH 4 (Single inputs channel). The ADC state transitions between RDY (Ready) and CONV (Conversion) states. The internal calibration factor [6:0] is shown as F2 for single-ended channels and F3 for differential channels. The CALFACT_S[6:0] register is set to F2, and the CALFACT_D[6:0] register is set to F3. The diagram is labeled MSV30530V2.

The diagram illustrates the timing and state transitions of an ADC when mixing single-ended and differential channels. A 'Trigger event' line shows four rising edges that initiate a sequence of conversions. The 'ADC state' line shows the ADC transitioning from 'RDY' (Ready) to 'CONV' (Conversion) for each channel: CONV CH 1 (Single ended inputs channel), CONV CH 2 (Differential inputs channel), CONV CH 3 (Differential inputs channel), and CONV CH 4 (Single inputs channel). The 'Internal calibration factor[6:0]' is shown as F2 for single-ended channels and F3 for differential channels. The 'CALFACT_S[6:0]' register is set to F2, and the 'CALFACT_D[6:0]' register is set to F3. The diagram is labeled MSV30530V2.

Timing diagram showing the sequence of ADC conversions triggered by a common trigger event. The diagram illustrates four conversion channels: CONV CH 1 (Single ended inputs channel), CONV CH 2 (Differential inputs channel), CONV CH 3 (Differential inputs channel), and CONV CH 4 (Single inputs channel). The ADC state transitions between RDY (Ready) and CONV (Conversion) states. The internal calibration factor [6:0] is shown as F2 for single-ended channels and F3 for differential channels. The CALFACT_S[6:0] register is set to F2, and the CALFACT_D[6:0] register is set to F3. The diagram is labeled MSV30530V2.

21.4.9 ADC on-off control (ADEN, ADDIS, ADRDY)

First of all, follow the procedure explained in Section 21.4.6: ADC Deep-power-down mode (DEEPPWD) and ADC voltage regulator (ADVREGEN) .

Once DEEPPWD = 0 and ADVREGEN = 1, the ADC can be enabled and the ADC needs a stabilization time of \( t_{STAB} \) before it starts converting accurately, as shown in Figure 92 . Two control bits enable or disable the ADC:

Regular conversion can then start either by setting ADSTART = 1 (refer to Section 21.4.18: Conversion on external trigger and trigger polarity (EXTSEL, EXTEN, JEXTSEL, JEXTEN) ) or when an external trigger event occurs, if triggers are enabled.

Injected conversions start by setting JADSTART = 1 or when an external injected trigger event occurs, if injected triggers are enabled.

Software procedure to enable the ADC

  1. 1. Clear the ADRDY bit in the ADC_ISR register by writing 1.
  2. 2. Set ADEN.
  3. 3. Wait until ADRDY = 1 (ADRDY is set after the ADC startup time). This can be done using the associated interrupt (setting ADRDYIE = 1).
  4. 4. Clear the ADRDY bit in the ADC_ISR register by writing 1 (optional).

Caution: ADEN bit cannot be set when ADCAL is set and during four ADC clock cycles after the ADCAL bit is cleared by hardware (end of the calibration).

Software procedure to disable the ADC

  1. 1. Check that both ADSTART = 0 and JADSTART = 0 to ensure that no conversion is ongoing. If required, stop any regular and injected conversion ongoing by setting ADSTP = 1 and JADSTP = 1 and then wait until ADSTP = 0 and JADSTP = 0.
  2. 2. Set ADDIS.
  3. 3. If required by the application, wait until ADEN = 0, until the analog ADC is effectively disabled (ADDIS is automatically reset once ADEN = 0).

Figure 92. Enabling / disabling the ADC

Timing diagram for ADC enabling and disabling sequence showing signals ADEN, ADRDY, ADDIS and ADC state transitions.
sequenceDiagram
    Note over ADEN, ADC state: Enabling Sequence
    S/W->>ADEN: High
    ADEN->>ADRDY: tSTAB delay
    Note over ADC state: OFF -> Startup
    ADRDY->>ADC state: RDY
    Note over ADC state: RDY -> Converting CH -> RDY
    Note over ADEN, ADC state: Disabling Sequence
    S/W->>ADDIS: High
    ADDIS->>ADEN: H/W sets Low
    Note over ADC state: RDY -> REQ-OFF -> OFF

The diagram shows the interaction between software (S/W) and hardware (H/W) for ADC control. ADEN is set by S/W. After \( t_{STAB} \) , ADRDY is set by H/W. The ADC state transitions from OFF to Startup to RDY. During operation, it moves to Converting CH and back to RDY. To disable, S/W sets ADDIS, which causes H/W to clear ADEN and transition the state through REQ-OFF back to OFF. A legend indicates that rising edges with a straight arrow are 'by S/W' and falling edges with a bent arrow are 'by H/W'.

Timing diagram for ADC enabling and disabling sequence showing signals ADEN, ADRDY, ADDIS and ADC state transitions.

21.4.10 Constraints when writing the ADC control bits

The software is allowed to write the RCC control bits to configure and enable the ADC clock (refer to RCC Section), the DIFSEL[i] control bits in the ADC_DIFSEL register and the control bits ADCAL and ADEN in the ADC_CR register, only if the ADC is disabled (ADEN must be equal to 0).

The software is then allowed to write the control bits ADSTART, JADSTART and ADDIS of the ADC_CR register only if the ADC is enabled and there is no pending request to disable the ADC (ADEN must be equal to 1 and ADDIS to 0).

For all the other control bits of the ADC_CFGR, ADC_SMPRx, ADC_TRy, ADC_SQRy, ADC_JDRy, ADC_OFRy, ADC_OFCHRy and ADC_IER registers:

The software is allowed to write the ADSTP or JADSTP control bits of the ADC_CR register only if the ADC is enabled, possibly converting, and if there is no pending request to disable the ADC (ADSTART or JADSTART must be equal to 1 and ADDIS to 0).

The software can write the register ADC_JSQR at any time, when the ADC is enabled (ADEN = 1) and JADSTART is cleared. The software is allowed to modify on-the-fly the ADC_JSQR register when JADSTART is set (injected conversions are ongoing) only when the context queue is enabled (JQDIS = 0 in the ADC_CFGR register). Refer to Section 21.7.16: ADC injected sequence register (ADC_JSQR) for additional details.

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 as well as all the bits of ADC_CR register).

21.4.11 Channel selection (ADC_SQRy, ADC_JSQR)

There are up to 19 multiplexed channels per ADC:

Note: To convert one of the internal analog channels, the corresponding analog sources must first be enabled by programming bits VREFEN, VBATSEL or VSENSESEL in the ADCx_CCR registers.

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: ADCx_INP/INN3, ADCx_INP/INN8, ADCx_INP/INN2, ADCx_INN/INP2, ADCx_INP/INN0, ADCx_INP/INN2, ADCx_INP/INN2, ADCx_INP/INN15.

ADC_SQRy 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 21.4.17: Stopping an ongoing conversion (ADSTP, JADSTP) ).

The software is allowed to modify on-the-fly the ADC_JSQR register when JADSTART is set (injected conversions ongoing) only when the context queue is enabled (JQDIS = 0 in ADC_CFGR register). Refer to Section 21.4.21: Queue of context for injected conversions

21.4.12 Channel-wise programmable sampling time (SMPR1, SMPR2)

Before starting a conversion, the ADC must establish a direct connection between the voltage source under measurement and the embedded sampling capacitor of the ADC. This sampling time must be enough for the input voltage source to charge the embedded capacitor to the input voltage level.

Each channel can be sampled with a different sampling time which is programmable using the SMP[2:0] bits in the ADC_SMPR1 and ADC registers. It is therefore possible to select among the following sampling time values:

The total conversion time is calculated as follows:

\[ T_{\text{CONV}} = \text{Sampling time} + 12.5 \text{ ADC clock cycles} \]

Example:

With \( F_{\text{adc\_ker\_ck}} = 30 \text{ MHz} \) and a sampling time of 2.5 ADC clock cycles:

\[ T_{\text{CONV}} = (2.5 + 12.5) \text{ ADC clock cycles} = 15 \text{ ADC clock cycles} = 500 \text{ ns} \]

The ADC notifies the end of the sampling phase by setting the status bit EOSMP (only for regular conversion).

Constraints on the sampling time

For each channel, SMP[2:0] bits must be programmed to respect a minimum sampling time as specified in the ADC characteristics section of the datasheets.

Bulb sampling mode

When the BULB bit is set in ADC register, the sampling period starts immediately after the last ADC conversion. A hardware or software trigger starts the conversion after the sampling time has been programmed in ADC_SMPR1 register. The very first ADC conversion, after the ADC is enabled, is performed with the sampling time programmed in SMP bits. The Bulb mode is effective starting from the second conversion.

The maximum sampling time is limited (refer to the ADC characteristics section of the datasheet).

The Bulb mode is neither compatible with the continuous conversion mode nor with the injected channel conversion.

When the BULB bit is set, it is not allowed to set SMPTRIG bit in ADC_CFGR2.

Figure 93. Bulb mode timing diagram

Figure 93: Bulb mode timing diagram comparing Normal (discontinuous) mode and BULB (continuous) mode.

The diagram shows two timing scenarios for ADC states (idle, sample, conversion) relative to a Trigger signal:

MSV46157V2

Figure 93: Bulb mode timing diagram comparing Normal (discontinuous) mode and BULB (continuous) mode.

Sampling time control trigger mode

When the SMPTRIG bit is set, the sampling time programmed through SMPx bits is not applicable. The sampling time is controlled by the trigger signal edge.

When a hardware trigger is selected, each rising edge of the trigger signal starts the sampling period. A falling edge ends the sampling period and starts the conversion. The EXTEN[1:0] bits must be set to 01. Hardware triggers with not defined rising and falling edges (one pulse event) cannot be used in Bulb mode.

When a software trigger is selected, the software trigger is not the ADSTART bit in ADC_CR but the SWTRIG bit. SWTRIG bit has to be set to start the sampling period, and the SWTRIG bit has to be cleared to end the sampling period and start the conversion. EXTEN[1:0] bits must be set to 00.

The maximum sampling time is limited (refer to the ADC characteristics section of the datasheet).

This mode is neither compatible with the continuous conversion mode, nor with the injected channel conversion.

When SMPTRIG bit is set, it is not allowed to set BULB bit.

I/O analog switch voltage booster

The resistance of the I/O analog switches increases when the \( V_{DDA} \) voltage is too low. The sampling time must consequently be adapted accordingly (refer to the device datasheet for the corresponding electrical characteristics). This resistance can be minimized at low \( V_{DDA} \) voltage by enabling an internal voltage booster through the BOOSTEN bit of the SYSCFG_CFGR1 register.

SMPPLUS control bit

When a sampling time of 2.5 ADC clock cycles is selected, the total conversion time becomes 15 cycles in 12-bit mode. If the dual interleaved mode is used (see Section : Interleaved mode with independent injected ), the sampling interval cannot be equal to the value specified since an even number of cycles is required for the conversion. The SMPPLUS bit can be used to change the sampling time 2.5 ADC clock cycles into 3.5 ADC clock cycles. In this way, the total conversion time becomes 16 clock cycles, thus making possible to interleave every 8 cycles.

21.4.13 Single conversion mode (CONT = 0)

In Single conversion mode, the ADC performs once all the conversions of the channels. This mode is started with the CONT bit at 0 by either:

Inside the regular sequence, after each conversion is complete:

Inside the injected sequence, after each conversion is complete:

After the regular sequence is complete:

After the injected sequence is complete:

Then the ADC stops until a new external regular or injected trigger occurs or until bit ADSTART or JADSTART is set again.

Note: To convert a single channel, program a sequence with a length of 1.

21.4.14 Continuous conversion mode (CONT = 1)

This mode applies to regular channels only.

In continuous conversion mode, when a software or hardware regular trigger event occurs, the ADC performs once all the regular conversions of the channels and then automatically restarts and continuously converts each conversions of the sequence. This mode is started with the CONT bit at 1 either by external trigger or by setting the ADSTART bit in the ADC_CR register.

Inside the regular sequence, after each conversion is complete:

After the sequence of conversions is complete:

Then, a new sequence restarts immediately and the ADC continuously repeats the conversion sequence.

Note: To convert a single channel, program a sequence with a length of 1.

It is not possible to have both discontinuous mode and continuous mode enabled: it is forbidden to set both DISCEN = 1 and CONT = 1.

Injected channels cannot be converted continuously. The only exception is when an injected channel is configured to be converted automatically after regular channels in continuous mode (using JAUTO bit), refer to Auto-injection mode section).

21.4.15 Starting conversions (ADSTART, JADSTART)

Software starts ADC regular conversions by setting ADSTART = 1.

When ADSTART is set, the conversion starts:

Software starts ADC injected conversions by setting JADSTART = 1.

When JADSTART is set, the conversion starts:

Note: In auto-injection mode (JAUTO = 1), use ADSTART bit to start the regular conversions followed by the auto-injected conversions (JADSTART must be kept cleared).

ADSTART and JADSTART also provide information on whether any ADC operation is currently ongoing. It is possible to re-configure the ADC while ADSTART = 0 and JADSTART = 0 are both true, indicating that the ADC is idle.

ADSTART is cleared by hardware:

Note: In continuous mode (CONT = 1), ADSTART is not cleared by hardware with the assertion of EOS because the sequence is automatically relaunched.

When a hardware trigger is selected in single mode (CONT = 0 and EXTSEL≠0x00), ADSTART is not cleared by hardware with the assertion of EOS to help the software which does not need to reset ADSTART again for the next hardware trigger event. This ensures that no further hardware triggers are missed.

JADSTART is cleared by hardware:

Note: When the software trigger is selected, ADSTART bit should not be set if the EOC flag is still high.

21.4.16 ADC timing

The elapsed time between the start of a conversion and the end of conversion is the sum of the configured sampling time plus the successive approximation time depending on data resolution:

\[ T_{CONV} = T_{SMPL} + T_{SAR} = [2.5 \text{ } \mu\text{s}_{\min} + 12.5 \text{ } \mu\text{s}_{12\text{bit}}] \times T_{ADC\_CLK} \]
\[ T_{CONV} = T_{SMPL} + T_{SAR} = 83.33 \text{ ns}_{\min} + 416.67 \text{ ns}_{12\text{bit}} = 500.0 \text{ ns (for } F_{ADC} = 30 \text{ MHz)} \]

Figure 94. Analog-to-digital conversion time

Timing diagram for ADC conversion showing ADC state, Analog channel, Internal S/H, ADSTART, EOSMP, EOC, and ADC_DR signals over time. It illustrates the sampling and converting phases for channels Ch(N) and Ch(N+1).

The diagram shows the timing of an ADC conversion across several signals:

MSV30532V2

Timing diagram for ADC conversion showing ADC state, Analog channel, Internal S/H, ADSTART, EOSMP, EOC, and ADC_DR signals over time. It illustrates the sampling and converting phases for channels Ch(N) and Ch(N+1).

21.4.17 Stopping an ongoing conversion (ADSTP, JADSTP)

The software can decide to stop regular conversions ongoing by setting ADSTP = 1 and injected conversions ongoing by setting JADSTP = 1.

Stopping conversions resets the ongoing ADC operation. Then the ADC can be reconfigured (ex: changing the channel selection or the trigger) ready for a new operation.

Note that it is possible to stop injected conversions while regular conversions are still operating and vice-versa. This allows, for instance, re-configuration of the injected conversion sequence and triggers while regular conversions are still operating (and vice-versa).

When the ADSTP bit is set by software, any ongoing regular conversion is aborted with partial result discarded (ADC_DR register is not updated with the current conversion).

When the JADSTP bit is set by software, any ongoing injected conversion is aborted with partial result discarded (ADC_JDRy register is not updated with the current conversion). The scan sequence is also aborted and reset (meaning that relaunching the ADC would restart a new sequence).

Once this procedure is complete, bits ADSTP/ADSTART (in case of regular conversion), or JADSTP/JADSTART (in case of injected conversion) are cleared by hardware and the

software must poll ADSTART (or JADSTART) until the bit is reset before assuming the ADC is completely stopped.

Note: In auto-injection mode (JAUTO = 1), setting ADSTP bit aborts both regular and injected conversions (JADSTP must not be used).

Figure 95. Stopping ongoing regular conversions

Timing diagram for stopping ongoing regular conversions. It shows the ADC state, JADSTART, ADSTART, ADSTP, and ADC_DR signals over time. The ADC state transitions from RDY to Sample Ch(N-1), then Convert Ch(N-1), then RDY, then Sample Ch(N), then C, then RDY. Triggers are shown for the first and second conversion. ADSTART is set by software and cleared by hardware. ADSTP is set by software and cleared by hardware. ADC_DR contains Data N-2 and Data N-1.

The diagram illustrates the timing for stopping ongoing regular conversions. The ADC state starts in RDY, then transitions through Sample Ch(N-1), Convert Ch(N-1), RDY, Sample Ch(N), C, and back to RDY. Triggers are shown for the first and second conversion. The ADSTART signal is set by software and cleared by hardware. The ADSTP signal is set by software and cleared by hardware. The ADC_DR signal contains Data N-2 and Data N-1. A note indicates that software is not allowed to configure regular conversions selection and triggers.

MSV30533V2

Timing diagram for stopping ongoing regular conversions. It shows the ADC state, JADSTART, ADSTART, ADSTP, and ADC_DR signals over time. The ADC state transitions from RDY to Sample Ch(N-1), then Convert Ch(N-1), then RDY, then Sample Ch(N), then C, then RDY. Triggers are shown for the first and second conversion. ADSTART is set by software and cleared by hardware. ADSTP is set by software and cleared by hardware. ADC_DR contains Data N-2 and Data N-1.

Figure 96. Stopping ongoing regular and injected conversions

Timing diagram for stopping ongoing regular and injected conversions. It shows the ADC state, JADSTART, JADSTP, ADSTART, ADSTP, ADC_JDR, and ADC_DR signals over time. The ADC state transitions from RDY to Sample Ch(N-1), then Convert Ch(N-1), then RDY, then Sample Ch(M), then C, then RDY, then Sample, then RDY. Triggers are shown for regular, injected, and regular conversions. JADSTART is set by software and cleared by hardware. JADSTP is set by software and cleared by hardware. ADSTART is set by software and cleared by hardware. ADSTP is set by software and cleared by hardware. ADC_JDR contains DATA M-1. ADC_DR contains DATA N-2 and DATA N-1. Notes indicate that software is not allowed to configure injected conversions selection and triggers, and software is not allowed to configure regular conversions selection and triggers.

The diagram illustrates the timing for stopping ongoing regular and injected conversions. The ADC state transitions from RDY to Sample Ch(N-1), Convert Ch(N-1), RDY, Sample Ch(M), C, RDY, Sample, and RDY. Triggers are shown for regular, injected, and regular conversions. The JADSTART signal is set by software and cleared by hardware. The JADSTP signal is set by software and cleared by hardware. The ADSTART signal is set by software and cleared by hardware. The ADSTP signal is set by software and cleared by hardware. The ADC_JDR signal contains DATA M-1. The ADC_DR signal contains DATA N-2 and DATA N-1. Notes indicate that software is not allowed to configure injected conversions selection and triggers, and software is not allowed to configure regular conversions selection and triggers.

MSV30534V1

Timing diagram for stopping ongoing regular and injected conversions. It shows the ADC state, JADSTART, JADSTP, ADSTART, ADSTP, ADC_JDR, and ADC_DR signals over time. The ADC state transitions from RDY to Sample Ch(N-1), then Convert Ch(N-1), then RDY, then Sample Ch(M), then C, then RDY, then Sample, then RDY. Triggers are shown for regular, injected, and regular conversions. JADSTART is set by software and cleared by hardware. JADSTP is set by software and cleared by hardware. ADSTART is set by software and cleared by hardware. ADSTP is set by software and cleared by hardware. ADC_JDR contains DATA M-1. ADC_DR contains DATA N-2 and DATA N-1. Notes indicate that software is not allowed to configure injected conversions selection and triggers, and software is not allowed to configure regular conversions selection and triggers.

21.4.18 Conversion on external trigger and trigger polarity (EXTSEL, EXTEN, JEXTSEL, JEXTEN)

A conversion or a sequence of conversions can be triggered either by software or by an external event (e.g. timer capture, input pins). If the EXTEN[1:0] control bits (for a regular conversion) or JEXTEN[1:0] bits (for an injected conversion) are different from 00, then external events are able to trigger a conversion with the selected polarity.

When the Injected Queue is enabled (bit JQDIS = 0), injected software triggers are not possible.

The regular trigger selection is effective once software has set bit ADSTART = 1 and the injected trigger selection is effective once software has set bit JADSTART = 1.

Any hardware triggers which occur while a conversion is ongoing are ignored.

Table 164 provides the correspondence between the EXTEN[1:0] and JEXTEN[1:0] values and the trigger polarity.

Table 164. Configuring the trigger polarity for regular external triggers

EXTEN[1:0]Source
00Hardware Trigger detection disabled, software trigger detection enabled
01Hardware Trigger with detection on the rising edge
10Hardware Trigger with detection on the falling edge
11Hardware Trigger with detection on both the rising and falling edges

Note: The polarity of the regular trigger cannot be changed on-the-fly.

Table 165. Configuring the trigger polarity for injected external triggers

JEXTEN[1:0]Source
00
  • – If JQDIS = 1 (Queue disabled): Hardware trigger detection disabled, software trigger detection enabled
  • – If JQDIS = 0 (Queue enabled), Hardware and software trigger detection disabled
01Hardware Trigger with detection on the rising edge
10Hardware Trigger with detection on the falling edge
11Hardware Trigger with detection on both the rising and falling edges

Note: The polarity of the injected trigger can be anticipated and changed on-the-fly when the queue is enabled (JQDIS = 0). Refer to Section 21.4.21: Queue of context for injected conversions .

The EXTSEL and JEXTSEL control bits select which out of 32 possible events can trigger conversion for the regular and injected groups.

A regular group conversion can be interrupted by an injected trigger.

Note:
The regular trigger selection cannot be changed on-the-fly.
The injected trigger selection can be anticipated and changed on-the-fly. Refer to Section 21.4.21: Queue of context for injected conversions on page 624

Each ADC master shares the same input triggers with its ADC slave as described in Figure 97 .

Figure 97. Triggers sharing between ADC master and ADC slave

Figure 97: Triggers sharing between ADC master and ADC slave. The diagram shows two ADC blocks, 'ADC MASTER' and 'ADC SLAVE', sharing common external trigger inputs. On the left, 'Regular sequencer triggers' (adc_ext_trg0, adc_ext_trg1, ..., adc_ext_trg31) and 'Injected sequencer triggers' (adc_jext_trg0, adc_jext_trg1, ..., adc_jext_trg31) are shown. These triggers are connected to multiplexers within each ADC block. The 'ADC MASTER' has multiplexers for 'External regular trigger' (controlled by EXTSEL[3:0]) and 'External injected trigger' (controlled by JEXTSEL[4:0]). The 'ADC SLAVE' has similar multiplexers for 'External regular trigger' (EXTSEL[3:0]) and 'External injected trigger' (JEXTSEL[4:0]). Lines with dots indicate shared connections between the trigger inputs and the multiplexers. A small label 'MSV46156V1' is in the bottom right corner of the diagram area.
Figure 97: Triggers sharing between ADC master and ADC slave. The diagram shows two ADC blocks, 'ADC MASTER' and 'ADC SLAVE', sharing common external trigger inputs. On the left, 'Regular sequencer triggers' (adc_ext_trg0, adc_ext_trg1, ..., adc_ext_trg31) and 'Injected sequencer triggers' (adc_jext_trg0, adc_jext_trg1, ..., adc_jext_trg31) are shown. These triggers are connected to multiplexers within each ADC block. The 'ADC MASTER' has multiplexers for 'External regular trigger' (controlled by EXTSEL[3:0]) and 'External injected trigger' (controlled by JEXTSEL[4:0]). The 'ADC SLAVE' has similar multiplexers for 'External regular trigger' (EXTSEL[3:0]) and 'External injected trigger' (JEXTSEL[4:0]). Lines with dots indicate shared connections between the trigger inputs and the multiplexers. A small label 'MSV46156V1' is in the bottom right corner of the diagram area.

Table 166 to Table 169 give all the possible external triggers of the three ADCs for regular and injected conversions.

Table 166. ADC1/2 - External triggers for regular channels

NameSourceTypeEXTSEL[4:0]
adc_ext_trgtim1_oc1Internal signal from on-chip timers00000
adc_ext_trg1tim1_oc2Internal signal from on-chip timers00001
adc_ext_trg2tim1_oc3Internal signal from on-chip timers00010
adc_ext_trg3tim2_oc2Internal signal from on-chip timers00011
adc_ext_trg4tim3_trgoInternal signal from on-chip timers00100
adc_ext_trg5tim4_oc4Internal signal from on-chip timers00101
adc_ext_trg6EXTI line 11External pin00110
adc_ext_trg7tim8_trgoInternal signal from on-chip timers00111
adc_ext_trg8tim8_trgo2Internal signal from on-chip timers01000
Table 166. ADC1/2 - External triggers for regular channels (continued)
NameSourceTypeEXTSEL[4:0]
adc_ext_trg9tim1_trgoInternal signal from on-chip timers01001
adc_ext_trg10tim1_trgo2Internal signal from on-chip timers01010
adc_ext_trg11tim2_trgoInternal signal from on-chip timers01011
adc_ext_trg12tim4_trgoInternal signal from on-chip timers01100
adc_ext_trg13tim6_trgoInternal signal from on-chip timers01101
adc_ext_trg14tim15_trgoInternal signal from on-chip timers01110
adc_ext_trg15tim3_oc4Internal signal from on-chip timers01111
adc_ext_trg16tim20_trgoInternal signal from on-chip timers10000
adc_ext_trg17tim20_trgo2Internal signal from on-chip timers10001
adc_ext_trg18tim20_oc1Internal signal from on-chip timers10010
adc_ext_trg19tim20_oc2Internal signal from on-chip timers10011
adc_ext_trg20tim20_oc3Internal signal from on-chip timers10100
adc_ext_trg21hrtim_adc_trg1Internal signal from on-chip timers10101
adc_ext_trg22hrtim_adc_trg3Internal signal from on-chip timers10110
adc_ext_trg23hrtim_adc_trg5Internal signal from on-chip timers10111
adc_ext_trg24hrtim_adc_trg6Internal signal from on-chip timers11000
adc_ext_trg25hrtim_adc_trg7Internal signal from on-chip timers11001
adc_ext_trg26hrtim_adc_trg8Internal signal from on-chip timers11010
adc_ext_trg27hrtim_adc_trg9Internal signal from on-chip timers11011
adc_ext_trg28hrtim_adc_trg10Internal signal from on-chip timers11100
adc_ext_trg29lptim_outInternal signal from on-chip timers11101
adc_ext_trg30tim7_trgoInternal signal from on-chip timers11110
adc_ext_trg31reserved-11111
Table 167. ADC1/2 - External trigger for injected channels
NameSourceTypeJEXTSEL[4:0]
adc_jext_trg0tim1_trgoInternal signal from on-chip timers00000
adc_jext_trg1tim1_oc4Internal signal from on-chip timers00001
adc_jext_trg2tim2_trgoInternal signal from on-chip timers00010
adc_jext_trg3tim2_oc1Internal signal from on-chip timers00011
adc_jext_trg4tim3_oc4Internal signal from on-chip timers00100
adc_jext_trg5tim4_trgoInternal signal from on-chip timers00101
adc_jext_trg6EXTI line 15External pin00110
adc_jext_trg7tim8_oc4Internal signal from on-chip timers00111
adc_jext_trg8tim1_trgo2Internal signal from on-chip timers01000

Table 167. ADC1/2 - External trigger for injected channels (continued)

NameSourceTypeJEXTSEL[4:0]
adc_jext_trg9tim8_trgoInternal signal from on-chip timers01001
adc_jext_trg10tim8_trgo2Internal signal from on-chip timers01010
adc_jext_trg11tim3_oc3Internal signal from on-chip timers01011
adc_jext_trg12tim3_trgoInternal signal from on-chip timers01100
adc_jext_trg13tim3_oc1Internal signal from on-chip timers01101
adc_jext_trg14tim6_trgoInternal signal from on-chip timers01110
adc_jext_trg15tim15_trgoInternal signal from on-chip timers01111
adc_jext_trg16tim20_trgoInternal signal from on-chip timers10000
adc_jext_trg17tim20_trgo2Internal signal from on-chip timers10001
adc_jext_trg18tim20_oc4Internal signal from on-chip timers10010
adc_jext_trg19hrtim_adc_trg2Internal signal from on-chip timers10011
adc_jext_trg20hrtim_adc_trg4Internal signal from on-chip timers10100
adc_jext_trg21hrtim_adc_trg5Internal signal from on-chip timers10101
adc_jext_trg22hrtim_adc_trg6Internal signal from on-chip timers10110
adc_jext_trg23hrtim_adc_trg7Internal signal from on-chip timers10111
adc_jext_trg24hrtim_adc_trg8Internal signal from on-chip timers11000
adc_jext_trg25hrtim_adc_trg9Internal signal from on-chip timers11001
adc_jext_trg26hrtim_adc_trg10Internal signal from on-chip timers11010
adc_jext_trg27tim16_oc1Internal signal from on-chip timers11011
adc_jext_trg28reserved-11100
adc_jext_trg29lptim_outInternal signal from on-chip timers11101
adc_jext_trg30tim7_trgoInternal signal from on-chip timers11110
adc_jext_trg31reserved-11111

Table 168. ADC3/4/5 - External triggers for regular channels

NameSourceTypeEXTSEL[4:0]
adc_ext_trg0tim3_oc1Internal signal from on-chip timers00000
adc_ext_trg1tim2_oc3Internal signal from on-chip timers00001
adc_ext_trg2tim1_oc3Internal signal from on-chip timers00010
adc_ext_trg3tim8_oc1Internal signal from on-chip timers00011
adc_ext_trg4tim3_trgoInternal signal from on-chip timers00100
adc_ext_trg5EXTI line 2External pin00101
adc_ext_trg6tim4_oc1Internal signal from on-chip timers00110
adc_ext_trg7tim8_trgoInternal signal from on-chip timers00111

Table 168. ADC3/4/5 - External triggers for regular channels (continued)

NameSourceTypeEXTSEL[4:0]
adc_ext_trg8tim8_trgo2Internal signal from on-chip timers01000
adc_ext_trg9tim1_trgoInternal signal from on-chip timers01001
adc_ext_trg10tim1_trgo2Internal signal from on-chip timers01010
adc_ext_trg11tim2_trgoInternal signal from on-chip timers01011
adc_ext_trg12tim4_trgoInternal signal from on-chip timers01100
adc_ext_trg13tim6_trgoInternal signal from on-chip timers01101
adc_ext_trg14tim15_trgoInternal signal from on-chip timers01110
adc_ext_trg15tim2_oc1Internal signal from on-chip timers01111
adc_ext_trg16tim20_trgoInternal signal from on-chip timers10000
adc_ext_trg17tim20_trgo2Internal signal from on-chip timers10001
adc_ext_trg18tim20_oc1Internal signal from on-chip timers10010
adc_ext_trg19hrtim_adc_trg2Internal signal from on-chip timers10011
adc_ext_trg20hrtim_adc_trg4Internal signal from on-chip timers10100
adc_ext_trg21hrtim_adc_trg1Internal signal from on-chip timers10101
adc_ext_trg22hrtim_adc_trg3Internal signal from on-chip timers10110
adc_ext_trg23hrtim_adc_trg5Internal signal from on-chip timers10111
adc_ext_trg24hrtim_adc_trg6Internal signal from on-chip timers11000
adc_ext_trg25hrtim_adc_trg7Internal signal from on-chip timers11001
adc_ext_trg26hrtim_adc_trg8Internal signal from on-chip timers11010
adc_ext_trg27hrtim_adc_trg9Internal signal from on-chip timers11011
adc_ext_trg28hrtim_adc_trg10Internal signal from on-chip timers11100
adc_ext_trg29lptim_outInternal signal from on-chip timers11101
adc_ext_trg30tim7_trgoInternal signal from on-chip timers11110
adc_ext_trg31reserved-11111

Table 169. ADC3/4/5 - External triggers for injected channels

NameSourceTypeJEXTSEL[4:0]
adc_jext_trg0tim1_trgoInternal signal from on-chip timers00000
adc_jext_trg1tim1_oc4Internal signal from on-chip timers00001
adc_jext_trg2tim2_trgoInternal signal from on-chip timers00010
adc_jext_trg3tim8_oc2Internal signal from on-chip timers00011
adc_jext_trg4tim4_oc3Internal signal from on-chip timers00100
adc_jext_trg5tim4_trgoInternal signal from on-chip timers00101
adc_jext_trg6tim4_oc4Internal signal from on-chip timers00110
adc_jext_trg7tim8_oc4Internal signal from on-chip timers00111

Table 169. ADC3/4/5 - External triggers for injected channels (continued)

NameSourceTypeJEXTSEL[4:0]
adc_jext_trg8tim1_trgo2Internal signal from on-chip timers01000
adc_jext_trg9tim8_trgoInternal signal from on-chip timers01001
adc_jext_trg10tim8_trgo2Internal signal from on-chip timers01010
adc_jext_trg11tim1_oc3Internal signal from on-chip timers01011
adc_jext_trg12tim3_trgoInternal signal from on-chip timers01100
adc_jext_trg13EXTI line 3External pin01101
adc_jext_trg14tim6_trgoInternal signal from on-chip timers01110
adc_jext_trg15tim15_trgoInternal signal from on-chip timers01111
adc_jext_trg16tim20_trgoInternal signal from on-chip timers10000
adc_jext_trg17tim20_trgo2Internal signal from on-chip timers10001
adc_jext_trg18tim20_oc2Internal signal from on-chip timers10010
adc_jext_trg19hrtim_adc_trg2Internal signal from on-chip timers10011
adc_jext_trg20hrtim_adc_trg4Internal signal from on-chip timers10100
adc_jext_trg21hrtim_adc_trg5Internal signal from on-chip timers10101
adc_jext_trg22hrtim_adc_trg6Internal signal from on-chip timers10110
adc_jext_trg23hrtim_adc_trg7Internal signal from on-chip timers10111
adc_jext_trg24hrtim_adc_trg8Internal signal from on-chip timers11000
adc_jext_trg25hrtim_adc_trg9Internal signal from on-chip timers11001
adc_jext_trg26hrtim_adc_trg10Internal signal from on-chip timers11010
adc_jext_trg27hrtim_adc_trg1Internal signal from on-chip timers11011
adc_jext_trg28hrtim_adc_trg3Internal signal from on-chip timers11100
adc_jext_trg29lptim_outInternal signal from on-chip timers11101
adc_jext_trg30tim7_trgoInternal signal from on-chip timers11110
adc_jext_trg31reserved-11111

21.4.19 Injected channel management

Triggered injection mode

To use triggered injection, the JAUTO bit in the ADC_CFGR register must be cleared.

  1. 1. Start the conversion of a group of regular channels either by an external trigger or by setting the ADSTART bit in the ADC_CR register.
  2. 2. If an external injected trigger occurs, or if the JADSTART bit in the ADC_CR register is set during the conversion of a regular group of channels, the current conversion is
  1. reset and the injected channel sequence switches are launched (all the injected channels are converted once).
    1. 3. Then, the regular conversion of the regular group of channels is resumed from the last interrupted regular conversion.
    2. 4. If a regular event occurs during an injected conversion, the injected conversion is not interrupted but the regular sequence is executed at the end of the injected sequence.
  2. Figure 98 shows the corresponding timing diagram.

Note: When using triggered injection, one must ensure that the interval between trigger events is longer than the injection sequence. For instance, if the sequence length is 30 ADC clock cycles (that is two conversions with a sampling time of 2.5 clock periods), the minimum interval between triggers must be 31 ADC clock cycles.

Auto-injection mode

If the JAUTO bit in the ADC_CFGR register is set, then the channels in the injected group are automatically converted after the regular group of channels. This can be used to convert a sequence of up to 20 conversions programmed in the ADC_SQRy and ADC_JSQR registers.

In this mode, the ADSTART bit in the ADC_CR register must be set to start regular conversions, followed by injected conversions (JADSTART must be kept cleared). Setting the ADSTP bit aborts both regular and injected conversions (JADSTP bit must not be used).

In this mode, external trigger on injected channels must be disabled.

If the CONT bit is also set in addition to the JAUTO bit, regular channels followed by injected channels are continuously converted.

Note: It is not possible to use both the auto-injected and discontinuous modes simultaneously. When the DMA is used for exporting regular sequencer's data in JAUTO mode, it is necessary to program it in circular mode. If the single-shot mode is selected, the JAUTO sequence is stopped upon DMA Transfer Complete event.

Figure 98. Injected conversion latency

Timing diagram for injected conversion latency. The diagram shows four signals over time: adc_ker_ck (ADC kernel clock), Injection event, Reset ADC, and SOC (Start of Conversion). The adc_ker_ck signal is a periodic square wave. The Injection event signal is a pulse that triggers the conversion. The Reset ADC signal is a pulse that resets the ADC. The SOC signal is a pulse that indicates the start of the conversion. The maximum latency (1) is indicated by a double-headed arrow between the rising edge of the Injection event and the rising edge of the SOC signal.

The timing diagram illustrates the relationship between the ADC kernel clock (adc_ker_ck), an injection event, a reset signal (Reset ADC), and the start of conversion (SOC). The adc_ker_ck signal is a periodic square wave. The Injection event is a pulse that triggers the conversion. The Reset ADC signal is a pulse that resets the ADC. The SOC signal is a pulse that indicates the start of the conversion. The maximum latency (1) is indicated by a double-headed arrow between the rising edge of the Injection event and the rising edge of the SOC signal.

Timing diagram for injected conversion latency. The diagram shows four signals over time: adc_ker_ck (ADC kernel clock), Injection event, Reset ADC, and SOC (Start of Conversion). The adc_ker_ck signal is a periodic square wave. The Injection event signal is a pulse that triggers the conversion. The Reset ADC signal is a pulse that resets the ADC. The SOC signal is a pulse that indicates the start of the conversion. The maximum latency (1) is indicated by a double-headed arrow between the rising edge of the Injection event and the rising edge of the SOC signal.
  1. 1. The maximum latency value can be found in the electrical characteristics of the device datasheet.

21.4.20 Discontinuous mode (DISCEN, DISCNUM, JDISCEN)

Regular group mode

This mode is enabled by setting the DISCEN bit in the ADC_CFGR register.

It is used to convert a short sequence (subgroup) of n conversions ( \( n \leq 8 \) ) that is part of the sequence of conversions selected in the ADC_SQRy registers. The value of n is specified by writing to the DISCNUM[2:0] bits in the ADC_CFGR register.

When an external trigger occurs, it starts the next n conversions selected in the ADC_SQRy registers until all the conversions in the sequence are done. The total sequence length is defined by the L[3:0] bits in the ADC_SQR1 register.

Example:

Note: The channel numbers referred to in the above example might not be available on all microcontrollers.

When a regular group is converted in discontinuous mode, no rollover occurs (the last subgroup of the sequence can have less than n conversions).

When all subgroups are converted, the next trigger starts the conversion of the first subgroup. In the example above, the fourth trigger reconverts the channels 1, 2 and 3 in the first subgroup.

It is not possible to have both discontinuous mode and continuous mode enabled. In this case (if DISCEN = 1, CONT = 1), the ADC behaves as if continuous mode was disabled.

Injected group mode

This mode is enabled by setting the JDISCEN bit in the ADC_CFGR register. It converts the sequence selected in the ADC_JSQR register, channel by channel, after an external injected trigger event. This is equivalent to discontinuous mode for regular channels where 'n' is fixed to 1.

When an external trigger occurs, it starts the next channel conversions selected in the ADC_JSQR registers until all the conversions in the sequence are done. The total sequence length is defined by the JL[1:0] bits in the ADC_JSQR register.

Example:

Note: The channel numbers referred to in the above example might not be available on all microcontrollers.

When all injected channels have been converted, the next trigger starts the conversion of the first injected channel. In the example above, the fourth trigger reconverts the first injected channel 1.

It is not possible to use both auto-injected mode and discontinuous mode simultaneously: the bits DISCEN and JDISCEN must be kept cleared by software when JAUTO is set.

21.4.21 Queue of context for injected conversions

A queue of context is implemented to anticipate up to 2 contexts for the next injected sequence of conversions. JQDIS bit of ADC_CFGR register must be reset to enable this feature. Only hardware-triggered conversions are possible when the context queue is enabled.

This context consists of:

All the parameters of the context are defined into a single register ADC_JSQR and this register implements a queue of 2 buffers, allowing the bufferization of up to 2 sets of parameters:

Note: When configured in discontinuous mode (bit JDISCEN = 1), only the last trigger of the injected sequence changes the context and consumes the Queue. The first trigger only consumes the queue but others are still valid triggers as shown by the discontinuous mode example below (length = 3 for both contexts):

Behavior when changing the trigger or sequence context

The Figure 99 and Figure 100 show the behavior of the context Queue when changing the sequence or the triggers.

Figure 99. Example of ADC_JSQR queue of context (sequence change)

Timing diagram for Figure 99 showing ADC_JSQR queue behavior during a sequence change. It tracks Write ADC_JSQR signals for sequences P1, P2, and P3, the resulting JSQR queue entries, Trigger 1 pulses, the ADC J context returned by reading ADC_JSQR, and the overall ADC state (RDY, Conversions, RDY).

Timing diagram for Figure 99. The diagram shows five horizontal timelines over time. 1. Write ADC_JSQR : Shows three pulses labeled P1, P2, and P3. 2. JSQR queue : Starts as EMPTY . After P1, it contains P1 . After P2, it contains P1,P2 . After P3, it contains P2 , then P2,P3 , and finally P3 . 3. Trigger 1 : A pulse occurs after the P2 write. 4. ADC J context (returned by reading ADC_JSQR) : Starts as EMPTY . After the Trigger 1 pulse, it contains P1 . After the P3 write, it contains P2 , then P3 . 5. ADC state : Starts as RDY . After Trigger 1, it goes through Conversion1 , Conversion2 , and Conversion3 , returning to RDY . After the P3 write, it goes through Conversion1 and returns to RDY . Vertical dashed lines connect events between timelines. A code MS30536V4 is in the bottom right.

Timing diagram for Figure 99 showing ADC_JSQR queue behavior during a sequence change. It tracks Write ADC_JSQR signals for sequences P1, P2, and P3, the resulting JSQR queue entries, Trigger 1 pulses, the ADC J context returned by reading ADC_JSQR, and the overall ADC state (RDY, Conversions, RDY).
  1. 1. Parameters:
    P1: sequence of 3 conversions, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 1
    P3: sequence of 4 conversions, hardware trigger 1

Figure 100. Example of ADC_JSQR queue of context (trigger change)

Timing diagram for Figure 100 showing ADC_JSQR queue behavior during a trigger change. It tracks Write ADC_JSQR signals for sequences P1, P2, and P3, the resulting ADC_JSQR queue entries, Trigger 1 and Trigger 2 pulses, the ADC J context returned by reading ADC_JSQR, and the overall ADC state (RDY, Conversions, RDY).

Timing diagram for Figure 100. The diagram shows five horizontal timelines over time. 1. Write ADC_JSQR : Shows three pulses labeled P1, P2, and P3. 2. ADC_JSQR queue : Starts as EMPTY . After P1, it contains P1 . After P2, it contains P1,P2 . After P3, it contains P2 , then P2,P3 (labeled Ignored ), and finally P3 . 3. Trigger 1 : A pulse occurs after the P2 write. 4. Trigger 2 : A pulse occurs after the P3 write. 5. ADC J context (returned by reading ADC_JSQR) : Starts as EMPTY . After the Trigger 1 pulse, it contains P1 . After the P3 write, it contains P2 , then P3 . 6. ADC state : Starts as RDY . After Trigger 1, it goes through Conversion1 and Conversion2 , returning to RDY . After the P3 write, it goes through Conversion1 and returns to RDY . Vertical dashed lines connect events between timelines. A code MS30537V4 is in the bottom right.

Timing diagram for Figure 100 showing ADC_JSQR queue behavior during a trigger change. It tracks Write ADC_JSQR signals for sequences P1, P2, and P3, the resulting ADC_JSQR queue entries, Trigger 1 and Trigger 2 pulses, the ADC J context returned by reading ADC_JSQR, and the overall ADC state (RDY, Conversions, RDY).
  1. 1. Parameters:
    P1: sequence of 2 conversions, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 2
    P3: sequence of 4 conversions, hardware trigger 1

Queue of context: Behavior when a queue overflow occurs

The Figure 101 and Figure 102 show the behavior of the context Queue if an overflow occurs before or during a conversion.

Figure 101. Example of ADC_JSQR queue of context with overflow before conversion

Timing diagram for Figure 101 showing ADC context queue overflow before conversion.

This timing diagram illustrates the behavior of the ADC context queue when an overflow occurs before a conversion. The diagram shows several signals over time:

MS30538V4

Timing diagram for Figure 101 showing ADC context queue overflow before conversion.
  1. Parameters:
    P1: sequence of 2 conversions, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 2
    P3: sequence of 3 conversions, hardware trigger 1
    P4: sequence of 4 conversions, hardware trigger 1

Figure 102. Example of ADC_JSQR queue of context with overflow during conversion

Timing diagram for Figure 102 showing ADC context queue overflow during conversion.

This timing diagram illustrates the behavior of the ADC context queue when an overflow occurs during a conversion. The signals and their behavior are similar to Figure 101, but with a key difference in the timing of the overflow relative to the conversion state:

MS30538V4

Timing diagram for Figure 102 showing ADC context queue overflow during conversion.
  1. Parameters:
    P1: sequence of 2 conversions, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 2
    P3: sequence of 3 conversions, hardware trigger 1
    P4: sequence of 4 conversions, hardware trigger 1

It is recommended to manage the queue overflows as described below:

Queue of context: Behavior when the queue becomes empty

Figure 103 and Figure 104 show the behavior of the context Queue when the Queue becomes empty in both cases JQM = 0 or 1.

Figure 103. Example of ADC_JSQR queue of context with empty queue (case JQM = 0)

Timing diagram showing the behavior of the ADC context queue when it becomes empty (case JQM = 0). The diagram tracks five signals over time: 'Write ADC_JSQR', 'ADC_JSQR queue', 'Trigger 1', 'ADC J context (returned by reading ADC_JSQR)', and 'ADC state'. 
    - 'Write ADC_JSQR': Shows pulses for contexts P1, P2, and P3.
    - 'ADC_JSQR queue': Starts 'EMPTY', then contains 'P1', then 'P1, P2', then 'P2'. When P3 is written, it becomes 'P2, P3'. Annotations indicate that the queue is not empty and maintains P2 because JQM=0, and that P3 is maintained.
    - 'Trigger 1': Shows periodic pulses.
    - 'ADC J context': Starts 'EMPTY', then shows 'P1', 'P2', and 'P3' corresponding to the queue's state.
    - 'ADC state': Shows 'RDY' periods followed by 'Conversion1' periods. Conversion1 occurs when the queue is not empty and a trigger is present.
    The diagram illustrates that when the queue becomes empty (after P1 is consumed), the next context (P2) is loaded. When P3 is written while P2 is still in the queue, P3 is added. The 'Note' indicates that due to internal resynchronization, there is a latency, and a trigger occurring just after or before writing P3 might result in a conversion considering context P2.
Timing diagram showing the behavior of the ADC context queue when it becomes empty (case JQM = 0). The diagram tracks five signals over time: 'Write ADC_JSQR', 'ADC_JSQR queue', 'Trigger 1', 'ADC J context (returned by reading ADC_JSQR)', and 'ADC state'. - 'Write ADC_JSQR': Shows pulses for contexts P1, P2, and P3. - 'ADC_JSQR queue': Starts 'EMPTY', then contains 'P1', then 'P1, P2', then 'P2'. When P3 is written, it becomes 'P2, P3'. Annotations indicate that the queue is not empty and maintains P2 because JQM=0, and that P3 is maintained. - 'Trigger 1': Shows periodic pulses. - 'ADC J context': Starts 'EMPTY', then shows 'P1', 'P2', and 'P3' corresponding to the queue's state. - 'ADC state': Shows 'RDY' periods followed by 'Conversion1' periods. Conversion1 occurs when the queue is not empty and a trigger is present. The diagram illustrates that when the queue becomes empty (after P1 is consumed), the next context (P2) is loaded. When P3 is written while P2 is still in the queue, P3 is added. The 'Note' indicates that due to internal resynchronization, there is a latency, and a trigger occurring just after or before writing P3 might result in a conversion considering context P2.
  1. 1. Parameters:
    P1: sequence of 1 conversion, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 1
    P3: sequence of 1 conversion, hardware trigger 1

Note: When writing P3, the context changes immediately. However, because of internal resynchronization, there is a latency and if a trigger occurs just after or before writing P3, it can happen that the conversion is launched considering the context P2. To avoid this situation, the user must ensure that there is no ADC trigger happening when writing a new context that applies immediately.

Figure 104. Example of ADC_JSQR queue of context with empty queue (case JQM = 1)

Timing diagram for Figure 104 showing ADC_JSQR queue behavior with JQM=1. The diagram includes signals for Write ADC_JSQR, ADC_JSQR queue, Trigger 1, ADC J context, and ADC state. It shows sequences P1, P2, and P3 being added to the queue. When the queue becomes empty, subsequent triggers are ignored because JQM=1.

The diagram illustrates the behavior of the ADC_JSQR queue when JQM=1. The 'ADC_JSQR queue' row shows the queue's state: initially 'EMPTY', then 'P1' is added, then 'P1,P2', then 'P2' (as P1 is converted), then 'EMPTY' (as P2 is converted). When the queue is 'EMPTY', a trigger for P3 is ignored. After P3 is added, the queue becomes 'EMPTY' again, and another trigger is ignored. The 'ADC J context (returned by reading ADC_JSQR)' row shows 'EMPTY', 'P1', 'P2', 'EMPTY (0x00)', 'P3', and 'EMPTY'. The 'ADC state' row shows 'RDY', 'Conversion1', 'RDY', 'Conversion', 'RDY', 'Conversion1', and 'RDY'.

Timing diagram for Figure 104 showing ADC_JSQR queue behavior with JQM=1. The diagram includes signals for Write ADC_JSQR, ADC_JSQR queue, Trigger 1, ADC J context, and ADC state. It shows sequences P1, P2, and P3 being added to the queue. When the queue becomes empty, subsequent triggers are ignored because JQM=1.
  1. 1. Parameters:
    P1: sequence of 1 conversion, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 1
    P3: sequence of 1 conversion, hardware trigger 1

Flushing the queue of context

The figures below show the behavior of the context Queue in various situations when the queue is flushed.

Figure 105. Flushing ADC_JSQR queue of context by setting JADSTP = 1 (JQM = 0)
Case when JADSTP occurs during an ongoing conversion

Timing diagram for Figure 105 showing the effect of setting JADSTP=1 during a conversion. The diagram includes signals for Write ADC_JSQR, ADC_JSQR queue, JADSTP, JADSTART, Trigger 1, ADC J context, and ADC state. It shows that setting JADSTP=1 flushes the queue, losing the last active context (P2) and maintaining the last active context (P1).

The diagram shows the effect of setting JADSTP=1 during an ongoing conversion. The 'ADC_JSQR queue' row shows 'EMPTY', 'P1', 'P1, P2', 'P1' (after JADSTP is set), and 'P3' (after JADSTP is reset). The 'ADC J context (returned by reading ADC_JSQR)' row shows 'EMPTY', 'P1', and 'P3'. The 'ADC state' row shows 'RDY', 'Conv1 (Aborted)', 'STP', 'RDY', 'Conversion1', and 'RDY'.

Timing diagram for Figure 105 showing the effect of setting JADSTP=1 during a conversion. The diagram includes signals for Write ADC_JSQR, ADC_JSQR queue, JADSTP, JADSTART, Trigger 1, ADC J context, and ADC state. It shows that setting JADSTP=1 flushes the queue, losing the last active context (P2) and maintaining the last active context (P1).
  1. 1. Parameters:
    P1: sequence of 1 conversion, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 1
    P3: sequence of 1 conversion, hardware trigger 1

Figure 106. Flushing ADC_JSQR queue of context by setting JADSTP = 1 (JQM = 0)
Case when JADSTP occurs during an ongoing conversion and a new trigger occurs.

Timing diagram for Figure 106 showing the flushing of the ADC_JSQR queue during an ongoing conversion. The diagram includes signals for Write ADC_JSQR, ADC_JSQR queue, JADSTP, JADSTART, Trigger 1, ADC J context, and ADC state. It shows that when JADSTP is set during an ongoing conversion (Conv1), the queue is flushed and maintains the last active context (P1), while P2 is lost. A new trigger (P3) occurs after the conversion is aborted.

The diagram illustrates the following sequence of events:

MS30543V2

Timing diagram for Figure 106 showing the flushing of the ADC_JSQR queue during an ongoing conversion. The diagram includes signals for Write ADC_JSQR, ADC_JSQR queue, JADSTP, JADSTART, Trigger 1, ADC J context, and ADC state. It shows that when JADSTP is set during an ongoing conversion (Conv1), the queue is flushed and maintains the last active context (P1), while P2 is lost. A new trigger (P3) occurs after the conversion is aborted.
  1. Parameters:
    P1: sequence of 1 conversion, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 1
    P3: sequence of 1 conversion, hardware trigger 1

Figure 107. Flushing ADC_JSQR queue of context by setting JADSTP = 1 (JQM = 0)
Case when JADSTP occurs outside an ongoing conversion

Timing diagram for Figure 107 showing the flushing of the ADC_JSQR queue when JADSTP is set outside an ongoing conversion. The diagram includes signals for Write ADC_JSQR, ADC_JSQR queue, JADSTP, JADSTART, Trigger 1, ADC J context, and ADC state. It shows that when JADSTP is set while the ADC is in the STOP state, the queue is flushed and maintains the last active context (P1), while P2 is lost. A new trigger (P3) occurs after the conversion is aborted.

The diagram illustrates the following sequence of events:

MS30544V3

Timing diagram for Figure 107 showing the flushing of the ADC_JSQR queue when JADSTP is set outside an ongoing conversion. The diagram includes signals for Write ADC_JSQR, ADC_JSQR queue, JADSTP, JADSTART, Trigger 1, ADC J context, and ADC state. It shows that when JADSTP is set while the ADC is in the STOP state, the queue is flushed and maintains the last active context (P1), while P2 is lost. A new trigger (P3) occurs after the conversion is aborted.
  1. Parameters:
    P1: sequence of 1 conversion, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 1
    P3: sequence of 1 conversion, hardware trigger 1

Figure 108. Flushing ADC_JSQR queue of context by setting JADSTP = 1 (JQM = 1)

Timing diagram for Figure 108 showing the flushing of the ADC_JSQR queue when JADSTP = 1. The diagram tracks the ADC_JSQR queue, JADSTP, JADSTART, Trigger 1, ADC J context, and ADC state over time. It shows that setting JADSTP = 1 while the queue contains P1 and P2 results in the queue becoming empty and P2 being lost. Subsequent writing of P3 and triggering a conversion results in only P3 being converted.

The diagram illustrates the behavior of the ADC when JADSTP = 1 and JQM = 1.
1. Initial State: The ADC_JSQR queue is EMPTY, and the ADC state is RDY.
2. Write P1: A write to ADC_JSQR adds parameter P1 to the queue.
3. Write P2: A subsequent write adds parameter P2. The queue now contains P1, P2.
4. Set JADSTP: The JADSTP bit is set by software. An annotation indicates that the queue is flushed and becomes empty, and P2 is lost. The queue is now EMPTY.
5. Reset JADSTP: The JADSTP bit is reset by hardware.
6. Write P3: A write to ADC_JSQR adds parameter P3. The queue contains P3.
7. Trigger 1: Trigger 1 is asserted. The ADC J context (returned by reading ADC_JSQR) is P3. The ADC state becomes CONVERSION1.
8. Start Conversion: The conversion starts (STP).
9. Abort: An aborted conversion is shown, returning the ADC state to RDY.
10. Reset JADSTART: The JADSTART bit is reset by hardware.
11. Set JADSTART: The JADSTART bit is set by software.
12. Trigger 1 (Ignored): Trigger 1 is asserted again but is ignored because JADSTART is already set.
13. Final State: The ADC state returns to RDY.
Reference: MS30545V2

Timing diagram for Figure 108 showing the flushing of the ADC_JSQR queue when JADSTP = 1. The diagram tracks the ADC_JSQR queue, JADSTP, JADSTART, Trigger 1, ADC J context, and ADC state over time. It shows that setting JADSTP = 1 while the queue contains P1 and P2 results in the queue becoming empty and P2 being lost. Subsequent writing of P3 and triggering a conversion results in only P3 being converted.
  1. Parameters:
    P1: sequence of 1 conversion, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 1
    P3: sequence of 1 conversion, hardware trigger 1

Figure 109. Flushing ADC_JSQR queue of context by setting ADDIS = 1 (JQM = 0)

Timing diagram for Figure 109 showing the flushing of the ADC_JSQR queue when ADDIS = 1. The diagram tracks the ADC_JSQR queue, ADDIS, ADC J context, and ADC state over time. It shows that setting ADDIS = 1 while the queue contains P1 and P2 results in the queue being flushed and maintaining only the last active context (P2, which was not consumed). Subsequent writing of P1 and triggering a conversion results in only P1 being converted.

The diagram illustrates the behavior of the ADC when ADDIS = 1 and JQM = 0.
1. Initial State: The ADC_JSQR queue contains P1, P2, and the ADC state is RDY.
2. Read Context: The ADC J context (returned by reading ADC_JSQR) is P1.
3. Set ADDIS: The ADDIS bit is set by software. An annotation indicates that the queue is flushed and maintains the last active context (P2 which was not consumed is lost). The queue now contains P1.
4. Reset ADDIS: The ADDIS bit is reset by hardware.
5. Final State: The ADC state becomes REQ-OFF and then OFF.
Reference: MS30546V2

Timing diagram for Figure 109 showing the flushing of the ADC_JSQR queue when ADDIS = 1. The diagram tracks the ADC_JSQR queue, ADDIS, ADC J context, and ADC state over time. It shows that setting ADDIS = 1 while the queue contains P1 and P2 results in the queue being flushed and maintaining only the last active context (P2, which was not consumed). Subsequent writing of P1 and triggering a conversion results in only P1 being converted.
  1. Parameters:
    P1: sequence of 1 conversion, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 1
    P3: sequence of 1 conversion, hardware trigger 1

Figure 110. Flushing ADC_JSQR queue of context by setting ADDIS = 1 (JQM = 1)

Timing diagram showing the effect of setting ADDIS = 1 on the ADC_JSQR queue. The diagram illustrates four signals over time: ADC_JSQR queue, ADDIS, ADC J context, and ADC state. The ADC_JSQR queue initially contains parameters P1 and P2. When ADDIS is set by software, the queue becomes empty (0x00). The ADC J context, returned by reading ADC_JSQR, initially contains P1 and becomes EMPTY (0x00) after the queue is flushed. The ADC state transitions from RDY to REQ-OFF and then to OFF.

The diagram illustrates the timing of flushing the ADC_JSQR queue. The top signal, 'ADC_JSQR queue', shows it initially containing 'P1, P2'. When the 'ADDIS' bit is 'Set by S/W', the queue becomes 'EMPTY'. A note above indicates: 'Queue is flushed and becomes empty (ADC_JSQR is read as 0x00)'. The 'ADC J context (returned by reading ADC_JSQR)' initially shows 'P1' and becomes 'EMPTY (0x00)' after the flush. The 'ADC state' transitions from 'RDY' to 'REQ-OFF' and then to 'OFF'. The 'ADDIS' bit is shown being 'Set by S/W' and 'Reset by H/W'. The diagram is labeled 'MS30547V4' in the bottom right corner.

Timing diagram showing the effect of setting ADDIS = 1 on the ADC_JSQR queue. The diagram illustrates four signals over time: ADC_JSQR queue, ADDIS, ADC J context, and ADC state. The ADC_JSQR queue initially contains parameters P1 and P2. When ADDIS is set by software, the queue becomes empty (0x00). The ADC J context, returned by reading ADC_JSQR, initially contains P1 and becomes EMPTY (0x00) after the queue is flushed. The ADC state transitions from RDY to REQ-OFF and then to OFF.
  1. 1. Parameters:
    P1: sequence of 1 conversion, hardware trigger 1
    P2: sequence of 1 conversion, hardware trigger 1
    P3: sequence of 1 conversion, hardware trigger 1

Queue of context: Starting the ADC with an empty queue

The following procedure must be followed to start ADC operation with an empty queue, in case the first context is not known at the time the ADC is initialized. This procedure is only applicable when JQM bit is reset:

  1. 5. Write a dummy ADC_JSQR with JEXTEN[1:0] not equal to 00 (otherwise triggering a software conversion).
  2. 6. Set JADSTART.
  3. 7. Set JADSTP.
  4. 8. Wait until JADSTART is reset.
  5. 9. Set JADSTART.

Disabling the queue

It is possible to disable the queue by setting bit JQDIS = 1 into the ADC_CFGR register.

21.4.22 Programmable resolution (RES) - Fast conversion mode

It is possible to perform faster conversion by reducing the ADC resolution.

The resolution can be configured to be either 12, 10, 8, or 6 bits by programming the control bits RES[1:0]. Figure 115 , Figure 116 , Figure 117 and Figure 118 show the conversion result format with respect to the resolution as well as to the data alignment.

Lower resolution allows faster conversion time for applications where high-data precision is not required. It reduces the conversion time spent by the successive approximation steps according to Table 170 .

Table 170. \( T_{SAR} \) timings depending on resolution
RES (bits)\( T_{SAR} \) (ADC clock cycles)\( T_{SAR} \) (ns) at \( F_{ADC}= 30 \) MHz\( T_{CONV} \) (ADC clock cycles) (with Sampling Time= 2.5 ADC clock cycles)\( T_{CONV} \) (ns) at \( F_{ADC}= 30 \) MHz
1212.5 ADC clock cycles416.67 ns15 ADC clock cycles500.0 ns
1010.5 ADC clock cycles350.0 ns13 ADC clock cycles433.33 ns
88.5 ADC clock cycles203.33 ns11 ADC clock cycles366.67 ns
66.5 ADC clock cycles216.67 ns9 ADC clock cycles300.0 ns

21.4.23 End of conversion, end of sampling phase (EOC, JEOC, EOSMP)

The ADC notifies the application for each end of regular conversion (EOC) event and each injected conversion (JEOC) event.

The ADC sets the EOC flag as soon as a new regular conversion data is available in the ADC_DR register. An interrupt can be generated if bit EOCIE is set. EOC flag is cleared by the software either by writing 1 to it or by reading ADC_DR.

The ADC sets the JEOC flag as soon as a new injected conversion data is available in one of the ADC_JDRy register. An interrupt can be generated if bit JEOCIE is set. JEOC flag is cleared by the software either by writing 1 to it or by reading the corresponding ADC_JDRy register.

The ADC also notifies the end of Sampling phase by setting the status bit EOSMP (for regular conversions only). EOSMP flag is cleared by software by writing 1 to it. An interrupt can be generated if bit EOSMPIE is set.

21.4.24 End of conversion sequence (EOS, JEOS)

The ADC notifies the application for each end of regular sequence (EOS) and for each end of injected sequence (JEOS) event.

The ADC sets the EOS flag as soon as the last data of the regular conversion sequence is available in the ADC_DR register. An interrupt can be generated if bit EOSIE is set. EOS flag is cleared by the software either by writing 1 to it.

The ADC sets the JEOS flag as soon as the last data of the injected conversion sequence is complete. An interrupt can be generated if bit JEOSIE is set. JEOS flag is cleared by the software either by writing 1 to it.

21.4.25 Timing diagrams example (single/continuous modes, hardware/software triggers)

Figure 111. Single conversions of a sequence, software trigger

Timing diagram for single conversions of a sequence with a software trigger. It shows the relationship between ADSTART, EOC, EOS, ADC state, and ADC_DR signals over time. The sequence includes channels CH1, CH9, CH10, and CH17. The diagram is labeled with 'by SW' for software trigger and 'by HW' for hardware trigger. Reference number MS30549V1 is present.

Timing diagram for single conversions of a sequence, software trigger. The diagram shows the relationship between ADSTART (1) , EOC, EOS, ADC state (2) , and ADC_DR signals over time. The sequence includes channels CH1, CH9, CH10, and CH17. The diagram is labeled with 'by SW' for software trigger and 'by HW' for hardware trigger. Reference number MS30549V1 is present.

Timing diagram for single conversions of a sequence with a software trigger. It shows the relationship between ADSTART, EOC, EOS, ADC state, and ADC_DR signals over time. The sequence includes channels CH1, CH9, CH10, and CH17. The diagram is labeled with 'by SW' for software trigger and 'by HW' for hardware trigger. Reference number MS30549V1 is present.

Figure 112. Continuous conversion of a sequence, software trigger

Timing diagram for continuous conversion of a sequence with a software trigger. It shows the relationship between ADCSTART, EOC, EOS, ADSTP, ADC state, and ADC_DR signals over time. The sequence includes channels CH1, CH9, CH10, and CH17, followed by a STOP state. The diagram is labeled with 'by SW' for software trigger and 'by HW' for hardware trigger. Reference number MS30550V1 is present.

Timing diagram for continuous conversion of a sequence, software trigger. The diagram shows the relationship between ADCSTART (1) , EOC, EOS, ADSTP, ADC state (2) , and ADC_DR signals over time. The sequence includes channels CH1, CH9, CH10, and CH17, followed by a STOP state. The diagram is labeled with 'by SW' for software trigger and 'by HW' for hardware trigger. Reference number MS30550V1 is present.

Timing diagram for continuous conversion of a sequence with a software trigger. It shows the relationship between ADCSTART, EOC, EOS, ADSTP, ADC state, and ADC_DR signals over time. The sequence includes channels CH1, CH9, CH10, and CH17, followed by a STOP state. The diagram is labeled with 'by SW' for software trigger and 'by HW' for hardware trigger. Reference number MS30550V1 is present.

Figure 113. Single conversions of a sequence, hardware trigger

Timing diagram for single conversions of a sequence with hardware trigger. It shows signals ADSTART, EOC, EOS, TRGX(1), ADC state(2), and ADC_DR over time. The diagram illustrates the sequence of events: ADSTART pulse, followed by a series of conversions for channels CH1, CH2, CH3, CH4. EOC pulses occur after each conversion. EOS goes low after the last conversion (CH4) and high after the next sequence starts. TRGX(1) is a periodic over-frequency trigger. ADC state shows RDY, CH1, CH2, CH3, CH4, READ, CH1, CH2, CH3, CH4, RDY. ADC_DR shows data D1, D2, D3, D4, D1, D2, D3, D4. Legend: by s/w (software), by h/w (hardware), triggered, ignored, Indicative timings. MS31013V2
Timing diagram for single conversions of a sequence with hardware trigger. It shows signals ADSTART, EOC, EOS, TRGX(1), ADC state(2), and ADC_DR over time. The diagram illustrates the sequence of events: ADSTART pulse, followed by a series of conversions for channels CH1, CH2, CH3, CH4. EOC pulses occur after each conversion. EOS goes low after the last conversion (CH4) and high after the next sequence starts. TRGX(1) is a periodic over-frequency trigger. ADC state shows RDY, CH1, CH2, CH3, CH4, READ, CH1, CH2, CH3, CH4, RDY. ADC_DR shows data D1, D2, D3, D4, D1, D2, D3, D4. Legend: by s/w (software), by h/w (hardware), triggered, ignored, Indicative timings. MS31013V2
  1. 1. TRGx (over-frequency) is selected as trigger source, EXTEN[1:0] = 01, CONT = 0
  2. 2. Channels selected = 1, 2, 3, 4; AUTDLY = 0.

Figure 114. Continuous conversions of a sequence, hardware trigger

Timing diagram for continuous conversions of a sequence with hardware trigger. It shows signals ADSTART, EOC, EOS, ADSTP, TRGX(1), ADC(2), and ADC_DR over time. The diagram illustrates the sequence of events: ADSTART pulse, followed by continuous conversions for channels CH1, CH2, CH3, CH4. EOC pulses occur after each conversion. EOS goes low after the last conversion (CH4) and high after the next sequence starts. ADSTP goes high to stop the sequence. TRGX(1) is a periodic over-frequency trigger. ADC state shows RDY, CH1, CH2, CH3, CH4, CH1, CH2, CH3, CH4, CH1, STOP, RDY. ADC_DR shows data D1, D2, D3, D4, D1, D2, D3, D4. Legend: by s/w (software), by h/w (hardware), triggered, ignored, Not in scale timings. MS31014V2
Timing diagram for continuous conversions of a sequence with hardware trigger. It shows signals ADSTART, EOC, EOS, ADSTP, TRGX(1), ADC(2), and ADC_DR over time. The diagram illustrates the sequence of events: ADSTART pulse, followed by continuous conversions for channels CH1, CH2, CH3, CH4. EOC pulses occur after each conversion. EOS goes low after the last conversion (CH4) and high after the next sequence starts. ADSTP goes high to stop the sequence. TRGX(1) is a periodic over-frequency trigger. ADC state shows RDY, CH1, CH2, CH3, CH4, CH1, CH2, CH3, CH4, CH1, STOP, RDY. ADC_DR shows data D1, D2, D3, D4, D1, D2, D3, D4. Legend: by s/w (software), by h/w (hardware), triggered, ignored, Not in scale timings. MS31014V2
  1. 1. TRGx is selected as trigger source, EXTEN[1:0] = 10, CONT = 1
  2. 2. Channels selected = 1, 2, 3, 4; AUTDLY = 0.

21.4.26 Data management

Data register, data alignment and offset (ADC_DR, OFFSETy, OFFSETy_CH, ALIGN)

Data and alignment

At the end of each regular conversion channel (when EOC event occurs), the result of the converted data is stored into the ADC_DR data register which is 16 bits wide.

At the end of each injected conversion channel (when JEOC event occurs), the result of the converted data is stored into the corresponding ADC_JDRy data register which is 16 bits wide.

The ALIGN bit in the ADC_CFGR register selects the alignment of the data stored after conversion. Data can be right- or left-aligned as shown in Figure 115 , Figure 116 , Figure 117 and Figure 118 .

Special case: when left-aligned, the data are aligned on a half-word basis except when the resolution is set to 6-bit. In that case, the data are aligned on a byte basis as shown in Figure 117 and Figure 118 .

Note: Left-alignment is not supported in oversampling mode. When ROVSE and/or JOVSE bit is set, the ALIGN bit value is ignored and the ADC only provides right-aligned data.

Offset

An offset y (y = 1,2,3,4) can be applied to a channel by setting the bit OFFSETy_EN = 1 into ADC_OFRy register. The channel to which the offset is applied is programmed into the bits OFFSETy_CH[4:0] of ADC_OFRy register. In this case, the converted value is decreased by the user-defined offset written in the bits OFFSETy[11:0]. The result may be a negative value so the read data is signed and the SEXT bit represents the extended sign value.

Note: Offset correction is not supported in oversampling mode. When ROVSE and/or JOVSE bit is set, the value of the OFFSETy_EN bit in ADC_OFRy register is ignored (considered as reset).

Table 173 describes how the comparison is performed for all the possible resolutions for analog watchdog 1.

Table 171. Offset computation versus data resolution

Resolution (bits RES[1:0])Subtraction between raw converted data and offsetResultComments
Raw converted Data, left alignedOffset
00: 12-bitDATA[11:0]OFFSET[11:0]Signed 12-bit data-
01: 10-bitDATA[11:2],00OFFSET[11:0]Signed 10-bit dataThe user must configure OFFSET[1:0] to 00

Table 171. Offset computation versus data resolution (continued)

Resolution
(bits
RES[1:0])
Subtraction between raw
converted data and offset
ResultComments
Raw
converted
Data, left
aligned
Offset
10: 8-bitDATA[11:4],00
00
OFFSET[11:0]Signed
8-bit data
The user must configure OFFSET[3:0]
to 0000
11: 6-bitDATA[11:6],00
0000
OFFSET[11:0]Signed
6-bit data
The user must configure OFFSET[5:0]
to 000000

When reading data from ADC_DR (regular channel) or from ADC_JDRy (injected channel, y = 1,2,3,4) corresponding to the channel “i”:

Figure 115, Figure 116, Figure 117 and Figure 118 show alignments for signed and unsigned data.

Figure 115. Right alignment (offset disabled, unsigned value)

12-bit data
bit15bit7bit0
0000D11D10D9D8D7D6D5D4D3D2D1D0
10-bit data
bit15bit7bit0
000000D9D8D7D6D5D4D3D2D1D0
8-bit data
bit15bit7bit0
00000000D7D6D5D4D3D2D1D0
6-bit data
bit15bit7bit0
0000000000D5D4D3D2D1D0

MS31015V1

Figure 116. Right alignment (offset enabled, signed value)

Diagram showing right alignment for 12-bit, 10-bit, 8-bit, and 6-bit data. Each section shows a 16-bit register structure with sign extension (SEXT) and data bits (D11-D0) aligned to the right. Bit 15 is the sign bit, bit 7 is the middle bit, and bit 0 is the least significant bit.

12-bit data

SEXTD11D10D9D8D7D6D5D4D3D2D1D0
bit15bit7bit0

10-bit data

SEXTD9D8D7D6D5D4D3D2D1D0
bit15bit7bit0

8-bit data

SEXTD7D6D5D4D3D2D1D0
bit15bit7bit0

6-bit data

SEXTD5D4D3D2D1D0
bit15bit7bit0

MS31016V1

Diagram showing right alignment for 12-bit, 10-bit, 8-bit, and 6-bit data. Each section shows a 16-bit register structure with sign extension (SEXT) and data bits (D11-D0) aligned to the right. Bit 15 is the sign bit, bit 7 is the middle bit, and bit 0 is the least significant bit.

Figure 117. Left alignment (offset disabled, unsigned value)

Diagram showing left alignment for 12-bit, 10-bit, 8-bit, and 6-bit data. Each section shows a 16-bit register structure with data bits (D11-D0) aligned to the left and the remaining bits filled with zeros. Bit 15 is the most significant bit, bit 7 is the middle bit, and bit 0 is the least significant bit.

12-bit data

D11D10D9D8D7D6D5D4D3D2D1D00000
bit15bit7bit0

10-bit data

D9D8D7D6D5D4D3D2D1D0000000
bit15bit7bit0

8-bit data

D7D6D5D4D3D2D1D000000000
bit15bit7bit0

6-bit data

00000000D5D4D3D2D1D000
bit15bit7bit0

MS31017V1

Diagram showing left alignment for 12-bit, 10-bit, 8-bit, and 6-bit data. Each section shows a 16-bit register structure with data bits (D11-D0) aligned to the left and the remaining bits filled with zeros. Bit 15 is the most significant bit, bit 7 is the middle bit, and bit 0 is the least significant bit.

Figure 118. Left alignment (offset enabled, signed value)

Figure 118 shows four bit field diagrams for 12-bit, 10-bit, 8-bit, and 6-bit data with left alignment and offset enabled. Each diagram shows a 16-bit register structure with SEXT, data bits (D15 to D0), and trailing zeros. The bit positions for bit15, bit7, and bit0 are indicated above each diagram.

12-bit data

bit15 bit7 bit0
SEXTD11D10D9D8D7D6D5D4D3D2D1D0000

10-bit data

bit15 bit7 bit0
SEXTD9D8D7D6D5D4D3D2D1D000000

8-bit data

bit15 bit7 bit0
SEXTD7D6D5D4D3D2D1D00000000

6-bit data

bit15 bit7 bit0
SEXTSEXTSEXTSEXTSEXTSEXTSEXTSEXTSEXTD5D4D3D2D1D00

MS31018V1

Figure 118 shows four bit field diagrams for 12-bit, 10-bit, 8-bit, and 6-bit data with left alignment and offset enabled. Each diagram shows a 16-bit register structure with SEXT, data bits (D15 to D0), and trailing zeros. The bit positions for bit15, bit7, and bit0 are indicated above each diagram.

Gain compensation

When GCOMP bit is set in ADC_CFGR2 register, the gain compensation is activated on all the converted data. After each conversion, data is calculated with the following formula.

\[ \text{DATA} = \text{DATA}(\text{adc result}) \times (\text{GCOMPCOEFF}) / 4096 \]

As GCOMPCOEFF can be programmed from 0 to 16383, the actual gain compensation factor can range from 0 to 3.999756.

Before storing the resulting data in RDATA or JDATAx registers, the LSB-1 value is evaluated to round up the data and minimize the error.

The gain compensation is also effective for the oversampling. When the gain compensation is used for the oversampling mode, the gain calculation is performed after the accumulation and right-shift operations to minimize the power consumption (the gain calculation is done only once instead of at each conversion).

Offset compensation

When SATEN bit is set in ADC_OF Ry register during offset operation, data are unsigned. All the offset data saturate at 0x000 (in 12-bit mode). When OFFSETPOS bit is set, the offset direction is positive and the data saturate at 0xFFF (in 12-bit mode). In 8-bit mode, data saturate at 0x00 and 0xFF, respectively.

The analog watchdog comparison is performed on unsigned values, after offset and gain compensation. For correct watchdog operation, the data after offset compensation must be in unsigned format (SATEN bit set in ADC_OF Ry register).

ADC overrun (OVR, OVRMOD)

The overrun flag (OSR) notifies of that a buffer overrun event occurred when the regular converted data has not been read (by the CPU or the DMA) before new converted data became available.

The OVR flag is set if the EOC flag is still 1 at the time when a new conversion completes. An interrupt can be generated if bit OVRIE = 1.

When an overrun condition occurs, the ADC is still operating and can continue converting unless the software decides to stop and reset the sequence by setting bit ADSTP = 1.

OVR flag is cleared by software by writing 1 to it.

It is possible to configure if data is preserved or overwritten when an overrun event occurs by programming the control bit OVRMOD:

Figure 119. Example of overrun (OVR)

Timing diagram showing ADC signals (ADSTART, EOC, EOS, OVR, ADSTP, TRGx) and data states (RDY, CH1-CH7, STOP) over time. It illustrates an overrun condition where a new conversion (CH5) completes before the previous data (CH4) is read. Two scenarios for ADC_DR are shown: OVRMOD=0 where data D4 is preserved despite the overrun, and OVRMOD=1 where data D4 is overwritten by D5.

The diagram illustrates the timing of an ADC overrun event. The top section shows signal transitions for ADSTART (1) , EOC, EOS, OVR, ADSTP, and TRGx (1) . Below this, the 'ADC state (2) ' is shown as a sequence of states: RDY, CH1, CH2, CH3, CH4, CH5, CH6, CH7, STOP, and RDY. An 'Overrun' is indicated during the CH5 state. The 'ADC_DR read access' line shows when data is read from the data register. Two rows for 'ADC_DR' show the data values: for OVRMOD=0, the values are D1, D2, D3, D4 (with D4 preserved during the overrun); for OVRMOD=1, the values are D1, D2, D3, D4, D5, D6 (with D4 overwritten by D5). A legend at the bottom indicates timing markers: 'by s/w' (software), 'by h/w' (hardware), and 'triggered'. The diagram is labeled 'Indicative timings' and 'MS31019V1'.

Timing diagram showing ADC signals (ADSTART, EOC, EOS, OVR, ADSTP, TRGx) and data states (RDY, CH1-CH7, STOP) over time. It illustrates an overrun condition where a new conversion (CH5) completes before the previous data (CH4) is read. Two scenarios for ADC_DR are shown: OVRMOD=0 where data D4 is preserved despite the overrun, and OVRMOD=1 where data D4 is overwritten by D5.

Note: There is no overrun detection on the injected channels since there is a dedicated data register for each of the four injected channels.

Managing a sequence of conversions without using the DMA

If the conversions are slow enough, the conversion sequence can be handled by the software. In this case the software must use the EOC flag and its associated interrupt to handle each data. Each time a conversion is complete, EOC is set and the ADC_DR register can be read. OVRMOD should be configured to 0 to manage overrun events as an error.

Managing conversions without using the DMA and without overrun

It may be useful to let the ADC convert one or more channels without reading the data each time (if there is an analog watchdog for instance). In this case, the OVRMOD bit must be configured to 1 and OVR flag should be ignored by the software. An overrun event does not prevent the ADC from continuing to convert and the ADC_DR register always contains the latest conversion.

Managing conversions using the DMA

Since converted channel values are stored into a unique data register, it is useful to use DMA for conversion of more than one channel. This avoids the loss of the data already stored in the ADC_DR register.

When the DMA mode is enabled (DMAEN bit set in the ADC_CFGR register in single ADC mode or MDMA different from 00 in dual ADC mode), a DMA request is generated after each conversion of a channel. This allows the transfer of the converted data from the ADC_DR register to the destination location selected by the software.

Despite this, if an overrun occurs (OVR = 1) because the DMA could not serve the DMA transfer request in time, the ADC stops generating DMA requests and the data corresponding to the new conversion is not transferred by the DMA. Which means that all the data transferred to the RAM can be considered as valid.

Depending on the configuration of OVRMOD bit, the data is either preserved or overwritten (refer to Section : ADC overrun (OVR, OVRMOD) ).

The DMA transfer requests are blocked until the software clears the OVR bit.

Two different DMA modes are proposed depending on the application use and are configured with bit DMACFG of the ADC_CFGR register in single ADC mode, or with bit DMACFG of the ADC_CCR register in dual ADC mode:

DMA one shot mode (DMACFG = 0)

In this mode, the ADC generates a DMA transfer request each time a new conversion data is available and stops generating DMA requests once the DMA has reached the last DMA transfer (when a transfer complete interrupt occurs - refer to DMA section) even if a conversion has been started again.

When the DMA transfer is complete (all the transfers configured in the DMA controller have been done):

DMA circular mode (DMACFG = 1)

In this mode, the ADC generates a DMA transfer request each time a new conversion data is available in the data register, even if the DMA has reached the last DMA transfer. This allows configuring the DMA in circular mode to handle a continuous analog input data stream.

21.4.27 Dynamic low-power features

Auto-delayed conversion mode (AUTDLY)

The ADC implements an auto-delayed conversion mode controlled by the AUTDLY configuration bit. Auto-delayed conversions are useful to simplify the software as well as to optimize performance of an application clocked at low frequency where there would be risk of encountering an ADC overrun.

When AUTDLY = 1, a new conversion can start only if all the previous data of the same group has been treated:

This is a way to automatically adapt the speed of the ADC to the speed of the system which reads the data.

The delay is inserted after each regular conversion (whatever DISCEN = 0 or 1) and after each sequence of injected conversions (whatever JDISCEN = 0 or 1).

Note: There is no delay inserted between each conversions of the injected sequence, except after the last one.

During a conversion, a hardware trigger event (for the same group of conversions) occurring during this delay is ignored.

Note: This is not true for software triggers where it remains possible during this delay to set the bits ADSTART or JADSTART to restart a conversion: it is up to the software to read the data before launching a new conversion.

No delay is inserted between conversions of different groups (a regular conversion followed by an injected conversion or conversely):

The behavior is slightly different in auto-injected mode (JAUTO = 1) where a new regular conversion can start only when the automatic delay of the previous injected sequence of conversion has ended (when JEOS has been cleared). This is to ensure that the software can read all the data of a given sequence before starting a new sequence (see Figure 124 ).

To stop a conversion in continuous auto-injection mode combined with autodelay mode (JAUTO = 1, CONT = 1 and AUTDLY = 1), follow the following procedure:

  1. 1. Wait until JEOS = 1 (no more conversions are restarted)
  2. 2. Clear JEOS.
  3. 3. Set ADSTP.
  4. 4. Read the regular data.

If this procedure is not respected, a new regular sequence can restart if JEOS is cleared after ADSTP has been set.

In AUTDLY mode, a hardware regular trigger event is ignored if it occurs during an already ongoing regular sequence or during the delay that follows the last regular conversion of the sequence. It is however considered pending if it occurs after this delay, even if it occurs during an injected sequence of the delay that follows it. The conversion then starts at the end of the delay of the injected sequence.

In AUTDLY mode, a hardware injected trigger event is ignored if it occurs during an already ongoing injected sequence or during the delay that follows the last injected conversion of the sequence.

Figure 120. AUTDLY = 1, regular conversion in continuous mode, software trigger

Timing diagram for Figure 120 showing ADC signals and states over time. The diagram includes signals for ADSTART (software trigger), EOC (end of conversion), EOS (end of sequence), ADSTP (stop), ADC_DR read access, ADC state (RDY, CH1, DLY, CH2, DLY, CH3, DLY, CH1, DLY, STOP, RDY), and ADC_DR (data registers D1, D2, D3, D1). It illustrates the sequence of events starting from a software trigger, through conversions of channels 1, 2, and 3 with delays, to a stop state and back to ready.

The timing diagram shows the following signals and states over time:

Triggers are indicated by arrows: "by SW" (software) for ADSTART and "by HW" (hardware) for EOC. A legend indicates "Indicative timings". The diagram is labeled MS31020V1.

Timing diagram for Figure 120 showing ADC signals and states over time. The diagram includes signals for ADSTART (software trigger), EOC (end of conversion), EOS (end of sequence), ADSTP (stop), ADC_DR read access, ADC state (RDY, CH1, DLY, CH2, DLY, CH3, DLY, CH1, DLY, STOP, RDY), and ADC_DR (data registers D1, D2, D3, D1). It illustrates the sequence of events starting from a software trigger, through conversions of channels 1, 2, and 3 with delays, to a stop state and back to ready.
  1. 1. AUTDLY = 1.
  2. 2. Regular configuration: EXTEN[1:0] = 00 (SW trigger), CONT = 1, CHANNELS = 1,2,3.
  3. 3. Injected configuration DISABLED.

Figure 121. AUTODLY = 1, regular HW conversions interrupted by injected conversions (DISCEN = 0; JDISCEN = 0)

Timing diagram showing regular and injected ADC conversions with AUTODLY=1. The diagram illustrates the sequence of events including triggers, ADC states (RDY, CH1, DLY, CH2, CH5, CH6, CH3), EOC, EOS, and data registers (ADC_DR, ADC_JDR1, ADC_JDR2).

The timing diagram illustrates the operation of an ADC with AUTODLY=1, where regular hardware (HW) conversions are interrupted by injected conversions. The diagram shows the following signals and states over time:

Timing diagram showing regular and injected ADC conversions with AUTODLY=1. The diagram illustrates the sequence of events including triggers, ADC states (RDY, CH1, DLY, CH2, CH5, CH6, CH3), EOC, EOS, and data registers (ADC_DR, ADC_JDR1, ADC_JDR2).
  1. 1. AUTODLY = 1
  2. 2. Regular configuration: EXTEN[1:0] = 01 (HW trigger), CONT = 0, DISCEN = 0, CHANNELS = 1, 2, 3
  3. 3. Injected configuration: JEXTEN[1:0] = 01 (HW Trigger), JDISCEN = 0, CHANNELS = 5,6

Figure 122. AUTODLY = 1, regular HW conversions interrupted by injected conversions (DISCEN = 1, JDISCEN = 1)

Timing diagram showing regular and injected ADC conversions with delays and triggers. The diagram illustrates the sequence of events for regular conversions (CH1, CH2, CH3) and injected conversions (CH5, CH6) under specific configuration settings. It includes signals for Regular trigger, ADC state (RDY, CH, DLY), EOC, EOS, read access, ADC_DR, Injected trigger, JEOS, ADC_JDR1, and ADC_JDR2. Delays (DLY) are shown for regular channels and the injected sequence. Data values D1, D2, D3, D5, and D6 are indicated in the ADC_DR and JDR registers. Some triggers are marked as 'Ignored' or 'Not ignored' based on the current conversion state.

MS31022V1

Timing diagram showing regular and injected ADC conversions with delays and triggers. The diagram illustrates the sequence of events for regular conversions (CH1, CH2, CH3) and injected conversions (CH5, CH6) under specific configuration settings. It includes signals for Regular trigger, ADC state (RDY, CH, DLY), EOC, EOS, read access, ADC_DR, Injected trigger, JEOS, ADC_JDR1, and ADC_JDR2. Delays (DLY) are shown for regular channels and the injected sequence. Data values D1, D2, D3, D5, and D6 are indicated in the ADC_DR and JDR registers. Some triggers are marked as 'Ignored' or 'Not ignored' based on the current conversion state.
  1. 1. AUTODLY = 1
  2. 2. Regular configuration: EXTEN[1:0] = 01 (HW trigger), CONT = 0, DISCEN = 1, DISCNUM = 1, CHANNELS = 1, 2, 3.
  3. 3. Injected configuration: JEXTEN[1:0] = 01 (HW Trigger), JDISCEN = 1, CHANNELS = 5,6

Figure 123. AUTODLY = 1, regular continuous conversions interrupted by injected conversions

Timing diagram for Figure 123 showing regular continuous conversions interrupted by injected conversions with AUTODLY = 1. The diagram illustrates the sequence of channels (CH1, CH2, CH5, CH6, CH3, CH1), delays (DLY), and data outputs (D1, D2, D3, D5, D6).

This timing diagram illustrates the ADC operation in continuous mode with AUTODLY = 1, where regular conversions are interrupted by injected conversions. The sequence starts with ADSTART (1) (by s/w) triggering the ADC into the RDY state. The regular conversion sequence consists of CH1, CH2, and CH3. Injected conversions consist of CH5 and CH6. Delays (DLY) are applied between conversions. Data outputs are shown as D1, D2, D3 for regular conversions and D5, D6 for injected conversions. The 'EOC' (End of Conversion) signal is shown for regular conversions, while 'JEOS' (End of Injected Sequence) is shown for injected conversions. The 'ADC_DR read access' signal indicates when data is read from the data register. The 'Injected trigger' signal is shown as 'Ignored' during the regular sequence. The diagram is labeled 'Indicative timings' and 'MS31023V3'.

Timing diagram for Figure 123 showing regular continuous conversions interrupted by injected conversions with AUTODLY = 1. The diagram illustrates the sequence of channels (CH1, CH2, CH5, CH6, CH3, CH1), delays (DLY), and data outputs (D1, D2, D3, D5, D6).
  1. 1. AUTODLY = 1
  2. 2. Regular configuration: EXTEN[1:0] = 00 (SW trigger), CONT = 1, DISCEN = 0, CHANNELS = 1, 2, 3
  3. 3. Injected configuration: JEXTEN[1:0] = 01 (HW Trigger), JDISCEN = 0, CHANNELS = 5,6

Figure 124. AUTODLY = 1 in auto- injected mode (JAUTO = 1)

Timing diagram for Figure 124 showing AUTODLY = 1 in auto-injected mode (JAUTO = 1). The diagram shows a sequence of regular conversions (CH1, CH2, CH3) and injected conversions (CH5, CH6) with delays, and data outputs D1, D2, D3, D5, D6.

This timing diagram illustrates the ADC operation in auto-injected mode with AUTODLY = 1 and JAUTO = 1. The sequence starts with ADSTART (1) (by s/w) triggering the ADC into the RDY state. The regular conversion sequence consists of CH1, CH2, and CH3. Injected conversions consist of CH5 and CH6. Delays (DLY) are applied between conversions. Data outputs are shown as D1, D2, D3 for regular conversions and D5, D6 for injected conversions. The 'EOC' (End of Conversion) signal is shown for regular conversions, while 'JEOS' (End of Injected Sequence) is shown for injected conversions. The 'ADC_DR read access' signal indicates when data is read from the data register. The diagram is labeled 'Indicative timings' and 'MS31024V4'.

Timing diagram for Figure 124 showing AUTODLY = 1 in auto-injected mode (JAUTO = 1). The diagram shows a sequence of regular conversions (CH1, CH2, CH3) and injected conversions (CH5, CH6) with delays, and data outputs D1, D2, D3, D5, D6.
  1. 1. AUTODLY = 1
  2. 2. Regular configuration: EXTEN[1:0] = 00 (SW trigger), CONT = 1, DISCEN = 0, CHANNELS = 1, 2
  3. 3. Injected configuration: JAUTO = 1, CHANNELS = 5,6

21.4.28 Analog window watchdog (AWD1EN, JAWD1EN, AWD1SGL, AWD1CH, AWD2CH, AWD3CH, AWD_HTx, AWD_LTx, AWDx)

The three AWD analog watchdogs monitor whether some channels remain within a configured voltage range (window).

Figure 125. Analog watchdog guarded area

Figure 125. Analog watchdog guarded area. A graph showing analog voltage on the y-axis. Two horizontal lines represent the 'Higher threshold' (HTx) and 'Lower threshold' (LTx). The region between these thresholds is shaded and labeled 'Guarded area'. The graph is labeled MS45396V1.
Figure 125. Analog watchdog guarded area. A graph showing analog voltage on the y-axis. Two horizontal lines represent the 'Higher threshold' (HTx) and 'Lower threshold' (LTx). The region between these thresholds is shaded and labeled 'Guarded area'. The graph is labeled MS45396V1.

AWDx flag and interrupt

An interrupt can be enabled for each of the 3 analog watchdogs by setting AWDxIE in the ADC_IER register (x = 1,2,3).

AWDx (x = 1,2,3) flag is cleared by software by writing 1 to it.

The ADC conversion result is compared to the lower and higher thresholds before alignment.

Description of analog watchdog 1

The AWD analog watchdog 1 is enabled by setting the AWD1EN bit in the ADC_CFGR register. This watchdog monitors whether either one selected channel or all enabled channels (1) remain within a configured voltage range (window).

Table 172 shows how the ADC_CFGR registers should be configured to enable the analog watchdog on one or more channels.

Table 172. Analog watchdog channel selection

Channels guarded by the analog watchdogAWD1SGL bitAWD1EN bitJAWD1EN bit
Nonex00
All injected channels001
All regular channels010
All regular and injected channels011
Single (1) injected channel101
Single (1) regular channel110
Single (1) regular or injected channel111
  1. 1. Selected by the AWD1CH[4:0] bits. The channels must also be programmed to be converted in the appropriate regular or injected sequence.

The AWD1 analog watchdog status bit is set if the analog voltage converted by the ADC is below a lower threshold or above a higher threshold.

These thresholds are programmed in bits HT1[11:0] and LT1[11:0] of the ADC_TR1 register for the analog watchdog 1. When converting data with a resolution of less than 12 bits (according to bits RES[1:0]), the LSB of the programmed thresholds must be kept cleared because the internal comparison is always performed on the full 12-bit raw converted data (left aligned).

Table 173 describes how the comparison is performed for all the possible resolutions for analog watchdog 1.

Table 173. Analog watchdog 1 comparison

Resolution(
bit
RES[1:0])
Analog watchdog comparison
between:
Comments
Raw converted data,
left aligned (1)
Thresholds
00: 12-bitDATA[11:0]LT1[11:0] and
HT1[11:0]
-
01: 10-bitDATA[11:2],00LT1[11:0] and
HT1[11:0]
User must configure LT1[1:0] and HT1[1:0]
to 00
10: 8-bitDATA[11:4],0000LT1[11:0] and
HT1[11:0]
User must configure LT1[3:0] and HT1[3:0]
to 0000
11: 6-bitDATA[11:6],000000LT1[11:0] and
HT1[11:0]
User must configure LT1[5:0] and HT1[5:0]
to 000000

1. Refer to Section : Gain compensation for additional details on analog watchdog comparison.

Analog watchdog filter for watchdog 1

When an ADC is configured with only one input channel (selecting several channels in Scan mode not allowed), a valid ADC conversion data filter can be configured:

Description of analog watchdog 2 and 3

The second and third analog watchdogs are more flexible and can guard several selected channels by programming the corresponding bits in AWDxCH[18:0] (x=2,3).

The corresponding watchdog is enabled when any bit of AWDxCH[18:0] (x=2,3) is set.

They are limited to a resolution of 8 bits and only the 8 MSBs of the thresholds can be programmed into HTx[7:0] and LTx[7:0]. Table 174 describes how the comparison is performed for all the possible resolutions.

Table 174. Analog watchdog 2 and 3 comparison

Resolution
(bits RES[1:0])
Analog watchdog comparison between:Comments
Raw converted data,
left aligned (1)
Thresholds
00: 12-bitDATA[11:4]LTx[7:0] and HTx[7:0]DATA[3:0] are not relevant for the comparison
01: 10-bitDATA[11:4]LTx[7:0] and HTx[7:0]DATA[3:2] are not relevant for the comparison
10: 8-bitDATA[11:4]LTx[7:0] and HTx[7:0]-
11: 6-bitDATA[11:6],00LTx[7:0] and HTx[7:0]User must configure LTx[1:0] and HTx[1:0] to 00

1. Refer to Section : Gain compensation for additional details on analog watchdog comparison.

ADC y _AWD x _OUT signal output generation

Each analog watchdog is associated to an internal hardware signal ADC y _AWD x _OUT (y=ADC number, x=watchdog number) which is directly connected to the ETR input (external trigger) of some on-chip timers. Refer to the on-chip timers section to understand how to select the ADC y _AWD x _OUT signal as ETR.

ADC y _AWD x _OUT is activated when the associated analog watchdog is enabled:

Note: AWD x flag is set by hardware and reset by software: AWD x flag has no influence on the generation of ADC y _AWD x _OUT (ex: ADC y _AWD x _OUT can toggle while AWD x flag remains at 1 if the software did not clear the flag).

Figure 126. ADC y _AWD x _OUT signal generation (on all regular channels) Timing diagram showing ADC STATE, EOC FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals over a sequence of 7 conversions. The diagram shows how the AWDx FLAG and ADCy_AWDx_OUT signal behave when conversions are 'inside' or 'outside' the programmed thresholds. The AWDx FLAG is set when a conversion is outside and cleared by software when it is inside. The ADCy_AWDx_OUT signal is set when the AWDx FLAG is set and reset when the AWDx FLAG is cleared.

The timing diagram illustrates the relationship between the ADC state, End of Conversion (EOC) flags, Analog Watchdog (AWD x ) flags, and the AWD x output signal across seven regular conversions. The conversions are categorized as 'inside' or 'outside' the programmed thresholds.

Legend:

MS31025V1

Timing diagram showing ADC STATE, EOC FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals over a sequence of 7 conversions. The diagram shows how the AWDx FLAG and ADCy_AWDx_OUT signal behave when conversions are 'inside' or 'outside' the programmed thresholds. The AWDx FLAG is set when a conversion is outside and cleared by software when it is inside. The ADCy_AWDx_OUT signal is set when the AWDx FLAG is set and reset when the AWDx FLAG is cleared.

Figure 127. ADC y _AWD x _OUT signal generation (AWD x flag not cleared by software)

Timing diagram for Figure 127 showing ADC STATE, EOC FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals for multiple regular channels (Conversion1-7) where the AWDx flag is not cleared by software.

The diagram shows the following signal states over time:

  • - Converting regular channels 1,2,3,4,5,6,7
  • - Regular channels 1,2,3,4,5,6,7 are all guarded

MS31026V1

Timing diagram for Figure 127 showing ADC STATE, EOC FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals for multiple regular channels (Conversion1-7) where the AWDx flag is not cleared by software.

Figure 128. ADC y _AWD x _OUT signal generation (on a single regular channel)

Timing diagram for Figure 128 showing ADC STATE, EOC FLAG, EOS FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals for regular channels 1 and 2, where only channel 1 is guarded and the AWDx flag is cleared by software.

The diagram shows the following signal states over time:

  • - Converting regular channels 1 and 2
  • - Only channel 1 is guarded

MS31027V1

Timing diagram for Figure 128 showing ADC STATE, EOC FLAG, EOS FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals for regular channels 1 and 2, where only channel 1 is guarded and the AWDx flag is cleared by software.

Figure 129. ADC y _AWD x _OUT signal generation (on all injected channels)

Timing diagram for Figure 129 showing ADC STATE, JEOS FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals for injected channels 1, 2, 3, and 4, where all are guarded and the AWDx flag is cleared by software.

The diagram shows the following signal states over time:

  • - Converting the injected channels 1, 2, 3, 4
  • - All injected channels 1, 2, 3, 4 are guarded

MS31028V1

Timing diagram for Figure 129 showing ADC STATE, JEOS FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals for injected channels 1, 2, 3, and 4, where all are guarded and the AWDx flag is cleared by software.

Analog watchdog threshold control

LTx[11:0] and HTx[11:0] can be changed when an analog-to-digital conversion is ongoing (that is between the start of conversion and the end of conversion of the ADC internal state). If LTx[11:0] and HTx[11:0] are updated during the ADC conversion of the ADC guarded channel, the watchdog function is masked for this conversion. This masking is removed at the next start of conversion, resulting in a analog watchdog thresholds to be applied from the next ADC conversion. The analog watchdog comparison is performed at each end of conversion. If the current ADC data is out of the new interval, no interrupt and AWDx_OUT signal are issued. The Interrupt and the AWD generation only happen at the end of the conversion which started after the threshold update. If AWD_xOUT is already asserted, programming the new thresholds does not deassert the AWDx_OUT signal.

Analog watchdog with gain and offset compensation

When gain and offset compensation are enabled, the analog watchdog compares the threshold after the compensated data.

Note: When the offset compensation is enabled (OFFSETy_EN set in ADC_OFRy register), data overflow or underflow can result in a wrong watchdog result. When the saturation is enabled (SATEN set in ADC_OFRy), the watchdog provides a correct result. However this prevents from using the signed data format.

21.4.29 Oversampler

The oversampling unit performs data pre-processing to offload the CPU. It is able to handle multiple conversions and average them into a single data with increased data width, up to 16-bit.

It provides a result with the following form, where N and M can be adjusted:

\[ \text{Result} = \frac{1}{M} \times \sum_{n=0}^{n=N-1} \text{Conversion}(t_n) \]

It allows to perform by hardware the following functions: averaging, data rate reduction, SNR improvement, basic filtering.

The oversampling ratio N is defined using the OVFS[2:0] bits in the ADC_CFGR2 register, and can range from 2x to 256x. The division coefficient M consists of a right bit shift up to 8 bits, and is defined using the OVSS[3:0] bits in the ADC_CFGR2 register.

The summation unit can yield a result up to 20 bits (256x 12-bit results), which is first shifted right. It is then truncated to the 16 least significant bits, rounded to the nearest value using the least significant bits left apart by the shifting, before being finally transferred into the ADC_DR data register.

Note: If the intermediary result after the shifting exceeds 16-bit, the result is truncated as is, without saturation.

Figure 130. 20-bit to 16-bit result truncation

Diagram showing 20-bit to 16-bit result truncation. It illustrates the raw 20-bit data (bits 19-0), the shifting process, and the final truncated and rounded 16-bit result (bits 15-0).

The diagram shows three horizontal bars representing data bits. The top bar is 'Raw 20-bit data' with bits 19, 15, 11, 7, 3, and 0 marked. The middle bar is 'Shifting', showing a rightward arrow. The bottom bar is 'Truncation and rounding', showing bits 15 and 0 marked. A dashed vertical line separates the raw data from the shifted data. The text 'MS34453V1' is in the bottom right corner.

Diagram showing 20-bit to 16-bit result truncation. It illustrates the raw 20-bit data (bits 19-0), the shifting process, and the final truncated and rounded 16-bit result (bits 15-0).

Figure 131 gives a numerical example of the processing, from a raw 20-bit accumulated data to the final 16-bit result.

Figure 131. Numerical example with 5-bit shift and rounding

Numerical example with 5-bit shift and rounding. It shows raw 20-bit data (3, B, 7, D, 7) being shifted and rounded to a final 16-bit result (1, D, B, F).

The diagram shows two horizontal bars. The top bar is 'Raw 20-bit data' with values 3, B, 7, D, 7 at bits 19, 15, 11, 7, 3. The bottom bar is 'Final result after 5-bit shift and rounding to nearest' with values 1, D, B, F at bits 15, 11, 7, 3. A dashed vertical line at bit 15 separates the raw data from the final result. The text 'MS34453V1' is in the bottom right corner.

Numerical example with 5-bit shift and rounding. It shows raw 20-bit data (3, B, 7, D, 7) being shifted and rounded to a final 16-bit result (1, D, B, F).

Table 175 gives the data format for the various N and M combinations, for a raw conversion data equal to 0xFFF.

Table 175. Maximum output results versus N and M (gray cells indicate truncation)

Over sampling ratioMax Raw dataNo-shift1-bit shift2-bit shift3-bit shift4-bit shift5-bit shift6-bit shift7-bit shift8-bit shift
OVSS = 0000OVSS = 0001OVSS = 0010OVSS = 0011OVSS = 0100OVSS = 0101OVSS = 0110OVSS = 0111OVSS = 1000
2x0x1FFE0x1FFE0x0FFF0x08000x04000x02000x01000x00800x00400x020
4x0x3FFC0x3FFC0x1FFE0x0FFF0x08000x04000x02000x01000x00800x0040
8x0x7FF80x7FF80x3FFC0x1FFE0x0FFF0x08000x04000x02000x01000x0080
16x0xFFF00xFFF00x7FF80x3FFC0x1FFE0x0FFF0x08000x04000x02000x0100
32x0x1FFE00xFFE00xFFF00x7FF80x3FFC0x1FFE0x0FFF0x08000x04000x0200
64x0x3FFC00xFFC00xFFE00xFFF00x7FF80x3FFC0x1FFE0x0FFF0x08000x0400
128x0x7FF800xFF800xFFC00xFFE00xFFF00x7FF80x3FFC0x1FFE0x0FFF0x0800
256x0xFFF000xFF000xFF800xFFC00xFFE00xFFF00x7FF80x3FFC0x1FFE0x0FFF

There are no changes for conversion timings in oversampled mode: the sample time is maintained equal during the whole oversampling sequence. A new data is provided every N

conversions, with an equivalent delay equal to \( N \times T_{\text{CONV}} = N \times (t_{\text{SMP}} + t_{\text{SAR}}) \) . The flags are set as follows:

ADC operating modes supported when oversampling (single ADC mode)

In oversampling mode, most of the ADC operating modes are maintained:

Note: The alignment mode is not available when working with oversampled data. The ALIGN bit in ADC_CFGR1 is ignored and the data are always provided right-aligned.

Offset correction is not supported in oversampling mode. When ROVSE and/or JOVSE bit is set, the value of the OFFSETy_EN bit in ADC_OFRy register is ignored (considered as reset).

Analog watchdog

The analog watchdog functionality is maintained, with the following difference:

Note: Care must be taken when using high shifting values, since this reduces the comparison range. For instance, if the oversampled result is shifted by 4 bits, thus yielding a 12-bit data right-aligned, the effective analog watchdog comparison can only be performed on 8 bits. The comparison is done between ADC_DR[11:4] and HT[0:7] / LT[0:7], and HT[11:8] / LT[11:8] must be kept reset.

Triggered mode

The averager can also be used for basic filtering purpose. Although not a very powerful filter (slow roll-off and limited stop band attenuation), it can be used as a notch filter to reject constant parasitic frequencies (typically coming from the mains or from a switched mode power supply). For this purpose, a specific discontinuous mode can be enabled with TROVS bit in ADC_CFGR2, to be able to have an oversampling frequency defined by a user and independent from the conversion time itself.

Figure 132 below shows how conversions are started in response to triggers during discontinuous mode.

If the TROVS bit is set, the content of the DISCEN bit is ignored and considered as 1.

Figure 132. Triggered regular oversampling mode (TROVS bit = 1)

Figure 132: Triggered regular oversampling mode (TROVS bit = 1). The diagram shows two scenarios for regular oversampling. The top scenario shows a sequence of four channels (Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3) being converted continuously (CONT=0, DISCEN=1, TROVS=0) until an EOC flag is set. The bottom scenario shows the same sequence of four channels being converted continuously (CONT=0, DISCEN=1, TROVS=1) until an EOC flag is set. In the bottom scenario, the sequence is triggered by a 'Trigger' signal, and the conversion of each channel is shown as a separate box. The sequence repeats: Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3, Ch(N)0, Ch(N)1, Ch(N)2. The EOC flag is set after the last channel (Ch(N)2) is converted.

The diagram illustrates two modes of regular oversampling in an ADC. In the top part, with CONT=0 , DISCEN = 1 , and TROVS = 0 , a 'Trigger' initiates a sequence of four channels: Ch(N) 0 , Ch(N) 1 , Ch(N) 2 , and Ch(N) 3 . The sequence continues until the EOC flag set . In the bottom part, with CONT=0 , DISCEN = 1 , and TROVS = 1 , a 'Trigger' initiates a sequence of four channels: Ch(N) 0 , Ch(N) 1 , Ch(N) 2 , and Ch(N) 3 . This sequence repeats, with the next trigger starting Ch(N) 0 , Ch(N) 1 , and Ch(N) 2 . The EOC flag set is indicated after the last channel ( Ch(N) 2 ) is converted. The diagram is labeled MS34455V2 in the bottom right corner.

Figure 132: Triggered regular oversampling mode (TROVS bit = 1). The diagram shows two scenarios for regular oversampling. The top scenario shows a sequence of four channels (Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3) being converted continuously (CONT=0, DISCEN=1, TROVS=0) until an EOC flag is set. The bottom scenario shows the same sequence of four channels being converted continuously (CONT=0, DISCEN=1, TROVS=1) until an EOC flag is set. In the bottom scenario, the sequence is triggered by a 'Trigger' signal, and the conversion of each channel is shown as a separate box. The sequence repeats: Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3, Ch(N)0, Ch(N)1, Ch(N)2. The EOC flag is set after the last channel (Ch(N)2) is converted.

Injected and regular sequencer management when oversampling

In oversampling mode, it is possible to have differentiated behavior for injected and regular sequencers. The oversampling can be enabled for both sequencers with some limitations if they have to be used simultaneously (this is related to a unique accumulation unit).

Oversampling regular channels only

The regular oversampling mode bit ROVSM defines how the regular oversampling sequence is resumed if it is interrupted by injected conversion:

Figure 133 gives examples for a 4x oversampling ratio.

Figure 133. Regular oversampling modes (4x ratio)

Figure 133: Regular oversampling modes (4x ratio). The diagram is split into two horizontal sections. The top section, 'Continued mode', shows a sequence of regular channels: Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3, Ch(M)0, Ch(M)1. An arrow labeled 'Oversampling stopped' points to Ch(M)1. Below this, an 'Abort' signal from injected channels Ch(J), Ch(K) is shown. After the abort, 'Oversampling continued' for the regular channels, showing Ch(M)1, Ch(M)2, Ch(M)3, Ch(O)0. The bottom section, 'Resumed mode', shows the same regular channel sequence. An arrow labeled 'Oversampling aborted' points to Ch(M)1. After an 'Abort' from injected channels, 'Oversampling resumed' for the regular channels, showing Ch(M)0, Ch(M)1, Ch(M)2, Ch(M)3. Both sections indicate 'Continued mode: ROVSE = 1, JOVSE = 0, ROVSM = 0, TROVS = X' and 'Resumed mode: ROVSE = 1, JOVSE = 0, ROVSM = 1, TROVS = X' respectively. A 'JEOC' (Injected End of Conversion) signal is shown at the end of the injected channels in both cases. MS34456V1 is noted in the bottom right.

Continued mode: ROVSE = 1, JOVSE = 0, ROVSM = 0, TROVS = X

Resumed mode: ROVSE = 1, JOVSE = 0, ROVSM = 1, TROVS = X

MS34456V1

Figure 133: Regular oversampling modes (4x ratio). The diagram is split into two horizontal sections. The top section, 'Continued mode', shows a sequence of regular channels: Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3, Ch(M)0, Ch(M)1. An arrow labeled 'Oversampling stopped' points to Ch(M)1. Below this, an 'Abort' signal from injected channels Ch(J), Ch(K) is shown. After the abort, 'Oversampling continued' for the regular channels, showing Ch(M)1, Ch(M)2, Ch(M)3, Ch(O)0. The bottom section, 'Resumed mode', shows the same regular channel sequence. An arrow labeled 'Oversampling aborted' points to Ch(M)1. After an 'Abort' from injected channels, 'Oversampling resumed' for the regular channels, showing Ch(M)0, Ch(M)1, Ch(M)2, Ch(M)3. Both sections indicate 'Continued mode: ROVSE = 1, JOVSE = 0, ROVSM = 0, TROVS = X' and 'Resumed mode: ROVSE = 1, JOVSE = 0, ROVSM = 1, TROVS = X' respectively. A 'JEOC' (Injected End of Conversion) signal is shown at the end of the injected channels in both cases. MS34456V1 is noted in the bottom right.

Oversampling Injected channels only

The Injected oversampling mode bit JOVSE enables oversampling solely for conversions in the injected sequencer.

Oversampling regular and Injected channels

It is possible to have both ROVSE and JOVSE bits set. In this case, the regular oversampling mode is forced to resumed mode (ROVSM bit ignored), as represented on Figure 134 below.

Figure 134. Regular and injected oversampling modes used simultaneously

Figure 134: Regular and injected oversampling modes used simultaneously. The diagram shows a sequence of regular channels: Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3, Ch(M)0, Ch(M)1. An arrow labeled 'Oversampling aborted' points to Ch(M)1. Below this, a 'Trigger' and 'Abort' signal from injected channels Ch(J)0, Ch(J)1, Ch(J)2, Ch(J)3 is shown. After the abort, 'Oversampling resumed' for the regular channels, showing Ch(M)0, Ch(M)1. A 'JEOC' (Injected End of Conversion) signal is shown at the end of the injected channels. The configuration is 'ROVSE = 1, JOVSE = 1, ROVSM = 1, TROVS = 0'. MS34457V2 is noted in the bottom right.

ROVSE = 1, JOVSE = 1, ROVSM = 1, TROVS = 0

MS34457V2

Figure 134: Regular and injected oversampling modes used simultaneously. The diagram shows a sequence of regular channels: Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3, Ch(M)0, Ch(M)1. An arrow labeled 'Oversampling aborted' points to Ch(M)1. Below this, a 'Trigger' and 'Abort' signal from injected channels Ch(J)0, Ch(J)1, Ch(J)2, Ch(J)3 is shown. After the abort, 'Oversampling resumed' for the regular channels, showing Ch(M)0, Ch(M)1. A 'JEOC' (Injected End of Conversion) signal is shown at the end of the injected channels. The configuration is 'ROVSE = 1, JOVSE = 1, ROVSM = 1, TROVS = 0'. MS34457V2 is noted in the bottom right.

Triggered regular oversampling with injected conversions

It is possible to have triggered regular mode with injected conversions. In this case, the injected mode oversampling mode must be disabled, and the ROVSM bit is ignored (resumed mode is forced). The JOVSE bit must be reset. The behavior is represented on Figure 135 below.

Timing diagram showing triggered regular oversampling with injection. Regular channels Ch(N)0, Ch(N)1, and Ch(N)2 are shown. Injected channels Ch(J) and Ch(K) are shown. The diagram illustrates that the injected conversions abort the regular conversions and that the regular conversions resume after the injected conversions are complete. The configuration bits are ROVSE = 1, JOVSE = 0, ROVSM = 1, TROVS = 1.

Figure 135. Triggered regular oversampling with injection

ROVSE = 1, JOVSE = 0, ROVSM = 1, TROVS = 1

MS34458V4

Timing diagram showing triggered regular oversampling with injection. Regular channels Ch(N)0, Ch(N)1, and Ch(N)2 are shown. Injected channels Ch(J) and Ch(K) are shown. The diagram illustrates that the injected conversions abort the regular conversions and that the regular conversions resume after the injected conversions are complete. The configuration bits are ROVSE = 1, JOVSE = 0, ROVSM = 1, TROVS = 1.

Auto-injected mode

It is possible to oversample auto-injected sequences and have all conversions results stored in registers to save a DMA resource. This mode is available only with both regular and injected oversampling active: JAUTO = 1, ROVSE = 1 and JOVSE = 1, other combinations are not supported. The ROVSM bit is ignored in auto-injected mode. The Figure 136 below shows how the conversions are sequenced.

Timing diagram showing oversampling in auto-injected mode. Regular channels N0, N1, N2, N3 are shown. Injected channels I0, I1, I2, I3, J0, J1, J2, J3, K0, K1, K2, K3, L0, L1, L2, L3 are shown. The diagram illustrates that the injected conversions are performed after the regular conversions. The configuration bits are JAUTO = 1, ROVSE = 1, JOVSE = 1, ROVSM = X, TROVS = 0.

Figure 136. Oversampling in auto-injected mode

JAUTO = 1, ROVSE = 1, JOVSE = 1, ROVSM = X, TROVS = 0

MS34459V1

Timing diagram showing oversampling in auto-injected mode. Regular channels N0, N1, N2, N3 are shown. Injected channels I0, I1, I2, I3, J0, J1, J2, J3, K0, K1, K2, K3, L0, L1, L2, L3 are shown. The diagram illustrates that the injected conversions are performed after the regular conversions. The configuration bits are JAUTO = 1, ROVSE = 1, JOVSE = 1, ROVSM = X, TROVS = 0.

It is possible to have also the triggered mode enabled, using the TROVS bit. In this case, the ADC must be configured as following: JAUTO = 1, DISCEN = 0, JDISCEN = 0, ROVSE = 1, JOVSE = 1 and TROVS = 1.

Dual ADC modes supported when oversampling

It is possible to have oversampling enabled when working in dual ADC configuration, for the injected simultaneous mode and regular simultaneous mode. In this case, the two ADCs must be programmed with the very same settings (including oversampling).

All other dual ADC modes are not supported when either regular or injected oversampling is enabled (ROVSE = 1 or JOVSE = 1).

Combined modes summary

The Table 176 below summarizes all combinations, including modes not supported.

Table 176. Oversampler operating modes summary

Regular Oversampling ROVSEInjected Oversampling JOVSEOversampler mode ROVSM
0 = continued
1 = resumed
Triggered Regular mode TROVSComment
1000Regular continued mode
1001Not supported
1010Regular resumed mode
1011Triggered regular resumed mode
110XNot supported
1110Injected and regular resumed mode
1111Not supported
01XXInjected oversampling

21.4.30 Dual ADC modes

Dual ADC modes can be used in devices with two ADCs or more (see Figure 137 ).

In dual ADC mode the start of conversion is triggered alternately or simultaneously by the ADCx master to the ADC slave, depending on the mode selected by the bits DUAL[4:0] in the ADCx_CCR register.

Four possible modes are implemented:

It is also possible to use these modes combined in the following ways:

In dual ADC mode (when bits DUAL[4:0] in ADCx_CCR register are not equal to zero), the bits CONT, AUTDLY, DISCEN, DISCNUM[2:0], JDISCEN, JQM, JAUTO of the ADC_CFGR register are shared between the master and slave ADC: the bits in the slave ADC are always equal to the corresponding bits of the master ADC.

To start a conversion in dual mode, the user must program the bits EXTEN[1:0], EXTSEL, JEXTEN[1:0], JEXTSEL of the master ADC only, to configure a software or hardware trigger, and a regular or injected trigger. (the bits EXTEN[1:0] and JEXTEN[1:0] of the slave ADC are don't care).

In regular simultaneous or interleaved modes: once the user sets bit ADSTART or bit ADSTP of the master ADC, the corresponding bit of the slave ADC is also automatically set. However, bit ADSTART or bit ADSTP of the slave ADC is not necessarily cleared at the same time as the master ADC bit.

In injected simultaneous or alternate trigger modes: once the user sets bit JADSTART or bit JADSTP of the master ADC, the corresponding bit of the slave ADC is also automatically set. However, bit JADSTART or bit JADSTP of the slave ADC is not necessarily cleared at the same time as the master ADC bit.

In dual ADC mode, the converted data of the master and slave ADC can be read in parallel, by reading the ADC common data register (ADCx_CDR). The status bits can be also read in parallel by reading the dual-mode status register (ADCx_CSR).

Figure 137. Dual ADC block diagram (1) Dual ADC block diagram showing Master and Slave ADC components, their registers, and input sources.

The diagram illustrates the internal architecture of a Dual ADC system. It is divided into two main sections: Slave ADC (top) and Master ADC (bottom), both connected to a common Address/data bus on the right.

MSV36025V2

Dual ADC block diagram showing Master and Slave ADC components, their registers, and input sources.
  1. 1. External triggers also exist on slave ADC but are not shown for the purposes of this diagram.
  2. 2. The ADC common data register (ADCx_CDR) contains both the master and slave ADC regular converted data.

Injected simultaneous mode

This mode is selected by programming bits DUAL[4:0] = 00101

This mode converts an injected group of channels. The external trigger source comes from the injected group multiplexer of the master ADC (selected by the JEXTSEL bits in the ADC_JSQR register).

Note: Do not convert the same channel on the two ADCs (no overlapping sampling times for the two ADCs when converting the same channel).

In simultaneous mode, one must convert sequences with the same length or ensure that the interval between triggers is longer than the longer of the 2 sequences. Otherwise, the ADC with the shortest sequence may restart while the ADC with the longest sequence is completing the previous conversions.

Regular conversions can be performed on one or all ADCs. In that case, they are independent of each other and are interrupted when an injected event occurs. They are resumed at the end of the injected conversion group.

Figure 138. Injected simultaneous mode on 4 channels: dual ADC mode

Timing diagram for injected simultaneous mode on 4 channels. It shows two horizontal bars representing the MASTER ADC and SLAVE ADC. The MASTER ADC has four channels: CH1, CH2, CH3, CH4. The SLAVE ADC has four channels: CH15, CH14, CH13, CH12. A 'Trigger' arrow points to the start of the sequences. A legend indicates that a light gray box represents 'Sampling' and a white box represents 'Conversion'. Arrows point to the end of the sequences on both ADCs, labeled 'End of injected sequence on MASTER and SLAVE ADC'. The diagram is labeled MS31900V1.
Timing diagram for injected simultaneous mode on 4 channels. It shows two horizontal bars representing the MASTER ADC and SLAVE ADC. The MASTER ADC has four channels: CH1, CH2, CH3, CH4. The SLAVE ADC has four channels: CH15, CH14, CH13, CH12. A 'Trigger' arrow points to the start of the sequences. A legend indicates that a light gray box represents 'Sampling' and a white box represents 'Conversion'. Arrows point to the end of the sequences on both ADCs, labeled 'End of injected sequence on MASTER and SLAVE ADC'. The diagram is labeled MS31900V1.

If JDISCEN = 1, each simultaneous conversion of the injected sequence requires an injected trigger event to occur.

This mode can be combined with AUTDLY mode:

ongoing regular sequence and the associated delay phases are ignored.
There is the same behavior for regular sequences occurring on the slave ADC.

Regular simultaneous mode with independent injected

This mode is selected by programming bits DUAL[4:0] = 00110.

This mode is performed on a regular group of channels. The external trigger source comes from the regular group multiplexer of the master ADC (selected by the EXTSEL bits in the ADC_CFGR register). A simultaneous trigger is provided to the slave ADC.

In this mode, independent injected conversions are supported. An injection request (either on master or on the slave) aborts the current simultaneous conversions, which are restarted once the injected conversion is completed.

Note: Do not convert the same channel on the two ADCs (no overlapping sampling times for the two ADCs when converting the same channel).

In regular simultaneous mode, one must convert sequences with the same length or ensure that the interval between triggers is longer than the longer conversion time of the 2 sequences. Otherwise, the ADC with the shortest sequence may restart while the ADC with the longest sequence is completing the previous conversions.

Software is notified by interrupts when it can read the data:

It is also possible to read the regular data using the DMA. Two methods are possible:

Note: In MDMA mode (MDMA[1:0] = 10 or 11), the user must program the same number of conversions in the master's sequence as in the slave's sequence. Otherwise, the remaining conversions does not generate a DMA request.

Figure 139. Regular simultaneous mode on 16 channels: dual ADC mode

Diagram showing the sequence of conversions for Master and Slave ADCs in dual mode. The Master ADC sequence is CH1, CH2, CH3, CH4, ..., CH16. The Slave ADC sequence is CH16, CH14, CH13, CH12, ..., CH1. A 'Trigger' arrow points to the start of the sequences. A legend indicates that light gray boxes represent 'Sampling' and white boxes represent 'Conversion'. An arrow at the end points to the 'End of regular sequence on MASTER and SLAVE ADC'. The diagram is labeled ai16054b.
Diagram showing the sequence of conversions for Master and Slave ADCs in dual mode. The Master ADC sequence is CH1, CH2, CH3, CH4, ..., CH16. The Slave ADC sequence is CH16, CH14, CH13, CH12, ..., CH1. A 'Trigger' arrow points to the start of the sequences. A legend indicates that light gray boxes represent 'Sampling' and white boxes represent 'Conversion'. An arrow at the end points to the 'End of regular sequence on MASTER and SLAVE ADC'. The diagram is labeled ai16054b.

If DISCEN = 1 then each “n” simultaneous conversions of the regular sequence require a regular trigger event to occur (“n” is defined by DISCNUM).

This mode can be combined with AUTDLY mode:

It is possible to use the DMA to handle data in regular simultaneous mode combined with AUTDLY mode, assuming that multiple-DMA mode is used: bits MDMA must be set to 10 or 11.

When regular simultaneous mode is combined with AUTDLY mode, it is mandatory for the user to ensure that:

Note: This combination of regular simultaneous mode and AUTDLY mode is restricted to the use case when only regular channels are programmed: it is forbidden to program injected channels in this combined mode.

Interleaved mode with independent injected

This mode is selected by programming bits DUAL[4:0] = 00111.

This mode can be started only on a regular group (usually one channel). The external trigger source comes from the regular channel multiplexer of the master ADC.

After an external trigger occurs:

The minimum delay which separates two conversions in interleaved mode is configured in the DELAY bits in the ADCx_CCR register. This delay starts counting one half cycle after the end of the sampling phase of the master conversion. This way, an ADC cannot start a

conversion if the complementary ADC is still sampling its input (only one ADC can sample the input signal at a given time).

If the CONT bit is set on both master and slave ADCs, the selected regular channels of both ADCs are continuously converted.

The software is notified by interrupts when it can read the data at the end of each conversion event (EOC) on the slave ADC. A slave and master EOC interrupts are generated (if EOCIE is enabled) and the software can read the ADC_DR of the slave/master ADC.

Note: It is possible to enable only the EOC interrupt of the slave and read the common data register (ADCx_CDR). But in this case, the user must ensure that the duration of the conversions are compatible to ensure that inside the sequence, a master conversion is always followed by a slave conversion before a new master conversion restarts. It is recommended to use the MDMA mode.

It is also possible to have the regular data transferred by DMA. In this case, individual DMA requests on each ADC cannot be used and it is mandatory to use the MDMA mode, as following:

Figure 140. Interleaved mode on 1 channel in continuous conversion mode: dual ADC mode

Timing diagram for Figure 140 showing interleaved mode on 1 channel in continuous conversion mode for dual ADC. The diagram illustrates the timing of Master and Slave ADC conversions. The Master ADC starts with a sampling phase (grey) followed by a conversion phase (white) for CH1. The Slave ADC is triggered and starts its sampling phase (grey) followed by a conversion phase (white) for CH1. The timing is divided into 0.5 ADCCLK cycles. The Master ADC's sampling phase occurs during the first 0.5 cycle, and its conversion phase occurs during the second 0.5 cycle. The Slave ADC's sampling phase occurs during the first 0.5 cycle, and its conversion phase occurs during the second 0.5 cycle. The diagram shows that the Master ADC's conversion phase overlaps with the Slave ADC's sampling phase. The total duration for one full cycle (sampling + conversion) for both ADCs is 4 ADCCLK cycles. The End of conversion on master and slave ADC is indicated at the end of the sequence. A legend indicates that grey boxes represent Sampling and white boxes represent Conversion. The diagram is labeled MSv31030V5.
Timing diagram for Figure 140 showing interleaved mode on 1 channel in continuous conversion mode for dual ADC. The diagram illustrates the timing of Master and Slave ADC conversions. The Master ADC starts with a sampling phase (grey) followed by a conversion phase (white) for CH1. The Slave ADC is triggered and starts its sampling phase (grey) followed by a conversion phase (white) for CH1. The timing is divided into 0.5 ADCCLK cycles. The Master ADC's sampling phase occurs during the first 0.5 cycle, and its conversion phase occurs during the second 0.5 cycle. The Slave ADC's sampling phase occurs during the first 0.5 cycle, and its conversion phase occurs during the second 0.5 cycle. The diagram shows that the Master ADC's conversion phase overlaps with the Slave ADC's sampling phase. The total duration for one full cycle (sampling + conversion) for both ADCs is 4 ADCCLK cycles. The End of conversion on master and slave ADC is indicated at the end of the sequence. A legend indicates that grey boxes represent Sampling and white boxes represent Conversion. The diagram is labeled MSv31030V5.

Figure 141. Interleaved mode on 1 channel in single conversion mode: dual ADC mode

Timing diagram for Figure 141 showing interleaved mode on 1 channel in single conversion mode for dual ADC. It illustrates the sampling and conversion phases for Master and Slave ADCs, triggered by the Slave ADC. The diagram shows two instances of conversion, each taking 4 ADCCLK cycles, with sampling starting every 0.5 ADCCLK cycle.

The diagram shows the timing for dual ADC interleaved mode on a single channel. A 'SLAVE ADC Trigger' initiates the sequence. The 'MASTER ADC' and 'SLAVE ADC' both perform sampling and conversion on 'CH1'. Sampling occurs for 0.5 ADCCLK cycles, followed by conversion for 4 ADCCLK cycles. The conversion ends simultaneously on both the master and slave ADCs. A legend indicates that grey boxes represent 'Sampling' and white boxes represent 'Conversion'. The diagram is labeled MSV31031V3.

Timing diagram for Figure 141 showing interleaved mode on 1 channel in single conversion mode for dual ADC. It illustrates the sampling and conversion phases for Master and Slave ADCs, triggered by the Slave ADC. The diagram shows two instances of conversion, each taking 4 ADCCLK cycles, with sampling starting every 0.5 ADCCLK cycle.

If DISCEN = 1, each “n” simultaneous conversions (“n” is defined by DISCNUM) of the regular sequence require a regular trigger event to occur.

In this mode, injected conversions are supported. When injection is done (either on master or on slave), both the master and the slave regular conversions are aborted and the sequence is restarted from the master (see Figure 142 below).

Figure 142. Interleaved conversion with injection

Timing diagram for Figure 142 showing interleaved conversion with injection. It illustrates the sequence of conversions for ADC1 (master) and ADC2 (slave) being interrupted by an injected trigger for CH11, and then resuming on the master ADC.

The diagram illustrates interleaved conversion with injection. ADC1 (master) is initially converting CH1, CH1, CH1. ADC2 (slave) is converting CH2, CH2, CH2. An 'Injected trigger' for CH11 occurs, aborting the current conversions. After the injection, the sequence resumes on the master ADC (ADC1) with CH1, CH1, CH1. The slave ADC (ADC2) resumes with CH2, CH2, CH0. 'read CDR' labels indicate the completion of conversions. A legend shows grey for 'Sampling' and white for 'Conversion'. The diagram is labeled MS34460V1.

Timing diagram for Figure 142 showing interleaved conversion with injection. It illustrates the sequence of conversions for ADC1 (master) and ADC2 (slave) being interrupted by an injected trigger for CH11, and then resuming on the master ADC.

Alternate trigger mode

This mode is selected by programming bits DUAL[4:0] = 01001.

This mode can be started only on an injected group. The source of external trigger comes from the injected group multiplexer of the master ADC.

This mode is only possible when selecting hardware triggers: JEXTEN[1:0] must not be 00.

Injected discontinuous mode disabled (JDISCEN = 0 for both ADC)

  1. 1. When the first trigger occurs, all injected master ADC channels in the group are converted.
  2. 2. When the second trigger occurs, all injected slave ADC channels in the group are converted.
  3. 3. And so on.

A JEOS interrupt, if enabled, is generated after all injected channels of the master ADC in the group have been converted.

A JEOS interrupt, if enabled, is generated after all injected channels of the slave ADC in the group have been converted.

JEOC interrupts, if enabled, can also be generated after each injected conversion.

If another external trigger occurs after all injected channels in the group have been converted then the alternate trigger process restarts by converting the injected channels of the master ADC in the group.

Figure 143. Alternate trigger: injected group of each ADC

Timing diagram showing the sequence of events for Master and Slave ADCs under alternate triggering. The diagram illustrates four trigger events (1st, 2nd, 3rd, 4th) and the resulting conversion status (Sampling or Conversion) for both ADCs, along with associated interrupt signals (JEOC, JEOS).

The diagram illustrates the timing of injected group conversions for a Master ADC and a Slave ADC under alternate triggering. The sequence of events is as follows:

After the 4th trigger, the sequence repeats. The diagram also shows the state of the ADCs (Sampling or Conversion) and the resulting interrupt signals (JEOC, JEOS) for each trigger event.

Legend:

ai16059-m

Timing diagram showing the sequence of events for Master and Slave ADCs under alternate triggering. The diagram illustrates four trigger events (1st, 2nd, 3rd, 4th) and the resulting conversion status (Sampling or Conversion) for both ADCs, along with associated interrupt signals (JEOC, JEOS).

Note: Regular conversions can be enabled on one or all ADCs. In this case the regular conversions are independent of each other. A regular conversion is interrupted when the ADC has to perform an injected conversion. It is resumed when the injected conversion is finished.

The time interval between 2 trigger events must be greater than or equal to 1 ADC clock period. The minimum time interval between 2 trigger events that start conversions on the same ADC is the same as in the single ADC mode.

Injected discontinuous mode enabled (JDISCEN = 1 for both ADC)

If the injected discontinuous mode is enabled for both master and slave ADCs:

A JEOS interrupt, if enabled, is generated after all injected channels of the master ADC in the group have been converted.

A JEOS interrupt, if enabled, is generated after all injected channels of the slave ADC in the group have been converted.

JEOC interrupts, if enabled, can also be generated after each injected conversions.

If another external trigger occurs after all injected channels in the group have been converted then the alternate trigger process restarts.

Figure 144. Alternate trigger: 4 injected channels (each ADC) in discontinuous mode

Timing diagram showing the sequence of events for Master and Slave ADCs in discontinuous mode with 4 injected channels. The diagram illustrates the flow between Sampling and Conversion phases, triggered by external events (1st through 8th triggers). Interrupts like JEOC and JEOS are shown occurring at specific points in the conversion sequence for both Master and Slave ADCs. A legend at the bottom left defines the phases: Sampling (grey box) and Conversion (white box).

The diagram illustrates the timing of Master and Slave ADCs in discontinuous mode with 4 injected channels. The Master ADC starts with the 1st trigger, followed by the Slave ADC with the 2nd trigger. Subsequent triggers (3rd through 8th) alternate between the Master and Slave ADCs. The Master ADC generates JEOC (End of Conversion) and JEOS (End of Sequence) interrupts after its 4 injected channels are converted. The Slave ADC similarly generates JEOC and JEOS interrupts after its 4 injected channels are converted. The legend indicates that grey boxes represent Sampling and white boxes represent Conversion.

Timing diagram showing the sequence of events for Master and Slave ADCs in discontinuous mode with 4 injected channels. The diagram illustrates the flow between Sampling and Conversion phases, triggered by external events (1st through 8th triggers). Interrupts like JEOC and JEOS are shown occurring at specific points in the conversion sequence for both Master and Slave ADCs. A legend at the bottom left defines the phases: Sampling (grey box) and Conversion (white box).

Combined regular/injected simultaneous mode

This mode is selected by programming bits DUAL[4:0] = 00001.

It is possible to interrupt the simultaneous conversion of a regular group to start the simultaneous conversion of an injected group.

Note: In combined regular/injected simultaneous mode, one must convert sequences with the same length or ensure that the interval between triggers is longer than the long conversion time of the 2 sequences. Otherwise, the ADC with the shortest sequence may restart while the ADC with the longest sequence is completing the previous conversions.

Combined regular simultaneous + alternate trigger mode

This mode is selected by programming bits DUAL[4:0] = 00010.

It is possible to interrupt the simultaneous conversion of a regular group to start the alternate trigger conversion of an injected group. Figure 145 shows the behavior of an alternate trigger interrupting a simultaneous regular conversion.

The injected alternate conversion is immediately started after the injected event. If a regular conversion is already running, in order to ensure synchronization after the injected conversion, the regular conversion of all (master/slave) ADCs is stopped and resumed synchronously at the end of the injected conversion.

Note: In combined regular simultaneous + alternate trigger mode, one must convert sequences with the same length or ensure that the interval between triggers is longer than the long conversion time of the 2 sequences. Otherwise, the ADC with the shortest sequence may restart while the ADC with the longest sequence is completing the previous conversions.

Figure 145. Alternate + regular simultaneous

Timing diagram for Figure 145 showing ADC MASTER and ADC SLAVE regular and injected conversion sequences. The diagram illustrates that synchronization is not lost when triggers occur during injected conversions.

The diagram shows four horizontal timelines for ADC MASTER reg, ADC MASTER inj, ADC SLAVE reg, and ADC SLAVE inj. - ADC MASTER reg: CH1, CH2, CH3 (triggered by 1st trigger), CH3, CH4, CH4, CH5. - ADC MASTER inj: CH1 (interrupting the regular sequence). - ADC SLAVE reg: CH4, CH6, CH7, CH7, CH8, CH8, CH9. - ADC SLAVE inj: CH1 (interrupting the regular sequence, triggered by 2nd trigger). A label 'synchronization not lost' is present near the bottom right.

Timing diagram for Figure 145 showing ADC MASTER and ADC SLAVE regular and injected conversion sequences. The diagram illustrates that synchronization is not lost when triggers occur during injected conversions.

If a trigger occurs during an injected conversion that has interrupted a regular conversion, the alternate trigger is served. Figure 146 shows the behavior in this case (note that the 6th trigger is ignored because the associated alternate conversion is not complete).

Figure 146. Case of trigger occurring during injected conversion

Timing diagram for Figure 146 showing multiple triggers (1st, 2nd, 3rd, 4th, 5th, 6th) occurring during injected conversions. The 6th trigger is ignored because the associated alternate conversion is not complete.

The diagram shows four horizontal timelines for ADC MASTER reg, ADC MASTER inj, ADC SLAVE reg, and ADC SLAVE inj. - ADC MASTER reg: CH1, CH2, CH3 (triggered by 1st trigger), CH3, CH4, CH4, CH5, CH5, CH6. - ADC MASTER inj: CH14 (interrupting the regular sequence). - ADC SLAVE reg: CH7, CH8, CH9, CH9, CH10, CH10, CH11, CH11, CH12. - ADC SLAVE inj: CH15 (interrupting the regular sequence). Triggers: 1st (on CH3), 2nd (on CH15), 3rd (on CH4), 4th (on CH15), 5th (on CH5), 6th (ignored because CH15 is not complete).

Timing diagram for Figure 146 showing multiple triggers (1st, 2nd, 3rd, 4th, 5th, 6th) occurring during injected conversions. The 6th trigger is ignored because the associated alternate conversion is not complete.

Combined injected simultaneous plus interleaved

This mode is selected by programming bits DUAL[4:0] = 00011

It is possible to interrupt an interleaved conversion with a simultaneous injected event.

In this case the interleaved conversion is interrupted immediately and the simultaneous injected conversion starts. At the end of the injected sequence the interleaved conversion is resumed. When the interleaved regular conversion resumes, the first regular conversion which is performed is always the master's one. Figure 147, Figure 148 and Figure 149 show the behavior using an example.

Caution: In this mode, it is mandatory to use the Common Data Register to read the regular data with a single read access. On the contrary, master-slave data coherency is not guaranteed.

Figure 147. Interleaved single channel CH0 with injected sequence CH11, CH12

Timing diagram for Figure 147 showing interleaved single channel CH0 with injected sequence CH11, CH12. It illustrates the interaction between ADC1 (master) and ADC2 (slave) over time, showing sampling and conversion phases. The diagram is split into two parts by a vertical dashed line labeled 'Injected trigger'. To the left of the trigger, ADC1 (master) is shown converting CH0 three times. ADC2 (slave) is also shown converting CH0 three times. Between the two triggers, an injected sequence of CH11 and CH12 is shown for ADC2. To the right of the trigger, the master ADC1 resumes its CH0 conversions, and the slave ADC2 resumes its CH0 conversions. A legend indicates that light gray bars represent sampling and dark gray bars represent conversion. Text labels include 'Conversions aborted', 'read CDR', and 'Resume (always restart with the master)'. The code MS34461V1 is in the bottom right corner.
Timing diagram for Figure 147 showing interleaved single channel CH0 with injected sequence CH11, CH12. It illustrates the interaction between ADC1 (master) and ADC2 (slave) over time, showing sampling and conversion phases. The diagram is split into two parts by a vertical dashed line labeled 'Injected trigger'. To the left of the trigger, ADC1 (master) is shown converting CH0 three times. ADC2 (slave) is also shown converting CH0 three times. Between the two triggers, an injected sequence of CH11 and CH12 is shown for ADC2. To the right of the trigger, the master ADC1 resumes its CH0 conversions, and the slave ADC2 resumes its CH0 conversions. A legend indicates that light gray bars represent sampling and dark gray bars represent conversion. Text labels include 'Conversions aborted', 'read CDR', and 'Resume (always restart with the master)'. The code MS34461V1 is in the bottom right corner.

Figure 148. Two Interleaved channels (CH1, CH2) with injected sequence CH11, CH12 - case 1: Master interrupted first

Timing diagram for Figure 148, case 1: Master interrupted first. It shows ADC1 (master) and ADC2 (slave) interleaved conversions of CH1 and CH2. The diagram is split by an 'Injected trigger'. Before the trigger, both ADCs are shown converting their respective channels. At the trigger, the master's conversions are aborted. An injected sequence of CH11 and CH12 is then shown for the slave. After the trigger, the master resumes its CH1 conversions, and the slave resumes its CH2 conversions. A legend indicates sampling (light gray) and conversion (dark gray) phases. Text labels include 'Conversions aborted', 'read CDR', and 'Resume (always restart with the master)'. The code MS34462V1 is in the bottom right corner.
Timing diagram for Figure 148, case 1: Master interrupted first. It shows ADC1 (master) and ADC2 (slave) interleaved conversions of CH1 and CH2. The diagram is split by an 'Injected trigger'. Before the trigger, both ADCs are shown converting their respective channels. At the trigger, the master's conversions are aborted. An injected sequence of CH11 and CH12 is then shown for the slave. After the trigger, the master resumes its CH1 conversions, and the slave resumes its CH2 conversions. A legend indicates sampling (light gray) and conversion (dark gray) phases. Text labels include 'Conversions aborted', 'read CDR', and 'Resume (always restart with the master)'. The code MS34462V1 is in the bottom right corner.

Figure 149. Two Interleaved channels (CH1, CH2) with injected sequence CH11, CH12 - case 2: Slave interrupted first

Timing diagram for Figure 149, case 2: Slave interrupted first. It shows ADC1 (master) and ADC2 (slave) interleaved conversions of CH1 and CH2. The diagram is split by an 'Injected trigger'. Before the trigger, both ADCs are shown converting their respective channels. At the trigger, the slave's conversions are aborted. An injected sequence of CH11 and CH12 is then shown for the slave. After the trigger, the master resumes its CH1 conversions, and the slave resumes its CH2 conversions. A legend indicates sampling (light gray) and conversion (dark gray) phases. Text labels include 'Conversions aborted', 'read CDR', and 'Resume (always restart with the master)'. The code MS34463V2 is in the bottom right corner.
Timing diagram for Figure 149, case 2: Slave interrupted first. It shows ADC1 (master) and ADC2 (slave) interleaved conversions of CH1 and CH2. The diagram is split by an 'Injected trigger'. Before the trigger, both ADCs are shown converting their respective channels. At the trigger, the slave's conversions are aborted. An injected sequence of CH11 and CH12 is then shown for the slave. After the trigger, the master resumes its CH1 conversions, and the slave resumes its CH2 conversions. A legend indicates sampling (light gray) and conversion (dark gray) phases. Text labels include 'Conversions aborted', 'read CDR', and 'Resume (always restart with the master)'. The code MS34463V2 is in the bottom right corner.

DMA requests in dual ADC mode

In all dual ADC modes, it is possible to use two DMA channels (one for the master, one for the slave) to transfer the data, like in single mode (refer to Figure 150: DMA Requests in regular simultaneous mode when MDMA = 00 ).

Figure 150. DMA Requests in regular simultaneous mode when MDMA = 00

Timing diagram showing DMA requests in regular simultaneous mode when MDMA = 00. The diagram illustrates the sequence of events for two ADCs (Master and Slave) triggered by external signals. The Master ADC (CH1) and Slave ADC (CH2) both receive triggers. The Master ADC generates an EOC (End of Conversion) signal, which triggers a DMA request. The Slave ADC generates an EOC signal, which triggers a DMA request. The DMA controller reads the Master ADC data (ADC_DR) and the Slave ADC data (ADC_DR). The diagram shows two conversion cycles. The first cycle starts with a trigger for the Master ADC (CH1), followed by the Slave ADC (CH2). The Master ADC generates an EOC signal, which triggers a DMA request. The DMA controller reads the Master ADC data (ADC_DR). The Slave ADC generates an EOC signal, which triggers a DMA request. The DMA controller reads the Slave ADC data (ADC_DR). The second cycle starts with a trigger for the Master ADC (CH1), followed by the Slave ADC (CH2). The Master ADC generates an EOC signal, which triggers a DMA request. The DMA controller reads the Master ADC data (ADC_DR). The Slave ADC generates an EOC signal, which triggers a DMA request. The DMA controller reads the Slave ADC data (ADC_DR). The diagram is labeled 'Configuration where each sequence contains only one conversion' and 'MSV31032V2'.

Configuration where each sequence contains only one conversion

MSV31032V2

Timing diagram showing DMA requests in regular simultaneous mode when MDMA = 00. The diagram illustrates the sequence of events for two ADCs (Master and Slave) triggered by external signals. The Master ADC (CH1) and Slave ADC (CH2) both receive triggers. The Master ADC generates an EOC (End of Conversion) signal, which triggers a DMA request. The Slave ADC generates an EOC signal, which triggers a DMA request. The DMA controller reads the Master ADC data (ADC_DR) and the Slave ADC data (ADC_DR). The diagram shows two conversion cycles. The first cycle starts with a trigger for the Master ADC (CH1), followed by the Slave ADC (CH2). The Master ADC generates an EOC signal, which triggers a DMA request. The DMA controller reads the Master ADC data (ADC_DR). The Slave ADC generates an EOC signal, which triggers a DMA request. The DMA controller reads the Slave ADC data (ADC_DR). The second cycle starts with a trigger for the Master ADC (CH1), followed by the Slave ADC (CH2). The Master ADC generates an EOC signal, which triggers a DMA request. The DMA controller reads the Master ADC data (ADC_DR). The Slave ADC generates an EOC signal, which triggers a DMA request. The DMA controller reads the Slave ADC data (ADC_DR). The diagram is labeled 'Configuration where each sequence contains only one conversion' and 'MSV31032V2'.

In simultaneous regular and interleaved modes, it is also possible to save one DMA channel and transfer both data using a single DMA channel. For this MDMA bits must be configured in the ADCx_CCR register:

Example:

Interleaved dual mode: a DMA request is generated each time 2 data items are available:

first DMA request: ADCx_CDR[31:0] = SLV_ADC_DR[15:0] | MST_ADC_DR[15:0]

second DMA request: ADCx_CDR[31:0] = SLV_ADC_DR[15:0] | MST_ADC_DR[15:0]

Figure 151. DMA requests in regular simultaneous mode when MDMA = 10

Timing diagram for regular simultaneous mode showing ADC Master regular, ADC Master EOC, ADC Slave regular, ADC Slave EOC, DMA request from ADC Master, and DMA request from ADC Slave signals over time.

This timing diagram illustrates the regular simultaneous mode of an ADC. It shows two sequences of conversions. In each sequence, a 'Trigger' signal initiates the conversion of 'CH1' on the ADC Master regular line. Simultaneously, the ADC Slave regular line shows 'CH2' being converted. The 'ADC Master EOC' (End of Conversion) signal pulses when the master's conversion is complete. The 'ADC Slave EOC' signal pulses when the slave's conversion is complete. The 'DMA request from ADC Master' signal is active (low) when the master's conversion is complete. The 'DMA request from ADC Slave' signal is inactive (high) throughout. A vertical line separates the two sequences. Below the diagram, the text 'Configuration where each sequence contains only one conversion' is present. The reference 'MSV31033V3' is in the bottom right corner.

Timing diagram for regular simultaneous mode showing ADC Master regular, ADC Master EOC, ADC Slave regular, ADC Slave EOC, DMA request from ADC Master, and DMA request from ADC Slave signals over time.

Figure 152. DMA requests in interleaved mode when MDMA = 10

Timing diagram for interleaved mode showing ADC Master regular, ADC Master EOC, ADC Slave regular, ADC Slave EOC, DMA request from ADC Master, and DMA request from ADC Slave signals over time, including delays.

This timing diagram illustrates the interleaved mode of an ADC. It shows two sequences of conversions. In each sequence, a 'Trigger' signal initiates the conversion of 'CH1' on the ADC Master regular line. After a 'Delay', the ADC Slave regular line shows 'CH2' being converted. The 'ADC Master EOC' signal pulses when the master's conversion is complete. The 'ADC Slave EOC' signal pulses when the slave's conversion is complete. The 'DMA request from ADC Master' signal is active (low) when the master's conversion is complete. The 'DMA request from ADC Slave' signal is inactive (high) throughout. A vertical line separates the two sequences. Below the diagram, the text 'Configuration where each sequence contains only one conversion' is present. The reference 'MSV31034V2' is in the bottom right corner.

Timing diagram for interleaved mode showing ADC Master regular, ADC Master EOC, ADC Slave regular, ADC Slave EOC, DMA request from ADC Master, and DMA request from ADC Slave signals over time, including delays.

Note: When using MDMA mode, the user must take care to configure properly the duration of the master and slave conversions so that a DMA request is generated and served for reading both data (master + slave) before a new conversion is available.

This mode is used in interleaved and regular simultaneous mode when resolution is 6-bit or when resolution is 8-bit and data is not signed (offsets must be disabled for all the involved channels).

Example:

Interleaved dual mode: a DMA request is generated each time 2 data items are available:

first DMA request: ADCx_CDR[15:0] = SLV_ADC_DR[7:0] | MST_ADC_DR[7:0]

second DMA request: ADCx_CDR[15:0] = SLV_ADC_DR[7:0] | MST_ADC_DR[7:0]

Overrun detection

In dual ADC mode (when DUAL[4:0] is not equal to 00000), if an overrun is detected on one of the ADCs, the DMA requests are no longer issued to ensure that all the data transferred to the RAM are valid (this behavior occurs whatever the MDMA configuration). It may happen that the EOC bit corresponding to one ADC remains set because the data register of this ADC contains valid data.

DMA one shot mode/ DMA circular mode when MDMA mode is selected

When MDMA mode is selected (10 or 11), bit DMACFG of the ADCx_CCR register must also be configured to select between DMA one shot mode and circular mode, as explained in section Section : Managing conversions using the DMA (bits DMACFG of master and slave ADC_CFGR are not relevant).

Stopping the conversions in dual ADC modes

The user must set the control bits ADSTP/JADSTP of the master ADC to stop the conversions of both ADC in dual ADC mode. The other ADSTP control bit of the slave ADC has no effect in dual ADC mode.

Once both ADC are effectively stopped, the bits ADSTART/JADSTART of the master and slave ADCs are both cleared by hardware.

21.4.31 Temperature sensor

The temperature sensor can be used to measure the junction temperature (T j ) of the device. The temperature sensor is internally connected to the ADC input channels which are used to convert the sensor output voltage to a digital value. When not in use, the sensor can be put in power down mode. It support the temperature range –40 to 125 °C.

Figure 153 shows the block diagram of connections between the temperature sensor and the ADC.

The temperature sensor output voltage changes linearly with temperature. The offset of this line varies from chip to chip due to process variation (up to 45 °C from one chip to another).

The uncalibrated internal temperature sensor is more suited for applications that detect temperature variations instead of absolute temperatures. To improve the accuracy of the temperature sensor measurement, calibration values are stored in system memory for each device by ST during production.

During the manufacturing process, the calibration data of the temperature sensor and the internal voltage reference are stored in the system memory area. The user application can then read them and use them to improve the accuracy of the temperature sensor or the internal reference (refer to the datasheet for additional information).

The temperature sensor is internally connected to the ADC input channel which is used to convert the sensor's output voltage to a digital value. Refer to the electrical characteristics section of the device datasheet for the sampling time value to be applied when converting the internal temperature sensor.

When not in use, the sensor can be put in power-down mode.

Figure 153 shows the block diagram of the temperature sensor.

Figure 153. Temperature sensor channel block diagram

Figure 153. Temperature sensor channel block diagram. The diagram shows a 'Temperature sensor' block connected to a multiplexer. The output of the sensor is labeled V_TS. The multiplexer is controlled by a 'VSENSESEL control bit'. The output of the multiplexer is connected to the 'ADC input' of an 'ADCx' block. The 'ADCx' block outputs 'Converted data' to an 'Address/data bus' block. The diagram is labeled MSv46150V2.
graph LR
    TS[Temperature sensor] -- V_TS --> MUX
    VSENSESEL[VSENSESEL control bit] --> MUX
    MUX --> ADCx[ADCx]
    ADCx -- Converted data --> Bus[Address/data bus]
  
Figure 153. Temperature sensor channel block diagram. The diagram shows a 'Temperature sensor' block connected to a multiplexer. The output of the sensor is labeled V_TS. The multiplexer is controlled by a 'VSENSESEL control bit'. The output of the multiplexer is connected to the 'ADC input' of an 'ADCx' block. The 'ADCx' block outputs 'Converted data' to an 'Address/data bus' block. The diagram is labeled MSv46150V2.

Reading the temperature

To use the sensor:

  1. 1. Select the ADC input channels that is connected to \( V_{TS} \) .
  2. 2. Program with the appropriate sampling time (refer to electrical characteristics section of the device datasheet).
  3. 3. Set the VSENSESEL bit in the ADCx_CCR register to wake up the temperature sensor from power-down mode.
  4. 4. Start the ADC conversion.
  5. 5. Read the resulting \( V_{TS} \) data in the ADC data register.
  6. 6. Calculate the actual temperature using the following formula:

\[ \text{temperature (in } ^\circ\text{C)} = \frac{\text{TS\_CAL2\_TEMP} - \text{TS\_CAL1\_TEMP}}{\text{TS\_CAL2} - \text{TS\_CAL1}} \times (\text{TS\_DATA} - \text{TS\_CAL1}) + \text{TS\_CAL1\_TEMP} \]

Where:

Refer to the device datasheet for more information about TS_CAL1 and TS_CAL2 calibration points.

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 VSENSESEL bits should be set at the same time.

The above formula is given for TS_DATA measurement done with the same \( V_{REF+} \) voltage as TS_CAL1/TS_CAL2 values. If \( V_{REF+} \) is different, the formula must be adapted. For example if \( V_{REF+} = 3.3\text{ V} \) and TS_CAL data are acquired at \( V_{REF+} = 3.0\text{ V} \) , TS_DATA must be replaced by \( TS\_DATA \times (3.3/3.0) \) .

21.4.32 \( V_{BAT} \) supply monitoring

The VBATSEL bit in the ADCx_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 3. This bridge is automatically enabled when VBATSEL is set, to connect \( V_{BAT}/3 \) to the ADC input channels. As a consequence, the converted digital value is one third of 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 device datasheet for the sampling time value to be applied when converting the \( V_{BAT}/3 \) voltage.

The figure below shows the block diagram of the \( V_{BAT} \) sensing feature.

Figure 154. \( V_{BAT} \) channel block diagram

Figure 154. VBAT channel block diagram. The diagram shows a switch controlled by the VBATSEL bit, connected to a VBAT pin. The switch is connected to a bridge divider consisting of two resistors in series, with the midpoint connected to the ADC input. The output of the divider is labeled VBAT/3. The ADC input is connected to an ADCx block, which is further connected to an Address/data bus. The diagram is labeled MSv46151V1 in the bottom right corner.
Figure 154. VBAT channel block diagram. The diagram shows a switch controlled by the VBATSEL bit, connected to a VBAT pin. The switch is connected to a bridge divider consisting of two resistors in series, with the midpoint connected to the ADC input. The output of the divider is labeled VBAT/3. The ADC input is connected to an ADCx block, which is further connected to an Address/data bus. The diagram is labeled MSv46151V1 in the bottom right corner.
  1. 1. The VBATSEL bit must be set to enable the conversion of internal channel for \( V_{BAT}/3 \) .

21.4.33 Monitoring the internal voltage reference

It is possible to monitor the internal voltage reference ( \( V_{REFINT} \) ) to have a reference point for evaluating the ADC \( V_{REF+} \) voltage level.

The internal reference voltage ( \( V_{REFINT} \) ) is internally connected to ADC1_INP18, ADC3_INP18, ADC4_INP18 and ADC5_INP18.

Refer to the electrical characteristics section of the product datasheet for the sampling time value to be applied when converting the internal voltage reference voltage.

Figure 155 shows the block diagram of the \( V_{REFINT} \) sensing feature.

Figure 155. \( V_{REFINT} \) channel block diagram

Block diagram of the V_REFINT channel. A box labeled 'Internal power block' outputs V_REFINT to a multiplexer. The multiplexer is controlled by the 'VREFEN control bit' and its output is connected to the 'ADC input' of a block labeled 'ADCx'. The diagram is labeled MSv34467V5 in the bottom right corner.
Block diagram of the V_REFINT channel. A box labeled 'Internal power block' outputs V_REFINT to a multiplexer. The multiplexer is controlled by the 'VREFEN control bit' and its output is connected to the 'ADC input' of a block labeled 'ADCx'. The diagram is labeled MSv34467V5 in the bottom right corner.
  1. 1. The VREFEN bit into ADCx_CCR register must be set to enable the conversion of internal channels ( \( V_{REFINT} \) ).

Calculating the actual \( V_{REF+} \) voltage using the internal reference voltage

The power supply voltage applied to the device may be subject to variations or not precisely known. When \( V_{DDA} \) is connected to \( V_{REF+} \) , it is possible to compute the actual \( V_{DDA} \) voltage using the embedded internal reference voltage ( \( V_{REFINT} \) ). \( V_{REFINT} \) and its calibration data, acquired by the ADC during the manufacturing process at \( V_{DDA\_Charac} \) , can be used to evaluate the actual \( V_{DDA} \) voltage level.

The following formula gives the actual \( V_{REF+} \) voltage supplying the device:

\[ V_{REF+} = V_{REF+\_Charac} \times VREFINT\_CAL / VREFINT\_DATA \]

Where:

Converting a supply-relative ADC measurement to an absolute voltage value

The ADC is designed to deliver a digital value corresponding to the ratio between \( V_{REF+} \) and the voltage applied on the converted channel.

For most applications \( V_{DDA} \) value is unknown and ADC converted values are right-aligned. In this case, it is necessary to convert this ratio into a voltage independent from \( V_{DDA} \) :

\[ V_{\text{CHANNELx}} = \frac{V_{\text{REF+}}}{\text{FULL\_SCALE}} \times \text{ADC\_DATA} \]

By replacing \( V_{\text{REF+}} \) by the formula provided above, the absolute voltage value is given by the following formula

\[ V_{\text{CHANNELx}} = \frac{V_{\text{REF+\_Charac}} \times V_{\text{REFINT\_CAL}} \times \text{ADC\_DATA}}{V_{\text{REFINT\_DATA}} \times \text{FULL\_SCALE}} \]

For applications where \( V_{\text{REF+}} \) is known and ADC converted values are right-aligned, the absolute voltage value can be obtained by using the following formula:

\[ V_{\text{CHANNELx}} = \frac{V_{\text{REF+}}}{\text{FULL\_SCALE}} \times \text{ADC\_DATA} \]

Where:

Note: If ADC measurements are done using an output format other than 16-bit right-aligned, all the parameters must first be converted to a compatible format before the calculation is done.

21.5 ADC in low-power mode

Table 177. Effect of low-power modes on the ADC

ModeDescription
SleepNo effect.
DMA requests are functional.
Low-power runNo effect.
Low-power sleepNo effect.
DMA requests are functional.
Stop 0/Stop 1The ADC is not operational. Its state is kept.
The ADC consumes the static current recommended to disable the peripheral in advance in order to reduce power consumption.
StandbyThe ADC is powered down and must be reinitialized after exiting Standby or Shutdown mode.
Shutdown

21.6 ADC interrupts

For each ADC, an interrupt can be generated:

Separate interrupt enable bits are available for flexibility.

Table 178. ADC interrupts per each ADC

Interrupt eventEvent flagEnable control bit
ADC readyADRDYADRDYIE
End of conversion of a regular groupEOCEOCIE
End of sequence of conversions of a regular groupEOSEOSIE
End of conversion of a injected groupJEOCJEOCIE
End of sequence of conversions of an injected groupJEOSJEOSIE
Analog watchdog 1 status bit is setAWD1AWD1IE
Analog watchdog 2 status bit is setAWD2AWD2IE
Analog watchdog 3 status bit is setAWD3AWD3IE
End of sampling phaseEOSMPEOSMPIE
OverrunOVROVRIE
Injected context queue overflowsJQOVFJQOVFIE

21.7 ADC registers (for each ADC)

Refer to Section 1.2 on page 74 for a list of abbreviations used in register descriptions.

21.7.1 ADC interrupt and status register (ADC_ISR)

Address offset: 0x00

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.JQOVFAWD3AWD2AWD1JEOSJEOCOVREOSEOCEOSMPADRDY
rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1

Bits 31:11 Reserved, must be kept at reset value.

Bit 10 JQOVF: Injected context queue overflow

This bit is set by hardware when an Overflow of the Injected Queue of Context occurs. It is cleared by software writing 1 to it. Refer to Section 21.4.21: Queue of context for injected conversions for more information.

0: No injected context queue overflow occurred (or the flag event was already acknowledged and cleared by software)

1: Injected context queue overflow has occurred

Bit 9 AWD3: Analog watchdog 3 flag

This bit is set by hardware when the converted voltage crosses the values programmed in the fields LT3[7:0] and HT3[7:0] of ADC_TR3 register. It is cleared by software writing 1 to it.

0: No analog watchdog 3 event occurred (or the flag event was already acknowledged and cleared by software)

1: Analog watchdog 3 event occurred

Bit 8 AWD2: Analog watchdog 2 flag

This bit is set by hardware when the converted voltage crosses the values programmed in the fields LT2[7:0] and HT2[7:0] of ADC_TR2 register. It is cleared by software writing 1 to it.

0: No analog watchdog 2 event occurred (or the flag event was already acknowledged and cleared by software)

1: Analog watchdog 2 event occurred

Bit 7 AWD1: Analog watchdog 1 flag

This bit is set by hardware when the converted voltage crosses the values programmed in the fields LT1[11:0] and HT1[11:0] of ADC_TR1 register. It is cleared by software writing 1 to it.

0: No analog watchdog 1 event occurred (or the flag event was already acknowledged and cleared by software)

1: Analog watchdog 1 event occurred

Bit 6 JEOS: Injected channel end of sequence flag

This bit is set by hardware at the end of the conversions of all injected channels in the group. It is cleared by software writing 1 to it.

0: Injected conversion sequence not complete (or the flag event was already acknowledged and cleared by software)

1: Injected conversions complete

Bit 5 JEOC: Injected channel end of conversion flag

This bit is set by hardware at the end of each injected conversion of a channel when a new data is available in the corresponding ADC_JDRy register. It is cleared by software writing 1 to it or by reading the corresponding ADC_JDRy register

0: Injected channel conversion not complete (or the flag event was already acknowledged and cleared by software)

1: Injected channel conversion complete

Bit 4 OVR: ADC overrun

This bit is set by hardware when an overrun occurs on a regular channel, meaning that a new conversion has completed while the EOC flag was already set. It is cleared by software writing 1 to it.

0: No overrun occurred (or the flag event was already acknowledged and cleared by software)

1: Overrun has occurred

Bit 3 EOS: End of regular sequence flag

This bit is set by hardware at the end of the conversions of a regular sequence of channels. It is cleared by software writing 1 to it.

0: Regular Conversions sequence not complete (or the flag event was already acknowledged and cleared by software)

1: Regular Conversions sequence complete

Bit 2 EOC: End of conversion flag

This bit is set by hardware at the end of each regular conversion of a channel when a new data is available in the ADC_DR register. It is cleared by software writing 1 to it or by reading the ADC_DR register

0: Regular channel conversion not complete (or the flag event was already acknowledged and cleared by software)

1: Regular channel conversion complete

Bit 1 EOSMP: End of sampling flag

This bit is set by hardware during the conversion of any channel (only for regular channels), at the end of the sampling phase.

0: not at the end of the sampling phase (or the flag event was already acknowledged and cleared by software)

1: End of sampling phase reached

Bit 0 ADRDY: ADC ready

This bit is set by hardware after the ADC has been enabled (bit ADEN = 1) and when the ADC reaches a state where it is ready to accept conversion requests.

It is cleared by software writing 1 to it.

0: ADC not yet ready to start conversion (or the flag event was already acknowledged and cleared by software)

1: ADC is ready to start conversion

21.7.2 ADC interrupt enable register (ADC_IER)

Address offset: 0x04

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.JQOVF
IE
AWD3IEAWD2IEAWD1IEJEOSIEJEOCIEOVR IEEOSIEEOCIEEOSMP
IE
ADRDI
IE
rwrwrwrwrwrwrwrwrwrwrw

Bits 31:11 Reserved, must be kept at reset value.

Bit 10 JQOVFIE: Injected context queue overflow interrupt enable

This bit is set and cleared by software to enable/disable the Injected Context Queue Overflow interrupt.

0: Injected Context Queue Overflow interrupt disabled

1: Injected Context Queue Overflow interrupt enabled. An interrupt is generated when the JQOVF bit is set.

Note: The software is allowed to write this bit only when JADSTART = 0 (which ensures that no injected conversion is ongoing).

Bit 9 AWD3IE: Analog watchdog 3 interrupt enable

This bit is set and cleared by software to enable/disable the analog watchdog 2 interrupt.

0: Analog watchdog 3 interrupt disabled

1: Analog watchdog 3 interrupt enabled

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bit 8 AWD2IE: Analog watchdog 2 interrupt enable

This bit is set and cleared by software to enable/disable the analog watchdog 2 interrupt.

0: Analog watchdog 2 interrupt disabled

1: Analog watchdog 2 interrupt enabled

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bit 7 AWD1IE: Analog watchdog 1 interrupt enable

This bit is set and cleared by software to enable/disable the analog watchdog 1 interrupt.

0: Analog watchdog 1 interrupt disabled

1: Analog watchdog 1 interrupt enabled

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bit 6 JEOSIE: End of injected sequence of conversions interrupt enable

This bit is set and cleared by software to enable/disable the end of injected sequence of conversions interrupt.

0: JEOS interrupt disabled

1: JEOS interrupt enabled. An interrupt is generated when the JEOS bit is set.

Note: The software is allowed to write this bit only when JADSTART = 0 (which ensures that no injected conversion is ongoing).

Bit 5 JEOCIE: End of injected conversion interrupt enable

This bit is set and cleared by software to enable/disable the end of an injected conversion interrupt.
0: JEOC interrupt disabled.

1: JEOC interrupt enabled. An interrupt is generated when the JEOC bit is set.

Note: The software is allowed to write this bit only when JADSTART = 0 (which ensures that no injected conversion is ongoing).

Bit 4 OVRIE: Overrun interrupt enable

This bit is set and cleared by software to enable/disable the Overrun interrupt of a regular conversion.

0: Overrun interrupt disabled

1: Overrun interrupt enabled. An interrupt is generated when the OVR bit is set.

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 3 EOSIE: End of regular sequence of conversions interrupt enable

This bit is set and cleared by software to enable/disable the end of regular sequence of conversions interrupt.

0: EOS interrupt disabled

1: EOS interrupt enabled. An interrupt is generated when the EOS bit is set.

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 2 EOCIE: End of regular conversion interrupt enable

This bit is set and cleared by software to enable/disable the end of a regular conversion interrupt.

0: EOC interrupt disabled.

1: EOC interrupt enabled. An interrupt is generated when the EOC bit is set.

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 1 EOSMPIE: End of sampling flag interrupt enable for regular conversions

This bit is set and cleared by software to enable/disable the end of the sampling phase interrupt for regular conversions.

0: EOSMP interrupt disabled.

1: EOSMP interrupt enabled. An interrupt is generated when the EOSMP bit is set.

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 0 ADRDYIE: ADC ready interrupt enable

This bit is set and cleared by software to enable/disable the ADC Ready interrupt.

0: ADRDY interrupt disabled

1: ADRDY interrupt enabled. An interrupt is generated when the ADRDY bit is set.

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

21.7.3 ADC control register (ADC_CR)

Address offset: 0x08

Reset value: 0x2000 0000

31302928272625242322212019181716
ADCAL
L
ADCAL
LDIF
DEEP
PWD
ADVREG
EN
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rsrwrwrw

1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.JADST
P
ADSTPJADST
ART
ADSTA
RT
ADDISADEN
rsrsrsrsrsrs

Bit 31 ADCAL: ADC calibration

This bit is set by software to start the calibration of the ADC. Program first the bit ADCALDIF to determine if this calibration applies for single-ended or differential inputs mode.

It is cleared by hardware after calibration is complete.

0: Calibration complete

1: Write 1 to calibrate the ADC. Read at 1 means that a calibration in progress.

Note: The software is allowed to launch a calibration by setting ADCAL only when ADEN = 0.

The software is allowed to update the calibration factor by writing ADC_CALFACT only when ADEN = 1 and ADSTART = 0 and JADSTART = 0 (ADC enabled and no conversion is ongoing)

Bit 30 ADCALDIF: Differential mode for calibration

This bit is set and cleared by software to configure the single-ended or differential inputs mode for the calibration.

0: Writing ADCAL launches a calibration in single-ended inputs mode.

1: Writing ADCAL launches a calibration in differential inputs mode.

Note: The software is allowed to write this bit only when the ADC is disabled and is not calibrating (ADCAL = 0, JADSTART = 0, JADSTP = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0).

Bit 29 DEEPPWD: Deep-power-down enable

This bit is set and cleared by software to put the ADC in Deep-power-down mode.

0: ADC not in Deep-power down

1: ADC in Deep-power-down (default reset state)

Note: The software is allowed to write this bit only when the ADC is disabled (ADCAL = 0, JADSTART = 0, JADSTP = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0).

Bit 28 ADVREGEN: ADC voltage regulator enable

This bit is set by software to enable the ADC voltage regulator.

Before performing any operation such as launching a calibration or enabling the ADC, the ADC voltage regulator must first be enabled and the software must wait for the regulator start-up time.

0: ADC Voltage regulator disabled

1: ADC Voltage regulator enabled.

For more details about the ADC voltage regulator enable and disable sequences, refer to Section 21.4.6: ADC Deep-power-down mode (DEEPPWD) and ADC voltage regulator (ADVREGEN) .

The software can program this bit field only when the ADC is disabled (ADCAL = 0, JADSTART = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0).

Bits 27:6 Reserved, must be kept at reset value.

Bit 5 JADSTP: ADC stop of injected conversion command

This bit is set by software to stop and discard an ongoing injected conversion (JADSTP Command).

It is cleared by hardware when the conversion is effectively discarded and the ADC injected sequence and triggers can be re-configured. The ADC is then ready to accept a new start of injected conversions (JADSTART command).

0: No ADC stop injected conversion command ongoing

1: Write 1 to stop injected conversions ongoing. Read 1 means that an ADSTP command is in progress.

Note: The software is allowed to set JADSTP only when JADSTART = 1 and ADDIS = 0 (ADC is enabled and eventually converting an injected conversion and there is no pending request to disable the ADC)

In Auto-injection mode (JAUTO = 1), setting ADSTP bit aborts both regular and injected conversions (do not use JADSTP)

Bit 4 ADSTP: ADC stop of regular conversion command

This bit is set by software to stop and discard an ongoing regular conversion (ADSTP Command).

It is cleared by hardware when the conversion is effectively discarded and the ADC regular sequence and triggers can be re-configured. The ADC is then ready to accept a new start of regular conversions (ADSTART command).

0: No ADC stop regular conversion command ongoing

1: Write 1 to stop regular conversions ongoing. Read 1 means that an ADSTP command is in progress.

Note: The software is allowed to set ADSTP only when ADSTART = 1 and ADDIS = 0 (ADC is enabled and eventually converting a regular conversion and there is no pending request to disable the ADC).

In auto-injection mode (JAUTO = 1), setting ADSTP bit aborts both regular and injected conversions (do not use JADSTP).

In dual ADC regular simultaneous mode and interleaved mode, the bit ADSTP of the master ADC must be used to stop regular conversions. The other ADSTP bit is inactive.

Bit 3 JADSTART: ADC start of injected conversion

This bit is set by software to start ADC conversion of injected channels. Depending on the configuration bits JEXTEN[1:0], a conversion starts immediately (software trigger configuration) or once an injected hardware trigger event occurs (hardware trigger configuration).

It is cleared by hardware:

0: No ADC injected conversion is ongoing.

1: Write 1 to start injected conversions. Read 1 means that the ADC is operating and eventually converting an injected channel.

Note: The software is allowed to set JADSTART only when ADEN = 1 and ADDIS = 0 (ADC is enabled and there is no pending request to disable the ADC).

In auto-injection mode (JAUTO = 1), regular and auto-injected conversions are started by setting bit ADSTART (JADSTART must be kept cleared)

Bit 2 ADSTART: ADC start of regular conversion

This bit is set by software to start ADC conversion of regular channels. Depending on the configuration bits EXTEN[1:0], a conversion starts immediately (software trigger configuration) or once a regular hardware trigger event occurs (hardware trigger configuration).

It is cleared by hardware:

0: No ADC regular conversion is ongoing.

1: Write 1 to start regular conversions. Read 1 means that the ADC is operating and eventually converting a regular channel.

Note: The software is allowed to set ADSTART only when ADEN = 1 and ADDIS = 0 (ADC is enabled and there is no pending request to disable the ADC)

In auto-injection mode (JAUTO = 1), regular and auto-injected conversions are started by setting bit ADSTART (JADSTART must be kept cleared)

Bit 1 ADDIS: ADC disable command

This bit is set by software to disable the ADC (ADDIS command) and put it into power-down state (OFF state).

It is cleared by hardware once the ADC is effectively disabled (ADEN is also cleared by hardware at this time).

0: no ADDIS command ongoing

1: Write 1 to disable the ADC. Read 1 means that an ADDIS command is in progress.

Note: The software is allowed to set ADDIS only when ADEN = 1 and both ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing)

Bit 0 ADEN: ADC enable control

This bit is set by software to enable the ADC. The ADC is effectively ready to operate once the flag ADRDY has been set.

It is cleared by hardware when the ADC is disabled, after the execution of the ADDIS command.

0: ADC is disabled (OFF state)

1: Write 1 to enable the ADC.

Note: The software is allowed to set ADEN only when all bits of ADC_CR registers are 0 (ADCAL = 0, JADSTART = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0) except for bit ADVREGEN which must be 1 (and the software must have wait for the startup time of the voltage regulator)

21.7.4 ADC configuration register (ADC_CFGR)

Address offset: 0x0C

Reset value: 0x8000 0000

31302928272625242322212019181716
JQDISAWD1CH[4:0]JAUTOJAWD1ENAWD1ENAWD1SGLJQMJDISCENDISCNUM[2:0]DISCEN
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

1514131211109876543210
ALIGNAUT DLYCONTOVR MODEXTEN[1:0]EXTSEL[4:0]RES[1:0]Res.DMA CFGDMA EN
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 JQDIS: Injected Queue disable

These bits are set and cleared by software to disable the Injected Queue mechanism :

0: Injected Queue enabled

1: Injected Queue disabled

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no regular nor injected conversion is ongoing).

A set or reset of JQDIS bit causes the injected queue to be flushed and the ADC_JSQR register is cleared.

Bits 30:26 AWD1CH[4:0]: Analog watchdog 1 channel selection

These bits are set and cleared by software. They select the input channel to be guarded by the analog watchdog.

00000: ADC analog input channel 0 monitored by AWD1

00001: ADC analog input channel 1 monitored by AWD1

.....

10010: ADC analog input channel 18 monitored by AWD1

others: reserved, must not be used

Note: Some channels are not connected physically. Keep the corresponding AWD1CH[4:0] setting to the reset value.

The channel selected by AWD1CH must be also selected into the SQi or JSQi bits.

The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bit 25 JAUTO: Automatic injected group conversion

This bit is set and cleared by software to enable/disable automatic injected group conversion after regular group conversion.

0: Automatic injected group conversion disabled

1: Automatic injected group conversion enabled

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no regular nor injected conversion is ongoing).

When dual mode is enabled (DUAL bits in ADCx_CCR register are not equal to zero), the bit JAUTO of the slave ADC is no more writable and its content is equal to the bit JAUTO of the master ADC.

Bit 24 JAWD1EN: Analog watchdog 1 enable on injected channels

This bit is set and cleared by software

0: Analog watchdog 1 disabled on injected channels

1: Analog watchdog 1 enabled on injected channels

Note: The software is allowed to write this bit only when JADSTART = 0 (which ensures that no injected conversion is ongoing).

Bit 23 AWD1EN: Analog watchdog 1 enable on regular channels

This bit is set and cleared by software

0: Analog watchdog 1 disabled on regular channels

1: Analog watchdog 1 enabled on regular channels

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 22 AWD1SGL: Enable the watchdog 1 on a single channel or on all channels

This bit is set and cleared by software to enable the analog watchdog on the channel identified by the AWD1CH[4:0] bits or on all the channels

0: Analog watchdog 1 enabled on all channels

1: Analog watchdog 1 enabled on a single channel

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bit 21 JQM: ADC_JSQR queue mode

This bit is set and cleared by software.

It defines how an empty Queue is managed.

0: ADC_JSQR mode 0: The Queue is never empty and maintains the last written configuration into ADC_JSQR.

1: ADC_JSQR mode 1: The Queue can be empty and when this occurs, the software and hardware triggers of the injected sequence are both internally disabled just after the completion of the last valid injected sequence.

Refer to Section 21.4.21: Queue of context for injected conversions for more information.

Note: The software is allowed to write this bit only when JADSTART = 0 (which ensures that no injected conversion is ongoing).

When dual mode is enabled (DUAL bits in ADCx_CCR register are not equal to zero), the bit JQM of the slave ADC is no more writable and its content is equal to the bit JQM of the master ADC.

Bit 20 JDISCEN: Discontinuous mode on injected channels

This bit is set and cleared by software to enable/disable discontinuous mode on the injected channels of a group.

0: Discontinuous mode on injected channels disabled

1: Discontinuous mode on injected channels enabled

Note: The software is allowed to write this bit only when JADSTART = 0 (which ensures that no injected conversion is ongoing).

It is not possible to use both auto-injected mode and discontinuous mode simultaneously: the bits DISCEN and JDISCEN must be kept cleared by software when JAUTO is set.

When dual mode is enabled (bits DUAL of ADCx_CCR register are not equal to zero), the bit JDISCEN of the slave ADC is no more writable and its content is equal to the bit JDISCEN of the master ADC.

Bits 19:17 DISCNUM[2:0] : Discontinuous mode channel count

These bits are written by software to define the number of regular channels to be converted in discontinuous mode, after receiving an external trigger.

000: 1 channel

001: 2 channels

...

111: 8 channels

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

When dual mode is enabled (DUAL bits in ADCx_CCR register are not equal to zero), the bits DISCNUM[2:0] of the slave ADC are no more writable and their content is equal to the bits DISCNUM[2:0] of the master ADC.

Bit 16 DISCEN : Discontinuous mode for regular channels

This bit is set and cleared by software to enable/disable Discontinuous mode for regular channels.

0: Discontinuous mode for regular channels disabled

1: Discontinuous mode for regular channels enabled

Note: It is not possible to have both discontinuous mode and continuous mode enabled: it is forbidden to set both DISCEN = 1 and CONT = 1.

It is not possible to use both auto-injected mode and discontinuous mode simultaneously: the bits DISCEN and JDISCEN must be kept cleared by software when JAUTO is set.

The software is allowed to write this bit only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

When dual mode is enabled (DUAL bits in ADCx_CCR register are not equal to zero), the bit DISCEN of the slave ADC is no more writable and its content is equal to the bit DISCEN of the master ADC.

Bit 15 ALIGN : Data alignment

This bit is set and cleared by software to select right or left alignment. Refer to Data register, data alignment and offset (ADC_DR, OFFSETy, OFFSETy_CH, ALIGN) .

0: Right alignment

1: Left alignment

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bit 14 AUTDLY : Delayed conversion mode

This bit is set and cleared by software to enable/disable the Auto Delayed Conversion mode.

0: Auto-delayed conversion mode off

1: Auto-delayed conversion mode on

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

When dual mode is enabled (DUAL bits in ADCx_CCR register are not equal to zero), the bit AUTDLY of the slave ADC is no more writable and its content is equal to the bit AUTDLY of the master ADC.

Bit 13 CONT : Single / continuous conversion mode for regular conversions

This bit is set and cleared by software. If it is set, regular conversion takes place continuously until it is cleared.

0: Single conversion mode

1: Continuous conversion mode

Note: It is not possible to have both discontinuous mode and continuous mode enabled: it is forbidden to set both DISCEN = 1 and CONT = 1.

The software is allowed to write this bit only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

When dual mode is enabled (DUAL bits in ADCx_CCR register are not equal to zero), the bit CONT of the slave ADC is no more writable and its content is equal to the bit CONT of the master ADC.

Bit 12 OVRMOD : Overrun mode

This bit is set and cleared by software and configure the way data overrun is managed.

0: ADC_DR register is preserved with the old data when an overrun is detected.

1: ADC_DR register is overwritten with the last conversion result when an overrun is detected.

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bits 11:10 EXTEN[1:0] : External trigger enable and polarity selection for regular channels

These bits are set and cleared by software to select the external trigger polarity and enable the trigger of a regular group.

00: Hardware trigger detection disabled (conversions can be launched by software)

01: Hardware trigger detection on the rising edge

10: Hardware trigger detection on the falling edge

11: Hardware trigger detection on both the rising and falling edges

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bits 9:5 EXTSEL[4:0] : External trigger selection for regular group

These bits select the external event used to trigger the start of conversion of a regular group:

00000: Event 0

00001: Event 1

00010: Event 2

00011: Event 3

00100: Event 4

00101: Event 5

00110: Event 6

00111: Event 7

...

11111: Event 31

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bits 4:3 RES[1:0] : Data resolution

These bits are written by software to select the resolution of the conversion.

00: 12-bit

01: 10-bit

10: 8-bit

11: 6-bit

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bit 2 Reserved, must be kept at reset value.

Bit 1 DMACFG : Direct memory access configuration

This bit is set and cleared by software to select between two DMA modes of operation. It is effective only when DMAEN = 1 ( single ADC mode ), or MDMA[1:0] ≠ 00 ( dual ADC mode ).
0: DMA One Shot mode selected
1: DMA Circular mode selected
For more details, refer to Section : Managing conversions using the DMA

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

In dual-ADC modes, this bit is not relevant and replaced by control bit DMACFG of the ADCx_CCR register.

Bit 0 DMAEN : Direct memory access enable

This bit is set and cleared by software to enable the generation of DMA requests. This allows to use the DMA to manage automatically the converted data. For more details, refer to Section : Managing conversions using the DMA .
0: DMA disabled
1: DMA enabled

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

In dual-ADC modes, this bit is not relevant and replaced by control bits MDMA[1:0] of the ADCx_CCR register.

21.7.5 ADC configuration register 2 (ADC_CFGR2)

Address offset: 0x10

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.SMPTRI
G
BULBSWTRI
G
Res.Res.Res.Res.Res.Res.Res.Res.GCOM
P
rwrwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.ROV
SM
TROVSOVSS[3:0]OVSR[2:0]JOVSEROVSE
rwrwrwrwrwrwrwrwrwrwrw

Bits 31:28 Reserved, must be kept at reset value.

Bit 27 SMPTRIG : Sampling time control trigger mode

This bit is set and cleared by software to enable the sampling time control trigger mode.

0: Sampling time control trigger mode disabled

1: Sampling time control trigger mode enabled

The sampling time starts on the trigger rising edge, and the conversion on the trigger falling edge.

EXTEN[1:0] bits should be set to 01. BULB bit must not be set when the SMPTRIG bit is set.

When EXTEN[1:0] bits are set to 00, set SWTRIG to start the sampling and clear SWTRIG bit to start the conversion.

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no conversion is ongoing).

Bit 26 BULB : Bulb sampling mode

This bit is set and cleared by software to enable the bulb sampling mode.

0: Bulb sampling mode disabled

1: Bulb sampling mode enabled. The sampling period starts just after the previous end of conversion.

SAMPTRIG bit must not be set when the BULB bit is set.

The very first ADC conversion is performed with the sampling time specified in SMPx bits.

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no conversion is ongoing).

Bit 25 SWTRIG : Software trigger bit for sampling time control trigger mode

This bit is set and cleared by software to enable the bulb sampling mode.

0: Software trigger starts the conversion for sampling time control trigger mode

1: Software trigger starts the sampling for sampling time control trigger mode

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no conversion is ongoing).

Bits 24:17 Reserved, must be kept at reset value.

Bit 16 GCOMP : Gain compensation mode

This bit is set and cleared by software to enable the gain compensation mode.

0: Regular ADC operating mode

1: Gain compensation enabled and applied on all channels

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no conversion is ongoing).

Bits 15:11 Reserved, must be kept at reset value.

Bit 10 ROVSM : Regular Oversampling mode

This bit is set and cleared by software to select the regular oversampling mode.

0: Continued mode: When injected conversions are triggered, the oversampling is temporarily stopped and continued after the injection sequence (oversampling buffer is maintained during injected sequence)

1: Resumed mode: When injected conversions are triggered, the current oversampling is aborted and resumed from start after the injection sequence (oversampling buffer is zeroed by injected sequence start)

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no conversion is ongoing).

Bit 9 TROVS: Triggered Regular Oversampling

This bit is set and cleared by software to enable triggered oversampling

0: All oversampled conversions for a channel are done consecutively following a trigger

1: Each oversampled conversion for a channel needs a new trigger

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no conversion is ongoing).

Bits 8:5 OVSS[3:0]: Oversampling shift

This bitfield is set and cleared by software to define the right shifting applied to the raw oversampling result.

0000: No shift

0001: Shift 1-bit

0010: Shift 2-bits

0011: Shift 3-bits

0100: Shift 4-bits

0101: Shift 5-bits

0110: Shift 6-bits

0111: Shift 7-bits

1000: Shift 8-bits

Other codes reserved

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no conversion is ongoing).

Bits 4:2 OVSR[2:0]: Oversampling ratio

This bitfield is set and cleared by software to define the oversampling ratio.

000: 2x

001: 4x

010: 8x

011: 16x

100: 32x

101: 64x

110: 128x

111: 256x

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no conversion is ongoing).

Bit 1 JOVSE: Injected Oversampling Enable

This bit is set and cleared by software to enable injected oversampling.

0: Injected Oversampling disabled

1: Injected Oversampling enabled

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing)

Bit 0 ROVSE: Regular Oversampling Enable

This bit is set and cleared by software to enable regular oversampling.

0: Regular Oversampling disabled

1: Regular Oversampling enabled

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing)

21.7.6 ADC sample time register 1 (ADC_SMPR1)

Address offset: 0x14

Reset value: 0x0000 0000

31302928272625242322212019181716
SMPPLUSRes.SMP9[2:0]SMP8[2:0]SMP7[2:0]SMP6[2:0]SMP5[2:1]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
SMP5[0]SMP4[2:0]SMP3[2:0]SMP2[2:0]SMP1[2:0]SMP0[2:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 SMPPLUS : Addition of one clock cycle to the sampling time

1: 2.5 ADC clock cycle sampling time becomes 3.5 ADC clock cycles for the ADC_SMPR1 and ADC_SMPR2 registers.

0: The sampling time remains set to 2.5 ADC clock cycles remains

To make sure no conversion is ongoing, the software is allowed to write this bit only when ADSTART= 0 and JADSTART= 0.

Bit 30 Reserved, must be kept at reset value.

Bits 29:0 SMPx[2:0] : Channel x sampling time selection (x = 9 to 0)

These bits are written by software to select the sampling time individually for each channel. During sample cycles, the channel selection bits must remain unchanged.

000: 2.5 ADC clock cycles

001: 6.5 ADC clock cycles

010: 12.5 ADC clock cycles

011: 24.5 ADC clock cycles

100: 47.5 ADC clock cycles

101: 92.5 ADC clock cycles

110: 247.5 ADC clock cycles

111: 640.5 ADC clock cycles

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Some channels are not connected physically. Keep the corresponding SMPx[2:0] setting to the reset value.

21.7.7 ADC sample time register 2 (ADC_SMPR2)

Address offset: 0x18

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.SMP18[2:0]SMP17[2:0]SMP16[2:0]SMP15[2:1]
rwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
SMP15[0]SMP14[2:0]SMP13[2:0]SMP12[2:0]SMP11[2:0]SMP10[2:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:27 Reserved, must be kept at reset value.

Bits 26:0 SMPx[2:0] : Channel x sampling time selection (x = 18 to 10)

These bits are written by software to select the sampling time individually for each channel. During sampling cycles, the channel selection bits must remain unchanged.

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Some channels are not connected physically. Keep the corresponding SMPx[2:0] setting to the reset value.

21.7.8 ADC watchdog threshold register 1 (ADC_TR1)

Address offset: 0x20

Reset value: 0x0FFF 0000

31302928272625242322212019181716
Res.Res.Res.Res.HT1[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
Res.AWDFILT[2:0]LT1[11:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:28 Reserved, must be kept at reset value.

Bits 27:16 HT1[11:0] : Analog watchdog 1 higher threshold

These bits are written by software to define the higher threshold for the analog watchdog 1.

Refer to Section 21.4.28: Analog window watchdog (AWD1EN, JAWD1EN, AWD1SGL, AWD1CH, AWD2CH, AWD3CH, AWD_HTx, AWD_LTx, AWDx) .

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bit 15 Reserved, must be kept at reset value.

Bits 14:12 AWDFILT : Analog watchdog filtering parameter

This bit is set and cleared by software.

000: No filtering

001: two consecutive detection generates an AWDx flag or an interrupt

...

111: Eight consecutive detection generates an AWDx flag or an interrupt

Note: The software is allowed to write this bit only when ADSTART = 0 (which ensures that no conversion is ongoing).

Bits 11:0 LT1[11:0] : Analog watchdog 1 lower threshold

These bits are written by software to define the lower threshold for the analog watchdog 1.

Refer to Section 21.4.28: Analog window watchdog (AWD1EN, JAWD1EN, AWD1SGL, AWD1CH, AWD2CH, AWD3CH, AWD_HTx, AWD_LTx, AWDx)

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

21.7.9 ADC watchdog threshold register 2 (ADC_TR2)

Address offset: 0x24

Reset value: 0x00FF 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.HT2[7:0]
rwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.LT2[7:0]
rwrwrwrwrwrwrwrw

Bits 31:24 Reserved, must be kept at reset value.

Bits 23:16 HT2[7:0] : Analog watchdog 2 higher threshold

These bits are written by software to define the higher threshold for the analog watchdog 2.

Refer to Section 21.4.28: Analog window watchdog (AWD1EN, JAWD1EN, AWD1SGL, AWD1CH, AWD2CH, AWD3CH, AWD_HTx, AWD_LTx, AWDx)

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bits 15:8 Reserved, must be kept at reset value.

Bits 7:0 LT2[7:0] : Analog watchdog 2 lower threshold

These bits are written by software to define the lower threshold for the analog watchdog 2.

Refer to Section 21.4.28: Analog window watchdog (AWD1EN, JAWD1EN, AWD1SGL, AWD1CH, AWD2CH, AWD3CH, AWD_HTx, AWD_LTx, AWDx)

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

21.7.10 ADC watchdog threshold register 3 (ADC_TR3)

Address offset: 0x28

Reset value: 0x00FF 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.HT3[7:0]
rwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.LT3[7:0]
rwrwrwrwrwrwrwrw

Bits 31:24 Reserved, must be kept at reset value.

Bits 23:16 HT3[7:0] : Analog watchdog 3 higher threshold

These bits are written by software to define the higher threshold for the analog watchdog 3.

Refer to Section 21.4.28: Analog window watchdog (AWD1EN, JAWD1EN, AWD1SGL, AWD1CH, AWD2CH, AWD3CH, AWD_HTx, AWD_LTx, AWDx)

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bits 15:8 Reserved, must be kept at reset value.

Bits 7:0 LT3[7:0] : Analog watchdog 3 lower threshold

These bits are written by software to define the lower threshold for the analog watchdog 3.

This watchdog compares the 8-bit of LT3 with the 8 MSB of the converted data.

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

21.7.11 ADC regular sequence register 1 (ADC_SQR1)

Address offset: 0x30

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.SQ4[4:0]Res.SQ3[4:0]Res.SQ2[4]
rwrwrwrwrwrwrwrwrw
1514131211109876543210
SQ2[3:0]Res.SQ1[4:0]Res.Res.L[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:29 Reserved, must be kept at reset value.

Bits 28:24 SQ4[4:0] : fourth conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the fourth in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 23 Reserved, must be kept at reset value.

Bits 22:18 SQ3[4:0] : third conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the third in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 17 Reserved, must be kept at reset value.

Bits 16:12 SQ2[4:0] : second conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the second in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 11 Reserved, must be kept at reset value.

Bits 10:6 SQ1[4:0] : first conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the first in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bits 5:4 Reserved, must be kept at reset value.

Bits 3:0 L[3:0] : Regular channel sequence length

These bits are written by software to define the total number of conversions in the regular channel conversion sequence.

0000: 1 conversion

0001: 2 conversions

...

1111: 16 conversions

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Note: Some channels are not connected physically and must not be selected for conversion.

21.7.12 ADC regular sequence register 2 (ADC_SQR2)

Address offset: 0x34

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.SQ9[4:0]Res.SQ8[4:0]Res.SQ7[4]rw
rwrwrwrwrwrwrwrw
1514131211109876543210
SQ7[3:0]Res.SQ6[4:0]Res.SQ5[4:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:29 Reserved, must be kept at reset value.

Bits 28:24 SQ9[4:0] : 9th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 9th in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 23 Reserved, must be kept at reset value.

Bits 22:18 SQ8[4:0] : 8th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 8th in the regular conversion sequence

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 17 Reserved, must be kept at reset value.

Bits 16:12 SQ7[4:0] : 7th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 7th in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 11 Reserved, must be kept at reset value.

Bits 10:6 SQ6[4:0] : 6th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 6th in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 5 Reserved, must be kept at reset value.

Bits 4:0 SQ5[4:0] : 5th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 5th in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Note: Some channels are not connected physically and must not be selected for conversion.

21.7.13 ADC regular sequence register 3 (ADC_SQR3)

Address offset: 0x38

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.SQ14[4:0]Res.SQ13[4:0]Res.SQ12[4]
rwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
SQ12[3:0]Res.SQ11[4:0]Res.SQ10[4:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:29 Reserved, must be kept at reset value.

Bits 28:24 SQ14[4:0] : 14th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 14th in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 23 Reserved, must be kept at reset value.

Bits 22:18 SQ13[4:0] : 13th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 13th in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 17 Reserved, must be kept at reset value.

Bits 16:12 SQ12[4:0] : 12th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 12th in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 11 Reserved, must be kept at reset value.

Bits 10:6 SQ11[4:0] : 11th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 11th in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 5 Reserved, must be kept at reset value.

Bits 4:0 SQ10[4:0] : 10th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 10th in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Note: Some channels are not connected physically and must not be selected for conversion.

21.7.14 ADC regular sequence register 4 (ADC_SQR4)

Address offset: 0x3C

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
ResResResResResSQ16[4:0]ResSQ15[4:0]
rwrwrwrwrwrwrwrwrwrw

Bits 31:11 Reserved, must be kept at reset value.

Bits 10:6 SQ16[4:0] : 16th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 16th in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 5 Reserved, must be kept at reset value.

Bits 4:0 SQ15[4:0] : 15th conversion in regular sequence

These bits are written by software with the channel number (0 to 18) assigned as the 15th in the regular conversion sequence.

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Note: Some channels are not connected physically and must not be selected for conversion.

21.7.15 ADC regular data register (ADC_DR)

Address offset: 0x40

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
RDATA[15:0]
rrrrrrrrrrrrrrrr

Bits 31:16 Reserved, must be kept at reset value.

Bits 15:0 RDATA[15:0] : Regular data converted

These bits are read-only. They contain the conversion result from the last converted regular channel. The data are left- or right-aligned as described in Section 21.4.26: Data management .

21.7.16 ADC injected sequence register (ADC_JSQR)

Address offset: 0x4C

Reset value: 0x0000 0000

31302928272625242322212019181716
JSQ4[4:0]Res.JSQ3[4:0]Res.JSQ2[4:1]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
JSQ20Res.JSQ1[4:0]JEXTEN[1:0]JEXTSEL[4:0]JL[1:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:27 JSQ4[4:0] : fourth conversion in the injected sequence

These bits are written by software with the channel number (0 to 18) assigned as the fourth in the injected conversion sequence.c

Note: The software is allowed to write these bits only when JADSTART = 0 (which ensures that no injected conversion is ongoing), unless the context queue is enabled (JQDIS = 0 in the ADC_CFGR register).

Bit 26 Reserved, must be kept at reset value.

Bits 25:21 JSQ3[4:0] : third conversion in the injected sequence

These bits are written by software with the channel number (0 to 18) assigned as the third in the injected conversion sequence.

Note: The software is allowed to write these bits only when JADSTART = 0 (which ensures that no injected conversion is ongoing), unless the context queue is enabled (JQDIS = 0 in the ADC_CFGR register).

Bit 20 Reserved, must be kept at reset value.

Bits 19:15 JSQ2[4:0] : second conversion in the injected sequence

These bits are written by software with the channel number (0 to 18) assigned as the second in the injected conversion sequence.

Note: The software is allowed to write these bits only when JADSTART = 0 (which ensures that no injected conversion is ongoing), unless the context queue is enabled (JQDIS = 0 in the ADC_CFGR register).

Bit 14 Reserved, must be kept at reset value.

Bits 13:9 JSQ1[4:0] : first conversion in the injected sequence

These bits are written by software with the channel number (0 to 18) assigned as the first in the injected conversion sequence.

Note: The software is allowed to write these bits only when JADSTART = 0 (which ensures that no injected conversion is ongoing), unless the context queue is enabled (JQDIS = 0 in the ADC_CFGR register).

Bits 8:7 JEXTEN[1:0] : External Trigger Enable and Polarity Selection for injected channels

These bits are set and cleared by software to select the external trigger polarity and enable the trigger of an injected group.

00: If JQDIS = 0 (queue enabled), Hardware and software trigger detection disabled

00: If JQDIS = 1 (queue disabled), Hardware trigger detection disabled (conversions can be launched by software)

01: Hardware trigger detection on the rising edge

10: Hardware trigger detection on the falling edge

11: Hardware trigger detection on both the rising and falling edges

Note: The software is allowed to write these bits only when JADSTART = 0 (which ensures that no injected conversion is ongoing).

If JQM = 1 and if the Queue of Context becomes empty, the software and hardware triggers of the injected sequence are both internally disabled (refer to Section 21.4.21: Queue of context for injected conversions ).

Bits 6:2 JEXTSEL[4:0] : External Trigger Selection for injected group

These bits select the external event used to trigger the start of conversion of an injected group:

Note: The software is allowed to write these bits only when JADSTART = 0 (which ensures that no injected conversion is ongoing).

Bits 1:0 JL[1:0] : Injected channel sequence length

These bits are written by software to define the total number of conversions in the injected channel conversion sequence.

Note: The software is allowed to write these bits only when JADSTART = 0 (which ensures that no injected conversion is ongoing).

Note: Some channels are not connected physically and must not be selected for conversion.

21.7.17 ADC offset y register (ADC_OF Ry)

Address offset: 0x60 + 0x04 * (y -1), (y= 1 to 4)

Reset value: 0x0000 0000

31302928272625242322212019181716
OFFSET_ENOFFSET_CH[4:0]SATENOFFSE_TPOSRes.Res.Res.Res.Res.Res.Res.Res.
rwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.Res.OFFSET[11:0]
rwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 OFFSET_EN : Offset y enable

This bit is written by software to enable or disable the offset programmed into bits OFFSETy[11:0].

Note: The software is allowed to write this bit only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bits 30:26 OFFSET_CH[4:0] : Channel selection for the data offset y

These bits are written by software to define the channel to which the offset programmed into bits OFFSETy[11:0] applies.

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Some channels are not connected physically and must not be selected for the data offset y.

Bit 25 SATEN : Saturation enable

This bit is set and cleared by software to enable the saturation at 0x000 and 0xFFF for the offset function.

0: No saturation control, offset result can be signed

1: Saturation enabled, offset result unsigned and saturated at 0x000 and 0xFFF

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bit 24 OFFSETPOS : Positive offset

This bit is set and cleared by software to enable the positive offset.

0: Negative offset

1: Positive offset

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Bits 23:12 Reserved, must be kept at reset value.

Bits 11:0 OFFSET[11:0] : Data offset y for the channel programmed into bits OFFSETy_CH[4:0]

These bits are written by software to define the offset y to be subtracted from the raw converted data when converting a channel (can be regular or injected). The channel to which applies the data offset y must be programmed in the bits OFFSETy_CH[4:0]. The conversion result can be read from in the ADC_DR (regular conversion) or from in the ADC_JDRyi registers (injected conversion).

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

If several offset (OFFSETy) point to the same channel, only the offset with the lowest x value is considered for the subtraction.

Ex: if OFFSET1_CH[4:0]=4 and OFFSET2_CH[4:0]=4, this is OFFSET1[11:0] which is subtracted when converting channel 4.

21.7.18 ADC injected channel y data register (ADC_JDRy)

Address offset: 0x80 + 0x04 * (y - 1), (y = 1 to 4)

Reset value: 0x0000 0000

31302928272625242322212019181716
ResResResResResResResResResResResResResResResRes
1514131211109876543210
JDATA[15:0]
rrrrrrrrrrrrrrrr

Bits 31:16 Reserved, must be kept at reset value.

Bits 15:0 JDATA[15:0] : Injected data

These bits are read-only. They contain the conversion result from injected channel y. The data are left -or right-aligned as described in Section 21.4.26: Data management .

21.7.19 ADC analog watchdog 2 configuration register (ADC_AWD2CR)

Address offset: 0xA0

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.AWD2CH[18:16]
rwrwrw
1514131211109876543210
AWD2CH[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:19 Reserved, must be kept at reset value.

Bits 18:0 AWD2CH[18:0] : Analog watchdog 2 channel selection

These bits are set and cleared by software. They enable and select the input channels to be guarded by the analog watchdog 2.

AWD2CH[i] = 0: ADC analog input channel i is not monitored by AWD2

AWD2CH[i] = 1: ADC analog input channel i is monitored by AWD2

When AWD2CH[18:0] = 000..0, the analog watchdog 2 is disabled

Note: The channels selected by AWD2CH must be also selected into the SQi or JSQi bits.

The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Some channels are not connected physically and must not be selected for the analog watchdog.

21.7.20 ADC analog watchdog 3 configuration register (ADC_AWD3CR)

Address offset: 0xA4

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.AWD3CH[18:16]
rwrwrw
1514131211109876543210
AWD3CH[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:19 Reserved, must be kept at reset value.

Bits 18:0 AWD3CH[18:0] : Analog watchdog 3 channel selection

These bits are set and cleared by software. They enable and select the input channels to be guarded by the analog watchdog 3.

AWD3CH[i] = 0: ADC analog input channel i is not monitored by AWD3

AWD3CH[i] = 1: ADC analog input channel i is monitored by AWD3

When AWD3CH[18:0] = 000..0, the analog watchdog 3 is disabled

Note: The channels selected by AWD3CH must be also selected into the SQi or JSQi bits.

The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (which ensures that no conversion is ongoing).

Some channels are not connected physically and must not be selected for the analog watchdog.

21.7.21 ADC differential mode selection register (ADC_DIFSEL)

Address offset: 0xB0

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.DIFSEL[18:16]
rwrwrw
1514131211109876543210
DIFSEL[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwr

Bits 31:19 Reserved, must be kept at reset value.

Bits 18:0 DIFSEL[18:0] : Differential mode for channels 18 to 0.

These bits are set and cleared by software. They allow to select if a channel is configured as single-ended or differential mode.

DIFSEL[i] = 0: ADC analog input channel is configured in single ended mode

DIFSEL[i] = 1: ADC analog input channel i is configured in differential mode

Note: The DIFSEL bits corresponding to channels that are either connected to a single-ended I/O port or to an internal channel must be kept their reset value (single-ended input mode).

The software is allowed to write these bits only when the ADC is disabled (ADCAL = 0, JADSTART = 0, JADSTP = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0).

21.7.22 ADC calibration factors (ADC_CALFACT)

Address offset: 0xB4

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.CALFACT_D[6:0]
rwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.CALFACT_S[6:0]
rwrwrwrwrwrwrw

Bits 31:23 Reserved, must be kept at reset value.

Bits 22:16 CALFACT_D[6:0] : Calibration Factors in differential mode

These bits are written by hardware or by software.

Once a differential inputs calibration is complete, they are updated by hardware with the calibration factors.

Software can write these bits with a new calibration factor. If the new calibration factor is different from the current one stored into the analog ADC, it is then applied once a new differential calibration is launched.

Note: The software is allowed to write these bits only when ADEN = 1, ADSTART = 0 and JADSTART = 0 (ADC is enabled and no calibration is ongoing and no conversion is ongoing).

Bits 15:7 Reserved, must be kept at reset value.

Bits 6:0 CALFACT_S[6:0] : Calibration Factors In single-ended mode

These bits are written by hardware or by software.

Once a single-ended inputs calibration is complete, they are updated by hardware with the calibration factors.

Software can write these bits with a new calibration factor. If the new calibration factor is different from the current one stored into the analog ADC, it is then applied once a new single-ended calibration is launched.

Note: The software is allowed to write these bits only when ADEN = 1, ADSTART = 0 and JADSTART = 0 (ADC is enabled and no calibration is ongoing and no conversion is ongoing).

21.7.23 ADC Gain compensation Register (ADC_GCOMP)

Address offset: 0xC0

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.GCOMP COEFF[13:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:14 Reserved, must be kept at reset value.

Bits 13:0 GCOMP COEFF[13:0] : Gain compensation coefficient

These bits are set and cleared by software to program the gain compensation coefficient.

00 1000 0000 0000: gain factor of 0.5

...

01 0000 0000 0000: gain factor of 1

10 0000 0000 0000: gain factor of 2

11 0000 0000 0000: gain factor of 3

...

The coefficient is divided by 4096 to get the gain factor ranging from 0 to 3.999756.

Note: This gain compensation is only applied when GCOMP bit of ADC_CFGR2 register is 1.

21.8 ADC common registers

These registers define the control and status registers common to master and slave ADCs:

21.8.1 ADCx common status register (ADCx_CSR) (x = 12 or 345)

Address offset: 0x300

Reset value: 0x0000 0000

This register provides an image of the status bits of the different ADCs. Nevertheless it is read-only and does not allow to clear the different status bits. Instead each status bit must be cleared by writing 0 to it in the corresponding ADC_ISR register.

One interface controls ADC1 and ADC2, while the other interface controls ADC3, ADC4 and ADC5.

31302928272625242322212019181716
Res.Res.Res.Res.Res.JQOVF_
SLV
AWD3_
SLV
AWD2_
SLV
AWD1_
SLV
JEOS_
SLV
JEOC_
SLV
OVR_
SLV
EOS_
SLV
EOC_
SLV
EOSMP_
SLV
ADRDY_
SLV
rrrrrrrrrrr
1514131211109876543210
Res.Res.Res.Res.Res.JQOVF_
MST
AWD3_
MST
AWD2_
MST
AWD1_
MST
JEOS_
MST
JEOC_
MST
OVR_
MST
EOS_
MST
EOC_
MST
EOSMP_
MST
ADRDY_
MST
rrrrrrrrrrr

Bits 31:27 Reserved, must be kept at reset value.

Bit 26 JQOVF_
SLV
: Injected Context Queue Overflow flag of the slave ADC

This bit is a copy of the JQOVF bit in the corresponding ADC_ISR register.

Bit 25 AWD3_
SLV
: Analog watchdog 3 flag of the slave ADC

This bit is a copy of the AWD3 bit in the corresponding ADC_ISR register.

Bit 24 AWD2_
SLV
: Analog watchdog 2 flag of the slave ADC

This bit is a copy of the AWD2 bit in the corresponding ADC_ISR register.

Bit 23 AWD1_
SLV
: Analog watchdog 1 flag of the slave ADC

This bit is a copy of the AWD1 bit in the corresponding ADC_ISR register.

Bit 22 JEOS_
SLV
: End of injected sequence flag of the slave ADC

This bit is a copy of the JEOS bit in the corresponding ADC_ISR register.

Bit 21 JEOC_
SLV
: End of injected conversion flag of the slave ADC

This bit is a copy of the JEOC bit in the corresponding ADC_ISR register.

Bit 20 OVR_
SLV
: Overrun flag of the slave ADC

This bit is a copy of the OVR bit in the corresponding ADC_ISR register.

Bit 19 EOS_
SLV
: End of regular sequence flag of the slave ADC. This bit is a copy of the EOS bit in the corresponding ADC_ISR register.

Bit 18 EOC_
SLV
: End of regular conversion of the slave ADC

This bit is a copy of the EOC bit in the corresponding ADC_ISR register.

Bit 17 EOSMP_
SLV
: End of Sampling phase flag of the slave ADC

This bit is a copy of the EOSMP2 bit in the corresponding ADC_ISR register.

Bit 16 ADRDY_SLV : Slave ADC ready

This bit is a copy of the ADRDY bit in the corresponding ADC_ISR register.

Bits 15:11 Reserved, must be kept at reset value.

Bit 10 JQOVF_MST : Injected Context Queue Overflow flag of the master ADC

This bit is a copy of the JQOVF bit in the corresponding ADC_ISR register.

Bit 9 AWD3_MST : Analog watchdog 3 flag of the master ADC

This bit is a copy of the AWD3 bit in the corresponding ADC_ISR register.

Bit 8 AWD2_MST : Analog watchdog 2 flag of the master ADC

This bit is a copy of the AWD2 bit in the corresponding ADC_ISR register.

Bit 7 AWD1_MST : Analog watchdog 1 flag of the master ADC

This bit is a copy of the AWD1 bit in the corresponding ADC_ISR register.

Bit 6 JEOS_MST : End of injected sequence flag of the master ADC

This bit is a copy of the JEOS bit in the corresponding ADC_ISR register.

Bit 5 JEOC_MST : End of injected conversion flag of the master ADC

This bit is a copy of the JEOC bit in the corresponding ADC_ISR register.

Bit 4 OVR_MST : Overrun flag of the master ADC

This bit is a copy of the OVR bit in the corresponding ADC_ISR register.

Bit 3 EOS_MST : End of regular sequence flag of the master ADC

This bit is a copy of the EOS bit in the corresponding ADC_ISR register.

Bit 2 EOC_MST : End of regular conversion of the master ADC

This bit is a copy of the EOC bit in the corresponding ADC_ISR register.

Bit 1 EOSMP_MST : End of Sampling phase flag of the master ADC

This bit is a copy of the EOSMP bit in the corresponding ADC_ISR register.

Bit 0 ADRDY_MST : Master ADC ready

This bit is a copy of the ADRDY bit in the corresponding ADC_ISR register.

21.8.2 ADCx common control register (ADCx_CCR) (x = 12 or 345)

Address offset: 0x308

Reset value: 0x0000 0000

One interface controls ADC1 and ADC2, while the other interface controls ADC3, ADC4 and ADC5.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.VBATS ELVSENSES ELVREF ENPRESC[3:0]CKMODE[1:0]
rwrwrwrwrwrwrwrwrw
1514131211109876543210
MDMA[1:0]DMA CFGRes.DELAY[3:0]Res.Res.Res.DUAL[4:0]
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:25 Reserved, must be kept at reset value.

Bit 24 VBATSEL : VBAT selection

This bit is set and cleared by software to control VBAT.

0: V BAT channel disabled.

1: V BAT channel enabled

Bit 23 VSENSESEL : V TS selection

This bit is set and cleared by software to control V TS .

0: Temperature sensor channel disabled

1: Temperature sensor channel enabled

Bit 22 VREFINT : V REFINT enable

This bit is set and cleared by software to enable/disable the V REFINT channel.

0: V REFINT channel disabled

1: V REFINT channel enabled

Bits 21:18 PRESC[3:0] : ADC prescaler

These bits are set and cleared by software to select the frequency of the clock to the ADC. The clock is common for all the ADCs.

0000: input ADC clock not divided

0001: input ADC clock divided by 2

0010: input ADC clock divided by 4

0011: input ADC clock divided by 6

0100: input ADC clock divided by 8

0101: input ADC clock divided by 10

0110: input ADC clock divided by 12

0111: input ADC clock divided by 16

1000: input ADC clock divided by 32

1001: input ADC clock divided by 64

1010: input ADC clock divided by 128

1011: input ADC clock divided by 256

other: reserved

Note: The software is allowed to write these bits only when the ADC is disabled (ADCAL = 0, JADSTART = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0). The ADC prescaler value is applied only when CKMODE[1:0] = 00.

Bits 17:16 CKMODE[1:0] : ADC clock mode

These bits are set and cleared by software to define the ADC clock scheme (which is common to both master and slave ADCs):

00: adc_ker_ck (x = 123) (Asynchronous clock mode), generated at product level (refer to Section 6: Reset and clock control (RCC))

01: adc_hclk/1 (Synchronous clock mode). This configuration must be enabled only if the AHB clock prescaler is set (HPRE[3:0] = 0xxx in RCC_CFGR register) and if the system clock has a 50% duty cycle.

10: adc_hclk/2 (Synchronous clock mode)

11: adc_hclk/4 (Synchronous clock mode)

In all synchronous clock modes, there is no jitter in the delay from a timer trigger to the start of a conversion.

Note: The software is allowed to write these bits only when the ADCs are disabled (ADCAL = 0, JADSTART = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0).

Bits 15:14 MDMA[1:0] : Direct memory access mode for dual ADC mode

This bitfield is set and cleared by software. Refer to the DMA controller section for more details.

00: MDMA mode disabled

01: Reserved

10: MDMA mode enabled for 12 and 10-bit resolution

11: MDMA mode enabled for 8 and 6-bit resolution

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 13 DMACFG : DMA configuration (for dual ADC mode)

This bit is set and cleared by software to select between two DMA modes of operation and is effective only when DMAEN = 1.

0: DMA One Shot mode selected

1: DMA Circular mode selected

For more details, refer to Section : Managing conversions using the DMA

Note: The software is allowed to write these bits only when ADSTART = 0 (which ensures that no regular conversion is ongoing).

Bit 12 Reserved, must be kept at reset value.

Bits 11:8 DELAY : Delay between 2 sampling phases

These bits are set and cleared by software. These bits are used in dual interleaved modes.

Refer to Table 179 for the value of ADC resolution versus DELAY bits values.

Note: The software is allowed to write these bits only when the ADCs are disabled (ADCAL = 0, JADSTART = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0).

Bits 7:5 Reserved, must be kept at reset value.

Bits 4:0 DUAL[4:0] : Dual ADC mode selection

These bits are written by software to select the operating mode.

All the ADCs independent:

00000: Independent mode

00001 to 01001: Dual mode, master and slave ADCs working together

00001: Combined regular simultaneous + injected simultaneous mode

00010: Combined regular simultaneous + alternate trigger mode

00011: Combined Interleaved mode + injected simultaneous mode

00100: Reserved

00101: Injected simultaneous mode only

00110: Regular simultaneous mode only

00111: Interleaved mode only

01001: Alternate trigger mode only

All other combinations are reserved and must not be programmed

Note: The software is allowed to write these bits only when the ADCs are disabled (ADCAL = 0, JADSTART = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0).

Table 179. DELAY bits versus ADC resolution

DELAY bits12-bit resolution10-bit resolution8-bit resolution6-bit resolution
00001 * T adc_ker_ck1 * T adc_ker_ck1 * T adc_ker_ck1 * T adc_ker_ck
00012 * T adc_ker_ck2 * T adc_ker_ck2 * T adc_ker_ck2 * T adc_ker_ck
00103 * T adc_ker_ck3 * T adc_ker_ck3 * T adc_ker_ck3 * T adc_ker_ck

Table 179. DELAY bits versus ADC resolution (continued)

DELAY bits12-bit resolution10-bit resolution8-bit resolution6-bit resolution
0011\( 4 * T_{adc\_ker\_ck} \)\( 4 * T_{adc\_ker\_ck} \)\( 4 * T_{adc\_ker\_ck} \)\( 4 * T_{adc\_ker\_ck} \)
0100\( 5 * T_{adc\_ker\_ck} \)\( 5 * T_{adc\_ker\_ck} \)\( 5 * T_{adc\_ker\_ck} \)\( 5 * T_{adc\_ker\_ck} \)
0101\( 6 * T_{adc\_ker\_ck} \)\( 6 * T_{adc\_ker\_ck} \)\( 6 * T_{adc\_ker\_ck} \)\( 6 * T_{adc\_ker\_ck} \)
0110\( 7 * T_{adc\_ker\_ck} \)\( 7 * T_{adc\_ker\_ck} \)\( 7 * T_{adc\_ker\_ck} \)\( 6 * T_{adc\_ker\_ck} \)
0111\( 8 * T_{adc\_ker\_ck} \)\( 8 * T_{adc\_ker\_ck} \)\( 8 * T_{adc\_ker\_ck} \)\( 6 * T_{adc\_ker\_ck} \)
1000\( 9 * T_{adc\_ker\_ck} \)\( 9 * T_{adc\_ker\_ck} \)\( 8 * T_{adc\_ker\_ck} \)\( 6 * T_{adc\_ker\_ck} \)
1001\( 10 * T_{adc\_ker\_ck} \)\( 10 * T_{adc\_ker\_ck} \)\( 8 * T_{adc\_ker\_ck} \)\( 6 * T_{adc\_ker\_ck} \)
1010\( 11 * T_{adc\_ker\_ck} \)\( 10 * T_{adc\_ker\_ck} \)\( 8 * T_{adc\_ker\_ck} \)\( 6 * T_{adc\_ker\_ck} \)
1011\( 12 * T_{adc\_ker\_ck} \)\( 10 * T_{adc\_ker\_ck} \)\( 8 * T_{adc\_ker\_ck} \)\( 6 * T_{adc\_ker\_ck} \)
others\( 12 * T_{adc\_ker\_ck} \)\( 10 * T_{adc\_ker\_ck} \)\( 8 * T_{adc\_ker\_ck} \)\( 6 * T_{adc\_ker\_ck} \)

21.8.3 ADCx common regular data register for dual mode (ADCx_CDR) (x = 12 or 345)

Address offset: 0x30C

Reset value: 0x0000 0000

One interface controls ADC1 and ADC2, while the other interface controls ADC3, ADC4 and ADC5.

31302928272625242322212019181716
RDATA_SLV[15:0]
rrrrrrrrrrrrrrrr
1514131211109876543210
RDATA_MST[15:0]
rrrrrrrrrrrrrrrr

Bits 31:16 RDATA_SLV[15:0] : Regular data of the slave ADC

In dual mode, these bits contain the regular data of the slave ADC. Refer to Section 21.4.30: Dual ADC modes .

The data alignment is applied as described in Section : Data register, data alignment and offset (ADC_DR, OFFSETy, OFFSETy_CH, ALIGN)

Bits 15:0 RDATA_MST[15:0] : Regular data of the master ADC.

In dual mode, these bits contain the regular data of the master ADC. Refer to Section 21.4.30: Dual ADC modes .

The data alignment is applied as described in Section : Data register, data alignment and offset (ADC_DR, OFFSETy, OFFSETy_CH, ALIGN)

In MDMA = 11 mode, bits 15:8 contains SLV_ADC_DR[7:0], bits 7:0 contains MST_ADC_DR[7:0].

21.9 ADC register map

The following table summarizes the ADC registers.

Table 180. ADC global register map

OffsetRegister
0x000 - 0x0FCMaster ADC1/ADC3
0x100 - 0x1FCSlave ADC2/ADC4
0x200 - 0x2FCReserved/single ADC5
0x300 - 0x30CMaster and slave ADCs common registers

Table 181. ADC register map and reset values for each ADC (offset = 0x000 for master ADC, 0x100 for slave ADC)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x00ADC_ISRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.JQOVFAWD3AWD2AWD1JEOSJEOCOVREOSEOCEOSMPADRDY
Reset value00000000000
0x04ADC_IERRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.JQOVFIEAWD3IEAWD2IEAWD1IEJEOSIEJEOCIEOVRIEEOSIEEOCIEEOSMPIEADRDYIE
Reset value00000000000
0x08ADC_CRADCALADCALDIFDEEPPWDADVREGENRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.JADSTPADSTPJADSTARTADSTARTADDISADEN
Reset value0010000000
0x0CADC_CFGRJQDISRes.AWD1CH[4:0]JAUTOJAWD1ENAWD1ENAWD1SGLJQMJDISCENDISCNUM [2:0]DISCENALIGNAUTDLYCONTOVRMODEXTEN[1:0]EXTSEL[4:0]RES [1:0]Res.DMACFGDMAEN
Reset value1000000000000000000000000000000
0x10ADC_CFGR2Res.Res.Res.Res.SMPTRIGBULBSWTRIGRes.Res.Res.Res.Res.Res.Res.Res.GCOMPRes.Res.Res.Res.Res.ROVSVMTROVSOVSS[3:0]OVSR [2:0]JOVSEROVSE
Reset value000000000000000
0x14ADC_SMPR1SMPPLUSRes.SMP9 [2:0]SMP8 [2:0]SMP7 [2:0]SMP6 [2:0]SMP5 [2:0]SMP4 [2:0]SMP3 [2:0]SMP2 [2:0]SMP1 [2:0]SMP0 [2:0]
Reset value000000000000000000000000000000
0x18ADC_SMPR2Res.Res.Res.Res.Res.SMP18 [2:0]SMP17 [2:0]SMP16 [2:0]SMP15 [2:0]SMP14 [2:0]SMP13 [2:0]SMP12 [2:0]SMP11 [2:0]SMP10 [2:0]
Reset value00000000000000000000000000
0x1CReservedRes.
0x20ADC_TR1Res.Res.Res.Res.HT1[11:0]AWDFILT [2:0]LT1[11:0]
Reset value111111111111000000000000
0x24ADC_TR2Res.Res.Res.Res.Res.Res.Res.Res.HT2[7:0]Res.Res.Res.Res.Res.Res.Res.Res.LT2[7:0]
Reset value1111111100000000
0x28ADC_TR3Res.Res.Res.Res.Res.Res.Res.Res.HT3[7:0]Res.Res.Res.Res.Res.Res.Res.Res.LT3[7:0]
Reset value1111111100000000
0x2CReservedRes.
0x30ADC_SQR1Res.Res.Res.SQ4[4:0]Res.SQ3[4:0]Res.SQ2[4:0]Res.SQ1[4:0]Res.L[3:0]
Reset value000000000000000000000000
0x34ADC_SQR2Res.Res.Res.SQ9[4:0]Res.SQ8[4:0]Res.SQ7[4:0]Res.SQ6[4:0]Res.SQ5[4:0]
Reset value0000000000000000000000000
0x38ADC_SQR3Res.Res.Res.SQ14[4:0]Res.SQ13[4:0]Res.SQ12[4:0]Res.SQ11[4:0]Res.SQ10[4:0]
Reset value0000000000000000000000000
0x3CADC_SQR4Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SQ16[4:0]Res.SQ15[4:0]
Reset value0000000000
0x40ADC_DRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.regular RDATA[15:0]
Reset value0000000000000000

Table 181. ADC register map and reset values for each ADC (offset = 0x000 for master ADC, 0x100 for slave ADC) (continued)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x44-
0x48
ReservedRes.
0x4CADC_JSQRJSQ4[4:0]Res.JSQ3[4:0]Res.JSQ2[4:0]Res.JSQ1[4:0]JEXTEN[1:0]JEXTSEL [4:0]JL[1:0]
Reset value00000000000000000000000000000
0x50-
0x5C
ReservedRes.
0x60ADC_OFR1OFFSET1_ENOFFSET1_CH[4:0]SATENOFFSETPOSRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET1[11:0]
Reset value00000000000000000000
0x64ADC_OFR2OFFSET2_ENOFFSET2_CH[4:0]SATENOFFSETPOSRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET2[11:0]
Reset value00000000000000000000
0x68ADC_OFR3OFFSET3_ENOFFSET3_CH[4:0]SATENOFFSETPOSRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET3[11:0]
Reset value00000000000000000000
0x6CADC_OFR4OFFSET4_ENOFFSET4_CH[4:0]SATENOFFSETPOSRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET4[11:0]
Reset value00000000000000000000
0x70-
0x7C
ReservedRes.
0x80ADC_JDR1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.JDATA1[15:0]
Reset value0000000000000000
0x84ADC_JDR2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.JDATA2[15:0]
Reset value0000000000000000
0x88ADC_JDR3Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.JDATA3[15:0]
Reset value0000000000000000
0x8CADC_JDR4Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.JDATA4[15:0]
Reset value0000000000000000
0x8C-
0x9C
ReservedRes.
0xA0ADC_AWD2CRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.AWD2CH[18:0]
Reset value0000000000000000000
0xA4ADC_AWD3CRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.AWD3CH[18:0]
Reset value0000000000000000000
0xA8-
0xAC
ReservedRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.

Table 181. ADC register map and reset values for each ADC (offset = 0x000 for master ADC, 0x100 for slave ADC) (continued)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0xB0ADC_DIFSELDIFSEL[18:0]
Reset value00000000000000000000000000000000
0xB4ADC_CALFACTCALFACT_D[6:0]CALFACT_S[6:0]
Reset value0000000000000000000000000000000
0xC0ADC_GCOMPGCOMP[13:0]
Reset value0000000000000000000000000000000

Table 182. ADC register map and reset values (master and slave ADC common registers) offset = 0x300

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x00ADCx_CSRslave ADC2master ADC1
Reset value0000000000000000000000000000000
0x04ReservedRes.
0x08ADCx_CCRRes.Res.Res.Res.Res.Res.Res.VBATSELVSENSESELVREFENPRESC[3:0]DUAL[4:0]
Reset value0000000000000000000000000000000
0x0CADCx_CDRRDATA_SLV[15:0]RDATA_MST[15:0]
Reset value0000000000000000000000000000000

Refer to Section 2.2 on page 82 for the register boundary addresses.