Community
cancel
Showing results for 
Search instead for 
Did you mean: 
CChri35
New Contributor II
1,182 Views

Using the MCU to wakeup from standby

Hi!

As I've read in several posts, many people try to accomplish to realise battery-friendly power managment

which means control the standby by software.

We know, that - if the wpa_supplicant is deaktivated - the Edison can be put into standy with the commands

echo -n "mem" > /sys/power/state

or

echo -n "freeze" > /sys/power/state

 

But what is much harder: to get it out the standby programmatically. I've found this Intel https://software.intel.com/en-us/node/557354# Waking_up_the_host_CPU_using_the_MCU article, which has

an section called "Waking up the host CPU using the MCU". I thought this could be the answer as obviously

it is also possible to register GPIO's as interrupts.

Thus I have tried to get started with the MCU. I've downloaded the SDK an have programmed the MCU

with the sample script which should send messages to ttyMFD2.

But as far as I can see it, the MCU code isn't run (or it is wrong) because there are no messages appearing

on ttyMFD2. I've also tried to wakup the CPU every 2 minutes. But this didn't work either.

 

cat ttymcu0

gives me no output.

What can be wrong? Why does the MCU not run / work?

Christoph

4 Replies
CChri35
New Contributor II
70 Views

I've got the code to run on the MCU now (seems I had forgotten to save anything first ect.)

My program look like this now:

# include "mcu_api.h"

# include "mcu_errno.h"

int my_irq(int req)

{

debug_print(DBG_INFO, "PWR Button pressed -> Wakeup!\n");

host_send((unsigned char*)"wake up!\n", 10);

return IRQ_HANDLED;

}

void mcu_main()

{

gpio_register_interrupt(83, 0, my_irq);

while (1)

{

debug_print(DBG_INFO, "I am in main loop!\n");

mcu_sleep(300); /* sleep 3 second */

}

}

 

 

When I press my GPIO button I can now see the Messages including the times, when I pressed it.

root@edison:~# cat /dev/ttymcu1

( INFO): I am in main loop!

( INFO): I am in main loop!

( INFO): I am in main loop!

( INFO): I am in main loop!

( INFO): PWR Button pressed -> Wakeup!

( INFO): I am in main loop!

( INFO): PWR Button pressed -> Wakeup!

( INFO): I am in main loop!

( INFO): I am in main loop!

( INFO): I am in main loop!

( INFO): I am in main loop!

( INFO): I am in main loop!

But when I send the system into sleep with echo -n "freeze" > /sys/power/state,

it doesn't wakeup, when I press my button.

Is

host_send((unsigned char*)"wake up!\n", 10);

really the right command to ake it up? Do I have to do something else?

 

Thx!

 

CChri35
New Contributor II
70 Views

And Update:

echo -n "mem" > /sys/power/state

works with my method. So I reached the target. But only for the first time after boot,

which was also stated /message/310012# 310012 here

Pedro_M_Intel
Employee
70 Views

Hello Christoph.P,

I just checked the script myself and noticed that I'm having the same behavior as you. Let check what's going on and I'll get back to you as soon as possible.

Peter.

Pedro_M_Intel
Employee
70 Views

I followed the "Waking up the host CPU using the MCU" section from this guide

https://software.intel.com/en-us/node/557354# Waking_up_the_host_CPU_using_the_MCU Using the MCU SDK and API: Code examples | Intel® Developer Zone, the guide mentions that to enable power management of the serial port you need to run the command

echo auto > /sys/devices/pci0000\:00/0000\:00\:04.3/power/control

We tested the Edison breakout board when enabling power management of the serial port with Wi-Fi enabled/disabled. These were the current results:

Power management enabled and Wi-Fi enabled: ~35.40 mA

Power management enabled and Wi-Fi disabled: ~10 mA

We encourage you to take a look at these documents to get power consumption figures:

Edison Breakout Board, http://www.intel.com/content/www/us/en/support/boards-and-kits/intel-edison-boards/000006086.html?wa... Power Consumption for Intel® Edison Breakout Board Edison Kit for Arduino, http://www.intel.com/content/www/us/en/support/boards-and-kits/intel-edison-boards/000006123.html?wa... Power Consumption for Intel® Edison Board for Arduino*

Peter.

Reply