Trying to put a KL02 microcontroler in VLPS mode

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

Trying to put a KL02 microcontroler in VLPS mode

Jump to solution
813 Views
omerarregi
Contributor I

I'm trying to put a KL02 microcontroler in VLPS mode (according to the datasheet the current consumption in this mode should be betwen 2 to 5 uA) but it seems that it doesn't enter in this mode properly. The current consumption is around 2mA after WFI instruction (3.6mA in normal operation)

I've an periodic interruption (1sec) using LPTIMER for RUN mode enter 1sec. after WFI instruction.

I'm trying to send the uC to VLPS mode out of this interruption with this code:

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// set the uC in Very-Low-Power Stop mode (VLPS)

SMC->PMPROT |= (uint8_t)SMC_PMPROT_AVLP_MASK;    // allow entry in low power modes

SMC->PMCTRL |= 0x02;                                                      // set VLPS mode for WFI state

MCM->CPO |= MCM_CPO_CPOWOI_MASK;                       // clear CPOREQ on any interrupt or exception vector fetch

MCM->CPO |= MCM_CPO_CPOREQ_MASK;                       // request Compute Operation

while (!(MCM->CPO & MCM_CPO_CPOACK_MASK));           // wait until Compute operation entry has completed

__WFI();

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Any idea about what I'm doing wrong?

Thanks in advance

Labels (1)
0 Kudos
1 Solution
545 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Omer,

FSL's shared a sample code package of the FRDM-KL02 which includes a low power mode demo.

The demo's illustrated the ways to enter different low power modes, of course the VLPS mode in, you can refer to this demo for details.

Please download the sample code package through the link as below.

cache.freescale.com/files/32bit/software/KL02-SC.zip
Have a great day,
Ping

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

View solution in original post

0 Kudos
2 Replies
545 Views
omerarregi
Contributor I

Thanks, Problem solved

0 Kudos
546 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Omer,

FSL's shared a sample code package of the FRDM-KL02 which includes a low power mode demo.

The demo's illustrated the ways to enter different low power modes, of course the VLPS mode in, you can refer to this demo for details.

Please download the sample code package through the link as below.

cache.freescale.com/files/32bit/software/KL02-SC.zip
Have a great day,
Ping

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

0 Kudos