GD32W51x User Manual
369
14.4.10.
DMA request
The DMA request is used to transfer data for conversion of more than one channel. The DMA
request of regular channel is enabled by the DMA bit of ADC_CTL1 register. When this bit is
set, the ADC generates a DMA request at the end of conversion of a regular channel. When
this request is received, the DMA will transfer the converted data from the ADC_RDATA
register to the destination location which is specified by the user.
14.4.11.
Overflow detection
Overflow detection is enabled when DMA is enabled or EOCM bit in ADC_CTL1 is set. An
overflow event occurs when a regular conversion is done before the prior regular data has
been read out. The ROVF bit of the ADC_STAT is set. Overflow interrupt is generated if the
ROVFIE bit in the ADC_CTL0 is set.
It is recommended to reinitialize the DMA module to recover the ADC from ROVF state. To
ensure the regular converted data are transferred correctly, the internal state machine is reset.
The ADC conversion will be stalled until the ROVF bit is cleared.
Software procedure for recovering the ADC from ROVF state:
1. Clear DMA bit of ADC_CTL1 to 0
2. Clear ADCON bit of ADC_CTL1 to 0
3. Clear CHEN bit of DMA_CHxCTL to 0 with reinit DMA module
4. Clear ROVF bit of ADC_STAT to 0
5. Set CHEN bit of DMA_CHxCTL to 1
6. Set DMA bit of ADC_CTL1 to 1
7. Set ADCON bit of ADC_CTL1 to 1
8. Wait T(setup)
9. Start conversion with software or trigger.
14.4.12.
Temperature sensor, internal reference voltage VREFINT and external
battery voltage VBAT
When the TSVREN bit in ADC_CCTL register is set, the temperature sensor channel
(ADC_IN9) and V
REFINT
channel (ADC_IN10) are enabled. The temperature sensor can be
used to measure the ambient temperature of the device. The sensor output voltage can be
converted into a digital value by ADC. The sampling time for the temperature sensor is
recommended to be set to at least t
s_temp
μs(refer to device datasheet for more information).
When this sensor is not in use, it can be set in power down mode by resetting the TSVREN
bit.
The output voltage of the temperature sensor changes linearly with temperature. Because
there is an offset, which is up to 45°C and varies from chip to chip due to process variation,
the internal temperature sensor is more suitable for applications that detect temperature