26. Analog-to-digital converters (ADC1/2)

26.1 ADC introduction

This section describes the implementation of up to 2 ADCs:

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

Each ADC has up to 20 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 improving analog performances 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.

26.2 ADC main features

Figure 193 shows the block diagram of one ADC.

26.3 ADC implementation

Table 254. ADC features
ADC modes/featuresADC1ADC2
Resolution12 bit
Maximum sampling speed5 Msps
(12-bit resolution)
Dual mode operationX
Hardware offset calibrationX
Hardware linearity calibration-
Single-end inputX
Differential inputX
Injected channel conversionX
Oversamplingup to x256
Data register16 bits
Data register FIFO depth3 stages
DMA supportX
Parallel data output to ADF-
Offset compensationX
Gain compensation-
Number of analog watchdog3
Option registerX

26.4 ADC functional description

26.4.1 ADC block diagram

Figure 193 shows the ADC block diagram and Table 255 gives the ADC pin description.

Figure 193. ADC block diagram

ADC block diagram showing internal components like SAR ADC, Bias and Ref, AHB interface, and various triggers (SW, EXT, JEXT).

The block diagram illustrates the internal architecture of the ADC. At the center is the SAR ADC block, which receives analog input from Input selection & scan control and produces CONVERTED DATA . The Bias and Ref block provides reference voltages and calibration. The REG block handles the ADVREGEN signal. The AHB interface connects to the ADC via signals like READY , EOSMP , EOC , EOS , OVR , JEOS , JQOVF , and AWDx . It also connects to adc_it and adc_dma lines. The Start & Stop Control block manages the conversion process with SWTRIG , BULB , SMPTRIG , SMPPLUS , JAUTO , JL[1:0] , JSQx[4:0] , L[3:0] , SQx[4:0] , CONT , and DIFSELI signals. External triggers are handled by EXTEN[1:0] and JEXTEN[1:0] blocks, which receive inputs from adc_ext0_trg through adc_ext31_trg and adc_jext0_trg through adc_jext31_trg . The Analog watchdog 1,2,3 block monitors the AWD1 , AWD2 , and AWD3 signals. Various configuration registers like ADCAL , ADCALDIF , CALFACT_D/S[6:0] , SMPx[2:0] , DISCEN , DISCNUM[2:0] , JDISCEN , JDISCNUM[2:0] , JQDIS , AWD1EN , JAWD1EN , AWD1SGL , AWD1CH[4:0] , LT1[11:0] , HT1[11:0] , AWDFILT[2:0] , AWD2CH[18:0] , LT2[7:0] , HT2[7:0] , AWD3CH[18:0] , LT3[7:0] , and HT3[7:0] are shown. The diagram also includes power supply pins VREF+ and VDDA , and clock pins adc_ker_ck_input and adc_hclk .

ADC block diagram showing internal components like SAR ADC, Bias and Ref, AHB interface, and various triggers (SW, EXT, JEXT).

MSV66875V3

26.4.2 ADC pins and internal signals

Table 255. ADC input/output pins

Pin nameSignal typeDescription
VDDAInput, analog supplyAnalog power supply and positive reference voltage for the ADC
VSSAInput, analog supply groundGround for analog power supply, equal to V SS .
VREF+Input, analog reference positiveThe higher/positive reference voltage for the ADC.
VREF-Input, analog reference negativeThe lower/negative reference voltage for the ADC. V REF- is internally connected to V SSA
ADC1/2_INNi/INPiNegative/positive external analog input signals20 negative/positive external analog input channels (refer to Section 26.4.4: ADC connectivity for details)

Table 256. ADC internal input/output signals

Internal signal nameSignal typeDescription
V INPiPositive analog input channelsPositive internal analog input channels connected either to ADC1/2_INPi external channels or to internal channels.
V INNiNegative analog input channelsNegative internal analog input channels connected either to ADC1/2_INNi external channels or to internal channels
adc_ext_trgiInputsADC external trigger inputs for regular conversions. These inputs are shared between the ADC master and the ADC slave.
adc_jext_trgiInputsADC external trigger inputs for the injected conversions. These inputs are shared between the ADC master and the ADC slave.
adc_awdxOutputInternal analog watchdog output signal connected to on-chip timers. (x = Analog watchdog number 1,2,3)
adc_ker_ck_inputInputADC kernel clock
adc_hclkInputADC peripheral clock
adc_itOutputADC interrupt
adc_dmaOutputADC DMA request

Table 257. ADC interconnection

Signal nameSource/destination
ADC1 V INP [16]V SENSE (internal temperature sensor output voltage).
ADC1 V INP [17]V REFINT (output voltage from internal reference voltage).
ADC2 V INP [16]V BAT /4 (VBAT pin input voltage divided by 4).
ADC2 V INP [17]V DDCORE (internal digital core voltage).
adc_ext_trg0tim1_oc1

Table 257. ADC interconnection (continued)

Signal nameSource/destination
adc_ext_trg1tim1_oc2
adc_ext_trg2tim1_oc3
adc_ext_trg3tim2_oc2
adc_ext_trg4tim3_trgo
adc_ext_trg5tim4_oc4
adc_ext_trg6exti11
adc_ext_trg7tim8_trgo
adc_ext_trg8tim8_trgo2
adc_ext_trg9tim1_trgo
adc_ext_trg10tim1_trgo2
adc_ext_trg11tim2_trgo
adc_ext_trg12tim4_trgo
adc_ext_trg13tim6_trgo
adc_ext_trg14tim15_trgo
adc_ext_trg15tim3_oc4
adc_ext_trg16exti15
adc_ext_trg17reserved
adc_ext_trg18lptim1_ch1
adc_ext_trg19lptim2_ch1
adc_ext_trg20reserved
adc_ext_trg21reserved
adc_ext_trg22reserved
adc_ext_trg23reserved
adc_ext_trg24reserved
adc_ext_trg25reserved
adc_ext_trg26reserved
adc_ext_trg27reserved
adc_ext_trg28reserved
adc_ext_trg29reserved
adc_ext_trg30reserved
adc_ext_trg31reserved
adc_jext_trg0tim1_trgo
adc_jext_trg1tim1_oc4
adc_jext_trg2tim2_trgo
adc_jext_trg3tim2_oc1

Table 257. ADC interconnection (continued)

Signal nameSource/destination
adc_jext_trg4tim3_oc4
adc_jext_trg5tim4_trgo
adc_jext_trg6exti15
adc_jext_trg7tim8_oc4
adc_jext_trg8tim1_trgo2
adc_jext_trg9tim8_trgo
adc_jext_trg10tim8_trgo2
adc_jext_trg11tim3_oc3
adc_jext_trg12tim3_trgo
adc_jext_trg13tim3_oc1
adc_jext_trg14tim6_trgo
adc_jext_trg15tim15_trgo
adc_jext_trg16reserved
adc_jext_trg17reserved
adc_jext_trg18lptim1_ch1
adc_jext_trg19lptim2_ch1
adc_jext_trg20reserved
adc_jext_trg21reserved
adc_jext_trg22reserved
adc_jext_trg23reserved
adc_jext_trg24reserved
adc_jext_trg25reserved
adc_jext_trg26reserved
adc_jext_trg27reserved
adc_jext_trg28reserved
adc_jext_trg29reserved
adc_jext_trg30reserved
adc_jext_trg31reserved

26.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 ADC input clock can be selected between two different clock sources (see Figure 194: ADC clock scheme ):

  1. 1. The ADC clock can be a specific clock source (adc_ker_ck_input), independent and asynchronous with the AHB clock.

Refer to section Reset and clock control (RCC) for more information on how to generate the ADC dedicated clock. To select this scheme, CKMODE[1:0] bits of ADC_CCR register must be set to 00.

  1. 2. The ADC clock can be derived from the AHB clock interface divided by a programmable factor of 1, 2 or 4. To select this scheme, CKMODE[1:0] bits of ADC_CCR must be different from 00. The programmable divider factor can be configured through CKMODE[1:0] bits of ADC_CCR.

The prescaling factor of 1 (CKMODE[1:0] = 01) can be used only if the AHB prescaler is set to 1 (HPRE[3:0] = 0xxx in the RCC_CFGR register).

Option 1 has the advantage of achieving 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 ADC_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 is added by the resynchronizations between the two clock domains).

The clock is configured through CKMODE[1:0] bits must be compliant with the operating frequency specified in the device datasheet.

Figure 194. ADC clock scheme

Figure 194. ADC clock scheme diagram showing the clock distribution from the RCC to the ADC1 and ADC2 blocks. The RCC provides adc_hclk and adc_ker_ck_input. The ADC1 and ADC2 block contains an AHB interface, a prescaler (/1 or /2 or /4), and a clock source selector (Others). The prescaler is controlled by Bits CKMODE[1:0] of ADCx_CCR. The clock source selector is controlled by Bits PRESK[3:0] of ADCx_CCR and Bits CKMODE[1:0] of ADCx_CCR. The output of the selector is adc_ker_ck, which is connected to Analog ADC1 (master) and Analog ADC2 (slave).

The diagram illustrates the clock scheme for ADC1 and ADC2. On the left, the RCC (Reset and clock controller) provides two clock signals: adc_hclk and adc_ker_ck_input . The adc_hclk signal is connected to the AHB interface within the ADC1 and ADC2 block. The adc_ker_ck_input signal is connected to a clock source selector. The ADC1 and ADC2 block contains an AHB interface, a prescaler (labeled /1 or /2 or /4 ), and a clock source selector (labeled Others ). The prescaler is controlled by Bits CKMODE[1:0] of ADCx_CCR . The clock source selector is controlled by Bits PRESK[3:0] of ADCx_CCR and Bits CKMODE[1:0] of ADCx_CCR . The output of the selector is adc_ker_ck , which is connected to Analog ADC1 (master) and Analog ADC2 (slave). The diagram also shows a list of possible clock sources for the prescaler: /1, 2, 4, 6, 8, 10, 12, 16, 32, 64, 128, 256 . The reference MSv63822V3 is noted at the bottom right.

Figure 194. ADC clock scheme diagram showing the clock distribution from the RCC to the ADC1 and ADC2 blocks. The RCC provides adc_hclk and adc_ker_ck_input. The ADC1 and ADC2 block contains an AHB interface, a prescaler (/1 or /2 or /4), and a clock source selector (Others). The prescaler is controlled by Bits CKMODE[1:0] of ADCx_CCR. The clock source selector is controlled by Bits PRESK[3:0] of ADCx_CCR and Bits CKMODE[1:0] of ADCx_CCR. The output of the selector is adc_ker_ck, which is connected to Analog ADC1 (master) and Analog ADC2 (slave).

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:

Constraints between ADC clocks

When several ADC interfaces are used simultaneously, it is mandatory to use the same clock source from the RCC block without prescaler ratio for all ADC interfaces.

26.4.4 ADC connectivity

ADC inputs are connected to the external channels as well as internal sources as described below.

Figure 195. ADC1 connectivity

Schematic diagram of ADC1 connectivity showing 20 channels (0-19) with external and internal connections to a SAR ADC1 block.

The diagram illustrates the connectivity of the ADC1 block. It features 20 input channels, each with an external input (INP) and an internal negative input (INN). The channels are categorized into 'Fast channel' and 'Slow channel' groups. The internal negative inputs are connected to various internal sources: VSSA, VSENSE, and VREFINT. The SAR ADC1 block is shown on the right, with its positive input (V_INP) connected to the external INP lines and its negative input (V_INN) connected to the internal INN lines. Reference voltages V_REF+ and V_REF- are also shown.

ChannelExternal InputInternal Negative InputInternal SourceChannel Type
0ADC12_INP0ADC12_INN1VSSAFast channel
1ADC12_INP1VSSAFast channel
2ADC1_INP2VSSAFast channel
3ADC12_INP3VSSAFast channel
4ADC12_INP4VSSAFast channel
5ADC12_INP5VSSAFast channel
6ADC1_INP6ADC1_INN2VSSASlow channel
7ADC12_INP7ADC12_INN3VSSASlow channel
8ADC12_INP8ADC12_INN4VSSASlow channel
9ADC12_INP9ADC12_INN5VSSASlow channel
10ADC12_INP10VSSASlow channel
11ADC12_INP11ADC12_INN10VSSASlow channel
12ADC12_INP12ADC12_INN11VSSASlow channel
13ADC12_INP13ADC12_INN12VSSASlow channel
14ADC12_INP14VSSASlow channel
15ADC12_INP15VSSASlow channel
16VSENSESlow channel
17VREFINTSlow channel
18ADC12_INP18VSSASlow channel
19ADC12_INP19ADC12_INN18VSSASlow channel
Schematic diagram of ADC1 connectivity showing 20 channels (0-19) with external and internal connections to a SAR ADC1 block.

MSV66876V1

Figure 196. ADC2 connectivity

Schematic diagram of ADC2 connectivity showing 20 channels (0-19) with positive (INP) and negative (INN) inputs. Channels 0-5 are 'Fast channel', and 6-19 are 'Slow channel'. Inputs are connected to various internal signals like VSSA, VBAT/4, and VDDCORE. A SAR ADC2 block is shown on the right with VREF+, VREF-, VINP, and VINN inputs.

The diagram illustrates the internal connectivity of the ADC2 module. It features 20 differential input channels, each consisting of a positive input (INP) and a negative input (INN). The channels are categorized into 'Fast channel' (0-5) and 'Slow channel' (6-19). The negative inputs are connected to various internal voltage sources: VSSA (channels 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19), VBAT/4 (channels 16, 17), and VDDCORE (channels 18, 19). The positive inputs are connected to the VINP input of the SAR ADC2 block. The negative inputs are connected to the VINN input of the SAR ADC2 block. The SAR ADC2 block also has VREF+ and VREF- inputs. The diagram is labeled MSv66877V1.

ADC2 ChannelINP InputINN InputINN ConnectionChannel Type
0ADC12_INP0ADC12_INN1VSSAFast channel
1ADC12_INP1VSSAFast channel
2ADC2_INP2VSSAFast channel
3ADC12_INP3VSSAFast channel
4ADC12_INP4VSSAFast channel
5ADC12_INP5VSSAFast channel
6ADC2_INP6ADC2_INN2VSSASlow channel
7ADC12_INP7ADC12_INN3VSSASlow channel
8ADC12_INP8ADC12_INN4VSSASlow channel
9ADC12_INP9ADC12_INN5VSSASlow channel
10ADC12_INP10VSSASlow channel
11ADC12_INP11ADC12_INN10VSSASlow channel
12ADC12_INP12ADC12_INN11VSSASlow channel
13ADC12_INP13ADC12_INN12VSSASlow channel
14ADC12_INP14VSSASlow channel
15ADC12_INP15VSSASlow channel
16VSSA, VBAT/4Slow channel
17VSSA, VDDCORESlow channel
18ADC12_INP18VSSASlow channel
19ADC12_INP19ADC12_INN18VSSASlow channel
Schematic diagram of ADC2 connectivity showing 20 channels (0-19) with positive (INP) and negative (INN) inputs. Channels 0-5 are 'Fast channel', and 6-19 are 'Slow channel'. Inputs are connected to various internal signals like VSSA, VBAT/4, and VDDCORE. A SAR ADC2 block is shown on the right with VREF+, VREF-, VINP, and VINN inputs.

26.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.

26.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, it is first needed to exit Deep-power-down mode by setting bit DEEPPWD = 0.

Then, it is mandatory to enable the ADC internal voltage regulator by setting the bit ADVREGEN = 1 into ADC_CR register. The software must wait for the startup time of the ADC voltage regulator ( \( T_{ADCVREG\_STUP} \) ) before launching a calibration or enabling the ADC. This delay must be implemented by software.

For the startup time of the ADC voltage regulator, refer to device datasheet for \( T_{ADCVREG\_STUP} \) parameter.

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 26.4.8: Calibration (ADCAL, ADCALDIF, ADC_CALFACT) ).

26.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 external voltage \( 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 external voltage \( V_{INP[i]} \) (positive input) and \( V_{INN[i]} \) (negative input).

The output data for the differential mode is an unsigned data. When \( V_{INP[i]} \) equals \( V_{REF-} \) , \( V_{INN[i]} \) equals \( V_{REF+} \) and the output data is 0x000 (12-bit resolution mode). When \( V_{INP[i]} \) equals \( V_{REF+} \) , \( V_{INN[i]} \) equals \( V_{REF-} \) and the output data is 0xFFF.

\[ \text{Converted value} = \frac{\text{ADC\_Full\_Scale}}{2} \times \left[ 1 + \frac{V_{INP} - V_{INN}}{V_{REF+}} \right] \]

When ADC is configured as differential mode, both inputs should be biased at \( (V_{REF+})/2 \) voltage.

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

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

For a complete description of how the input channels are connected for each ADC, refer to Section 26.4.4: ADC 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: this can make the channel on the other ADC unusable. Only exception is interleaved mode for ADC master and the slave.

26.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 = 1.
  5. 5. Wait until ADCAL = 0.
  6. 6. The calibration factor can be read from ADC_CALFACT register.

Figure 197. ADC calibration

Timing diagram for ADC calibration showing signal transitions for ADCALDIF, ADCAL, ADC State, and CALFACT_x[6:0] over time. The diagram shows the sequence of events: setting ADCALDIF, asserting ADCAL, the ADC state changing from OFF to Startup to Calibrate, and the CALFACT_x[6:0] register being updated. The calibration time t_CAB is indicated. Legend: by S/W (software), by H/W (hardware).

The figure is a timing diagram illustrating the ADC calibration process. It consists of four horizontal signal lines and a state transition diagram.

Legend for signal transitions:

Indicative timings: The diagram includes a label \( t_{CAB} \) for the calibration duration.

MSV30263V2

Timing diagram for ADC calibration showing signal transitions for ADCALDIF, ADCAL, ADC State, and CALFACT_x[6:0] over time. The diagram shows the sequence of events: setting ADCALDIF, asserting ADCAL, the ADC state changing from OFF to Startup to Calibrate, and the CALFACT_x[6:0] register being updated. The calibration time t_CAB is indicated. Legend: by S/W (software), by H/W (hardware).

Software procedure to reinject 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 198. 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 during the conversion. The start conversion signal is triggered by software (s/w) and hardware (h/w). The WRITE ADC_CALFACT signal is asserted by software (s/w) to update the CALFACT_S register. The CALFACT_S register is updated from F1 to F2. A legend indicates that 'by s/w' means software-initiated and 'by h/w' means hardware-initiated.

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

Vertical dashed lines indicate the sequence of events: first, the WRITE ADC_CALFACT signal is asserted; second, the start conversion signal is triggered; third, the internal calibration factor updates to 'F2'.

Legend:
by s/w (software-initiated)
by h/w (hardware-initiated)

MSV30529V2

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 during the conversion. The start conversion signal is triggered by software (s/w) and hardware (h/w). The WRITE ADC_CALFACT signal is asserted by software (s/w) to update the CALFACT_S register. The CALFACT_S register is updated from F1 to F2. A legend indicates that 'by s/w' means software-initiated and 'by h/w' means hardware-initiated.

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 199. Mixing single-ended and differential channels

Timing diagram showing ADC state transitions between RDY and CONV for four channels. CH1 and CH4 are single-ended; CH2 and CH3 are differential. Internal calibration factor switches between F2 for single-ended and F3 for differential. CALFACT_S is fixed at F2 and CALFACT_D is fixed at F3.

The diagram illustrates the timing and calibration factors for a sequence of ADC conversions. A 'Trigger event' initiates each conversion. The ADC state alternates between 'RDY' (Ready) and 'CONV' (Conversion) for four 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 'Internal calibration factor[6:0]' is F2 for single-ended channels (CH1, CH4) and F3 for differential channels (CH2, CH3). The static registers 'CALFACT_S[6:0]' and 'CALFACT_D[6:0]' hold the values F2 and F3 respectively. The diagram is labeled MSV30530V2.

Timing diagram showing ADC state transitions between RDY and CONV for four channels. CH1 and CH4 are single-ended; CH2 and CH3 are differential. Internal calibration factor switches between F2 for single-ended and F3 for differential. CALFACT_S is fixed at F2 and CALFACT_D is fixed at F3.

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

First of all, follow the procedure explained in Section 26.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 200 . Two control bits enable or disable the ADC:

Regular conversion can then start either by setting ADSTART = 1 (refer to Section 26.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 = 1.
  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 = 1.
  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 200. Enabling / disabling the ADC

Timing diagram showing the sequence of events for enabling and disabling the ADC. The diagram plots four signals over time: ADEN, ADRDY, ADDIS, and ADC state. 
  - ADEN (Analog-to-Digital Converter Enable): A signal that goes high (enabling) and then later goes low (disabling). 
  - ADRDY (ADC Ready): A signal that goes high when ADEN goes high, after a stabilization time tSTAB. It goes low when ADEN goes low. 
  - ADDIS (ADC Disable): A signal that goes high to initiate a disable sequence. It is shown going high while the ADC is in the 'RDY' state. 
  - ADC state: A sequence of states: OFF, Startup, RDY, Converting CH, RDY, REQ-OFF, OFF. 
  - Transitions: 
    - Enabling: ADEN goes high (labeled 'by S/W'), tSTAB passes, ADRDY goes high, ADC state goes from OFF to Startup to RDY. 
    - Disabling: ADDIS goes high, ADC state goes from RDY to REQ-OFF to OFF. ADEN goes low (labeled 'by H/W'), and ADRDY goes low.
Timing diagram showing the sequence of events for enabling and disabling the ADC. The diagram plots four signals over time: ADEN, ADRDY, ADDIS, and ADC state. - ADEN (Analog-to-Digital Converter Enable): A signal that goes high (enabling) and then later goes low (disabling). - ADRDY (ADC Ready): A signal that goes high when ADEN goes high, after a stabilization time tSTAB. It goes low when ADEN goes low. - ADDIS (ADC Disable): A signal that goes high to initiate a disable sequence. It is shown going high while the ADC is in the 'RDY' state. - ADC state: A sequence of states: OFF, Startup, RDY, Converting CH, RDY, REQ-OFF, OFF. - Transitions: - Enabling: ADEN goes high (labeled 'by S/W'), tSTAB passes, ADRDY goes high, ADC state goes from OFF to Startup to RDY. - Disabling: ADDIS goes high, ADC state goes from RDY to REQ-OFF to OFF. ADEN goes low (labeled 'by H/W'), and ADRDY goes low.

MSv62472V1

26.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). Refer to Section 26.6.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 = 0 as well as all the bits of ADC_CR register).

26.4.11 Channel selection (ADC_SQRY, ADC_JSQR)

The ADC features up to 20 multiplexed channels per ADC, out of which:

To convert one of the internal analog channels, the corresponding analog sources must first be enabled by programming bits VREFEN, VBATEN or TSEN in the ADC_CCR registers.

Refer to Table ADC interconnection in Section 26.4.2: ADC pins and internal signals for the connection of the above internal analog inputs to external ADC pins or internal signals.

The conversions can be organized 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: ADC1/2_INP/INN3, ADC1/2_INP/INN8, ADC1/2_INP/INN2, ADC1/2_INP/INN2, ADC1/2_INP/INN0, ADC1/2_INP/INN2, ADC1/2_INP/INN2, ADC1/2_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 26.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 to 1 (injected conversions ongoing) only when the context queue is enabled (JQDIS = 0 in ADC_CFGR register). Refer to Section 26.4.21: Queue of context for injected conversions

26.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_SMPR2 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).

Note: Depending on the ADC conversion mode, the real sampling time can vary compared to the SMP value programmed above, while the equivalent total conversion time ( \( T_{\text{CONV}} \) ) does not change:

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 201. Bulb mode timing diagram

Timing diagram for Bulb mode showing Normal (discontinuous) mode and BULB (continuous) mode states and trigger signals.

The figure is a timing diagram titled 'Figure 201. Bulb mode timing diagram'. It is divided into two horizontal sections. The top section, 'Normal (discontinuous) mode', shows a sequence of ADC states: idle, sample, conversion, idle, sample, conversion, idle. Below this, the 'Trigger' signal is shown with rising edges at the start of each 'sample' state. The bottom section, 'BULB (continuous) mode', shows a sequence of ADC states: idle, sample, conversion, sample, conversion, sample. Below this, the 'Trigger' signal is shown with a rising edge at the start of the first 'sample' state and subsequent rising edges at the start of each 'sample' state. A double-headed arrow between the start of the second 'sample' state and the start of the first 'conversion' state is labeled 'Sampling time programmed in SMP bits'. The diagram is labeled 'MSV46157V2' in the bottom right corner.

Timing diagram for Bulb mode showing Normal (discontinuous) mode and BULB (continuous) mode states and trigger signals.

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.

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.

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

by enabling an internal voltage booster through BOOSTE bit or by selecting a \( V_{DD} \) booster voltage (if \( V_{DD} > 2.7\text{ V} \) ) through the ADV_READY bit of the PWR_PMCR register.

SMPPLUS control bit

The SMPPLUS bit can be used to change the sampling time from 2.5 ADC clock cycles to 3.5 ADC clock cycles.

26.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.

26.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).

26.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.

26.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{ } |_{min} + 12.5 \text{ } |_{12bit}] \times T_{ADC\_CLK} \]
\[ T_{CONV} = T_{SMPL} + T_{SAR} = 83.33 \text{ ns } |_{min} + 416.67 \text{ ns } |_{12bit} = 500.0 \text{ ns (for } F_{ADC\_CLK} = 30 \text{ MHz)} \]

Figure 202. Analog-to-digital conversion time

Timing diagram for ADC conversion showing signals: ADC state (RDY, Sampling Ch(N), Converting Ch(N), Sampling Ch(N+1)), Analog channel (Ch(N), Ch(N+1)), Internal S/H (Sample AIN(N), Hold AIN(N), Sample AIN(N+1)), ADSTART (Set by SW), EOSMP (Set by HW, Cleared by SW), EOC (Set by HW, Cleared by HW/SW), and ADC_DR (Data N-1, Data N). It illustrates the timing parameters tSMPL and tSAR.

MSV30532V2

Timing diagram for ADC conversion showing signals: ADC state (RDY, Sampling Ch(N), Converting Ch(N), Sampling Ch(N+1)), Analog channel (Ch(N), Ch(N+1)), Internal S/H (Sample AIN(N), Hold AIN(N), Sample AIN(N+1)), ADSTART (Set by SW), EOSMP (Set by HW, Cleared by SW), EOC (Set by HW, Cleared by HW/SW), and ADC_DR (Data N-1, Data N). It illustrates the timing parameters tSMPL and tSAR.
  1. 1. \( T_{SMPL} \) depends on SMP[2:0].
  2. 2. \( T_{SAR} \) depends on RES[2:0].

26.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 203. Stopping ongoing regular conversions

Timing diagram showing the process of stopping ongoing regular conversions. The diagram illustrates the ADC state, JADSTART, ADSTART, ADSTP, and ADC_DR signals over time. The ADC state transitions from RDY to Sample Ch(N-1) to Convert Ch(N-1) to RDY, then to Sample Ch(N) to C to RDY. Triggers are shown for the start of conversions. The ADSTART signal is cleared by hardware at the start and end of the conversion sequence. The ADSTP signal is set by software during the second conversion sequence. The ADC_DR register contains Data N-2 and Data N-1.

The diagram illustrates the timing of signals during the stopping of ongoing regular conversions. The top row shows the ADC state: RDY, Sample Ch(N-1), Convert Ch(N-1), RDY, Sample Ch(N), C, RDY. Triggers are indicated for the start of the first and second conversion sequences. The JADSTART signal is shown as a single line. The ADSTART signal is cleared by hardware at the beginning and end of the conversion sequence. A note indicates that software is not allowed to configure regular conversions selection and triggers while conversions are ongoing. The ADSTP signal is set by software during the second conversion sequence and cleared by hardware. The ADC_DR register contains Data N-2 and Data N-1.

MSV30533V2

Timing diagram showing the process of stopping ongoing regular conversions. The diagram illustrates the ADC state, JADSTART, ADSTART, ADSTP, and ADC_DR signals over time. The ADC state transitions from RDY to Sample Ch(N-1) to Convert Ch(N-1) to RDY, then to Sample Ch(N) to C to RDY. Triggers are shown for the start of conversions. The ADSTART signal is cleared by hardware at the start and end of the conversion sequence. The ADSTP signal is set by software during the second conversion sequence. The ADC_DR register contains Data N-2 and Data N-1.

Figure 204. Stopping ongoing regular and injected conversions

Timing diagram showing the sequence of events for stopping ongoing regular and injected conversions. It tracks the ADC state (RDY, Sample, Convert), JADSTART, JADSTP, ADC_JDR, ADSTART, ADSTP, and ADC_DR signals over time. Injected conversions are stopped by setting JADSTP, and regular conversions are stopped by setting ADSTP. Both are cleared by hardware when the conversion is complete.

The diagram illustrates the timing for stopping ongoing conversions. The ADC state transitions between RDY, Sample, and Convert. Injected conversions (JADSTART) are stopped by setting JADSTP, and regular conversions (ADSTART) are stopped by setting ADSTP. Both are cleared by hardware when the conversion is complete. The ADC_DR register holds the data from the previous conversion (DATA N-2, DATA N-1).

Timing diagram showing the sequence of events for stopping ongoing regular and injected conversions. It tracks the ADC state (RDY, Sample, Convert), JADSTART, JADSTP, ADC_JDR, ADSTART, ADSTP, and ADC_DR signals over time. Injected conversions are stopped by setting JADSTP, and regular conversions are stopped by setting ADSTP. Both are cleared by hardware when the conversion is complete.

26.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 (such as 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 0b00, 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 258 provides the correspondence between the EXTEN[1:0] and JEXTEN[1:0] values and the trigger polarity.

Table 258. 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 259. 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 26.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 26.4.21: Queue of context for injected conversions on page 1057 .

Figure 205. Triggers shared between ADC master and slave

Diagram showing trigger connections between ADC MASTER and ADC SLAVE. The diagram illustrates how regular and injected sequencer triggers are shared between the master and slave ADC units. On the left, 'Regular sequencer triggers' (adc_ext_trg0 to adc_ext_trg31) are connected to the ADC MASTER's 'External regular trigger' input via an EXTSEL[3:0] multiplexer. 'Injected sequencer triggers' (adc_jext_trg0 to adc_jext_trg31) are connected to the ADC SLAVE's 'External injected trigger' input via a JEXTSEL[4:0] multiplexer. The diagram also shows connections to the ADC SLAVE's 'External regular trigger' and 'External injected trigger' inputs. The MSV46156V1 identifier is present in the bottom right corner.
Diagram showing trigger connections between ADC MASTER and ADC SLAVE. The diagram illustrates how regular and injected sequencer triggers are shared between the master and slave ADC units. On the left, 'Regular sequencer triggers' (adc_ext_trg0 to adc_ext_trg31) are connected to the ADC MASTER's 'External regular trigger' input via an EXTSEL[3:0] multiplexer. 'Injected sequencer triggers' (adc_jext_trg0 to adc_jext_trg31) are connected to the ADC SLAVE's 'External injected trigger' input via a JEXTSEL[4:0] multiplexer. The diagram also shows connections to the ADC SLAVE's 'External regular trigger' and 'External injected trigger' inputs. The MSV46156V1 identifier is present in the bottom right corner.

Refer to Table ADC interconnection in Section 26.4.2: ADC pins and internal signals for the list of all the external triggers that can be used for regular conversion.

26.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 reset and the injected channel sequence switches are launched (all the injected channels are converted once).
  3. 3. Then, the regular conversion of the regular group of channels is resumed from the last interrupted regular conversion.
  4. 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.

Figure 206 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 206. Injected conversion latency

Timing diagram for injected conversion latency. The diagram shows four signals over time: adc_ker_ck (a periodic clock signal), Injection event (a single pulse), Reset ADC (a pulse that goes high after the injection event), and SOC (Start of Conversion, a pulse that goes high after the Reset ADC pulse). A horizontal double-headed arrow labeled 'max. latency(1)' indicates the time interval between the rising edge of the Injection event and the rising edge of the SOC signal. Vertical dashed lines mark these two rising edges. The diagram is labeled MSV43771V1 in the bottom right corner.
Timing diagram for injected conversion latency. The diagram shows four signals over time: adc_ker_ck (a periodic clock signal), Injection event (a single pulse), Reset ADC (a pulse that goes high after the injection event), and SOC (Start of Conversion, a pulse that goes high after the Reset ADC pulse). A horizontal double-headed arrow labeled 'max. latency(1)' indicates the time interval between the rising edge of the Injection event and the rising edge of the SOC signal. Vertical dashed lines mark these two rising edges. The diagram is labeled MSV43771V1 in the bottom right corner.

1. The maximum latency value can be found in the electrical characteristics of the device datasheet.

26.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 4th trigger reconverts the channels 1, 2 and 3 in the 1st 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 4th trigger reconverts the 1st 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.

26.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 1 st 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

Figure 207 and Figure 208 show the behavior of the context Queue when changing the sequence or the triggers.

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

Timing diagram for Figure 207 showing sequence changes in the ADC_JSQR queue.

This timing diagram illustrates the behavior of the ADC_JSQR queue when the sequence context changes. The diagram shows four horizontal timelines:

MS30536V4

Timing diagram for Figure 207 showing sequence changes in the ADC_JSQR queue.
  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 208. Example of ADC_JSQR queue of context (trigger change)

Timing diagram for Figure 208 showing trigger changes in the ADC_JSQR queue.

This timing diagram illustrates the behavior of the ADC_JSQR queue when the trigger context changes. The diagram shows five horizontal timelines:

MS30537V4

Timing diagram for Figure 208 showing trigger changes in the ADC_JSQR queue.
  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 209 and Figure 210 show the behavior of the context Queue if an overflow occurs before or during a conversion.

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

Timing diagram for Figure 209 showing ADC_JSQR queue behavior with overflow before conversion. The diagram tracks signals: Write ADC_JSQR, ADC_JSQR queue, JQOVF, Trigger 1, Trigger 2, ADC J context, ADC state, and JEOS. It shows an overflow occurring when P3 is written while P1 and P2 are still in the queue, resulting in P3 being ignored. Conversion1 and Conversion2 occur based on Trigger 1 and Trigger 2 respectively.

The diagram illustrates the state of the ADC context queue and associated signals over time.
1. Write ADC_JSQR : Shows pulses for parameters P1, P2, P3, and P4.
2. ADC_JSQR queue : Starts EMPTY. P1 is added, then P2. When P3 is written, the queue is full (P1, P2), causing an overflow. P3 is ignored. Later, P2 is removed, and P4 is added, resulting in P2 and P4 in the queue.
3. JQOVF : Flag set when P3 is written (overflow) and cleared by software (SW) when P2 is removed.
4. Trigger 1 and Trigger 2 : Hardware triggers for conversion sequences.
5. ADC J context : Returned by reading ADC_JSQR. It shows EMPTY, then P1, then P2 (after P3 is ignored and P1 is removed).
6. ADC state : RDY -> Conversion1 (triggered by Trigger 1) -> Conversion2 (triggered by Trigger 2) -> RDY -> Conversion1 (triggered by Trigger 1 again).
7. JEOS : End of conversion signal pulses during Conversion1 and Conversion2.
Reference: MS30538V4

Timing diagram for Figure 209 showing ADC_JSQR queue behavior with overflow before conversion. The diagram tracks signals: Write ADC_JSQR, ADC_JSQR queue, JQOVF, Trigger 1, Trigger 2, ADC J context, ADC state, and JEOS. It shows an overflow occurring when P3 is written while P1 and P2 are still in the queue, resulting in P3 being ignored. Conversion1 and Conversion2 occur based on Trigger 1 and Trigger 2 respectively.
  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 210. Example of ADC_JSQR queue of context with overflow during conversion

Timing diagram for Figure 210 showing ADC_JSQR queue behavior with overflow during conversion. Similar to Figure 209, but the overflow for P3 occurs while Conversion1 (triggered by P1) is still ongoing. The queue management and context return remain the same as in Figure 209.

This diagram is similar to Figure 209 but with a key difference in timing.
1. Write ADC_JSQR : Pulses for P1, P2, P3, and P4.
2. ADC_JSQR queue : Same as Figure 209. P3 causes an overflow when P1 and P2 are present.
3. JQOVF : Set at P3 write, cleared by SW when P2 is removed.
4. ADC state : RDY -> Conversion1 (started by P1) -> Conversion2 (started by P2) -> RDY -> Conversion1 (started by P4). The overflow for P3 occurs while Conversion1 is still active.
5. JEOS : End of conversion pulses.
Reference: MS30539V4

Timing diagram for Figure 210 showing ADC_JSQR queue behavior with overflow during conversion. Similar to Figure 209, but the overflow for P3 occurs while Conversion1 (triggered by P1) is still ongoing. The queue management and context return remain the same as in Figure 209.
  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 211 and Figure 212 show the behavior of the context Queue when the Queue becomes empty in both cases JQM = 0 or 1.

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

Timing diagram for ADC_JSQR queue behavior when JQM=0. It shows five signal lines: Write ADC_JSQR, ADC_JSQR queue, Trigger 1, ADC J context (returned by reading ADC_JSQR), and ADC state. The diagram illustrates the sequence of writing P1, P2, and P3, and how the queue and ADC state respond to triggers. Key annotations include 'The queue is not empty and maintains P2 because JQM=0' and 'Queue not empty (P3 maintained)'.

MS30540V5

Timing diagram for ADC_JSQR queue behavior when JQM=0. It shows five signal lines: Write ADC_JSQR, ADC_JSQR queue, Trigger 1, ADC J context (returned by reading ADC_JSQR), and ADC state. The diagram illustrates the sequence of writing P1, P2, and P3, and how the queue and ADC state respond to triggers. Key annotations include 'The queue is not empty and maintains P2 because JQM=0' and 'Queue not empty (P3 maintained)'.
  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 212. Example of ADC_JSQR queue of context with empty queue (JQM = 1)

Timing diagram for Figure 212 showing ADC_JSQR queue behavior with JQM=1. The diagram illustrates the queue becoming empty and triggers being ignored when JQM=1.

The diagram shows the following signals and states over time:

MS30541V3

Timing diagram for Figure 212 showing ADC_JSQR queue behavior with JQM=1. The diagram illustrates the queue becoming empty and triggers being ignored when JQM=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 213. Flushing ADC_JSQR queue of context by setting JADSTP = 1 (JQM = 0) - JADSTP occurs during an ongoing conversion.

Timing diagram for Figure 213 showing the effect of setting JADSTP=1 during an ongoing conversion. The queue is flushed, and the last active context (P2) is lost.

The diagram shows the following signals and states over time:

MS30542V2

Timing diagram for Figure 213 showing the effect of setting JADSTP=1 during an ongoing conversion. The queue is flushed, and the last active context (P2) is lost.
  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 214. Flushing ADC_JSQR queue of context by setting JADSTP = 1 (JQM = 0) - JADSTP occurs during an ongoing conversion and a new trigger occurs

Timing diagram for Figure 214 showing the flushing of the ADC_JSQR queue when JADSTP is set during an ongoing conversion.

This timing diagram illustrates the behavior of the ADC when the JADSTP bit is set during an ongoing conversion. The diagram includes the following signals and states over time:

MS30543V2

Timing diagram for Figure 214 showing the flushing of the ADC_JSQR queue when JADSTP is set during an ongoing conversion.
  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 215. Flushing ADC_JSQR queue of context by setting JADSTP = 1 (JQM = 0) - JADSTP occurs outside an ongoing conversion

Timing diagram for Figure 215 showing the flushing of the ADC_JSQR queue when JADSTP is set outside an ongoing conversion.

This timing diagram illustrates the behavior of the ADC when the JADSTP bit is set outside an ongoing conversion. The diagram includes the following signals and states over time:

MS30544V3

Timing diagram for Figure 215 showing the flushing of the ADC_JSQR queue when JADSTP is set outside an ongoing conversion.
  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 216. Flushing ADC_JSQR queue of context by setting JADSTP = 1 (JQM = 1)

Timing diagram for Figure 216 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. When JADSTP is set by software, the queue is flushed and becomes empty, losing context P2. Subsequent context P3 is added when JADSTART is set. Hardware triggers cause conversions, but the second trigger while in the first conversion is ignored due to the flushed queue.

Figure 216 is a timing diagram illustrating the flushing of the ADC_JSQR queue when JADSTP = 1 (JQM = 1). The diagram shows the following signals and states over time:

Text annotation: "Queue is flushed and becomes empty (P2 is lost)".
Reference: MS30545V2

Timing diagram for Figure 216 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. When JADSTP is set by software, the queue is flushed and becomes empty, losing context P2. Subsequent context P3 is added when JADSTART is set. Hardware triggers cause conversions, but the second trigger while in the first conversion is ignored due to the flushed queue.
  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 217. Flushing ADC_JSQR queue of context by setting ADDIS = 1 (JQM = 0)

Timing diagram for Figure 217 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. When ADDIS is set by software, the queue is flushed but retains the last active context (P2). Subsequent context P1 is added. The ADC state changes to REQ-OFF and then OFF.

Figure 217 is a timing diagram illustrating the flushing of the ADC_JSQR queue when ADDIS = 1 (JQM = 0). The diagram shows the following signals and states over time:

Text annotation: "Queue is flushed and maintains the last active context (P2 which was not consumed is lost)".
Reference: MS30546V2

Timing diagram for Figure 217 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. When ADDIS is set by software, the queue is flushed but retains the last active context (P2). Subsequent context P1 is added. The ADC state changes to REQ-OFF and then 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

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

Timing diagram showing the flushing of 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 starts with P1 and P2, then becomes EMPTY. The ADDIS signal is set by software (S/W) and reset by hardware (H/W). The ADC J context starts with P1, then becomes EMPTY (0x00). The ADC state starts with RDY, then becomes REQ-OFF, and finally OFF. A note indicates that the queue is flushed and becomes empty when ADDIS is set, and the ADC_JSQR is read as 0x00.

Queue is flushed and becomes empty
(ADC_JSQR is read as 0x00)

ADC_JSQR queue: P1, P2 → EMPTY

ADDIS: Set by S/W → Reset by H/W

ADC J context (returned by reading ADC_JSQR): P1 → EMPTY (0x00)

ADC state: RDY → REQ-OFF → OFF

MS30547V4

Timing diagram showing the flushing of 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 starts with P1 and P2, then becomes EMPTY. The ADDIS signal is set by software (S/W) and reset by hardware (H/W). The ADC J context starts with P1, then becomes EMPTY (0x00). The ADC state starts with RDY, then becomes REQ-OFF, and finally OFF. A note indicates that the queue is flushed and becomes empty when ADDIS is set, and the ADC_JSQR is read as 0x00.
  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 not equal to 0 (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.

26.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 223 , Figure 224 , Figure 225 and Figure 226 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 260 .

Table 260. \( 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 cycles283.33 ns11 ADC clock cycles366.67 ns
66.5 ADC clock cycles216.67 ns9 ADC clock cycles300.0 ns

26.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.

26.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.

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

Figure 219. Single conversions of a sequence, software trigger

Timing diagram for single conversions of a sequence with software trigger. It shows four signal lines: ADSTART(1), EOC, EOS, and ADC state(2). ADSTART is a software trigger (SW) that goes high to start a sequence of four conversions (CH1, CH9, CH10, CH17) and then goes low. EOC pulses high after each conversion. EOS goes high after the last conversion (CH17) and low when ADSTART goes high again. ADC state shows RDY, CH1, CH9, CH10, CH17, RDY, CH1, CH9, CH10, CH17, RDY. ADC_DR shows data values D1, D9, D10, D17, D17, D1, D9, D10, D17. A legend indicates 'by SW' with a rising edge and 'by HW' with a falling edge. Reference MS30549V1.
Timing diagram for single conversions of a sequence with software trigger. It shows four signal lines: ADSTART(1), EOC, EOS, and ADC state(2). ADSTART is a software trigger (SW) that goes high to start a sequence of four conversions (CH1, CH9, CH10, CH17) and then goes low. EOC pulses high after each conversion. EOS goes high after the last conversion (CH17) and low when ADSTART goes high again. ADC state shows RDY, CH1, CH9, CH10, CH17, RDY, CH1, CH9, CH10, CH17, RDY. ADC_DR shows data values D1, D9, D10, D17, D17, D1, D9, D10, D17. A legend indicates 'by SW' with a rising edge and 'by HW' with a falling edge. Reference MS30549V1.

Figure 220. Continuous conversion of a sequence, software trigger

Timing diagram for continuous conversion of a sequence with software trigger. It shows five signal lines: ADCSTART(1), EOC, EOS, ADSTP, and ADC state(2). ADCSTART is a software trigger (SW) that goes high to start continuous conversions. ADSTP is a hardware trigger (HW) that goes high to stop the sequence. EOC pulses high after each conversion. EOS goes high when ADSTP goes high and low when ADCSTART goes high. ADC state shows READY, CH1, CH9, CH10, CH17, CH1, CH9, CH10, STP, READY, CH1, CH9. ADC_DR shows data values D1, D9, D10, D17, D1, D9, D1. A legend indicates 'by SW' with a rising edge and 'by HW' with a falling edge. Reference MS30550V1.
Timing diagram for continuous conversion of a sequence with software trigger. It shows five signal lines: ADCSTART(1), EOC, EOS, ADSTP, and ADC state(2). ADCSTART is a software trigger (SW) that goes high to start continuous conversions. ADSTP is a hardware trigger (HW) that goes high to stop the sequence. EOC pulses high after each conversion. EOS goes high when ADSTP goes high and low when ADCSTART goes high. ADC state shows READY, CH1, CH9, CH10, CH17, CH1, CH9, CH10, STP, READY, CH1, CH9. ADC_DR shows data values D1, D9, D10, D17, D1, D9, D1. A legend indicates 'by SW' with a rising edge and 'by HW' with a falling edge. Reference MS30550V1.

Figure 221. 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. ADSTART is a single pulse. EOC pulses for each conversion. EOS goes high after the last conversion. TRGX(1) is a periodic signal where rising edges are ignored (marked with X) and one rising edge triggers the sequence. ADC state(2) shows a sequence of 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. ADSTART is a single pulse. EOC pulses for each conversion. EOS goes high after the last conversion. TRGX(1) is a periodic signal where rising edges are ignored (marked with X) and one rising edge triggers the sequence. ADC state(2) shows a sequence of 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 (1) (over-frequency) is selected as trigger source, EXTEN = 01, CONT = 0
  2. 2. Channels selected = 1, 2, 3, 4; AUTDLY = 0.

Figure 222. 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. ADSTART starts the sequence and is ignored when already active. EOC pulses for each conversion. EOS goes high after the last conversion. ADSTP stops the sequence. TRGX(1) is a periodic signal where rising edges are ignored (marked with X) and one rising edge triggers the sequence. ADC(2) 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. ADSTART starts the sequence and is ignored when already active. EOC pulses for each conversion. EOS goes high after the last conversion. ADSTP stops the sequence. TRGX(1) is a periodic signal where rising edges are ignored (marked with X) and one rising edge triggers the sequence. ADC(2) 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 = 10, CONT = 1
  2. 2. Channels selected = 1, 2, 3, 4; AUTDLY = 0.

26.4.26 Data management

Data register, data alignment and offset (ADC_DR, OFFSET, OFFSET_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 223 , Figure 224 , Figure 225 and Figure 226 .

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 225 and Figure 226 .

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 OFFSET_EN = 1 into ADC_OFRy register. The channel to which the offset is to be applied is programmed into the bits OFFSET_CH[4:0] of ADC_OFRy register. In this case, the converted value is decreased by the user-defined offset written in the bits OFFSET[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 OFFSET_EN bit in ADC_OFRy register is ignored (considered as reset).

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

Table 261. Offset computation versus data resolution

Resolution
(bits
RES[1:0])
Subtraction between raw
converted data and offset
ResultComments
Raw
converted
Data, left
aligned
Offset
00: 12-bitDATA[11:0]OFFSET[11:0]Signed
12-bit data
-
01: 10-bitDATA[11:2],00OFFSET[11:0]Signed
10-bit data
The user must configure OFFSET[1:0] to "00"

Table 261. 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 223, Figure 224, Figure 225 and Figure 226 show alignments for signed and unsigned data.

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

Diagram showing right alignment of ADC data for 12-bit, 10-bit, 8-bit, and 6-bit resolutions. Each resolution shows a 16-bit word with data bits D15-D0 right-aligned and the upper bits set to 0. Bit 15 is labeled bit15, bit 7 is labeled bit7, and bit 0 is labeled bit0.

The diagram illustrates the right alignment of ADC data for different resolutions when the offset is disabled and the value is unsigned. The data is presented in a 16-bit word format, with bits labeled from bit15 down to bit0.

MS31015V1

Diagram showing right alignment of ADC data for 12-bit, 10-bit, 8-bit, and 6-bit resolutions. Each resolution shows a 16-bit word with data bits D15-D0 right-aligned and the upper bits set to 0. Bit 15 is labeled bit15, bit 7 is labeled bit7, and bit 0 is labeled bit0.

Figure 224. 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 layout with SEXT bits and data bits D11-D0. Bit 15 is the sign bit, bit 7 is the middle bit, and bit 0 is the least significant bit.

12-bit data
bit15 bit7 bit0

SEXTSEXTSEXTSEXTD11D10D9D8D7D6D5D4D3D2D1D0

10-bit data
bit15 bit7 bit0

SEXTSEXTSEXTSEXTSEXTSEXTD9D8D7D6D5D4D3D2D1D0

8-bit data
bit15 bit7 bit0

SEXTSEXTSEXTSEXTSEXTSEXTSEXTSEXTD7D6D5D4D3D2D1D0

6-bit data
bit15 bit7 bit0

SEXTSEXTSEXTSEXTSEXTSEXTSEXTSEXTSEXTSEXTD5D4D3D2D1D0

MS31016V1

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

Figure 225. 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 layout with data bits D11-D0 and trailing 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
bit15 bit7 bit0

D11D10D9D8D7D6D5D4D3D2D1D00000

10-bit data
bit15 bit7 bit0

D9D8D7D6D5D4D3D2D1D0000000

8-bit data
bit15 bit7 bit0

D7D6D5D4D3D2D1D000000000

6-bit data
bit15 bit7 bit0

00000000D5D4D3D2D1D000

MS31017V1

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

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

Diagram showing data alignment for 12-bit, 10-bit, 8-bit, and 6-bit data. Each section shows a 16-bit register layout with bit positions (bit15, bit7, bit0) and data fields (SEXT, D11-D0).

The diagram illustrates the data alignment for different ADC resolution modes when offset is enabled and signed values are used. Each mode shows a 16-bit register layout:

MS31018V1

Diagram showing data alignment for 12-bit, 10-bit, 8-bit, and 6-bit data. Each section shows a 16-bit register layout with bit positions (bit15, bit7, bit0) and data fields (SEXT, D11-D0).

Offset compensation

When SATEN bit is set in ADC_OFRy 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 before the offset compensation.

ADC overrun (OVR, OVRMOD)

The overrun flag (OVR) notifies when the regular converted data has not been read (by the CPU or the DMA) before ADC_DR FIFO (three stages) is overflowed.

The OVR flag is set when a new conversion completes while ADC_CR register FIFO was full. An interrupt is generated if OVRIE bit is set to 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 ADSTP to 1. Since ADC_DR FIFO features three stages, up to three data are stored in the FIFO.

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:

is cleared by reading ADC_DR register. However, the FIFO can still contain previously converted data.

Figure 227. Example of overrun (OVRMOD = 0)

Timing diagram illustrating an overrun condition in an ADC when OVRMOD = 0. The diagram shows the relationship between ADSTART, EOC, OVR, ADSTP, TRGx, ADC state, ADC_DR read access, ADC_DR, and ADC_DR (FIFO_DATA) signals over time. rising edge arrow falling edge arrow triggered arrow

This timing diagram illustrates an overrun condition (OVRMOD = 0) in the ADC. The signals shown are:

Legend:

by s/w    by h/w    triggered

Indicative timings

MSv65305V1

Timing diagram illustrating an overrun condition in an ADC when OVRMOD = 0. The diagram shows the relationship between ADSTART, EOC, OVR, ADSTP, TRGx, ADC state, ADC_DR read access, ADC_DR, and ADC_DR (FIFO_DATA) signals over time. rising edge arrow falling edge arrow triggered arrow

Figure 228. Example of overrun (OVRMOD = 1)

Timing diagram showing ADC signals (ADSTART, EOC, EOS, OVR, ADSTP, TRGx), ADC state (RDY, CH1-CH7, STOP), and ADC_DR read access. It illustrates an overrun condition where a new conversion starts before the previous one is read. Legend: by s/w (software), by h/w (hardware), triggered. MSV31019V2

The diagram illustrates the timing of an ADC overrun event. The ADSTART signal is set by software to start a sequence of conversions. The EOC (End of Conversion) flag is set by hardware when each conversion is complete. The EOS (End of Sequence) flag is set by hardware when the last conversion in the sequence is complete. The OVR (Overrun) flag is set by hardware when a new conversion starts before the previous one has been read. The ADSTP (Stop) signal is set by hardware when the sequence is complete. The TRGx (Trigger) signal is set by hardware to start the sequence. The ADC state shows the sequence of conversions: RDY (Ready), CH1, CH2, CH3, CH4, CH5, CH6, CH7, STOP, and then back to RDY. The ADC_DR read access shows that the data for CH5 is overwritten by the data for CH6 before it is read, resulting in an overrun. The ADC_DR register contains the data for the last completed conversion (D6). The legend indicates that ADSTART is set by software, EOC and EOS are set by hardware, and TRGx is triggered by hardware. The diagram is labeled 'Indicative timings' and 'MSV31019V2'.

Timing diagram showing ADC signals (ADSTART, EOC, EOS, OVR, ADSTP, TRGx), ADC state (RDY, CH1-CH7, STOP), and ADC_DR read access. It illustrates an overrun condition where a new conversion starts before the previous one is read. Legend: by s/w (software), by h/w (hardware), triggered. MSV31019V2

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 must be configured to 0 to manage overrun events or FIFO overflow 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 to 1 in the ADC_CFGR register in single ADC mode or MDMA different from 0b00 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.

26.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 233 ).

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 = 1
  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 229. AUTODLY = 1, regular conversion in continuous mode, software trigger

Timing diagram for Figure 229 showing ADC operation in continuous mode with software trigger and AUTODLY=1. The diagram shows the relationship between ADSTART(1), EOC, EOS, ADSTP, ADC_DR read access, ADC state, and ADC_DR data. The ADC state sequence is RDY, CH1, DLY, CH2, DLY, CH3, DLY, CH1, DLY, STOP, RDY. Data points D1, D2, D3, and D1 are shown. Triggers are labeled 'by SW' and 'by HW'. A legend indicates 'Indicative timings'.

MS31020V1

Timing diagram for Figure 229 showing ADC operation in continuous mode with software trigger and AUTODLY=1. The diagram shows the relationship between ADSTART(1), EOC, EOS, ADSTP, ADC_DR read access, ADC state, and ADC_DR data. The ADC state sequence is RDY, CH1, DLY, CH2, DLY, CH3, DLY, CH1, DLY, STOP, RDY. Data points D1, D2, D3, and D1 are shown. Triggers are labeled 'by SW' and 'by HW'. A legend indicates 'Indicative timings'.
  1. 1. AUTODLY = 1
  2. 2. Regular configuration: EXTEN=0x0 (SW trigger), CONT = 1, CHANNELS = 1,2,3
  3. 3. Injected configuration DISABLED

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

Timing diagram for Figure 230 showing ADC operation with regular HW conversions interrupted by injected conversions. The diagram shows Regular trigger, ADC state, EOC, EOS, ADC_DR read access, ADC_DR, Injected trigger, JEOS, ADC_JDR1, and ADC_JDR2. The ADC state sequence includes regular conversions (CH1, CH2, CH3) and injected conversions (CH5, CH6). Data points D1, D2, D3, D1, D5, and D6 are shown. Triggers are labeled 'by s/w' and 'by h/w'. A legend indicates 'Indicative timings'.

MS31021V2

Timing diagram for Figure 230 showing ADC operation with regular HW conversions interrupted by injected conversions. The diagram shows Regular trigger, ADC state, EOC, EOS, ADC_DR read access, ADC_DR, Injected trigger, JEOS, ADC_JDR1, and ADC_JDR2. The ADC state sequence includes regular conversions (CH1, CH2, CH3) and injected conversions (CH5, CH6). Data points D1, D2, D3, D1, D5, and D6 are shown. Triggers are labeled 'by s/w' and 'by h/w'. A legend indicates 'Indicative timings'.
  1. 1. AUTODLY = 1
  2. 2. Regular configuration: EXTEN=0x1 (HW trigger), CONT = 0, DISCEN = 0, CHANNELS = 1, 2, 3
  3. 3. Injected configuration: JEXTEN = 0x1 (HW Trigger), JDISCEN = 0, CHANNELS = 5,6

Figure 231. 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) when DISCEN and JDISCEN are enabled. It shows how injected conversions interrupt regular ones and how delays (DLY) are applied. Data values D1, D2, D3, D5, and D6 are shown being read from ADC_DR and ADC_JDR registers. Triggers are labeled as 'by SW' (software) or 'by HW' (hardware).

The timing diagram illustrates the operation of an ADC with AUTODLY=1, DISCEN=1, and JDISCEN=1. The 'Regular trigger' line shows a sequence of regular conversions: CH1 (regular), CH2 (regular), CH5 (injected), CH6 (injected), CH3 (regular), CH1 (regular), CH2 (regular). The 'ADC state' line shows the sequence of states: RDY, CH1, DLY, RDY, CH2, DLY, RDY, CH5, RDY, CH6, CH3, DLY, RDY, CH1, DLY, RDY, CH2. The 'EOC' (End of Conversion) signal is shown for regular conversions. The 'read access' line shows the data values D1, D2, D3, D5, and D6 being read from the ADC_DR and ADC_JDR registers. The 'Injected trigger' line shows the start of injected conversions. The 'JEOS' (End of Injected Sequence) signal is shown. The 'ADC_JDR1' and 'ADC_JDR2' registers are shown. The diagram also indicates 'Ignored' and 'Not ignored (occurs during injected sequence)' events. A legend at the bottom indicates 'by SW' (software trigger) and 'by HW' (hardware trigger). A box labeled 'Indicative timings' is present.

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) when DISCEN and JDISCEN are enabled. It shows how injected conversions interrupt regular ones and how delays (DLY) are applied. Data values D1, D2, D3, D5, and D6 are shown being read from ADC_DR and ADC_JDR registers. Triggers are labeled as 'by SW' (software) or 'by HW' (hardware).

MS31022V1

  1. 1. AUTODLY = 1
  2. 2. Regular configuration: EXTEN = 0x1 (HW trigger), CONT = 0, DISCEN = 1, DISCNUM = 1, CHANNELS = 1, 2, 3.
  3. 3. Injected configuration: JEXTEN = 0x1 (HW Trigger), JDISCEN = 1, CHANNELS = 5,6

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

Timing diagram for Figure 232 showing regular continuous conversions interrupted by injected conversions with AUTODLY = 1.

This timing diagram illustrates the ADC operation when AUTODLY = 1 and regular continuous conversions are interrupted by injected conversions. The sequence of events is as follows:

Indicative timings are shown with arrows indicating the sequence of events. MS31023V3

Timing diagram for Figure 232 showing regular continuous conversions interrupted by injected conversions with AUTODLY = 1.
  1. 1. AUTODLY = 1
  2. 2. Regular configuration: EXTEN = 0x0 (SW trigger), CONT = 1, DISCEN = 0, CHANNELS = 1, 2, 3
  3. 3. Injected configuration: JEXTEN = 0x1 (HW Trigger), JDISCEN = 0, CHANNELS = 5,6

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

Timing diagram for Figure 233 showing AUTODLY = 1 in auto-injected mode (JAUTO = 1).

This timing diagram illustrates the ADC operation when AUTODLY = 1 in auto-injected mode ( JAUTO = 1 ). The sequence of events is as follows:

Indicative timings are shown with arrows indicating the sequence of events. MS31024V4

Timing diagram for Figure 233 showing AUTODLY = 1 in auto-injected mode (JAUTO = 1).
  1. 1. AUTODLY = 1
  2. 2. Regular configuration: EXTEN = 0x0 (SW trigger), CONT = 1, DISCEN = 0, CHANNELS = 1, 2
  3. 3. Injected configuration: JAUTO = 1, CHANNELS = 5,6

26.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 234. Analog watchdog guarded area

Diagram showing the analog watchdog guarded area. A vertical axis represents 'Analog voltage'. Two horizontal lines represent the 'Higher threshold' (HTx) and 'Lower threshold' (LTx). The region between these thresholds is shaded and labeled 'Guarded area'. The diagram is labeled MS45396V1.
Diagram showing the analog watchdog guarded area. A vertical axis represents 'Analog voltage'. Two horizontal lines represent the 'Higher threshold' (HTx) and 'Lower threshold' (LTx). The region between these thresholds is shaded and labeled 'Guarded area'. The diagram 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 262 shows how the ADC_CFGR registers should be configured to enable the analog watchdog on one or more channels.

Table 262. 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. 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) before the offset compensation stage.

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

Table 263. Analog watchdog 1 comparison

Resolution(
bit
RES[1:0])
Analog watchdog comparison
between:
Comments
Raw converted data,
left aligned
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

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[19:0] (x = 2,3).

The corresponding watchdog is enabled when any bit of AWDxCH[19: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 264 describes how the comparison is performed for all the possible resolutions.

Table 264. Analog watchdog 2 and 3 comparison

Resolution
(bits RES[1:0])
Analog watchdog comparison between:Comments
Raw converted data,
left aligned
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

Table 264. Analog watchdog 2 and 3 comparison

Resolution
(bits RES[1:0])
Analog watchdog comparison between:Comments
Raw converted data,
left aligned
Thresholds
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

ADCy_AWDx_OUT signal output generation

Each analog watchdog is associated to an internal hardware signal ADCy_AWDx_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 ADCy_AWDx_OUT signal as ETR.

ADCy_AWDx_OUT is activated when the associated analog watchdog is enabled:

Note: AWDx flag is set by hardware and reset by software: AWDx flag has no influence on the generation of ADCy_AWDx_OUT (ex: ADCy_AWDx_OUT can toggle while AWDx flag remains at 1 if the software did not clear the flag).

Figure 235. ADCy_AWDx_OUT signal generation (on all regular channels)

Timing diagram showing ADC STATE, EOC FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals across seven conversions. The diagram shows how the AWDx flag and output signal behave when conversions are 'inside' or 'outside' thresholds. A legend indicates that regular channels 1,2,3,4,5,6,7 are being converted and are all guarded.

The timing diagram illustrates the relationship between the ADC state, End of Conversion (EOC) flags, Analog Watchdog (AWDx) flags, and the ADCy_AWDx_OUT signal during a sequence of seven regular conversions. The ADC state starts at 'RDY' and transitions through 'Conversion1' to 'Conversion7'. Each conversion is marked as either 'inside' or 'outside' the programmed thresholds. The EOC FLAG pulses when each conversion completes. The AWDx FLAG is set (goes high) when a conversion is 'outside' and is cleared by software (S/W) when it is 'inside'. The ADCy_AWDx_OUT signal is set (goes high) when the AWDx FLAG is set and is reset (goes low) when the AWDx FLAG is cleared. The legend indicates that regular channels 1,2,3,4,5,6,7 are being converted and are all guarded.

ADC STATEConversion1Conversion2Conversion3Conversion4Conversion5Conversion6Conversion7
RDYinsideoutsideinsideoutsideoutsideoutsideinside
EOC FLAGLowPulseLowPulseLowPulseLow
AWDx FLAGLowHighLow (cleared by S/W)HighHighHighLow (cleared by S/W)
ADCy_AWDx_OUTLowHighLowHighHighHighLow

MS31025V1

Timing diagram showing ADC STATE, EOC FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals across seven conversions. The diagram shows how the AWDx flag and output signal behave when conversions are 'inside' or 'outside' thresholds. A legend indicates that regular channels 1,2,3,4,5,6,7 are being converted and are all guarded.

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

Timing diagram for Figure 236 showing ADC STATE, EOC FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals. The diagram shows a sequence of conversions (Conversion1 to Conversion7) with 'inside' or 'outside' status. EOC flags pulse at each conversion. AWDx FLAG goes high at Conversion2 and stays high. ADCy_AWDx_OUT goes high at Conversion2 and low at Conversion7.

ADC STATE: RDY, Conversion1 (inside), Conversion2 (outside), Conversion3 (inside), Conversion4 (outside), Conversion5 (outside), Conversion6 (outside), Conversion7 (inside)

EOC FLAG: Pulses at each conversion boundary.

AWDx FLAG: Goes high at Conversion2 and remains high (not cleared by S/W).

ADC y _AWD x _OUT: Goes high at Conversion2 and low at Conversion7.

MS31026V1

Timing diagram for Figure 236 showing ADC STATE, EOC FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals. The diagram shows a sequence of conversions (Conversion1 to Conversion7) with 'inside' or 'outside' status. EOC flags pulse at each conversion. AWDx FLAG goes high at Conversion2 and stays high. ADCy_AWDx_OUT goes high at Conversion2 and low at Conversion7.

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

Timing diagram for Figure 237 showing ADC STATE, EOC FLAG, EOS FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals. The diagram shows alternating conversions of Channel 1 (inside) and Channel 2 (outside). AWDx FLAG is cleared by software. ADCy_AWDx_OUT follows the 'inside/outside' status of Channel 1.

ADC STATE: Conversion1 (outside), Conversion2, Conversion1 (inside), Conversion2, Conversion1 (outside), Conversion2, Conversion1 (outside), Conversion2

EOC FLAG: Pulses at each conversion boundary.

EOS FLAG: Pulses at the end of each Conversion2.

AWDx FLAG: Pulses at Conversion1 (outside) and is cleared by S/W.

ADC y _AWD x _OUT: Goes high at Conversion1 (inside) and low at Conversion1 (outside).

MS31027V1

Timing diagram for Figure 237 showing ADC STATE, EOC FLAG, EOS FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals. The diagram shows alternating conversions of Channel 1 (inside) and Channel 2 (outside). AWDx FLAG is cleared by software. ADCy_AWDx_OUT follows the 'inside/outside' status of Channel 1.

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

Timing diagram for Figure 238 showing ADC STATE, JEOS FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals for injected channels. The diagram shows conversions of injected channels 1-4. AWDx FLAG is cleared by software after each 'inside' conversion. ADCy_AWDx_OUT follows the 'inside/outside' status of injected channels.

ADC STATE: RDY, Conversion1 (inside), Conversion2 (outside), Conversion3 (inside), Conversion4 (outside), Conversion1 (outside), Conversion2 (outside), Conversion3 (inside)

JEOS FLAG: Pulses at the end of the injected channel sequence.

AWDx FLAG: Pulses at Conversion3 (inside) and is cleared by S/W. Same for other 'inside' conversions.

ADC y _AWD x _OUT: Goes high at Conversion3 (inside) and low at Conversion3 (outside).

MS31028V1

Timing diagram for Figure 238 showing ADC STATE, JEOS FLAG, AWDx FLAG, and ADCy_AWDx_OUT signals for injected channels. The diagram shows conversions of injected channels 1-4. AWDx FLAG is cleared by software after each 'inside' conversion. ADCy_AWDx_OUT follows the 'inside/outside' status of injected channels.

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.

To update both LTx[11:0] and HTx[11:0] during an ADC conversion, a unique write access to the ADC_TRx register be performed.

Analog watchdog with offset compensation

When the offset compensation is enabled, the analog watchdog compares the threshold before the data compensation.

26.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 239. 20-bit to 16-bit result truncation

Diagram illustrating 20-bit to 16-bit result truncation. It shows three horizontal bars representing data. The top bar is 'Raw 20-bit data' with bits 19 to 0. The middle bar is 'Shifting', showing a right arrow indicating a shift. The bottom bar is 'Truncation and rounding', showing the resulting 16-bit data with bits 15 to 0. A dashed vertical line at bit 15 separates the raw data from the shifted and truncated data. The diagram is labeled MS34453V1.
Diagram illustrating 20-bit to 16-bit result truncation. It shows three horizontal bars representing data. The top bar is 'Raw 20-bit data' with bits 19 to 0. The middle bar is 'Shifting', showing a right arrow indicating a shift. The bottom bar is 'Truncation and rounding', showing the resulting 16-bit data with bits 15 to 0. A dashed vertical line at bit 15 separates the raw data from the shifted and truncated data. The diagram is labeled MS34453V1.

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

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

Diagram illustrating a numerical example with 5-bit shift and rounding. It shows two horizontal bars representing data. The top bar is 'Raw 20-bit data' with bits 19 to 0, containing the values 3, B, 7, D, 7. The bottom bar is 'Final result after 5-bit shift and rounding to nearest', showing the resulting 16-bit data with bits 15 to 0, containing the values 1, D, B, F. A dashed vertical line at bit 15 separates the raw data from the shifted and rounded data. The diagram is labeled MS34454V1.
Diagram illustrating a numerical example with 5-bit shift and rounding. It shows two horizontal bars representing data. The top bar is 'Raw 20-bit data' with bits 19 to 0, containing the values 3, B, 7, D, 7. The bottom bar is 'Final result after 5-bit shift and rounding to nearest', showing the resulting 16-bit data with bits 15 to 0, containing the values 1, D, B, F. A dashed vertical line at bit 15 separates the raw data from the shifted and rounded data. The diagram is labeled MS34454V1.

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

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

Over sampling ratioMax Raw dataNo-shift
OVSS = 0000
1-bit shift
OVSS = 0001
2-bit shift
OVSS = 0010
3-bit shift
OVSS = 0011
4-bit shift
OVSS = 0100
5-bit shift
OVSS = 0101
6-bit shift
OVSS = 0110
7-bit shift
OVSS = 0111
8-bit shift
OVSS = 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 follow:

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_CFGR 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 OFFSET_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, 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 HTx[7:0] / LTx[7:0] (AWD1/2/3), with HT1[11:8] and LT1[11:8] kept reset (AWD1 only).

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.

The Figure 241 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 241. Triggered regular oversampling mode (TROVS bit = 1)

Figure 241: Triggered regular oversampling mode (TROVS bit = 1). The diagram illustrates two scenarios for regular oversampling. In the top scenario, with CONT=0, DISCEN=1, and TROVS=0, a 'Trigger' initiates a sequence of four conversions: Ch(N)0, Ch(N)1, Ch(N)2, and Ch(N)3. The 'EOC flag set' is indicated after the fourth conversion. In the bottom scenario, with CONT=0, DISCEN=1, and TROVS=1, a 'Trigger' initiates a sequence of conversions: Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3, Ch(N)0, Ch(N)1, and Ch(N)2. The 'EOC flag set' is indicated after the seventh conversion. The diagram shows that in the TROVS=1 mode, the sequence continues until the EOC flag is set, regardless of the CONT bit setting.

CONT=0
DISCEN = 1
TROVS = 0

Trigger

Ch(N) 0 Ch(N) 1 Ch(N) 2 Ch(N) 3

EOC flag set

CONT=0
DISCEN = 1
TROVS = 1

Trigger

Ch(N) 0

Trigger

Ch(N) 1

Trigger

Ch(N) 2

Trigger

Ch(N) 3

Trigger

Ch(N) 0

Trigger

Ch(N) 1

Trigger

Ch(N) 2

EOC flag set

MS34455V2

Figure 241: Triggered regular oversampling mode (TROVS bit = 1). The diagram illustrates two scenarios for regular oversampling. In the top scenario, with CONT=0, DISCEN=1, and TROVS=0, a 'Trigger' initiates a sequence of four conversions: Ch(N)0, Ch(N)1, Ch(N)2, and Ch(N)3. The 'EOC flag set' is indicated after the fourth conversion. In the bottom scenario, with CONT=0, DISCEN=1, and TROVS=1, a 'Trigger' initiates a sequence of conversions: Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3, Ch(N)0, Ch(N)1, and Ch(N)2. The 'EOC flag set' is indicated after the seventh conversion. The diagram shows that in the TROVS=1 mode, the sequence continues until the EOC flag is set, regardless of the CONT bit setting.

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:

The Figure 242 gives examples for a 4x oversampling ratio.

Figure 242. Regular oversampling modes (4x ratio)

Diagram illustrating two oversampling modes for regular channels: Continued mode and Resumed mode. Both show regular channels (Ch(N)0-3, Ch(M)0-1, Ch(O)0) and injected channels (Ch(J), Ch(K)). In Continued mode, oversampling is stopped and then continued. In Resumed mode, oversampling is aborted and then resumed. Control bits ROVSE, JOVSE, ROVSM, and TROVS are specified for each mode.

The diagram illustrates two oversampling modes for regular channels in an ADC. Both modes show a sequence of regular channels (Ch(N) 0 , Ch(N) 1 , Ch(N) 2 , Ch(N) 3 , Ch(M) 0 , Ch(M) 1 , Ch(O) 0 ) and injected channels (Ch(J), Ch(K)). A trigger initiates the conversion, and an 'Abort' signal can stop the oversampling. The 'JEOC' (Injected End of Conversion) signal marks the end of the injected sequence.

Continued mode: ROVSE = 1, JOVSE = 0, ROVSM = 0, TROVS = X. In this mode, oversampling is stopped after Ch(M) 1 and then continued with Ch(M) 1 , Ch(M) 2 , Ch(M) 3 , Ch(O) 0 .

Resumed mode: ROVSE = 1, JOVSE = 0, ROVSM = 1, TROVS = X. In this mode, oversampling is aborted after Ch(M) 1 and then resumed with Ch(M) 0 , Ch(M) 1 , Ch(M) 2 , Ch(M) 3 .

MS34456V1

Diagram illustrating two oversampling modes for regular channels: Continued mode and Resumed mode. Both show regular channels (Ch(N)0-3, Ch(M)0-1, Ch(O)0) and injected channels (Ch(J), Ch(K)). In Continued mode, oversampling is stopped and then continued. In Resumed mode, oversampling is aborted and then resumed. Control bits ROVSE, JOVSE, ROVSM, and TROVS are specified for each mode.

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 243 below.

Figure 243. Regular and injected oversampling modes used simultaneously

Figure 243: Regular and injected oversampling modes used simultaneously. The diagram shows a sequence of regular channels (Ch(N)0 to Ch(M)1) and injected channels (Ch(J)0 to Ch(J)3). A trigger initiates the regular channels. An 'Abort' signal occurs between Ch(N)3 and Ch(M)0. The regular channels resume after the injected channels complete, indicated by 'Oversampling resumed'. The injected channels end with 'JEOC'. Configuration: ROVSE = 1, JOVSE = 1, ROVSM = 1, TROVS = 0.

Regular channels: Ch(N) 0 | Ch(N) 1 | Ch(N) 2 | Ch(N) 3 | Ch(M) 0 | Ch(M) 1

Injected channels: Ch(J) 0 | Ch(J) 1 | Ch(J) 2 | Ch(J) 3

Trigger → Abort

Oversampling aborted

Oversampling resumed

JEOC

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

MS34457V2

Figure 243: Regular and injected oversampling modes used simultaneously. The diagram shows a sequence of regular channels (Ch(N)0 to Ch(M)1) and injected channels (Ch(J)0 to Ch(J)3). A trigger initiates the regular channels. An 'Abort' signal occurs between Ch(N)3 and Ch(M)0. The regular channels resume after the injected channels complete, indicated by 'Oversampling resumed'. The injected channels end with 'JEOC'. Configuration: ROVSE = 1, JOVSE = 1, ROVSM = 1, TROVS = 0.

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 244 below.

Figure 244. Triggered regular oversampling with injection

Figure 244: Triggered regular oversampling with injection. The diagram shows regular channels (Ch(N)0, Ch(N)1, Ch(N)2) and injected channels (Ch(J), Ch(K)). Triggers initiate the regular channels. An 'Abort' signal occurs between Ch(N)2 and Ch(J). The regular channels resume after the injected channels complete, indicated by 'Oversampling resumed'. Configuration: ROVSE = 1, JOVSE = 0, ROVSM = 1, TROVS = 1.

Regular channels: Ch(N) 0 | Ch(N) 1 | Ch(N) 2 | Ch(N) 0 | Ch(N) 1

Injected channels: Ch(J) | Ch(K)

Trigger → Trigger → Trigger → Abort → Trigger → Resumed

Oversampling resumed

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

MS34458V4

Figure 244: Triggered regular oversampling with injection. The diagram shows regular channels (Ch(N)0, Ch(N)1, Ch(N)2) and injected channels (Ch(J), Ch(K)). Triggers initiate the regular channels. An 'Abort' signal occurs between Ch(N)2 and Ch(J). The regular channels resume after the injected channels complete, indicated by 'Oversampling resumed'. Configuration: 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 245 below shows how the conversions are sequenced.

Figure 245. Oversampling in auto-injected mode

Diagram showing the sequencing of regular and injected channels in auto-injected mode. Regular channels are N0, N1, N2, N3. Injected channels are I0, I1, I2, I3, J0, J1, J2, J3, K0, K1, K2, K3, L0, L1, L2, L3. The diagram shows a sequence of regular channels followed by injected channels, then regular channels again. Configuration: JAUTO = 1, ROVSE = 1, JOVSE = 1, ROVSM = X, TROVS = 0. MS34459V1
Diagram showing the sequencing of regular and injected channels in auto-injected mode. Regular channels are N0, N1, N2, N3. Injected channels are I0, I1, I2, I3, J0, J1, J2, J3, K0, K1, K2, K3, L0, L1, L2, L3. The diagram shows a sequence of regular channels followed by injected channels, then regular channels again. Configuration: JAUTO = 1, ROVSE = 1, JOVSE = 1, ROVSM = X, TROVS = 0. MS34459V1

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 TROVSE = 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 266 below summarizes all combinations, including modes not supported.

Table 266. Oversampler operating modes summary

Regular Oversampling
ROVSE
Injected Oversampling
JOVSE
Oversampler mode
ROVSM
0 = continued
1 = resumed
Triggered Regular mode
TROVS
Comment
1000Regular continued mode
1001Not supported
1010Regular resumed mode
1011Triggered regular resumed mode
110XNot supported
1110Injected and regular resumed mode
1111Not supported
01XXInjected oversampling

26.4.30 Dual ADC modes

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

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 ADC_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 ADC_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, EXTSEL, JEXTEN, 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 necessary 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 necessary 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 (ADC_CDR). The status bits can be also read in parallel by reading the dual-mode status register (ADC_CSR).

Figure 246. Dual ADC block diagram (1)

Dual ADC block diagram showing Master ADC and Slave ADC components, including input multiplexers, channel blocks, data registers, and a common address/data bus.

The diagram illustrates the internal architecture of a dual ADC system. On the left, there are two multiplexers for internal analog inputs. The top multiplexer takes inputs from ADCx_INN1, ADCx_INP1, ADCx_INN2, and ADCx_INP2. The bottom multiplexer takes inputs from ADCx_INN16, ADCx_INP16, and other internal analog inputs. These multiplexers feed into the 'Slave ADC' and 'Master ADC' blocks. Each ADC block contains 'Regular channels' and 'Injected channels' blocks. The 'Regular channels' feed into a 'Regular data register (16-bits)', and the 'Injected channels' feed into 'Injected data registers (4 x16-bits)'. Both ADCs have 'Internal triggers' and 'Start trigger mux.' (one for the regular group and one for the injected group) connected to their channel blocks. A 'Dual mode control' block is connected to the start trigger muxes. All data registers are connected to a common 'Address/data bus' on the right. The diagram is labeled 'MSV36025V2' in the bottom right corner.

Dual ADC block diagram showing Master ADC and Slave ADC components, including input multiplexers, channel blocks, data registers, and a common address/data bus.

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 247. Injected simultaneous mode on 4 channels: dual ADC mode

Timing diagram for Injected simultaneous mode on 4 channels: dual ADC mode. The diagram shows two horizontal timelines for MASTER ADC and SLAVE ADC. The MASTER ADC timeline has four channels: CH1, CH2, CH3, CH4. The SLAVE ADC timeline has four channels: CH15, CH14, CH13, CH12. A 'Trigger' event is shown as a vertical line. Below the trigger, there are two boxes: a light gray box labeled 'Sampling' and a white box labeled 'Conversion'. Arrows indicate the start of the sequence at the trigger and the end of the sequence at the last channel conversion. The text 'End of injected sequence on MASTER and SLAVE ADC' is placed at the end of the sequences. The diagram is labeled MS31900V1 in the bottom right corner.
Timing diagram for Injected simultaneous mode on 4 channels: dual ADC mode. The diagram shows two horizontal timelines for MASTER ADC and SLAVE ADC. The MASTER ADC timeline has four channels: CH1, CH2, CH3, CH4. The SLAVE ADC timeline has four channels: CH15, CH14, CH13, CH12. A 'Trigger' event is shown as a vertical line. Below the trigger, there are two boxes: a light gray box labeled 'Sampling' and a white box labeled 'Conversion'. Arrows indicate the start of the sequence at the trigger and the end of the sequence at the last channel conversion. The text 'End of injected sequence on MASTER and SLAVE ADC' is placed at the end of the sequences. The diagram is labeled MS31900V1 in the bottom right corner.

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] = 0b10 or 0b11), 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 248. Regular simultaneous mode on 16 channels: dual ADC mode

Diagram illustrating Regular simultaneous mode on 16 channels: dual ADC mode. It shows two ADCs, MASTER ADC and SLAVE ADC, with their respective channel sequences. 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 a small square represents 'Sampling' and a larger rectangle represents 'Conversion'. An arrow points to the end of the sequences with the text 'End of regular sequence on MASTER and SLAVE ADC'. The diagram is labeled 'ai16054b' in the bottom right corner.
Diagram illustrating Regular simultaneous mode on 16 channels: dual ADC mode. It shows two ADCs, MASTER ADC and SLAVE ADC, with their respective channel sequences. 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 a small square represents 'Sampling' and a larger rectangle represents 'Conversion'. An arrow points to the end of the sequences with the text 'End of regular sequence on MASTER and SLAVE ADC'. The diagram is labeled 'ai16054b' in the bottom right corner.

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 0b10 or 0b11.

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 ADC_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 (ADC_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 249. Interleaved mode on one channel in continuous conversion mode: dual ADC mode

Timing diagram for interleaved mode on one channel in continuous conversion mode: dual ADC mode. The diagram shows the timing relationship between a Master ADC and a Slave ADC. The Master ADC starts sampling CH1 at 0.5 ADCCLK cycles. The Slave ADC is triggered and starts sampling CH1 at 0.5 ADCCLK cycles. Both ADCs perform conversion for 4 ADCCLK cycles. The Master ADC's conversion ends at 4.5 ADCCLK cycles, and the Slave ADC's conversion ends at 4.5 ADCCLK cycles. The diagram includes a legend for Sampling (grey box) and Conversion (white box).

The diagram illustrates the timing for interleaved mode on one channel in continuous conversion mode using dual ADCs. The Master ADC begins sampling CH1 at 0.5 ADCCLK cycles. The Slave ADC is triggered and begins sampling CH1 at 0.5 ADCCLK cycles. Both ADCs perform conversion for 4 ADCCLK cycles. The Master ADC's conversion ends at 4.5 ADCCLK cycles, and the Slave ADC's conversion ends at 4.5 ADCCLK cycles. The diagram includes a legend for Sampling (grey box) and Conversion (white box). The text 'MSV31030V5' is visible in the bottom right corner.

Timing diagram for interleaved mode on one channel in continuous conversion mode: dual ADC mode. The diagram shows the timing relationship between a Master ADC and a Slave ADC. The Master ADC starts sampling CH1 at 0.5 ADCCLK cycles. The Slave ADC is triggered and starts sampling CH1 at 0.5 ADCCLK cycles. Both ADCs perform conversion for 4 ADCCLK cycles. The Master ADC's conversion ends at 4.5 ADCCLK cycles, and the Slave ADC's conversion ends at 4.5 ADCCLK cycles. The diagram includes a legend for Sampling (grey box) and Conversion (white box).

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

Timing diagram for Figure 250 showing interleaved mode on 1 channel in single conversion mode. The diagram illustrates the timing between a Master ADC and a Slave ADC. The Master ADC starts sampling CH1 at 0.5 ADCCLK cycles after a trigger. The Slave ADC starts sampling CH1 at 0.5 ADCCLK cycles after the Master ADC starts. Both ADCs complete their conversion at 4 ADCCLK cycles. The diagram shows two such sequences. A legend indicates that gray boxes represent Sampling and white boxes represent Conversion. The text 'MSv31031V3' is in the bottom right corner.
Timing diagram for Figure 250 showing interleaved mode on 1 channel in single conversion mode. The diagram illustrates the timing between a Master ADC and a Slave ADC. The Master ADC starts sampling CH1 at 0.5 ADCCLK cycles after a trigger. The Slave ADC starts sampling CH1 at 0.5 ADCCLK cycles after the Master ADC starts. Both ADCs complete their conversion at 4 ADCCLK cycles. The diagram shows two such sequences. A legend indicates that gray boxes represent Sampling and white boxes represent Conversion. The text 'MSv31031V3' is in the bottom right corner.

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 251 below).

Figure 251. Interleaved conversion with injection

Timing diagram for Figure 251 showing interleaved conversion with injection. The diagram shows two ADCs, ADC1 (master) and ADC2 (slave). ADC1 is converting CH1, CH1, CH1. ADC2 is converting CH2, CH2, CH2. An injected trigger occurs, causing ADC1 to convert CH11. ADC2's conversions are aborted. After the injection, the regular sequences resume. The text 'Resume (always on master)' is shown above the resumed sequence. A legend indicates that gray boxes represent Sampling and white boxes represent Conversion. The text 'MS34460V1' is in the bottom right corner.
Timing diagram for Figure 251 showing interleaved conversion with injection. The diagram shows two ADCs, ADC1 (master) and ADC2 (slave). ADC1 is converting CH1, CH1, CH1. ADC2 is converting CH2, CH2, CH2. An injected trigger occurs, causing ADC1 to convert CH11. ADC2's conversions are aborted. After the injection, the regular sequences resume. The text 'Resume (always on master)' is shown above the resumed sequence. A legend indicates that gray boxes represent Sampling and white boxes represent Conversion. The text 'MS34460V1' is in the bottom right corner.

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 must not be 0x0.

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

  1. 1. When the 1st trigger occurs, all injected master ADC channels in the group are converted.
  2. 2. When the 2nd 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 252. Alternate trigger: injected group of each ADC

Timing diagram showing the sequence of Master and Slave ADC conversions triggered by four external events. The diagram illustrates sampling and conversion phases for injected groups. Interrupts JEOC and JEOS are shown occurring at the end of conversion sequences for both Master and Slave ADCs. A legend indicates that grey boxes represent sampling and white boxes represent conversion. Reference ai16059-m is noted in the bottom right.

The diagram illustrates the timing of injected group conversions for a Master ADC and a Slave ADC under four trigger events. Each ADC has a sequence of three injected channels. Each channel consists of a sampling phase (grey box) followed by a conversion phase (white box).
- 1st trigger: Initiates the Master ADC's injected group. JEOC (End of Conversion) is generated after the third channel's conversion. JEOS (End of Sequence) is generated after the third channel's conversion.
- 2nd trigger: Initiates the Slave ADC's injected group. JEOC and JEOS are generated after the third channel's conversion.
- 3rd trigger: Initiates the Master ADC's injected group again. JEOC and JEOS are generated after the third channel's conversion.
- 4th trigger: Initiates the Slave ADC's injected group again. JEOC and JEOS are generated after the third channel's conversion.
A legend at the bottom left shows a grey box for 'Sampling' and a white box for 'Conversion'. The reference 'ai16059-m' is in the bottom right corner.

Timing diagram showing the sequence of Master and Slave ADC conversions triggered by four external events. The diagram illustrates sampling and conversion phases for injected groups. Interrupts JEOC and JEOS are shown occurring at the end of conversion sequences for both Master and Slave ADCs. A legend indicates that grey boxes represent sampling and white boxes represent conversion. Reference ai16059-m is noted in the bottom right.

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 253. Alternate trigger: 4 injected channels (each ADC) in discontinuous mode

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

The diagram illustrates the timing sequence for 4 injected channels in discontinuous mode for both Master and Slave ADCs. The sequence starts with the 1st trigger for the Master ADC, followed by the 2nd trigger for the Slave ADC, and so on, alternating between them. Each trigger initiates a conversion sequence. The Master ADC's sequence consists of 4 conversions, and the Slave ADC's sequence also consists of 4 conversions. Interrupts (JEOC, JEOS) are generated after each conversion in the Master ADC's sequence and after each conversion in the Slave ADC's sequence. The 8th trigger occurs after the Slave ADC's 4th conversion, restarting the sequence. A legend indicates that grey boxes represent Sampling and white boxes represent Conversion.

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

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 254 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 254. Alternate + regular simultaneous

Timing diagram for Figure 254 showing ADC MASTER and ADC SLAVE regular and injected conversion sequences.

The diagram shows the timing for 'Alternate + regular simultaneous' mode.
- ADC MASTER reg: Converts CH1, CH2, CH3, then after a gap, CH3, CH4, then CH4, CH5.
- ADC MASTER inj: A conversion of CH1 is triggered by the '1st trigger' during the master's regular sequence.
- ADC SLAVE reg: Converts CH4, CH6, CH7, then CH7, CH8, then CH8, CH9. These are synchronized with the master's regular conversions.
- ADC SLAVE inj: A conversion of CH1 is triggered by the '2nd trigger' during the slave's regular sequence. The text notes 'synchronization not lost'.

Timing diagram for Figure 254 showing ADC MASTER and ADC SLAVE regular and injected conversion sequences.

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

Figure 255. Case of trigger occurring during injected conversion

Timing diagram for Figure 255 showing multiple triggers and their effect on ADC MASTER and SLAVE sequences.

The diagram illustrates multiple triggers (1st through 6th) affecting the conversion sequences:
- 1st trigger: Starts Master regular (CH1, CH2, CH3) and Slave regular (CH7, CH8, CH9). Master injected (CH14) and Slave injected (CH15) also occur.
- 2nd trigger: Occurs during the injected conversion.
- 3rd trigger: Starts next sequence: Master (CH3, CH4) and Slave (CH9, CH10).
- 4th trigger: Occurs during the slave's injected conversion.
- 5th trigger: Starts next sequence: Master (CH4, CH5) and Slave (CH10, CH11).
- 6th trigger: Is explicitly labeled as '(ignored)' because the previous alternate conversion is not complete.

Timing diagram for Figure 255 showing multiple triggers and their effect on ADC MASTER and SLAVE sequences.

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 256, Figure 257 and Figure 258 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 256. Interleaved single channel CH0 with injected sequence CH11, CH12

Timing diagram for Figure 256 showing interleaved single channel CH0 with injected sequence CH11, CH12. It illustrates the interaction between ADC1 (master) and ADC2 (slave) channels, including sampling, conversion, and read CDR operations. The diagram shows that when an injected trigger occurs, the slave's current conversion is aborted and the injected sequence (CH11, CH12) is converted instead. Once the injected sequence is complete, the slave resumes its master sequence. A legend indicates that light gray represents sampling and dark gray represents conversion.

ADC1 (master): CH0, CH0, CH0

ADC2 (slave): CH0, CH0, CH0 (aborted), CH11, CH11, CH12, CH12, CH0, CH0, CH0

read CDR

Legend: Sampling, Conversion

Injected trigger

Conversions aborted

Resume (always restart with the master)

MS34461V1

Timing diagram for Figure 256 showing interleaved single channel CH0 with injected sequence CH11, CH12. It illustrates the interaction between ADC1 (master) and ADC2 (slave) channels, including sampling, conversion, and read CDR operations. The diagram shows that when an injected trigger occurs, the slave's current conversion is aborted and the injected sequence (CH11, CH12) is converted instead. Once the injected sequence is complete, the slave resumes its master sequence. A legend indicates that light gray represents sampling and dark gray represents conversion.

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

Timing diagram for Figure 257, case 1: Master interrupted first. It shows ADC1 (master) and ADC2 (slave) interleaved channels CH1 and CH2. When an injected trigger occurs, the slave's current conversion is aborted and the injected sequence (CH11, CH12) is converted. The master's sequence resumes after the injected sequence. A legend indicates that light gray represents sampling and dark gray represents conversion.

ADC1 (master): CH1, CH1, CH1

ADC2 (slave): CH2, CH2, CH2 (aborted), CH11, CH11, CH12, CH12, CH2, CH2, CH2

read CDR

Legend: Sampling, Conversion

Injected trigger

Conversions aborted

Resume (always restart with the master)

MS34462V1

Timing diagram for Figure 257, case 1: Master interrupted first. It shows ADC1 (master) and ADC2 (slave) interleaved channels CH1 and CH2. When an injected trigger occurs, the slave's current conversion is aborted and the injected sequence (CH11, CH12) is converted. The master's sequence resumes after the injected sequence. A legend indicates that light gray represents sampling and dark gray represents conversion.

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

Timing diagram for Figure 258, case 2: Slave interrupted first. It shows ADC1 (master) and ADC2 (slave) interleaved channels CH1 and CH2. When an injected trigger occurs, the slave's current conversion is aborted and the injected sequence (CH11, CH12) is converted. The master's sequence resumes after the injected sequence. A legend indicates that light gray represents sampling and dark gray represents conversion.

ADC1 (master): CH1, CH1, CH1

ADC2 (slave): CH2, CH2, CH2 (aborted), CH11, CH11, CH12, CH12, CH2, CH2, CH2

read CDR

Legend: Sampling, Conversion

Injected trigger

Conversions aborted

Resume (always restart with the master)

MS34463V2

Timing diagram for Figure 258, case 2: Slave interrupted first. It shows ADC1 (master) and ADC2 (slave) interleaved channels CH1 and CH2. When an injected trigger occurs, the slave's current conversion is aborted and the injected sequence (CH11, CH12) is converted. The master's sequence resumes after the injected sequence. A legend indicates that light gray represents sampling and dark gray represents conversion.

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 259: DMA Requests in regular simultaneous mode when MDMA = 0b00 ).

Figure 259. DMA Requests in regular simultaneous mode when MDMA = 0b00

Timing diagram 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 two conversion cycles. The diagram shows that in regular simultaneous mode with MDMA = 0b00, separate DMA requests are generated for the master and slave ADCs upon completion of their respective conversions. The master's DMA request occurs when the master's EOC signal goes high, and the slave's DMA request occurs when the slave's EOC signal goes high. The diagram also indicates that the DMA reads the master's ADC_DR register when the master's DMA request is active, and the slave's ADC_DR register when the slave's DMA request is active. The configuration is such that each sequence contains only one conversion.

MSV31032V2

Timing diagram 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 two conversion cycles. The diagram shows that in regular simultaneous mode with MDMA = 0b00, separate DMA requests are generated for the master and slave ADCs upon completion of their respective conversions. The master's DMA request occurs when the master's EOC signal goes high, and the slave's DMA request occurs when the slave's EOC signal goes high. The diagram also indicates that the DMA reads the master's ADC_DR register when the master's DMA request is active, and the slave's ADC_DR register when the slave's DMA request is active. The configuration is such that each sequence contains only one conversion.

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 ADC_CCR register:

Example:

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

1st DMA request: ADC_CDR[31:0] = SLV_ADC_DR[15:0] | MST_ADC_DR[15:0]

2nd DMA request: ADC_CDR[31:0] = SLV_ADC_DR[15:0] | MST_ADC_DR[15:0]

Figure 260. DMA requests in regular simultaneous mode when MDMA = 0b10

Timing diagram for Figure 260 showing regular simultaneous mode. It displays two sequences of conversions. In each sequence, a 'Trigger' signal starts the conversion of 'CH1' on the ADC Master regular line. Simultaneously, 'CH2' is converted on the ADC Slave regular line. The ADC Master EOC (End of Conversion) signal goes high when CH1 completes. The ADC Slave EOC signal goes high when CH2 completes. A DMA request from the ADC Master is generated at the EOC of CH1. The DMA request from the ADC Slave is shown as a flat line, indicating no request is generated in this mode. A caption at the bottom states: 'Configuration where each sequence contains only one conversion'. The reference 'MSV31033V3' is in the bottom right corner.

Configuration where each sequence contains only one conversion

MSV31033V3

Timing diagram for Figure 260 showing regular simultaneous mode. It displays two sequences of conversions. In each sequence, a 'Trigger' signal starts the conversion of 'CH1' on the ADC Master regular line. Simultaneously, 'CH2' is converted on the ADC Slave regular line. The ADC Master EOC (End of Conversion) signal goes high when CH1 completes. The ADC Slave EOC signal goes high when CH2 completes. A DMA request from the ADC Master is generated at the EOC of CH1. The DMA request from the ADC Slave is shown as a flat line, indicating no request is generated in this mode. A caption at the bottom states: 'Configuration where each sequence contains only one conversion'. The reference 'MSV31033V3' is in the bottom right corner.

Figure 261. DMA requests in interleaved mode when MDMA = 0b10

Timing diagram for Figure 261 showing interleaved mode. It displays two sequences of conversions. In each sequence, a 'Trigger' signal starts the conversion of 'CH1' on the ADC Master regular line. After a 'Delay', the conversion of 'CH2' on the ADC Slave regular line begins. The ADC Master EOC signal goes high when CH1 completes. The ADC Slave EOC signal goes high when CH2 completes. DMA requests from both the ADC Master and the ADC Slave are generated at their respective EOC signals. A caption at the bottom states: 'Configuration where each sequence contains only one conversion'. The reference 'MSV31034V2' is in the bottom right corner.

Configuration where each sequence contains only one conversion

MSV31034V2

Timing diagram for Figure 261 showing interleaved mode. It displays two sequences of conversions. In each sequence, a 'Trigger' signal starts the conversion of 'CH1' on the ADC Master regular line. After a 'Delay', the conversion of 'CH2' on the ADC Slave regular line begins. The ADC Master EOC signal goes high when CH1 completes. The ADC Slave EOC signal goes high when CH2 completes. DMA requests from both the ADC Master and the ADC Slave are generated at their respective EOC signals. A caption at the bottom states: 'Configuration where each sequence contains only one conversion'. The reference 'MSV31034V2' is in the bottom right corner.

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:

1st DMA request: ADC_CDR[15:0] = SLV_ADC_DR[7:0] | MST_ADC_DR[7:0]

2nd DMA request: ADC_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 b00000), 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 (0b10 or 0b11), bit DMACFG of the ADC_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.

26.4.31 Temperature sensor

The temperature sensor can be used to measure the junction temperature (Tj) 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 (see Table: ADC interconnection in Section 26.4.2: ADC pins and internal signals for more details). When not in use, the sensor can be put in power down mode. It support the temperature range –40 to 125 °C.

Figure 262 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 262 shows the block diagram of the temperature sensor.

Figure 262. Temperature sensor channel block diagram

Figure 262. Temperature sensor channel block diagram

The block diagram illustrates the internal temperature sensor's connection to the ADC. On the left, a box labeled 'Temperature sensor' is connected to a multiplexer. The multiplexer's output is labeled \( V_{SENSE} \) and is connected to the 'ADC input' of a block labeled 'ADCx'. Above the multiplexer, a 'TSEN control bit' is shown entering it. The 'ADCx' block has an output labeled 'Converted data' which is connected to a vertical box labeled 'Address/data bus'. In the bottom right corner of the diagram, the text 'MSv62477V1' is present.

Figure 262. Temperature sensor channel block diagram

Reading the temperature

To use the sensor:

  1. 1. Select the ADC input channels that is connected to \( V_{SENSE} \) .
  2. 2. Program with the appropriate sampling time (refer to electrical characteristics section of the device datasheet).
  3. 3. Set the bit in the ADC_CCR register to wake up the temperature sensor from power-down mode.
  4. 4. Start the ADC conversion.
  5. 5. Read the resulting \( V_{SENSE} \) 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 SENSE at the correct level. The ADC also has a startup time after power-on, so to minimize the delay, the ADEN and bits should be set at the same time.

26.4.32 V BAT supply monitoring

The VBATEN bit in the ADC_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 4. This bridge is automatically enabled when VBATEN is set, to connect V BAT /4 to the ADC input channels (see Table: ADC interconnection in Section 26.4.2: ADC pins and internal signals for more details). 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 /4 voltage.

Figure 263 shows the block diagram of the V BAT sensing feature.

Figure 263. V BAT channel block diagram Figure 263. VBAT channel block diagram

The diagram shows the internal circuitry for monitoring the battery voltage (V BAT ). A switch controlled by the VBATEN control bit connects the VBAT pin to a voltage divider consisting of two resistors. The midpoint of the divider provides a voltage labeled V BAT /4. This voltage is then passed through a multiplexer to the ADC input of the ADCx block. The ADCx block is connected to an Address/data bus. The identifier MSv41032V5 is located in the bottom right corner.

Figure 263. VBAT channel block diagram
  1. 1. The VBATEN bit must be set to enable the conversion of internal channel for V BAT /4.

26.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.

Refer to Table: ADC interconnection in Section 26.4.2: ADC pins and internal signals for details on the ADC input channels to which the internal voltage reference is internally connected.

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 264 shows the block diagram of the V REFINT sensing feature.

Figure 264. V REFINT channel block diagram Figure 264. VREFINT channel block diagram

The diagram illustrates the internal voltage reference sensing feature. An Internal power block generates the V REFINT voltage. This voltage is connected to a multiplexer, which is controlled by the VREFEN control bit. The output of the multiplexer is connected to the ADC input of the ADCx block. The identifier MSv34467V5 is located in the bottom right corner.

Figure 264. VREFINT channel block diagram
  1. 1. The VREFEN bit into ADC_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

\( V_{REF+} \) voltage may be subject to variations or not precisely known. The embedded internal reference voltage \( V_{REFINT} \) and its calibration data acquired by the ADC during the manufacturing process at \( V_{REF+\_charac} \) can be used to evaluate the actual \( V_{REF+} \) 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 applications where \( V_{REF+} \) 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_{REF+} \) :

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

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

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

Where:

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

26.4.34 Monitoring the supply voltage

ADC2 is connected to the internal supply voltage. To use the ADC to measure this voltage, enable the connection through ADC option register.

26.5 ADC interrupts

For each ADC, an interrupt can be generated:

Separate interrupt enable bits are available for flexibility.

Table 267. ADC interrupts

Interrupt vectorInterrupt eventEvent flagEnable Control bitInterrupt clear methodExit from Sleep modeExit from Stop, Standby mode
ADCADC readyADRDYADRDYIESet by hardware and cleared by softwareYesNo
End of conversion of a regular groupEOCEOCIE
End of conversion sequence of a regular groupEOSEOSIE
End of conversion of an injected groupJEOCJEOCIE
End of conversion sequence 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

26.6 ADC registers (for each ADC)

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

26.6.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 26.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 ADDRDY: ADC ready

This bit is set by hardware after the ADC has been enabled (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

26.6.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.JQOVFIEAWD3IEAWD2IEAWD1IEJEOSIEJEOCIEOVRIEEOSIEEOCIEEOSMP
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 OVRRIE: 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).

26.6.3 ADC control register (ADC_CR)

Address offset: 0x08

Reset value: 0x2000 0000

31302928272625242322212019181716
ADCALADCALDIFDEEPPWDADVREGENRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rsrwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.JADSTPADSTPJADSTARTADSTARTADDISADEN
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 26.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).

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, a conversion immediately starts (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, a conversion immediately starts (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)

26.6.4 ADC configuration register (ADC_CFGR)

Address offset: 0x0C

Reset value: 0x8000 0000

31302928272625242322212019181716
JQDISAWD1CH[4:0]JAUTOJAWD1ENAWD1ENAWD1SGLJQMJDISCENDISCNUM[2:0]DISCEN
r/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/w
1514131211109876543210
ALIGNAUTDLYCONTOVRMODEXTEN[1:0]EXTSEL4EXTSEL3EXTSEL2EXTSEL1EXTSEL0RES[1:0]Res.DMACFGDMAEN
r/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/wr/w

Bit 31 JQDIS : Injected queue disable

This bit is 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

....

10011: ADC analog input channel 19 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 ADC_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 26.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 ADC_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 ADC_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 ADC_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 ADC_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 Section : Data register, data alignment and offset (ADC_DR, OFFSET, OFFSET_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 ADC_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 ADC_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: adc_ext_trg0

00001: adc_ext_trg1

00010: adc_ext_trg2

00011: adc_ext_trg3

00100: adc_ext_trg4

00101: adc_ext_trg5

00110: adc_ext_trg6

00111: adc_ext_trg7

...

11111: adc_ext_trg31

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 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 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 ADC_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 ADC_CCR register.

26.6.5 ADC configuration register 2 (ADC_CFGR2)

Address offset: 0x10

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.SMPTRIGBULBSWTRIGRes.Res.Res.Res.Res.Res.Res.Res.Res.
rwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.ROVSMTROVSOVSS[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 bit should be set to 01. BULB bit must not be set when the SMPTRIG bit is set.

When EXTEN bit is 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.

SMPTRIG 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.

Bits 16: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.

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.

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.

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

26.6.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.

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.

26.6.7 ADC sample time register 2 (ADC_SMPR2)

Address offset: 0x18

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.SMP19[2:0]SMP18[2:0]SMP17[2:0]SMP16[2:0]SMP15[2:1]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
SMP15[0]SMP14[2:0]SMP13[2:0]SMP12[2:0]SMP11[2:0]SMP10[2:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 29:0 SMPx[2:0] : Channel x sampling time selection (x = 19 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.

26.6.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 26.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[2:0] : 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 26.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).

26.6.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 26.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 26.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).

26.6.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 26.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).

26.6.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] : 4th conversion in regular sequence

These bits are written by software with the channel number (0 to 19) assigned as the 4th 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] : 3rd conversion in regular sequence

These bits are written by software with the channel number (0 to 19) assigned as the 3rd 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] : 2nd conversion in regular sequence

These bits are written by software with the channel number (0 to 19) assigned as the 2nd 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] : 1st conversion in regular sequence

These bits are written by software with the channel number (0 to 19) assigned as the 1st 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.

26.6.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]
rwrwrwrwrwrwrwrwrw
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 19) 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 19) 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 19) 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 19) 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 19) 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.

26.6.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 19) 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 19) 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 19) 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 19) 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 19) 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.

26.6.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
Res.Res.Res.Res.Res.SQ16[4:0]Res.SQ15[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 19) 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 19) 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.

26.6.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.
1514131211109876543210
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 26.4.26: Data management .

26.6.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
1514131211109876543210
JSQ2[0]Res.JSQ1[4:0]JEXTEN[1:0]JEXTSEL[4:0]JL[1:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:27 JSQ4[4:0] : 4th conversion in the injected sequence

These bits are written by software with the channel number (0 to 19) assigned as the 4th 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).

Bit 26 Reserved, must be kept at reset value.

Bits 25:21 JSQ3[4:0] : 3rd conversion in the injected sequence

These bits are written by software with the channel number (0 to 19) assigned as the 3rd 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).

Bit 20 Reserved, must be kept at reset value.

Bits 19:15 JSQ2[4:0] : 2nd conversion in the injected sequence

These bits are written by software with the channel number (0 to 19) assigned as the 2nd 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).

Bit 14 Reserved, must be kept at reset value.

Bits 13:9 JSQ1[4:0] : 1st conversion in the injected sequence

These bits are written by software with the channel number (0 to 19) assigned as the 1st 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).

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.

Otherwise, the queue is disabled as well as hardware trigger detection (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 26.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:

00000: adc_jext_trg0

00001: adc_jext_trg1

00010: adc_jext_trg2

00011: adc_jext_trg3

00100: adc_jext_trg4

00101: adc_jext_trg5

00110: adc_jext_trg6

00111: adc_jext_trg7

...

11111: adc_jext_trg31

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.

00: 1 conversion

01: 2 conversions

10: 3 conversions

11: 4 conversions

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.

26.6.17 ADC offset y register (ADC_OFRy)

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 OFFSET[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 OFFSET[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.

If OFFSET_EN is set, it is not allowed to select the same channel for different ADC_OFRy registers.

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 OFFSET_CH[4:0]

These bits are written by software to define the offset 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 must be programmed in the bits OFFSET_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 (OFFSET) 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.

26.6.18 ADC injected channel y data register (ADC_JDRy)

Address offset: 0x80 + 0x04 * (y - 1), (y = 1 to 4)

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
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 26.4.26: Data management .

26.6.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.AWD2CH[19:16]
rwrwrwrw
1514131211109876543210
AWD2CH[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 19:0 AWD2CH[19: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[19: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.

26.6.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.AWD3CH[19:16]
rwrwrwrw
1514131211109876543210
AWD3CH[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 19:0 AWD3CH[19: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[19: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.

26.6.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.DIFSEL[19:16]
rwrwrwrw
1514131211109876543210
DIFSEL[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwr

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

Bits 19:0 DIFSEL[19:0] : Differential mode for channels 19 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 i 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).

26.6.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).

26.6.23 ADC option register (ADC_OR)

Address offset: 0xC8

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.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OP0
rw

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

Bit 0 OP0 : Option bit 0

For ADC1:

0: INP0/INN1 GPIO switch control disabled

1: INP0/INN1 GPIO switch control enabled

Note: This option bit must be set to 1 when ADCx_INP0 or ADCx_INN1 channel is selected.

For ADC2:

0: V DDCORE channel disabled

1: V DDCORE channel enabled

Note: ADC_OR register might be reserved on some ADC instances. Refer to Section 26.3: ADC implementation.

26.7 ADC common registers

These registers define the control and status registers common to master and slave ADCs:

26.7.1 ADC common status register (ADC_CSR)

Address offset: 0x300

Reset value: 0x0000 0000

This register provides an image of the status bits of the different ADC. 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.

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. Bit 16 ADRDY_SLV : Slave ADC ready
    This bit is a copy of the ADRDY bit in the corresponding ADC_ISR register.
  7. Bits 15:11 Reserved, must be kept at reset value.
  8. 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.
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. 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.
  17. 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.
  18. Bit 0 ADRDY_MST : Master ADC ready
    This bit is a copy of the ADRDY bit in the corresponding ADC_ISR register.

26.7.2 ADC common control register (ADC_CCR)

Address offset: 0x308

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.VBATENTSENVREFENPRESC[3:0]CKMODE[1:0]
rwrwrwrwrwrwrwrwrw
1514131211109876543210
MDMA[1:0]DMA
CFG
Res.DELAY[3:0]Res.Res.Res.DUAL[4:0]
rwrwrwrwrwrwrwrwrwrwrwrw

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

Bit 24 VBATEN : VBAT enable

This bit is set and cleared by software to control.

0: V BAT channel disabled

1: V BAT channel enabled

Bit 23 TSEN : V SENSE enable

This bit is set and cleared by software to control V SENSE .

0: Temperature sensor channel disabled

1: Temperature sensor channel enabled

Bit 22 VREFEN : 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] = 0b00.

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 = 1/2 \) ) (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 to 1 (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[3:0] : Delay between 2 sampling phases

These bits are set and cleared by software. These bits are used in dual interleaved modes. Refer to Table 268 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. 00000 corresponds to Independent mode. Values 00001 to 01001 correspond to dual mode, master and slave ADCs working together.

00000: Independent mode

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

Others: Reserved, must not be used

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 268. 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
00114 * T adc_ker_ck4 * T adc_ker_ck4 * T adc_ker_ck4 * T adc_ker_ck
01005 * T adc_ker_ck5 * T adc_ker_ck5 * T adc_ker_ck5 * T adc_ker_ck
01016 * T adc_ker_ck6 * T adc_ker_ck6 * T adc_ker_ck6 * T adc_ker_ck
01107 * T adc_ker_ck7 * T adc_ker_ck7 * T adc_ker_ck6 * T adc_ker_ck
01118 * T adc_ker_ck8 * T adc_ker_ck8 * T adc_ker_ck6 * T adc_ker_ck
10009 * T adc_ker_ck9 * T adc_ker_ck8 * T adc_ker_ck6 * T adc_ker_ck
100110 * T adc_ker_ck10 * T adc_ker_ck8 * T adc_ker_ck6 * T adc_ker_ck
101011 * T adc_ker_ck10 * T adc_ker_ck8 * T adc_ker_ck6 * T adc_ker_ck
101112 * T adc_ker_ck10 * T adc_ker_ck8 * T adc_ker_ck6 * T adc_ker_ck
others12 * T adc_ker_ck10 * T adc_ker_ck8 * T adc_ker_ck6 * T adc_ker_ck

26.7.3 ADC common regular data register for dual mode (ADC_CDR)

Address offset: 0x30C

Reset value: 0x0000 0000

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 26.4.30: Dual ADC modes .

The data alignment is applied as described in Section : Data register, data alignment and offset (ADC_DR, OFFSET, OFFSET_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 26.4.30: Dual ADC modes .

The data alignment is applied as described in Section : Data register, data alignment and offset (ADC_DR, OFFSET, OFFSET_CH, ALIGN)

In MDMA = 0b11 mode, bits 15:8 contains SLV_ADC_DR[7:0], bits 7:0 contains MST_ADC_DR[7:0].

26.8 ADC register map

The following table summarizes the ADC registers.

Table 269. ADC global register map

OffsetRegister
0x000 - 0x0B4Master ADC1
0x0B8 - 0x0FCReserved
0x100 - 0x1B4Slave ADC2
0x1B8 - 0x2FCReserved
0x300 - 0x30CMaster and slave ADCs common registers

Table 270. 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_CFGRJQDISAWD1CH[4:0]JAUTOJAWD1ENAWD1ENAWD1SGLJQMJDISCENDISCNUM[2:0]DISCENALIGNAUTDLYCONTOVRMODEXTEN[1:0]EXTSEL4EXTSEL3EXTSEL2EXTSEL1EXTSEL0RES[1:0]Res.DMACFGDMAEN
Reset value1000000000000000000000000000000
0x0CADC_CFGR2Res.Res.Res.Res.SMPTRIGBULBSWTRIGRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.ROVSMTROVSOVSS[3:0]OVSR[2:0]JOVSEROVSE
Reset value00000000000000
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 value00000000000000000000000000000
0x18ADC_SMPR2Res.Res.SMP19[2:0]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 value0000000000000000000000000000
0x1CReservedRes.
0x20ADC_TR1Res.Res.Res.Res.HT1[11:0]Res.AWDFILT[2:0]LT1[11:0]
Reset value111111111111000000000000000

Table 270. ADC register map and reset values for each ADC (offset = 0x000 for master ADC, 0x100 for slave ADC) (continued)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
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.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.Res.SQ5[4:0]
Reset value000000000000000000000000
0x38ADC_SQR3Res.Res.Res.SQ14[4:0]Res.SQ13[4:0]Res.SQ12[4:0]Res.SQ11[4:0]Res.Res.SQ10[4:0]
Reset value000000000000000000000000
0x3CADC_SQR4Res.Res.Res.Res.Res.Res.SQ16[4:0]Res.Res.SQ15[4:0]
Reset value000000000
0x40ADC_DRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.regular RDATA[15:0]
Reset value000000000000000
0x44-0x48ReservedRes.
0x4CADC_JSQRJSQ4[4:0]Res.JSQ3[4:0]Res.JSQ2[4:0]Res.JSQ1[4:0]Res.JEXTEN[1:0]JEXTSEL[4:0]JL[1:0]
Reset value0000000000000000000000000000000
0x50-0x5CReservedRes.
0x60ADC_OFR1OFFSET_ENOFFSET_CH[4:0]SATENOFFSETPOSRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET[11:0]
Reset value000000000000000000
0x64ADC_OFR2OFFSET_ENOFFSET_CH[4:0]SATENOFFSETPOSRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET[11:0]
Reset value000000000000000000
0x68ADC_OFR3OFFSET_ENOFFSET_CH[4:0]SATENOFFSETPOSRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET[11:0]
Reset value000000000000000000
0x6CADC_OFR4OFFSET_ENOFFSET_CH[4:0]SATENOFFSETPOSRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET[11:0]
Reset value000000000000000000
0x70-0x7CReservedRes.

Table 270. ADC register map and reset values for each ADC (offset = 0x000 for master ADC, 0x100 for slave ADC) (continued)

OffsetRegister name reset value313029282726252423222120191817161514131211109876543210
0x80ADC_JDR1Res.JDATA1[15:0]
Reset value0000000000000000
0x84ADC_JDR2Res.JDATA2[15:0]
Reset value0000000000000000
0x88ADC_JDR3Res.JDATA3[15:0]
Reset value0000000000000000
0x8CADC_JDR4Res.JDATA4[15:0]
Reset value0000000000000000
0x90-0x9CReservedRes.
0xA0ADC_AWD2CRRes.AWD2CH[19:0]
Reset value00000000000000000000
0xA4ADC_AWD3CRRes.AWD3CH[19:0]
Reset value00000000000000000000
0xA8-0xACReservedRes.
0xB0ADC_DIFSELRes.DIFSEL[19:0]
Reset value00000000000000000000
0xB4ADC_CALFACTRes.CALFACT_D[6:0]Res.Res.CALFACT_S[6:0]Res.
Reset value00000000000000
0xB8-0xC4ReservedRes.
0xC8ADC_ORRes.OP0
Reset value0
0xCC-0xFCReservedRes.

Table 271. ADC register map and reset values (master and slave ADC common registers)

OffsetRegister name reset value313029282726252423222120191817161514131211109876543210
0x300ADC_CSRRes.Res.Res.Res.Res.JQOVF_SLVAWD3_SLVAWD2_SLVAWD1_SLVJEOS_SLVJEOC_SLVOVR_SLVEOS_SLVEOC_SLVEOSMP_SLVADDRDY_SLVRes.Res.Res.Res.Res.JQOVF_MSTAWD3_MSTAWD2_MSTAWD1_MSTJEOS_MSTJEOC_MSTOVR_MSTEOS_MSTEOC_MSTEOSMP_MSTADDRDY_MST
slave ADC2master ADC1
Reset value0000000000000000000000
0x304ReservedRes.
0x308ADC_CCRRes.Res.Res.Res.Res.Res.Res.VBATENTSENVREFENPRESC[3:0]CKMODE[1:0]MDMA[1:0]DMACFGRes.DELAY[3:0]Res.Res.Res.DUAL[4:0]
Reset value000000000000000000000

Table 271. ADC register map and reset values (master and slave ADC common registers) (continued)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x30CADC_CDRRDATA_SLV[15:0]
Reset value00000000000000000000000000000000
0x310-
0x3EC
ReservedResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResRes

Refer to Section 2.3 on page 115 for the register boundary addresses.