RTC Data reset/lost after sleep

taintedsushi
Posts: 1
Joined: Fri Sep 06, 2019 1:23 am

RTC Data reset/lost after sleep

Postby taintedsushi » Fri Sep 06, 2019 4:34 pm

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.

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: RTC Data reset/lost after sleep

Postby ESP_Sprite » Sat Sep 07, 2019 3:59 am

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.

Who is online

Users browsing this forum: dzungpv, igormoo, snutw_ and 132 guests