Page 1 of 1

RTC reset on deepsleep wakeup - ESP32-C3

Posted: Sun Mar 05, 2023 11:59 pm
by atouron
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

Re: RTC reset on deepsleep wakeup - ESP32-C3

Posted: Tue Apr 11, 2023 8:52 am
by ESP_wangning
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.

Re: RTC reset on deepsleep wakeup - ESP32-C3

Posted: Wed Apr 12, 2023 2:46 am
by axellin
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?

Re: RTC reset on deepsleep wakeup - ESP32-C3

Posted: Mon Jun 12, 2023 4:19 pm
by dongrigorio
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)