Dear TechSupporter:
I had a problem when I setting VLPS mode with S32K148(run freertos system,and use s32ds debug).
I have read AN5425.pdf, before trans to VLPS mode,set SCG,PMC,SMC register,then set an GPIO Interrput to wakeup from VLPS mode,
Without debug, I tried to trans to VLPS mode,then I use gpio interrupt to wakeup,but I found that interrupt execution, but the main() is not running again, I saved some screenshots when using PE in the debugging,
Was it something I missed?I'm not sure if actually trans to VLPS mode.
Is there a way to check if mcu have entered VLPS mode?
If mcu already in VLPS mode ,after wake up,main() function will be call again?
1:the clock configuration is as follows
2:before transfer to VLPS, I have set register as follows:
uint32_t tempSIRC = SCG->SIRCCSR;
uint32_t tempFIRC = SCG->FIRCCSR;
INT_SYS_DisableIRQGlobal();
/*set wakeup gpio ptc9 interrupt enable*/
GPIO_Port_Function_Set(PORTC,PIN_INDEX_9,PIN_FUNCTION_ALT1);
GPIO_Port_Dir_Set(PTC,PIN_INDEX_9,DIR_INPUT);
INT_WakeUp_Set(PORTC,PIN_INDEX_9,PORT_INT_FALLING_EDGE);
INT_SYS_InstallHandler(PORTC_IRQn, &PORTC_IRQHandler, NULL);
INT_SYS_EnableIRQ(PORTC_IRQn);
INT_SYS_EnableIRQGlobal();
/* Disable Clock monitor for System Oscillator */
SCG->SOSCCSR &= ~(SCG_SOSCCSR_SOSCCM_MASK);
SCG->SOSCCSR &= ~(SCG_SOSCCSR_SOSCEN_MASK);
/* Disable Clock monitor for System PLL */
SCG->SPLLCSR &= ~(SCG_SPLLCSR_SPLLCM_MASK);
SCG->SPLLCSR &= ~(SCG_SPLLCSR_SPLLEN_MASK);
/* Disable Clock monitor for System FRIC */
SCG->FIRCCSR |= SCG_FIRCCSR_FIRCREGOFF_MASK; /* Disable FIRC regulator */
SCG->FIRCCSR &= ~SCG_FIRCCSR_FIRCEN_MASK; /* Disable FIRC clock */
/* Disable SIRC in VLPS */
tempSIRC &= ~(SCG_SIRCCSR_SIRCLPEN_MASK |SCG_SIRCCSR_SIRCSTEN_MASK);
/* Enable SIRC in VLPS */
tempSIRC |= SCG_SIRCCSR_SIRCLPEN_MASK |SCG_SIRCCSR_SIRCSTEN_MASK;
SCG->SIRCCSR = tempSIRC;
/* Allow very low power modes*/
SMC->PMPROT |= SMC_PMPROT_AVLP_MASK;
/* Enable Stop Modes in the Core */
S32_SCB->SCR |= S32_SCB_SCR_SLEEPDEEP_MASK;
/* CLKBIASDIS=1: In VLPS mode, the bias currents and reference voltages*/
PMC->REGSC |= PMC_REGSC_BIASEN_MASK;
/* Select VLPS Mode */
SMC->PMCTRL = SMC_PMCTRL_STOPM(2);//0b10
if(1 == SMC->PMSTAT)
{
__asm("DSB");
__asm("ISB");
/* Call WFI to enter DeepSleep mode */
__asm("WFI");
}
3:GPIO Interrput function as follows
void PORTC_IRQHandler(void)
{
uint32_t IRQflag = 0;
IRQflag = INT_Read_IRQ_Flag(PORTC);
/*PTC9:Falling Edge:Trigger*/
if((IRQflag&(1 << 9)) != 0)
{
;
}
}
Hello,
>>Is there a way to check if mcu have entered VLPS mode?
You can verify VLPS entry by measuring current, please, refer to the DS rev 13. "Table 13. Power consumption"
>>If mcu already in VLPS mode ,after wake up,main() function will be call again?
No, the program continues.
1. Your clock configuration is correct.
2. When you are using SDK, I would like to suggest looking at an example from the S32DS (File -> New -> S32DS Project from Example) power_mode_switch_s32k148
You can easily set VLPS mode using "POWER_SYS_SetMode()" function located in the "power_manager.c" file.
So, this example can be used for your testing purpose to verify the behavior in VPLS mode.
I hope it helps,
Best regards,
Diana
Hi dianabatrlova:
thank you for your reply,it's my misunderstood,when mcu wake up, the program continue to run,
so I reconfigured Clock after POWER_SYS_SetMode(), now it can wake up normally.