We are trying to port our application which was running on MSP430 and CC2520 Radio with single MKW41Z512 SoC from NXP. I am using TPM0 timer clocked with MCGIRCLK at 4MHz fast IRC to wake up from VLPS (Very Low Power Stop) mode. I am also using TPM1 and TPM2 for some other purpose to come out of sleep mode. I am entering into VLPS mode directly from RUN mode (FEE) and exiting back to RUN mode with these timers. The SOC resets itself with Core Lockup bit set in RCM_SRS1 register. This issue is not happening when running the same with debugger (which I think doesn't stop the MCG clock to enable debugging). If the VLPS mode enter is removed then there is no reset.
I have used the driver example to enter to VLPS mode.
status_t SMC_SetPowerModeVlps(SMC_Type *base)
/* configure VLPS mode */
reg = base->PMCTRL;
reg &= ~SMC_PMCTRL_STOPM_MASK;
reg |= (kSMC_StopVlps << SMC_PMCTRL_STOPM_SHIFT);
base->PMCTRL = reg;
/* Set the SLEEPDEEP bit to enable deep sleep mode */
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
/* read back to make sure the configuration valid before enter stop mode */
/* check whether the power mode enter VLPS mode succeed */
if (base->PMCTRL & SMC_PMCTRL_STOPA_MASK)
One another point to add up is that only once in 3 times this code returns kStatus_Success and most of the other times it returns kStatus_SMC_StopAbort, for which also I couldn't find a reason.
Any quick help or suggestion will be greatly appreciated as we need to solve this to take a decision on using this SoC as power consumption is very stringent requirement.