[resolved] deep sleep wakeup does not keep RTC memory

eyaleb
Posts: 31
Joined: Sun May 14, 2017 6:54 am

[resolved] deep sleep wakeup does not keep RTC memory

Postby eyaleb » Sun May 14, 2017 7:12 am

I am aware of the issue with the esp32 rev0 (which I have). I thought that a software fix was in the IDF now.

I searched this forum and could not solve this problem. I concocted a simple app:

Code: Select all

#include <stdio.h>
#include <esp_system.h>

RTC_DATA_ATTR int n;

void app_main()
{
        printf ("##### n=%d #####\n", n);
        n = 1;

        esp_deep_sleep(5*1000000);
}
The console always shows:

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
Falling back to built-in command interpreter.
OK
>ets Jun  8 2016 00:22:57

rst:0x7 (TG0WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0x00
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0008,len:8
load:0x3fff0010,len:4392
load:0x40078000,len:11092
load:0x40080000,len:252
entry 0x40080034
W (46) boot: PRO CPU has been reset by WDT.
W (46) boot: WDT reset info: PRO CPU PC=0xfa88689a
W (46) boot: WDT reset info: APP CPU PC=0xa43ffa6f
I (63) boot: ESP-IDF v2.0-rc1-803-g1e0710f 2nd stage bootloader
I (84) boot: compile time 16:37:22
I (96) boot: Enabling RNG early entropy source...
I (113) boot: SPI Speed      : 40MHz
I (126) boot: SPI Mode       : DIO
I (138) boot: SPI Flash Size : 4MB
I (151) boot: Partition Table:
I (163) boot: ## Label            Usage          Type ST Offset   Length
I (185) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (208) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (232) boot:  2 factory          factory app      00 00 00010000 00100000
I (255) boot: End of partition table
I (268) boot: Disabling RNG early entropy source...
I (285) boot: Loading app partition at offset 00010000
I (801) boot: segment 0: paddr=0x00010018 vaddr=0x00000000 size=0x0ffe8 ( 65512) 
I (801) boot: segment 1: paddr=0x00020008 vaddr=0x3f400010 size=0x06860 ( 26720) map
I (817) boot: segment 2: paddr=0x00026870 vaddr=0x3ffb0000 size=0x02b18 ( 11032) load
I (848) boot: segment 3: paddr=0x00029390 vaddr=0x40080000 size=0x00400 (  1024) load
I (871) boot: segment 4: paddr=0x00029798 vaddr=0x40080400 size=0x12e0c ( 77324) load
I (933) boot: segment 5: paddr=0x0003c5ac vaddr=0x400c0000 size=0x00064 (   100) load
I (934) boot: segment 6: paddr=0x0003c618 vaddr=0x00000000 size=0x039f0 ( 14832) 
I (954) boot: segment 7: paddr=0x00040010 vaddr=0x400d0018 size=0x26cb0 (158896) map
I (980) boot: segment 8: paddr=0x00066cc8 vaddr=0x50000000 size=0x00004 (     4) load
I (1007) cpu_start: Pro cpu up.
I (1018) cpu_start: Starting app cpu, entry point is 0x40080edc
I (0) cpu_start: App cpu up.
I (1051) heap_alloc_caps: Initializing. RAM available for dynamic allocation:
I (1073) heap_alloc_caps: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM
I (1094) heap_alloc_caps: At 3FFB6428 len 00029BD8 (166 KiB): DRAM
I (1115) heap_alloc_caps: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (1136) heap_alloc_caps: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1158) heap_alloc_caps: At 4009320C len 0000CDF4 (51 KiB): IRAM
I (1179) cpu_start: Pro cpu start user code
I (1236) cpu_start: Starting scheduler on PRO CPU.
I (202) cpu_start: Starting scheduler on APP CPU.
##### n=0 #####
1) Why the initial 'flash read err, 1000'?
2) Is this expected: "boot: PRO CPU has been reset by WDT"?
3) The final line always shows "n=0", so the RTC memory is not preserved, seems to be reset on wakeup.

BTW, hitting Enter quickly after the OK does drop into the basic command prompt.

TIA
Last edited by eyaleb on Fri May 19, 2017 12:17 am, edited 2 times in total.

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: deep sleep wakep does not keep RTC memory

Postby ESP_igrr » Sun May 14, 2017 8:54 am

Please attach your sdkconfig file

eyaleb
Posts: 31
Joined: Sun May 14, 2017 6:54 am

Re: deep sleep wakeup does not keep RTC memory [resolved]

Postby eyaleb » Sun May 14, 2017 9:19 am

I wanted to respond earlier but was not able, being a new forum member.

I have now tried a much longer "CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY" which was originally set to zero. My earlier tests with 100 and 200 did not help, but trying 1000us got it working. In my case anything below 300us is bad so now I use 500 to be safe.

Who is online

Users browsing this forum: Bing [Bot] and 88 guests