KL03Z: Current Draw in VLPR Mode?

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

KL03Z: Current Draw in VLPR Mode?

2,252 Views
sarastout-grand
Contributor III

Hello,

 

I have a very basic code for the KL03Z for which I'm trying to verify the current draw in VLPR mode as noted in the data sheet. I have the QFN package of the microcontroller, I have set the LIRC clock to 8MHz and divided it down so that the core is at 4MHz and the bus is at 1MHz. The datasheet shows that the current draw should be either 188uA or 209uA depending on the meaning of "compute operating mode".

 

193934_193934.pngpastedImage_1.png

 

When I run the attached code, I get 1.06mA. When I step through the code using the debugger, I see the correct current (~184uA). I'm using the latest KDS software and Jlink. When I disconnect the Jlink, I still see the 1.06mA. The PMSTAT register shows that I'm in VLPR mode.

 

So...my questions:

1. Why do I not read the correct current draw when I run as opposed to step?

2. What is the "Computer Operation Mode"?

3. How do I put the While(1) look in SRAM vs flash as noted in that same datasheet entry? Is what I have in the code SRAM?

 

Thanks,

 

Sara

Original Attachment has been moved to: main.c.zip

Labels (1)
0 Kudos
12 Replies

1,672 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Sara,

Considering that you may have already 'refer MCUXpresso SDK for FRDM-KL03Z SDK package, which provided [power_mode_switch] demo'. If the current is still high, please refer the method mentioned in 'MKL03Z: Current consumption too high in VLLSx states'.

 

Best Regards,

Robin

 

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

0 Kudos

1,672 Views
sarastout-grand
Contributor III

Hi Robin,

Neither of those links helped me, I have already seen both.

I will re-state my questions, being more specific about the first one:

1. Why does the While(1) loop cause my current to double?

2. What is the "Computer Operation Mode"?

3. How do I put the While(1) look in SRAM vs flash as noted in that same datasheet entry? Is what I have in the code SRAM?

My first question stems from the fact that I get the correct current draw when I "step" through my code with the debugger, right up until I hit the While(1) loop. When I "run" the code, the current nearly doubles as soon as it hits the While(1) loop. Can you run my code and see if you get the same thing? What is causing this? How do I get a true view of my actual current if I can't get into the While(1) loop? And, to compare to the datasheet, I believe I need to be in a while(1) loop. Please confirm this!

My second question stems from me trying to understand the specification on the datasheet. One of the VLPR current specifications is in "Compute Operation Mode" and this is not specified in the other. What does this mean?

The third question also comes from me trying to understand the specification on the datasheet. The VLPR currents are specified as sometimes being in SRAM and sometimes in flash. How do I know which one I have set-up in the code I sent you? I'm assuming SRAM, but I didn't specify either. One of them must be the default.

Thanks,


Sara

0 Kudos

1,672 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Sorry for my last reply!

2. What is the "Computer Operation Mode"?

Please read the chapter '7.2.2 Compute Operation' of KL03P24M48SF0RM.

7.2.2 Compute Operation.png

Best Regards,

Robin

0 Kudos

1,672 Views
sarastout-grand
Contributor III

Hi Robin,

Thanks for the answer to the 2nd question. I was able to find that section in the manual just yesterday.

Any ideas for the other two questions? I believe I have sort-of answered the 3rd question. My code is in flash because I think that is the default. I'm not sure what I would have to do to put it in SRAM.

Thanks,

Sara

0 Kudos

1,672 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

About the 3nd question, please refer 'Relocating Code and Data Using the KDS GCC Linker File for Kinetis'.

I got the higher current just like you:

1. I have test the power_manager and power_mode_switch demo in SDK_2.2_FRDM-KL03Z, after input 'D' the MCU enter VLPR mode. But I get the higher current about 1mA.

2. I have also try to configure the FTFA_FOPT[LPBOOT]=01 or 00(ensure the MCU direct boot to VLPR mode), still get 1mA current. (I have attach the test project. You can test it with IAR and FRDM-KL03Z board.)

LPBOOT.png

KL03 LPBOOT SDK2.2 IAR.png

3. The Power Estimation Tool for Kinetis MCUs also show me that the VLPR mode current is about 1.06mA.

Power Estimation Tool v1.0.1.png

I have report this to AE team and will inform you ASAP when I get the reply.

Best Regards,

Robin

0 Kudos

1,672 Views
sarastout-grand
Contributor III

Thanks Robin.

I'm glad you were able to see my problem. I await any feedback you receive from the AE team.

Sara

0 Kudos

1,671 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

feedback:

The VLPR mode data sheet notes indicate the code, the while(1), is being run out of SRAM. Most likely the flash has been turned off as well, but I can't be certain.  If you run the while(1) out of flash you will bearing the flash operation power which you have shown to be about 1 ma.  Check this out and let us know how you come along with your spec checking. 

 

You can use the low power modes VLPW, VLPS, LLS and VLLSx as well if you are not running your function in VLPR 100% of the time, transitioning out of low power mode with interrupts and from LLS and VLLSx with the LLWU module inputs. I wrote the app note AN4503 , it has a wealth of information available about Kinetis Low power modes. 

Best Regards,

Robin

0 Kudos

1,672 Views
gschelotto
Contributor V

Hi,

I am facing the same problem as Sara. My hardware consists only of a KL03Z running the VLPR Mode. Here's my initialization sequence:

  1. Disable peripheral clocks (no peripheral is initialized)
  2. Set MCG to LIRC8M mode
  3. Switch to VLPR mode (LIRC2M) using the API provided by latest SDK and the frdmkl03z_power_mode_switch example
  4. while(1){} loop

In this case the current consumption is 1mA but if I put an if(something) into the while, the current drops to 710uA!

Please, I need to know what is happening. Why does the current decrease by simply modifying the code?

Can anyone help?

gaston

0 Kudos

1,671 Views
mjbcswitzerland
Specialist V

Hi

A possible explanation of the difference in current consumption is that in the case of a simple forever loop the code is running in cache (or something similar) and so the processor is running at full speed (no wait states due to Flash access) but if you add some code that doesn't allow caching it slows the processor (adds wait states) and this slightly reduces current consumption.

Regards

Mark

0 Kudos

1,671 Views
gschelotto
Contributor V

Hi Mark,

Yes, you're right since the cache is placed in RAM. For example, I've verified that in VLPR mode the current consumption drops to 120uA! with the while(1) loop relocated to RAM.

If the while(1) FLASH-located has statements with access to RAM (conditionals, assignments,...) we will have some access to RAM and others to FLASH and the result is an average of both consumptions.

I think it is clear and in my opinion we could leave the case solved.

Thanks,
gaston

0 Kudos

1,671 Views
sarastout-grand
Contributor III

Hi Robin,

Yes, I agree. When I run with the clocks as noted in the datasheet with the code in flash, I get their numbers for current that are posted. However, I'm still puzzled by why the current drops by about half when I place an "if" statement inside the while(1) loop. Is that normal? It seems that it very much matters what type of statement goes inside the while(1) loop. So, I measure about 1.06mA, with my clocks (4MHz core, 1MHz Bus) and code in flash, with nothing inside the while(1) loop. Then, if I put the following statement inside the while(1) loop, the current drops from 1.06mA to about 475uA :

if (SMC_BRD_PMSTAT_PMSTAT(SMC)==0b0100)

So, what is my real current draw in VLPR mode? Is it 1.06mA or 475uA or any other number that I get when I put something else inside the while(1) loop? I need to know the lowest that I can go in VLPR mode. I completely understand about the other modes and will be using them as well. However, in my application, I need to know the lowest current consumption while I'm running. The difference between 1.06mA and 475uA is significant in terms of battery life in my application. Obviously something is going on inside the while(1) loop that draws a lot of current and adding the "if" statement changes that behavior.

I want to understand what is happening so that I can optimize it. Can you look into this?

Thanks,

Sara

0 Kudos

1,671 Views
sarastout-grand
Contributor III

Hello!

Is this still being looked into? I would really like some insight into why this is happening!

Thanks,

Sara

0 Kudos