Introduction

This chapter describes the usage of the 12-bit analog-to-digital converter (ADC).

ADC is a successive-approximation register (SAR) ADC and the conversion result of ADC sample is stored in the result register and can be read on demand.

ADC characteristics are as follows:

  • Resolution: 12 bit

  • ENOB: 10 bit

  • Sample Frequency: 31.25 kHz ~ 250 kHz, 166.67 kHz is recommended (default)

  • Sample Capacitance: 2.4 pF ~ 2.93 pF

  • Reference Voltage: Fixed, cannot be externally supplied

  • Internal Impedance: About 500

  • FIFO size: 64 x 16 bit

  • Channel switch list length: 1 ~ 16

  • Description of channels:

RTL8721Dx:

Channel

ADC channel ID

Pin name

Input voltage (V)

Normal channel

CH0~CH6

PB13~PB19

0~3.3

BAT_MEAS channel

CH7

BAT_MEAS

0 ~ 5

Note

ADC multi-channel sample is time-division multiplexing on the same circuit. The sample frequency value listed above is specific to a single channel. When multiple channels are set in the channel switch list, the sample frequency will decrease accordingly.

ADC Calibration

ADC Voltage Calibration

  • To improve the linearity of ADC input/output characteristics, each chip undergoes nonlinear calibration in factory to reduce ADC gain errors and offset errors.

  • Users can directly retrieve voltages via the following APIs:

    • ADC_GetVoltage(u32 chan_data): Get calibrated normal channel voltage.

    • ADC_GetVBATVoltage(u32 vbat_data): Get calibrated BAT_MEAS channel voltage.

ADC Internal Resistor Calibration

  • ADC internal resistor R varies among chips.

  • Users can directly retrieve internal resistor value via ADC_GetInterR()