How to make KEA128 enter sleep mode ?

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

How to make KEA128 enter sleep mode ?

Jump to solution
1,195 Views
buckzheng
Contributor II

i want to make kea128 enter stop mode , here are my configuration code bellow

PMC->SPMSC1 = 0x80;
PMC->SPMSC2 = 0x00;
PMC->SPMSC1 &= ~PMC_SPMSC1_LVWIE_MASK;
/* disable LVD in stop mode */
PMC->SPMSC1 &= ~(PMC_SPMSC1_LVDE_MASK | PMC_SPMSC1_LVDRE_MASK |
PMC_SPMSC1_LVDSE_MASK);
/* Set the SLEEPDEEP bit to enable deep sleep mode (STOP) */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
/* Not using KEIL's uVision, so use the standard assembly command */
__WFI;

while(1)

{

}

but  MCU don't go to sleep , it continue run codes in while loop, rather stop in the front of while ! what i should do to make kea128 enter sleep mode ?

0 Kudos
Reply
1 Solution
966 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Hunter,

     I copy your code to the FRDM-KEAZ128_Driver Testcode, and test the power consumption on my FRDM-KEA128 board, the power consumption is just 132uA, so it can enter stop mode successfully.

    Now, please take care two points.

1. Did you add any other interrupt in your code?

   Because interrupt will wake up the stop mode.

   Please disable the interrupt, then try again.

2. After you download the code with debugger, please power down your board, remove your debugger(except you use the onboard debugger like FRDM board), then power on and test the power consumption again, power off and power on the board after downloading the code is very important, don't just press the reset button.

Wish it helps you!

If you still have question, please let me know!

Have a great day,
Kerry

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

View solution in original post

2 Replies
967 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Hunter,

     I copy your code to the FRDM-KEAZ128_Driver Testcode, and test the power consumption on my FRDM-KEA128 board, the power consumption is just 132uA, so it can enter stop mode successfully.

    Now, please take care two points.

1. Did you add any other interrupt in your code?

   Because interrupt will wake up the stop mode.

   Please disable the interrupt, then try again.

2. After you download the code with debugger, please power down your board, remove your debugger(except you use the onboard debugger like FRDM board), then power on and test the power consumption again, power off and power on the board after downloading the code is very important, don't just press the reset button.

Wish it helps you!

If you still have question, please let me know!

Have a great day,
Kerry

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

966 Views
buckzheng
Contributor II

hello, Kerry! thanks for your reply! I made a mistake , I use keil to compile my project, but  this function "__WFI" is defined "__wfi", rather than the instruction "WFI"!  So MCU did'nt enter sleep mode! The true synax is "__WFI()"  in keil !