Skip to content

Power: Core2 v1.1 suspend the DCDC under-voltage power-off while disabling the external output - #375

Merged
lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:core2v11_ext_off
Sep 20, 2026
Merged

lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:core2v11_ext_off

Conversation

@ainyan03

Copy link
Copy Markdown
Contributor

Summary

On the Core2 v1.1 (AXP2101), calling M5.Power.setExtOutput(false) while the board is powered from USB without a battery switches the whole board off: the PMIC latches into its power-off state and stays there until the power key is pressed, and the USB link disappears with it. This PR turns that into an ESP32 brownout reset with the PMIC and the USB link alive. With a battery the call is unaffected.

Cause

The AXP2101 BLDO2 output is the board's AXP_BoostEN line and drives two enables at once: the EN of the SY7088 boost that makes the 5 V bus, and the /EN of the ME1502 switch that ties USB VBUS to the bus when the boost is off. While BLDO2 falls, the switch closes before the boost stops (measured by sweeping BLDO2: switch on at about 0.9 V, boost off at about 0.5 V), so for a moment the boost output feeds back through VBUS into the PMIC input. With a battery VSYS rides through it. Without one the transient pulls VSYS down and the AXP2101 powers off on DCDC under-voltage (power-off source register 0x21 = 0x20), which is a latched state.

There is no BLDO2 voltage at which both the boost and the switch are off, so the transition cannot be sequenced; it can only be made survivable.

Change

setExtOutput(false) on the Core2 / Tough AXP2101 path:

  • reads register 0x23 and clears the DCDC1 / DCDC3 under-voltage power-off bits, writes BLDO2 off, waits 20 ms (the transition completes within 10 ms) and writes the register back;
  • skips the suspend and the wait when BLDO2 is already off (no transition);
  • fails closed: when 0x23 cannot be read or the suspend write fails, the output is left untouched and false is returned; a failed re-arm after the transition is reported as false too (the output is off in that case; the warning says so).

Power_Class::begin() sets the DCDC1 / DCDC3 bits of 0x23 on the AXP2101 (their chip default) so that a brownout reset during the call, which skips the restore, does not leave the protection off.

The setExtOutput doc notes the behaviour: on such a unit without a battery the board resets and reboots with the output enabled again, so a sketch that unconditionally disables the output at startup will loop; with a battery or with 5 V supplied on the bus the transition does not disturb the board; disabling an enabled output blocks for about 20 ms on this model.

Verification

  • Core2 v1.1 with battery: setExtOutput(false) unchanged in effect, 0x23 restored to its previous value, repeated calls and re-enable fine.
  • Core2 v1.1 without battery: E BOD: Brownout detector was triggered followed by a reset instead of a latched power-off; the USB link stays up and the board comes back with 0x23 re-armed.
  • Core2 v1.0 (AXP192) unaffected (that path is untouched).
  • Builds: Arduino esp32 / esp32s3, ESP-IDF 6 (GCC 14, -Wall -Werror).

…bling the external output

On the Core2 v1.1 the AXP2101 BLDO2 drives both the boost enable and the
/EN of the switch that ties USB VBUS to the 5V bus. While BLDO2 falls the
switch closes before the boost stops and the boost output feeds back
through VBUS into the PMIC. Without a battery the transient pulls VSYS
down and the AXP2101 latches off on DCDC under-voltage (0x21 = 0x20)
until the power key is pressed; the USB link goes with it.

setExtOutput(false) now clears the DCDC1/DCDC3 under-voltage power-off
bits (0x23) for the transition and restores them 20 ms later (the
transition completes within 10 ms). Without a battery the ESP32 then
brownout-resets with the PMIC and the USB link alive; begin() re-arms
the bits since that reset skips the restore. The suspend is skipped when
BLDO2 is already off. The call fails closed: when the protection register
cannot be read or the suspend write fails the output is left untouched
and false is returned; a failed re-arm is reported as false as well.

Verified on a Core2 v1.1 with a battery (no change, register restored)
and without one (brownout reset instead of a latched power-off).
@lovyan03
lovyan03 merged commit 784e58a into m5stack:develop Sep 20, 2026
28 checks passed
@ainyan03
ainyan03 deleted the core2v11_ext_off branch September 20, 2026 06:39
@ainyan03 ainyan03 mentioned this pull request Sep 21, 2026
lovyan03 added a commit that referenced this pull request Sep 21, 2026
Power: Core2 v1.1 suspend the DCDC under-voltage power-off while disabling the external output
(cherry picked from commit 784e58a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants