Hi,
I am using MCUExpressoIDE SDK sample code(pflash) for flash writing. The code is given for BOARD_BootClockRUN() but I want to use it for BOARD_BootClockVLPR() mode please help.
Regards,
shrek
Hi Shre,
Thank you for your interest in NXP kinetis product, I would like to provide service for you.
The KL15 can't support the flash program in the VLPR mode, please check the KL15 reference manual:
Sorry for the inconvenience we bring you.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Kerry,
Thanks for your reply.
Is there any way to switch the mode at runtime for flash writing, as shown in the example below?
for example:
void main
{
BOARD_BootClockVLPR() ; //Initialize VLPR mode
BOARD_BootClockRUN() ; //switch to RUN Mode
Flash_Program(); //program flash
BOARD_BootClockVLPR() ; //switch to VLPR mode
}
Regards,
Shrej
Hi Shrejjhh,
Yes, if you want to do the flash program, you can change the power mode to RUN, then do the flash program, after that, you can go back the VLPR again.
Actually, just the power mode switch.
About the power mode switch, you can refer to our SDK code, power_mode_switch, you can find it in folder :
FRDM-KE15Z\boards\frdmke15z\demo_apps\power_mode_switch
SDK can be downloaded from this link:
Welcome | MCUXpresso SDK Builder
void APP_PowerModeSwitch(smc_power_state_t curPowerState, app_power_mode_t targetPowerMode)
{
switch (targetPowerMode)
{
case kAPP_PowerModeVlpr:
APP_SetClockVlpr();
SMC_SetPowerModeVlpr(SMC);
while (kSMC_PowerStateVlpr != SMC_GetPowerModeState(SMC))
{
}
break;
case kAPP_PowerModeRun:
/* Power mode change. */
SMC_SetPowerModeRun(SMC);
while (kSMC_PowerStateRun != SMC_GetPowerModeState(SMC))
{
}
/* If enter RUN from VLPR, change clock after the power mode change. */
if (kSMC_PowerStateVlpr == curPowerState)
{
APP_SetClockRunFromVlpr();
}
break;
case kAPP_PowerModeWait:
SMC_PreEnterWaitModes();
SMC_SetPowerModeWait(SMC);
SMC_PostExitWaitModes();
break;
case kAPP_PowerModeStop:
SMC_PreEnterStopModes();
SMC_SetPowerModeStop(SMC, kSMC_PartialStop); /* Normal STOP mode. */
SMC_PostExitStopModes();
break;
case kAPP_PowerModeVlpw:
SMC_PreEnterWaitModes();
SMC_SetPowerModeVlpw(SMC);
SMC_PostExitWaitModes();
break;
case kAPP_PowerModeVlps:
SMC_PreEnterStopModes();
SMC_SetPowerModeVlps(SMC);
SMC_PostExitStopModes();
break;
default:
PRINTF("Wrong value");
break;
}
}
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Kerry,
Thanks for your reply.
Is it require to set clock every time switching the power mode? Because AN4503(8.1.1 Entering and exit conditions for each low power mode,page 36) does not mentioned this.
As per AN4503, we need to modify PMPROT[AVLP]=1, PMCTRL[RUNM]=10 to switch from RUN mode to VLPR mode which is handled by SMC_SetPowerModeVlpr(SMC);
And modify PMCTRL[LPWUI] =1 which is handled by SMC_SetPowerModeRun(SMC);
But the SDK example code uses APP_SetClockVlpr(); and APP_SetClockVlpr(); Is it really required?
Regards,
Shrej
Hi Shre jjjhh,
Please check the KL15 reference manual, chapter 7: power management, you can find the VLPR have the clock limit, that's why we tell you do the clock switch:
So, please refer to the KL15 sdk code, that is really what you need.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------