cancel
Showing results for 
Search instead for 
Did you mean: 

Both CAN bus interrupt

NASI
Senior

Hello,

I am using both CAN bus to transmit data with different ID, DLC 8 and it works fine.

To receive data in each CAN bus, I use interrupt for both of CAN bus as bellow and I get data only from one of the CAN bus.

void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)

{

 /* Get RX message */

 if (HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &CAN1_Message.RxHeader, CAN1_Message.RxData) != HAL_OK)

 {

  /* Reception Error */

  Error_Handler();

 }

 if (HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &CAN2_Message.RxHeader, CAN2_Message.RxData) != HAL_OK)

 {

  /* Reception Error */

  Error_Handler();

 }

}

CAN interrupt is activated for only one CAN bus.

Is my interrupt code correct?

Thank you.

0 REPLIES 0