cancel
Showing results for 
Search instead for 
Did you mean: 

How to exit WFE (Sleep) using Timer ?

johnfitzgerald9
Associate II
Posted on October 15, 2009 at 07:41

How to exit WFE (Sleep) using Timer ?

1 REPLY 1
johnfitzgerald9
Associate II
Posted on May 17, 2011 at 13:26

How must a timer be set up to exit WFE (Sleep) mode on overflow / underflow? Can the timer generate an EVENT to exit sleep or must I use an interrupt? Any examples please? I couldn't find one in the Std Peri Library.

I can set up the timer and generate an interrupt on timer overflow which I can service in a conventional handler. What I can't understand is how to use the WFE or WFI functions with the timer when I don't want an interrupt service - I just want to pause until the timer overflows, do something and then pause again and so on ...

For WFE and WFI it looks like the Gcc compiler doesn't understand __WFI() which assembles as

__WFI();

F7FFFF1D bl 0x080002C0

and you must use the form __asm(''wfi''); which assembles properly.

__asm(''wfi'');

BF30 wfi

Actually, it turns out you must use a compiler optimisation setting greater than 0 to get the __WFI(); instruction to produce inline code! Otherwise you get a function call.

In passing ... anyone understand what ''force_stores'' does in connection with wfi?

Also, why would wfi sometimes seem to miss or skip. Using it in a wait (wfi) loop to flash a LED is intermittent even though the interrupt is definitely regular.

[ This message was edited by: Omniverous on 16-10-2009 11:30 ]