2021-05-12 04:53 AM
Hello All,
I am using sleep mode to save power. I am using STM32L431RC & using CAN interface.
I am able to enter into the sleep mode when a CAN message is received.
But it doesn't come out when a CAN interrupt is received.
My code for CAN interrupt handler
HAL_CAN_GetRxMessage(&hcan1, CAN_RX_FIFO0, &pHeaderRx, DataRx);
if(pHeaderRx.ExtId == 0x056E0410)
{
if(DataRx[0] == 0xD0)
{
HAL_PWR_DisableSleepOnExit ();
HAL_ResumeTick();
}
else if(DataRx[0] == 0xD1)
{
HAL_SuspendTick();
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
}
else
{};
}
Any help will be appreciated.
Solved! Go to Solution.
2021-05-12 09:13 AM
Hi! Make sure you doing the following:
2021-05-12 09:13 AM
Hi! Make sure you doing the following:
2021-05-12 10:31 PM
Thank you DOCon.1 for your reply.
I m using cubeMax for pin configuration and atollic trueStudio for development.
It is entering in sleep mode successfully but not coming out from sleep mode when next expected CAN data is received. as shown in above code.
Kindly find image of NVIC setting.