ESP32 and Deepsleep

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
TomMa
Normal user
Posts: 3
Joined: 26 Jun 2020, 17:14

ESP32 and Deepsleep

#1 Post by TomMa » 26 Jun 2020, 17:44

Is there anything special to consider for using deepsleep on the ESP32.

Connecting GPIO16 to RST is only for ESP8266 i assume, at least it did not change anything for me.
At the moment, the board goes to sleep but it always wakes up with a cold boot, for that reason it always sets the security timer for not going to sleep to 30s (System#NoSleep=30).
To my understanding, this should only be set on the first cold boot and not after waking up from sleep.

Attached a snippet of the log

Code: Select all

3418 : Info  : WD   : Uptime 1 ConnectFailures 0 FreeMem 213644 WiFiStatus 3
3512 : Info  : EVENT: System#NoSleep=5
7351 : Info  : WD   : Uptime 1 ConnectFailures 0 FreeMem 213884 WiFiStatus 3
7353 : Info  : SLEEP: Entering deep sleep in 30 seconds.
7353 : Info  : EVENT: System#NoSleep=30
37356 : Info  : EVENT: System#Sleep
37359 : Info  : SLEEP: Powering down to deepsleep...
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:DOUT, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
ªU38 : Info  :

INIT : Booting version: mega-20200608 (ESP32 SDK v3.2.3-14-gd3e562907)
39 : Info  : INIT : Free RAM:290016
40 : Info  : INIT : Cold Boot - Restart Reason: CPU0: Deep Sleep, Wakeup reason (901) CPU1: for APP CPU, reseted by PRO CPU
40 : Info  : FS   : Mounting...
69 : Info  : CRC  : No program memory checksum found. Check output of crc2.py
79 : Info  : CRC  : SecuritySettings CRC   ...OK
151 : Info  : INIT : Free RAM:285052
151 : Info  : INIT : I2C
152 : Info  : INIT : SPI not enabled
341 : Info  : INFO : Plugins: 81 [Normal] [TEST ESP32] (ESP32 SDK v3.2.3-14-gd3e562907)
342 : Info  : EVENT: System#NoSleep=5
346 : Info  : EVENT: System#Wake
449 : Info  : WIFI : Set WiFi to STA
587 : Info  : WIFI  : Start network scan
589 : Info  : WIFI : Connecting netgear attempt #0
594 : Info  : Webserver: start
597 : Info  : OTA  : Arduino OTA enabled on port 3232
610 : Info  : EVENT: System#Boot
2335 : Info  : WIFI : Connected! AP: netgear (EC:08:6B:24:CA:4C) Ch: 6 Duration: 1581 ms
2336 : Info  : WIFI : DHCP IP: 192.168.2.184 (TEST-ESP32) GW: 192.168.2.1 SN: 255.255.255.0   duration: 19 ms
2350 : Info  : firstLoopConnectionsEstablished
2352 : Info  : EVENT: WiFi#ChangedAccesspoint
2354 : Info  : WD   : Uptime 0 ConnectFailures 0 FreeMem 213976 WiFiStatus 3
2509 : Info  : NTP  : NTP replied: delay 140 mSec Accuracy increased by 0.646 seconds
2510 : Info  : Time set to 1593186073.646
2511 : Info  : Current Time Zone:  DST time start: 2020-03-29 02:00:00 offset: 120 min STD time start: 2020-10-25 03:00:00 offset: 60 min
2512 : Info  : Local time: 2020-06-26 17:41:13
2513 : Info  : EVENT: Clock#Time=Fri,17:41
2517 : Info  : EVENT: WiFi#Connected
2522 : Info  : WD   : Uptime 1 ConnectFailures 0 FreeMem 212680 WiFiStatus 3
2617 : Info  : EVENT: System#NoSleep=5
2717 : Info  : EVENT: Time#Initialized
7351 : Info  : WD   : Uptime 1 ConnectFailures 0 FreeMem 213532 WiFiStatus 3
7352 : Info  : SLEEP: Entering deep sleep in 30 seconds.
7353 : Info  : EVENT: System#NoSleep=30
Any idea what I am missing?

TD-er
Core team member
Posts: 2790
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 and Deepsleep

#2 Post by TD-er » 26 Jun 2020, 22:49

I never tried deep sleep on the ESP32, so I don't have any experience with that ESP and deep sleep.
Maybe you can try to grab all from the serial port to see if it may be crashing on the first boot after deep sleep?
That could explain why it always reports a cold boot.

TomMa
Normal user
Posts: 3
Joined: 26 Jun 2020, 17:14

Re: ESP32 and Deepsleep

#3 Post by TomMa » 29 Jun 2020, 11:03

Here is the log after a reset by button and the following sleep cycle.
I can't see any errors.
Interesting is the line with "Restart Reason"
On first Boot, it is

Code: Select all

39 : Info  : INIT : Cold Boot - Restart Reason: CPU0: Vbat power on reset CPU1: for APP CPU, reseted by PRO CPU
After Deepsleep, it is

Code: Select all

40 : Info  : INIT : Cold Boot - Restart Reason: CPU0: Deep Sleep, Wakeup reason (901) CPU1: for APP CPU, reseted by PRO CPU
So somehow, it is noticed that the second boot is from deepsleep, but the nosleep timer still is set to System#NoSleep=30 and not the time defined in web-ui .
Any ideas what else I could check?

Code: Select all

rst:0x1 (POWERON_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:DOUT, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
ªU38 : Info  :

INIT : Booting version: mega-20200608 (ESP32 SDK v3.2.3-14-gd3e562907)
39 : Info  : INIT : Free RAM:290016
39 : Info  : INIT : Cold Boot - Restart Reason: CPU0: Vbat power on reset CPU1: for APP CPU, reseted by PRO CPU
40 : Info  : FS   : Mounting...
71 : Info  : CRC  : No program memory checksum found. Check output of crc2.py
81 : Info  : CRC  : SecuritySettings CRC   ...OK
149 : Info  : INIT : Free RAM:285060
150 : Info  : INIT : I2C
150 : Info  : INIT : SPI not enabled
340 : Info  : INFO : Plugins: 81 [Normal] [TEST ESP32] (ESP32 SDK v3.2.3-14-gd3e562907)
341 : Info  : EVENT: System#NoSleep=15
345 : Info  : EVENT: System#Wake
448 : Info  : WIFI : Set WiFi to STA
642 : Info  : WIFI  : Start network scan
644 : Info  : WIFI : Connecting netgear attempt #0
649 : Info  : Webserver: start
652 : Info  : OTA  : Arduino OTA enabled on port 3232
665 : Info  : EVENT: System#Boot
919 : Info  : SYS  : 0.00,100.00
1150 : Info  : EVENT: System#rssi=0.00
2390 : Info  : WIFI : Connected! AP: netgear (CC:CE:1E:EF:56:3E) Ch: 6 Duration: 1568 ms
2391 : Info  : WIFI : DHCP IP: 192.168.2.184 (TEST-ESP32) GW: 192.168.2.1 SN: 255.255.255.0   duration: 20 ms
2405 : Info  : firstLoopConnectionsEstablished
2407 : Info  : EVENT: System#load=100.00
2410 : Info  : WD   : Uptime 0 ConnectFailures 0 FreeMem 213892 WiFiStatus 3
3442 : Info  : EVENT: WiFi#ChangedAccesspoint
3446 : Info  : WD   : Uptime 1 ConnectFailures 0 FreeMem 213576 WiFiStatus 3
3541 : Info  : EVENT: WiFi#Connected
3641 : Info  : EVENT: System#NoSleep=15
10167 : Info  : SYS  : -43.00,100.00
10241 : Info  : EVENT: System#rssi=-43.00
10341 : Info  : EVENT: System#load=100.00
17406 : Info  : WD   : Uptime 1 ConnectFailures 0 FreeMem 213800 WiFiStatus 3
17408 : Info  : SLEEP: Entering deep sleep in 30 seconds.
17408 : Info  : EVENT: System#NoSleep=30
47411 : Info  : EVENT: System#Sleep
47414 : Info  : SLEEP: Powering down to deepsleep...
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:DOUT, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
ªU38 : Info  :

INIT : Booting version: mega-20200608 (ESP32 SDK v3.2.3-14-gd3e562907)
39 : Info  : INIT : Free RAM:290016
40 : Info  : INIT : Cold Boot - Restart Reason: CPU0: Deep Sleep, Wakeup reason (901) CPU1: for APP CPU, reseted by PRO CPU
40 : Info  : FS   : Mounting...
71 : Info  : CRC  : No program memory checksum found. Check output of crc2.py
81 : Info  : CRC  : SecuritySettings CRC   ...OK
149 : Info  : INIT : Free RAM:285052
150 : Info  : INIT : I2C
150 : Info  : INIT : SPI not enabled
340 : Info  : INFO : Plugins: 81 [Normal] [TEST ESP32] (ESP32 SDK v3.2.3-14-gd3e562907)
341 : Info  : EVENT: System#NoSleep=15
345 : Info  : EVENT: System#Wake
448 : Info  : WIFI : Set WiFi to STA
586 : Info  : WIFI  : Start network scan
588 : Info  : WIFI : Connecting netgear attempt #0
593 : Info  : Webserver: start
596 : Info  : OTA  : Arduino OTA enabled on port 3232
609 : Info  : EVENT: System#Boot
863 : Info  : SYS  : 0.00,100.00
1094 : Info  : EVENT: System#rssi=0.00
2334 : Info  : WIFI : Connected! AP: netgear (CC:CE:1E:EF:56:3E) Ch: 6 Duration: 1567 ms
2335 : Info  : WIFI : DHCP IP: 192.168.2.184 (TEST-ESP32) GW: 192.168.2.1 SN: 255.255.255.0   duration: 19 ms
2350 : Info  : firstLoopConnectionsEstablished
2352 : Info  : EVENT: System#load=100.00
2355 : Info  : WD   : Uptime 0 ConnectFailures 0 FreeMem 213916 WiFiStatus 3
2439 : Info  : NTP  : NTP replied: delay 30 mSec Accuracy increased by 0.248 seconds
2440 : Info  : Time set to 1593419816.248
2441 : Info  : Current Time Zone:  DST time start: 2020-03-29 02:00:00 offset: 120 min STD time start: 2020-10-25 03:00:00 offset: 60 min
2442 : Info  : Local time: 2020-06-29 10:36:56
2443 : Info  : EVENT: Clock#Time=Mon,10:36
2449 : Info  : EVENT: WiFi#ChangedAccesspoint
2453 : Info  : WD   : Uptime 1 ConnectFailures 0 FreeMem 213204 WiFiStatus 3
2549 : Info  : EVENT: WiFi#Connected
2648 : Info  : EVENT: System#NoSleep=15
2749 : Info  : EVENT: Time#Initialized
6389 : Info  : EVENT: Clock#Time=Mon,10:37
10166 : Info  : SYS  : -35.00,87.57
10248 : Info  : EVENT: System#rssi=-35.00
10349 : Info  : EVENT: System#load=87.57
17351 : Info  : SLEEP: Entering deep sleep in 30 seconds.
17352 : Info  : EVENT: System#NoSleep=30
47355 : Info  : EVENT: System#Sleep
47358 : Info  : SLEEP: Powering down to deepsleep...
ets Jun  8 2016 00:22:57

TD-er
Core team member
Posts: 2790
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 and Deepsleep

#4 Post by TD-er » 29 Jun 2020, 19:00

The first time it is entering deep sleep is different from other attempts. (so you can recover from a wrong setting)

But I guess we're always considering it a "cold boot" or at least not as waking up from a deep sleep.

Can you make an issue on Github for this, including these logs?

TomMa
Normal user
Posts: 3
Joined: 26 Jun 2020, 17:14

Re: ESP32 and Deepsleep

#5 Post by TomMa » 29 Jun 2020, 19:06

I will try. Never done that before ;)

TD-er
Core team member
Posts: 2790
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: ESP32 and Deepsleep

#6 Post by TD-er » 29 Jun 2020, 19:08

TomMa wrote:
29 Jun 2020, 19:06
I will try. Never done that before ;)
Well before you know it you will make your own commits and pull requests :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests