What is the consideration about battery charging exactly?

Thank you for answer.

I guess you mean powering XIAO board not charging here. Am I right?

I want to check I have correctly understood your explanations.

  1. P0.14 state doesn’t matter when powering XIAO board through USB → it is okay to set P0.14 low
  2. Set P0.14 to low when powering XIAO through a battery
  3. Set P0.14 to low to enter sleep mode with ADC function activated.

It seems awkward little bit because this means P0.14 just should be always low.
Is it still valid to set P0.14 to HIGH to prevent damaging P0.31 when ADC is turned off?
For instance, can I make XIAO enter sleep mode without ADC if I set P0.31 HIGH before entering sleep mode?

Does this include charging battery through USB bus power?

Here, I guess that connecting it to ground means setting the voltage level to LOW in software manner like:

pinMode(VBAT_ENABLE, OUTPUT);
digitalWrite(VBAT_ENABLE, LOW);

Fundamentally, I have question about how voltage divider works here.

The voltage divider consists of VBAT-1M-P0.31-510k-P0.14.
Assume the maximum voltage scenario, VBAT=4.2V.

P0.14 can be 0V in LOW or 3.3V in HIGH.
If P0.14 is LOW, the voltage at P0.31 will read 1.419V and this is way lower than 3.3V, P0.31 won’t be never damaged.

On the other hand, when P0.14 is HIGH, the voltage at P0.31 will be some value between 3.3V and 4.2V which is above logic level 3.3V, so it P0.31 could be damaged.

This result won’t be changed with or without ADC and with or without USB connection.
If I have battery connection anyway, P0.31 won’t be damaged when P0.14 is LOW and P0.31 could be damaged when P0.14 is HIGH.

Why the wiki recommends to set P0.14 HIGH at the very first time?