Hi,
I want to use the wfi instruction in my code. I'm sending a command to a module and wait for the reply.
I have configured UART communication with the module. Will it be good to use wfi() instruction? I know that it will turn the cpu to power down mode.
Instead I can use some arbitrary delay, but the time taken for the reply is varying in nature.(.7 to 2 sec)
What if I poll the Interrupt flag? is there any alternate solution ?
Thank You.
I don't believe there is any fundamentals, architectural reason why you should not be able to do this. However, I would not recommend it. If you choose to stop the processor in this way, all exceptions of lower priority will be blocked until you exit the exception handler. That is almost certainly not what you want. If you want to achieve the same effect, better to set the SLEEPONEXIT bit and then exit the exception handler. The processor will then exit the exception context and immediately sleep.
Hope this helps.
Chris
Hi, Thanks for your response.
This is what I need because I'm executing WFI instruction on the lowest priority interrupt service routine (occur continuously) which drives my code. I actually want to block the code until I get a response from the peripheral device(the expected interrupt after giving a command to the peripheral device - GSM) or else it would affect further progress in the code as I'm setting few flags based on this expected interrupt(like checking if the GSM is Offline or Online etc).