![ARTERY AT32WB415 Series Reference Manual Download Page 252](http://html1.mh-extra.com/html/artery/at32wb415-series/at32wb415-series_reference-manual_2977599252.webp)
AT32WB415
Series Reference Manual
2022.04.13
Page 252
Ver 2.00
Calibration
After power-on, the calibration is enabled by setting the ADCAL bit in the ADC_CTRL2 register. When
the calibration is complete, the ADCAL bit is cleared by hardware and the conversion is performed by
software trigger.
After each calibration, the calibration value is stored in ADC_ODT register, and then value is
automatically sent back to the ADC so as to eliminate capacitance errors. The storage of the calibration
value will not set the OCCE flag, or generate interrupts or DMA requests.
Figure 18-3 ADC power-on and calibration
ADCCLK
ADCEN
STAB
Trigger
ADC
status
Powering up
Conversion
t
CCE flag
ADCAL
Calibration
The ADCEN
bit is set by
software.
The ADCAL
bit is set by
software.
The ADCAL
bit is cleared
by hardware
The CCE bit
is set by
hardware
18.4.2.2 Trigger
The ADC triggers contain ordinary channel trigger and preempted channel trigger. The ordinary channel
conversion is triggered by ordinary channel triggers while the preempted channel conversion is triggered
by preempted ones. After the OCTEN or PCTEN bit is set in the ADC_CTRL2 register, the ADC starts
conversion after a trigger source is detected.
The conversion can be triggered by software write operation to the OCSWTRG and PCSWTRG bits in
the ADC_CTRL2 register, or by an external event. The external events include timer and pin triggers.
The OCTESEL and PCTESEL bits in the ADC_CTRL2 register are used to select specific trigger sources,
as shown in
. Besides, the ordinary channel has a special trigger source, which repeatedly
enables ADCEN to trigger conversion, withouting the need of enabling the OCTEN bit in the
ADC_CTRL2 register.
Table 18-1 Trigger sources for ADC
OCTESEL
Trigger source
PCTESEL
Trigger source
0000
TMR1_CH1 event
0000
TMR1_TRGOUT event
0001
TMR1_CH2 event
0001
TMR1_CH4 event
0010
TMR1_CH3 event
0010
TMR2_TRGOUT event
0011
TMR2_CH2 event
0011
TMR2_CH1 event
0100
Reserved
0100
Reserved
0101
TMR4_CH4 event
0101
TMR4_TRGOUT event
0110
ADC1_ETO_MU
X=0
EXINT line11 external pin
0110
ADC1_
ETP_MUX=0
EXINT line15 external pin
ADC1_ETO_MU
X=1
TMR1_TRGOUT event
ADC1_
ETP_MUX=1
TMR1_CH4 event
0111
OCSWTRG bit
0111
PCSWTRG bit
1000
Reserved
1000
Reserved