Light sleep mode does not wake up - ESP32-C3

nogema
Posts: 14
Joined: Tue Jun 27, 2023 2:57 pm

Light sleep mode does not wake up - ESP32-C3

Postby nogema » Mon Feb 17, 2025 4:05 pm

Hi everyone,

I am currently trying to implement a low power mode on my custom board to reduce as much as possible its consumption because it runs with a battery. So I familiarized myself with the light sleep example (https://github.com/espressif/esp-idf/tr ... ight_sleep). I am developing with ESP-IDF v5.2.3 and VSCode on an ESP32-C3-Mini.

However, I cannot make it work. When I go into light sleep, my program does not wake up. I have tried to toggle the wakeup modes, other versions of the example (5.3.2 and 5.4). I also asked for help from ChatGPT but it ended going round in circles despite my efforts to make things clearer. I have also tried other examples that use light and deep sleep modes but same result.

If anyone has any ideas or suggestions of what is or might be wrong, you're welcome.

Best regards,

nogema
Posts: 14
Joined: Tue Jun 27, 2023 2:57 pm

Re: Light sleep mode does not wake up - ESP32-C3

Postby nogema » Tue Feb 18, 2025 8:33 am

EDIT : it worked in deep sleep mode with the example : https://github.com/espressif/esp-idf/tr ... deep_sleep

vvb333007
Posts: 8
Joined: Wed Jul 31, 2024 5:53 am

Re: Light sleep mode does not wake up - ESP32-C3

Postby vvb333007 » Tue Feb 18, 2025 1:35 pm

How did you configure wake-up event? Is its wakeup source a timer or an uart?
This code works for me:

Code: Select all

static int nap(unsigned int timeout_sec, int uart) {

  if (!timeout_sec) {
    esp_sleep_enable_uart_wakeup(uart);
    uart_set_wakeup_threshold(uart, 1);
  } else {
    esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_UART);
    esp_sleep_enable_timer_wakeup(1000000UL * timeout_sec);
  }
  esp_light_sleep_start();
  printf("Resuming..\r\n");
  return 0;
}


nogema
Posts: 14
Joined: Tue Jun 27, 2023 2:57 pm

Re: Light sleep mode does not wake up - ESP32-C3

Postby nogema » Tue Feb 18, 2025 1:58 pm

Hi vvb333007,

I set it as it was in the example (UART, timer, GPIO) then I only set timer to be sure the issue does not come from my custom board.

After investigation, it was actually working but I could not see it. In fact once the light sleep mode is enabled, the UART pins that I use to flash and to log the progress of my program (GPIO18, GPIO19) are disabled. And they stay disabled even when it wakes up from light sleep.

Until now, I was waiting for the log to be sure it was working. Then I tried to blink a LED instead and I saw it was working.

In your case vvb333007, does the log work after wakeup ?

Who is online

Users browsing this forum: No registered users and 122 guests