4 Replies Latest reply on Feb 22, 2016 1:37 PM by Intel_Peter

    Using the MCU to wakeup from standby

    Christoph.P

      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 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

        • 1. Re: Using the MCU to wakeup from standby
          Christoph.P

          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!

          • 2. Re: Using the MCU to wakeup from standby
            Christoph.P

            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 here

            • 3. Re: Using the MCU to wakeup from standby
              Intel_Peter

              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.

              • 4. Re: Using the MCU to wakeup from standby
                Intel_Peter

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

                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, Power Consumption for Intel® Edison Breakout Board Edison Kit for Arduino, Power Consumption for Intel® Edison Board for Arduino*

                 

                Peter.