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.

TMS320F28377D: using one mailbox for multiple transmit messages

Part Number: TMS320F28377D


I have a fairly simple interface where one node transmits data requests to several nodes. When a node receives a request it replies back. Initially we had a mailbox for every TX and RX message but we're running out of mailboxes. It seems like it would be ok to designate one mailbox as the TX mailbox and send several different messages through that mailbox? Any reason not to do this?

// // // So say I have 3 TX message objects that I set up:

   // Msg 1

   sTXCANMsg1.ui32MsgID = 1;                                                  // CAN message ID

   sTXCANMsg1.ui32MsgIDMask = 0;                                             // no mask needed for TX

   sTXCANMsg1.ui32MsgLen = sizeof(TxCANMsgData.val.Msg1);                     // number of data bytes

   sTXCANMsg1.pucMsgData = TxCANMsgData.val.Msg1;                             // ptr to message content

 

   // Msg 2

   sTXCANMsg1.ui32MsgID = 2;                                                  // CAN message ID

   sTXCANMsg1.ui32MsgIDMask = 0;                                            // no mask needed for TX

   sTXCANMsg1.ui32MsgLen = sizeof(TxCANMsgData.val.Msg2);                     // number of data bytes

   sTXCANMsg1.pucMsgData = TxCANMsgData.val.Msg2;                             // ptr to message content

 

   // Msg 3

   sTXCANMsg1.ui32MsgID = 3;                                                  // CAN message ID

   sTXCANMsg1.ui32MsgIDMask = 0;                                            // no mask needed for TX

   sTXCANMsg1.ui32MsgLen = sizeof(TxCANMsgData.val.Msg3);                     // number of data bytes

   sTXCANMsg1.pucMsgData = TxCANMsgData.val.Msg3;                             // ptr to message content

 

// // // But then I only use one transmit object ID for sending the messages: 

// // // Note that I don't have to send messages back to back there will be some time between transmits

#define CAN_TX_OBJ_ID                 1

 

 

CANMessageSet(can_base_addr, CAN_TX_OBJ_ID, &sTXCANMsg1, MSG_OBJ_TYPE_TX);

CANMessageSet(can_base_addr, CAN_TX_OBJ_ID, &sTXCANMsg2, MSG_OBJ_TYPE_TX);

CANMessageSet(can_base_addr, CAN_TX_OBJ_ID, &sTXCANMsg3, MSG_OBJ_TYPE_TX);

  • It seems like it would be ok to designate one mailbox as the TX mailbox and send several different messages through that mailbox? Any reason not to do this?

    Yes, it would be OK to transmit the messages from one mailbox. I presume you will be changing the MSGID to address different receiving nodes. 

    Are you using remote frames? If so, you could transmit a remote frame from a receive mailbox and receive a response in the same mailbox. Please download my Application report http://www.ti.com/lit/sprace5. It has tested examples for remote frames.

  • Hareesh,

    Thanks for your response. Yes I would be changing the message ID so that we send messages to the appropriate node.

    I have not been using remote frames but that also sounds like a solution. I look forward to reading the app report.