🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Core2: AXP2101 giving false values

    Scheduled Pinned Locked Moved PRODUCTS
    5 Posts 4 Posters 4.7k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      TuigWerk
      last edited by

      Hi there,

      I have a problem getting my arduino program to work on my new Core2 with an AXP2101 power management chip. The exact same code works properly on an older Core2 with an AXP192.

      When I request M5.axp.isCharging(), this value always stays 1, also when it is not plugged in. Also GetBatPower() and GetBatChargeCurrent() give incorrect values. It seems that the arduino Core2 library is not up-to-date..
      Can anyone help me and tell me how to get the correct data?

      Thanks a lot! Tjeerd

      1 Reply Last reply Reply Quote 0
      • felmueF Offline
        felmue
        last edited by felmue

        Hello @TuigWerk

        these functions are not (yet) implemented for the AXP2101. For instance isCharging() always returns true. See here.

        Maybe have a look at M5Unified library. isCharging() seems to be implemented here.

        Thanks
        Felix

        GPIO translation table M5Stack / M5Core2
        Information about various M5Stack products.
        Code examples

        T 1 Reply Last reply Reply Quote 0
        • T Offline
          TuigWerk @felmue
          last edited by

          Hi @felmue , thank you very much for your help. With that I was able to add some lines to the axp2101.h and axp2101.cpp of the Core2 library. I can now successfully check .isCharging() of the axp2101. I am will try to do the same thing for other functions..

          Thanks again!

          added to axp2101.h:

          bool isCharging(void);
          

          added to axp2101.cpp:

          bool AXP2101::isCharging()  {
              uint8_t registerValue = readRegister8(_addr, 0x01, _speed);      
              return (registerValue & 0b01100000) == 0b00100000;
          } 
          

          Changed in axp.cpp:

          bool AXP::isCharging() {
              if (_pmic == pmic_axp192) {
                  return axp192.isCharging();
              }
              if (_pmic == pmic_axp2101) {
                  return axp2101.isCharging();
              }
              return true;
          }
          
          1 Reply Last reply Reply Quote 0
          • R Offline
            robouden
            last edited by

            On the M5StackCore 2 V1.0 by connecting the battery, it did automatically switch on. But on the M5SatckCore 2 V1.1 it does not. How to program the M5Satck Core 2 V1.1 to automatically power up from connecting to a battery?

            Regards,
            Rob Oudendijk

            C 1 Reply Last reply Reply Quote 0
            • C Offline
              colintd @robouden
              last edited by

              @robouden To get the Core2 V1.1 units to power on from an external supply, I found a fix was needed in the axp::begin() function to check for VBUS power before deciding whether to enable the VBUS converter. Both my fix and the current official version can be found here https://github.com/m5stack/M5Core2/commit/c26f1b63635c90d9bd82d87db6ab4d9048b3a1b5

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post