Skip to content

ESP32C3 can not wake from Light-sleep by UART #6976

Closed
@soulyiran

Description

@soulyiran

Board

ESP32-C3-4M

Device Description

Board: ESP32-C3-4M on custom board
IDE: Arduino
Version: Arduino ESP32 Version 2.0.4
Computer OS: Mac M1

Hardware Configuration

only uart

Version

latest master (checkout manually)

IDE Name

Arduino IDE

Operating System

macOS 12.4

Flash frequency

40Mhz

PSRAM enabled

no

Upload speed

115200

Description

ESP32C3 can not wake from Light-sleep by UART.

Sketch

#include <Arduino.h>
#include <driver/uart.h>

void setup() {
    // wake from sleep every 20s
    esp_sleep_enable_timer_wakeup(20*1000000); 

    // Configure UART0
    Serial.begin(115200);
    while (!Serial) { delay(500); }
    uart_set_wakeup_threshold(UART_NUM_0, 3);   // 3 edges on U0RXD to wakeup
    esp_sleep_enable_uart_wakeup(UART_NUM_0);   // Enable UART 0 as wakeup source

    Serial.printf("ESP32 light sleep with UART wake\r\n");
    Serial.printf("SDK: %s\r\n", ESP.getSdkVersion());
    Serial.flush();

}

void loop() {
    Serial.println("going to sleep");
    Serial.flush();
    esp_light_sleep_start();
    esp_sleep_wakeup_cause_t wakeup_cause;
    wakeup_cause = esp_sleep_get_wakeup_cause();
    
    if (wakeup_cause == 8){
      Serial.println("wakeup by uart");
      delay(5000);
      while(Serial.available()) Serial.write(Serial.read());
      Serial.flush();
    }
    if (wakeup_cause == 4){
      Serial.println("wakeup by timmer");
      Serial.flush();
    }
}

Debug Message

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
SHA-256 comparison failed:
Calculated: 080c5cb68a075ced55f248b97bca965e3e5bd5da80a64e34e6a1638f89d6f64e
Expected: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Attempting to boot anyway...
entry 0x403ce000
ESP32 light sleep with UART wake
SDK: v4.4.1-472-gc9140caf8c
going to sleep
wakeup by timmer
...

Other Steps to Reproduce

I also try this code on ESP32, and it can be successfully wake by UART0.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions