KL25Z low power mode

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

KL25Z low power mode

Jump to solution
2,749 Views
Embionics
Contributor III

Hello,

Hello,

I'm starting working with KL25Z board and I'm trying to find a low power mode suitable for my application.

I have a problem with stop mode.

I am using processor expert with Code warrior 10.3.

In my project I add the "BitIO" component to drive an input pin(PTD6)

Also made the same pin(PTD6) as a LLWU for any edge in CPU setting.

When i call below function it goes into stop mode.

Cpu_SetOperationMode(DOM_STOP, NULL, NULL);

But it is not coming out of stop even by setting PTD 6 pin high or low.

Please help me if i am getting wrong.

Regards,

Amreen

Labels (1)
0 Kudos
1 Solution
1,494 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Amreen,

   I already help you check your code, about the configuration, it is ok, to test your low power mode, I add the following code in your main():

Cpu_SetOperationMode(DOM_SLEEP, NULL, NULL);  // enter normal stop

  // Wait for clocks to stabilize

  for (i=0; i<20000; i++)

  {}

// printf("Woke up from Stop!! \n\n");

  //jjtest

  BLUE_LED_SetVal(BLUE_LED_DeviceData);

  while(1)          //after wake up then blinking, please make the PTA5 to ground to realize wake up

  {

      RED_LED_SetVal(RED_LED_DeviceData);

  for(c1=0;c1<10;c1++)

  {

      for(c2=0;c2<65535;c2++);

  }

  RED_LED_ClrVal(RED_LED_DeviceData);

  for(c1=0;c1<10;c1++)

  {

      for(c2=0;c2<65535;c2++);

  }

You can realize wake up by connect the PTA5 to ground, then the red light will brink, it means chip already wake up.

Please find the new code in the attachment, I already comment the uart code, after you test the low power function is ok, you can add your uart code again.

I wish my answer will help you!

If you still have question, please let me know!

Best regards!

Jingjing

View solution in original post

0 Kudos
9 Replies
1,494 Views
gibbon1
Contributor III

I had to deal with this and know why it's confusing. There are two wake up interrupt sources on the KL24, the AWIC and LLWU.  The AWIC is part of the standard ARM core from Arm Ltd.  The documentation is mostly on the ARM website. The LLWU is a Kinetis (Freescale) designed module and is documented in the KL24 data sheet.

Very simply,

The LLWU is disabled except when in a Low Leakage Stop Mode. Which means it cannot be used to wake the processor up from normal stop or standby modes. You need to use the AWIC instead.

The AWIC is disables in Low Leakage Stop Modes, which means you need to use the LLWU to wake up the processor from LLS.

Note on the KL15 which I'm using some LLWU input pins also have pin change interrupts (AWIC) and some do not.  This can be an issue if you want a pin to be able to both wake up the processor from sleep mode and low leakage sleep mode.  If possible you may want to avoid using the low leakage stop modes unless you really need ultra low sleep current.

0 Kudos
1,494 Views
Embionics
Contributor III

Hello,

I am trying both modes differently..

First is that i am working with Normal Stop mode.

In which LLWU is disable.

I have configure one pin as e external interrupt pin using processor expert with CW10.3.

In main function I have called the function "mode_Select=Cpu_SetOperationMode(DOM_STOP, NULL, NULL) " to enter into stop mode. For this I have refer code "PEx_low_power_demo " from freescale webside.

and after this function i have written while loop for LED toggle.

But when interrupt occurs is it not coming out of the stop mode.LED is not toggling.

Please advise me if there is some other method.

Also i have to work with LLWU pin interrupt to wake from other stop modes like VLLSx to decide which mode is suitable for my application.

Reg,

Amreen

0 Kudos
1,494 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Amreen,

      According to your demand, I write the code of wake up from normal stop base on "PEx_low_power_demo ", please find in the attachments!

     I use the PTA5 , and configure the interrupt as the wake up source, after wake up from the normal stop, then red light blink.

   After test, the function is ok!

     I hope it will helps you, if you still have question, please let me know!

Best regards!

Jingjing

1,494 Views
Embionics
Contributor III

Hello,

Thanks for the code. Your code is very helpful and it is working with my hardware.

It saw that my CPU Setting are different than your CPU setting.

I am trying to figure out the setting from your code  which is require for my application.

I have attached my CPU Settings file.

Guide me if i am going in wrong direction.

Thanks,

Amreen

0 Kudos
1,494 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Amreen sayyed,

    I would like to help you to compare and find the wrong problem, but maybe you need give me your problem project, then I can do the test.

    The configuration of CPU is not enough to locate your issues!

Best regards!

Jing

0 Kudos
1,494 Views
Embionics
Contributor III

Hello,

I have attached my project.

It contain some extra component like UART0 and UART1.

These components are future requirement of my project.

Also i am not able to generate .hex file from your project. Is there any different setting require for it.

Thanks,

Amreen

0 Kudos
1,495 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Amreen,

   I already help you check your code, about the configuration, it is ok, to test your low power mode, I add the following code in your main():

Cpu_SetOperationMode(DOM_SLEEP, NULL, NULL);  // enter normal stop

  // Wait for clocks to stabilize

  for (i=0; i<20000; i++)

  {}

// printf("Woke up from Stop!! \n\n");

  //jjtest

  BLUE_LED_SetVal(BLUE_LED_DeviceData);

  while(1)          //after wake up then blinking, please make the PTA5 to ground to realize wake up

  {

      RED_LED_SetVal(RED_LED_DeviceData);

  for(c1=0;c1<10;c1++)

  {

      for(c2=0;c2<65535;c2++);

  }

  RED_LED_ClrVal(RED_LED_DeviceData);

  for(c1=0;c1<10;c1++)

  {

      for(c2=0;c2<65535;c2++);

  }

You can realize wake up by connect the PTA5 to ground, then the red light will brink, it means chip already wake up.

Please find the new code in the attachment, I already comment the uart code, after you test the low power function is ok, you can add your uart code again.

I wish my answer will help you!

If you still have question, please let me know!

Best regards!

Jingjing

0 Kudos
1,494 Views
Embionics
Contributor III

Thank you jing. Your code was very helpful to me.

Now I am trying VLLS3 mode in PEx_low_power_demo code given by you at the start of this thread.

I have made following 3 changes to that code as

1) at power on Green LED will Glow.

2) Before entering into VLLS mode turn off green and turn on Blue LED.

3) When Come out off VLLS3 mode turn off blue LED & RED LED will Toggle Continuously.

As per my understanding, before entering into VLLS we have to set PTD6  LLWU pin  for interrupt.

To do this, I set PTD6 as GPIO with interrupt disable, set PTD6 a input pin and then

enable and select the falling edge detect type for the external wake up input pin PTD6.

In  event "Cpu_OnLLSWakeUpINT", I set LPTMR access enable.

Also set  TCF,TEN,TIE bits in LPTMR0_CSR as LPTMR is enable.

I am considering that when I am giving falling edge at PTD6 the toggling of RED LED should work.

But the code is not coming out off VLLS3 As toggling of RED LED is not occurred & only BLUE LED is ON.

Is it right method to test VLLS3 mode?

I have also attached the code. Please suggest if there any modification require to it.

Thanks,

Amreen

0 Kudos
1,494 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Amreen,

 

   According to our reference manual, if you want to come out of normal stop mode, you should use the interrupt.

   Just like the following:

23.jpg

So, I have a question, did you configure the PTD6 interruption?

Best regards!

Jingjing