1 Reply Latest reply on May 3, 2016 1:35 PM by Intel Corporation

    mcu api wakeups

    dorlX

      hello again,

      i'm trying to write a code for the MCU to be a "interrupt generator" for the cpp code i'm writing, which goes to S3 state for some time..

      the general idea is that the cpp file does some work, registers a wake up with the MCU (using host_receive), goes to S3, and should be waken up by the MCU, which is set to sending a wakeup 20s after the wakeup called was registered with him.

       

      the code for the MCU:

      void mcu_main()

      {

        int len;

        char buf[64];

        while(1){

        do {

        len = host_receive((unsigned char *)buf, 64);

        mcu_sleep(10);

        } while (len <= 0);

        if (strncmp(buf, "start", 5) == 0)

        {

        debug_print(DBG_INFO, "registered a wake up call in 20 secs!\n");

        mcu_sleep(2000);

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

        }

        }

      }

       

       

      the problem is, that i always get the wakeup call after 2.5 seconds, and not 20.. is there a reason that happens ?

       

      thanks,

      Dor

        • 1. Re: mcu api wakeups
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi dorlX,

          According to your description, the if statement is, at some point, true and the message "registered a wake up call in 20 secs!\n" is printed before the MCU goes to sleep. Have you tried to change the 2000 value to another one just to see if you get different times for the wakeup call?

          Regards,
          Diego