Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEEPSLEEP_RESET gets stuck after a few resets #796

Closed
jh83 opened this issue Oct 30, 2017 · 136 comments
Closed

DEEPSLEEP_RESET gets stuck after a few resets #796

jh83 opened this issue Oct 30, 2017 · 136 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck) Type: Bug 🐛 All bugs

Comments

@jh83
Copy link

jh83 commented Oct 30, 2017

Hardware:

Board: ESP32 Dev Module - Sparkfun ESP32 Thing
Core Installation/update date: 30/oct/2017
IDE name: Arduino IDE
Flash Frequency: 80Mhz
Upload Speed: 921600

Description:

The board does not correctly restart after deep sleep. Im using the builtin example sketch "TimerWakeUp" without modifications and no other hardware attached and i get random results on the powerup after sleep.

The board usually start successfully a few times after deepsleep, but then it failes to run the actual sketch after startup and a manual reset is needed.

The debug information below shows that the device starts after deepsleep and outputs "Boot number: x", but then in the last boot it doesn't output anything from the sketch and does not return to sleep. A manual press of the reset button restarts the device and the it runs for a few more deepsleep cycles before it gets stuck again.

Any one else seen this problem?

Sketch:

builtin "TimerWakeUp" example sketch

Debug Messages:

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c
Boot number: 1
Wakeup was not caused by deep sleep
Setup ESP32 to sleep for every 5 Seconds
Going to sleep now
ets Jun  8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c
Boot number: 2
Wakeup caused by timer
Setup ESP32 to sleep for every 5 Seconds
Going to sleep now
ets Jun  8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c

@iot-man
Copy link

iot-man commented Oct 31, 2017

I'm having the same problem. My sketch goes to sleep for 60 seconds after taking temp/humidity readings etc via I2C. It used to work ok before system upgraded to most recent commit. First two restarts work ok but always hangs on third restart.

Debug messages

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c
Boot number: 1
Setup ESP32 to sleep for every 60 Seconds

Connecting to SKYE3E0B
MQTT connecting ...connected
19.74
1015.97
Going to sleep now
ets Jun 8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c
Boot number: 2
Setup ESP32 to sleep for every 60 Seconds

Connecting to SKYE3E0B
MQTT connecting ...connected
19.73
1015.91
Going to sleep now
ets Jun 8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c

@s-oshidari
Copy link

I'm having a "similar" problem. In my case it happened with ESP.restart().
It gets successfully restarted a few times, but after several cycles it hangs like below.

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c

@copercini
Copy link
Contributor

copercini commented Nov 1, 2017

Same here, after commit 55289a4 this problem starts

@degehi
Copy link

degehi commented Nov 3, 2017

Same here, hangs after 2-3 reboot, just after the 'entry' log line

@etimou
Copy link

etimou commented Nov 4, 2017

Exactly the same problem for me as well with an unmodified "TimerWakeUp" example sketch.

@me-no-dev
Copy link
Member

I would suggest an issue to be opened in IDF (if one does not already exist). It is surely something in that update.

@mikey60
Copy link

mikey60 commented Nov 6, 2017

I reset the core version back to https://github.com/espressif/arduino-esp32/tree/95123681d5340defa24472e441758fba88e3a34f as was suggested in Issue #801 and my sketch with a 20 minute deep sleep that would hang after an hour or so (as described above) now has been working properly for 2 days.

@cristianhumelnicu
Copy link

Any patch for deepsleep issue ???

@copercini copercini added the Type: Bug 🐛 All bugs label Nov 8, 2017
@etimou
Copy link

etimou commented Nov 9, 2017 via email

@degehi
Copy link

degehi commented Nov 9, 2017

@etimou: what I did: just apply a checkout after de clone operation, with a version number before 55289a4

on the esp32 directory: git checkout 9512368

running without reboot hangs with this release for me.

@etimou
Copy link

etimou commented Nov 10, 2017 via email

@cristianhumelnicu
Copy link

@etimou, @degehi
Could you tell me what is the maximum time you've been able to keep ESP32 in deepsleep? All I've done is a deepsleep time of 30 minutes ... if it's more than 30 minutes it's not waking up again ffrom deepsleep...

@etimou
Copy link

etimou commented Nov 16, 2017 via email

@cristianhumelnicu
Copy link

@etimou Do you use the deepsleep example from Arduino or other scatch ?
Thk!

@mikey60
Copy link

mikey60 commented Nov 16, 2017

I am using my own program based on the Arduino deepsleep example an it sleeps for 20 minutes and then sends sensor data to ThingSpeak. It has run for several days. When I get a chance I will change the deepsleep to one hour and see if it continues to work.

@iotmodules
Copy link

I'm using the Sparkfun esp32 thing and am having similar issues however its not just sleep, i'm getting hanged reboots when pressing the reset button too, not just in the TimerWakeUp sketch.

I also find that I get about 5 reboots before a hang when RTC_DATA_ATTR int bootCount = 0; is intialised however if I comment it out and all references to it then I get about 30-40 reboots before a hang.

Using latest with 80a7d60 commited 6 days ago

@CelliesProjects
Copy link
Contributor

CelliesProjects commented Nov 16, 2017

Using the MHET Live D1 mini-kit.
Can confirm the problem with hanging reboots.

Both the reset button and ESP.restart() have the issue.

@etimou
Copy link

etimou commented Nov 18, 2017 via email

@euquiq
Copy link

euquiq commented Nov 21, 2017

I'm having the same problem (with latest Arduino - idf):

I set up a deep-sleep / wake timer for N seconds (5, 2 or even 1 second) and after a low number of wake-ups (2 to 6 times of normal waking up), ESP32 hangs.

So after reading the above posts, I am waiting for the bug to be crushed (on IDF, it seems).

Regards,

Enrique.

@copercini
Copy link
Contributor

There is a commit that fixes it on IDF espressif/esp-idf@abacf8d seems like just wait @me-no-dev bump the version for Arduino IDE =)

@me-no-dev
Copy link
Member

need to check if @nkolban has updated the BLE lib and find some time to put a new release.

@nkolban
Copy link

nkolban commented Nov 21, 2017

That is job number 1 starting now

@cristianhumelnicu
Copy link

@me-no-dev Could you estimate when any fix update for deepsleep and reset issue will be availble ?

@me-no-dev
Copy link
Member

I have updated Arduino. Can you pull the latest changes and give it a try?

@cristianhumelnicu
Copy link

cristianhumelnicu commented Nov 25, 2017

@me-no-dev I already did .. using deepsleep example with timer wake-up and put to be 60 min in deep sleep . Until now have 12 deepsleep cycles without problems for 1h deepsleep

But i still have one problem .. I put another 3 x Wroom32 (Rev.1) to sleep 2h , 6h and 8h ant all of them standing in sleep about 45 minutes and after that wake up . All i've done with success is 1h sleep time with first Wroom32

Could u guide me what is supouse to do for long time deepsleep i mean 8h - 24h ?

Thank you very much!

@me-no-dev
Copy link
Member

@cristianhumelnicu please post a minimal sketch that shows that issue and I will run it here on a few boards to see the result

@cristianhumelnicu
Copy link

cristianhumelnicu commented Nov 28, 2017

@me-no-dev Is the standard deepsleep example and i use Wroom32 Silicon Rev.1 chipset

#define uS_TO_S_FACTOR 1000000  
#define TIME_TO_SLEEP  7200        

RTC_DATA_ATTR int bootCount = 0;

void setup(){
  Serial.begin(115200);
  delay(200); 

  ++bootCount;
  Serial.println("Boot number: " + String(bootCount));
 
  esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
  Serial.println("Setup ESP32 to sleep for every " + String(TIME_TO_SLEEP) + " Seconds");

 Serial.println("Going to sleep now");
  esp_deep_sleep_start();  
}
void loop(){ 
}

After last update is working for 1h deep sleep, but if I set TIME_TO_SLEEP>2h , the microconttroler exit from deep sleep in 45min

Until last arduino-esp update never did exit from deepsleep for TIME_TO_SLEEP > 30 min

I did try to define TIME_TO_SLEEP as unsigned long with same results

Thank you !

@NaimSakaamini
Copy link

I have no logs. It only goes to sleep after random number of cycles and never wakes up. Am I supposed to do something to get the logs ?

@zonehun
Copy link

zonehun commented Aug 23, 2020

I'm having the same problem. But interestingly only when I'm on battery power. So I think my code is OK and the deep sleep and wake up working properly - but only on stable voltage from USB port. I have a NodeMCU ESP32S module and I'm using Arduino to make and sync my code the the ESP. And of course I'm using the recent Arduino-ESP32 libraries 1.0.4. You can find my code here https://github.com/miniAirQ/miniAirQ

Now I'm fighting with ghosts because I can not see any logs or messages while I'm on battery power (no serial monitor). I made LED blinkings in proper part of my code and then it was turned out that after 3-4 deep sleep cycles the reboot process stucked somewhere.

Do you have any suggestions what to follow, how to create a persistent log or any other thing to figure out the exact problem? Battery powering is important to me so the answer "switch over to a stable 5V" will not make me happy.

Thank you very much.

@Kashyapkoshti
Copy link

rst:0x10 (RTCWDT_RTC_RESET),boot:0x1f (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371

I am getting this error in my esp32 devkit v1
How to solve it?
I am using arduino IDE for programming the esp32

@lbernstone
Copy link
Contributor

Please don't hijack issues. Your problem clearly has nothing to do with deep sleep.

@Kashyapkoshti
Copy link

Please don't hijack issues. Your problem clearly has nothing to do with deep sleep.

I am not hijacking your issue,i dont have any clue about my error.
i read somewhere in your comments that flash read errr,1000 and i thought maybe this is related.

@stale
Copy link

stale bot commented Oct 28, 2020

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Oct 28, 2020
@StefanStsc
Copy link

Not solved

@stale
Copy link

stale bot commented Oct 28, 2020

[STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it openin the future.

@stale stale bot removed the Status: Stale Issue is stale stage (outdated/stuck) label Oct 28, 2020
@zeekoe
Copy link

zeekoe commented Nov 30, 2020

I'm quite sure I have a similar issue, on MicroPython. Using deep sleep, sometimes my ESP32 (Heltec Wifi kit 32) doesn't wake up. It runs on 4x NiMH + a diode to lower the voltage. Works perfectly (it's not charging the batteries of course). When the battery voltate is lower, it fails to wake up significantly more often. So I can confirm the feeling of the battery being related.
MicroPython doesn't support other sleep modes, so I cannot test them. I assumed max watchdog timer value to be seconds-ish, but @JLIspace 's comment suggests it can be longer; @JLIspace could you elaborate just a little bit on your solution?

Edit: To add on that, I noticed when the machine doesn't wake from timed sleep, it's also unable to wake up from button (GPIO) wake up sources that it usually does wake up from.

@AIexBV
Copy link

AIexBV commented Dec 28, 2020

I am running some Wroom32 boards to send BME680 values to a MQTT server every 15 minutes. The circuits are powered by 2 AA batteries (3 volts). Some of the boards run flawlessly over months, while some of them fail after some days and drain the battery within hours. My latest attempt as mentioned above already soldering a capacitor of 100uF very close to the board to filter the power supply seems to be successful. All of them but one are running now for 2 weeks without a problem. At one board the capacitor did not bring the solution. I changed the capacitor to a 47uF tantalum today. Maybe that works. Basically I guess the stability of the voltage is the key solution for the problem.

9 days later:
More than 800 wake ups worked now flawlessly. So for me the tantalum capacitor was the solution.

@Younes-SadatNejad
Copy link

Hello
I am having the exact same problem.
I am using ESP32 Dev kit1, with the external trigger as my wake-up from a deep sleep.
The problem is that after few wakeup and sleep, it stops waking up and manual reboot is the only way to fix it.
The problem exists both with wire and without wire, however when using battery, it happens sooner (about 30-40 times), while with wire it may take 200 times.
I used a pull-up resistor of 100K for pin2 that is my trigger, and a 100uF capacitor on the battery, the problem remains.
I tried adding a 500ms delay at the beginning of setup, the problem remains.
Is there any software solution, or is it just a matter of finding the right capacitor on the voltage supply?

@iotmodules
Copy link

iotmodules commented Jan 16, 2021 via email

@waged
Copy link

waged commented Feb 12, 2021

I have the same issue too with ESP32-WROVER the wake-up after deep sleep and it seems everything is working fine for the flash read and here us the

ets Jun  8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac

i was testing the Voltage and the pin status of EN and during touching the En pin to check 3.3 voltage is present and just with one probe "may be static charge" the ESP restarted and worked fine and the restart reason was waking up from deep_sleep although it stuck for hours and the sleep was just for 5 minutes. any ideas?

@ppotter100
Copy link

ppotter100 commented Jun 18, 2021

A possible fix is mentioned in espressif/esp-idf#6694 with batteries. Potentially the ESP32 gets stuck in a restart procedure, due to a low voltage, and deep sleep wake up. Adding a capacitor to the CHIP_PU pin might fix the issue.

@stale
Copy link

stale bot commented Aug 21, 2021

[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Aug 21, 2021
@stale
Copy link

stale bot commented Sep 6, 2021

[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Sep 6, 2021
@ginixsan
Copy link

ginixsan commented Sep 26, 2021

Tried all possible solutions here and still same problem. It wakes up from deep sleep and stalls in setup after 2-3 lines.. no cause, no reset, no crash.. nothing.. just freezes...happens with batteries and with usb connected..

@JLIspace
Copy link

Tried all possible solutions here and still same problem. It wakes up from deep sleep and stalls in setup after 2-3 lines.. no cause, no reset, no crash.. nothing.. just freezes...happens with batteries and with usb connected..

Yep. My bet is that a bad power supply still is the main cause. Using a watchdog timer is the only method of recovering after this „freeze“ that I‘m aware of.

best regards JLIspace

@oktett-8
Copy link

oktett-8 commented Oct 2, 2021

Tried all possible solutions here and still same problem. It wakes up from deep sleep and stalls in setup after 2-3 lines.. no cause, no reset, no crash.. nothing.. just freezes...happens with batteries and with usb connected..

Also was going mad with this issue for years, excluded power supply issues and using different chip revisions (last tests done with ESP32-E) and didn’t find a root cause, but a least this kind of workaround for improvement:
If you do a delay(100); right at the beginning of setup() most ESP32 show an improvement. Some chips that got stuck before every couple of minutes then ran for years without issues (on battery since this was the purpose of my deep sleep application). Some chips need 500 ms delay to work permanently whilst with others even longer times don’t help at all.

@epareja2
Copy link

Anyone has found yet the root cause on this?

@Olfdev
Copy link

Olfdev commented Dec 21, 2023

I think I'm having the same issue with my AZDelivery lolin32 lite. I thought I was running out of battery even though it didn't make a lot of sense but now I know the battery isn't the culprit. With the USB connected, it hangs forever (after 13 30min deep sleep/wake up but this is very random):

..........
rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4
ets Jun 8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4
ets Jun 8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4

I'll try the delay at the beginning of the setup().

EDIT: Adding a delay didn't change anything, it froze again.
Today, 30 deep sleep/awake so far and still running...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck) Type: Bug 🐛 All bugs
Projects
None yet
Development

No branches or pull requests