S32K148 Run to VLPS Problem

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

S32K148 Run to VLPS Problem

1,047 Views
shijie_zheng
Contributor III
  •  

    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?

  •  can you help me to analyze this question?

     

    1:the clock configuration is as follows

    clock.jpg

     

  • I have run clock init in main() function:
  • /* Initialize and configure clocks */
    CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT,g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
    CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);

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)
    {

          ;

    }

}

 

0 Kudos
2 Replies

1,032 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

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

0 Kudos

1,022 Views
shijie_zheng
Contributor III

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.

0 Kudos