Core2: AXP2101 giving false values
-
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
-
-
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; }
-
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 -
@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