KL03 doesn't go to very low power mode

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

KL03 doesn't go to very low power mode

1,596 Views
ivansantanna
Contributor III

Hello All, I'm finding the same problems that Will X had to put KL03 to VLPS. I can see the power consuption starts around 6mA (RUN Mode), going to around 1mA (VLPR), and going to 210uA when I try to put it on VLPS. I'm thinking that this current is expected on Normal STOP and not on VLPS, that should be around 2uA.
I already read some ANs and many sites for this subject. I found some interesting tips about debugger must be off. Of course that I'm disconnecting it to measure the current, but is it enough? Should I turn it of on any register? I also forced the Flash Config bytes (FSEC) to secure mode, but the power consuption is still the same (210uA). I saw at RM that there is a register called MDM-AP (bit 7) that indicates if Low Power is enabled or not. What can change this MDM-AP bit? Is it configurable?
Is there any other "switch" that I should put on OFF position to reach the 2uA of Power consuption?

I'm using my target board, but only with the MCU and the SWD connector assembled, so only the MCU (KL03) is draining this current.

I'm doing the following sequence:

 

SMC_PMPROT = 0x22;      // enabling AVLP and AVLLS

SMC_PMCTRL = (SMC_PMCTRL_RUNM(2) + SMC_PMCTRL_STOPM(2));      // RUN mode VLPR and STOP VLPS

dummyread = SMC_PMCTRL;

while (!(SMC_PMSTAT & 0x04));      // waiting for VLPR

/* HERE I CAN SEE THE CURRENT GOING DOWN AROUND 1mA */

 

PortInit()      // Config the GPIOs

LPTMR_Init()      // Config LPTimer to generate an Interruption each 1 sec.

 

while(1) {   

   GoVLPS();

   GPIOA_PTOR = 0x20;   // toogle the PA5 to check if its comming out from VLPS every sec.

}

 

 

void GoVLPS(void){

   SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK;

   __asm("DSB");

   __ams("WFI");

}

  

Thanks and regards

Ivan

Labels (1)
0 Kudos
9 Replies

1,099 Views
mjbcswitzerland
Specialist V

Hi Ivan


To go to VLPS mode you (possibly) shouldn't use the VLPR settings.

See:
http://www.utasker.com/kinetis/FRDM-KL03Z.html
http://www.utasker.com/kinetis/LLWU.html

You can get KL03 OpenSource code from http://www.utasker.com/forum/index.php?topic=1721.msg7086#msg7086 which includes complete low power management.

I just checked on a FRDM-KL03Z
RUN mode = 6mA
WAIT mode = 2.3mA
STOP mode = 136uA
VLPS mode = 2.5uA
VLLS1 mode = 0.7uA

I didn't check VLPR and VLPW since I was using a 48MHz clock, which doesn't allow these without further changes (and so give the same results as RUN and WAIT).

Regards

Mark


Professional support for Kinetis: http://www.utasker.com/index.html
Remote desktop one-on-one coaching: http://www.utasker.com/services.html
Getting started to expert videos: https://www.youtube.com/results?search_query=utasker+shorts

0 Kudos

1,099 Views
ivansantanna
Contributor III

Hello Mark, first of all, thanks for your quick response!

As described on KL03RM it's possible to switch between VLPR and VLPS modes.

That's what I'm doing... During running time, at VLPR and on stop on VLPS.

See the arrow 6 at diagram below.

BTW, I'd tried to switch between RUN to VLPS. The power consumption

increases... I think that HIRC is running on this case...

At the link that you sent me, I found the low_power.c file, but not the

functions that it calls, like PREPARE_SLEEP_STATE, MEASURE_LOW_POWER_ON...

so it's doesn't help me too much.

#include "config.h"

#if defined SUPPORT_LOW_POWER

#define OWN_TASK TASK_LOW_POWER

*extern void fnLowPower(TTASKTABLE *ptrTaskTable)

// low power task called on every scheduling pass*

{

  • if (uNoSchedule(OWN_TASK) == 0) {

// is the scheduler idle?*

  • #if defined PREPARE_SLEEP_STATE*

  • PREPARE_SLEEP_STATE();

// {2} optional preparation for the sleep mode to reduce peripheral

consumption or enable only certain wakeup sources*

  • #endif*

  • #if defined MEASURE_LOW_POWER_ON*

  • MEASURE_LOW_POWER_ON();

//

  • #endif*
  • fnDoLowPower();
  • #if defined MEASURE_LOW_POWER_OFF*
  • MEASURE_LOW_POWER_OFF();
interrupts are disabled at this point when the low power mode is to be entered* // switch to low power mode until woken* // interrupt have been re-enabled when the low power mode is exited*

  • #endif*

  • #if defined RECOVER_SLEEP_STATE*

  • RECOVER_SLEEP_STATE();

// optional changes on sleep mode exit to allow full power operation

again*

  • #endif*

  • }*

}

#endif

I'm gess that the MCU is going to STOP mode instead of Very Low Power Stop.

I don't know why? Maybe I must to disable any register on ARM core turn of

a oscilator, or a debugger block inside the core.

I would like to ask you for the sequence that you checked at the code that

you tested.

I'm looking forward your feedback.

Thanks in advance...

Ivan

2017-03-20 11:50 GMT-03:00 mjbcswitzerland <admin@community.nxp.com>:

NXP Community

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: KL03 doesn't go to very low power mode

reply from Mark Butcher

<https://community.nxp.com/people/mjbcswitzerland?et=watches.email.thread>

in Kinetis Microcontrollers - View the full discussion

<https://community.nxp.com/message/888653?commentID=888653&et=watches.email.thread#comment-888653>

0 Kudos

1,099 Views
mjbcswitzerland
Specialist V

Ivan

The file low_power.c is a generic control (not Cortex/Kinetis specific) and the functions PREPARE_SLEEP_STATE(); MEASURE_LOW_POWER_ON(); and RECOVER_SLEEP_STATE(); are optional user code calls that have nothing to do with the actual sequence. They can be used to do things like switching on/off additional clocks or ports that are application specific and not Kinetis low leakage specific.

The sequence that you are interested in is in the file "kinetis_low_power.h", which controls the Cortex / Kinetis case.
fnSetLowPowerMode() is used to prepare for the low power state but doesn't enter it yet. fnGetLowPowerMode() returns the low power state that is prepared.

fnDoLowPower(), called from fnLowPower(), is used to actually do the switch (if it can because it allows automatic/dynamic switching in and out depending on what the complete system is doing. For example if one wants to go to a very low power state it may only switch to the WAIT state so that UART transmissions that are in progress first complete - then it will go to the final low power state.

The uTasker project thus uses intelligent and dynamic low power mode switching rather than the straight-line sequences that are usually seen.
You can get an idea from some videos:
https://www.youtube.com/watch?v=kWNlsAoMly4&index=1&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q
https://www.youtube.com/watch?v=iZEMRiDmHzw&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&index=5
https://www.youtube.com/watch?v=v4UnfcDiaE4&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&index=7

For example, if one wants to use the VLPS mode one calls

fnSetLowPowerMode(VLPS_MODE);

which is a non-blocking call which informs the state the we would like to go to. As soon as the system is sure that there are no pending events that should be first handled it will enter the mode (safely) although it may in the meantime temporarily use another low power mode that still allows unfinished work to be done until it can do the final switch. There is no need to understand the full details since it encapsulates everything and makes it processor independent. Looking at the forum (bursting with low power switching difficulties) I expect that the community could save many man years between them by using this to the general examples that only seem to work when one holds one's breath and the wind is blowing in the correct direction....;-)


Regards

Mark


Professional support for Kinetis: http://www.utasker.com/index.html
Remote desktop one-on-one coaching: http://www.utasker.com/services.html
Getting started to expert videos: https://www.youtube.com/results?search_query=utasker+shorts

0 Kudos

1,099 Views
ivansantanna
Contributor III

Ok Mark, thanks again.

I will check the code and try to understand why my code doesn't go to VLPS.

As soon as I have a new position I'll notify you.

By the way, I'm no using the FRDM-KL03Z board. I'm using my own board, but

only with the MCU and SDW connector assembled. My question is: as I don't

have any cristal oscilator on my board, and I'm using the LPTMR, clocked by

LPO, to come out from VLPS to VLPR every second, do you think that this

internal oscilator could be the block that is draining more than 200uA?

Thanks and regards...

Ivan

2017-03-20 18:45 GMT-03:00 mjbcswitzerland <admin@community.nxp.com>:

NXP Community

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: KL03 doesn't go to very low power mode

reply from Mark Butcher

<https://community.nxp.com/people/mjbcswitzerland?et=watches.email.thread>

in Kinetis Microcontrollers - View the full discussion

<https://community.nxp.com/message/888742?commentID=888742&et=watches.email.thread#comment-888742>

0 Kudos

1,099 Views
mjbcswitzerland
Specialist V

Ivan

The LPTMR and LPO consume typically 30nA so this will a problem.

Regards

Mark

0 Kudos

1,099 Views
ivansantanna
Contributor III

Mark,

30nA! So, definitely, it's not the problem...

I expect to have a total hardware consuption under 60uA, including

regulator, and others discretes components.

I going to home to check the code from uTask and try to find my problem.

Yesterday I reached 185uA, but desabling all the Ports, leaving only one

pin toggling...

Should I change anything on DAP register as MDM-AP bit to disable the

debugger? Or just unplugging it will be disabled? How to access this

register?

Thanks and regards...

Ivan

2017-03-21 17:29 GMT-03:00 mjbcswitzerland <admin@community.nxp.com>:

NXP Community

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: KL03 doesn't go to very low power mode

reply from Mark Butcher

<https://community.nxp.com/people/mjbcswitzerland?et=watches.email.thread>

in Kinetis Microcontrollers - View the full discussion

<https://community.nxp.com/message/889197?commentID=889197&et=watches.email.thread#comment-889197>

0 Kudos

1,099 Views
mjbcswitzerland
Specialist V

Iva

I do all low power testing without a debugger connected, although in the Freedom boards with OpenSDA there is always one in the circuit.

Regards

Mark

0 Kudos

1,099 Views
ivansantanna
Contributor III

Hello.

Just to inform you a new data collected right now.

I'm still seeing the power consuption around 185uA. I commented the

sleepdeep line and now it's draining 35uA. So, I think that now it's on

VLPW mode, wich the power consuption is around 30uA. Now my question is,

why when the SLEEPDEEP is enabled the MCU doesn't go to VLPS? It's seems to

go to normal STOP mode.

Any tip?

Ivan

2017-03-21 20:11 GMT-03:00 mjbcswitzerland <admin@community.nxp.com>:

NXP Community

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: KL03 doesn't go to very low power mode

reply from Mark Butcher

<https://community.nxp.com/people/mjbcswitzerland?et=watches.email.thread>

in Kinetis Microcontrollers - View the full discussion

<https://community.nxp.com/message/889203?commentID=889203&et=watches.email.thread#comment-889203>

0 Kudos

1,099 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Ivan Santanna,

    Just as my reply in your another post:

https://community.nxp.com/message/890323?commentID=890323#comment-890323 

1. Give me your test project.

2. Share your smallest system schematic, tell me your power consumption test point.

Then I will help you do the details checking.


Have a great day,
Kerry

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

0 Kudos