BL602/604 Reference Manual
Set GPIO according to the channel used
According to the analog pin used, determine the channel number used, initialize the corresponding GPIO as an analog
function. It should be noted that when setting the GPIO as an analog input, do not set the GPIO pull-up or pull-down,
you need to set it to float.
Set the channel to be converted
Set the corresponding channel register according to the analog channel and conversion mode used.
For single-channel conversion, set the converted channel information in the gpadc_pos_sel and gpadc_neg_sel reg-
isters.
For multi-channel scanning mode, set gpadc_scan_length, gpadc_reg_scn_posX and gpadc_reg_scn_negX according
to the number of scanning channels and scanning order.
Set the data reading method
According to the way of reading data introduced by ADC FIFO, select the mode to use and set the corresponding
register. If you use DMA, you also need to configure a channel of DMA to cooperate with the ADC FIFO to complete
the data transfer.
Start conversion
Finally set gpadc_res_sel to select the precision of the data conversion result. Finally set gpadc_global_en = 1 and
gpadc_conv_start = 1 to start the ADC to start conversion.
When the conversion is complete and needs to be converted again, gpadc_conv_start needs to be set to 0 and then
set to 1 in order to trigger the conversion again.
4.3.9 VBAT measurement
The VBAT/2 measurement is the voltage of the chip VDD33, not the voltage of an external battery such as a lithium
battery. If you need to measure the voltage of a power supply head such as a lithium battery, you can divide the
voltage and then input it to the ADC’s GPIO analog channel. Measuring the voltage of VDD33 can reduce the use of
GPIO.
The VBAT/2 voltage measured by the ADC module is after a partial pressure.The actual input voltage to the ADC
module is half of VDD33, that is, VBAT/2 = VDD33/2. Because the voltage is divided, in order to obtain higher
accuracy, it is recommended that the reference voltage of the ADC is 1.8V, single-ended mode is used, the positive
input voltage is VBAT/2, the negative input voltage is GND, and Gpadc_vbat_en is set to 1 to start.
After conversion, multiply the corresponding conversion result by 2 to get the VDD33 voltage.
4.3.10 TSEN measurement
The ADC can measure the internal diode or external diode voltage value, and the voltage difference between the diode
and temperature is related, so by measuring the voltage of the diode, the ambient temperature can be calculated. We
BL602/604 Reference Manual 52/ 195
@2020 Bouffalo Lab