How to come out from sleep mode using CAN interrupt?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-12 4: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.
- Labels:
-
CAN
-
Interrupt
-
STM32L4 series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-12 9:13 AM
Hi! Make sure you doing the following:
- Unmask the appropriate CAN interrupt in the cortex-M NVIC
- Enable the appropriate CAN interrupt in the CAN register block (maybe CAN_CR?)
- Set up an interrupt handler funtion for this CAN interrupt, where you clear the interrupt flat (maybe CAN_ICR)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-05-12 9:13 AM
Hi! Make sure you doing the following:
- Unmask the appropriate CAN interrupt in the cortex-M NVIC
- Enable the appropriate CAN interrupt in the CAN register block (maybe CAN_CR?)
- Set up an interrupt handler funtion for this CAN interrupt, where you clear the interrupt flat (maybe CAN_ICR)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎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.
