Inconsistent sleeping with SDK 2.1.0 uint64_t sleep times
-
- Posts: 11
- Joined: Thu Oct 08, 2015 2:31 pm
Inconsistent sleeping with SDK 2.1.0 uint64_t sleep times
Postby torntrousers » Sat May 27, 2017 4:56 pm
For example, calling system_deep_sleep with these works as expected:
uint64_t sleepTime = 10000000; // WORKS: 10 seconds
uint64_t sleepTime = 7200000000; // WORKS: 2 hours
uint64_t sleepTime = 9000000000; // WORKS: 2.5 hours
uint64_t sleepTime = 86400000000; // WORKS: 24 hours
But calling system_deep_sleep with values like these doesn't work and the ESP8266 wakes up almost immediately:
uint64_t sleepTime = 21600000000; // FAILS: 6 hours
uint64_t sleepTime = 74049000000; // FAILS: bit over 20 hours
In all cases system_deep_sleep is returning true, and the ESP8266 wakes up with rst cause:2, boot mode:(3,6).
What could be wrong, is this a bug?
Re: Inconsistent sleeping with SDK 2.1.0 uint64_t sleep times
Postby pratik » Sun May 28, 2017 9:41 pm
Ensure that this has nothing to do with loose connections, if you are working on a prototype. Meanwhile I will let you know if I can reproduce this exact problem.
-
- Posts: 11
- Joined: Thu Oct 08, 2015 2:31 pm
Re: Inconsistent sleeping with SDK 2.1.0 uint64_t sleep times
Postby torntrousers » Tue May 30, 2017 4:35 pm
Re: Inconsistent sleeping with SDK 2.1.0 uint64_t sleep times
Postby Her Mary » Wed May 31, 2017 1:57 pm
It is mentioned in the non OS API guide.
-
- Posts: 11
- Joined: Thu Oct 08, 2015 2:31 pm
Re: Inconsistent sleeping with SDK 2.1.0 uint64_t sleep times
Postby torntrousers » Wed May 31, 2017 4:08 pm
The theoretical maximum value of time_in_us can be calculated by formula:
(time_in_us / cali) << 12 = 2^32 - 1
• cali = system_rtc_clock_cali_proc(), the cali is the RTC clock period (in us)
In system_rtc_clock_cali_proc in 3.3.22 it says:
RTC clock period (in us); bit11 ~ bit0 are decimal.
Example os_printf("clk cal : %d \r\n",system_rtc_clock_cali_proc()>>12);
When I try that printf on an ESP8266 it outputs "clk cal : 6"
So (time_in_us / cali) << 12 = 2^32 - 1
So time_in-us = ( (2^32 - 1) >> 12 ) * 6
= 6291450
Which is just 6 seconds! Clearly wrong as it sleeps for longer than that fine. Can anyone do the maths better?
Re: Inconsistent sleeping with SDK 2.1.0 uint64_t sleep times
Postby Her Mary » Thu Jun 01, 2017 11:26 am
It is "cali = system_rtc_clock_cali_proc()", not "cali = system_rtc_clock_cali_proc()>>12".
-
- Posts: 11
- Joined: Thu Oct 08, 2015 2:31 pm
Re: Inconsistent sleeping with SDK 2.1.0 uint64_t sleep times
Postby torntrousers » Thu Jun 01, 2017 12:51 pm
Re: Inconsistent sleeping with SDK 2.1.0 uint64_t sleep times
Postby ESP_Faye » Mon Jun 19, 2017 10:04 am
The deep sleep 0 issue has been solved, please have a try with the latest SDK. https://github.com/espressif/ESP8266_NONOS_SDK
Thanks for your interest in ESP8266!
Who is online
Users browsing this forum: No registered users and 64 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.