GD32A50x User Manual
276
hardware on-chip over-sampling or software averaging. If higher precision
temperature is required, it must be sampled several times (more than 50 times is
recommended) for average.
When the INREFEN bit in ADC_CTL1 register is set, the VREFINT channel (ADC_IN17) is
enabled. The internal reference voltage (VREFINT) provides a stable (bandgap) voltage
output for the ADC and comparators. VREFINT is internally connected to the ADC_IN17 input
channel.
14.4.12.
Programmable resolution (DRES)
The resolution is configured by programming the DRES[1:0] bits in the ADC_OVSAMPCTL
register. For applications that do not require high data accuracy, lower resolution allows faster
conversion time.
The DRES[1:0] bits must only be changed when the ADCON bit is reset.
Lower resolution reduces the conversion time needed for the successive approximation steps
as shown in
Table 14-4. tCONV timings depending on resolution
Table 14-4. t
CONV
timings depending on resolution
DRES[1:0]
bits
t
CONV
(ADC clock
cycles)
t
CONV
(ns) at
f
ADC
=15MHz
t
SMPL
(min)
(ADC clock
cycles)
t
ADC
(ADC clock
cycles)
t
ADC
(us) at
f
ADC
=15MHz
12
12.5
833 ns
2.5
15
1000 ns
10
10.5
700 ns
2.5
13
867 ns
8
8.5
567ns
2.5
11
733 ns
6
6.5
433 ns
2.5
9
600 ns
14.4.13.
On-chip hardware oversampling
The on-chip hardware oversampling circuit performs data preprocessing to offload the CPU.
It can handle multiple conversions and average them into a single data with increased data
width, up to 16-bit.
The on-chip hardware oversampling circuit is enabled by OVSEN bit in the
ADC_OVSAMPCTL register. It provides a result with the following form, where N and M can
be adjusted, and D
out
(n) is the n-th output digital signal of the ADC:
Result=
1
M
*
∑
D
out
(n)
N-1
n=0
(14-1)
The on-chip hardware oversampling circuit performs the following functions: summing and bit
right shifting. The oversampling ratio N is defined by the OVSR[2:0] bits in the
ADC_OVSAMPCTL register. It can range from 2x to 256x. The division coefficient M means
bit right shifting up to 8-bit. It is configured through the OVSS[3:0] bits in the
ADC_OVSAMPCTL register.
Summation units can produce
up to 20 bits (256 x 12-bit), which is first shifted right. The upper
bits of the result are then truncated, keeping only the 16 least significant bits rounded to the
nearest value using the least significant bits left apart by the shifting, before being finally
transferred into the data register.