Need 2 reset to wakeup from deepSleep

gagabla
Posts: 4
Joined: Tue May 07, 2024 10:21 pm

Need 2 reset to wakeup from deepSleep

Postby gagabla » Tue May 07, 2024 10:30 pm

Hello,

i am experimenting with a Esp12F board and have some issues with waking up from deep sleep. It is reproducable, that when i try to wakeup from deep sleep, the first reset will only print a single line on serial console and not run any code from setup() or loop() functions. Only the second reset will then again print the same first line, but then continue the process and also reach my user code.


Here is an example of the output i get, with ### i annotated to give explanation

Code: Select all

### my code runing as intended
...
Work...
Work...
Going to sleep
### now ESP8266 is in deep sleep

### pulling down RST to GND for the first time
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)
### will hang here indefinitely, not sure what is going on


### pulling down RST to GND the second time
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3424, room 16 
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8 
tail 0
chksum 0x2b
csum 0x2b
v00042790
~ld
error: pll_cal exceeds 2ms!!!
rf cal sector: 1020
freq trace enable 0
rf[112] : 0��Started
FlashChipId:
1660C4
Work...
Work...
Work...
Work...
Work...
Work...
### on second time the boot is successful and my code is running
The issue is reported few times already when googeling around, but i could not find any clear explanation or resolution yet. There seemed to be the idea (back in 2020) that the flash memory might be causing the issue (which is why i print the FlashChipId above), but no conclusion was reached as far as i can tell.

Any hint welcome!

User avatar
Inq720
Posts: 37
Joined: Fri Dec 22, 2023 1:36 pm
Location: North Carolina, USA
Contact:

Re: Need 2 reset to wakeup from deepSleep

Postby Inq720 » Wed May 08, 2024 1:13 pm

This thread in another forum was about optimizing ESP8286 for minimum power usage (including Deep Sleep). Don't really need to read the whole thread, but this post shows the code I used and the results. https://forum.dronebotworkshop.com/postid/43697/

Hope this helps.

gagabla
Posts: 4
Joined: Tue May 07, 2024 10:21 pm

Re: Need 2 reset to wakeup from deepSleep

Postby gagabla » Thu May 09, 2024 12:26 pm

Hello, sadly the behaviour with your code is exactly the same, just since you use time-based wakeup, it will automatically show the strange behavour of the first reset once the wakeup timer expires (which also is a bit confusing me since i didnt do any explicit wiring from GPIO16 to RST, but that is another story).

Here is my current circuit:
Image

And i used exactly the code you posted just with bit shorter waiting times to be able to reproduce quicker.

Here is the resulting output in the serial monitor with my comments marked by ###

Code: Select all

### power on via power supply
 ets Jan  8 2013,rst cause:2, boot mode:(3,7)

load 0x4010f000, len 3424, room 16 
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8 
tail 0
chksum 0x2b
csum 0x2b
v000413e0
~ld
rf cal sector: 1020
freq trace enable 0
rf[112] : 0�
### here the internal LED blinks as expected, then goes off when EPS8266 goes to sleep
### sleeping ...
### the following message appears once the sleep timer expired, also the internal LED flickers shortly)
 ets Jan  8 2013,rst cause:5, boot mode:(3,7)

ets_main.c 
### nothing else happens, LED not blinking, also not getting another reset or anything


###  now i lost my patience and did a manual reset, again only this one line message, LED flickers, but nothing else going on
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

###  again i lost my patience and pressed the reset butten, this time it gets to live
 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3424, room 16 
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8 
tail 0
chksum 0x2b
csum 0x2b
v000413e0
~ld
error: pll_cal exceeds 2ms!!!
rf cal sector: 1020
freq trace enable 0
rf[112] : 0�
### again LED is blinking as desired, then going off when going to sleep

### again timer expired but nothing more happens then those two lines of output
 ets Jan  8 2013,rst cause:5, boot mode:(3,6)

ets_main.c 
I can repeat this behavour every time, only the second manual reset will get the chip to start properly.

I am quite sure the code is not the problem since it is not running at the time i press the reset, neither the first time, nor the second time.

My circuit follows https://circuitjournal.com/esp8266-with ... g-to-esp12 just i added a pull-up to GPIO2 because i found some pages where this was recommended, but it actually does not make any difference for me (i think it just may not be pulled low)

gagabla
Posts: 4
Joined: Tue May 07, 2024 10:21 pm

Re: Need 2 reset to wakeup from deepSleep

Postby gagabla » Thu May 09, 2024 1:26 pm

And one more thing: when i press reset while the code is running/before going to sleep, reset is working fine / the chip restarts immediately, prints all the messages, and also LED is blinking.

User avatar
Inq720
Posts: 37
Joined: Fri Dec 22, 2023 1:36 pm
Location: North Carolina, USA
Contact:

Re: Need 2 reset to wakeup from deepSleep

Postby Inq720 » Fri May 10, 2024 1:50 am

Apologies, I didn't notice you were using external triggering. Mine was timed, self waking configuration. I've never experienced your symptoms. My various projects restart anywhere from 1 second to 15 minutes. Maybe it is simply a de-bounce problem with the switch. I really can't advice you further.

Image
Attachments
PXL_20240510_014635927.jpg
PXL_20240510_014635927.jpg (189.17 KiB) Viewed 7432 times

gagabla
Posts: 4
Joined: Tue May 07, 2024 10:21 pm

Re: Need 2 reset to wakeup from deepSleep

Postby gagabla » Wed May 29, 2024 8:57 pm

Hello, sorry for the long delay, i ordered some more esp12f boards (from a different supplier) and also pogo-pin connectors so i dont have to solder them all up.

So i get really weird results:

* esp12f from supplier A: ISSUE REPRODUCABLE
* esp12f from supplier A: WORKS AS EXPECTED
* esp12f from supplier A: ISSUE REPRODUCABLE
* esp12f from supplier A: ISSUE REPRODUCABLE
* esp01 from supplier B: WORKS AS EXPECTED
* esp12f from supplier C: ISSUE REPRODUCABLE
* esp12f from supplier C: ISSUE REPRODUCABLE
* esp12f from supplier C: ISSUE REPRODUCABLE

All of them tested with the same software.

Out of 8 ESP8266 only 2 work as expected, one of them on a esp01 board, the other one on a esp12f board.

The effect is reproducable, i can exchange the boards back and forth (pogo pins are a great invention!) and for the two boards it works, for the others it wont.

I checked the power supply with an oscilloscope, the voltage seems to be sufficiently stable (~3V) for both the working and the non-working boards. I see one strange observation though (also on both kinds of boards) that when the esp8266 goes to deep sleep, the voltage starts jittering in a range of 0.5 V around 3V, which it does not when esp8266 is running and also i cannt observe when esp8266 is disconnected.

I added a 10k pull-up resistor to the reset line just in case, but also does not have any effect.

Browsing through the web i could find quite a few people observing the same issue, but nobody came to a conclusion about the root-cause it seems:

https://www.esp8266.com/viewtopic.php?p=87500 => same issue reported multiple times but no resolution
https://www.esp8266.com/viewtopic.php?p=90064 => same issue, no answer
https://arduino.stackexchange.com/quest ... y-2nd-time => again same issue, no answer
https://stackoverflow.com/questions/657 ... deep-sleep => could be same, not clear if it was an issue with driving the reset line but i checked mine with oscilloscope and it looks good

I am really out of ideas here, any further hint what could the issue/what i could check appreciated!

jshansen
Posts: 1
Joined: Thu Jun 20, 2024 12:56 am

Re: Need 2 reset to wakeup from deepSleep

Postby jshansen » Thu Jun 20, 2024 1:04 am

It's sad that so many of us are trying to work through this. Please take a look at below article where some of us rehashed this earlier. It is very hard to explain this by anything other than poor-quality products and we've all had exactly the same random experiences as you.

https://forum.arduino.cc/t/esp8266-esp- ... -deepsleep

I've accumulated so many boards in my pursuit of this that I'm contemplating an external double reset circuit triggered by the WAKE pulse, but in the end: if you buy quality components from a reputable source, it "just" works, and all the workarounds are unnecessary.

d_ferdi
Posts: 2
Joined: Thu Oct 10, 2024 8:15 pm

Re: Need 2 reset to wakeup from deepSleep solution

Postby d_ferdi » Fri Oct 18, 2024 3:21 pm

hello,
i find this to solve the problem:
https://github.com/esp8266/Arduino/issu ... 2080368936

goodby

Who is online

Users browsing this forum: No registered users and 21 guests