Other Parts Discussed in Thread: CC2430
Hi,
I am using CC2430 along with ZStack-CC2430-1.4.3-1.2.1.
I was playing around with the sleep functionality of the MCU and chanced upon this particular behaviour.
My code does something like this:
SET_SLEEP_STATE(DEEP_SLEEP_PM3); //this will set SLEEP.MODE to 00, PM3
//some codes that are not relevant
while(1); //MCU caught here indefinitely
Now, i have an external interrupt enabled on P1.3 via a push button switch. What i noticed is that, when i depress the switch the interrupt service routine of Port1 never gets called. In the debugger i found that the interrupt flags of P1.3 are not set at all. All interrupt enable bits are set properly.
Now when i manually set the SLEEP.MODE bits to 00 in the debugger, immediately the P1.3 interrupt flags are set and the associated ISR then gets executed.
I replaced the above while(1) with PCON.IDLE = 1. This time the MCU goes to sleep and is able to get awakened by the P1.3 interrupt.
It looks like the MCU is trying to set the SLEEP.MODE and the PCON.IDLE as an atomic set. That is, interrupts get disabled in-between, though this is not visible in the debugger.
Can someone confirm on this behavior?