technical questions about the charging circuit of core 2 / basic core

  • Hi everyone,
    This is my first post.
    I want to build a custom base plate for either the basic core or the core 2, that is partly similar to the battery bottom 2 or the go/fire battery bottom. I don't need any connectivity, nor do I need the extra battery, the microphone, or the imu.

    Requirements and my research

    I only need a connection to power. Maybe I throw in a rs485 transciever ic, or connectors for some gpios...

    But I have one requirement that is not optional. I need the builtin charging to work and display the correct charging state, but I don't understand if I have to do something special for that. Also I noticed that even when charging via USB-C the charging state does not work when the battery bottom 2 is connected.

    I read that you can tell the axp192 chip if the bus connector is sourcing, or sinking power.

    I can't use the battery bottom, because they are to high. The whole stack becomes to tall for my application.


    Why is that and can I prevent it?
    Why does the battery percentage behave strangely if the internal battery is not connected , but the battery bottom is?
    Is the axp192 capable to tell me if the bus is feeding power, so I can tell if the core is placed on the mount?
    Does another power base exist?

    My project

    I want to build room controller and heating control that is mounted on the wall in a light switch box. I am from Germany, where light switch boxes are round and have a diameter of 60 mm and most light switches are about 55mm wide and I want to mount the core 2 or basic core in these.
    The mounting itself is not that problematic, since I already printed a prototype cover-plate that fits my light switches. Since I have plenty of room in the electrical box, I am fitting a power-supply and an atom with a bme280 sensor, so the sensor stays in place even if the core is removed and carried around.
    I want the core to be removable, so I could take it with me outside or wherever. I didn't decide if I want the cores to be interchangable and if I want that to be possible i need to break out a uart or something, so the atom can tell me where it is placed.

  • Hello @NeoCortex1997

    both battery bottoms (M5GO bottom and M5GO bottom 2) have a separate charger IC built-in which might be the cause for the incorrect charging data you are seeing. (This should not be an issue if you build your own.) I suggest you also check the schematic.

    This function void AXP192::SetBusPowerMode(uint8_t state) can be used to switch between sourcing or sinking power. But please note: this is only true for M5Core2 as only the M5Core2 uses the AXP192. The M5Stack uses an IP5306, plus the internal logic is different so it doesn't need to switch between input and output.

    M5Core2 (output mode) : USB 5 V-> AXP192 -> 3.3 V (ESP32) -> booster on -> BUS 5 V (out)
    M5Core2 (input mode) : BUS 5 V -> AXP192 -> 3.3 V (ESP32) -> booster off
    M5Stack : USB 5 V = BUS 5 V -> IP5306 -> 3.3 V (ESP32) -- Edit: not 100 % sure here as there is no complete schematic for the M5Stack.

    Yes, the AXP192 is capable to tell whether the bus is feeding or not. This is checked at the end of the M5.begin() function like this:

      // axp: check v-bus status
      if (Read8bit(0x00) & 0x08) {
        Write1Byte(0x30, Read8bit(0x30) | 0x80);
        // if v-bus can use, disable M-Bus 5V output to input
      } else {
        // if not, enable M-Bus 5V output


  • Thanks For your quick reply, but could I use the void AXP192::SetBusPowerMode(uint8_t state) function inside micropython or in uiflow respectively?

    And for the question with feeding power:
    I might phrased it not in a way that my intentions were understandable. I want to check, if the module is powered by the bus, or by the battery. My intuitive answer would be that the charging state should reflect that, but I was not sure, so I wanted to ask.

    Additional questions

    Since the IP5306 is different, can it tell, if I feed power via usb or via the bus?
    Can the APX192 tell if power is fed via usb vs via bus?


    The module does not need to be charged via usb if it is in its mount, so I need to continue wirelessCommunication if it is not inside the mount. If there is no way to tell that, I need to break out one more pin to the pogo-pin connector that has a pull-up and is pulled to gnd via the mount.
    I would pull the pin to gnd, since it is already broken out. If i would like to pull it to 3.3v, I would have to route 3.3v from the m5atom and that seems unclean to me.
    The m5atom is more or less only used to read the sensor, communicate via rs485 and have direct communication with the M5Stack/M5Core2.


    I am considering to include an IMU on my board, to allow display rotation if the module is flipped 180°, but would likely not do that, because I hate working with miniscule smd packages...

  • Hello @NeoCortex1997

    yes. in UIFlow you can use the Set bus power mode disable/enable M-Bus 5V output block. It's under Hardware - Power when M5Core2 is selected as device.

    Well, with the AXP192. there are two functions to get GetVinVoltage() and GetVBusVoltage(); voltage. In M5Core2 the first is USB and the second is bus voltage. And I guess if the device is running and both are zero, it runs from battery. Unfortunately I can only see a Get VBus voltage block in UIFlow. You'll have to translate the C functions to micropython yourself.

    Re: IP5306 - I am sorry, but I don't know if it has this capability. The documentation on this customized IC is very lacking / not existing.


  • Thank you @felmue, you have been a really great help for me.

    Regarding the IPS5306:
    That's a question for the support tem then - I guess...

  • Hello,
    I'd like to join this conversation with similar question related to powering the Core2/Tough (AXP on board).
    What will happen if with "enabled M-bus 5V output" we will charge the system with external power connected to 5V pin on M-bus? Is it possible to set on battery charge when "output" is enabled?
    That can happen when you are using Tough and external power source f.ex. via RS485 socket (on Tough it's mounted DC/DC buck converter that is powering the system via 5V pin on M-bus socket).
    I assume that AXP192 is not managing the "hot-swap" and we can expect some strange results when 5v pin on M-bus (pin 31 named VBUS on AXP192 chip) is powered from "onboard 5V Booster" and from external DC/DC buck converter that is mounted on Tough.EXT module/board.
    Reason for questioning:
    I'm using Tough witch internal battery and 5V units connected via Grove socket. I need to power the units all the time. When "enable M-Bus 5V ouput" is active, than battery charging is not active when M5Stack Tough is powered from Tough DC/DC converter (green RS485 socket). So, I need to set "M-Bus output" disable. But then when the external power is off, the 5V booser is not working, so the unit is loosing power. I was trying to implement "hot-swap" procedure in code, but time of switch was too long to get it flawlessly.

    Looking for help ...

  • Hello @TapM

    the AXP192 does automatically switch between ACIN (USB) , VBUS (5 V pin on M-bus) and battery. However in your case only VBUS and battery are in the mix.

    I did some experiments (i.e. turning on internal 5 V boost w/o disabling VBUS) and yes, switching on the internal 5 V booster while power comes in via 5 V pin on M-bus immediately shuts the system down. My best guess is, that the AXP192 doesn't like the 'circle' that is created in that way, e.g. kind of powering itself through the internal 5 V booster.

    Not sure if there is a way to solve this w/o hardware modification.