2023-05-29 09:22 PM
I use STM32F105RCT6, Where I need to receive CAN data inside a timer interrupt. Also, the IRQ number of the CAN is lower than that of the timer. CAN message is filled to the FIFO0 but "HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan1)" is not called back. I can get data by calling "HAL_CAN_GetRxMessage(hcan1, CAN_RX_FIFO0,&RxHeader1, RxData1)" inside the code.
2023-05-30 07:09 PM
It's not clear why you want to receive CAN data inside of a timer interrupt? Are you trying to request data from another node at a specific time?
2023-06-04 10:43 AM
I'm transmitting two CAN messages inside a timer. After the first one is transferred, wait for a reply from another device to go to the subsequent transmission.
2023-06-04 10:58 AM
You need to set a flag in the timer interrupt then exit it. Then in main while loop you check the flag then send your first message. When you receive a CAN interrupt you save the data, set a flag indicating you have a new CAN message. Then in main while loop you parse the CAN message and if it's a match you send the 2nd CAN message.