Because I need to reduce power consumption, I deinitialize CAN before entering VLPR mode, and enter VLPS mode after 10ms, but lptmr cannot wake up. When I shield the CAN deinitialization code, I can wake up. What is the reason?
This is my Task code,use SDK3.0:
void PowerIf_SleepManageTask(void)
{
uint16_t lsCurTime = 0;
static uint16_t lsPreTime = 0;
static uint8_t lsTemp = 0;
lsCurTime = GetSysTime();
switch (gBcmWokeMode)
{
case RUNNING:
{
gAppCanWakeupFlg = false;
if (true == PowerFunc_GetBCMFuncModeSleepCon() )
{
gBcmWokeMode = SLEEP_DELAY;
lsPreTime = lsCurTime;
}
}
break;
case SLEEP_DELAY:
{
if ((false == PowerFunc_GetBCMFuncModeSleepCon()) || (gAppCanWakeupFlg == true))
{
gAppCanWakeupFlg = false;
gBcmWokeMode = RUNNING;
}
else if( (lsCurTime - lsPreTime) > BCMSleepDelayTime)
{
gBcmWokeMode = SLEEP;
DriverLpTmrIf_LowpowerTimerInit(); //lptmr Init
FLEXCAN_DRV_Deinit(INST_CANCOM1);
POWER_SYS_SetMode(VLPR, POWER_MANAGER_POLICY_AGREEMENT);
}
}
break;
case SLEEP:
{
if ( (gAppCanWakeupFlg == false) && (false == PowerFunc_GetLocalWakeupCon() ) )
{
POWER_SYS_SetMode(VLPS, POWER_MANAGER_POLICY_AGREEMENT);
}
else
{
}
}
break;
default :
gBcmWokeMode = RUNNING;
break;
}
}
Hello,
The LPTMR must work regardless of the state of the FlexCAN module.
Please make sure that the MCU enters the VLPR, VLPS modes successfully and that LPTMR functional clock is enabled in VLPS.
Can you please share the project so that I can test it?
Thank you,
BR, Daniel