We really need a way to differenciate RESET and Wake Up from Deep Sleep

pratik

Re: We really need a way to differenciate RESET and Wake Up from Deep Sleep

Postby pratik » Sun Dec 11, 2016 1:00 pm

Ohh! I get what you are saying.
This is now an SDK issue!
It is actually basic digital design stuff. Let me try to explain...

ESP8266 wakes from deep sleep by resetting itself, where it is the same recent as a user reset using a button. But when deep sleep is enabled, the chip RESETS ITSELF.
So in the hardware, once deep sleep is enabled - the chip expects the next reset event to be a wake-up reset. And if the user pulls the line low at this stage when deep sleep is enabled - the chip will think the GPIO caused this, not the user!
What you can do is you can use an external latch (a simple MOS and capacitor based one, will cost less than a button itself!) which stays high for say 5 seconds after the USER presses the reset button. The ESP8266 can then read this and determine if a button was pressed recently!

This is additional circuit design that is necessary to detect a button press. The ESP8266 has no internal hardware to distinguish (if deep sleep is enabled) whether a physical button press caused reset or a system wakeup caused a reset because they both do the same thing - alter reset pin!

garyeb
Posts: 4
Joined: Wed Nov 30, 2016 7:19 am

Re: We really need a way to differenciate RESET and Wake Up from Deep Sleep

Postby garyeb » Sun Dec 11, 2016 10:21 pm

Pratik,

After posting my question, a friend suggested precisely the external latch solution you offered as an alternative for this application. It will also have a much lower power consumption since the ESP is powered of until the button is pushed. As soon as my MOSFET order arrives, I will test the solution.

Thanks!

Gary

php4fan

Re: We really need a way to differenciate RESET and Wake Up from Deep Sleep

Postby php4fan » Sun Feb 09, 2020 11:54 pm

The ESP8266 has no internal hardware to distinguish (if deep sleep is enabled) whether a physical button press caused reset or a system wakeup caused a reset because they both do the same thing


That is not true.
The ESP8266 does have the internal hardware necessary to distinguish, and that is the RTC.
The RTC is running while in deepsleep. You put it into deepsleep for a given amount of time. When it wakes up, it could know, if it wanted to, how much time has elapsed since it went to sleep. All it needs to do is read the RTC before it resets it.

There is actually a low-level function whose name I can't remember, which gives you the elapsed time (can't remember if in micro or milliseconds) of the RTC since reset. Unfortunately, the SDK resets it first thing at startup (I saw it in the source code somewhere), so it always gives you the time since boot (which makes it exactly equivalent to another function that is supposed to be a different one - also cannot remember the name). So we, users, have no way to tell because the designers of the SDK decided to not allow us, not because the board doesn't have the internal hardware to allow it, which it does have.

This is a design flaw in the espressif SDK. And a huge one. Please fix it.

Her Mary
Posts: 537
Joined: Mon Oct 27, 2014 11:09 am

Re: We really need a way to differenciate RESET and Wake Up from Deep Sleep

Postby Her Mary » Fri Feb 28, 2020 11:53 am

Have you tried the latest RTOS SDK? It seems that it does not have this issue. https://github.com/espressif/ESP8266_RTOS_SDK

Who is online

Users browsing this forum: No registered users and 1 guest