When i enter vlls3 mode , i measure power comsumption 2xx uA (i use external osc 32768hz),
Where am i setting wrong?
IC: MK02FN64VFM10
Environment: IAR 7,3
My code:
/* Including needed modules to compile this module/procedure */
#include "Cpu.h"
#include "Events.h"
#include "pin_init.h"
#include "osa1.h"
#if CPU_INIT_CONFIG
#include "Init_Config.h"
#endif
/* User includes (#include below this line is not maintained by Processor Expert) */
#define SYS_CLOCK 23986176
void SYS_Init(void)
{
OSC_CR = 0xA0;
MCG_C1 = 0x0;
MCG_C2 = 0x06; //
MCG_C4 = 0X80; //32768*732 = 23986176 SYSTEM CLOCK
MCG_C6 = 0;
MCG_C7 = 1; //
MCG_C8 = 0;
SIM_SOPT1 &= ~(3<<18);
SIM_SCGC4 = 0;
SIM_SCGC5 = 0;
SIM_SCGC7 = 0;
WDOG_STCTRLH = 0;
}
void ENTER_VLLS3(void)
{
volatile unsigned int dummyread;
SMC_PMPROT = SMC_PMPROT_AVLLS_MASK;
/* Set the STOPM field to 0b100 for VLLS3 mode */
SMC_PMCTRL &= ~SMC_PMCTRL_STOPM_MASK;
SMC_PMCTRL |= SMC_PMCTRL_STOPM(0x4);
SCB->SCR &= (unsigned int)~(unsigned int)(SCB_SCR_SLEEPONEXIT_Msk);
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
SMC_STOPCTRL = 0x03;
/*wait for write to complete to SMC before stopping core */
dummyread = SMC_PMCTRL;
/* Now execute the stop instruction to go into LLS */
//stop();
asm("WFI");
}
/*lint -save -e970 Disable MISRA rule (6.3) checking. */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
unsigned int i;
PE_low_level_init();
for(i = 0 ; i < 1000000; i++);
SYS_Init();
while(1)
{
ENTER_VLLS3();
}
#ifdef PEX_RTOS_START
PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
#endif
for(;;){}
}
Electric circuit:
Solved! Go to Solution.
Hi herol,
Sorry for my later reply, I already find the root problem.
Please do the modification like the following picture:
Just modify the
#define SYSTEM_SMC_PMPROT_VALUE | 0x00U |
to
#define SYSTEM_SMC_PMPROT_VALUE | 0xAAU |
You can find this defination in system_MK02F128.h, the path is: project path->SDK->device->mk02f12810->startup folder.
Then add the ENTER_VLLS3 code, after you download the code to your chip, unconnect your debugger, repower on your board, you will find the power consumption is about 2uA.
Wish it helps you!
If you still have question, please let me know!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Has anyone actually measured the power consumption of k02 and provide examples it?
Sorry, but I'm a newbie. What do you programmer use for MKL02?. I don't know which to buy. Thank you.
Hi,
You can use KDS compiling and debugging of your designs.
KDS website : Kinetis Design Studio Integrated Development |Freescale
If you want to buy development platform for kl02 can refer to the following website :
Freescale Freedom Development Platform for th|Freescale
Wish it helps you!
herol
Thank Hero !!!
Hi,
Before you enter in the VLLSx, you can change your clock mode to BLPI, and disable the OSC module, because OSC module also have large power consumption:
Besides this, where the current point you are measuring your power consumption, did this point just contain the MCU power consumption, no other external circuit power consumption?
Wish it helps you!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jinjing,
1. I have tried to change to BLPE then into VLLS MODE, but get the same current consumption .
OSC Module in low-power mode power consumption is 500nA, but I measured the amount is too much difference .
2. Yes, no other external circuitry. I would like to test the power consumption , so do not add any circuit
Thank you.
.
Hi herol,
When you test your power consumption, did you still connect the debugger or programmer?
After you download the code to your chip, power off and remove your debugger, then power on again and test the power consumtion.
If still not ok, try to change the clock mode to BLPI, use the internal clock, and disable the OSC module, then enter in VLLS3 and test the power consumption, to check whether this is the same as the power consumption which datasheet defined.
Wish it helps you!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jingjing,
If connect the debugger or no power off , the power consumption will be mA.
I try to change the colock mode to BLPI, and disable the OSC module ,then enter in VLLS3, power consumption is the same 2xx~3xx uA.
(I've used different PCB and different ic, but the results are the same)
I tried using KDS 3.0, "statement with no effect" message in wfi instruction.
Thanks.
Hi herol,
Please use my K02 project, and test the power consumption on your board, because I don't have the K02 board.
I create the K02 barebone KDS project, and enter VLLS3, I test on my K22 board, it can enter in the VLLS3, and the power consumption is same as the datasheet, just about 4 uA.
I can make sure my code can enter VLLS3 successfully, you can try it, and tell me your power consumption, if it is still very higher , it maybe caused by the hardware.
When you test the power consumption, please take off your debugger from your board, and repower on the board.
Waiting for your test result.
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Jingjing,
Do you have any ideas?
herol
Hi herol,
Did you try it on your side?
Regards,
Jingjing
Hi herol,
Sorry for my later reply, I already find the root problem.
Please do the modification like the following picture:
Just modify the
#define SYSTEM_SMC_PMPROT_VALUE | 0x00U |
to
#define SYSTEM_SMC_PMPROT_VALUE | 0xAAU |
You can find this defination in system_MK02F128.h, the path is: project path->SDK->device->mk02f12810->startup folder.
Then add the ENTER_VLLS3 code, after you download the code to your chip, unconnect your debugger, repower on your board, you will find the power consumption is about 2uA.
Wish it helps you!
If you still have question, please let me know!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Dear Jingjing,
It's good, the power consumption is about 2uA.
This indicates that "SMC_PMPROT = SMC_PMPROT_AVLLS_MASK" is invalid . Is that so?
Thanks.
herol
Hi herol,
From the reference manual:
You can find that SMC_PMPROT regisster is the write once register after any system reset, because after reset, SMC_PMPROT is defined as 0 in PE code, then although you define it again in your main function, but it is invalid, you can't enter VLLSx mode because AVLLS is not enabled, at this time, the MCU enter stop mode, that's why you get about 200uA.
If SMC_PMPROT is defined as 0XAA after mcu reset, then all the low power mode is enabled, the according low power will enter successfully.
Wish it helps you!
Regards,
Jingjing
Hi Jingjing,
Thanks.
herol
Hi Jingjing,
I use your KDS project 、 remove debug tool and repower to get power consumption 3.7uA.
If I creat new Processor Expert project (using the same code)、 remove debug tool and repower to get power consumption is 2XXuA.
I have a question , how to creat a no Processor Expert projcet for IAR or how to reduce power consumption in a
Processor Expert projcet ?
Thanks.
herol
Hi herol,
Could you tell me the PE project which still have 2xxuA with what IDE? KDS PE project or just use Processor expert for IAR project with out KDS?
Regards,
Jingjing
Hi Jingjing,
I use PEMICRO MULTILINK UNIVERSAL.
I creat a project and select Processor Expert the power consumption is 2xxuA.(KDS 3.0)
I creat a project and no choose Processor Expert the power consumption is 3.7uA.(KDS 3.0)
But now I do not know which option to set the resulting PE project enters debug mode will have an error message.
Thanks.
herol
After you build the PE project, any error in the problems window?
You should make sure no error before downloading.
Besides, if still not ok, you can try to create a new PE project, and download the code again.
When I change the cpu type pinmuxs have a error, then to click switch configuration can be solved , in addition there is no other error message.