2019-10-16 01:16 AM
Hello,
I am working on power management and I put MCU in sleep mode (no low-power), but it doesn't wake up when it receives a CAN frame, it stays in sleep mode. I would like any CAN frame to wake up the MCU.
To switch to sleep mode I use :
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
In my code I have configure CAN Rx as interrupt.
In run mode, the frames are received correctly and pass through "CAN1_RX0_IRQHandler()" function.
When I use debug only signal SIGINT (when I add/remove a breakpoint) can wake up the MCU.
On the table below (DS11453) we can see that any interrupt can wake up the MCU.
Are there any things to set up to configure the CAN for the wake-up ?
Thank you for your advice
2019-10-16 07:42 AM
I think I've found the solution.
I was trying to enter in sleepMode from CAN functions (indirectly from Rx callback), so now I just use a boolean here and in the main function I have put the code :
HAL_SuspendTick();
HAL_PWR_EnterSLEEPMode(PWR_MAINREGULATOR_ON, PWR_SLEEPENTRY_WFI);
sleepRequest = 0; //this is the boolean
HAL_ResumeTick();