21. Analog-to-digital converters (ADC)

21.1 ADC introduction

This section describes the implementation of up to 3 ADCs:

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

Each ADC has up to 14 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 (default configuration) 32-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.

21.2 ADC main features

Figure 85 shows the block diagram of one ADC.

21.3 ADC implementation

Table 136. ADC features

ADC modes/featuresADC1, ADC2(1)ADC3(2)
Resolution12 bits
Maximum sampling speed2 Msps
(12-bit resolution)
Dual mode operationX-
Offset calibrationX
Single-end inputX
Differential input-
Injected channel conversionX
Oversamplingup to x1024
Data register32 bits
DMA supportX
Parallel data output to MDF and ADF-
Offset compensationX
Gain compensationX
Number of analog watchdog3

1. Only available on STM32C55x/562/59x/5A3 devices.

2. Only available on STM32C59x/5A3 devices.

21.4 ADC functional description

21.4.1 ADC block diagram

Figure 85 shows the ADC block diagram and Table 137 gives the ADC pin description.

Figure 85. ADC block diagram

A detailed block diagram of the ADC peripheral. It shows the flow from analog input channels (ADC_INi) through input selection and scan control to a SAR ADC. The SAR ADC is connected to a bias and reference section, an oversampler, and an AHB interface. Various triggers (EXTEN, JEXTEN) and watchdog timers (AWD1, AWD2, AWD3) are also integrated into the system. Power supply pins VDDA and VREF+/- are shown at the top and bottom respectively.

The diagram illustrates the internal architecture of the ADC. Key components include:

A detailed block diagram of the ADC peripheral. It shows the flow from analog input channels (ADC_INi) through input selection and scan control to a SAR ADC. The SAR ADC is connected to a bias and reference section, an oversampler, and an AHB interface. Various triggers (EXTEN, JEXTEN) and watchdog timers (AWD1, AWD2, AWD3) are also integrated into the system. Power supply pins VDDA and VREF+/- are shown at the top and bottom respectively.

MSv75338V2

21.4.2 ADC pins and internal signals

Table 137. ADC input/output pins

Pin nameSignal typeDescription
VDDAInput, analog supplyAnalog power supply
VSSAInput, analog supply groundGround for analog power supply, equal to VSS.
VREF+Input, analog reference positiveThe higher/positive reference voltage for the ADC.
VREF-Input, analog reference negativeThe lower/negative reference voltage for the ADC.
ADCx_INiExternal analog input signals14 external analog input channels (refer to Section 21.4.4: ADC connectivity for details)

Table 138. ADC internal input/output signals

Internal signal nameSignal typeDescription
VINiAnalog input channelsInternal analog input channels connected either to ADCx_INi 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_awdyOutputInternal analog watchdog output signal connected to on-chip timers. (y = Analog watchdog number 1,2,3)
adc_ker_ckInputADC kernel clock
adc_hclkInputADC peripheral clock
adc_itOutputADC interrupt
adc_dmaOutputADC DMA request

Table 139. ADC1/2/3 interconnection

Signal nameSource/destination
ADC1 VIN[13]VREFINT (output voltage from internal reference voltage or dac_int1)
ADC1 VIN[12]VSENSE (internal temperature sensor output voltage)
adc_ext_trg0exti11
adc_ext_trg1tim1_oc1
adc_ext_trg2tim1_oc2
adc_ext_trg3tim1_oc3
adc_ext_trg4tim1_trgo
adc_ext_trg5tim1_trgo2

Table 139. ADC1/2/3 interconnection (continued)

Signal nameSource/destination
adc_ext_trg6tim2_oc2
adc_ext_trg7tim2_trgo
adc_ext_trg8Reserved
adc_ext_trg9Reserved
adc_ext_trg10tim5_oc4(1)
adc_ext_trg11tim5_trgo(1)
adc_ext_trg12tim6_trgo
adc_ext_trg13tim8_trgo
adc_ext_trg14tim8_trgo2
adc_ext_trg15tim15_trgo
adc_ext_trg16lptim1_ch1
adc_ext_trg17Reserved
adc_ext_trg18Reserved
adc_ext_trg19Reserved
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_trg0exti15
adc_jext_trg1tim1_oc4
adc_jext_trg2tim1_trgo
adc_jext_trg3tim1_trgo2
adc_jext_trg4tim2_oc1
adc_jext_trg5tim2_trgo
adc_jext_trg6Reserved
adc_jext_trg7Reserved
adc_jext_trg8Reserved

Table 139. ADC1/2/3 interconnection (continued)

Signal nameSource/destination
adc_jext_trg9Reserved
adc_jext_trg10tim5_oc1(1)
adc_jext_trg11tim5_oc2(1)
adc_jext_trg12tim5_oc3(1)
adc_jext_trg13tim5_trgo(1)
adc_jext_trg14tim7_trgo
adc_jext_trg15tim8_oc4
adc_jext_trg16tim8_trgo
adc_jext_trg17tim8_trgo2
adc_jext_trg18tim12_trgo
adc_jext_trg19tim15_trgo
adc_jext_trg20lptim1_ch1
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

1. Reserved on STM32C53x/542 devices.

21.4.3 ADC clocks

Dual clock domain architecture

The dual clock-domain architecture means that the ADC kernel clock is independent from the AHB bus clock that is used to access ADC registers.

The adc_ker_ck input clock can be selected between different clock sources (see Figure 86: ADC clock scheme). This selection is done in the RCC (refer to section Reset and clock control (RCC) for more information):

  1. 1. The ADC clock can be provided by an internal or external clock source, which is independent and asynchronous from the AHB clock.
  2. 2. The ADC clock can be derived from AHB clock (selected in RCC).

Option 1 has the advantage of achieving the maximum ADC clock frequency whatever the AHB clock scheme selected.

Option 2 corresponds to a pseudosynchronous clock. This can be useful when the ADC is triggered by a timer and the application requires that the ADC is accurately triggered without any uncertainty (otherwise, an uncertainty of the trigger instant time is added by the resynchronizations between the two clock domains). This accurate trigger is supported only by trgo or trgo2 timer triggers.

For further details on the synchronization between ADC and timers, refer to section ADC synchronization in each timer section, and to section Peripheral clock distribution in the RCC section.

The clock is configured through the RCC and must be compliant with the operating frequency specified in the device datasheet.

Figure 86. ADC clock scheme

Block diagram of ADC clock scheme showing RCC (Reset and clock controller) connected to ADC12 or ADC3 via adc_hclk and adc_ker_ck lines. The ADC block contains an AHB interface and Analog ADC1, 2, 3 components.

The diagram illustrates the ADC clock scheme. On the left is a block labeled 'RCC (Reset and clock controller)'. On the right is a larger block labeled 'ADC12 or ADC3'. Inside the ADC block, there is an 'AHB interface' and an 'Analog ADC1, 2, 3' component. Two clock lines connect the RCC to the ADC: 'adc_hclk' connects to the 'AHB interface', and 'adc_ker_ck(1)' connects to the 'Analog ADC1, 2, 3' component. The frequency of the kernel clock is indicated as \(F_{adc\_ker\_ck}\). A note at the bottom left states '(1): Refer to RCC section for the exact clock naming.' and a reference code 'MSv71209V2' is at the bottom right.

Block diagram of ADC clock scheme showing RCC (Reset and clock controller) connected to ADC12 or ADC3 via adc_hclk and adc_ker_ck lines. The ADC block contains an AHB interface and Analog ADC1, 2, 3 components.

Clock ratio constraint between ADC clock and AHB clock

There are no constraints to respect for the ratio between the ADC clock and the AHB clock. However, the ratio must be carefully chosen to avoid any overrun especially if the clock AHB is much slower than the ADC clock.

When adc_hclk operates at a higher frequency than adc_ker_ck, writing to the AHB register does not immediately update the ADC configuration due to clock domain crossing delays. To guarantee that the configuration is properly applied within the adc_ker_ck domain, it is necessary to wait for four adc_ker_ck clock cycles after the AHB register update.

21.4.4 ADC connectivity

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

Figure 87. ADC1 connectivity

Block diagram of ADC1 connectivity showing 12 external input channels (ADC1_IN0 to ADC1_IN11) and two internal sources (VSENSE, VREFINT) connected to a channel selection multiplexer. The multiplexer output is the VIN input of the SAR ADC1, which is also connected to VREF+ and VREF- reference inputs.

The diagram illustrates the ADC1 connectivity. On the left, there are 12 external input channels labeled ADC1_IN0 through ADC1_IN11 (with ADC1_IN2(1), ADC1_IN5(1), ADC1_IN6(1), ADC1_IN7(1) having footnote references). Below these are two internal sources: VSENSE and VREFINT. Each of these 14 inputs is connected to a corresponding input labeled VIN[0] through VIN[13] inside the ADC1 block. A vertical dashed line indicates the 'Channel selection' mechanism. The selected line feeds into VIN of the SAR ADC1 block. The SAR ADC1 block is also connected to VREF+ at the top and VREF- at the bottom. Reference MSv75339V2 is in the lower right corner.

Block diagram of ADC1 connectivity showing 12 external input channels (ADC1_IN0 to ADC1_IN11) and two internal sources (VSENSE, VREFINT) connected to a channel selection multiplexer. The multiplexer output is the VIN input of the SAR ADC1, which is also connected to VREF+ and VREF- reference inputs.
  1. 1. On the STM32C53x/542 devices, these external channels can be connected to two GPIOs selected through the SBS_PMCR register.

Figure 88. ADC2 connectivity

Schematic diagram of ADC2 connectivity showing 14 input channels (ADC2_IN0 to ADC2_IN13) connected to a channel selection multiplexer, which then feeds into a SAR ADC2 block. The SAR ADC2 is powered by VREF+ and VREF-.

The diagram illustrates the ADC2 connectivity. On the left, 14 input pins are listed: ADC2_IN0, ADC2_IN1, ADC2_IN2, ADC2_IN3, ADC2_IN4, ADC2_IN5, ADC2_IN6, ADC2_IN7, ADC2_IN8, ADC2_IN9, ADC2_IN10, ADC2_IN11, ADC2_IN12, and ADC2_IN13. Each input pin is connected to a corresponding internal node: VIN[0] through VIN[13]. These nodes are connected to a vertical bus. A horizontal line labeled 'Channel selection' intersects this bus, with 14 switch symbols indicating the selection of one of the 14 channels. The output of the channel selection is labeled VIN and is connected to the input of a block labeled 'SAR ADC2'. The SAR ADC2 block has two reference voltage inputs: VREF+ and VREF-. The entire diagram is enclosed in a box. In the bottom right corner of the box, the text 'MSv75340V1' is present.

Schematic diagram of ADC2 connectivity showing 14 input channels (ADC2_IN0 to ADC2_IN13) connected to a channel selection multiplexer, which then feeds into a SAR ADC2 block. The SAR ADC2 is powered by VREF+ and VREF-.

Figure 89. ADC3 connectivity

Block diagram of ADC3 connectivity showing 14 input channels (ADC3_IN0 to ADC3_IN13) connected to an internal ADC3 block. The inputs pass through a channel selection multiplexer to the SAR ADC3 core, which is powered by V_REF+ and V_REF-.

The diagram illustrates the ADC3 connectivity. On the left, 14 input channels are listed: ADC3_IN0, ADC3_IN1, ADC3_IN2, ADC3_IN3, ADC3_IN4, ADC3_IN5, ADC3_IN6, ADC3_IN7, ADC3_IN8, ADC3_IN9, ADC3_IN10, ADC3_IN11, ADC3_IN12, and ADC3_IN13. Each input channel is connected to a corresponding input pin within the ADC3 block, labeled VIN[0] through VIN[13]. A vertical dashed line labeled 'Channel selection' indicates a multiplexer that selects one of these inputs. The selected input, VIN, is then fed into the SAR ADC3 core. The SAR ADC3 core has two reference voltage inputs: VREF+ and VREF-. The entire ADC3 block is enclosed in a box. The reference VREF+ is connected to the top of the SAR ADC3 block, and VREF- is connected to the bottom. The output of the SAR ADC3 is labeled VIN.

MSv76719V1

Block diagram of ADC3 connectivity showing 14 input channels (ADC3_IN0 to ADC3_IN13) connected to an internal ADC3 block. The inputs pass through a channel selection multiplexer to the SAR ADC3 core, which is powered by V_REF+ and V_REF-.

21.4.5 Slave AHB interface

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

The AHB slave interface does not support split/retry requests, and it can generate AHB error in case of wrong HSIZE.

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

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

To activate the ADC, first exit the Deep-power-down mode by clearing the DEEPPWD bit.

Then, it is mandatory to enable the ADC internal voltage regulator by setting the ADVREGEN bit of the 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 the device datasheet for \(T_{ADCVREG\_STUP}\) parameter.

When ADC operations are complete, the ADC can be disabled by clearing the ADEN bit of the ADC_CR register. Power can then be saved by disabling the ADC voltage regulator (by clearing ADVREGEN).

Additional power can be saved by entering ADC Deep-power-down mode again (by setting DEEPPWD of ADC_CR register). This is particularly interesting before entering Stop mode.

Note: Setting DEEPPWD automatically disables the ADC voltage regulator and the ADVREGEN bit is automatically cleared.

When the internal voltage regulator is disabled (ADVREGEN cleared), 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 reapply the calibration factor, which was previously saved (refer to Section Calibration).

21.4.7 Calibration (ADCAL, ADC_CALFACT)

Each ADC provides an automatic calibration procedure that drives all the calibration sequences including the power-on/off sequence of the ADC. During the procedure, the ADC calculates a calibration factor, which is 7-bit wide and 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 is initiated by software by setting bit ADCAL = 1. Calibration can only be initiated when the ADC is disabled (when ADEN = 0). The 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[6:0] of the ADC_CALFACT register.

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 reenabling the ADC.

The internal analog calibration is lost each time the power of the ADC is removed (for example, when the product enters Standby). In this case, to avoid spending time recalibrating the ADC, it is possible to rewrite 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 the \(V_{REF+}\) voltage changed more than 10% (see Section 21.4.31: Monitoring the internal voltage reference).

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

Figure 90. ADC calibration

Timing diagram for ADC calibration showing ADCAL, ADC State, and CALFACT[6:0] signals over time.

The diagram illustrates the ADC calibration process. It shows three main signals over time:

Below the signals, there are two boxes indicating the control signals:

A note in the bottom right corner states "Indicative timings". The diagram is labeled "MSv75341V1" in the bottom right corner.

Timing diagram for ADC calibration showing ADCAL, ADC State, and CALFACT[6:0] signals over time.

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

Figure 91. Updating the ADC calibration factor

Timing diagram for updating the ADC calibration factor. The diagram shows the sequence of events for updating the calibration factor from F1 to F2. It includes signals for ADC state (Ready to Converting channel), Internal calibration factor[6:0], Start conversion (hardware or software), WRITE ADC_CALFACT, and CALFACT[6:0]. A legend indicates that a rising edge on WRITE ADC_CALFACT is a software (S/W) trigger, while a rising edge on Start conversion is a hardware (H/W) trigger. The update occurs during a conversion cycle.

The diagram illustrates the process of updating the ADC calibration factor. It shows the following signals and states over time:

A legend at the bottom indicates that a rising edge on WRITE ADC_CALFACT is a software (S/W) trigger, and a rising edge on Start conversion is a hardware (H/W) trigger.

MSv75342V1

Timing diagram for updating the ADC calibration factor. The diagram shows the sequence of events for updating the calibration factor from F1 to F2. It includes signals for ADC state (Ready to Converting channel), Internal calibration factor[6:0], Start conversion (hardware or software), WRITE ADC_CALFACT, and CALFACT[6:0]. A legend indicates that a rising edge on WRITE ADC_CALFACT is a software (S/W) trigger, while a rising edge on Start conversion is a hardware (H/W) trigger. The update occurs during a conversion cycle.

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

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

Once DEEPPWD is cleared and ADVREGEN is set, the ADC can be enabled. It requires a \(t_{STAB}\) stabilization time before starting converting accurately (see Figure 92).

Two control bits enable or disable the ADC:

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

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

Software procedure to enable the ADC

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

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 all regular and injected ongoing conversions by setting ADSTP and JADSTP. Then wait until ADSTP = 0 and JADSTP = 0.
  2. 2. Set ADDIS.
  3. 3. If required by the application, wait for ADEN = 0, until the analog ADC is effectively disabled (ADDIS is automatically reset once ADEN = 0).

Figure 92. Enabling/disabling the ADC

Timing diagram showing enabling and disabling sequences for ADC with signals ADEN, ADRDY, ADDIS, and ADC state transitioning through OFF, Startup, RDY, Converting CH, RDY, REQ-OF, OFF.

by S/W \(\boldsymbol{\lceil}\) by H/W \(\boldsymbol{\rceil}\)

MSv62472V1

Timing diagram showing enabling and disabling sequences for ADC with signals ADEN, ADRDY, ADDIS, and ADC state transitioning through OFF, Startup, RDY, Converting CH, RDY, REQ-OF, OFF.

21.4.9 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) and configure the ADEN bit in the ADC_CR register, only if the ADC is disabled (ADEN must be cleared).

The software can write the ADSTART, JADSTART and ADDIS control bits in 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).

The following constraints apply to all the other control bits of the ADC_CFGRx, ADC_SMPRx, ADC_TRy, ADC_SQRy, ADC_JDRy, ADC_OFRy, ADC_OFCHRy and ADC_IER registers:

RM0522 Analog-to-digital converters (ADC)

RM0522 Rev 1 575/2572

The software is allowed to write the ADSTP or JADSTP control bits in the ADC_CR register only if the ADC is enabled and if there is no pending request to disable the ADC.

Note: Not all forbidden write accesses to ADC control bits are protected by hardware. In some cases, the ADC state may become unknown. To recover from this situation, the ADC must be disabled (ADEN = 0 as well as all the bits of the ADC_CR register).

21.4.10 Channel selection (ADC_SQRy, ADC_JSQR)

The ADC features up to 14 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 VREFEN, TSEN in the ADCC_CCR registers.

Refer to ADC interconnection tables in Section 21.4.2: ADC pins and internal signals for the connection of the above internal analog inputs to ADC pins.

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: ADCx_IN3, ADCx_IN8, ADCx_IN2, ADCx_IN2, ADCx_IN0, ADCx_IN2, and ADCx_IN2.

ADC_SQRy registers must not be modified while a regular conversion is ongoing. ADC regular conversions must consequently be stopped by setting ADSTP (refer to Section 21.4.18: Stopping an ongoing conversion (ADSTP, JADSTP)).

21.4.11 Channel preselection register (ADC_PCSEL)

The PCSEL bit of the ADC_PCSEL register controls the analog switch integrated in the I/O.

For each channel selected through SQRx or JSQRx bits, the corresponding PCSEL bit must be configured in advance in the ADC_PCSEL register. The ADC input multiplexer selects the ADC input according to SQRx and JSQRx configuration with very high speed. The analog switch integrated in the I/O cannot react as fast as the ADC multiplexer. To avoid the delay due to the analog switch control on the I/O, it is necessary to preselect the input channels that are selected through the SQRx and JSQRx. The selection is based on the \(V_{IN}\) of each ADC input. For example, if the ADC converts ADCx_IN1, PCSEL1 bit must also be set in ADC_PCSEL register.

Note: Configuring the PCSEL bit is not necessary for the internal channels (such as \(V_{REFINT}\)).

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

Before starting a conversion, the ADC must establish a direct connection between the voltage source under measurement and the embedded sampling capacitor of the ADC. This sampling time must be sufficient 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 through the SMP[2:0] bits of 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 (12-bit mode):

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

Example

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

\[T_{\text{CONV}} = (3 + 13) \times \text{ADC clock cycles} = 16 \text{ ADC clock cycles} = 500 \text{ ns}\]

The ADC notifies the end of the sampling phase by asserting the EOSMP flag (only for regular conversion).

Constraints on the sampling time

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

Bulb sampling mode

The bulb sampling mode enables to obtain longer sampling time.

When the BULB bit is set in the ADC_CFGR2 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_SMPRx registers. 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).

Bulb mode is supported exclusively in regular conversion; dual mode is not supported.

The BULB bit can be modified only when the ADEN bit of the ADC_CR register is cleared.

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

Figure 93. Bulb mode timing diagram

Timing diagram for Bulb mode showing ADC state and Trigger signals for Normal and Bulb modes.

The diagram illustrates the timing for ADC states and trigger signals in two modes: Normal (discontinuous) mode and Bulb (discontinuous) mode.

Normal (discontinuous) mode:

ADC stateidlesampleconversionidlesampleconversionidle

Trigger signal: A rising edge starts the 'sample' phase, and a falling edge starts the 'conversion' phase.

Bulb (discontinuous) mode:

ADC stateidlesampleconversionsampleconversionsample

Trigger signal: A rising edge starts the 'sample' phase, and a falling edge starts the 'conversion' phase. A second rising edge starts another 'sample' phase.

Sampling time programmed in SMP bits: Indicated by a double-headed arrow between the start of the second 'sample' phase and the start of the 'conversion' phase.

MSv46157V3

Timing diagram for Bulb mode showing ADC state and Trigger signals for Normal and Bulb modes.

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 (EXTEN[1:0] = 01), each rising edge of the trigger signal starts the sampling period. A falling edge ends the sampling period and starts the conversion.

Due to the synchronization mechanism, the minimum allowed pulse width is seven adc_ker_ck periods.

When a software trigger is selected (EXTEN[1:0] = 00), the software trigger is not the ADSTART bit of ADC_CR but the SWTRIG bit. The SWTRIG bit has to be set to start the sampling period, and it has to be cleared to end the sampling period and start the conversion. In this mode, the minimum sampling time is limited to seven ADC clock cycles.

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

This mode is only compatible with the discontinuous mode. DISCNUM must be cleared for regular conversion mode. It is not supported for injected conversion mode and autoinjection mode.

When the SMPTRIG bit is set, setting the BULB bit is not allowed and only regular conversion is supported.

The sampling time control trigger mode is not compatible with the following dual modes: DUAL[4:0] = 0b00010, 0b00011, 0b00101, 0b00110, 0b00111, and 0b01001.

21.4.13 Single conversion mode

To enable the single conversion mode for regular channels, clear both CONT and DISCEN bits in ADC_CFGR1 register. To enable it on injected channel, clear JDISCEN bit.

In single conversion mode, the ADC performs once all the regular conversions of the programmed channels. This mode is started by one of the following events:

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:

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

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

21.4.14 Continuous conversion mode (CONT = 1)

This mode applies to regular channels only.

In continuous conversion mode, when a software or hardware regular trigger event occurs, the ADC performs once all the regular conversions of the channels and then automatically restarts and continuously converts all the conversions of the sequence. This mode is started by setting the CONT bit of the ADC_CFGR1 register, either by an 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, this means that it is forbidden to set both DISCEN and CONT bits.

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 Section : Autoinjection mode).

21.4.15 Discontinuous mode (DISCEN, DISCNUM, JDISCEN)

Regular group mode

This mode is enabled by setting the DISCEN and CONT = 0 bit in the ADC_CFGR1 register.

It is used to convert a short sequence (subgroup) of n conversions (n ≤ 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_CFGR1 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 LEN[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 devices.

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

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

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

Injected group mode

This mode is enabled by setting the JDISCEN bit in the ADC_CFGR1 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 with DISCNUM = 0.

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 JLEN[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 devices.

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

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

21.4.16 Starting conversions (ADSTART, JADSTART)

ADC regular conversions can be started by setting ADSTART.

When ADSTART is set, the conversion starts:

The application software starts ADC injected conversions by setting JADSTART.

When JADSTART is set, the conversion starts:

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

When the hardware trigger is enabled, ADSTART and JADSTART also indicate whether an ADC operation is ongoing. The ADC can be reconfigured while ADSTART and JADSTART are both cleared, indicating that the ADC is idle.

In the case of software triggering, ADSTP and/or JADSTP must be set before ADC reconfiguration.

ADSTART is deasserted by hardware:

Note: In continuous mode (CONT = 1), ADSTART is not deasserted by hardware when EOS is asserted because the sequence is automatically relaunched.

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

JADSTART is deasserted by hardware:

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

In bulb mode (BULB = 1), the previous end-of-conversion automatically starts the sampling, then setting ADSTART starts the conversion including the programmed sampling time.

In sampling time control trigger mode (SMPTRIG = 1), SWTRIG bit must be set to start the conversion.

21.4.17 Timing

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

\[T_{CONV} = T_{SMPL} + T_{SAR} = [3_{|min} + 13_{|12bit}] \times T_{ADC\_CLK}\]

\[T_{CONV} = T_{SMPL} + T_{SAR} = 93.75 \text{ ns}_{|min} + 406.25 \text{ ns}_{|12bit} = 500 \text{ ns} \text{ (for } F_{adc\_ker\_ck} = 32 \text{ MHz)}\]

Figure 94. Analog-to-digital conversion time

Timing diagram for analog-to-digital conversion showing ADC state, Analog channel, Internal S/H, ADSTART, EOSMP, EOC, and ADC_DR signals over time. It details sampling and conversion phases for channels N and N+1, with timing parameters t_SMPL and t_SAR.

The diagram illustrates the timing sequence for an analog-to-digital conversion. It shows the following signals and their states:

Indicative timings are shown for the sampling time \(t_{SMPL}^{(2)}\) and the conversion time \(t_{SAR}^{(3)}\).

Timing diagram for analog-to-digital conversion showing ADC state, Analog channel, Internal S/H, ADSTART, EOSMP, EOC, and ADC_DR signals over time. It details sampling and conversion phases for channels N and N+1, with timing parameters t_SMPL and t_SAR.
  1. 1. AIN represents the input voltage captured by the internal Sample and Hold (S/H) capacitor.
  2. 2. \(t_{SMPL}\) depends on SMP[2:0].
  3. 3. \(t_{SAR}\) depends on RES[2:0].

Note: The bulb and the sampling time control trigger modes are not described in Figure 94: Analog-to-digital conversion time.

21.4.18 Stopping an ongoing conversion (ADSTP, JADSTP)

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

Stopping conversions resets the ongoing ADC operation. The ADC can then be reconfigured (for example by changing the channel selection or the trigger). It is then ready for a new operation.

Injected conversions can be stopped while regular conversions are still ongoing and vice versa. This allows, for instance, the reconfiguration of the injected conversion sequence and triggers while regular conversions are still ongoing (and vice versa).

When the ADSTP bit is set by software, any ongoing regular conversion is aborted with the partial result discarded (the 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 (the ADC_JDRy register is not updated with the current conversion). The scan sequence is also aborted and reset (meaning that relaunching the ADC restarts a new sequence).

Once this procedure is complete, ADSTP/ADSTART bits (for regular conversion), or JADSTP/JADSTART bits (for injected conversion) are deasserted by hardware and the software must poll ADSTART (or JADSTART) until the bit is reset before assuming the ADC is completely stopped.

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

Figure 95. Stopping ongoing regular conversions

Timing diagram for stopping ongoing regular conversions. It shows the sequence of events for ADC state, JADSTART, ADSTART, ADSTP, and ADC_DR. The ADC state transitions through RDY, Sample Ch(N-1), Convert Ch(N-1), RDY, Sample Ch(N), C, and back to RDY. Triggers are shown at the start of sampling and conversion. ADSTART is set by software and cleared by hardware. ADSTP is set by software and cleared by hardware. ADC_DR shows data N-2 and data N-1.

ADC state: RDY → Sample Ch(N-1) → Convert Ch(N-1) → RDY → Sample Ch(N) → C → RDY

Triggers: Trigger (at start of Sample Ch(N-1)), Trigger (at start of Sample Ch(N))

JADSTART: High level

ADSTART: Set by SW → HIGH (REGULAR CONVERSIONS ongoing) → Cleared by HW

ADSTP: Set by SW → HIGH → Cleared by HW

ADC_DR: Data N-2 → Data N-1

MS30533V2

Timing diagram for stopping ongoing regular conversions. It shows the sequence of events for ADC state, JADSTART, ADSTART, ADSTP, and ADC_DR. The ADC state transitions through RDY, Sample Ch(N-1), Convert Ch(N-1), RDY, Sample Ch(N), C, and back to RDY. Triggers are shown at the start of sampling and conversion. ADSTART is set by software and cleared by hardware. ADSTP is set by software and cleared by hardware. ADC_DR shows data N-2 and data N-1.

Figure 96. Stopping ongoing regular and injected conversions

Timing diagram for stopping ongoing regular and injected conversions. It shows the sequence of events for ADC state, JADSTART, JADSTP, ADSTART, ADSTP, ADC_JDR, and ADC_DR. The ADC state transitions through RDY, Sample Ch(N-1), Convert Ch(N-1), RDY, Sample Ch(M), C, RDY, Sample, and back to RDY. Triggers are shown for regular and injected conversions. JADSTART is set by software and cleared by hardware. JADSTP is set by software and cleared by hardware. ADSTART is set by software and cleared by hardware. ADSTP is set by software and cleared by hardware. ADC_JDR shows data M-1. ADC_DR shows data N-2 and data N-1.

ADC state: RDY → Sample Ch(N-1) → Convert Ch(N-1) → RDY → Sample Ch(M) → C → RDY → Sample → RDY

Triggers: Regular trigger (at start of Sample Ch(N-1)), Injected trigger (at start of Sample Ch(M)), Regular trigger (at start of Sample)

JADSTART: Set by SW → HIGH (INJECTED CONVERSIONS ongoing) → Cleared by HW

JADSTP: Set by SW → HIGH → Cleared by HW

ADC_JDR: DATA M-1

ADSTART: Set by SW → HIGH (REGULAR CONVERSIONS ongoing) → Cleared by HW

ADSTP: Set by SW → HIGH → Cleared by HW

ADC_DR: DATA N-2 → DATA N-1

MS30534V2

Timing diagram for stopping ongoing regular and injected conversions. It shows the sequence of events for ADC state, JADSTART, JADSTP, ADSTART, ADSTP, ADC_JDR, and ADC_DR. The ADC state transitions through RDY, Sample Ch(N-1), Convert Ch(N-1), RDY, Sample Ch(M), C, RDY, Sample, and back to RDY. Triggers are shown for regular and injected conversions. JADSTART is set by software and cleared by hardware. JADSTP is set by software and cleared by hardware. ADSTART is set by software and cleared by hardware. ADSTP is set by software and cleared by hardware. ADC_JDR shows data M-1. ADC_DR shows data N-2 and data N-1.

21.4.19 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 (for example 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.

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

All hardware triggers that occur while a conversion is ongoing are ignored:

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

Table 140. 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 (sampling time controlled in SMPTRIG mode)
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 141. Configuring the trigger polarity for injected external triggers

JEXTEN[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

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

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

Figure 97. Triggers shared between ADC master and slave

Block diagram showing trigger sharing between ADC master and slave. It illustrates the connections for regular and injected sequencer triggers (adc_ext_trg0 to adc_ext_trg31 and adc_jext_trg0 to adc_jext_trg31) to the EXTSEL and JEXTSEL registers of both the ADC MASTER and ADC SLAVE blocks.

The diagram illustrates the trigger sharing mechanism between an ADC MASTER and an ADC SLAVE. On the left, two groups of external triggers are shown: 'Regular sequencer triggers' (adc_ext_trg0 to adc_ext_trg31) and 'Injected sequencer triggers' (adc_jext_trg0 to adc_jext_trg31). These triggers are connected to multiplexers within both the ADC MASTER and ADC SLAVE blocks. In the ADC MASTER, the regular triggers are connected to the EXTSEL[3:0] register (labeled 'External regular trigger') and the injected triggers are connected to the JEXTSEL[4:0] register (labeled 'External injected trigger'). Similarly, in the ADC SLAVE, the same trigger lines are connected to its own EXTSEL[3:0] and JEXTSEL[4:0] registers. The diagram shows that both the master and slave can be triggered by the same set of external signals.

Block diagram showing trigger sharing between ADC master and slave. It illustrates the connections for regular and injected sequencer triggers (adc_ext_trg0 to adc_ext_trg31 and adc_jext_trg0 to adc_jext_trg31) to the EXTSEL and JEXTSEL registers of both the ADC MASTER and ADC SLAVE blocks.

MSv46156V1

Refer to ADC interconnection tables in Section 21.4.2: ADC pins and internal signals for the list of the external triggers.

21.4.20 Injected channel management

Triggered injection mode

To use triggered injection, the JAUTO bit in the ADC_CFGR1 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 if JDISCEN = 0).
  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.
  5. Figure 98 shows the corresponding timing diagram.

Note: When using triggered injection, one must ensure that the interval between trigger events is longer than the injection sequence.

Figure 98. Injected conversion latency during ongoing regular conversion

Timing diagram showing injected conversion latency during ongoing regular conversion. The diagram includes four signals: adc_ker_ck (clock), Injection event (a single pulse), Reset ADC (a low pulse), and Start of sampling (a low pulse). The latency is measured from the rising edge of the Injection event to the rising edge of the Start of sampling. The Reset ADC signal is active low and starts after the Injection event. The Start of sampling signal is active low and starts after the Reset ADC signal. The latency is labeled as 'max. latency (1)'.

MSv69546V2

Timing diagram showing injected conversion latency during ongoing regular conversion. The diagram includes four signals: adc_ker_ck (clock), Injection event (a single pulse), Reset ADC (a low pulse), and Start of sampling (a low pulse). The latency is measured from the rising edge of the Injection event to the rising edge of the Start of sampling. The Reset ADC signal is active low and starts after the Injection event. The Start of sampling signal is active low and starts after the Reset ADC signal. The latency is labeled as 'max. latency (1)'.
  1. 1. The maximum latency value can be found in the electrical characteristics of the device datasheet.

Autoinjection mode

If the JAUTO bit in the ADC_CFGR1 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.

Note: Autoinjection mode is compatible with discontinuous mode.

21.4.21 Programmable resolution (RES) - fast conversion mode

Faster conversions can be performed by reducing the ADC resolution.

The resolution can be configured to be either 12, 10, 8, or 6 bits by programming the RES[1:0] control bits. Figure 103, Figure 104, Figure 105 and Figure 106 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 142.

Table 142.\(T_{SAR}\) timings depending on resolution
RES
(bits)
\(T_{SAR}\)
(ADC clock cycles)
\(T_{SAR}\) (ns) at
\(F_{adc\_ker\_ck} = 32\)
MHz
\(T_{CONV}\) (ADC clock cycles)
(with Sampling time=
3 ADC clock cycles)
\(T_{CONV}\) (ns) at
\(F_{adc\_ker\_ck} = 32\)
MHz
1213 ADC clock cycles406.25 ns16 ADC clock cycles500.0 ns
1011 ADC clock cycles343.75 ns14 ADC clock cycles437.5 ns
89 ADC clock cycles281.25 ns12 ADC clock cycles375.3 ns
67 ADC clock cycles218.75 ns10 ADC clock cycles312.5 ns

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

The ADC notifies the application at the end of each regular conversion (EOC) event and 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 the EOCIE bit is set. The software can clear the EOC flag either by programming it to 1 or by reading ADC_DR. If ADC_DR FIFO is not emptied, the EOC flag is set again and an interrupt can be generated again.

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

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

21.4.23 End of conversion sequence (EOS, JEOS)

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

The ADC sets the EOS flag as soon as the conversion of the last data of the regular sequence is complete. An interrupt can be generated if the EOSIE bit is set. The EOS flag is cleared by the software by programming it to 1.

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

21.4.24 Timing diagram examples (single/continuous modes, hardware/software triggers)

Figure 99. Single conversions of a sequence, software trigger

Timing diagram for single conversions of a sequence using a software trigger. Signals shown are ADSTART(1), EOC, EOS, ADC state(2) (cycling through RDY, CH1, CH9, CH10, CH17, RDY), and ADC_DR (latching D1, D9, D10, D17). Triggers indicate 'by SW' and 'by HW', with 'Indicative timings' box and drawing reference MSv30549V2.

MSv30549V2

Timing diagram for single conversions of a sequence using a software trigger. Signals shown are ADSTART(1), EOC, EOS, ADC state(2) (cycling through RDY, CH1, CH9, CH10, CH17, RDY), and ADC_DR (latching D1, D9, D10, D17). Triggers indicate 'by SW' and 'by HW', with 'Indicative timings' box and drawing reference MSv30549V2.
  1. 1. EXTEN[1:0] = 00, CONT = 0
  2. 2. Channels selected = 1, 9, 10, 17; AUTDLY = 0.

Figure 100. Continuous conversion of a sequence, software trigger

Timing diagram for continuous conversion of a sequence using a software trigger. Signals shown are ADSTART(1), EOC, EOS, ADSTP, ADC state(2) (cycling through READY, CH1, CH9, CH10, CH17, CH1, CH9, CH10, STP, READY), and ADC_DR (latching D1, D9, D10, D17, D1, D9). Triggers indicate 'by SW' and 'by HW', with 'Indicative timings' box and drawing reference MSv30550V2.

MSv30550V2

Timing diagram for continuous conversion of a sequence using a software trigger. Signals shown are ADSTART(1), EOC, EOS, ADSTP, ADC state(2) (cycling through READY, CH1, CH9, CH10, CH17, CH1, CH9, CH10, STP, READY), and ADC_DR (latching D1, D9, D10, D17, D1, D9). Triggers indicate 'by SW' and 'by HW', with 'Indicative timings' box and drawing reference MSv30550V2.
  1. 1. EXTEN[1:0] = 00, CONT = 1
  2. 2. Channels selected = 1, 9, 10, 17; AUTDLY = 0.

Figure 101. Single conversions of a sequence, hardware trigger

Figure 101: Single conversions of a sequence, hardware trigger timing diagram with signals ADSTART, EOC, EOS, TRGX(1), ADC state(2), and ADC_DR, showing conversion sequence across channels CH1 to CH4 with RDY and READY states, and data outputs D1 to D4.

MS31013V2

Figure 101: Single conversions of a sequence, hardware trigger timing diagram with signals ADSTART, EOC, EOS, TRGX(1), ADC state(2), and ADC_DR, showing conversion sequence across channels CH1 to CH4 with RDY and READY states, and data outputs D1 to D4.
  1. 1. TRGx (overfrequency) is selected as trigger source, EXTEN[1:0] = 01, CONT = 0
  2. 2. Channels selected = 1, 2, 3, 4; AUTDLY = 0.

Figure 102. Continuous conversions of a sequence, hardware trigger

Figure 102: Continuous conversions of a sequence, hardware trigger timing diagram with signals ADSTART, EOC, EOS, ADSTP, TRGx(1), ADC(2), and ADC_DR, showing continuous conversion sequence from CH1 through CH4 repeatedly until STOP, yielding data outputs D1 to D4.

MS31014V2

Figure 102: Continuous conversions of a sequence, hardware trigger timing diagram with signals ADSTART, EOC, EOS, ADSTP, TRGx(1), ADC(2), and ADC_DR, showing continuous conversion sequence from CH1 through CH4 repeatedly until STOP, yielding data outputs D1 to D4.
  1. 1. TRGx is selected as trigger source, EXTEN[1:0] = 10, CONT = 1.
  2. 2. Channels selected = 1, 2, 3, 4; AUTDLY = 0.

21.4.25 Data management

Data register, data alignment and offset (ADC_DR, ADC_JDRy, OFFSETy, OFFSETy_CH, OVSS, LSHIFT, JOVSS(a), JLSHIFT(a), USAT, SSAT, POSOFF)

Data and alignment

At the end of each regular channel conversion (when an EOC event occurs), the result of the converted data is stored in the 32-bit wide ADC_DR data register with FIFO (when OVRMOD = 0). Since the data register has eight levels of FIFO, the EOC flag is raised again as far as the FIFO is not emptied.

At the end of each injected channel conversion (when a JEOC event occurs), the result of the converted data is stored in the 32-bit wide corresponding ADC_JDRy data register.

The OVSS[3:0], LSHIFT[3:0], JOVSS[3:0], and JLSHIFT[3:0] bitfields in the ADC_CFGR2 register select the alignment of the data stored after the conversion. By default, data are right-aligned. Refer to Figure 103, Figure 104, Figure 105, and Figure 106 for examples of data alignment.

Note: The data can be aligned in normal and oversampling mode. The OVSS[3:0] bitfield is only effective in oversampling mode.
JOVSS[3:0] and JLSHIFT[3:0] is reserved for injected conversions. Their usage is the same as OVSS[3:0] and LSHIFT[3:0], unless otherwise specifically described.

Offset

An unsigned offset value y (y = 1, 2, 3, 4) can be applied to a channel by programming a value different from 0 in the OFFSET[21:0] bitfield of the ADC_OFRy register. The channel to which the offset is applied is programmed to the OFFSETy_CH[4:0] bits of ADC_OFCFGRy register. The offset can be positive or negative depending on the value of POSOFF bit. When POSOFF is cleared, the converted value is subtracted by the user-defined offset written in OFFSET[21:0] bits. The result can be a negative value. The read data is consequently signed and the SEXT bit represents the extended sign value.

The offset value must be lower than the maximum conversion value (for example the maximum offset value is 0xFFFF in 12-bit mode).

The offset can be used to convert unsigned data to signed data (for example the offset value is equal to 0x800 in 12-bit mode).

The offset correction is also supported in oversampling mode. In this mode, the offset is subtracted when all the oversampling operations are complete.

Note: If the OFFSET channel is selected but the offset value is 0x0000, this offset programming is ignored. If the same OFFSET channel is programmed in different registers multiple times, the first programmed register takes priority.

Table 148 describes how the computation is performed for all the possible ADC resolutions and offset settings.


a. Only for products that include this bit.

Table 143. Offset computation versus data resolution

Resolution
(RES[1:0]
bits)
Subtraction between raw
converted data and offset
ResultComments
Raw converted
Data, left aligned
Offset
00: 12-bitDATA[11:0]OFFSET[11:0]Signed or unsigned
24-bit data, right
aligned to [11:0]
-
01: 10-bitDATA[11:2],00OFFSET[11:2]Signed or unsigned
24-bit data, right
aligned to [9:0]
The user must configure OFFSET[1:0]
to 0b00.
10: 8-bitDATA[11:4],0000OFFSET[11:4]Signed or unsigned
24 bit data right
aligned to [7:0]
The user must configure OFFSET[3:0]
to 0b0000.
11: 6-bitDATA[11:6],000000OFFSET[11:6]Signed or unsigned
24 bit data right
aligned to [5:0]
The user must configure OFFSET[5:0]
to 0b000000.

Figure 103, Figure 104, Figure 105 and Figure 106 show alignments for signed and unsigned data. JOVSS and JLSHIFT are not described here, but they behave the same as OVSS and LSHIFT.

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

Diagram showing right alignment for 12-bit, 10-bit, and 8-bit data, and 12-bit data with OVSR = 1024 and OVSS = 0000 or 1010.

The diagram illustrates the right alignment of data for different resolutions and offset configurations. It shows bit positions from 31 down to 0, with specific fields for data and offset.

MSv66828V3

Diagram showing right alignment for 12-bit, 10-bit, and 8-bit data, and 12-bit data with OVSR = 1024 and OVSS = 0000 or 1010.

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

Diagram showing right alignment for various data widths (12-bit, 10-bit, 8-bit) with SEXT and data fields. Includes annotations for Signed 32-bit or 16-bit format, Signed 8-bit format, SSAT = 1, OVSS = 0000, and OVSR = 1024.

The diagram illustrates right alignment for signed values with offset enabled. It shows five horizontal bit fields for different data widths:

MSv66829V3

Diagram showing right alignment for various data widths (12-bit, 10-bit, 8-bit) with SEXT and data fields. Includes annotations for Signed 32-bit or 16-bit format, Signed 8-bit format, SSAT = 1, OVSS = 0000, and OVSR = 1024.

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

Diagram showing left alignment for various data widths (12-bit, 10-bit, 8-bit) with leading zeros and a trailing zero. Includes annotations for LSHIFT values (4, 6, 0, 10).

The diagram illustrates left alignment for unsigned values with offset disabled. It shows four horizontal bit fields for different data widths:

MSv66830V3

Diagram showing left alignment for various data widths (12-bit, 10-bit, 8-bit) with leading zeros and a trailing zero. Includes annotations for LSHIFT values (4, 6, 0, 10).

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

Figure 106: Left alignment (offset enabled, signed value) diagram showing bit layouts for 12-bit, 10-bit, 8-bit, and 32-bit data formats.

Figure 106 illustrates the bit layout for left alignment with offset enabled and signed values. The diagram shows five different data formats, each with a bit width of 32 bits (bits 31 to 0). A vertical dashed line at bit 15 indicates the sign extension point.

MSv66831V3

Figure 106: Left alignment (offset enabled, signed value) diagram showing bit layouts for 12-bit, 10-bit, 8-bit, and 32-bit data formats.

Management of signed and unsigned saturation format (SSAT, USAT)

The offset correction might result in the data width to be wider than the original data.

To limit the original data width, the data saturation can be enabled through the SSAT and USAT bits of the ADC_OFCFGRy register.

Unsigned 12-bit data can be extended to 13-bit signed data by using an offset value different from 0x800.

The original data width can be preserved by setting SSAT bit to limit the data width to 12 bits.

Unsigned data can be saturated to the original data width by setting the USAT bit.

Table 144 shows the sign-extended data format corresponding to different resolutions.

Table 144. 12-bit data formats

SSATUSATFormatData range (offset = 0x800)
00Sign-extended 13-bit significant data:
SEXT[31:13]
DATA[12:0]
0x0000 07FF - 0xFFFF F800
10Sign-extended 12-bit significant data:
SEXT[31:12]
DATA[11:0]
0x7FF - 0x800

Table 144.12-bit data formats

SSATUSATFormatData range (offset =0x800)
01Unsigned saturation 12-bit signification data:
DATA[11:0]
0xFF - 0x000
11Reserved-

Table 145 provides numerical examples for four different offset values.

Table 145. Numerical examples for 32-bit or 16-bit format (POSSPFF = 0)

Raw conversion resultOffset valueResult
SSAT = 0
USAT = 0
Result
SSAT = 0
USAT = 1
Result
SSAT = 1
USAT = 0
0xFFF0x8000x0000 07FF0x07FF0x07FF
0x8000x0000 00000x00000x0000
0x0000xFFFF F8000x00000xF800
0xFFF0x8200x0000 07DF0x07DF0x07DF
0x8000xFFFF FFE00x00000xFFE0
0x0000xFFFF F7E00x00000xF7E0
0xFFF0x7E00x0000 081F0x081F0x07FF
0x8000x0000 00200x00200x0020
0x0000xFFFF F8200x00000xF820
0xFFF0x0200x0000 0FDF0x0FDF0x0FDF
0x8000x0000 07E00x07E00x07E0
0x0000xFFFF FFE00x00000xFFE0

Caution: SSAT must not be used in conjunction with USAT. No hardware check is performed to ensure that this condition is respected.

Gain compensation

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

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

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

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

The gain compensation is also effective for the oversampling. When the gain compensation is used in oversampling mode, the gain calculation is performed after the accumulation and

right-shift operations to minimize the power consumption (the gain calculation is done only once and not at each conversion).

The internal multiplier width is 32 bits and the input data width for the gain compensation must be less than 18 bits. When using oversampling with injected and regular conversion mode, the ROVSM bit of the ADC_CFGR2 register must be set to resume the pending conversion with the correct value.

When the gain compensation is activated, the ADC data latency is increased by one clock cycle. In continuous and scan conversion modes, the ADC conversion rate does not change.

ADC overrun (OVR, OVRMOD)

The overrun flag (OVR) issues a notification that the regular converted data has not been read (by the CPU or the DMA) before the ADC_DR FIFO (eight stages) is overflowed, or adc_hclk clock is too slow to manage the data. If the CPU clears the EOC flag without reading the data register, the OVR flag may still be triggered.

The OVR flag is set when a new conversion completes while ADC_DR as single register or FIFO output is full. An interrupt is generated if the OVRIE bit is set.

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. The OVR flag is cleared by software by programming it to 1.

Data can be configured to be preserved or overwritten when an overrun event occurs by programming the control bit OVRMOD:

Figure 107. Example of overrun (OVRMOD = 0)

Timing diagram for overrun with OVRMOD = 0. It shows the relationship between ADSTART, EOC, OVR, ADSTP, TRGx, ADC state, ADC_DR read access, and ADC_DR (FIFO_DATA). The ADC state sequence is RDY, CH1, CH2, CH3, CH4, ---, CH11, CH12, CH13, STOP, RDY. Data D1-D3 are written to the first ADC_DR register. D4 is written to the second ADC_DR register. D9 and D10 are written to the third ADC_DR register. D10 and D12 are written to the fourth ADC_DR register, with 'na' (not available) for the third register's second slot. An overrun occurs when a new conversion starts before the previous one is read. The diagram shows the OVR flag going high after the overrun. Timing markers indicate 'by s/w', 'by h/w', and 'triggered' events. A box labeled 'Indicative timings' is present.

MSv69549V1

Timing diagram for overrun with OVRMOD = 0. It shows the relationship between ADSTART, EOC, OVR, ADSTP, TRGx, ADC state, ADC_DR read access, and ADC_DR (FIFO_DATA). The ADC state sequence is RDY, CH1, CH2, CH3, CH4, ---, CH11, CH12, CH13, STOP, RDY. Data D1-D3 are written to the first ADC_DR register. D4 is written to the second ADC_DR register. D9 and D10 are written to the third ADC_DR register. D10 and D12 are written to the fourth ADC_DR register, with 'na' (not available) for the third register's second slot. An overrun occurs when a new conversion starts before the previous one is read. The diagram shows the OVR flag going high after the overrun. Timing markers indicate 'by s/w', 'by h/w', and 'triggered' events. A box labeled 'Indicative timings' is present.

Figure 108. Example of overrun (OVRMOD = 1)

Timing diagram for overrun with OVRMOD = 1. It shows the relationship between ADSTART, EOC, EOS, OVR, ADSTP, TRGx, ADC state, ADC_DR read access, and ADC_DR (OVRMOD=1). The ADC state sequence is RDY, CH1, CH2, CH3, CH4, CH5, CH6, CH7, STOP, RDY. Data D1-D6 are written to the ADC_DR register. An overrun occurs when a new conversion starts before the previous one is read, indicated by an arrow pointing to the ADC_DR read access signal. The OVR flag goes high after the overrun. Timing markers indicate 'by s/w', 'by h/w', and 'triggered' events. A box labeled 'Indicative timings' is present.

MSv31019V2

Timing diagram for overrun with OVRMOD = 1. It shows the relationship between ADSTART, EOC, EOS, OVR, ADSTP, TRGx, ADC state, ADC_DR read access, and ADC_DR (OVRMOD=1). The ADC state sequence is RDY, CH1, CH2, CH3, CH4, CH5, CH6, CH7, STOP, RDY. Data D1-D6 are written to the ADC_DR register. An overrun occurs when a new conversion starts before the previous one is read, indicated by an arrow pointing to the ADC_DR read access signal. The OVR flag goes high after the overrun. Timing markers indicate 'by s/w', 'by h/w', and 'triggered' events. A box labeled 'Indicative timings' is present.

Note: Even if overrun may occur for injected channels, there is no overrun detection on these 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 errors.

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 the OVR flag must 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

When the DMA mode is enabled (DMNGT[1:0] = 01 or 11 in the ADC_CFGR1 register in single ADC mode), a DMA request is generated after each channel conversion. This allows the transfer of the converted data from the ADC_DR register to the destination location configured in the DMA.

Despite this, if an overrun occurs (OVR = 1) because the DMA cannot 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. (OVRMOD = 0).

When OVRMOD = 1, even if DMA does not transfer the data immediately, new data overwrite ADC_DR, causing DMA to potentially skip data. As a result, some conversion results may be missed in the data transferred to RAM.

Depending on the configuration of the OVRMOD bit, the data are either preserved or overwritten (refer to Section : ADC overrun (OVR, OVRMOD)). If OVRMOD = 0 (data preserved), DMA transfer requests are blocked.

DMA can be configured through the DMNGT[1:0] bitfield of the ADC_CFGR1 register. Refer to Section 21.4.29: Dual ADC modes for information on DMA usage with dual ADC mode.

DMA one-shot mode (DMNGT[1:0] = 01)

In one-shot 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 (that is when DMA_LACK interrupt occurs, see Direct-memory controller section) even if a new conversion has been started.

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

DMA circular mode (DMNGT[1:0] = 11)

In circular mode, the ADC generates a DMA transfer request each time a new conversion data is available in the data register. This allows the configuration of the DMA in circular mode to handle a continuous analog input data stream.

DMA single-transfer or burst mode with FIFO (OVRMOD = 0)

The output data register features an eight-stage FIFO. Two different DMA requests are generated in parallel. When a data is available, an “SREQ single request” is generated. When four data are available, a “BREQ burst request” is generated. The DMA can be programmed either in single-transfer mode or in burst mode (four beats). The appropriate request line is selected by the DMA according to the mode selected. Refer to Section Direct memory access controller for further information.

Due to the existence of FIFO, DMA requests are generated until the FIFO is emptied. To stop DMA requests even when the FIFO is not emptied, set the ADSTP bit.

DMA for dual mode

Refer to Section 21.4.29: Dual ADC modes.

21.4.26 Dynamic low-power features

Autodelayed conversion mode (AUTDLY)

The ADC implements an autodelayed conversion mode controlled by the AUTDLY configuration bit in ADC_CFGR1. Autodelayed conversions are useful to simplify the software as well as to optimize performance of an application clocked at low frequency where there must be risk of encountering an ADC overrun.

Regular conversion mode

When AUTDLY is set, a new conversion can start if the following conditions are met:

This is a way to automatically adapt the speed of the ADC to the speed of the system that reads the data and prevent overrun errors.

The delay is inserted after each regular conversion.

Injected conversion mode

When AUTDLY is set, a new conversion can start only if the JEOS bit has been cleared (see Figure 110). Since there are four ADC_JDRy registers, the autodelay is performed at the end on the injected conversion sequence.

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

A hardware trigger event occurring during this delay is ignored.

No delay is inserted between regular and injected conversions. The autodelay for regular and injected modes is managed separately.

Caution: The behavior is slightly different in autoinjection 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 113).

In autoinjection mode, there is no delay between the last regular conversion and the first injected conversion. The user must clear the last EOC flag before clearing the JEOS flag, otherwise the next sequence might start before EOC flag is cleared.

In autodelay 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 or the delay that follows it. The conversion then starts at the end of the delay of the injected sequence.

In autodelay mode with JAUTO = 0, 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.

Note: AUTDLY mode is not supported with SMPTRIG or BULB mode.

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

Timing diagram for AUTDLY = 1, regular conversion in continuous mode, software trigger. The diagram shows the relationship between ADSTART(1), EOC, EOS, ADSTP, ADC_DR read access, ADC state, and ADC_DR data over time. It includes a state sequence: RDY, CH1, DLY, CH2, DLY, CH3, DLY, CH1, DLY, STOP, RDY. Data is shown as D1, D2, D3, D1. Triggers are marked as 'by SW' and 'by HW'. A box labeled 'Indicative timings' is present.

The diagram illustrates the timing of ADC operations when AUTDLY = 1 and using a software trigger. It shows the following signals and states over time:

A box labeled 'Indicative timings' is located at the bottom right of the diagram area.

Timing diagram for AUTDLY = 1, regular conversion in continuous mode, software trigger. The diagram shows the relationship between ADSTART(1), EOC, EOS, ADSTP, ADC_DR read access, ADC state, and ADC_DR data over time. It includes a state sequence: RDY, CH1, DLY, CH2, DLY, CH3, DLY, CH1, DLY, STOP, RDY. Data is shown as D1, D2, D3, D1. Triggers are marked as 'by SW' and 'by HW'. A box labeled 'Indicative timings' is present.

MS31020V1

  1. 1. AUTDLY = 1, JAUTO = 0.
  2. 2. Regular configuration: EXTEN[1:0] = 00 (software trigger), CONT = 1, CHANNELS = 1, 2, 3.
  3. 3. Injected configuration DISABLED.

Figure 110. AUTDLY = 1, regular hardware conversions interrupted by injected conversions (DISCEN = 0; JDISCEN = 0)

Timing diagram for ADC conversions showing regular and injected sequences. The diagram includes signals for Regular trigger, ADC state, EOC, EOS, ADC_DR read access, ADC_DR, Injected trigger, JEOS, ADC_JDR1, and ADC_JDR2. It illustrates how injected conversions (CH5, CH6, CH3) interrupt regular conversions (CH1, CH2) when AUTDLY = 1. Triggers are shown as being ignored or not ignored based on the sequence.

The diagram illustrates the ADC operation when AUTDLY = 1, showing how regular hardware conversions are interrupted by injected conversions. The sequence of events is as follows:

Indicative timings are shown for DLY (CH1), DLY (CH2), DLY (CH3), and DLY (inj). The diagram also indicates when triggers are ignored or not ignored.

Timing diagram for ADC conversions showing regular and injected sequences. The diagram includes signals for Regular trigger, ADC state, EOC, EOS, ADC_DR read access, ADC_DR, Injected trigger, JEOS, ADC_JDR1, and ADC_JDR2. It illustrates how injected conversions (CH5, CH6, CH3) interrupt regular conversions (CH1, CH2) when AUTDLY = 1. Triggers are shown as being ignored or not ignored based on the sequence.
  1. 1. AUTDLY = 1, JAUTO = 0.
  2. 2. Regular configuration: EXTEN[1:0] = 01 (hardware trigger), CONT = 0, DISCEN = 0, CHANNELS = 1, 2, 3.
  3. 3. Injected configuration: JEXTEN[1:0] = 01 (hardware trigger), JDISCEN = 0, CHANNELS = 5, 6.

Figure 111. AUTDLY = 1, regular hardware conversions interrupted by injected conversions (DISCEN = 1, JDISCEN = 1)

Timing diagram for Figure 111 showing regular and injected conversion sequences. The diagram includes signals for Regular trigger, ADC state (RDY, CH1, DLY, RDY, CH2, DLY, RDY, CH5, RDY, CH6, CH3, DLY, RDY, CH1, DLY, RDY, CH2), EOC, EOS, ADC_DR read access, ADC_DR (D1, D2, D3, D1), Injected trigger, JEOS, ADC_JDR1 (D5), and ADC_JDR2 (D6). It shows how injected conversions (CH5, CH6) interrupt regular conversions (CH1, CH2, CH3).

by SW ↑ by HW ↑ Indicative timings

MS31022V1

Timing diagram for Figure 111 showing regular and injected conversion sequences. The diagram includes signals for Regular trigger, ADC state (RDY, CH1, DLY, RDY, CH2, DLY, RDY, CH5, RDY, CH6, CH3, DLY, RDY, CH1, DLY, RDY, CH2), EOC, EOS, ADC_DR read access, ADC_DR (D1, D2, D3, D1), Injected trigger, JEOS, ADC_JDR1 (D5), and ADC_JDR2 (D6). It shows how injected conversions (CH5, CH6) interrupt regular conversions (CH1, CH2, CH3).
  1. 1. AUTDLY = 1, JAUTO = 0.
  2. 2. Regular configuration: EXTEN[1:0] = 01 (hardware trigger), CONT = 0, DISCEN = 1, DISCNUM = 1, CHANNELS = 1, 2, 3.
  3. 3. Injected configuration: JEXTEN[1:0] = 01 (hardware trigger), JDISCEN = 1, CHANNELS = 5, 6.

Figure 112. AUTDLY = 1, regular continuous conversions interrupted by injected conversions

Timing diagram for Figure 112 showing regular continuous conversions interrupted by injected conversions. The diagram includes signals for ADSTART(1), ADC state (RDY, CH1, DLY, CH2, DLY, CH5, CH6, DLY, CH3, DLY, CH1), EOC, EOS, ADC_DR read access, ADC_DR (D1, D2, D3), Injected trigger, JEOS, ADC_JDR1 (D5), and ADC_JDR2 (D6). It shows how injected conversions (CH5, CH6) interrupt regular continuous conversions (CH1, CH2, CH3).

by s/w ↑ by h/w ↑ Indicative timings

MS31023V3

Timing diagram for Figure 112 showing regular continuous conversions interrupted by injected conversions. The diagram includes signals for ADSTART(1), ADC state (RDY, CH1, DLY, CH2, DLY, CH5, CH6, DLY, CH3, DLY, CH1), EOC, EOS, ADC_DR read access, ADC_DR (D1, D2, D3), Injected trigger, JEOS, ADC_JDR1 (D5), and ADC_JDR2 (D6). It shows how injected conversions (CH5, CH6) interrupt regular continuous conversions (CH1, CH2, CH3).
  1. 1. AUTDLY = 1, JAUTO = 0.
  2. 2. Regular configuration: EXTEN[1:0] = 00 (software trigger), CONT = 1, DISCEN = 0, CHANNELS = 1, 2, 3.
  3. 3. Injected configuration: JEXTEN[1:0] = 01 (hardware trigger), JDISCEN = 0, CHANNELS = 5, 6.
Figure 113. AUTDLY = 1 in autoinjection mode (JAUTO = 1) Timing diagram for AUTDLY = 1 in autoinjection mode (JAUTO = 1). The diagram shows the sequence of events starting from ADSTART(1), followed by ADC state transitions (RDY, CH1 regular, DLY (CH1), CH2 regular, CH5 injected, CH6 injected, DLY (inj), CH3 regular, DLY, CH1 regular). It also shows EOC, EOS, ADC_DR read access pulses, ADC_DR data (D1, D2, D3), JEOS, ADC_JDR1 (D5), and ADC_JDR2 (D6) signals. A 'No delay' indicator is marked above CH2 to CH5. Legend indicates by s/w and by h/w edge triggers. A box labeled 'Indicative timings' is present in the lower right. Labeled MS31024V4 in the bottom right corner.

MS31024V4

Timing diagram for AUTDLY = 1 in autoinjection mode (JAUTO = 1). The diagram shows the sequence of events starting from ADSTART(1), followed by ADC state transitions (RDY, CH1 regular, DLY (CH1), CH2 regular, CH5 injected, CH6 injected, DLY (inj), CH3 regular, DLY, CH1 regular). It also shows EOC, EOS, ADC_DR read access pulses, ADC_DR data (D1, D2, D3), JEOS, ADC_JDR1 (D5), and ADC_JDR2 (D6) signals. A 'No delay' indicator is marked above CH2 to CH5. Legend indicates by s/w and by h/w edge triggers. A box labeled 'Indicative timings' is present in the lower right. Labeled MS31024V4 in the bottom right corner.
  1. 1. AUTDLY = 1.
  2. 2. Regular configuration: EXTEN[1:0] = 00 (software trigger), CONT = 1, DISCEN = 0, CHANNELS = 1, 2.
  3. 3. Injected configuration: JAUTO = 1, CHANNELS = 5, 6.

21.4.27 Analog window watchdog (AWD1EN, JAWD1EN, AWD1SGL, AWD1CH, AWDCH of ADC_AWD2CR and ADC_AWD3CR, HTR, LTR, AWDFILT)

Table 146. Analog window watchdog features
FeatureAWD1AWD2AWD3
Enable controlAWD1EN or JAWD1ENADC_AWD2CRADC_AWD3CR
Channel selectionAWD1CH[4:0]/AWD1SGLADC_AWD2CRADC_AWD3CR
Channel selection limitationOne or all channelsAny number of channels
Regular or injected--
Threshold controlADC_AWD1LTR /
ADC_AWD1HTR
ADC_AWD2LTR /
ADC_AWD2HTR
ADC_AWD3LTR /
ADC_AWD3HTR
Filter configurationAWDFILT[2:0] in ADC_AWDyHTR
InterruptAWDy in ADC_ISR

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

Figure 114. Analog watchdog guarded area

Figure 114: Analog watchdog guarded area. A diagram showing a vertical axis for 'Analog voltage'. Two horizontal lines represent the 'Higher threshold' (HTR) and 'Lower threshold' (LTR). The region between these two thresholds is shaded gray and labeled 'Guarded area'.
Figure 114: Analog watchdog guarded area. A diagram showing a vertical axis for 'Analog voltage'. Two horizontal lines represent the 'Higher threshold' (HTR) and 'Lower threshold' (LTR). The region between these two thresholds is shaded gray and labeled 'Guarded area'.

AWDy flag and interrupt

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

AWDy (y = 1,2,3) flag is cleared by software by writing 1 to it, or by setting ADDIS.

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 or JAWD1EN bit in the ADC_CFGR1 register. This watchdog monitors whether either one selected channel or all enabled channels remain within a configured voltage range (window).

Table 147 shows how the ADC_CFGR1 registers must be configured to enable the analog watchdog on one or more channels.

Table 147. Analog watchdog 1 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 flag is set if the analog voltage converted by the ADC is below a lower threshold or above a higher threshold.

These thresholds are programmed through HTR[22:0] bits of the ADC_AWD1HTR register and LTR[22:0] bits of the ADC_AWD1LTR register for the analog watchdog 1.

The threshold can be up to 23 bits (12-bit resolution with oversampling, OVS = 1024, offset and gain compensation)

When converting data with a resolution of less than 12 bits (defined by RES[1:0] bits), 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.

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

Table 148. Analog watchdog 1, 2, 3 comparison

Resolution
(RES[1:0]
bits)
Analog watchdog comparison between:Comments
Raw converted data,
left aligned(1)
Thresholds
00: 12-bitDATA[11:0]LTR[22:0] and
HTR[22:0]
-
01: 10-bitDATA[11:2],00LTR[22:0] and
HTR[22:0]
The user must configure LTR[1:0] to 0b00 and HTR[1:0] to 0b00.
10: 8-bitDATA[11:4],0000LTR[22:0] and
HTR[22:0]
The user must configure LTR[3:0] to 0b0000 and HTR[3:0] to 0b0000.
11: 6-bitDATA[11:6],000000LTR[22:0] and
HTR[22:0]
The user must configure LTR[5:0] to 0b000000 and HTR[5:0] to 0b000000.

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

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 AWDCH[13:0] (of ADC_AWD2CR and ADC_AWD3CR).

The corresponding watchdog is enabled when any bit of AWDCH[13:0] (of ADC_AWD2CR and ADC_AWD3CR) is set.

The threshold can be up to 23 bits (12-bit resolution with oversampling, OVS = 1024 and offset compensation in signed format with gain compensation) and is programmed through the ADC_AWD2HTR, ADC_AWD2LTR, ADC_AWD3HTR and ADC_AWD3LTR registers.

When converting data with a resolution of less than 12 bits (defined by RES[1:0] bits), the LSBs of the programmed threshold must be kept cleared, the internal comparison being performed on the full 12-bits converted data (left aligned).

ADCx_AWDy_OUT signal output generation

Each analog watchdog is associated with an internal hardware signal ADC_AWDy_OUT (y being the watchdog number), which is directly connected to the ETR input (external trigger) of some of the on-chip timers. Refer to the on-chip timers sections to understand how to select the ADC_AWDy_OUT signal as ETR.

ADC_AWDy_OUT is activated when the associated analog watchdog is enabled:

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

The AWDy flag is cleared by programming it to 1 or by set ADDIS bit. ADSTP and JADSTP bits do not reset the AWDy flag.

Figure 115. ADC_AWDy_OUT signal generation (on all regular channels)

Timing diagram showing ADCSTATE, EOCFLAG, AWDyFLAG, and ADC_AWDy_OUT signals across multiple conversions (1-7). It includes a note: '- Converting regular channels 1,2,3,4,5,6,7 - Regular channels 1,2,3,4,5,6,7 are all guarded' and a reference code MSv66832V1.
Timing diagram showing ADCSTATE, EOCFLAG, AWDyFLAG, and ADC_AWDy_OUT signals across multiple conversions (1-7). It includes a note: '- Converting regular channels 1,2,3,4,5,6,7 - Regular channels 1,2,3,4,5,6,7 are all guarded' and a reference code MSv66832V1.

Figure 116. ADC_AWDy_OUT signal generation (AWDy flag not cleared by software)

Timing diagram for Figure 116 showing ADCSTATE, EOCFLAG, AWDy FLAG, and ADC_AWDy_OUT signals across 7 conversions. AWDy FLAG is set high after Conversion 2 and remains high. ADC_AWDy_OUT is high when AWDy FLAG is high and EOCFLAG is low.

ADCSTATE: RDY | Conversion1 | Conversion2 | Conversion3 | Conversion4 | Conversion5 | Conversion6 | Conversion7

EOCFLAG: Pulses at the end of each conversion.

AWDy FLAG: Low until Conversion 2, then high (not cleared by S/W).

ADC_AWDy_OUT: High from the start of Conversion 2 until the end of Conversion 7.

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

MSv66833V1

Timing diagram for Figure 116 showing ADCSTATE, EOCFLAG, AWDy FLAG, and ADC_AWDy_OUT signals across 7 conversions. AWDy FLAG is set high after Conversion 2 and remains high. ADC_AWDy_OUT is high when AWDy FLAG is high and EOCFLAG is low.

Figure 117. ADC_AWDy_OUT signal generation (on a single regular channel)

Timing diagram for Figure 117 showing ADCSTATE, EOCFLAG, EOSFLAG, AWDy FLAG, and ADC_AWDy_OUT signals across 8 conversions. AWDy FLAG is cleared by software after each Conversion 1.

ADCSTATE: Conversion1 | Conversion2 | Conversion1 | Conversion2 | Conversion1 | Conversion2 | Conversion1 | Conversion2

EOCFLAG: Pulses at the end of each conversion.

EOSFLAG: Pulses at the end of each Conversion 1.

AWDy FLAG: Low until Conversion 1, then high (cleared by S/W), then low until next Conversion 1.

ADC_AWDy_OUT: High from the start of Conversion 1 until the end of Conversion 2, then low until next Conversion 1.

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

MSv66834V1

Timing diagram for Figure 117 showing ADCSTATE, EOCFLAG, EOSFLAG, AWDy FLAG, and ADC_AWDy_OUT signals across 8 conversions. AWDy FLAG is cleared by software after each Conversion 1.

Figure 118. ADC_AWDy_OUT signal generation (on all injected channels)

Timing diagram for ADC_AWDy_OUT signal generation. It shows the relationship between ADCSTATE, JEOSFLAG, AWDy FLAG, and ADC_AWDy_OUT across several conversion cycles. ADCSTATE shows a sequence of RDY, Conversion1 (inside), Conversion2 (outside), Conversion3 (inside), Conversion4 (outside), and several more conversions (outside, outside, inside). JEOSFLAG is a high pulse at the end of Conversion4. AWDy FLAG is a high pulse at the end of each conversion that is 'outside' the threshold, with notes 'cleared byS/W'. ADC_AWDy_OUT is a high pulse that occurs when a conversion is 'outside' and the AWDy FLAG is active. A box at the bottom left states: '-Converting the injected channels 1, 2, 3, 4' and '-All injected channels 1, 2, 3, 4 are guarded'. The reference 'MSv66835V1' is at the bottom right.
Timing diagram for ADC_AWDy_OUT signal generation. It shows the relationship between ADCSTATE, JEOSFLAG, AWDy FLAG, and ADC_AWDy_OUT across several conversion cycles. ADCSTATE shows a sequence of RDY, Conversion1 (inside), Conversion2 (outside), Conversion3 (inside), Conversion4 (outside), and several more conversions (outside, outside, inside). JEOSFLAG is a high pulse at the end of Conversion4. AWDy FLAG is a high pulse at the end of each conversion that is 'outside' the threshold, with notes 'cleared byS/W'. ADC_AWDy_OUT is a high pulse that occurs when a conversion is 'outside' and the AWDy FLAG is active. A box at the bottom left states: '-Converting the injected channels 1, 2, 3, 4' and '-All injected channels 1, 2, 3, 4 are guarded'. The reference 'MSv66835V1' is at the bottom right.

Analog watchdog threshold control on the fly

LTR[22:0] and HTR[22: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 LTR[22:0] and HTR[22:0] are updated during the ADC conversion of the ADC guarded channel, resulting in 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 modified threshold, no interrupt and AWDy_OUT signal are issued. The Interrupt and the AWD generation only happen at the end of the conversion that started after the threshold update. If AWDy_OUT is already asserted, programming the new thresholds does not deassert the AWDy_OUT signal. However, the watchdog threshold must not be changed twice during the four adc_ker_ck periods.

Analog watchdog filter for watchdog 1

With analog watchdog, a valid ADC conversion data range can be configured through the ADC_AWD1LTR and ADC_AWD1HTR registers. When the conversion results have consecutively passed the threshold for more than the watchdog filter value (AWDFILT[2:0] + 1), AWD1_OUT is generated as well as the AWD1 flag. Before this value is reached, AWD1 output is not activated.

Analog watchdog with gain and offset compensation

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

21.4.28 Oversampler

The oversampling unit performs data preprocessing to offload the device. It is able to handle multiple conversions and average them into a single data with increased data width, up to 22 bits.

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

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

It enables the following functions to be performed by hardware: averaging, data rate reduction, SNR improvement and basic filtering.

The oversampling ratio N is defined by the OVSR[9:0] bits in the ADC_CFGR2 register, or by the JOVSS[3:0] bits in the ADC_CFGR3 register for parallel injected oversampling mode. They can range from 2x to 1024x. The division coefficient M consists of a right bit shift up to 10 bits. It is defined through the OVSS[3:0] bits of the ADC_CFGR2 register.

The summation unit can yield a result up to 22 bits, which can be left or right shifted at the end. When the right shift is selected, it is rounded to the nearest value using the least significant bits left apart by the shifting, before being finally transferred to the ADC_DR data register.

Figure 119 gives a numerical example of the processing, from a raw 22-bit accumulated data to the final 12-bit result.

Figure 119. 12-bit result oversampling with 10-bit right shift and rounding

Figure 119. 12-bit result oversampling with 10-bit right shift and rounding, showing register bit alignments from 22-bit raw accumulated data to 12-bit rounded result for generic data D21..D0 to D11..D0 and numerical hexadecimal data 0x3FE258 to 0x0FF9.

Diagram illustrating the bit alignment and rounding mechanism for 12-bit result oversampling with 10-bit right shift (OVSR = 1024):

1. General Case (D21..D0):

2. Numerical Example:

MSv66836V3

Figure 119. 12-bit result oversampling with 10-bit right shift and rounding, showing register bit alignments from 22-bit raw accumulated data to 12-bit rounded result for generic data D21..D0 to D11..D0 and numerical hexadecimal data 0x3FE258 to 0x0FF9.

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

Table 149. Maximum output results versus N and M

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
x20x1FFE0x1FFE0x0FFF0x08000x04000x02000x01000x00800x00400x0020
x40x3FFC0x3FFCx1FFE0x0FFF0x08000x04000x02000x01000x00800x0040
x160xFFF00xFFF00x7FF80x3FFC0x1FFE0x0FFF0x08000x04000x02000x0100
x640x3FFC00x3FFC00x1FFE00xFFF00x7FF80x3FFC0x1FFE0x0FFF0x08000x0400
x2560xFFF000xFFF000x7FF800x3FFC00x1FFE00xFFF00x7FF80x3FFC0x1FFE0x0FFF
x10240x3FFC000x3FFC000x1FFE000xFFF000x7FF800x3FFC00x1FFE00xFFF00x7FF80x3FFC

The conversion timing rate does not change in oversampling mode: the sample time is maintained equal during the whole oversampling sequence. A new data is provided every N conversion, with an equivalent delay equal to N x TCONV = N x (tSMPL + tSAR). The flags are set as follows:

Unlike the conversion rate, the data latency changes in oversampling mode: each single conversion introduces an additional accumulation. As a result, an additional clock cycle is required when all the conversions are complete, after the accumulation and shift.

The EOC flag is set two additional clock cycles after the conversion is complete.

ADC operating modes supported in oversampling mode (single ADC mode)

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

Analog watchdog

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

Triggered mode

The oversampling can also be used for basic filtering purpose. Although it not a very powerful filter (slow roll-off and limited stop band attenuation), it can act 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 through the TROVS bit in ADC_CFGR2, to be able to achieve an oversampling frequency defined by the user and independent from the conversion time itself. The TROVS bit is supported with hardware trigger mode.

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

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

If the TROVS bit is set, neither software trigger nor JAUTO is supported.

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

Diagram illustrating Triggered regular oversampling mode (TROVS bit = 1). The diagram shows two sequences of channel conversions. The top sequence, labeled CONT=0, DISCEN = 1, TROVS = 0, shows a single trigger starting a sequence of four channels: Ch(N)0, Ch(N)1, Ch(N)2, and Ch(N)3, followed by an EOC flag set. The bottom sequence, labeled CONT=0, DISCEN = 1, TROVS = 1, shows multiple triggers starting individual channel conversions: Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3, Ch(N)0, Ch(N)1, and Ch(N)2, followed by an EOC flag set. The diagram is labeled MS34455V2.
Diagram illustrating Triggered regular oversampling mode (TROVS bit = 1). The diagram shows two sequences of channel conversions. The top sequence, labeled CONT=0, DISCEN = 1, TROVS = 0, shows a single trigger starting a sequence of four channels: Ch(N)0, Ch(N)1, Ch(N)2, and Ch(N)3, followed by an EOC flag set. The bottom sequence, labeled CONT=0, DISCEN = 1, TROVS = 1, shows multiple triggers starting individual channel conversions: Ch(N)0, Ch(N)1, Ch(N)2, Ch(N)3, Ch(N)0, Ch(N)1, and Ch(N)2, followed by an EOC flag set. The diagram is labeled MS34455V2.

Injected and regular sequencer management in oversampling mode

In oversampling mode, injected and regular sequencers can have different behaviors. 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 ROVSM bit defines how the regular oversampling sequence is resumed if it is interrupted by an injected conversion:

Figure 121 gives examples for a 4x oversampling ratio.

Figure 121. Regular oversampling modes (4x ratio)

Diagram showing two oversampling modes: Continued mode and Resumed mode. Continued mode shows a sequence of regular channels being aborted and then resumed with injected channels. Resumed mode shows a similar sequence but with a different configuration of regular and injected channels. Both modes include a JEOC signal.

The diagram illustrates two oversampling modes for a 4x ratio. In the top section, 'Continued mode' (ROVSE = 1, JOVSE = 0, ROVSM = 0, TROVS = 0), a sequence of regular channels Ch(N)0 to Ch(N)3 is followed by Ch(M)0 and Ch(M)1. A trigger occurs at Ch(M)1, leading to an 'Abort' and then 'Injected channels' Ch(J) and Ch(K). After a JEOC signal, oversampling is 'continued' with a sequence Ch(M)1 to Ch(M)3 and Ch(O)0. In the bottom section, 'Resumed mode' (ROVSE = 1, JOVSE = 0, ROVSM = 1, TROVS = 0), a similar sequence occurs, but after the injected channels and JEOC, oversampling is 'resumed' with a sequence Ch(M)0 to Ch(M)3.

Diagram showing two oversampling modes: Continued mode and Resumed mode. Continued mode shows a sequence of regular channels being aborted and then resumed with injected channels. Resumed mode shows a similar sequence but with a different configuration of regular and injected channels. Both modes include a JEOC signal.

MSv34456V2

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 must be resumed (ROVSM bit = 1), as shown in Figure 122. This limitation no longer applies in parallel injected oversampling mode.

Figure 122. Regular and injected oversampling modes used simultaneously

Diagram showing the sequence of regular and injected channel conversions when both ROVSE and JOVSE are set. Regular channels Ch(N)0 to Ch(N)3 and Ch(M)0, Ch(M)1 are shown. An injected trigger aborts the regular oversampling, followed by injected channels Ch(J)0 to Ch(J)3. Regular oversampling resumes with Ch(M)0, Ch(M)1 after JEOC.

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

MSv34457V3

Diagram showing the sequence of regular and injected channel conversions when both ROVSE and JOVSE are set. Regular channels Ch(N)0 to Ch(N)3 and Ch(M)0, Ch(M)1 are shown. An injected trigger aborts the regular oversampling, followed by injected channels Ch(J)0 to Ch(J)3. Regular oversampling resumes with Ch(M)0, Ch(M)1 after JEOC.

Triggered regular oversampling with injected conversions

It is possible to have triggered regular mode with injected conversions. In this case, the injected oversampling mode must be disabled and the ROVSM bit set (the resumed mode is forced). The JOVSE bit must be reset. The behavior is shown in Figure 123.

Figure 123. Triggered regular oversampling with injection

Diagram showing triggered regular oversampling with injected conversions. Regular channels Ch(N)0, Ch(N)1, and Ch(N)2 each have an individual Trigger. An Injected trigger aborts oversampling during Ch(N)2, followed by injected channels Ch(J) and Ch(K). Oversampling is resumed with Ch(N)0 and Ch(N)1 on subsequent triggers.

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

MSv34458V5

Diagram showing triggered regular oversampling with injected conversions. Regular channels Ch(N)0, Ch(N)1, and Ch(N)2 each have an individual Trigger. An Injected trigger aborts oversampling during Ch(N)2, followed by injected channels Ch(J) and Ch(K). Oversampling is resumed with Ch(N)0 and Ch(N)1 on subsequent triggers.

Autoinjection mode

It is possible to oversample autoinjected sequences and store all conversion results in registers. 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 autoinjection mode. Figure 124 shows how the conversions are sequenced.

Figure 124. Oversampling in autoinjection mode

Diagram showing the sequence of conversions in autoinjection mode. It consists of two rows of boxes. The top row is labeled 'Regular channels' and contains four boxes: N0, N1, N2, N3. The bottom row is labeled 'Injected channels' and contains 16 boxes: I0, I1, I2, I3, J0, J1, J2, J3, K0, K1, K2, K3, L0, L1, L2, L3. An arrow points from the N3 box down to the I0 box. Another arrow points from the L3 box up to the N0 box. Below the boxes, the text 'JAUTO = 1, ROVSE = 1, JOVSE = 1, ROVSM = X, TROVS = 0' is displayed. In the bottom right corner, the text 'MS34459V1' is visible.
Diagram showing the sequence of conversions in autoinjection mode. It consists of two rows of boxes. The top row is labeled 'Regular channels' and contains four boxes: N0, N1, N2, N3. The bottom row is labeled 'Injected channels' and contains 16 boxes: I0, I1, I2, I3, J0, J1, J2, J3, K0, K1, K2, K3, L0, L1, L2, L3. An arrow points from the N3 box down to the I0 box. Another arrow points from the L3 box up to the N0 box. Below the boxes, the text 'JAUTO = 1, ROVSE = 1, JOVSE = 1, ROVSM = X, TROVS = 0' is displayed. In the bottom right corner, the text 'MS34459V1' is visible.

Combined modes summary

Table 150 summarizes all combinations, including the modes that are not supported.

Table 150. Oversampler operating mode 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

21.4.29 Dual ADC modes

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

In dual ADC mode the start of conversion is triggered alternately or simultaneously by the ADC master to the ADC slave, depending on the mode selected by the bits DUAL[4:0] in the ADCC_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 the DUAL[4:0] bits in the ADCC_CCR register are not equal to zero), the following bits are shared between the master and slave ADCs, with the slave ADC bits being ignored and always applying to the corresponding bits of the master ADC:

For dual mode usage, the sampling time of the master and slave channels must be equal.

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

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

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

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

Note: In dual mode, BULB, JAUTO, SMPTRIG are not supported.

Figure 125. Dual ADC block diagram

Block diagram of a Dual ADC system showing Master and Slave ADCs with internal and external inputs, triggers, and data registers.

The diagram illustrates the architecture of a Dual ADC system, consisting of a Master ADC and a Slave ADC. Both ADCs share a common Address/data bus. The Slave ADC is at the top, receiving inputs from 'Internal analog inputs' and 'ADCx_IN0', 'ADCx_IN2', 'ADCx_INi' (via 'GPIO ports'). It contains 'Regular channels' and 'Injected channels', which feed into a 'Regular data register (32-bits)' and 'Injected data registers (4 x32-bits)' respectively. The Master ADC is at the bottom, receiving inputs from 'Internal analog inputs', 'Internal triggers', and two 'Start trigger mux.' blocks (one for the regular group and one for the injected group). It also contains 'Regular channels', 'Injected channels', and a 'Dual mode control' block. Its data registers are a 'Regular data register (32-bits)' and 'Injected data registers (4 x32-bits)'. The 'Dual mode control' block has logic gates that interface with the trigger muxes and the internal triggers. The 'Address/data bus' is a vertical bar on the right, connected to all data registers.

MSv72687V2

Block diagram of a Dual ADC system showing Master and Slave ADCs with internal and external inputs, triggers, and data registers.
  1. 1. External triggers also exist on slave ADC but are not shown for the purposes of this diagram.
  2. 2. The ADC common data register (ADCC_CDR) contains both the master and slave ADC regular converted data.

Injected simultaneous mode with independent regular conversion

The injected simultaneous mode is selected by programming DUAL[4:0] bits to 0b00101.

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, the user software must convert sequences with the same length. Sampling times for channels with the same sequence number must be equal.

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.

The software is notified by interrupts when it can read the data:

Figure 126. Injected simultaneous mode on four channels: Dual ADC mode

Timing diagram for injected simultaneous mode on four channels in Dual ADC mode. It shows two parallel horizontal bars representing the Master ADC and Slave ADC. The Master ADC bar contains four channels: CH1, CH2, CH3, and CH4. The Slave ADC bar contains four channels: CH15, CH14, CH13, and CH12. A 'Trigger' signal is shown as a vertical arrow pointing to the start of the first channel (CH1 for Master, CH15 for Slave). A legend indicates that a shaded rectangle represents 'Sampling' and an unshaded rectangle represents 'Conversion'. The diagram shows that the sampling and conversion phases for all channels on both ADCs are synchronized and occur simultaneously. An arrow points to the end of the last channel (CH4 for Master, CH12 for Slave) with the text 'End of injected sequence on MASTER and SLAVE ADC'. The reference 'MS31900V1' is in the bottom right corner.
Timing diagram for injected simultaneous mode on four channels in Dual ADC mode. It shows two parallel horizontal bars representing the Master ADC and Slave ADC. The Master ADC bar contains four channels: CH1, CH2, CH3, and CH4. The Slave ADC bar contains four channels: CH15, CH14, CH13, and CH12. A 'Trigger' signal is shown as a vertical arrow pointing to the start of the first channel (CH1 for Master, CH15 for Slave). A legend indicates that a shaded rectangle represents 'Sampling' and an unshaded rectangle represents 'Conversion'. The diagram shows that the sampling and conversion phases for all channels on both ADCs are synchronized and occur simultaneously. An arrow points to the end of the last channel (CH4 for Master, CH12 for Slave) with the text 'End of injected sequence on MASTER and SLAVE ADC'. The reference 'MS31900V1' is in the bottom right corner.

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

This mode can be combined with the AUTDLY mode:

In this mode, the following register bits are shared between the master and slave ADCs: JADSTART, JADSTP, JDISCEN, JOVSE, JLEN, JEXTEN, JEXTSEL, GCOMPEN, JOVSECT, JOVSISE, JOVSE, and TJOVS.

Regular simultaneous mode with independent injected conversions

The regular simultaneous mode is selected by programming DUAL[4:0] bits to 0b00110.

This mode applies to 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_CFGR1 register). A simultaneous trigger is provided to the slave ADC.

In this mode, independent injected conversions are supported. An injection request (either on the master or on the slave) aborts the current simultaneous conversions both for master and slave. They 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, the user software must convert sequences with the same length. Sampling times for channels with the same sequence number must be equal.

The software is notified by interrupts when it can read the data:

The regular data can also be read using the DMA. Several methods are possible:

Alternatively, data can be read from ADCC_CDR2:

After these reads, a DMA request is generated. The DMA transfers the slave data from the same data register and handles two transfers for dual mode operation.

Note: When DAMDF[1:0] = 0b10 or 0b11, the user must program the same number of conversions in the master and in the slave sequence. Otherwise, the remaining conversions do not generate a DMA request.

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

Diagram illustrating regular simultaneous mode on 16 channels using dual ADC mode. It shows two parallel sequences: MASTER ADC and SLAVE ADC. The MASTER ADC sequence starts with a Trigger and proceeds through Sampling (shaded boxes) and Conversion (white boxes) for channels CH1, CH2, CH3, CH4, ..., CH16. The SLAVE ADC sequence starts with a Trigger and proceeds through Sampling and Conversion for channels CH16, CH14, CH13, CH12, ..., CH1. The end of the regular sequence is marked for both ADCs. A legend indicates that shaded boxes represent Sampling and white boxes represent Conversion.

ai16054b

Diagram illustrating regular simultaneous mode on 16 channels using dual ADC mode. It shows two parallel sequences: MASTER ADC and SLAVE ADC. The MASTER ADC sequence starts with a Trigger and proceeds through Sampling (shaded boxes) and Conversion (white boxes) for channels CH1, CH2, CH3, CH4, ..., CH16. The SLAVE ADC sequence starts with a Trigger and proceeds through Sampling and Conversion for channels CH16, CH14, CH13, CH12, ..., CH1. The end of the regular sequence is marked for both ADCs. A legend indicates that shaded boxes represent Sampling and white boxes represent Conversion.

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

This mode can be combined with the AUTDLY mode:

The DMA can be used to handle data in regular simultaneous mode combined with AUTDLY mode, assuming that multi-DMA mode is used: bits DAMDF must be set to 0b10 or 0b11.

Interleaved mode with independent injected conversions

This mode is selected by programming DUAL[4:0] bits to 0b00111.

It 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 between two conversions in interleaved mode is configured in the DELAY bits in the ADCC_CCR register (see Table DELAY bits versus ADC resolution). 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).

As the CONT bit is set on both the 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 master or 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.

Table 151. DELAY bits versus ADC resolution

DELAY bits12-bit resolution10-bit resolution8-bit resolution6-bit resolution
0000\(1 * T_{adc\_ker\_ck}\)\(1 * T_{adc\_ker\_ck}\)\(1 * T_{adc\_ker\_ck}\)\(1 * T_{adc\_ker\_ck}\)
0001\(2 * T_{adc\_ker\_ck}\)\(2 * T_{adc\_ker\_ck}\)\(2 * T_{adc\_ker\_ck}\)\(2 * T_{adc\_ker\_ck}\)
0010\(3 * T_{adc\_ker\_ck}\)\(3 * T_{adc\_ker\_ck}\)\(3 * T_{adc\_ker\_ck}\)\(3 * T_{adc\_ker\_ck}\)
0011\(4 * T_{adc\_ker\_ck}\)\(4 * T_{adc\_ker\_ck}\)\(4 * T_{adc\_ker\_ck}\)\(4 * T_{adc\_ker\_ck}\)
0100\(5 * T_{adc\_ker\_ck}\)\(5 * T_{adc\_ker\_ck}\)\(5 * T_{adc\_ker\_ck}\)\(5 * T_{adc\_ker\_ck}\)
0101\(6 * T_{adc\_ker\_ck}\)\(6 * T_{adc\_ker\_ck}\)\(6 * T_{adc\_ker\_ck}\)\(6 * T_{adc\_ker\_ck}\)
0110\(7 * T_{adc\_ker\_ck}\)\(7 * T_{adc\_ker\_ck}\)\(7 * T_{adc\_ker\_ck}\)\(7 * T_{adc\_ker\_ck}\)
0111\(8 * T_{adc\_ker\_ck}\)\(8 * T_{adc\_ker\_ck}\)\(8 * T_{adc\_ker\_ck}\)\(7 * T_{adc\_ker\_ck}\)
1000\(9 * T_{adc\_ker\_ck}\)\(9 * T_{adc\_ker\_ck}\)\(9 * T_{adc\_ker\_ck}\)\(7 * T_{adc\_ker\_ck}\)
1001\(10 * T_{adc\_ker\_ck}\)\(10 * T_{adc\_ker\_ck}\)\(9 * T_{adc\_ker\_ck}\)\(7 * T_{adc\_ker\_ck}\)
1010\(11 * T_{adc\_ker\_ck}\)\(11 * T_{adc\_ker\_ck}\)\(9 * T_{adc\_ker\_ck}\)\(7 * T_{adc\_ker\_ck}\)
1011\(12 * T_{adc\_ker\_ck}\)\(11 * T_{adc\_ker\_ck}\)\(9 * T_{adc\_ker\_ck}\)\(7 * T_{adc\_ker\_ck}\)
1100\(13 * T_{adc\_ker\_ck}\)\(11 * T_{adc\_ker\_ck}\)\(9 * T_{adc\_ker\_ck}\)\(7 * T_{adc\_ker\_ck}\)
others\(13 * T_{adc\_ker\_ck}\)\(11 * T_{adc\_ker\_ck}\)\(9 * T_{adc\_ker\_ck}\)\(7 * T_{adc\_ker\_ck}\)

Figure 128. Interleaved mode on 1 channel in continuous conversion mode:
Dual ADC mode

Figure 128. Interleaved mode on 1 channel in continuous conversion mode: Dual ADC mode timing diagram showing MASTER ADC and SLAVE ADC alternating continuous sampling and conversion phases for CH1 with 5 ADCCLK cycles spacing and trigger.

MSv31030V6

Figure 128. Interleaved mode on 1 channel in continuous conversion mode: Dual ADC mode timing diagram showing MASTER ADC and SLAVE ADC alternating continuous sampling and conversion phases for CH1 with 5 ADCCLK cycles spacing and trigger.

Figure 129. Interleaved mode on 1 channel in single conversion mode:
Dual ADC mode

Figure 129. Interleaved mode on 1 channel in single conversion mode: Dual ADC mode timing diagram showing single conversions on MASTER ADC and SLAVE ADC separated by 5 ADCCLK cycles with End of conversion markers.

MSv31031V4

Figure 129. Interleaved mode on 1 channel in single conversion mode: Dual ADC mode timing diagram showing single conversions on MASTER ADC and SLAVE ADC separated by 5 ADCCLK cycles with End of conversion markers.

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

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

Note: In interleaved mode, the ADCx_AWDy_OUT signal for the master ADC is synchronized with the EOC of the master ADC, but the interrupt flag is synchronized with the EOC/JEOC flag of the slave ADC.

In addition, the ROVSM = 0 setting is not supported in oversampling mode.

Figure 130. Interleaved conversion with injection

Timing diagram for interleaved conversion with injection between ADC1 (master) and ADC2 (slave).

The diagram illustrates the interleaved conversion process with injection between two ADCs: ADC1 (master) and ADC2 (slave). The timeline shows the sequence of sampling and conversion for various channels.

MS34460V1

Timing diagram for interleaved conversion with injection between ADC1 (master) and ADC2 (slave).

Alternate trigger mode with independent regular conversions

The alternate trigger mode is selected by programming DUAL[4:0] bits to 0b01001.

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

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

Injected discontinuous mode disabled (JDISCEN = 0)

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

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

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

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

Figure 131. Alternate trigger: injected group of each ADC

Timing diagram showing the sequence of sampling and conversion for Master and Slave ADCs across four triggers. The diagram illustrates how triggers alternate between the Master and Slave ADCs, and how injected conversions are scheduled relative to regular conversions and triggers. Shaded boxes represent sampling, and white boxes represent conversion. Arrows indicate the start of triggers and the occurrence of JEOC and JEOS interrupts.

The diagram illustrates the timing sequence for Master and Slave ADCs across four triggers. The sequence is as follows:

Additional interrupts (JEOS) are shown for the Master ADC after its second and third conversions, and for the Slave ADC after its second conversion. A legend indicates that shaded boxes represent Sampling and white boxes represent Conversion.

Timing diagram showing the sequence of sampling and conversion for Master and Slave ADCs across four triggers. The diagram illustrates how triggers alternate between the Master and Slave ADCs, and how injected conversions are scheduled relative to regular conversions and triggers. Shaded boxes represent sampling, and white boxes represent conversion. Arrows indicate the start of triggers and the occurrence of JEOC and JEOS interrupts.

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 two trigger events must be greater than or equal to one ADC clock period. The minimum time interval between two trigger events that start conversions on the same ADC is the same as in the single ADC mode.

Injected discontinuous mode enabled (JDISCEN = 1)

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

  1. 1. When the first trigger occurs, the first injected channel of the master ADC is converted.
  2. 2. When the second trigger occurs, the first injected channel of the slave ADC is 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.

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

Timing diagram for Figure 132 showing 8 triggers for MASTER and SLAVE ADCs. Triggers 1, 3, 5, 7 are on MASTER ADC; triggers 2, 4, 6, 8 are on SLAVE ADC. Each trigger starts a sampling phase (grey box) followed by a conversion phase (white box). JEOC (End of Conversion) events are marked at the end of each conversion. For triggers 7 and 8, JEOC and JEOS (End of Sequence) are indicated.

ai16060V3

Timing diagram for Figure 132 showing 8 triggers for MASTER and SLAVE ADCs. Triggers 1, 3, 5, 7 are on MASTER ADC; triggers 2, 4, 6, 8 are on SLAVE ADC. Each trigger starts a sampling phase (grey box) followed by a conversion phase (white box). JEOC (End of Conversion) events are marked at the end of each conversion. For triggers 7 and 8, JEOC and JEOS (End of Sequence) are indicated.

Combined regular/injected simultaneous mode

This mode is selected by programming DUAL[4:0] bits to 0b00001.

The simultaneous conversion of a regular group can be interrupted to start the simultaneous conversion of an injected group.

Note: In combined regular/injected simultaneous mode, the user software must convert sequences with the same length.

Combined regular simultaneous and alternate trigger mode

This mode is selected by programming DUAL[4:0] bits to 0b00010.

The simultaneous conversion of a regular group can be interrupted to start the alternate trigger conversion of an injected group. Figure 133 shows the behavior of an alternate trigger interrupting a simultaneous regular conversion.

The injected alternate conversion immediately starts 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, the user software must convert sequences with the same length.

The software trigger is not supported for injected conversions.

Figure 133. Alternate + regular simultaneous

Timing diagram for Figure 133 showing the interaction between regular and injected conversions for MASTER and SLAVE ADCs. The diagram shows four rows: ADC MASTER reg, ADC MASTER inj, ADC SLAVE reg, and ADC SLAVE inj. It illustrates how an injected conversion (e.g., CH1 in ADC MASTER inj) interrupts a regular conversion (e.g., CH3 in ADC MASTER reg). The regular conversion is aborted, and after the injected conversion completes, the regular conversion resumes with the next channel (CH4). A second trigger is shown starting a new sequence. The text 'synchronization not lost' indicates that the timing between master and slave ADCs remains aligned.

ai16062V4

Timing diagram for Figure 133 showing the interaction between regular and injected conversions for MASTER and SLAVE ADCs. The diagram shows four rows: ADC MASTER reg, ADC MASTER inj, ADC SLAVE reg, and ADC SLAVE inj. It illustrates how an injected conversion (e.g., CH1 in ADC MASTER inj) interrupts a regular conversion (e.g., CH3 in ADC MASTER reg). The regular conversion is aborted, and after the injected conversion completes, the regular conversion resumes with the next channel (CH4). A second trigger is shown starting a new sequence. The text 'synchronization not lost' indicates that the timing between master and slave ADCs remains aligned.

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

Figure 134. Case of trigger occurring during injected conversion

Timing diagram for Figure 134 showing ADC MASTER and ADC SLAVE registers and injected conversions. It illustrates how triggers are served when they occur during an injected conversion that has interrupted a regular conversion. Triggers 1, 3, and 5 are served, while trigger 6 is ignored. Conversions are aborted when a trigger occurs during an injected conversion.

The diagram shows the sequence of conversions for ADC MASTER and ADC SLAVE registers and their injected conversions.
ADC MASTER reg: CH1, CH2, CH3, CH3, CH4, CH4, CH5, CH5, CH6
ADC MASTER inj: CH14, CH14, CH14
ADC SLAVE reg: CH7, CH8, CH9, CH9, CH10, CH10, CH11, CH11, CH12
ADC SLAVE inj: CH15, CH15
Triggers: 1st trigger (during CH3), 2nd trigger (during CH15), 3rd trigger (during CH4), 4th trigger (during CH11), 5th trigger (during CH5), 6th trigger (ignored).
Annotations: 'Conversion aborted' points to the end of CH3, CH4, and CH5 conversions.

Timing diagram for Figure 134 showing ADC MASTER and ADC SLAVE registers and injected conversions. It illustrates how triggers are served when they occur during an injected conversion that has interrupted a regular conversion. Triggers 1, 3, and 5 are served, while trigger 6 is ignored. Conversions are aborted when a trigger occurs during an injected conversion.

ai16063V4

Combined injected simultaneous and interleaved mode

This mode is selected by programming DUAL[4:0] bits to 0b00011.

An interleaved conversion can be interrupted with a simultaneous injected event.

In this case, the interleaved conversion is immediately interrupted 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 135, Figure 136, and Figure 137 show examples of this behavior.

Note: In this mode, the ROVSM = 0 setting is not supported in oversampling mode.

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

Timing diagram for Figure 135 showing ADC1 (master) and ADC2 (slave) interleaved conversions of CH0, interrupted by an injected sequence of CH11 and CH12. The diagram shows sampling and conversion phases, CDR reads, and the resumption of interleaved conversions after the injected sequence.

The diagram illustrates the interleaved conversion of CH0 between ADC1 (master) and ADC2 (slave), interrupted by an injected sequence of CH11 and CH12.
ADC1 (master): CH0, CH0, CH0, CH0, CH0
ADC2 (slave): CH0, CH0, CH0, CH0, CH0
Injected sequence: CH11, CH12
Annotations: 'Conversions aborted' points to the end of the second CH0 conversion for both ADCs. 'Injected trigger' marks the start of the injected sequence. 'Resume (always restart with the master)' marks the start of the third CH0 conversion for ADC1. 'read CDR' points to the end of each CH0 conversion.
Legend: Sampling (light gray box), Conversion (dark gray box).

Timing diagram for Figure 135 showing ADC1 (master) and ADC2 (slave) interleaved conversions of CH0, interrupted by an injected sequence of CH11 and CH12. The diagram shows sampling and conversion phases, CDR reads, and the resumption of interleaved conversions after the injected sequence.

MS34461V1

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

Timing diagram for Figure 136 showing ADC1 (master) and ADC2 (slave) interleaved channels CH1 and CH2 with injected sequence CH11, CH12. Case 1: Master interrupted first.

The diagram illustrates the interleaving of two channels, CH1 and CH2, across two ADCs, ADC1 (master) and ADC2 (slave). The sequence of operations is as follows:

Legend:

MS34462V1

Timing diagram for Figure 136 showing ADC1 (master) and ADC2 (slave) interleaved channels CH1 and CH2 with injected sequence CH11, CH12. Case 1: Master interrupted first.

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

Timing diagram for Figure 137 showing ADC1 (master) and ADC2 (slave) interleaved channels CH1 and CH2 with injected sequence CH11, CH12. Case 2: Slave interrupted first.

The diagram illustrates the interleaving of two channels, CH1 and CH2, across two ADCs, ADC1 (master) and ADC2 (slave). The sequence of operations is as follows:

Legend:

MS34463V2

Timing diagram for Figure 137 showing ADC1 (master) and ADC2 (slave) interleaved channels CH1 and CH2 with injected sequence CH11, CH12. Case 2: Slave interrupted first.

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 138: DMA requests in regular simultaneous mode when DAMDF[1:0] = 0b00).

Figure 138. DMA requests in regular simultaneous mode when DAMDF[1:0] = 0b00

Timing diagram for DMA requests in regular simultaneous mode when DAMDF[1:0] = 0b00. The diagram shows two parallel sequences for a master ADC and a slave ADC. Each sequence starts with a 'Trigger' signal. The master ADC sequence includes 'ADC master regular' (CH1), 'ADC master EOC', 'DMA request from ADC master', and 'DMA reads master ADC_DR'. The slave ADC sequence includes 'ADC slave regular' (CH2), 'ADC slave EOC', 'DMA request from ADC slave', and 'DMA reads slave ADC_DR'. The EOC signals for master and slave are aligned. The DMA requests are generated after the EOC signals. The DMA reads are performed after the DMA requests. The diagram is labeled 'MSv31032V3'.

Configuration where each sequence contains only one conversion. Master and slave timings are equal.

MSv31032V3

Timing diagram for DMA requests in regular simultaneous mode when DAMDF[1:0] = 0b00. The diagram shows two parallel sequences for a master ADC and a slave ADC. Each sequence starts with a 'Trigger' signal. The master ADC sequence includes 'ADC master regular' (CH1), 'ADC master EOC', 'DMA request from ADC master', and 'DMA reads master ADC_DR'. The slave ADC sequence includes 'ADC slave regular' (CH2), 'ADC slave EOC', 'DMA request from ADC slave', and 'DMA reads slave ADC_DR'. The EOC signals for master and slave are aligned. The DMA requests are generated after the EOC signals. The DMA reads are performed after the DMA requests. The diagram is labeled 'MSv31032V3'.

In interleaved mode or in simultaneous regular mode, it is also possible to save one DMA channel and transfer both data using a single DMA channel. To do this, the DAMDF[1:0] bits must be configured in the ADCC_CCR register:

A DMA request is generated alternatively after the master and slave EOC events have occurred. At that time, the data are alternatively available in the 32-bit register ADCC_CDR2 32-bit register.

This mode is used when the data width is above 16 bits (conversion data width can exceed 16 bits when functions such as oversampling, compensation and left-bit shift, are used).

Behavior: A DMA request is generated each time a new 32-bit data is available:

A DMA request is generated alternatively after the master and slave EOC events have occurred. At that time, two data items are available and the 32-bit register ADCC_CDR contains the two half-words representing two ADC-converted data. The slave ADC data takes the upper half-word and the master ADC data takes the lower half-word. DMA transfers two data by one request.

Any value above 16-bit in the master or the slave-converted data is truncated to the least 16 significant bits.

Behavior: A DMA request is generated each time a new 32-bit data is available:

Figure 139. DMA requests in interleaved mode when DAMDF = 0b10

Timing diagram of DMA requests in interleaved mode when DAMDF = 0b10 showing ADC Master regular (CH1), ADC Master EOC, ADC Slave regular (CH2), ADC Slave EOC, DMA request from ADC Master, and DMA request from ADC Slave with trigger pulses and delays.

Configuration where each sequence contains only one conversion

MSv31034V2

Timing diagram of DMA requests in interleaved mode when DAMDF = 0b10 showing ADC Master regular (CH1), ADC Master EOC, ADC Slave regular (CH2), ADC Slave EOC, DMA request from ADC Master, and DMA request from ADC Slave with trigger pulses and delays.

Note: When using dual ADC 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 data is available.

This mode is similar to the DAMDF[1:0] = 0b10 configuration. The only difference is that on each DMA request (two data are available), two bytes representing two ADC converted data are transferred as a half-word.

This mode is used when the resolution is 6 bits or 8 bits and data are not signed.

Behavior: A DMA request is generated each time two data items are available:

Note: DMA burst mode is not supported in ADC dual mode.

Overrun detection when OVRMOD = 0

In dual ADC mode (when DUAL[4:0] is not equal to b00000), if an overrun is detected on one of the ADCs, DMA requests are no longer issued to ensure that all the data transferred to the RAM are valid (this behavior occurs whatever the DAMDF configuration). The EOC bit

corresponding to one ADC might remain set because the data register of this ADC contains valid data.

Overrun detection when OVRMOD = 1

In dual ADC mode, if an overrun occurs on either ADC, the data register is overwritten, causing continuous DMA requests. This results in loss of data coherency.

DMA one-shot mode/ DMA circular mode when multi-ADC mode is selected

When DAMDF mode is selected (0b10 or 0b11), DMNGT[1:0] bits of the ADCC_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

Stopping the conversions in dual ADC modes

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

Once both ADCs are effectively stopped, the ADSTART/JADSTART bits on the master and slave ADCs are both deasserted by hardware.

Analog watchdog in dual mode

The analog watchdog is supported in all dual modes.

Disabling the ADC in dual mode

During a dual-mode operation, the master ADC shares the ADC clock with the slave ADC. To disable the ADC correctly through the ADDIS bit of ADC_CR, set the ADSTP (or JADSP) bit on the master ADC. Once ADSTP (or JADSTP) becomes 0 both for the master and slave ADCs, set the ADDIS bit on the master ADC, then set the ADDIS bit on the slave ADC.

Autoinjection mode in dual mode

Autoinjection mode is not supported when DUAL[4:0] equals 0b00010, 0b00011, 0b00101, 0b00110, 0b00111, or 0b01001.

Additionally, parallel injected oversampling mode is not supported in autoinjection mode.

Dual ADC modes supported in oversampling mode

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

21.4.30 Temperature sensor

The temperature sensor can be used to measure the junction temperature (\(T_J\)) of the device.

The temperature sensor is internally connected to the ADC input channels, which are used to convert the sensor output voltage to a digital value (see Table: ADC interconnection in Section 21.4.2: ADC pins and internal signals for more details). When not in use, the sensor

can be put in power-down mode. It supports the temperature range specified in the product datasheet.

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

Figure 140. Temperature sensor channel block diagram

Block diagram of the temperature sensor channel. A Temperature sensor block is connected to a multiplexer. The multiplexer is controlled by the TSEN control bit and outputs VSENSE to the ADC input of the ADCx block. The ADCx block outputs Converted data to the Address/data bus. The diagram is labeled MSv62477V3.
graph LR
    TS[Temperature sensor] --> MUX{MUX}
    TSEN[TSEN control bit] --> MUX
    MUX -- VSENSE --> ADC[ADCx
ADC input] ADC --> CD[Converted data] CD --> ADB[Address/data bus]

MSv62477V3

Block diagram of the temperature sensor channel. A Temperature sensor block is connected to a multiplexer. The multiplexer is controlled by the TSEN control bit and outputs VSENSE to the ADC input of the ADCx block. The ADCx block outputs Converted data to the Address/data bus. The diagram is labeled MSv62477V3.

Reading the temperature

To use the sensor:

  1. 1. Select the ADC input channel that is connected to \(V_{SENSE}\).
  2. 2. Program with the appropriate sampling time (refer to the electrical characteristics section of the device datasheet).
  3. 3. Set the TSEN bit in the ADCC_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. 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:

Caution: The above formula is valid only if the \(V_{\text{REF+}}\) condition specified in the table Temperature sensor calibration values of the datasheet are respected.

Note: The sensor has a startup time after waking from power-down mode before it can output \(V_{\text{SENSE}}\) at the correct level. The ADC also has a startup time after power-on, so to minimize the delay, the ADEN, and TSEN bits must be set simultaneously.

21.4.31 Monitoring the internal voltage reference

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

Refer to the ADC interconnection table in Section 21.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 device datasheet for the sampling time value to be applied when converting the internal voltage reference voltage.

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

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

Block diagram of the VREFINT channel. An 'Internal power block' outputs VREFINT to a multiplexer. The multiplexer is controlled by the 'VREFEN control bit' and its output goes to the 'ADCx' block at the 'ADC input'. The diagram is labeled MSv34467V5 in the bottom right corner.
graph LR
    IPB[Internal power block] -- VREFINT --> MUX{MUX}
    VREFEN[VREFEN control bit] --> MUX
    MUX --> ADCx[ADCx]
    ADCx --> AI[ADC input]
  

MSv34467V5

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

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

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

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

\[V_{REF+} = V_{REF+\_Charac} \times V_{REFINT\_CAL} / V_{REFINT\_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 some applications, the \(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 V_{REFINT\_CAL} \times ADC\_DATA}{V_{REFINT\_DATA} \times FULL\_SCALE}\]

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

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

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.

21.5 ADC interrupts

For each ADC, an interrupt can be generated:

Separate interrupt enable bits are available for flexibility.

Note: Interrupts are generated by the AHB clock domain. Since the ADC clock is adc_ker_ck, interrupt flags are delayed due to the synchronization between adc_ker_ck and AHB clock domains.

Table 152. 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 flag is setAWD1AWD1IE
Analog watchdog 2 flag is setAWD2AWD2IE
Analog watchdog 3 flag is setAWD3AWD3IE
End of sampling phaseEOSMPEOSMPIE
OverrunOVROVRIE
ADC internal voltage regulator readyLDORDYLDORDYIE

21.6 ADC registers (for each ADC)

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

21.6.1 ADC interrupt and status register (ADC_ISR)

Address offset: 0x000

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.LDORD
Y
Res.Res.AWD3AWD2AWD1JEOSJEOCOVREOSEOCEOSM
P
ADRDY
rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1rc_w1

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

Bit 12 LDORDY: ADC internal voltage regulator output ready flag

This bit is set by hardware and cleared by software. It indicates that the ADC internal voltage regulator output is ready and that the ADC can be enabled or calibrated.

0: ADC LDO internal voltage regulator disabled

1: ADC LDO internal voltage regulator enabled

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

Bit 9 AWD3: Analog watchdog 3 flag

This bit is set by hardware when the converted voltage crosses the values programmed in the fields LTR[22:0] and HTR[22:0] of ADC_AWD3LTR and ADC_AWD3HTR registers. It is cleared by software writing 1 to it or when ADEN = 0.

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 LTR[22:0] and HTR[22:0] of ADC_AWD2LTR and ADC_AWD2HTR registers. It is cleared by software writing 1 to it or when ADEN = 0.

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 LTR[22:0] and HTR[22:0] of ADC_AWD1LTR and ADC_AWD1HTR registers. It is cleared by software writing 1 to it or when ADEN = 0.

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 or when ADEN = 0.

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, when ADEN = 0, 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 (a new conversion has completed while the EOC flag was already set) or when adc_hclk clock is too slow to manage the data.

It is cleared by software writing 1 to it or when ADEN = 0.

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 or when ADEN = 0.

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, when ADEN = 0, 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. It is cleared by software writing 1 or when ADEN = 0.

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

1: End of sampling phase reached

Bit 0 ADRDY: ADC ready

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

It is cleared by software writing 1 to it or when ADEN = 0.

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

1: ADC is ready to start conversion

21.6.2 ADC interrupt enable register (ADC_IER)

Address offset: 0x004

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.LDORD
YIE
Res.Res.AWD3I
E
AWD2I
E
AWD1I
E
JEOSI
E
JEOSI
E
OVRIEEOSIEEOCIEEOSM
PIE
ADRDY
IE
rwrwrwrwrwrwrwrwrwrwrw

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

Bit 12 LDORDYIE: ADC internal voltage regulator interrupt enable

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

0: Internal voltage regulator interrupt disabled

1: Internal voltage regulator interrupt enabled

Note: The software is allowed to write this bit only when ADEN = 0.

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

Bit 9 AWD3IE: Analog watchdog 3 interrupt enable

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

0: Analog watchdog 3 interrupt disabled

1: Analog watchdog 3 interrupt enabled

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

Bit 8 AWD2IE: Analog watchdog 2 interrupt enable

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

0: Analog watchdog 2 interrupt disabled

1: Analog watchdog 2 interrupt enabled

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

Bit 7 AWD1IE: Analog watchdog 1 interrupt enable

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

0: Analog watchdog 1 interrupt disabled

1: Analog watchdog 1 interrupt enabled

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

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

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

0: JEOS interrupt disabled

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

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

Bit 5 JEOCIE: End of injected conversion interrupt enable

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

0: JEOC interrupt disabled.

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

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

Bit 4 OVRIE: Overrun interrupt enable

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

0: Overrun interrupt disabled

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

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

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

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

0: EOS interrupt disabled

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

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

Bit 2 EOCIE: End of regular conversion interrupt enable

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

0: EOC interrupt disabled.

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

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

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

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

0: EOSMP interrupt disabled.

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

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

Bit 0 ADRDYIE: ADC ready interrupt enable

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

0: ADRDY interrupt disabled

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

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

21.6.3 ADC control register (ADC_CR)

Address offset: 0x008

Reset value: 0x2000 0000

31302928272625242322212019181716
ADCALRes.DEEPPWDADVREGENRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rsrwrw
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.

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 Reserved, must be kept at reset value.

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 and ADEN = 0).

Bit 28 ADVREGEN: ADC internal voltage regulator enable

This bits is set by software to enable the ADC internal 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 internal voltage regulator disabled

1: ADC internal voltage regulator enabled.

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

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

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

Bit 5 JADSTP: ADC stop of injected conversion command

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

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

When a software trigger is used, JADSTART bit is cleared by hardware, but JADSTP bit must be programmed to reconfigure the ADC.

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: In autoinjection 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).

When a software trigger is used, ADSTART bit is cleared by hardware. However it is necessary to write ADSTP bit to reconfigure the ADC.

0: No ADC stop regular conversion command ongoing

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

Note: In autoinjection mode (JAUTO = 1), setting ADSTP bit aborts both regular and injected conversions (do not use ADSTP).

Note: In dual ADC regular simultaneous and interleaved modes, the ADSTP bit of the master ADC must be used to stop regular conversions on both ADCs. The other ADSTP bit is inactive.

Bit 3 JADSTART: ADC start of injected conversion

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

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, ADDIS = 0 and JAUTO = 0 (ADC is enabled and there is no pending request to disable the ADC).

Note: In autoinjection mode (JAUTO = 1), regular and autoinjected conversions are started by setting ADSTART bit (JADSTART must be kept cleared).

Bit 2 ADSTART: ADC start of regular conversion

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

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

Note: In autoinjection mode (JAUTO = 1), regular and autoinjected conversions are started by setting ADSTART bit (JADSTART must be kept cleared)

Bit 1 ADDIS: ADC disable command

This bit is set by software to disable the ADC (ADDIS command) and place 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, ADDIS = 0 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 ADRDY flag 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 the bits of ADC_CR registers are cleared (ADCAL = 0, JADSTART = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0), except for ADVREGEN bit which must be set. In addition, the software must wait for the startup time of the voltage regulator.

21.6.4 ADC configuration register (ADC_CFGR1)

Address offset: 0x00C

Reset value: 0x8000 0000

PeripheralReservedReservedReservedReservedReservedRunSleepWake-up capabilityReservedStop 0ReservedStop 1ReservedWake-upStandbyWake-up capability
31 30 2928272625242322212019181716
Res.AWD1CH[4:0]JAUTOJAWD1AWD1EAWD1S
Res.GLRes.JDISC
Res.ENDISCNUM[2:0]DISCE
Res.ENNN
rw rwrwrwrwrwrwrwrwrwrwrwrwrw
15 14 131211109876543210
Y CONT Res. AUTDLOVRM
Y CONT Res. AUTDLODEXTEN[1:0]EXTSEL[4:0]Res.RES[1:0]DMNGT[1:0]
rw rwrwrwrwrwrwrwrwrwrwrwrwrw
Bits 30:26 AWD1CH[4:0]: Analog watchdog 1 channel selection
Bit 25 JAUTO:Automatic injected group conversion
Bit 24 JAWD1EN: Analog watchdog 1 enable on injected channels
Bit 23 AWD1EN: Analog watchdog 1 enable on regular channels

Bit 31 Reserved, must be kept at reset value.

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

.....

01101: ADC analog input channel 13 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.

Note: The channel selected by AWD1CH must be also selected into the SQRi or JSQRi registers. 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 ADEN = 0.

Note: When dual mode is enabled (DUAL bits in ADCC_CCR register are not equal to zero), the JAUTO bit of the slave ADC is not valid and controlled by the JAUTO bit 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 4 Reserved, must be kept at reset value.

Bits 3:2 RES[1:0]: Data resolution

These bits are written by software to select the resolution of the conversion.

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

Bits 1:0 DMNGT[1:0]: Data management configuration

These bits are set and cleared by software to select how the ADC interface output data are managed.

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

21.6.5 ADC configuration register 2 (ADC_CFGR2)

Address offset: 0x010

Reset value: 0x0000 0000

31302928272625242322212019181716
LSHIFT[3:0]Res.Res.OVSR[9:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
SMPTR IGSWTRIGBULBRes.Res.ROVSMTROVSOVSS[3:0]Res.Res.Res.Res.ROVSE
rwrwrwrwrwrwrwrwrwrw
ST logo
ST logo

Bits 31:28 LSHIFT[3:0]: Left shift factor

This bitfield is set and cleared by software to define the left shifting applied to the final result with or without oversampling.

0000: No left shift
0001: 1-bit left shift
0010: 2-bit left shift
0011: 3-bit left shift
0100: 4-bit left shift
0101: 5-bit left shift
0110: 6-bit left shift
0111: 7-bit left shift
1000: 8-bit left shift
1001: 9-bit left shift
1010: 10-bit left shift
1011: 11-bit left shift
1100: 12-bit left shift
1101: 13-bit left shift
1110: 14-bit left shift
1111: 15-bit left shift

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

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

Bits 25:16 OVSR[9:0]: Oversampling ratio

This bitfield is set and cleared by software to define the oversampling ratio.

0: 1x (no oversampling)
1: 2x
2: 3x
...
1023: 1024x

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

Bit 15 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

If EXTEN[1:0] bits are set to 01, the sampling time starts on the trigger rising edge, and the conversion starts on the trigger falling edge.

The SMPTRIG bit must not be set when the BULB bit is set.

When EXTEN[1:0] bits are set to 00, set SWTRIG to start the sampling.

Note: The software is allowed to write this bit only when ADEN = 0. When the discontinuous mode is used, only DISCNUM[2:0] = 000 configuration is compatible with sampling time control trigger mode.

Bit 14 SWTRIG: Software trigger bit for sampling time control trigger mode

This bit is set and cleared by software to trigger the conversion in sampling time control trigger 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), SMPTRIG = 1, and EXTEN[0:1] = 00.

Bit 13 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.

BULB bit must not be set when the SWTRIG 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 ADEN = 0. When the discontinuous mode is used, only DISCNUM[2:0] = 000 configuration is compatible with bulb mode.

Bits 12: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 temporary 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). It is recommended to clear both JOVSE and GCOMP when ROVSM = 0.

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 and JADSTART = 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: 1-bit shift

0010: 2-bit shift

0011: 3-bit shift

0100: 4-bit shift

0101: 5-bit shift

0110: 6-bit shift

0111: 7-bit shift

1000: 8-bit shift

1001: 9-bit shift

1010: 10-bit shift

Other: reserved, must not be used

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

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

Bit 0 ROVSE: Regular oversampling enable

This bit is set and cleared by software to enable regular oversampling.

0: Regular oversampling disabled

1: Regular oversampling enabled

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

21.6.6 ADC sample time register 1 (ADC_SMPR1)

Address offset: 0x014

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.SMP9[2:0]SMP8[2:0]SMP7[2:0]SMP6[2:0]SMP5[2:1]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
SMP5[0]SMP4[2:0]SMP3[2:0]SMP2[2:0]SMP1[2:0]SMP0[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 = 9 to 0)

These bits are written by software to select the sampling time individually for each channel. During sample cycles, the channel selection bits must remain unchanged.

000: 3 ADC clock cycles

001: 5 ADC clock cycles

010: 8 ADC clock cycles

011: 13 ADC clock cycles

100: 25 ADC clock cycles

101: 48 ADC clock cycles

110: 139 ADC clock cycles

111: 289 ADC clock cycles

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

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

21.6.7 ADC sample time register 2 (ADC_SMPR2)

Address offset: 0x018

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.SMP13[2:0]SMP12[2:0]SMP11[2:0]SMP10[2:0]
rwrwrwrwrwrwrwrwrwrwrwrw

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

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

000: 3 ADC clock cycles

001: 5 ADC clock cycles

010: 8 ADC clock cycles

011: 13 ADC clock cycles

100: 25 ADC clock cycles

101: 48 ADC clock cycles

110: 139 ADC clock cycles

111: 289 ADC clock cycles

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

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

21.6.8 ADC channel preselection register (ADC_PCSEL)

Address offset: 0x01C

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.PCSEL[13:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 13:0 PCSEL[13:0]: Channel i (\(V_{IN[i]}\)) preselection

These bits are written by software to preselect the input channel I/O to be converted.

0: Input channel i (\(V_{IN[i]}\)) is not preselected for conversion, the result of the ADC conversion for this channel is wrong

1: Input channel i (\(V_{IN[i]}\)) is preselected for conversion

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

Configuring the PCSEL bit is not necessary for the internal channels (such as VREFINT).

21.6.9 ADC regular sequence register 1 (ADC_SQR1)

Address offset: 0x030

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.SQ4[4:0]Res.SQ3[4:0]Res.SQ2[4]
rwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
SQ2[3:0]Res.SQ1[4:0]Res.Res.LEN[3:0]
rwrwrwrwrwrwrwrwrwrwrwrwrw

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 13) 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 13) 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 13) 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 13) 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 LEN[3:0]: Regular channel sequence length

These bits are written by software to define the total number of conversions in the regular channel conversion sequence.

0000: 1 conversion

0001: 2 conversions

...

1111: 16 conversions

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

Note: Some channels are not connected physically and must not be selected for conversion.

21.6.10 ADC regular sequence register 2 (ADC_SQR2)

Address offset: 0x034

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.SQ9[4:0]Res.SQ8[4:0]Res.SQ7[4]
rwrwrwrwrwrwrwrwrwrwrw
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 13) 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 13) 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 13) 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 13) 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 13) assigned as the 5th in the regular conversion sequence.

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

Note: Some channels are not connected physically and must not be selected for conversion.

21.6.11 ADC regular sequence register 3 (ADC_SQR3)

Address offset: 0x038

Reset value: 0x0000 0000

31302928272625242322212019181716
ResResResSQ14[4:0]ResSQ13[4:0]ResSQ12[4]
rwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
SQ12[3:0]ResSQ11[4:0]ResSQ10[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 13) 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 13) 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 13) 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 13) 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 13) assigned as the 10th in the regular conversion sequence.

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

Note: Some channels are not connected physically and must not be selected for conversion.

21.6.12 ADC regular sequence register 4 (ADC_SQR4)

Address offset: 0x03C

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 13) 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 13) assigned as the 15th in the regular conversion sequence.

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

Note: Some channels are not connected physically and must not be selected for conversion.

21.6.13 ADC regular data register (ADC_DR)

Address offset: 0x040

Reset value: 0x0000 0000

31302928272625242322212019181716
RDATA[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
RDATA[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 RDATA[31:0]: Regular data converted

These bits are read-only. They contain the conversion result from the last converted regular channel.

The data are left- or right-aligned as described in Section 21.4.25: Data management.

21.6.14 ADC injected sequence register (ADC_JSQR)

Address offset: 0x04C

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]JLEN[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 13) 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 13) 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 13) 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 13) 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: Hardware trigger detection disabled (conversions can be launched by software)

01: Hardware trigger detection on the rising edge

10: Hardware trigger detection on the falling edge

11: Hardware trigger detection on both the rising and falling edges

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

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

21.6.15 ADC offset y configuration register (ADC_OFCFGRy)

Address offset: 0x050+0x004*(y-1), (y = 1 to 4)

Reset value: 0x0000 0000

31302928272625242322212019181716
OFFSET_CH[4:0]SSATUSATPOS
OFF
Res.Res.Res.Res.Res.Res.Res.Res.
rwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.

Bits 31:27 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 in bits OFFSET[21: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).

Note: Some channels are not connected physically and must not be selected for the data offset y.

Bit 26 SSAT: Signed saturation enable

This bit is set and cleared by software to enable the signed saturation feature.(see Section : Data register, data alignment and offset (ADC_DR, ADC_JDRy, OFFSETy, OFFSETy_CH, OVSS, LSHIFT, JOVSS, JLSHIFT(a), USAT, SSAT, POSOFF)).

0: Offset is subtracted maintaining the data integrity and extending converted data size (13-bit signed format)

1: Offset is subtracted and result is saturated to maintain the converted data size

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

Bit 25 USAT: Unsigned saturation enable

This bit is set and cleared by software to enable the unsigned saturation feature.

0: Offset is subtracted maintaining the data integrity

1: Offset is subtracted and result is saturated to maintain the converted data size

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 POSOFF: Positive offset enable

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:0 Reserved, must be kept at reset value.

21.6.16 ADC offset y register (ADC_OFRy)

Address offset: 0x060 + 0x004 * (y - 1), (y= 1 to 4)

Reset value: 0x0000 0000

31302928272625242322212019181716
ResResResResResResResResResResOFFSET[21:16]
rwrwrwrwrwrw
1514131211109876543210
OFFSET[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 21:0 OFFSET[21:0]: Data offset y for the channel programmed in OFFSETy_CH[4:0] bits

These bits are written by software to define the offset y to be subtracted from the raw converted data when converting a channel (can be regular or injected). The channel to which applies the data offset y must be programmed in the OFFSETy_CH[4:0] bits. The conversion result can be read from in the ADC_DR (regular conversion) or from in the ADC_JDRy 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).

21.6.17 ADC gain compensation register (ADC_GCOMP)

Address offset: 0x070

Reset value: 0x0000 1000

31302928272625242322212019181716
G
COMP
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rw
1514131211109876543210
Res.Res.GCOMPCOEFF[13:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 GCOMP: Gain compensation mode

This bit is set and cleared by software to enable the Gain compensation mode.

0: Regular ADC operation mode

1: Gain compensation enabled and applied on all channels.

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

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

Bits 13:0 GCOMPCOEFF[13:0]: Gain compensation coefficient

These bits are set and cleared by software to program the gain compensation coefficient.

00 1000 0000 0000: gain factor of 0.5

...

01 0000 0000 0000: gain factor of 1

10 0000 0000 0000: gain factor of 2

11 0000 0000 0000: gain factor of 3

...

The coefficient is divided by 4096 to get the gain factor ranging from 0 to 3.9999756

Note: This gain compensation is only applied when GCOMP bit is set.

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

21.6.18 ADC injected channel y data register (ADC_JDRy)

Address offset: 0x080 + 0x004 * (y - 1), (y = 1 to 4)

Reset value: 0x0000 0000

31302928272625242322212019181716
JDATA[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
JDATA[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 JDATA[31:0]: Injected data

These bits are read-only. They contain the conversion result from injected channel y. The data are left- or right-aligned as described in Section 21.4.25: Data management.

21.6.19 ADC analog watchdog 2 configuration register (ADC_AWD2CR)

Address offset: 0x0A0

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.AWDCH[13:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 13:0 AWDCH[13: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.

AWDCH[i] = 0: ADC analog input channel i is not monitored by AWD2

AWDCH[i] = 1: ADC analog input channel i is monitored by AWD2

When AWDCH[13:0] = 000..0, the analog Watchdog 2 is disabled

Note: The channels selected by AWDCH must be also selected in the SQi or JSQi bits.

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

Note: Some channels are not connected physically and must not be selected for the analog watchdog.

21.6.20 ADC analog watchdog 3 configuration register (ADC_AWD3CR)

Address offset: 0x0A4

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.AWDCH[13:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 13:0 AWDCH[13: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.

AWDCH[i] = 0: ADC analog input channel i is not monitored by AWD3

AWDCH[i] = 1: ADC analog input channel i is monitored by AWD3

When AWDCH[13:0] = 000..0, the analog Watchdog 3 is disabled.

Note: The channels selected by AWDCH must be also selected in the SQi or JSQi bits.

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

Note: Some channels are not connected physically and must not be selected for the analog watchdog.

21.6.21 ADC analog watchdog 1 lower threshold register (ADC_AWD1LTR)

Address offset: 0x0A8

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.LTR[22:16]
rwrwrwrwrwrwrw
1514131211109876543210
LTR[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 22:0 LTR[22:0]: Analog watchdog 1 lower threshold

These bits are set and cleared by software to define the lower threshold for analog watchdog 1.

Refer to Section 21.4.27: Analog window watchdog (AWD1EN, JAWD1EN, AWD1SGL, AWD1CH, AWDCH of ADC_AWD2CR and ADC_AWD3CR, HTR, LTR, AWDFILT).

21.6.22 ADC analog watchdog 1 higher threshold register (ADC_AWD1HTR)

Address offset: 0x0AC

Reset value: 0x003F FFFF

31302928272625242322212019181716
AWDFILT[2:0]Res.Res.Res.Res.Res.Res.HTR[22:16]
rwrwrwrwrwrwrwrwrwrw
1514131211109876543210
HTR[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:29 AWDFILT[2:0]: Analog watchdog filtering parameter

These bits are set and cleared by software.

000: No filtering, one detection generates an AWD1 flag or an interrupt

001: two consecutive detections generate an AWD1 flag or an interrupt

...

111: Eight consecutive detections generate an AWD1 flag or an interrupt

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

Bits 28:23 Reserved, must be kept at reset value.

Bits 22:0 HTR[22:0]: Analog watchdog 1 higher threshold

These bits are set and cleared by software to define the higher threshold for analog watchdog 1.

Refer to Analog windows watchdog section.

21.6.23 ADC analog watchdog 2 lower threshold register (ADC_AWD2LTR)

Address offset: 0x0B0

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.LTR[22:16]
rwrwrwrwrwrwrw
1514131211109876543210
LTR[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 22:0 LTR[22:0]: Analog watchdog 2 lower threshold

These bits are set and cleared by software to define the lower threshold for analog watchdog 2.

Refer to Analog windows watchdog section.

21.6.24 ADC analog watchdog 2 higher threshold register (ADC_AWD2HTR)

Address offset: 0x0B4

Reset value: 0x003F FFFF

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.HTR[22:16]
rwrwrwrwrwrwrw
1514131211109876543210
HTR[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 22:0 HTR[22:0]: Analog watchdog 2 higher threshold

These bits are set and cleared by software to define the higher threshold for analog watchdog 2.
Refer to Analog windows watchdog section.

21.6.25 ADC analog watchdog 3 lower threshold register (ADC_AWD3LTR)

Address offset: 0x0B8

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.LTR[22:16]
rwrwrwrwrwrwrw
1514131211109876543210
LTR[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 22:0 LTR[22:0]: Analog watchdog 3 lower threshold

These bits are set and cleared by software to define the lower threshold for analog watchdog 3.
Refer to Analog windows watchdog section.

21.6.26 ADC analog watchdog 3 higher threshold register (ADC_AWD3HTR)

Address offset: 0x0BC

Reset value: 0x003F FFFF

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.HTR[22:16]
rwrwrwrwrwrwrw
1514131211109876543210
HTR[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 22:0 HTR[22:0]: Analog watchdog 3 higher threshold

These bits are set and cleared by software to define the higher threshold for analog watchdog 3.
Refer to Analog windows watchdog section.

21.6.27 ADC calibration factors (ADC_CALFACT)

Address offset: 0x0C4

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.CALFACT[6:0]
rwrwrwrwrwrwrw

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

Bits 6:0 CALFACT[6:0]: Calibration factors

These bits can be written by hardware or by software.
Once the calibration is complete, they are updated by hardware with the calibration factors.
The 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 applied once a new conversion is launched.

Note: The software is allowed to write these bits only when ADSTART = 0 and JADSTART = 0 (ADC is enabled, no conversion is ongoing).

ST logo
ST logo

21.6.28 ADC option register (ADC_OR)

Address offset: 0x0D0

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

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

21.7 ADC common registers

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

21.7.1 ADC common status register (ADCC_CSR)

Address offset: 0x000

Reset value: 0x0000 0000

This register provides an image of the flags of the different ADCs. Nevertheless it is read-only and does not allow to clear the different flags. Instead each flag must be cleared by writing 0 to it in the corresponding ADC_ISR register.

31302928272625242322212019181716
Res.Res.Res.LDORDY_SLVRes.Res.AWD3_SLVAWD2_SLVAWD1_SLVJEOS_SLVJEOC_SLVOVR_SLVEOS_SLVEOC_SLVEOSMP_SLVADRDY_SLV
rrrrrrrrrrr
1514131211109876543210
Res.Res.Res.LDORDY_MSTRes.Res.AWD3_MSTAWD2_MSTAWD1_MSTJEOS_MSTJEOC_MSTOVR_MSTEOS_MSTEOC_MSTEOSMP_MSTADRDY_MST
rrrrrrrrrrr

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

Bit 28 LDORDY_SLV: ADC internal voltage regulator flag of the slave ADC

This bit is a copy of the LDORDY bit in the corresponding ADC_ISR register.

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

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.

21.7.2 ADC common control register (ADCC_CCR)

Address offset: 0x008

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.TSENVREFENRes.Res.Res.Res.Res.Res.
rwrw
1514131211109876543210
DAMDF[1:0]Res.Res.DELAY[3:0]Res.Res.Res.DUAL[4:0]
rwrwrwrwrwrwrwrwrwrwrw

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

Bit 23 TSEN: Temperature sensor voltage enable

This bit is set and cleared by software to control \(V_{SENSE}\) channel.

0: Temperature sensor channel disabled

1: Temperature sensor channel enabled

Note: The temperature sensor is not available on all ADC instances. Refer to Section 21.4.4: ADC connectivity for details.

Note: The software is allowed to write this bit only when ADEN = 0.

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

Note: \(V_{REFINT}\) is not available on all ADC instances. Refer to Section 21.4.4: ADC connectivity for details.

Note: The software is allowed to write this bit only when ADEN = 0.

Bits 21:16 Reserved, must be kept at reset value.

Bits 15:14 DAMDF[1:0]: Dual ADC mode data format

This bitfield are set and cleared by software. It specifies the data format in the common data register ADCC_CDR and ADCC_CDR2.

00: Dual ADC mode without data packing (ADCC_CDR and ADCC_CDR2 registers not used).

01: Reserved

10: Data formatting mode for any data width (ADCC_CDR data register is used when the data width is less than 16 bits, otherwise ADCC_CDR2 register is used)

11: Data formatting mode for data width lower that 8 bits (ADCC_CDR data register is used)

Note: The software is allowed to write these bits only when ADEN = 0 (ADC is disabled).

Bit 13 Reserved, must be kept at reset value.

Bit 12 Reserved, must be kept at reset value.

Bits 11:8 DELAY[3:0]: Delay between two sampling phases

These bits are set and cleared by software. These bits are used in dual interleaved modes. Refer to for the value of ADC resolution versus DELAY bits values.

Note: The software is allowed to write these bits only when the ADCs are disabled (ADCAL = 0, JADSTART = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0).

Bits 7:5 Reserved, must be kept at reset value.

Bits 4:0 DUAL[4:0]: Dual ADC mode selection

These bits are written by software to select the operating mode.

All the ADCs independent:

00000: Independent mode

The following settings apply to dual mode, master and slave ADCs working together

00001: Combined regular simultaneous + Injected simultaneous mode

00010: Combined regular simultaneous + Alternate trigger mode

00011: Combined interleaved mode + Injected simultaneous mode

00101: Injected simultaneous mode only

00110: Regular simultaneous mode only

00111: Interleaved mode only

01001: Alternate trigger mode only

Others: Reserved

All other combinations are reserved and must not be programmed

Note: The software is allowed to write these bits only when the ADCs are disabled (ADCAL = 0, JADSTART = 0, ADSTART = 0, ADSTP = 0, ADDIS = 0 and ADEN = 0).

21.7.3 ADC common regular data register for dual mode (ADCC_CDR)

Address offset: 0x00C

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

The data alignment is applied as described in Data register, data alignment and offset (ADC_DR, ADC_JDRy, OFFSETy, OFFSETy_CH, OVSS, LSHIFT, JOVSS, JLSHIFT(a), USAT, SSAT, POSOFF)

Bits 15:0 RDATA_MST[15:0]: Regular data of the master ADC.

In dual mode, these bits contain the regular data of the master ADC. Refer to Section 21.4.29: Dual ADC modes.

The data alignment is applied as described in Data register, data alignment and offset (ADC_DR, ADC_JDRy, OFFSETy, OFFSETy_CH, OVSS, LSHIFT, JOVSS, JLSHIFT(a), USAT, SSAT, POSOFF)

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

21.7.4 ADC common regular data register for dual mode (ADCC_CDR2)

Address offset: 0x010

Reset value: 0x0000 0000

31302928272625242322212019181716
RDATA_ALT[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
RDATA_ALT[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 RDATA_ALT[31:0]: Regular data of the master/slave alternated ADCs.

In dual mode, these bits contain the regular 32-bit data of the master and the slave ADC. Refer to Section 21.4.29: Dual ADC modes.

The data alignment is applied as described in Data register, data alignment and offset (ADC_DR, ADC_JDRy, OFFSETy, OFFSETy_CH, OVSS, LSHIFT, JOVSS, JLSHIFT(a), USAT, SSAT, POSOFF)

21.8 ADC register map

ADC1 and ADC3 are master ADCs.

ADC2 operates as a slave from ADC1.

Table 153. ADC register map and reset values for each ADC

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x000ADC_ISRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.LDORDYRes.Res.AWD3AWD2AWD1JEOSJEOCOVREOSEOCEOSMPADRDY
Reset value000000000000

Table 153. ADC register map and reset values for each ADC (continued)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x004ADC_IERRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.LDORDYIERes.Res.AWD3IEAWD2IEAWD1IEJEOSIEJEOCIEOVRIEEOSIEEOCIEEOSMPIEADRDYIE
Reset value00000000000
0x08ADC_CRADCALRes.DEEPPWDADVREGENRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.JADSTPADSTPJADSTARTADSTARTADDISADEN
Reset value010000000
0x00CADC_CFGR1Res.AWD1CH[4:0]JAUTOJAWD1ENAWD1ENAWD1SGLRes.JDISCENDISCNUM[2:0]DISCENRes.AUTDLYCONTOVRMODEXTEN[1:0]EXTSEL[4:0]Res.RES[1:0]DMNGT[1:0]
Reset value0x8000 0000
0x010ADC_CFGR2LSHIFT[3:0]Res.Res.OVSR[9:0]SMPTRIGSWTRIGBULBRes.Res.ROMVSMTROVSOVSS[3:0]Res.Res.Res.Res.ROVSE
Reset value000000000000000000000000
0x014ADC_SMPR1Res.Res.SMP9[2:0]SMP8[2:0]SMP7[2:0]SMP6[2:0]SMP5[2:0]SMP4[2:0]SMP3[2:0]SMP2[2:0]SMP1[2:0]SMP0[2:0]
Reset value000000000000000000000000000000
0x018ADC_SMPR2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SMP13[2:0]SMP12[2:0]SMP11[2:0]SMP10[2:0]
Reset value000000000000
0x01CADC_PCSELRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PCSEL[13:0]
Reset value00000000000000
0x020-0x02CReserved
0x030ADC_SQR1Res.Res.Res.SQ4[4:0]Res.SQ3[4:0]Res.SQ2[4:0]Res.SQ1[4:0]Res.Res.LEN[3:0]
Reset value000000000000000000000000
0x034ADC_SQR2Res.Res.Res.SQ9[4:0]Res.SQ8[4:0]Res.SQ7[4:0]Res.SQ6[4:0]Res.SQ5[4:0]
Reset value0000000000000000000000000
0x038ADC_SQR3Res.Res.Res.SQ14[4:0]Res.SQ13[4:0]Res.SQ12[4:0]Res.SQ11[4:0]Res.SQ10[4:0]
Reset value0000000000000000000000000
0x03CADC_SQR4Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SQ16[4:0]Res.SQ15[4:0]
Reset value0000000000
0x040ADC_DRRDATA[31:0]
Reset value00000000000000000000000000000000
0x044-0x048Reserved
0x04CADC_JSQRRes.JSQ4[4:0]Res.JSQ3[4:0]Res.JSQ2[4:0]Res.JSQ1[4:0]JEXTEN[1:0]JEXTSEL[4:0]JLEN[1:0]
Reset value0000000000000000000000000000

Table 153. ADC register map and reset values for each ADC (continued)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x050ADC_OFCFGR1OFFSET1_CH[4:0]SSATUSATPOSOFRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value00000000
0x054ADC_OFCFGR2OFFSET2_CH[4:0]SSATUSATPOSOFRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value00000000
0x058ADC_OFCFGR3OFFSET3_CH[4:0]SSATUSATPOSOFRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value00000000
0x05CADC_OFCFGR4OFFSET4_CH[4:0]SSATUSATPOSOFRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value00000000
0x060ADC_OFR1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET[21:0]
Reset value0000000000000000000000
0x064ADC_OFR2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET[21:0]
Reset value0000000000000000000000
0x068ADC_OFR3Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET[21:0]
Reset value0000000000000000000000
0x06CADC_OFR4Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OFFSET[21:0]
Reset value0000000000000000000000
0x070ADC_GCOMPGCOMPRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.GCOMPCOEFF[13:0]
Reset value001000000000000
0x074-0x07CReserved
0x080ADC_JDR1JDATA[31:0]
Reset value00000000000000000000000000000000
0x084ADC_JDR2JDATA[31:0]
Reset value00000000000000000000000000000000
0x088ADC_JDR3JDATA[31:0]
Reset value00000000000000000000000000000000
0x08CADC_JDR4JDATA[31:0]
Reset value00000000000000000000000000000000
0x090-0x09CReserved

Table 153. ADC register map and reset values for each ADC (continued)

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x0A0ADC_AWD2CRResResResResResResResResResResResResResResResResResResAWDCH[13:0]
Reset value0000000000000000000
0x0A4ADC_AWD3CRResResResResResResResResResResResResResResResResResResAWDCH[13:0]
Reset value0000000000000000000
0x0A8ADC_AWD1LTRResResResResResResResResResResLTR[22:0]
Reset value000000000000000000000000000
0x0ACADC_AWD1HTRAWDFILT[2:0]ResResResResResResResResHTR[22:0]
Reset value000011111111111111111111111111
0x0B0ADC_AWD2LTRResResResResResResResResResResLTR[22:0]
Reset value000000000000000000000000000
0x0B4ADC_AWD2HTRResResResResResResResResResResHTR[22:0]
Reset value011111111111111111111111111
0x0B8ADC_AWD3LTRResResResResResResResResResResLTR[22:0]
Reset value000000000000000000000000000
0x0BCADC_AWD3HTRResResResResResResResResResResHTR[22:0]
Reset value011111111111111111111111111
0x0C0Reserved
0x0C4ADC_CALFACTResResResResResResResResResResResResResResResResResResCALFACT[6:0]
Reset value0000000000000000000
0x0C8-0x0CCReserved
0x0D0ADC_ORResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResRes
Reset value
0x0D4-0x0FCReserved

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

OffsetRegister name
reset value
313029282726252423222120191817161514131211109876543210
0x000ADCC_CSRRes.Res.Res.LDORDY_SLVRes.Res.AWD3_SLVAWD2_SLVAWD1_SLVJEOS_SLVJEOC_SLVOVR_SLVEOS_SLVEOC_SLVEOSMP_SLVADRDY_SLVRes.Res.Res.LDORDY_MSTRes.Res.AWD3_MSTAWD2_MSTAWD1_MSTJEOS_MSTJEOC_MSTOVR_MSTEOS_MSTEOC_MSTEOSMP_MSTADRDY_MST0
slave ADCmaster ADC
Reset value0000000000000000000000000
0x004ReservedRes
0x008ADCC_CCRRes.Res.Res.Res.Res.Res.Res.Res.TSENVREFENRes.Res.Res.DAMDF[1:0]Res.Res.Res.Res.DELAY[3:0]Res.Res.Res.Res.DUAL[4:0]
Reset value000000000000000
0x00CADCC_CDRRDATA_SLV[15:0]RDATA_MST[15:0]
Reset value0000000000000000000000000000000000000
0x010ADCC_CDR2RDATA_ALT[31:0]
Reset value0000000000000000000000000000000000000
0x014Reserved
ST logo
ST logo

Refer to Section 2.2: Memory organization for the register boundary addresses.