Page 1 of 1

Hibernating mode.

Posted: Thu Nov 26, 2015 8:06 pm
by beyonlo
Hi all!
In the Hibernating mode (wifi off - 5uA) all python code still running? How that works?

Thanks.

Re: Hibernating mode.

Posted: Fri Nov 27, 2015 9:33 am
by danicampora
Hi,

No, in hibernate mode no code is running. It's meant to save power. When waking up from hibernate the MCU will "reset" and start execution from scratch, so you need to check the reset_cause to decide how to proceed.

Re: Hibernating mode.

Posted: Mon Nov 30, 2015 12:04 am
by beyonlo
1. How go to hibernate mode?
2. How get ou from hibernate mode?

Are there a method hibernate_mode(time in ms) on python? So after that time system come back?

Re: Hibernating mode.

Posted: Mon Nov 30, 2015 6:52 am
by kfricke
There is some documentation you need to read to understand how this works. In general you need to select a sleep mode and enter it "after" you did set the RTC alarm for a given number of milliseconds (the time you intend to sleep).
beyonlo wrote:1. How go to hibernate mode?
This part describes how to enter the different sleep modes (in particular the methods idle(), sleep() and deep_sleep()).
2. How get ou from hibernate mode?
The RTC alarm does trigger the interrupt which you need to use to wake yourself up from the sleep methods. You do not need to set the RTC to a correct time, if your only intent is to sleep for a few microseconds.
You should skip the repeated RTC alarm (second argument to the alarm() method), since there seems to be a bug in current firmware versions, regarding this.

When using deep_sleep() your WiPy board starts up as if you did just boot it. There is a way to differentiate the RTC wakeup from an normal system start, in case you need to know this.
Using sleep() or idle() only suspends for a given number of milliseconds and does not enter real low power sleep. The two (not so deep sleep modes) idle() and sleep() do also keep WLAN up and connected.