Power on via RTC timer example



  • Hi guys

    Recently, while looking at the M5Core2 schematic, I realised that the fine M5Stack engineers connected the RTC interrupt output to the power key input of the AXP192. This means the RTC IC can power on a fully shutdown M5Core2 by either using a timer or an alarm.

    I've put together an example showing how to setup an RTC timer to power on the system.

    Cheers
    Felix



  • Hi @felmue, Tested your code on M5Core2 works perfectly fine - it can also work with deep sleep function not just the normal sleep mode, I merged it with our master repository, thank you for your contribution!



  • Hello @Zontex

    cool, thanks.

    Regarding deep sleep: I don't think it works as expected. When I call M5.Axp.DeepSleep(1000 * 1000 * 2); I'd expect the system to restart from deep sleep after about 2 seconds, but instead the system shuts down completely and never wakes up again from deep sleep.

    The reason I think is that SetSleep() turns off power to the ESP32 IC and therefore line (time_in_us == 0) ? esp_deep_sleep_start() : esp_deep_sleep(time_in_us); is never executed and the system never goes into deep sleep but is shutdown completely.

    Note: If I comment out SetSleep() then deep sleep works as expected.

    I've submitted a issue for the deep sleep issue: https://github.com/m5stack/M5Core2/issues/17

    Thanks
    Felix



  • @felmue I'll have a look into this issue, I only tested the commented out version and it worked fine but if it's not commented out it does as you say, will look into it.



  • Hi @Zontex

    thank you for looking into it, I appreciate it. Please let me know if there is anything I can help with or test.

    Thanks
    Felix