cancel
Showing results for 
Search instead for 
Did you mean: 

What triggers WFI exit?

zoharr
Associate II
Posted on March 30, 2014 at 08:39

Hello,

I want to use WFI, but I'm wondering how it works, what triggers the WFI to exit low power.

I've defined systick for 1uSec (I'll use it later for some delays).

I've defined timer2 for 100mSec.

I need to do some calculations every 100mSec. The calculation time should take about 10-15 mSec. The rest of the time the MCU should be in sleep mode.

I want to use WFI, but here is the question:

If I defined systick for 1uSec, does it means that in WFI, the system will wake from sleep every 1uSec, do nothing (since I didn't define nothig yet in SysTick_Handler() ) and go back to sleep till the timer interrupt occurs?

Is there any conditional WFI to wake only on specific interrupt and not on every interrupt?

#wfi-options
1 REPLY 1
Posted on March 30, 2014 at 10:41

WFI, Wait For INTERRUPT, like HALT in other architectures, comes out for interrupts, if you don't want to cause an interrupt(s), disable it/them.

Why generate a 1 MHz interrupt? If you just need to mark time with a counter (incrementing some value in software), then frankly use a hardware counter/timer in free-run mode, and compare values of that in the spin-loops you need it in. Don't be generating pointless interrupts, at exceedingly high frequency.

There is also WFE (Wait for EVENT), events behave differently, review the manual to determine if that does what you need.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..