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:
12bitENOB:
10bitSample Frequency:
31.25kHz ~250kHz,166.67kHz is recommended (default)Sample Capacitance:
2.4pF ~2.93pFReference Voltage: Fixed, cannot be externally supplied
Internal Impedance: About
500kΩFIFO size:
64x16bitChannel switch list length:
1~16Description of channels:
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 |
Channel |
ADC channel ID |
Pin name |
Input voltage (V) |
|---|---|---|---|
Normal channel |
CH0~CH5 |
PB5~PB0 |
0 ~ 3.3 |
Channel |
ADC channel ID |
Pin name |
Input voltage (V) |
|---|---|---|---|
Normal channel |
CH0~CH5 |
PB5~PB0 |
0 ~ 3.3 |
Channel |
ADC channel ID |
Pin name |
Input voltage (V) |
|---|---|---|---|
Normal channel |
CH0~CH5 |
PB5~PB0 |
0 ~ 3.3 |
Channel |
ADC channel ID |
Pin name |
Input voltage (V) |
|---|---|---|---|
Normal channel |
CH0~CH5 |
PB5~PB0 |
0 ~ 3.3 |
Channel |
ADC channel ID |
Pin name |
Input voltage (V) |
|---|---|---|---|
Normal channel |
CH0 ~ CH5 |
PA0 ~ PA5 |
0 ~ 1.8 |
BAT_MEAS channel |
CH6 |
BAT_MEAS |
0 ~ 5 |
Channel |
ADC channel ID |
Pin name |
Input voltage (V) |
|---|---|---|---|
Normal channel |
CH0~CH7 |
PA20~PA17, PA15~PA12 |
0 ~ 3.3 |
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
Rvaries among chips.Users can directly retrieve internal resistor value via
ADC_GetInterR()