This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28379S: using one mailbox for multiple Rx messages

Part Number: TMS320F28379S

HI,

I am trying to use a single mailbox for receiving multiple CAN messages with different message IDs

i am using the below functions to define the message Obj

CANMessageObjInt(ucRXMsg_ECU_001, CAN_MSG_ID_ECU_001, MSG_OBJ_RX_INT_ENABLE, &sRXCAN_ECU_001);
CANMessageSet(CANB_BASE, RX_MSG_OBJ_ID, &sRXCAN_ECU_001, MSG_OBJ_TYPE_RX);


CANMessageObjInt(ucRXMsg_EPC_001, CAN_MSG_ID_EPC_001, MSG_OBJ_RX_INT_ENABLE, &sRXCAN_EPC_001);
CANMessageSet(CANB_BASE, RX_MSG_OBJ_ID, &sRXCAN_EPC_001, MSG_OBJ_TYPE_RX);





/*****************************************************************************
//
//! Initialize the message object that will be used for transmitting CAN messages.
//!
//! \param ucMsgData is the Tx/Rx data array.
//! \param ui32MsgID is the CAN Msg ID.
//! \param ui32MsgFlg Enable CAN int on msg reception or transmission
//! \param pMsgObject is a pointer to a structure containing message object
//! settings.
//!
//!************************************************************************************
*/

void
CANMessageObjInt(unsigned char* ucMsgData, uint32_t ui32MsgID, uint32_t ui32MsgFlg, tCANMsgObject *pMsgObject)
{

// Initialize the message object that will be used for receiving CAN
// messages.
*(unsigned long *)ucMsgData = 0;
pMsgObject->ui32MsgID = ui32MsgID; // CAN message ID - use 1
pMsgObject->ui32MsgIDMask = 0; // 0x7f8; for TX
pMsgObject->ui32Flags = ui32MsgFlg;
pMsgObject->ui32MsgLen = sizeof(ucMsgData);
pMsgObject->pucMsgData = ucMsgData; // ptr to message content

}

CAN_MSG_ID_ECU_001 is defined as 0x010
and

CAN_MSG_ID_EPU_001 is defined as 0x100


When i execute the code and check

i observe that ui32MsgID for both sRXCAN_ECU_001 and sRXCAN_EPC_001 is set as 256 (0x100)
looks like the second command overwrite the earlier command.

am i doing something wrong in initialization?

also i am trying to read the transmitted message by calling

CANMessageGet(CANB_BASE, RX_MSG_OBJ_ID, &sRXCAN_ECU_001, true);

but currently since both the structures have same message ID, the message randomly goes on one.
is their a better way to receive the messages?
can i check for the MsgID and create an If else statement to direct the received message to the correct array?

Thanks
Ankit