This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

issues waking up from PM3 (sometimes...)

Hello All,

I have been working on a project that uses sleepmode PM3 and a button interupt to wake... before going into sleep, I turn on the interupt for the appropriate pin and call halDeepSleep()

when I press the button, 70-80% of the time it wakes up... sometimes It takes me 50+ presses to get a failure.

Here is the odd part, if I pause the debugger, It is stopped at the line directly after PCON=IDLE.  from here if I simply hit continue, the program starts just like it should... I have tried HalSystemReset(), setting the reset register, adding NOPs, setting PCON=0, sleepcmd=0... nothing seems to work.

does anyone have anymore suggestions?

Thanks,

Jason

  • Hi Jason, 

    The behavior when using the debugger is easy to explain. When the device is in yPM3 and you hit pause (HALT debug command), the device will be taken out of PM3 and allows you to single step from there on. 

    I would suggest that you put an assert the HAL_sleep function to make sure the interrupts are actually enabled when you are about to enter sleep. Do you for example disable the interrupt in the ISR to do debouncing? 

    Peder