Content originally posted in LPCWare by ArriaLive on Sat Oct 11 23:10:08 MST 2014
I know this thread is a couple years old, but I'm having a little trouble with the __SEV() and __WFE() instructions: The LPC43xx documentation, the ARM website, and this conversation suggest that when using a __WFE() instruction on the M0, the M0 goes to sleep (default is sleep mode), and is awakened by an __SEV() instruction from the M4. John's implementation seems to work, but mine doesn't. Am I missing a setting?
More info: In my application, the M0 runs a simple loop that checks a queue for a new entry. New entries are placed in the queue by the M4. This handshake works just fine. But since the queue is empty more than it is full, I'd like to just put the processor to sleep in the loop, then wake up when a new entry is in the queue. So, in the M0 loop I include the __WFE() instruction to let it nap, and then in the M4, when something is placed in the queue, I call the __SEV() instruction. That __SEV() should wake up the M0 and continue the loop, right?
But for some reason the M0 doesn't wake up on the __SEV() instruction. If I use the debugger to pause and continue the M0 processor, that wakes the M0 up, runs the loop once for any existing queue entry, then goes back to sleep again and won't wake up unless I create a debug event again. The __SEV() instruction on the M4 is not waking up the M0 on its own.
Does the NVIC or the Event Router have to be configured somehow (no, I have not yet enabled interrupts).
Thanks,