"KEAZN64M", (WFI Command not working ) IAR Compiler

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

"KEAZN64M", (WFI Command not working ) IAR Compiler

395 Views
mohammedaboelna
Contributor III

1- How can I make sure that the "WFI" command is working and the MCU enters the wait "low power" mode ? I mean is there a certain register i can watch to check that I'm in the wait mood ?
2- How can i go out of the wait mode using KBI interrupt noting that before entering the Wait mode the interrupts are disabled and PRIMASK.PM is set to 1 ? 
Hint
This is the Macro i used to define the wait instruction 
 
#define WAIT_FOR_INTERRUPTS()  asm("wfi")

0 Kudos
1 Reply

279 Views
mjbcswitzerland
Specialist V

Mohammed

1. When in the wait mode the processor 's core will be 'frozen', therefore you can do anything like checking registers. The simplest method is to set a break point after the wfi instruction and if it is hit it means that it has "woken" again.

2. The WAIT state is existed when there are interrupts pending "before the mask" so it is normal and correct to globally disable interrupts before executing the wfi instruction - this will have no effect on the wake-up.

Check also http://www.utasker.com/kinetis/FRDM-KEAZ64Q64.html - the binary there probably has low power tests according to http://www.utasker.com/kinetis/LLWU.html

Regards

Mark

0 Kudos