AT32F421
Series Reference Manual
2022.11.11
Page 310
Rev 2.02
18.4.2.3 Sampling and conversion sequence
The sampling period can be configured by setting the CSPTx bit in the ADC_SPT1 and ADC_SPT2
registers. A single one conversion time is calculated with the following formula:
A single one conversion tiem (ADCCLK cycle) = sampling time + 12.5
Example:
If the CSPTx selects 1.5 cycles, then one conversion needs 1.5+12.5=14 ADCCLK cycles
If the CSPTx selects 7.5 cycles, then one conversion needs 7.5+12.5=20 ADCCLK cycles.
18.4.3 Conversion sequence management
Only one channel is converted at each trigger event by default, that is, either OSN1-defined channel
(ordinary trigger) or PSN4-defined channel (preempted trigger).
The detailed conversion sequence modes are described in the following sections. With this, the channels
can be converted in a specific order.
18.4.3.1 Sequence mode
The sequence mode is enabled by setting the SQEN bit in the ADC_CTRL1 register. The ADC_OSQx
register is used to configure the sequence and the total number of the ordinary channels while the
ADC_PSQ register is used to define the sequence and total number of the preempted channels. After
the sequence mode is enabled, a single trigger event enables the conversion of a group of channels in
order. The ordinary channels start converting from the QSN1 while the preempted channels starts from
the PSNx, where x=4-PCLEN. Figure 18-4 shows an example of the behavior in sequence mode.
Figure 18-4
Sequence mode
ADC_IN5
ADC_IN0
ADC_IN5
OCLEN=2, OSN1=ADC_IN5, OSN2=ADC_IN0, OSN3=ADC_IN5
Ordinary channel
trigger
CCE flag set
ADC_IN5
ADC_IN0
ADC_IN5
CCE flag set
Ordinary channel
trigger
ADC_IN14
ADC_IN1
ADC_IN14
PCLEN=2, PSN2=ADC_IN14, PSN3=ADC_IN1, PSN4=ADC_IN14
Preempted channel
trigger
CCE and
PCCE flag set
ADC_IN14
ADC_IN1
ADC_IN14
CCE and
PCCE flag set
Preempted channel
trigger
Sampling
Conversion
18.4.3.2 Automatic preempted group conversion mode
The automatic preempted group conversion mode is enabled by setting the PCAUTOEN bit in the
ADC_CTRL1 register. Once the ordinary channel conversion is complete, the preempted group will
automatically continue its conversion. This mode can work with the sequence mode. The preempted
group conversion starts automatically at the end of the conversion of the ordinary group.
shows an example of the behavior when the automatic preempted group conversion mode works with
the ordinary group.