Skip to content

esp32-c3 wake pin not working #9578

Description

@puppet13th

wiring:
esp32 Pins(0,2,4) <--> R1 <--> v3.3

example code:

import machine
import esp32

def wake_msg():
    reset_cause = machine.reset_cause()
    if reset_cause is machine.HARD_RESET:
        reset_cause = 'HARD_RESET'
    elif reset_cause is machine.PWRON_RESET:
        reset_cause = 'PWRON_RESET'
    elif reset_cause is machine.WDT_RESET:
        reset_cause = 'WDT_RESET'
    elif reset_cause is machine.DEEPSLEEP_RESET:
        reset_cause = 'DEEPSLEEP_RESET'
    elif reset_cause is machine.SOFT_RESET:
        reset_cause = 'SOFT_RESET'
        
    wake_reason = machine.wake_reason()
    if wake_reason is machine.PIN_WAKE:
        wake_reason = 'PIN_WAKE'
    elif wake_reason is machine.EXT0_WAKE:
        wake_reason = 'EXT0_WAKE'
    elif wake_reason is machine.EXT1_WAKE:
        wake_reason = 'EXT1_WAKE'
    elif wake_reason is machine.TIMER_WAKE:
        wake_reason = 'TIMER_WAKE'
    elif wake_reason is machine.TOUCHPAD_WAKE:
        wake_reason = 'TOUCHPAD_WAKE'
    elif wake_reason is machine.ULP_WAKE:
        wake_reason = 'ULP_WAKE'
    return reset_cause,wake_reason

pin_list = [ 0, 2, 4 ] #C3

for num in pin_list:
    wake_pin = machine.Pin(num,machine.Pin.IN,machine.Pin.PULL_DOWN)
    esp32.wake_on_ext0(pin = wake_pin, level = esp32.WAKEUP_ANY_HIGH)
    before_sleep = wake_pin()
    machine.lightsleep(5000)
    print(num,before_sleep,wake_pin(),wake_msg())

esp32-c3 code output:

MicroPython v1.17 on 2021-09-02; ESP32C3 module with ESP32C3
Type "help()" for more information.
>>> %Run -c $EDITOR_CONTENT
0 1 1 ('SOFT_RESET', 'TIMER_WAKE')
2 1 1 ('SOFT_RESET', 'TIMER_WAKE')
4 1 1 ('SOFT_RESET', 'TIMER_WAKE')

MPY: soft reboot
MicroPython v1.18 on 2022-01-17; ESP32C3 module with ESP32C3
Type "help()" for more information.
>>> %Run -c $EDITOR_CONTENT
0 1 1 ('SOFT_RESET', 'TIMER_WAKE')
2 1 1 ('SOFT_RESET', 'TIMER_WAKE')
4 1 1 ('SOFT_RESET', 'TIMER_WAKE')

MicroPython v1.19.1-528-gb8982ec5f on 2022-10-10; ESP32C3 module with ESP32C3
Type "help()" for more information.
>>> %Run -c $EDITOR_CONTENT
0 1 1 ('SOFT_RESET', 'TIMER_WAKE')
2 1 1 ('SOFT_RESET', 'TIMER_WAKE')
4 1 1 ('SOFT_RESET', 'TIMER_WAKE')

esp32-s3 code output:

MicroPython v1.19.1-528-gb8982ec5f on 2022-10-09; LOLIN S3 with ESP32S3
Type "help()" for more information.
>>> %Run -c $EDITOR_CONTENT
0 1 1 ('SOFT_RESET', 'PIN_WAKE')
2 1 1 ('SOFT_RESET', 'PIN_WAKE')
4 1 1 ('SOFT_RESET', 'PIN_WAKE')

Originally posted by @puppet13th in #9482

Activity

  1. puppet13th commented on Oct 22, 2022

    @puppet13th
    Author

    waiting for #9583 to be merged.

  2. added a commit that references this issue on Aug 30, 2024
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