RTC reset on deepsleep wakeup - ESP32-C3

atouron
Posts: 6
Joined: Mon Sep 05, 2022 4:50 am

RTC reset on deepsleep wakeup - ESP32-C3

Postby atouron » Sun Mar 05, 2023 11:59 pm

Hi,

I'm having an issue with the RTC being reset after waking up from a deepsleep. I have narrowed it down to the way the ESP32-C3 is being woken up on one of the GPIO pins.

I currently have a nchannel mosfet at GPIO input (see attached image) and have the following code in startup to print out the reason for wakeup:

Code: Select all

esp_reset_reason_t esp_reason = esp_reset_reason();
printf("ESP reset reason: %i\n", esp_reason);

RESET_REASON rtc_reason = rtc_get_reset_reason(0);
printf("RTC reset reason: %i\n", rtc_reason);

esp_sleep_source_t wakeup_respon = esp_sleep_get_wakeup_cause();
printf("Wakeup reason: %i\n", wakeup_respon);
95% of the time when i trigger the wakeup pin, i get the following printout:
ESP reset reason: 8
RTC reset reason: 5
Wakeup reason: 7

but sometimes i get the following:
ESP reset reason: 1
RTC reset reason: 1
Wakeup reason: 0

and when i get this the RTC time has been reset.

Another thing i tried was to replace the nchannel mosfet with a switch (to experiment) and found that in over 10,000 wakeups, it always woke up correctly.

I then tried using a sine wave as the wakeup signal and found that it would ALWAYS fail wakeup (RTC would be reset).

This led me to believe that the rise/fall time of the wkaeup pulse has an effect on this error. Anything with a rise/fall time of less than 100uS 'seems' to be ok but anything greater causes issues in the wakeup.

I appreciate your time and hope you can help resolve this as the nchannel mosfet is the setup i require.

Note:
Currently using the ESP32-C3-MINI on IDF V4.4.2
Attachments
ESP32-C3 wake up.png
ESP32-C3 wake up.png (35.42 KiB) Viewed 4255 times

ESP_wangning
Posts: 17
Joined: Wed Jan 06, 2021 8:21 am

Re: RTC reset on deepsleep wakeup - ESP32-C3

Postby ESP_wangning » Tue Apr 11, 2023 8:52 am

Sorry for the late reply and thanks for asking!

RTC should not be reset when the chip is woken up by a GPIO from deep-sleep mode. This happens because there is a bug in ESP-IDF code. The bugfix has already merged to the master branch, and is to be backported to other release branches soon.

You may pull the latest master branch and test if this problem still exists.

axellin
Posts: 201
Joined: Mon Sep 17, 2018 9:09 am

Re: RTC reset on deepsleep wakeup - ESP32-C3

Postby axellin » Wed Apr 12, 2023 2:46 am

ESP_wangning wrote:
Tue Apr 11, 2023 8:52 am
Sorry for the late reply and thanks for asking!

RTC should not be reset when the chip is woken up by a GPIO from deep-sleep mode. This happens because there is a bug in ESP-IDF code. The bugfix has already merged to the master branch, and is to be backported to other release branches soon.
Could you share the commit id (or link) to the fix?

dongrigorio
Posts: 3
Joined: Thu Jan 19, 2023 12:52 pm

Re: RTC reset on deepsleep wakeup - ESP32-C3

Postby dongrigorio » Mon Jun 12, 2023 4:19 pm

Faced the same problem.
There was only this issue on Github:
"ESP32-C3 Incorrect wakeup cause with GPIO, resulting in RTC reset (IDFGH-10209) #11475"
https://github.com/espressif/esp-idf/issues/11475 (Open)

Who is online

Users browsing this forum: No registered users and 102 guests