Problem using the LLWU to recover from LLS mode

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problem using the LLWU to recover from LLS mode

ソリューションへジャンプ
2,312件の閲覧回数
RonBurgundy
Contributor I

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!

0 件の賞賛
返信
1 解決策
1,283件の閲覧回数
RonBurgundy
Contributor I

I figured out my problem with the LLWU.  After pressing the button to wakeup from LLS mode (which is on PORTC), control goes from the LLWU ISR to the PORTC ISR.  This wasn't obvious as my code was fairly complex.  I had to end up creating a simple project with minimal setup, which made it a lot easier to see where the MCU was getting stuck.

 

Hope this helps anyone else who gets stuck on this.

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,284件の閲覧回数
RonBurgundy
Contributor I

I figured out my problem with the LLWU.  After pressing the button to wakeup from LLS mode (which is on PORTC), control goes from the LLWU ISR to the PORTC ISR.  This wasn't obvious as my code was fairly complex.  I had to end up creating a simple project with minimal setup, which made it a lot easier to see where the MCU was getting stuck.

 

Hope this helps anyone else who gets stuck on this.

0 件の賞賛
返信
1,283件の閲覧回数
Mirko
Contributor I

Hi,

 

i have a problem to wake up K40 from LLS with LLWU. I try to wake up it with pin interrupt (PTE1) but when i sending the stimulus from this pin the K40 goes in a unpredictable power status.

I put the following code in the PORT E interrupt:

 

PE_ISR(isrINT_PORTE){  /* Write your interrupt code here ... */ PORTE_PCR1 |= 0x01000000; 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;    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}

 The only difference in comparison to the previous post is the absence of initinterrupts functions () and initgpio (). What code that must contain these functions?

 

Thanks to all.

0 件の賞賛
返信