Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
132
Ver.1.0.0
5.2.1.1 MUST Use GPIO Input Channel
For Telink 826x family, ADC module supports “VCC/VBAT” input channel to sample
supply voltage.
For TLSR8232,
though this design is reserved (corresponding to “VBAT” in the enum
type
“ADC_InputPchTypeDef”), based on certain reasons, it’s not allowed to use the
“VBAT” channel. Therefore, user must adopt GPIO input channel of ADC instead, which
includes PA6, PA7, and PB0~PB7.
/*ADC analog positive input channel selection enum*/
typedef
enum
{
NOINPUTP
,
A6P
,
A7P
,
B0P
,
B1P
,
B2P
,
B3P
,
B4P
,
B5P
,
B6P
,
B7P
,
PGA0P
,
PGA1P
,
TEMSENSORP
,
RSSI_P
,
VBAT
,
}
ADC_InputPchTypeDef
;
There are two ways to implement ADC sampling of supply voltage via GPIO input
channel.
1) Directly connect power supply to GPIO input channel of ADC
At ADC initialization, by setting specific GPIO to high impedance, voltage at the
GPIO equals supply voltage, so ADC can directly sample supply voltage.
2) Use GPIO high-level output to sample supply voltage without connection between
supply and GPIO input channel.
As per the design of TLSR8232 internal circuit, voltage of GPIO high-level output
always equals supply voltage and thus can be sampled by ADC.
I
n the project “5316_ble_remote” of the SDK, the second method is employed with GPIO
input channel selected as PA7.