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

    CoreInk wakeup from DeepSleep when on USB power

    Modules
    3
    5
    740
    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.
    • U
      user_m5stack471
      last edited by

      On my version of CoreInk (R211-200908) the RTC is connected to the ESP32-GPIO19, but this is NOT an RTC-GPIO.

      My understanding is that this means it can NOT wake the ESP32 from DeepSleep (whenever the CoreInk is powered from the USB).

      (This is not an issue when running on battery, as in that case the power is completely disconnected from the ESP32, and then the RTC can restart the ESP32 by reapplying the power - ie not using GPIO19.)

      The "int M5CoreInk::shutdown(int seconds)" software in "https://github.com/m5stack/M5Core-Ink/blob/master/src/M5CoreInk.cpp" tries to use:

      gpio_wakeup_enable(GPIO_NUM_19, gpio_int_type_t::GPIO_INTR_LOW_LEVEL);
      esp_sleep_enable_gpio_wakeup();
      ...
      esp_deep_sleep_start();

      to do this, but it appears that this will only wake the ESP32 from "esp_light_sleep_start()" NOT from "esp_deep_sleep_start()".

      The only way round this I can find is adding:
      esp_sleep_enable_timer_wakeup(seconds * 1000000); // or * 1100000
      (after the "esp_sleep_enable_gpio_wakeup();")
      (which uses a timer to wake the ESP32, and not the RTC-GPIO19).

      However this is far from ideal as you can't use the RTC to wake the ESP32 from DeepSleep for any one-off or weekly RTC timers if powered from the USB.

      (It would therefore seem to me to be a design-error to use GPIO19 as the RTC-wake-interrupt-pin and not an RTC-GPIO?)

      If I am mistaken then I would like to know how to use RTC/GPIO19 to wake the ESP32 from DeepSleep?

      (Note this is a different issue to https://community.m5stack.com/topic/4332/coreink-wakeup-from-usb-power.)

      Any comments would be appreciated.

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

        Hello @user_m5stack471

        ESP32 documentation RTC_GPIOs / Sleep Modes confirms that GPIO19 is not an RTC-GPIO and therefore cannot be used to wake ESP32 from deep sleep.

        That said, I am curious to know your motivation to put ESP32 into deep sleep while running from USB? I am asking because the overall power consumption of M5CoreInk with ESP32 in deep or light sleep is about the same. The reason for that is that with only ESP sleeping all the rest DC/DC converter, USB chip, etc. is still consuming power.

        A while ago I measured the power consumption with ESP32 in deep and light sleep when running from internal battery. The difference is minimal. Please see here.

        So I suggest you either don't use any ESP32 sleep mode since you are powering the device from USB anyways. Or use ESP light sleep which uses a bit more energy as deep sleep, but allows to be woken up via GPIO19.

        Thanks
        Felix

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

        1 Reply Last reply Reply Quote 0
        • U
          user_m5stack471
          last edited by

          Hi Felix,

          Many thanks for your comments - I appreciate them!

          That said, I am curious to know your motivation to put ESP32 into deep sleep while running from USB?
          I am asking because the overall power consumption of M5CoreInk with ESP32 in deep or light sleep is about the same.

          Because the DeepSleep wakes by re-running the setup() code, whereas the LightSleep wakes by just continuing from the line after the "esp_light_sleep_start()" command.

          This means that you can't use the same sleep code when running (ie.charging) on USB as you do when running on Battery.

          And specifically the basic example software such as "github.com/m5stack/M5Core-Ink/tree/master/examples/Basics/RTC_Clock" just go to DeepSleep, and when connected to USB power (ie. when on-charge) never wake to update the time or anything again, until they wake again when the USB is disconnected (which sometimes doesnt happen reliably either).

          (IE. one would have to write extra different sleep-code which would not have been necessary if the RTC-interrupt-pin was connected to an ESP32-RTC-GPIO.)

          However, as I said one can add a:

          esp_sleep_enable_timer_wakeup(seconds * 1000000); // or * 1100000
          

          into the https://github.com/m5stack/M5Core-Ink/blob/master/src/M5CoreInk.cpp:

          int M5CoreInk::shutdown(int seconds) {
          

          code, which then uses a timer to wake the ESP32 from DeepSleep when on USB, and not the RTC-interrupt-to-GPIO19.

          Although this is not ideal as you then can't use any of the BM8563-RTCs Weekly or CountDown-Timer functions to wake the ESP32 from DeepSleep when being charged.

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

            Hello @user_m5stack471

            ok, I see, thank you for the explanation.

            BTW: if you want setup() being re-run after light sleep you could try to restart ESP32 yourself with ESP.restart(); just after waking from light sleep. (Note: not tested myself - just an idea)

            Thanks
            Felix

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

            ajb2k3A 1 Reply Last reply Reply Quote 0
            • ajb2k3A
              ajb2k3 @felmue
              last edited by

              Have you guys seen this video from Andreas Spiess yet?
              https://www.youtube.com/watch?v=7bBDMW_m5vc

              UIFlow, so easy an adult can learn it!
              If I don't know it, be patient!
              I've ether not learned it or am too drunk to remember it!
              Author of the WIP UIFlow Handbook!
              M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

              1 Reply Last reply Reply Quote 0
              • First post
                Last post