From 3fe2cade14ad455f05786353215462c4e8ce8db2 Mon Sep 17 00:00:00 2001 From: ainyan03 <205502311+ainyan03@users.noreply.github.com> Date: Wed, 7 Oct 2026 03:03:57 +0000 Subject: [PATCH] Power: set the AXP2101 charge voltage to 4.2V at init (CoreS3 family, Core2 v1.1) The power-on value of REG 0x64 (constant-voltage target) is not always the datasheet default (011b = 4.2V): a CoreS3 SE was reported with 0x64 = 0x00, which is reserved in the current datasheet and was listed as 4.6V in an early revision. The cells on these boards are 4.2V types, so the target is now set explicitly at init, before the TS pin setting that lets the charger start. Chips that already read 0x03 are unaffected. A failed write is logged as a warning. A second Power.begin() call sets 4.2V again (when the write succeeds), replacing a lower target set with setChargeVoltage() before it. --- src/utility/Power_Class.inl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utility/Power_Class.inl b/src/utility/Power_Class.inl index 7b6e318..58c19f6 100644 --- a/src/utility/Power_Class.inl +++ b/src/utility/Power_Class.inl @@ -443,6 +443,10 @@ namespace m5 // TS senses the 5V bus (no battery thermistor). Its power-on default comes from the // EFUSE and differs between chips; when it is left as the temperature input, the // charger treats the bus voltage as a cold battery and never charges. + // The charge voltage (0x64) is not always at the datasheet default either: a unit read 0x00, + // which is reserved (4.6V in an early datasheet revision). The cell is a 4.2V type. + // Set it before the TS change below lets the charger start. + if (!Axp2101.setChargeVoltage(4200)) { ESP_LOGW("Power", "AXP2101: failed to set the charge voltage."); } Axp2101.bitOn(0x50, 0x10); // TS pin: external input, does not affect the charger // The touch INT is routed to the ESP32 as TOUCH_INT -> AW9523 P1_2 -> AW9523 INTN // -> I2C_INT -> GPIO21. The power key is wired to the AXP2101 PWRON only, and the @@ -911,6 +915,8 @@ namespace m5 // setExtOutput) makes the AXP2101 power itself off, and it stays off until the power // key; let the ESP32 brown out and restart instead. Over-voltage (bit 5) stays enabled. Axp2101.bitOff(0x23, 0x1F); // DCDC1-5 UVP power-off disable + // Charge voltage: the power-on value may be reserved; see the CoreS3 setup. + if (!Axp2101.setChargeVoltage(4200)) { ESP_LOGW("Power", "AXP2101: failed to set the charge voltage."); } // No battery thermistor on TS (reads about 2.9V); see the CoreS3 setup. Axp2101.bitOn(0x50, 0x10); // TS pin: external input, does not affect the charger