Page 1 of 1

RTC Data reset/lost after sleep

Posted: Fri Sep 06, 2019 4:34 pm
by taintedsushi
I'm probably out of my depth in this forum but I will ask anyway.

I have an ESP32 WROOM board. I'm programming it with the arduino IDE.

I save a variable using

Code: Select all

RTC_DATA_ATTR int loop = 0
Increment loop and set the sleep timer :

Code: Select all

 
loop ++;
esp_sleep_enable_timer_wakeup(sleeptime  * uS_TO_S_FACTOR);
esp_deep_sleep_start();
The program should cycle sleep 12 times and then reset the loop variable.

Occasionally it will make it through all 12 cycles no problem but, more often than not, the loop variable will be reset to 0 after coming out of sleep before 12. There is no pattern to the failures, it can happen during any iteration.

Any suggestions would be appreciated. Sorry if this is problem is not appropriate for this form.

Cheers.

Re: RTC Data reset/lost after sleep

Posted: Sat Sep 07, 2019 3:59 am
by ESP_Sprite
Can you see if the ESP32 successfully gets out of deep sleep all the time? Your RTC erasure may be caused by a reset for some reason.