Hi Li ADai
About the VLPR computer mode detail operation, I suggest you refer to the KL25 bare-metal code, which can be downloaded from this link:
https://www.nxp.com/downloads/en/lab-test-software/KL25_SC.exe
KL25 Sample Code\kl25_sc_rev10\klxx-sc-baremetal\build\keil\low_power_demo
case 0xf://Coremark in VLPR
if ((SMC_PMSTAT & SMC_PMSTAT_PMSTAT_MASK)== 1){
printf(" in RUN Mode moving to VLPR\n\r ");
printf("Press any key to enter VLPR\n\r ");
uart0_getchar(UART0_BASE_PTR);
printf("Configure clock frequency to 4MHz core clock and 1MHz flash clock\n\r ");
vlp_clock_config(BLPE);
clockMonitor(OFF);
enter_vlpr();
}
if ((SMC_PMSTAT & SMC_PMSTAT_PMSTAT_MASK)== 4){
printf(" in VLPR Mode !\n\r ");
} else if ((SMC_PMSTAT & SMC_PMSTAT_PMSTAT_MASK)== 1){
printf(" in Run Mode !\n\r ");
clockMonitor(ON);
}
op_mode = what_mcg_mode();
if (op_mode ==1)
printf("in BLPI mode now at %d Hz\r\n\r",mcg_clk_hz );
if (op_mode ==2)
printf(" in FBI mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==3)
printf(" in FEI mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==4)
printf(" in FEE mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==5)
printf(" in FBE mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==6)
printf(" in BLPE mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==7)
printf(" in PBE mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==8)
printf(" in PEE mode now at %d Hz\r\n",mcg_clk_hz );
printf("\n\rTransitioning from VLPR mode \n\r");
for (i=0;i<2;i++)
{
printf("Starting running Coremark in VLPR with--- CPO mode enabled. \n\r ");
enable_systick();
MCM_CPO |= MCM_CPO_CPOREQ_MASK;
while(!(MCM_CPO & MCM_CPO_CPOACK_MASK));
wait();
main_app();
if(MCM_CPO & MCM_CPO_CPOACK_MASK){
MCM_CPO &= ~MCM_CPO_CPOREQ_MASK;
while (MCM_CPO & MCM_CPO_CPOACK_MASK);
} else{
printf("Exiting test early - Did you disable LPTRM interrupt? \n\r");
break;
}
printf(" Back in VLPR mode \r\n");
printf("Starting running Coremark in VLPR without CPO mode enabled. \n\r");
main_app();
printf("Coremark iterations = 0x%02X of 2 \n\r",i) ;
}
break;
case 0x14:
if ((SMC_PMSTAT & SMC_PMSTAT_PMSTAT_MASK)== 4){
printf(" in VLPR Mode ! ");
wait_count = 20000000;
} else if ((SMC_PMSTAT & SMC_PMSTAT_PMSTAT_MASK)== 1){
printf(" in Run Mode ! ");
wait_count = 200000000;
MCG_C5 |= MCG_C5_PLLSTEN0_MASK;
}
op_mode = what_mcg_mode();
if (op_mode ==1)
printf("in BLPI mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==2)
printf(" in FBI mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==3)
printf(" in FEI mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==4)
printf(" in FEE mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==5)
printf(" in FBE mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==6)
printf(" in BLPE mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==7)
printf(" in PBE mode now at %d Hz\r\n",mcg_clk_hz );
if (op_mode ==8)
printf(" in PEE mode now at %d Hz\r\n",mcg_clk_hz );
printf("Start Compute Mode --> waiting for %d counts ", wait_count);
enable_systick();
MCM_CPO |= MCM_CPO_CPOREQ_MASK;
while(!(MCM_CPO & MCM_CPO_CPOACK_MASK));
wait();
for (i=0;i<wait_count;i++){
if(!(MCM_CPO & MCM_CPO_CPOACK_MASK))
break;
}
if(MCM_CPO & MCM_CPO_CPOACK_MASK){
MCM_CPO &= ~MCM_CPO_CPOREQ_MASK;
while (MCM_CPO & MCM_CPO_CPOACK_MASK);
}
printf(" \n\rWaiting is Over - Now OUT of Compute Mode\n\r ");
break;
Wish it helps you!
If you still have questions about it, please kindly let me know.
Best Regards,
Kerry
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------