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:
len = host_receive((unsigned char *)buf, 64);
} while (len <= 0);
if (strncmp(buf, "start", 5) == 0)
debug_print(DBG_INFO, "registered a wake up call in 20 secs!\n");
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 ?
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?