I am working with an Edison compute module in a custom board running 3.10.98-poky-edison+. I am able to go in and out of sleep mode using echo -n "mem" > /sys/power/state. Also i understand that Wifi needs to be turned off before going to low power mode. It seems that there is very less documentation for the low power modes of Edison. I have some clarifications regarding the low power mode.
1. What are the possible ways of waking the device from mem state? Can the device be woken up from sleep(mem state) using a timer interrupt?
2. What are the proper steps for turning off Wifi prior to sleep and turning it on after sleep. Please note that the device is always in STATION mode and connected to an AP.
3. What is the use of power management in Edison? Should it be turn on or off?
Thank you for contacting us, we'll do our best to help you clarify any doubts you have about the Edison. First, if after looking at the documentation you still feel something is not clear, don't hesitate to contact us, we'll do the effort to try and find more information.
One of the ways to wake the Edison is using the pin PWRBTN# . According to the module datasheet:
" The PWRBTN# pin is an active low input which can cause the Edison module to transition into and out of sleep, or cause a power off , depending on the configuration of the software."
I found a couple of useful threads that discuss waking the Edison, sleep states and interrupts, take a look at
/message/381316# 381316 https://communities.intel.com/message/381316# 381316
Regarding your question about turning off WiFi, you can try using these commands before placing the device in mem state.
ifconfig wlan0 down systemctl stop wpa_supplicant
In regards to the use of power management, it depends on your application. Disabling power management might be useful for some debug/performance reasons. This means that if you want the Edison to consume as less energy as possible then disabling power management may be an option. Let us know if you're interested in disabling power management.
We'll be waiting for your response.
I went through the links you provided. But i couldnt find an answer to my first question though.
ie Can the device be woken up from sleep(mem state) using a timer interrupt?.
Please note that we are using a custom board, thus POWERBTN cannot be used for waking up. The only option i see now is waking up through serial interrupts.
Thanks for your patience and for the clarification that you're using a custom board.
Timer interrupts work on the Edison. Other users have reported it works fine. I looked for an example thread and found this one /thread/60831 https://communities.intel.com/thread/60831 . Here you can see that the timer interrupt works fine and you can see examples and suggestions on how to start working with interrupts.
Let us know if this was helpful and if there's anything else we can help you with.
Thanks for the reply. Please note that my requirement was to wake up Edison with a timer after it has gone to low power mode. In the normal mode i am able to generate timer interrupts. Please see if this is possible.
I'm not sure if the timer is still running during low-power sleep mode. If the timer is still running, then it'd be possible to wake the device from low-power sleep mode. You mentioned in your initial post that you're able to go in and out of sleep mode. One way to test if the timer is still running and thus making it possible to be woken up during sleep mode is to have the program you're using as a timer to execute the command to go out of sleep mode at the moment the timer is supposed to wake up the Edison.
If this test is successful, then it'd be possible to wake the Edison after a timer comes in gives the order to go out of sleep mode. If the test is not successful, it'd mean that the timer turns off during low power mode, making the approach of a timer interrupt not possible.
Let us know your results.
It seems like the timer is not working during sleep mode. I had also read in some other posts that Edison's RTC can be used for waking up from sleep, but i am not sure enough. Is there any GPIO pins available on Edison that has the ability to wake up Edison on interrupt?
I also did some research on the Edison's RTC, the thread I found most useful was this one /thread/57801 https://communities.intel.com/thread/57801 . Which threads did you see?
There's a way to test if the MRAA ISR example works to check if you can wake up the Edison with pin 6. The example is the following: https://github.com/intel-iot-devkit/mraa/blob/master/examples/isr_pin6.c https://github.com/intel-iot-devkit/mraa/blob/master/examples/isr_pin6.c .
First, try this example on normal mode to see if the example works and you're able to do interrupts. Once you're sure the example works you can put the Edison in sleep mode and run the example again and adapt the code with the command you use to put the Edison out of sleep mode. If the ISR example manages to wake up the Edison then you'd be able to confirm if the Edison can be waken up using a GPIO pin as an interrupt.
Let us know your results.
One more question related to Wifi connection after wake up from low power mode. It seems that the device takes around 10 seconds for establishing Wifi connection after coming out of sleep. This delay includes starting wpa_supplicant, wpa_cli reconfigure etc. What is the expected delay for the Wifi module to be up, after coming out of mem state ?
I measured the delay by trial and error. I added a delay of 10 seconds after wake up to send some Wifi messages. Any delay less than this would result in a communication failure.
You mention that the device first wakes up and then there's a delay of 10s before you're successful at establishing a WiFi communication. This delay is not only the time it takes WiFi to be up, it also involves the many other features that WiFi requires to be up again before it can establish a connection. When the Edison comes back from sleep, there are several other functionality features that need to be enabled, that's why it's hard to say how much time specifically WiFi takes to be configured and be up again. I mean that the Edison is not in normal mode immediately after the wake up command is activated.
Having that said, we can try and test the same scenario you're using to compare how much time it'd take before the Edison can establish a connection. If you want us to try the same scenario and compare results, please send us the exact commands you used to put the Edison in sleep mode and the steps you took to wake up the Edison and test WiFi connectivity.
We'll be waiting for you response.
I am re opening the discussion here, as i have some more issues with WiFi and sleep mode. We have noted that after powering down the Wifi, when the device enters sleep mode, it seems the WiFi is still active.Please see if there is any problem with the commands used to enter sleep mode:
system("ifconfig wlan0 down"); /*disable wlan0*/
system("systemctl stop wpa_supplicant"); /*Stop wpa supplicant service before going to sleep*/
system("echo -n ""mem"" > /sys/power/state"); /*Enter sleep mode*/
What image are you using? Before running those 3 commands all pings were successful and after running the commands the pings were unsuccessful, which proves the Wi-Fi is not active. The commands were run directly from the console and with the image 201606061707.
How are you testing whether Wi-Fi is active?
Let us know your results.
I am using 201606081705 (3.10.98-poky-edison+).
We are using hotspot in phone as access point. During sleep mode, the phone still shows that the device is connected. Please note that this issue does not occur always.At times we see that the Wifi is properly shutdown. Can you repeat the test number of times to ensure that wifi is always powered down. Also please confirm that the commands i use are proper.
This is interesting. I flashed the latest image and ran the test about 5 times and all those times I could see Wi-Fi properly shutdown when in sleep mode. This doesn't occur randomly as you describe. We're not connecting to a phone though, we're just pinging a random website to test connectivity.
How many times did you test Wi-Fi connectivity in sleep mode before you get the first unsuccessful test?
You mention that during sleep mode, the phone still shows the device connected. Have you tried to send data in this "sleep but connected state"?