Battery voltage monitor and AD conversion for XIAO_ESP32C

The battery pad of XIAO_ESP32C3 is not connected to any port, so the battery voltage cannot be read and there is a risk of over-discharging the battery.
(XIAO_BLE has a port connected to the pad and can read the voltage.)
The battery voltage was divided by 1/2 with 200k and connected to the A0 port so that the voltage could be monitored.

About the AD conversion of the ESP32C3
The datasheet says nominally 2500mV full scale AD conversion, but there is a large variation from chip to chip, actually ±10%. My chip was 2700mV full scale.
Fortunately, the calibrated correction value for each chip is written in the fuse area, and by using the function alalogReadMilliVolts(), I can read the corrected voltage value without doing anything special.
The result of AD conversion and the voltage measured by the multimeter agree well with each other with an error of about 5 mV, which is not a problem in practical use.
In addition, during communication in particular, spike-like errors occurred, which had to be averaged out 16 times to remove them.

Reference:
Analog to Digital Converter - ESP32-C3 - — ESP-IDF Programming Guide v4.3-beta3 documentation
“\Arduino15\packages\esp32\hardware\esp32\2.0.5\cores\esp32\esp32-hal-adc.h or .c”

void setup() {
  Serial.begin(115200);
  pinMode(A0, INPUT);         // ADC
}

void loop() {
  uint32_t Vbatt = 0;
  for(int i = 0; i < 16; i++) {
    Vbatt = Vbatt + analogReadMilliVolts(A0); // ADC with correction   
  }
  float Vbattf = 2 * Vbatt / 16 / 1000.0;     // attenuation ratio 1/2, mV --> V
  Serial.println(Vbattf, 3);
  delay(1000);
}

I wonder if there’s any way to use the matrix mapping in the ESP to actually attach a port/pin to the battery? It’s not so hard to add a voltage divider, but it seems almost impossible to understand why this board has a charger but can’t read the battery charge!

Yea, Your on the bus with the rest of us SMH…
GL :-p

As far as the schematic shows, the battery terminal is not connected to any port.

Hence the Voltage divider youtube video :-), either intentional?(without explanation) or a HUGE, GIGANTIC fail by whomever at Seeed Engineering.
SMH ;-p