Skip to content

M5 PaperS3 wake on touch not working #205

Open

Description

@skrat

Seems to be missing a case:

https://github.com/m5stack/M5Unified/blob/master/src/utility/Power_Class.cpp#L245

with the wake up pin being 48 I believe according to schematic?

Activity

  1. felmue commented on Nov 16, 2025

    @felmue
    Contributor

    Hello @skrat

    what exactly do you mean by 'wake on touch'? Wake up from a shutdown state? Or wake up from one of the ESP32 sleep modes (deep sleep / light sleep)?

    AFAIK only wake on touch from ESP32 light sleep is possible. Please see explanation and example here.

    Thanks
    Felix

  2. skrat commented on Nov 16, 2025

    @skrat
    Author

    You are right, I want to use capacitive touch screen to wake up from light sleep.

    Related discussion here: https://github.com/orgs/micropython/discussions/14351

    I still don't see the _wakeupPin being assigned for PaperS3 board. I tried using wake_on_ext0 with GPIO pin 48, but I'm getting ValueError: invalid pin error.

  3. felmue commented on Nov 16, 2025

    @felmue
    Contributor

    Hello @skrat

    oh, I see, you are using Micropython. I am not well versed in Micropython so I cannot really help. Sorry.

    Thanks
    Felix

  4. randomekek commented on Jan 31, 2026

    @randomekek

    The change above fixes lightSleep(touch_wakeup). However, it's going to confuse developers if they use deepSleep(touch_wakeup=true) - which cannot work due to the touch panel not being wired to an IO Pin (pin 48 is too high to allow wake from deep sleep).

    I'm not sure what's the best solution - is there some way to make deepSleep a compile time warning if called with the PaperS3 board with touch_wakeup true?

  5. ainyan03 commented on Jul 30, 2026

    @ainyan03
    Contributor

    Triage note (not a maintainer).

    Light sleep was fixed by 24882b7 (v0.2.12): it sets _wakeupPin = GPIO_NUM_48 for PaperS3 and takes a gpio_wakeup_enable() path for that board, with a comment stating that GPIO48 is not an RTC IO:
    https://github.com/m5stack/M5Unified/blob/2fe93c0/src/utility/Power_Class.cpp#L1347-L1352

    deepSleep() however still takes the generic path:
    https://github.com/m5stack/M5Unified/blob/2fe93c0/src/utility/Power_Class.cpp#L1290-L1301

    On ESP32-S3 SOC_PM_SUPPORT_EXT0_WAKEUP is 0, so it reaches the EXT1 branch and executes
    ESP_ERROR_CHECK(esp_sleep_enable_ext1_wakeup_io(1ULL << 48, ESP_EXT1_WAKEUP_ANY_LOW)).
    GPIO48 is not an RTC IO on S3 (RTC IOs are GPIO0-21), so that returns ESP_ERR_INVALID_ARG and ESP_ERROR_CHECK aborts - deepSleep(us, true) panics on PaperS3 rather than sleeping. This is what @randomekek warned about above.

    One more inconsistency in the same block: the EXT1 pin mask is built from _wakeupPin while the wait loop uses wpin, so the M5PaperMono override (wpin = GPIO_NUM_4) never reaches the mask.

    I have a local patch that checks the pin with rtc_gpio_is_valid_gpio(), logs a warning instead of aborting, and uses wpin consistently; it builds cleanly for ESP32 and ESP32-S3. Let me know if a PR would be helpful.

  6. ainyan03 commented on Jul 30, 2026

    @ainyan03
    Contributor

    Submitted as #290 (second commit): the wakeup pin is validated with rtc_gpio_is_valid_gpio() and a warning is logged instead of aborting, so deepSleep(us, true) no longer panics on PaperS3. Deep sleep wakeup by touch remains impossible on this board - GPIO48 is not an RTC IO - so light sleep stays the way to do it.

  7. ainyan03 commented on Aug 17, 2026

    @ainyan03
    Contributor

    Thank you for your patience — release 0.2.20 is now out and reworks the sleep wakeup handling (#290, #291), which should cover this case. Could you update and report whether touch wakeup now works on your PaperS3?

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