Problems with Sleep Mode on KL05Z

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Problems with Sleep Mode on KL05Z

跳至解决方案
2,844 次查看
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 解答
2,041 次查看
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 项奖励
回复
6 回复数
2,042 次查看
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 项奖励
回复
2,041 次查看
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 项奖励
回复
2,041 次查看
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 项奖励
回复
2,041 次查看
BlackNight
NXP Employee
NXP Employee
2,041 次查看
joginderrana
Contributor II

HI Erich,

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

Thanks.

0 项奖励
回复
2,041 次查看
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 项奖励
回复