Skip to content

Issue using lightsleep on CoreS3 (lite) #214

Open

Description

@ngolf

I'm encountering an error when trying to get to light sleep on a CoreS3 Lite:

(debug message from my program): Sleep delay reached, entering light sleep
E (61558) sleep: Incorrect wakeup source (4) to disable.

The code does:

In setup():
(...)
M5.Power.begin()
..

In loop():

(...)
    if (hasBattery && (idleTime > SLEEP_DELAY_MS)) {
        Serial.println("Sleep delay reached, entering light sleep");
        M5.Power.lightSleep(0); // wake only on power button
        lastInteractionTime = millis();  // reset after wake
    }

No other M5.Power calls, other than getBatteryLevel() and isCharging.

I'm using v0.4.6 of the library, and the firmware of the cores3 is on the latest version too.

Activity

  1. ngolf commented on Dec 15, 2025

    @ngolf
    Author

    I've managed to get the sleep to work (by using a value different than 0ms), but the device does not seem to wake up with either a short, or long press of the power button, or touch of the screen.

    I seem to have to do 2 long ish presses (one that presumably powers off, then one that powers on (seems to do a full boot, not resuming code where it stopped)

  2. ainyan03 commented on Jul 31, 2026

    @ainyan03
    Contributor

    Thanks for the detailed report. There were three separate things going on here, and the first two are now fixed on develop.

    1. lightSleep(0) did not sleep, and logged Incorrect wakeup source (4) to disable

    Wakeup source 4 is ESP_SLEEP_WAKEUP_TIMER. A duration of 0 ended up disabling the timer wakeup source that had never been enabled, which is what ESP-IDF was complaining about, and the call then had no wakeup source left at all.

    This was fixed in #290. 0 now explicitly means "do not sleep" (the call returns immediately and logs a warning), and the default argument is sleep_no_timer, so sleeping without a timer is simply:

    M5.Power.lightSleep();   // sleep until the wakeup pin is triggered

    2. CoreS3 had no wakeup pin at all

    This is the main cause of what you saw, and it is fixed in #291.

    The touch interrupt does reach the ESP32 on this board, through the IO expander:

    TOUCH_INT -> AW9523 P1_2 -> AW9523 INTN -> I2C_INT -> GPIO21
    

    GPIO21 is an RTC IO on the ESP32-S3, so it works for both light sleep and deep sleep. Two interrupt sources have to be released before sleeping, which the library now does for you: the touch panel holds its INT asserted until the touch data is read, and the AW9523 reports input changes only, so its input port has to be read as well.

    Verified on a CoreS3 with Arduino 2.0.17 (ESP-IDF 4.4) and Arduino 3.3.4 (ESP-IDF 5.5); touch wakes the device from both light sleep and deep sleep. The CoreS3 SE shares the same wiring, so it should behave the same way — I would appreciate a confirmation from your side since I only have the plain CoreS3 here.

    The same PR also fixes a related problem: when built with Arduino 2.x, the wakeup pin was silently dropped in deepSleep() on every board, because ESP-IDF v4 does not define the SOC_PM_SUPPORT_EXT0_WAKEUP / SOC_PM_SUPPORT_EXT1_WAKEUP macros the code was testing.

    3. The power button cannot wake CoreS3

    Unfortunately this one is a hardware limitation. On the schematic the power key is wired to the AXP2101 PWRON pin only, and the AXP2101 IRQ output is shared with the RTC INT without being routed to the ESP32. There is no path by which the ESP32 can see a button press while it is asleep, so touch is the only usable wakeup source on this board.

    What you observed with two long presses is the AXP2101 performing a power off followed by a power on, which is why it comes back as a full boot instead of resuming.


    So on develop the following should do what you originally wanted, waking on a touch of the screen:

    M5.Power.lightSleep();   // == lightSleep(sleep_no_timer, true)

    Please give it a try and let us know if anything still misbehaves.

  3. ainyan03 commented on Aug 17, 2026

    @ainyan03
    Contributor

    Thank you for your patience — an update containing the fix for this issue has just been released as 0.2.20. Please update and confirm.

    It reworks sleep/wakeup (#290, #291): touch wakeup now works on CoreS3, and the wakeup pin is no longer ignored on older ESP-IDF versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions