Problems with Sleep Mode on KL05Z

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

Problems with Sleep Mode on KL05Z

Jump to solution
2,947 Views
saliheberisha
Contributor I

I am having problems waking up from sleep/stop mode,I set the external pin in LLWU  setting enabled and in the routine of detecting that interrupt set

Cpu_SetOperationMode(DOM_RUN, NULL, NULL); but I think the processor isn't detecting any interrupt. Also when entering the stop mode (VLLS) the board losses connection . All I need is a blinking led and via an external interrupt(falling edge) to set the processor in sleep and wake it up when rising edge on the interrupt is detected. I am using processor expert.

main looks like this :

int main(void)

{

  /* Write your local variable definition here */

     

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/

  PE_low_level_init();

EInt1_Enable();

  Cpu_VLPModeEnable();

  while(1){

  Bit1_SetVal();WAIT1_Waitms(100);

  Bit1_ClrVal();WAIT1_Waitms(100);

}

in events.c

void EInt1_OnInterrupt(void)

{

  WAIT1_Waitms(100);

  if (EInt1_GetVal())

  {

   Cpu_SetOperationMode(DOM_RUN, NULL, NULL);/* Write your code here ... */}

else {

  Cpu_SetOperationMode(DOM_STOP, NULL, NULL);

  }

}

Also tried this :

void Cpu_OnLLSWakeUpINT(void)

{

v = Cpu_SetOperationMode(DOM_RUN, NULL, NULL);// v is a char

Bit1_SetVal();WAIT1_Waitms(100);

  Bit1_ClrVal();WAIT1_Waitms(100);// just to see if it is entering this function

}

This is my configuration of CPU

Capture.PNG

1 Solution
2,144 Views
chris_brown
NXP Employee
NXP Employee

Hi Saliheberisha,

First, what debugger are you using?  Some debuggers will lose connection when entering low power modes because the debug circuitry is turned off when you enter debug mode.  Other debuggers will simply force the part to enter a pseudo low power mode.  So in either case, it is not recommended to enter a low power mode when debugging. 

Second, it sounds like maybe you are not handling ACKISO properly.  Remember that Processor Expert does not handle this for you.  So you will need to add some start-up code BEFORE the Processor Expert initialization runs.  See the screenshot below. 

UserCodeB4Init.png

Hope this helps,

Chris

View solution in original post

0 Kudos
Reply
6 Replies
2,145 Views
chris_brown
NXP Employee
NXP Employee

Hi Saliheberisha,

First, what debugger are you using?  Some debuggers will lose connection when entering low power modes because the debug circuitry is turned off when you enter debug mode.  Other debuggers will simply force the part to enter a pseudo low power mode.  So in either case, it is not recommended to enter a low power mode when debugging. 

Second, it sounds like maybe you are not handling ACKISO properly.  Remember that Processor Expert does not handle this for you.  So you will need to add some start-up code BEFORE the Processor Expert initialization runs.  See the screenshot below. 

UserCodeB4Init.png

Hope this helps,

Chris

0 Kudos
Reply
2,144 Views
donejtaelshani
Contributor II

what if I want to use LPTMR0 as an wake up timer for the sleep mode, how can i set the time( as i read it says on compare register ) and where should i set it, like if i want the timer interrupt to happen every 3s and i am using an external 32kHz oscillator. should i add a component for doing that or just write the code and select enable at LLWU settings ?

0 Kudos
Reply
2,144 Views
joginderrana
Contributor II

Hi I am using MK20DX128VLH5 microcontroller. I am not able to enable sleep mode in this controller. Please help to get rid of this problem. I will be grateful if you provide me with snap shot of cpu settings and syntax parameters for Cpu_SetOperationMode();

0 Kudos
Reply
2,144 Views
BlackNight
NXP Employee
NXP Employee
2,144 Views
joginderrana
Contributor II

HI Erich,

I have been through the example code and have my controller enabled on sleep mode now.

Thanks.

0 Kudos
Reply
2,144 Views
joginderrana
Contributor II

Hi Erich,

Now I have my board enabled on stop mode and can be triggered to exit stop mode using external interrupt through LLWU pins. I want to trigger it through UART. I am facing problem here. Please help me  to enable llwu interrupt to wake up the controller by sending active edge through UART.

0 Kudos
Reply