Skip to content

ESP32-C3 won't wake from deep sleep with GPIO0 or GPIO1 #6656

Description

@pjenks-accudyne

Board

ESP32-C3-DevKitM-1

Device Description

ESP32-C3-DevKitM-1

Hardware Configuration

100k potentiometers connected to GPIO0-GPIO3

Version

v2.0.2

IDE Name

Arduino IDE

Operating System

Windows 10

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

921600

Description

I am unable to use GPIO0 or GPIO1 to wake the ESP32-C3 from deep sleep, but I am able to use GPIO2 and GPIO3 to wake it from deep sleep. I'm using GPIO0-GPIO3 to read analog values from force sensors, simulated with potentiometers in this test setup. I'm also using these force sensors to wake the ESP32-C3 from deep sleep. I've been able to read analog and digital inputs on all 4 pins when the board is awake.

I have tested this setup with every combination of including and excluding the following functions:
gpio_deep_sleep_hold_dis();
esp_sleep_config_gpio_isolate();
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);

The only seemingly important difference I've found between GPIO0-GPIO1 and GPIO2-GPIO3 is that GPIO0-GPIO1 are input disabled after reset, while GPIO2-GPIO3 are input enabled after reset.

I've also noticed that the reset reason given in the debug messages is only DSLEEP if I wake the ESP32-C3 within about 0.5 seconds. The first boot sequence in my debug messages is from initial power on. The second is from waking the board from deep sleep with GPIO2 after sleeping for 3 seconds. The third is from waking the board from deep sleep with GPIO2 immediately after entering deep sleep. It seems that my bootCount variable does not persist unless the board is awoken immediately.

Sketch

const uint64_t WAKEUP_PIN_BITMASK = 0b1111;     //GPIO0-GPIO3
RTC_DATA_ATTR int bootCount = 0;

void print_wakeup_reason() {
  esp_sleep_wakeup_cause_t wakeup_reason;
  wakeup_reason = esp_sleep_get_wakeup_cause();
  switch(wakeup_reason) {
    case ESP_SLEEP_WAKEUP_GPIO : Serial.println("Wakeup caused by external signal using GPIO"); break;
    case ESP_SLEEP_WAKEUP_TIMER : Serial.println("Wakeup caused by timer"); break;
    case ESP_SLEEP_WAKEUP_TOUCHPAD : Serial.println("Wakeup caused by touchpad"); break;
    case ESP_SLEEP_WAKEUP_ULP : Serial.println("Wakeup caused by ULP program"); break;
    default : Serial.println("Wakeup was not caused by deep sleep"); break;
  }
}

void setup() {
  Serial.begin(115200);
  bootCount++;
  Serial.println();
  Serial.println("Boot number: " + String(bootCount));
  print_wakeup_reason();
  gpio_deep_sleep_hold_dis();
  esp_err_t errPD = esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
  Serial.print("esp_sleep_pd_config: ");
  switch(errPD) {
    case ESP_OK: Serial.println("ESP_OK"); break;
    case ESP_ERR_INVALID_ARG: Serial.println("ESP_ERR_INVALID_ARG"); break;
    default: Serial.println("None"); break;
  }
  esp_err_t errGPIO = esp_deep_sleep_enable_gpio_wakeup(WAKEUP_PIN_BITMASK, ESP_GPIO_WAKEUP_GPIO_HIGH);
  Serial.print("esp_deep_sleep_enable_gpio_wakeup: ");
  switch(errGPIO) {
    case ESP_OK: Serial.println("ESP_OK"); break;
    case ESP_ERR_INVALID_ARG: Serial.println("ESP_ERR_INVALID_ARG"); break;
    default: Serial.println("None"); break;
  }
  Serial.println();
  Serial.println();
  delay(500);
  esp_deep_sleep_start();
}

void loop() {
  //Not used
}

Debug Message

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x420
load:0x403ce000,len:0x90c
load:0x403d0000,len:0x236c
SHA-256 comparison failed:
Calculated: ccb0d00bac7e84e1d90a12e4f75f4ab6c5f7e71bb209afd5819c4c9557a6db71
Expected: c9cf160580940ec7801c73b16423824e72ad12055c732e83ce66332240af42a7
Attempting to boot anyway...
entry 0x403ce000
[    87][D][esp32-hal-cpu.c:211] setCpuFrequencyMhz(): PLL: 480 / 6 = 80 Mhz, APB
Boot number: 1
Wakeup was not caused by deep sleep
esp_sleep_pd_config: ESP_OK
esp_deep_sleep_enable_gpio_wakeup: ESP_OK


ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x420
load:0x403ce000,len:0x90c
load:0x403d0000,len:0x236c
SHA-256 comparison failed:
Calculated: ccb0d00bac7e84e1d90a12e4f75f4ab6c5f7e71bb209afd5819c4c9557a6db71
Expected: c9cf160580940ec7801c73b16423824e72ad12055c732e83ce66332240af42a7
Attempting to boot anyway...
entry 0x403ce000
[    87][D][esp32-hal-cpu.c:211] setCpuFrequencyMhz(): PLL: 480 / 6 = 80 Mhz, APB:
Boot number: 1
Wakeup was not caused by deep sleep
esp_sleep_pd_config: ESP_OK
esp_deep_sleep_enable_gpio_wakeup: ESP_OK


ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x5 (DSLEEP),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x420
load:0x403ce000,len:0x90c
load:0x403d0000,len:0x236c
SHA-256 comparison failed:
Calculated: ccb0d00bac7e84e1d90a12e4f75f4ab6c5f7e71bb209afd5819c4c9557a6db71
Expected: c9cf160580940ec7801c73b16423824e72ad12055c732e83ce66332240af42a7
Attempting to boot anyway...
entry 0x403ce000
[    87][D][esp32-hal-cpu.c:211] setCpuFrequencyMhz(): PLL: 480 / 6 = 80 Mhz, APB
Boot number: 2
Wakeup caused by external signal using GPIO
esp_sleep_pd_config: ESP_OK
esp_deep_sleep_enable_gpio_wakeup: ESP_OK

Other Steps to Reproduce

I have tested this setup on two identical ESP32-C3-DevKitM-1 boards.

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

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions