Bricked M5StickC after bad AXP192 config?



  • I was in process of writing a C driver for the AXP912 chip.

    Everything was going fine until I started working on the 0x33 register ie. AXP192_CHARGE_CONTROL1. I wrote the value 0xd0 ie. 0b11010000 which is supposed to mean:

    0x80 : 0b10000000 -> enable charging
    0x40 : 0b01000000 -> target voltage 4.2V
    0x10 : 0b00010000 -> 15% end charge current
    0x00 : 0b00010000 -> 100mA charge current

    0xd0 : 0b11010000

    After running the program M5StickC stopped responding in the usb port. USB device can be found but the connection times out.

    -cut-
    $ make erase_flash
    Toolchain path: /Users/tuupola/.espressif/tools/xtensa-esp32-elf/esp32-2019r1-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
    Toolchain version: esp32-2019r1
    Compiler version: 8.2.0
    Python requirements from /Users/tuupola/esp/esp-idf/requirements.txt are satisfied.
    Erasing entire flash...
    esptool.py v2.8-dev
    Serial port /dev/cu.usbserial-XXXXXXXXXX
    Connecting......................................_____

    A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
    make: *** [erase_flash] Error 2
    -cut-

    I can connect to the usb port but there is no output.

    -cut-
    $ screen /dev/cu.usbserial-XXXXXXXXXX 115200
    -cut-

    I though maybe this is one of the intermittent error M5Sticks have and tried to flash another unit. After flashing same problem.

    I tried updating the USB controller firmware. Update was successfull but did not help the problem. Also tried to connect G0 and GND when programming. Did not help.

    So my guess is somehow AXP192 can be configured so that it does not allow either the ESP32 or serial port start.

    Question is how to recover?



  • Debugging this further, I am able to get some serial output by first pressing the power button for ten seconds and then press it for one second.

    After the short press I can see the boot. up sequence and then it goes quiet again. Is this the old problem of M5StickC not booting if battery is too empty?



  • Apparently this was caused by accidentally writing 0x0 to AXP192_DCDC13_LDO23_CONTROL which turned off DCDC1 which provides power to ESP32 chip. The behaviour I was seeing was normal boot and then the firmware turning DCDC1 off.

    I was able to revive the M5StickC by connecting G0 to GROUND and randomly doing short and long power button presses while trying to erase flash. After few tries erase flash command suddenly succeeded.


  • Banned

    This post is deleted!