2014-03-29 11:39 PM
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-options2014-03-30 01:41 AM
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.