AnsweredAssumed Answered

Problem using the LLWU to recover from LLS mode

Question asked by Kit Church on Apr 13, 2011
Latest reply on Aug 19, 2011 by Mirko Carloni

Hello,

I'm trying to use the LLWU module a Kinetis K40 to wakeup from LLS stop mode, but can't get it to work.  I can put my device into LLS mode, but can't seem to fully recover when using a LLWU wakeup GPIO.  My device is using ~25 mA in run mode.  I push a button to put it into LLS mode, where the current drops to ~100 uA.  I press the same button (which is setup as a LLWU wakeup source) and the current jumps up to ~19 mA, but the device doesn't do anything.  So obviously the device is getting into LLS mode when the button is pressed and is leaving LLS mode when the button is pressed again - but it's not going into my LLWU ISR.  Asserting the reset pin on the MCU will restart the MCU from this unknown state.

 

I've enabled the LLWU interrupt, but again, the ISR never gets called.  I thought maybe the program was getting stuck in another ISR besides my LLWU ISR when waking up from LLS, but I've checked all the ISRs from the vector table and none of them are causing the freeze up.

 

I've based my code on Freescale's Power Management Controller (PMC) example code.

 

Below is the code I use to put the MCU into LLS mode:

 

SIM_SCGC4 |= SIM_SCGC4_LLWU_MASK;    // enable LLWU clock gating
MC_PMPROT = 0 | MC_PMPROT_ALLS_MASK;    // allow LLS stop mode
MC_PMCTRL = 0 | MC_PMCTRL_LPLLSM(3);     // enable LLS mode
SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK;        // set SLEEPDEEP bit to enable sleep modes
LLWU_PE3 |= LLWU_PE3_WUPE10(2);        // set Power button as wakeup source

asm("wfi");

 

 

Here is my ISR:

 

void llwu_isr(void)
{
    initInterrupts();
    SIM_SCGC4 |= SIM_SCGC4_LLWU_MASK;    // enable LLWU clock gating
    SIM_SCGC5 = SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK |       SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK;
    initGPIO();

 

    LLWU_CS |= LLWU_CS_ACKISO_MASK;    // clear LLWU acknowledge flag
    LLWU_F1 = 0xFF;            // clear wakeup flags
    LLWU_F2 = 0xFF;            // clear wakeup flags
    LLWU_F3 = 0xFF;            // clear wakeup flags
}

Anyone have any ideas why I can't completely get out of LLS mode?

 

Thanks!

Outcomes