RTC memory gets cleared after deep sleep

Wurzbart
Posts: 4
Joined: Sat Dec 03, 2016 7:39 pm

RTC memory gets cleared after deep sleep

Postby Wurzbart » Sat Dec 03, 2016 8:07 pm

Hello,
i have compiled and flashed example 06_sntp. After reset the esp32 connects to wifi and updates time over ntp. But after deep sleep the counter stays at 1 and does not increment.

This was done with the esp-idf v1.0-2-gc8685c2 on a board from Watterott (see GitHub https://github.com/watterott/ESP-WROOM-Breakout). The board uses a ESP-WROOM-32 module. Flash was in DIO mode at 40 MHz.

Output on serial:
Please see the flash error and watchdog reset in red!


ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_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:0x3ffc0008,len:0
load:0x3ffc0008,len:1964
load:0x40078000,len:3668
load:0x40080000,len:260
entry 0x40080034
I (557) heap_alloc_caps: Initializing heap allocator:
I (557) heap_alloc_caps: Region 19: 3FFC171C len 0001E8E4 tag 0
I (559) heap_alloc_caps: Region 25: 3FFE8000 len 00018000 tag 1
I (569) cpu_start: Pro cpu up.
I (574) cpu_start: Starting app cpu, entry point is 0x40080bf4
I (0) cpu_start: App cpu up.
I (589) cpu_start: Pro cpu start user code
I (614) rtc: rtc v160 Nov 22 2016 19:00:05
I (625) rtc: XTAL 40M
I (871) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0
I (946) cpu_start: Starting scheduler on PRO CPU.
I (948) cpu_start: Starting scheduler on APP CPU.
I (948) example: Boot count: 1
I (948) example: Time is not set yet. Connecting to WiFi and getting time over NTP.
I (958) example: Initializing Wifi
tcpip_task_hdlxxx : 3ffc6250, prio:18,stack:2048
I (968) wifi: frc2_timer_task_hdl:3ffc7cb4, prio:22, stack:2048
I (1028) wifi: pp_task_hdl : 3ffca5a0, prio:23, stack:8192
I (1028) example: Setting WiFi configuration SSID Moskwa2...
I (1028) wifi: mode : sta (24:0a:c4:00:33:9a)
I (1908) wifi: n:6 2, o:1 0, ap:255 255, sta:6 2, prof:1
I (2548) wifi: state: init -> auth (b0)
I (2558) wifi: state: auth -> assoc (0)
I (2568) wifi: state: assoc -> run (10)
I (2588) wifi: connected with Moskwa2, channel 6
I (9448) event: ip: 192.168.179.48, mask: 255.255.255.0, gw: 192.168.179.1
I (9448) example: Initializing SNTP
I (9448) example: Waiting for system time to be set... (1/10)
I (11448) example: The current date/time in New York is: Sat Dec 3 14:27:33 2016
I (11448) example: The current date/time in Shanghai is: Sun Dec 4 03:27:33 2016
I (11448) example: Entering deep sleep for 10 seconds
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:0x3ffc0008,len:0
load:0x3ffc0008,len:1964
load:0x40078000,len:3668
load:0x40080000,len:260
entry 0x40080034
I (558) heap_alloc_caps: Initializing heap allocator:
I (558) heap_alloc_caps: Region 19: 3FFC171C len 0001E8E4 tag 0
I (559) heap_alloc_caps: Region 25: 3FFE8000 len 00018000 tag 1
I (569) cpu_start: Pro cpu up.
I (575) cpu_start: Starting app cpu, entry point is 0x40080bf4
I (0) cpu_start: App cpu up.
I (591) cpu_start: Pro cpu start user code
I (615) rtc: rtc v160 Nov 22 2016 19:00:05
I (627) rtc: XTAL 40M
I (872) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0
I (947) cpu_start: Starting scheduler on PRO CPU.
I (949) cpu_start: Starting scheduler on APP CPU.
I (949) example: Boot count: 1
I (949) example: Time is not set yet. Connecting to WiFi and getting time over NTP.
I (959) example: Initializing Wifi
tcpip_task_hdlxxx : 3ffc6250, prio:18,stack:2048
I (969) wifi: frc2_timer_task_hdl:3ffc7cb4, prio:22, stack:2048
I (979) wifi: pp_task_hdl : 3ffca514, prio:23, stack:8192
I (979) example: Setting WiFi configuration SSID Moskwa2...
I (979) wifi: mode : sta (24:0a:c4:00:33:9a)
I (1859) wifi: n:6 2, o:1 0, ap:255 255, sta:6 2, prof:1
I (2499) wifi: state: init -> auth (b0)
I (2509) wifi: state: auth -> assoc (0)
I (2529) wifi: state: assoc -> run (10)
I (2549) wifi: connected with Moskwa2, channel 6
I (9459) event: ip: 192.168.179.48, mask: 255.255.255.0, gw: 192.168.179.1
I (9459) example: Initializing SNTP
I (9459) example: Waiting for system time to be set... (1/10)
I (11459) example: The current date/time in New York is: Sat Dec 3 14:27:54 2016
I (11459) example: The current date/time in Shanghai is: Sun Dec 4 03:27:54 2016
I (11459) example: Entering deep sleep for 10 seconds


I have tested the same example on a ESP-32S module with flash mode QIO at 80 Mhz speed and it seems to work. Maybe there is a problem with the flash initialisation. There is no flash error or watchdog reset.

Serial Output is as follows:

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_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:QIO, clock div:1
load:0x3ffc0008,len:0
load:0x3ffc0008,len:1964
load:0x40078000,len:3668
load:0x40080000,len:260
entry 0x40080034
I (420) heap_alloc_caps: Initializing heap allocator:
I (421) heap_alloc_caps: Region 19: 3FFC171C len 0001E8E4 tag 0
I (422) heap_alloc_caps: Region 25: 3FFE8000 len 00018000 tag 1
I (432) cpu_start: Pro cpu up.
I (438) cpu_start: Starting app cpu, entry point is 0x40080bf4
I (0) cpu_start: App cpu up.
I (453) cpu_start: Pro cpu start user code
I (477) rtc: rtc v160 Nov 22 2016 19:00:05
I (485) rtc: XTAL 40M
I (681) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 0
I (829) cpu_start: Starting scheduler on PRO CPU.
I (382) cpu_start: Starting scheduler on APP CPU.
I (382) example: Boot count: 1
I (382) example: Time is not set yet. Connecting to WiFi and getting time over NTP.
I (392) example: Initializing Wifi
tcpip_task_hdlxxx : 3ffc6204, prio:18,stack:2048
I (402) wifi: frc2_timer_task_hdl:3ffc7c68, prio:22, stack:2048
I (412) wifi: pp_task_hdl : 3ffca4c8, prio:23, stack:8192
I (412) example: Setting WiFi configuration SSID Moskwa2...
I (412) wifi: mode : sta (24:0a:c4:01:b8:9c)
I (1292) wifi: n:6 2, o:1 0, ap:255 255, sta:6 2, prof:1
I (1932) wifi: state: init -> auth (b0)
I (1942) wifi: state: auth -> assoc (0)
I (1952) wifi: state: assoc -> run (10)
I (1972) wifi: connected with Moskwa2, channel 6
I (8882) event: ip: 192.168.179.46, mask: 255.255.255.0, gw: 192.168.179.1
I (8882) example: Initializing SNTP
I (8882) example: Waiting for system time to be set... (1/10)
I (10882) example: The current date/time in New York is: Sat Dec 3 14:30:52 2016
I (10882) example: The current date/time in Shanghai is: Sun Dec 4 03:30:52 2016
I (10882) example: Entering deep sleep for 10 seconds
ets Jun 8 2016 00:22:57

rst:0x5 (DEEPSLEEP_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:QIO, clock div:1
load:0x3ffc0008,len:0
load:0x3ffc0008,len:1964
load:0x40078000,len:3668
load:0x40080000,len:260
entry 0x40080034
I (420) heap_alloc_caps: Initializing heap allocator:
I (421) heap_alloc_caps: Region 19: 3FFC171C len 0001E8E4 tag 0
I (422) heap_alloc_caps: Region 25: 3FFE8000 len 00018000 tag 1
I (432) cpu_start: Pro cpu up.
I (438) cpu_start: Starting app cpu, entry point is 0x40080bf4
I (0) cpu_start: App cpu up.
I (453) cpu_start: Pro cpu start user code
I (478) rtc: rtc v160 Nov 22 2016 19:00:05
I (486) rtc: XTAL 40M
I (552) phy: phy_version: 258, Nov 29 2016, 15:51:07, 0, 1
I (552) cpu_start: Starting scheduler on PRO CPU.
I (108) example: Boot count: 2
I (108) example: The current date/time in New York is: Sat Dec 3 14:31:03 2016
I (118) example: The current date/time in Shanghai is: Sun Dec 4 03:31:03 2016
I (118) example: Entering deep sleep for 10 seconds

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

Re: RTC memory gets cleared after deep sleep

Postby ESP_igrr » Sun Dec 04, 2016 12:24 pm

I think this issue was reported here as well: https://github.com/espressif/esp-idf/issues/117

I was working on some deep sleep related bits all the past week but somehow I can't reproduce this. Following your observation that this seems to be a problem only for a specific board, I suspect that there may be something wrong with putting the flash chip into sleep mode and waking it up. I'll try reproducing this with other boards and report back if I have a fix.

Wurzbart
Posts: 4
Joined: Sat Dec 03, 2016 7:39 pm

Re: RTC memory gets cleared after deep sleep

Postby Wurzbart » Sun Dec 04, 2016 7:50 pm

Hi,
i have tested the good board with the same mode and speed for the flash (DIO at 40MHz) and it works. Flash mode and speed seems not the problem. Maybe the flash chip matters.

Is it possible to read the flash chip id ?

Who is online

Users browsing this forum: chegewara and 103 guests