When S32k148 wakeup from VLPS mode,Can i choose first run address?

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

When S32k148 wakeup from VLPS mode,Can i choose first run address?

643 Views
shijie_zheng
Contributor III

Dear FAE:
I have a question. Can I manually set the first run address after VLPS exits(running freertos system),Generally, the address following "POWER_SYS_SetMode(VLPS,POWER_MANAGER_POLICY_AGREEMENT);" is executed after exit from VLPS mode,and not re-executed from main();But I expect it able to start executing from main() after exiting from VLPS,
at the same time I don't want to trigger main() reset through watchdog,
I used the following assembly statement to force the run address to point to main:
__asm("mov r0, #0x80000");
__asm("add r1, r0, #4");
__asm("ldr r0, [r0, #0]");
__asm("ldr r1, [r1, #0]");
__asm("msr msp, r0");
__asm("msr psp, r0");
S32_SysTick->CSR = 0UL;
S32_SysTick->CVR = 0UL;
S32_SCB->VTOR = 0x80000UL;
__asm("mov pc, r1");
However, I found that after exiting from VLPS, the application has crashed,
it stop at for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )
/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
{
/* There is nothing to do here, just iterating to the wanted
insertion position. */
}
How can I locate the cause of crash?
Is it recommended to set the running address by force pointing?

0 Kudos
Reply
1 Reply

634 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @shijie_zheng,

After the MCU exits the VLPS mode, it starts with all the pending interrupts and then continuous with the instruction that follows the WFI instruction.

The SDK driver executes the WFI instruction in

SMC_SetPowerMode()

STANDBY();

power_smc_hw_access.c

 

For the jump, you can reuse the code from AN12218

danielmartynek_0-1621516920907.png

https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/s32k-automotive-mc...

 

The issue here seems to be caused by the FreeRTOS scheduler.

Please take a look at this article: 

FreeRTOS: how to End and Restart the Scheduler

https://mcuoneclipse.com/2019/01/20/freertos-how-to-end-and-restart-the-scheduler/

 

You may also find a solution at

https://forums.freertos.org/

 

Regards,

Daniel

 

 

0 Kudos
Reply