Cannot exit from VLPS Mode in KL05Z

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cannot exit from VLPS Mode in KL05Z

673 Views
varunrajarangan
Contributor II

Hi there,

I am trying to implement VLPS mode in FRDM-KL05Z dev board.

I configured LPTMR to wakeup from sleep.

It is working perfectly in debug mode.

But in normal mode (without codewarrior debug support), it is going to sleep mode, but unable to wake up using the LPTMR interrupt.

These are the functions...

/* Low Power Timer Interrupt Service Routine*/

void LPTimer_IRQHandler(void){

    unsigned static char temp1 = 0;

    LPTMR0_CSR |= LPTMR_CSR_TCF_MASK;        //   

    LPTMR0_CSR |= LPTMR_CSR_TEN_MASK;        // Enable Timer

    temp1++;

    PORTB_TOGGLE(8);

    SMC_PMCTRL &= ~SMC_PMCTRL_STOPM_MASK;

    SCB_SCR &= ~(SCB_SCR_SLEEPDEEP_MASK | SCB_SCR_SLEEPONEXIT_MASK);

    }

SetPowerMode(uint8_t mode){

    uint8_t temp1 = 0;

    SMC_PMPROT = 0x22;                                                             // Allow Low Leakage Power Modes (VLPR,VLPW,VLPS,LLS)

    SMC_PMPROT = SMC_PMPROT_AVLP_MASK;                      //    

    SMC_PMCTRL &= ~SMC_PMCTRL_STOPM_MASK;               //

    SMC_PMCTRL |=  SMC_PMCTRL_STOPM(0x2);                     //

    temp1 = SMC_PMCTRL;                                                           // Dummy read

    }

void GotoSleep(){

    SCB_SCR|=SCB_SCR_SLEEPDEEP_MASK;                            // Enable ARM deep sleep modes

    __asm("DSB");

    __asm("WFI");                                                                             // Go to sleep

    __asm("ISB");

    }

Please help me to resolve this issue.

Thanks and regards

Varun Rajarangan

Labels (1)
0 Kudos
2 Replies

451 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Varun,

There is a demo code about use the LPTMR interrupt wake up low power mode(including the VLPS mode),

i recommend you can first test it on your board , and if it can work well in normal mode (without codewarrior debug support) , 

you can check your code refer to it .

You can download the demo code here :

FRDM-KL05Z Sample Code Package

Hope it helps

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------


Have a great day,
Alice

451 Views
varunrajarangan
Contributor II

Hi Alice,

Thanks for the reply. I managed to make it work. I changed the LPTMR clock source to 1KHz internal low power oscillator.

Regards

Varun Rajarangan

0 Kudos