I assume that you use, the FlexCAN driver.
In most situations in the Automotive Industry, message configuration is done in the initialization part of the system.
You have 64 mailboxes for each CAN instance, which you can configure as receive mailbox or transmit mailbox with the given ID.
Also, you can configure each can instance as an Extended or Standard ID format part given below. If you want to change id type or id of the
mailbox, you have to call the FLEXCAN_DRV_Init function in the runtime again.
/**********************************************************************************************************************************
can1_rxtype.data_length = CAN_PACK_SIZE;
can1_rxtype.msg_id_type = FLEXCAN_MSG_ID_STD;
FLEXCAN_DRV_Init(CAN1, &canCom2_State, &canCom2_InitConfig0); // Initialization of FlexCAN module.
**********************************************************************************************************************************/
FlexCAN initialization process :
Step 0 ) FLEXCAN_DRV_Init(CAN0, &canCom1_State, &canCom1_InitConfig0); // Initialization of FlexCAN module.
Step 1) FLEXCAN_DRV_ConfigRxMb(instance, ((pmailbox + i)->mb), &(rxtype),((pmailbox + i)->id)); // Initialization of CAN_RX, Mailbox and ID's
Step 2) FLEXCAN_DRV_Receive(instance, ((pmailbox + i)->mb), &((pmailbox + i)->msg));
Step 3) FLEXCAN_DRV_ConfigTxMb(instance, ((pmailbox + i)->mb), &txtype,((pmailbox + i)->id));
Step 4) ((mailbox + i)->msg).data[BYTE_0] = NULL; // message fill
Your driver is ready to run. When you receive the message which has the id you have assigned in the FLEXCAN_DRV_ConfigRxMb function, you will receive an interrupt for a given channel.
Best Wishes