-
I charged my M5StickC to full and flashed a blinky sketch. It's been working just fine (including console log of the time) for hours now.
Have you tried charging yours fully?
It would be nice to get some bindings with the AXP192 though, as it also controls the backlight of the LCD :P It's using the st7735 but without the backlight getting power, we can't see anything on the screen (or at least that's what I think; maybe I'm just using the lcd wrong).
Would also be nice if we can somehow get something like https://www.espruino.com/Reference#l_NRF_getBattery working through the power management chip :P
-
This initialisation code seems to work - it turns the backlight on, charges the battery etc. Needs to be put into a module when time permits. You can get the battery voltage and current using
batV
andbatA
:I2C1.setup({scl:22,sda:21,bitrate:400000}); function init(){ function Write1Byte(a,d) { I2C1.writeTo(0x34,a,d);} // Set LDO2 & LDO3(TFT_LED & TFT) 3.0V Write1Byte(0x28, 0xcc); // Set ADC to All Enable Write1Byte(0x82, 0xff); // Bat charge voltage to 4.2, Current 100MA Write1Byte(0x33, 0xc0); // Enable Bat,ACIN,VBUS,APS adc Write1Byte(0x82, 0xff); // Enable Ext, LDO3, DCDC1 // Close DCDC2 output // with out LD02 LCD light it is 0x49 Write1Byte(0x12, 0x4D); // 128ms power on, 4s power off Write1Byte(0x36, 0x0C); // Set RTC voltage to 3.3V Write1Byte(0x91, 0xF0); // Set GPIO0 to LDO Write1Byte(0x90, 0x02); // Disable vbus hold limit Write1Byte(0x30, 0x80); // Set temperature protection Write1Byte(0x39, 0xfc); // Enable RTC BAT charge Write1Byte(0x35, 0xa2); // Enable bat detection Write1Byte(0x32, 0x46); } init(); function batV() { I2C1.writeTo(0x34,0x78); var d = I2C1.readFrom(0x34,2); var v = d[0]*16+d[1]; const ADCLSB = 1.1 / 1000.0; return v * ADCLSB; } function batA() { function read13(a){ I2C1.writeTo(0x34,a); var d = I2C1.readFrom(0x34,2); return d[0]*32+d[1]; } // current in - current out (ma); return ( read13(0x7A)-read13(0x7C))/2; }
If you have had no problems with the Atom, it certainly looks like the AXP192 needs to be initialised. Among other things, it powers the RTC which can reset the ESP32. I plan to test some initialisation code based on the Arduino class - as @MaBe suggests - when I get a chance.