In Custom S32K118 Board, Entering to VLPS and Exit to RUN Mode

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

In Custom S32K118 Board, Entering to VLPS and Exit to RUN Mode

493 Views
Chaitanya_Sai
Contributor I

Hi Team,

I am using a custom S32K118 board where i want to enter the VLPS Mode, i am disabling all the peripherals that can stop entering the VLPS Mode and then able to enter to VLPS mode. But after that for waking up i have configured the Pin interrupt as the Wakeup Source, Now i have written two functions one for going to sleep and one for wakeup, Please find the two functions below.

The problem i am facing is, it is stucking somewhere in the wakeup sequence and then MCU is not responding, then i have to do complete power down and power up again..

 

void Enter_VLPS_Mode (void)
{
 
INT_SYS_DisableIRQ(ADC0_IRQn);
 
INT_SYS_DisableIRQ(CAN0_ORed_0_31_MB_IRQn);
 
INT_SYS_DisableIRQ(CAN0_ORed_Err_Wakeup_IRQn);
 
INT_SYS_DisableIRQ(LPIT0_IRQn);
 
INT_SYS_DisableIRQ(LPUART1_RxTx_IRQn);
 
INT_SYS_DisableIRQ(LPUART0_RxTx_IRQn);
 
INT_SYS_DisableIRQ(FTFC_IRQn);
 
 
 
 
CAN_DeInit();
Pit_DeInit();
UART_DeInit();
 
INT_SYS_ClearPending(ADC0_IRQn);
INT_SYS_ClearPending(CAN0_ORed_0_31_MB_IRQn);
INT_SYS_ClearPending(CAN0_ORed_Err_Wakeup_IRQn);
INT_SYS_ClearPending(LPIT0_IRQn);
INT_SYS_ClearPending(LPUART1_RxTx_IRQn);
INT_SYS_ClearPending(LPUART0_RxTx_IRQn);
INT_SYS_ClearPending(FTFC_IRQn);
 
 
 
RTC_SetAlarmAfterPeriod (Configured_Heartbeat_Frequency,0,0);
 
INT_SYS_ClearPending(PORT_IRQn);
 
POWER_SYS_SetMode(VLPR, POWER_MANAGER_POLICY_AGREEMENT);
 
POWER_SYS_SetMode(VLPS, POWER_MANAGER_POLICY_AGREEMENT);
 
}
 
void Restore_From_VLPS_To_RUN(void)
{
// Go back to RUN Mode
POWER_SYS_SetMode(RUN, POWER_MANAGER_POLICY_AGREEMENT);
 
// Restore the RUN cocke.
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
 
// Re initialize the modules we have de-inititalized.
 
CAN_Init();
Pit_Init();          /* or LPIT_Init, be consistent with what you use */
LPI2C_INIT();
LPUART_Initialization();
ADC_Initialization();
CSEC_Init();
RTC_Init();          /* if you need it active right after wake */
Accelerometer_Init(&ACC_Info);
 
// Re enable the IRQ's we disabled.
 
 
INT_SYS_EnableIRQ(ADC0_IRQn);
INT_SYS_EnableIRQ(CAN0_ORed_0_31_MB_IRQn);
INT_SYS_EnableIRQ(CAN0_ORed_Err_Wakeup_IRQn);
INT_SYS_EnableIRQ(LPIT0_IRQn);
INT_SYS_EnableIRQ(LPUART1_RxTx_IRQn);
INT_SYS_EnableIRQ(LPUART0_RxTx_IRQn);
INT_SYS_EnableIRQ(FTFC_IRQn);
 
INT_SYS_EnableIRQGlobal();
 
}
0 Kudos
Reply
3 Replies

471 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Chaitanya_Sai,

The MCU cannot be “stuck.” It is either in VLPS or actively executing code in VLPR.


Please measure the VDD power consumption and/or the BUS_CLK on CLKOUT to confirm whether the MCU is still in VLPS or is currently operating in VLPR or RUN mode.


Once the MCU is in VLPR or RUN, you can attach the debugger and inspect which part of the code is being executed.

Ensure that Sleep-On-Exit is disabled in the Power driver.

Also, note that it is not necessary to enter VLPR before entering VLPS—the MCU can transition directly from RUN to VLPS.

 

Regards,

Daniel

 

 

0 Kudos
Reply

363 Views
Chaitanya_Sai
Contributor I

Hi @danielmartynek ,

Actually I have tested whether it is going to sleep or not by putting a Soft reset function at the end of the ENTER_Vlps_Mode () function, it's always restarting.. and current consumption is also high.. So, basically it's not going to sleep.. 

Can u please check this and is there anything iam missing ?

 

0 Kudos
Reply

358 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @Chaitanya_Sai,

Could you please share the project, or a minimal test project that reproduces the issue, so I can run it on my side?
If you prefer not to share it here, feel free to open a support ticket and provide the project there privately.

BR, Daniel

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2336338%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EIn%20Custom%20S32K118%20Board%2C%20Entering%20to%20VLPS%20and%20Exit%20to%20RUN%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2336338%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Team%2C%3C%2FP%3E%3CP%3EI%20am%20using%20a%20custom%20S32K118%20board%20where%20i%20want%20to%20enter%20the%20VLPS%20Mode%2C%20i%20am%20disabling%20all%20the%20peripherals%20that%20can%20stop%20entering%20the%20VLPS%20Mode%20and%20then%20able%20to%20enter%20to%20VLPS%20mode.%20But%20after%20that%20for%20waking%20up%20i%20have%20configured%20the%20Pin%20interrupt%20as%20the%20Wakeup%20Source%2C%20Now%20i%20have%20written%20two%20functions%20one%20for%20going%20to%20sleep%20and%20one%20for%20wakeup%2C%20Please%20find%20the%20two%20functions%20below.%3C%2FP%3E%3CP%3EThe%20problem%20i%20am%20facing%20is%2C%20it%20is%20stucking%20somewhere%20in%20the%20wakeup%20sequence%20and%20then%20MCU%20is%20not%20responding%2C%20then%20i%20have%20to%20do%20complete%20power%20down%20and%20power%20up%20again..%3C%2FP%3E%3CBR%20%2F%3E%3CDIV%3Evoid%20Enter_VLPS_Mode%20(void)%3C%2FDIV%3E%3CDIV%3E%7B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_DisableIRQ(ADC0_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_DisableIRQ(CAN0_ORed_0_31_MB_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%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_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_ClearPending(LPIT0_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_ClearPending(LPUART1_RxTx_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_ClearPending(LPUART0_RxTx_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_ClearPending(FTFC_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ERTC_SetAlarmAfterPeriod%20(Configured_Heartbeat_Frequency%2C0%2C0)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_ClearPending(PORT_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPOWER_SYS_SetMode(VLPR%2C%20POWER_MANAGER_POLICY_AGREEMENT)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPOWER_SYS_SetMode(VLPS%2C%20POWER_MANAGER_POLICY_AGREEMENT)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7D%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CDIV%3Evoid%20Restore_From_VLPS_To_RUN(void)%3C%2FDIV%3E%3CDIV%3E%7B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F%2F%20Go%20back%20to%20RUN%20Mode%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPOWER_SYS_SetMode(RUN%2C%20POWER_MANAGER_POLICY_AGREEMENT)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F%2F%20Restore%20the%20RUN%20cocke.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ECLOCK_SYS_UpdateConfiguration(0U%2C%20CLOCK_MANAGER_POLICY_AGREEMENT)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F%2F%20Re%20initialize%20the%20modules%20we%20have%20de-inititalized.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ECAN_Init()%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EPit_Init()%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%2F*%20or%20LPIT_Init%2C%20be%20consistent%20with%20what%20you%20use%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ELPI2C_INIT()%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ELPUART_Initialization()%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EADC_Initialization()%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ECSEC_Init()%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3ERTC_Init()%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%2F*%20if%20you%20need%20it%20active%20right%20after%20wake%20*%2F%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EAccelerometer_Init(%26amp%3BACC_Info)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%2F%2F%20Re%20enable%20the%20IRQ's%20we%20disabled.%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_EnableIRQ(ADC0_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_EnableIRQ(CAN0_ORed_0_31_MB_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_EnableIRQ(CAN0_ORed_Err_Wakeup_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_EnableIRQ(LPIT0_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_EnableIRQ(LPUART1_RxTx_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_EnableIRQ(LPUART0_RxTx_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_EnableIRQ(FTFC_IRQn)%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EINT_SYS_EnableIRQGlobal()%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%7D%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2336702%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20In%20Custom%20S32K118%20Board%2C%20Entering%20to%20VLPS%20and%20Exit%20to%20RUN%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2336702%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F253035%22%20target%3D%22_blank%22%3E%40Chaitanya_Sai%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3EThe%20MCU%20cannot%20be%20%E2%80%9Cstuck.%E2%80%9D%20It%20is%20either%20in%20VLPS%20or%20actively%20executing%20code%20in%20VLPR.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EPlease%20measure%20the%20VDD%20power%20consumption%20and%2For%20the%20BUS_CLK%20on%20CLKOUT%20to%20confirm%20whether%20the%20MCU%20is%20still%20in%20VLPS%20or%20is%20currently%20operating%20in%20VLPR%20or%20RUN%20mode.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3EOnce%20the%20MCU%20is%20in%20VLPR%20or%20RUN%2C%20you%20can%20attach%20the%20debugger%20and%20inspect%20which%20part%20of%20the%20code%20is%20being%20executed.%3C%2FP%3E%0A%3CP%3EEnsure%20that%20Sleep-On-Exit%20is%20disabled%20in%20the%20Power%20driver.%3C%2FP%3E%0A%3CP%3EAlso%2C%20note%20that%20it%20is%20not%20necessary%20to%20enter%20VLPR%20before%20entering%20VLPS%E2%80%94the%20MCU%20can%20transition%20directly%20from%20RUN%20to%20VLPS.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3EDaniel%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2340914%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20In%20Custom%20S32K118%20Board%2C%20Entering%20to%20VLPS%20and%20Exit%20to%20RUN%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2340914%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F160001%22%20target%3D%22_blank%22%3E%40danielmartynek%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3EActually%20I%20have%20tested%20whether%20it%20is%20going%20to%20sleep%20or%20not%20by%20putting%20a%20Soft%20reset%20function%20at%20the%20end%20of%20the%20ENTER_Vlps_Mode%20()%20function%2C%20it's%20always%20restarting..%20and%20current%20consumption%20is%20also%20high..%20So%2C%20basically%20it's%20not%20going%20to%20sleep..%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20u%20please%20check%20this%20and%20is%20there%20anything%20iam%20missing%20%3F%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2341044%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20In%20Custom%20S32K118%20Board%2C%20Entering%20to%20VLPS%20and%20Exit%20to%20RUN%20Mode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2341044%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F253035%22%20target%3D%22_blank%22%3E%40Chaitanya_Sai%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3ECould%20you%20please%20share%20the%20project%2C%20or%20a%20minimal%20test%20project%20that%20reproduces%20the%20issue%2C%20so%20I%20can%20run%20it%20on%20my%20side%3F%3CBR%20%2F%3EIf%20you%20prefer%20not%20to%20share%20it%20here%2C%20feel%20free%20to%20open%20a%20support%20ticket%20and%20provide%20the%20project%20there%20privately.%3C%2FP%3E%0A%3CP%3EBR%2C%20Daniel%3C%2FP%3E%3C%2FLINGO-BODY%3E