So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By btidey
#85370 https://thingpulse.com/max-deep-sleep-for-esp8266/ has quite a good explanation.

The unsigned 32 (with a limit of 71 minutes) was changed to unsigned 64 bit at some point. However as the article shows the real maximum is about 3.5 hours.

I am guessing that the deep sleep is controlled by a 40 bit counter driven by the 80MHz clock which corresponds approximately to this maximum period.
User avatar
By hackerjoe
#85371
btidey wrote:https://thingpulse.com/max-deep-sleep-for-esp8266/ has quite a good explanation.

The unsigned 32 (with a limit of 71 minutes) was changed to unsigned 64 bit at some point. However as the article shows the real maximum is about 3.5 hours.

I am guessing that the deep sleep is controlled by a 40 bit counter driven by the 80MHz clock which corresponds approximately to this maximum period.


Oh so its possible to sleep longer now than the hour plus I have been reading about? I guess I'll try 5400 or even 7200 on my next edit and see how it works, maybe even go to 10800 :o :shock: :D
I hooked up a meter and I'm getting like .003mA when it's sleeping and when it wakes it goes to about .077mA
I have 2 test sensors I will try both and see which works better for me.
Thank you for everyone's time I appreciate the help and suggestions. 8-)
User avatar
By btidey
#85375
btidey wrote:I am guessing that the deep sleep is controlled by a 40 bit counter driven by the 80MHz clock which corresponds approximately to this maximum period.


That guess couldn't be right as the 80MHz clock is shut down in deep sleep. It is actually using the RTC clock which is a much slower clock that is running during deep sleep. I am not sure what the frequency of that is but it is not particularly accurate which is why deep sleep times can vary a bit.
User avatar
By btidey
#85376 Information on the RTC clock is a bit hard to come by but I found the information on the system_get_rtc_time call which indicates the period of the RTC is approximately 5.75uS or 173kHz which makes sense for the range of a slow speed RTC clock.

If one now takes a 31 bit counter (2147483648) then this would give a maximum period of 12,348 seconds or 3.4 hours.

So my improved guess of what is going on is that the sleep time in microseconds is converted into RTC periods and then used to either set a comparison value for the RTC time when sleep should end or set up a counter. RTC time is actually an unsigned 32 bit value but maybe there was a hardware reason why the sleep was restricted to 31 bits of RTC.