Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Light Sleep Wakeup Fails on ESP32-C6-Super Mini Board (Works on ESP32-WROOM) #10982

Open
1 task done
JinwooJungFromSouthKorea opened this issue Feb 18, 2025 · 0 comments
Open
1 task done
Labels
Type: Feature request Feature request for Arduino ESP32

Comments

@JinwooJungFromSouthKorea
Copy link

JinwooJungFromSouthKorea commented Feb 18, 2025

Related area

light sleep

Hardware specification

ESP32-C6-Super Mini

Is your feature request related to a problem?

Hi everyone,

I'm having trouble getting my ESP32-C6-Super Mini board to wake up from light sleep using a button (and even with a timer). My project works fine on an ESP32-WROOM board, but when I switch to the C6-Super Mini, it enters sleep correctly yet never wakes up.

Below are my two code examples and observations.

Working on ESP32-WROOM (using EXT0):

#include "esp_sleep.h"
#include <Arduino.h>

struct Button {
  uint8_t pin;
  bool pressed;
  void init() {
    pinMode(pin, INPUT_PULLUP);  
    pressed = false;
  }
  bool update() {
    bool now = (digitalRead(pin) == LOW);
    if (now && !pressed) {
      pressed = true;
      return true;
    }
    if (!now) {
      pressed = false;
    }
    return false;
  }
};

Button btn = {25, false};

enum State {
  STATE_AWAKE,
  STATE_WAIT_RELEASE,
  STATE_ENTER_SLEEP,
  STATE_SLEEPING,
  STATE_WAKEUP
};

State currentState = STATE_AWAKE;

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("ESP32-C6 Light Sleep Toggle (EXT1 Wakeup)");

  btn.init();
  // Using EXT0 wakeup here on pin 25
  esp_sleep_enable_ext0_wakeup((gpio_num_t)btn.pin, 0);
}

void loop() {
  switch (currentState) {
    case STATE_AWAKE:
      if (btn.update()) {
        Serial.println("Button pressed in awake state.");
        currentState = STATE_WAIT_RELEASE;
      }
      break;
    case STATE_WAIT_RELEASE:
      if (digitalRead(btn.pin) == HIGH) {
        Serial.println("Button released. Preparing to enter light sleep...");
        currentState = STATE_ENTER_SLEEP;
      }
      break;
    case STATE_ENTER_SLEEP:
      Serial.println("Entering light sleep mode (EXT1)...");
      currentState = STATE_SLEEPING;
      esp_light_sleep_start();
      currentState = STATE_WAKEUP;
      break;
    case STATE_WAKEUP:
      Serial.println("Woke up from light sleep via EXT1!");
      currentState = STATE_AWAKE;
      break;
  }
  delay(10);
}

Serial Monitor Output on ESP32-WROOM:

css

Button pressed in awake state.
Button released. Preparing to enter light sleep...
Entering light sleep mode (EXT1)...
Woke up from light sleep via EXT1!
...
I also measured the current: it drops from around 60mA to 20mA when in sleep, which seems normal.

Failing on ESP32-C6-Super Mini (using EXT1):

#include "esp_sleep.h"
#include <Arduino.h>

struct Button {
  uint8_t pin;
  bool pressed;
  void init() {
    pinMode(pin, INPUT_PULLUP);
    pressed = false;
  }
  bool update() {
    bool current = (digitalRead(pin) == LOW);
    if (current && !pressed) {
      pressed = true;
      return true;
    }
    if (!current) {
      pressed = false;
    }
    return false;
  }
};

Button btn = {7, false}; // Using GPIO 7

enum State {
  STATE_AWAKE,
  STATE_WAIT_RELEASE,
  STATE_ENTER_SLEEP,
  STATE_SLEEPING,
  STATE_WAKEUP
};

State currentState = STATE_AWAKE;

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("ESP32 Light Sleep Toggle Example");

  btn.init();

  // Keep RTC peripheral power on for internal pull-up stability
  esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);

  // EXT1 wakeup configuration: wake up when GPIO7 goes LOW
  esp_sleep_enable_ext1_wakeup((1ULL << btn.pin), ESP_EXT1_WAKEUP_ANY_LOW);
}

void loop() {
  switch (currentState) {
    case STATE_AWAKE:
      if (btn.update()) {
        Serial.println("Button pressed in awake state.");
        currentState = STATE_WAIT_RELEASE;
      }
      break;
    case STATE_WAIT_RELEASE:
      if (digitalRead(btn.pin) == HIGH) {
        Serial.println("Button released. Preparing to enter light sleep...");
        currentState = STATE_ENTER_SLEEP;
      }
      break;
    case STATE_ENTER_SLEEP:
      Serial.println("Entering light sleep mode...");
      currentState = STATE_SLEEPING;
      esp_light_sleep_start();
      currentState = STATE_WAKEUP;
      break;
    case STATE_WAKEUP:
      Serial.println("Woke up from light sleep!");
      currentState = STATE_AWAKE;
      break;
  }
  delay(10);
}

Serial Monitor Output on ESP32-C6-Super Mini:

mathematica

ESP32 Light Sleep Toggle Example
Button pressed in awake state.
Button released. Preparing to enter light sleep...
Now, entering sleep...
After entering sleep, the board never wakes up—even when I try pressing the button.

Additional Test with Timer Wakeup Only on ESP32-C6-Super Mini:

#include <Arduino.h>
#include "esp_sleep.h"

const int BUTTON_PIN = 7;

void setup() {
  Serial.begin(115200);
  delay(1000);

  pinMode(BUTTON_PIN, INPUT_PULLUP); // Default HIGH
  gpio_wakeup_enable((gpio_num_t)BUTTON_PIN, GPIO_INTR_LOW_LEVEL);
  esp_sleep_enable_gpio_wakeup();

  // Timer wakeup after 5 seconds
  esp_sleep_enable_timer_wakeup(5000000ULL);

  Serial.println("Entering Light Sleep in 3 seconds...");
  delay(3000);

  Serial.println("Now sleeping...");
  esp_light_sleep_start();

  Serial.println("Woke up!");
}

void loop() {
  delay(1000);
  Serial.println("Sleep again...");
  esp_light_sleep_start();
  Serial.println("Woke up again!");
}

Serial Output:

mathematica

Entering Light Sleep in 3 seconds...
Now sleeping...
After entering sleep, no wakeup occurs.

Summary of the Problem:

On the ESP32-WROOM board, my code works perfectly—the board sleeps and wakes via the button (or EXT0) as expected.
On the ESP32-C6-Super Mini board, while sleep is successfully entered (confirmed by the current drop), the board never wakes up—neither with button wakeup (using EXT1) nor with a timer wakeup.
Questions/Observations:

Could there be a bug or incomplete implementation in the Arduino core for ESP32-C6 affecting wakeup functions (esp_light_sleep_start(), EXT1, GPIO wakeup, timer wakeup)?
Is it possible that the ESP32-C6-Super Mini board’s pin mapping or RTC configuration differs from what the code assumes?
Any suggestions on debugging this or a workaround would be greatly appreciated.
Please let me know if any part of this description seems off or if there are additional details I should include. Thanks in advance for your help!

Feel free to edit or add any hardware details (such as external pull-ups, wiring, etc.) to further clarify your setup. Good luck, and I hope this helps get to the bottom of the issue!

Describe the solution you'd like

I want to wake up ESP32-C6 in light sleep mode

Describe alternatives you've considered

No response

Additional context

No response

I have checked existing list of Feature requests and the Contribution Guide

  • I confirm I have checked existing list of Feature requests and Contribution Guide.
@JinwooJungFromSouthKorea JinwooJungFromSouthKorea added the Type: Feature request Feature request for Arduino ESP32 label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature request Feature request for Arduino ESP32
Projects
None yet
Development

No branches or pull requests

1 participant