Wakeup from LLS mode on K60

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

Wakeup from LLS mode on K60

Jump to solution
1,918 Views
danielchai
Senior Contributor I

Hi All,

I have a question about wake up from LLS mode. I read the manual of K60 and it said it can be wake up from LLS using wakeup pin or wakeup module. And I read the demo code uses timer to wake it up. My question is how could I wake up system from LLS using wake up pin such as PTE2, PTE4..

Thank you.

-Daniel

1 Solution
1,544 Views
chris_brown
NXP Employee
NXP Employee

Hi Daniel,

Here are the general steps you will want to follow to get that to happen:

1) Make sure the pin you want to use is an LLWU pin listed in the LLWU input table in chapter 3 (it looks like PTE2 and PTE4 are for the K60).

2) Configure the pin you want to use for a digital function (any digital function should work, but personally, I recommend using the GPIO function).

3) Configure the pin in the LLWU pin enable register (it looks like these should be LLWU_P1 and LLWU_P2 respectively).  The pin enable registers are LLWU_PEx.  Consult the reference manual for which pin is controlled by which register. 

4) I would also recommend enabling the LLWU interrupt in the NVIC.  You can then check to see which wakeup pin woke you from LLS using the LLWU_Fx registers.  Remember to clear the flag before leaving the interrupt routine. 

That should be it.  :smileyhappy:

~Chris

View solution in original post

0 Kudos
Reply
6 Replies
1,544 Views
jvasil
Contributor III

Chris's answer is the first place I've seen the NVIC mentioned in the context of the LLWU interrupt.  Every other place I've read about this--including multiple Freescale application notes--just say "enable the LLWU interrupt."  Since the NVIC is disabled while in LLS (& VLLSx) mode, it is very counter-intuitive to have to enable this ISR in the NVIC!  I'd reached the conclusion that this is what the app note comment meant earlier today but it is nice to read this comment that makes me more positive about expecting a positive outcome when I try coding this tomorrow!!

James

0 Kudos
Reply
1,544 Views
mjbcswitzerland
Specialist V

Hi James

Please see http://www.utasker.com/kinetis/LLWU.html

The NVIC is needed some "some" of the LLWU modules but not for the LLWU pins.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
Reply
1,545 Views
chris_brown
NXP Employee
NXP Employee

Hi Daniel,

Here are the general steps you will want to follow to get that to happen:

1) Make sure the pin you want to use is an LLWU pin listed in the LLWU input table in chapter 3 (it looks like PTE2 and PTE4 are for the K60).

2) Configure the pin you want to use for a digital function (any digital function should work, but personally, I recommend using the GPIO function).

3) Configure the pin in the LLWU pin enable register (it looks like these should be LLWU_P1 and LLWU_P2 respectively).  The pin enable registers are LLWU_PEx.  Consult the reference manual for which pin is controlled by which register. 

4) I would also recommend enabling the LLWU interrupt in the NVIC.  You can then check to see which wakeup pin woke you from LLS using the LLWU_Fx registers.  Remember to clear the flag before leaving the interrupt routine. 

That should be it.  :smileyhappy:

~Chris

0 Kudos
Reply
1,544 Views
danielchai
Senior Contributor I

Hi Chris,

One more question is that when I configure the pin in LLWU pin enable register, do I have to use

LLWU_PE1 = LLWU_PE1_WUPE0(0x02); // defining PORT E1 as a wakeup source for LLWU

or there is some library function I can call from user level?

Thank you.

-Daniel

1,544 Views
Premjee
Contributor II

Hello Daniel,

                    If you are still having problem getting the LLWU source, I believe ARM does a memory clear when waking up from LLS/VLLS, you will need to reserve some memory space by offsetting it in the build section of component inspector for the CPU, and storing the wake up source in that location

Cpu_OnLLSWakeUpINT(void)

{

/* Write your code here ... */

LLWU_Source = Cpu_GetLLSWakeUpFlags();

/* release ACKISO */

if (PMC_REGSCPMC_REGSC_ACKISO_MASK)

{
PMC_REGSC |= PMC_REGSC_ACKISO_MASK;

}


}


1,544 Views
danielchai
Senior Contributor I

Hi JEEVAN,

That helps.

Thank you.