How long does it take to wake up from from WFI once an interrupt occurs?
What system parameters does the answer depend on?
What's turned off in the CPU (and elsewhere) while WFI is underway?
I'm using NXP i.MXRT1050 (Cortex M7) and I'm experiencing what seems to be longer than expected wake up time.
"seems" is rather un-scientific. Did you measure the wakeup time? For example with the systick timer?
Well I did take some indirect measurements which is what led me to the question: I performed erase/program operation on an external flash in one of two ways:
- Send the erase/program command and then poll an input signal coming from the flash and indicating whether the flash is busy or not.
- Send the erase/program command, go to sleep (WFI) and use the same input signal as an interrupt to wake up the CPU. After wake up check that signal (as the interrupt may have come from another source). If still busy go back to sleep (WFI), otherwise - done.
In my test I ran 170 operations (10 erase and 160 program). The second implementation took 800ms than the first. On average this is 4.7ms more per operation. If this is due to wake up from WFI then I may not want to use WFI despite the power savings. That is the reason I asked all the questions above.
Now, that's some more info ;-)
4.7ms is a lot. I'd try to do a measurement with systick timer as well. The delay might be related to the external interrupt. Do you "simply" use WFI or do you also enter WAIT mode?
One idea is, that it is related to PLL locking, but the data sheet states it is below 2250 cycles of the 24MHz reference clock (edit: ~100us).
Anyway, interesting that NXP does not give any hint how long it takes to leave the different power-saving modes :(
Is your SOC allowed to enter power saving state when CPU goes to WFI? Otherwise wakeup out of WFI wouldn't take that long time.
View all questions in Embedded forum