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.

TMS320F28379D: C2000 CAN example code writing on all mailboxes/object ids/ interfaces)

Part Number: TMS320F28379D
Other Parts Discussed in Thread: LAUNCHXL-F28379D, C2000WARE,

Note: This error is occurring on a LAUNCHXL-F28379D development kit

The C2000 example code I'm using is located at: \c2000\C2000Ware_2_00_00_03\driverlib\f2837xd\examples\cpu1\can\can_ex4_simple_transmit.c

To my understanding TX_MSG_OBJ_ID is synonymous with mailbox and interface. However when I run the code, I am receiving the messages on every single option for interface.

(The code specifies 500k baud but actually sends it out at 250k)

National Instruments NI USB-8473s High Speed CAN


My intention is that one message is sent on interface CAN1 and the other message is sent on CAN2

I am using the following defines to achieve this

#define TX_MSG_OBJ_ID 1
#define TX_MSG_OBJ_ID2 2

setting them up with this function

CAN_setupMessageObject(CANB_BASE, TX_MSG_OBJ_ID, 0x95555555, CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_TX, 0, CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH);
CAN_setupMessageObject(CANB_BASE, TX_MSG_OBJ_ID2, 0x95555556, CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_TX, 0, CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH);

and looping on this to send

CAN_sendMessage(CANB_BASE, TX_MSG_OBJ_ID, MSG_DATA_LENGTH, txMsgData);
CAN_sendMessage(CANB_BASE, TX_MSG_OBJ_ID2, MSG_DATA_LENGTH, txMsgData);

However I am getting both messages on every interface (CAN7 shown below)

P.S. I seem to be experiencing the same issue with the other CAN example project too:

\c2000\C2000Ware_2_00_00_03\device_support\f2837xd\examples\cpu1\can_external_transmit\cpu01\can_external_transmit.c

Here is the function from can.h: 
objID is the variable in question

//*****************************************************************************
//
//! Setup a Message Object
//!
//! \param base is the base address of the CAN controller.
//! \param objID is the message object number to configure (1-32).
//! \param msgID is the CAN message identifier used for the 11 or 29 bit
//!        identifiers
//! \param frame is the CAN ID frame type
//! \param msgType is the message object type
//! \param msgIDMask is the CAN message identifier mask used when identifier
//!        filtering is enabled
//! \param flags is the various flags and settings to be set for the message
//!        object
//! \param msgLen is the number of bytes of data in the message object (0-8)
//!
//! This function sets the various values required for a message object.
//!
//! The \e frame parameter can be one of the following values:
//! - \b CAN_MSG_FRAME_STD - Standard 11 bit identifier
//! - \b CAN_MSG_FRAME_EXT - Extended 29 bit identifier
//!
//! The \e msgType parameter can be one of the following values:
//! - \b CAN_MSG_OBJ_TYPE_TX          - Transmit Message
//! - \b CAN_MSG_OBJ_TYPE_TX_REMOTE   - Transmit Remote Message
//! - \b CAN_MSG_OBJ_TYPE_RX          - Receive Message
//! - \b CAN_MSG_OBJ_TYPE_RXTX_REMOTE - Receive Remote message with
//!                                     auto-transmit
//!
//! The \e flags parameter can be set as \b CAN_MSG_OBJ_NO_FLAGS if no flags
//! are required or the parameter can be a logical OR of any of the following
//! values:
//! - \b CAN_MSG_OBJ_TX_INT_ENABLE    - Enable Transmit Interrupts
//! - \b CAN_MSG_OBJ_RX_INT_ENABLE    - Enable Receive Interrupts
//! - \b CAN_MSG_OBJ_USE_ID_FILTER    - Use filtering based on the Message ID
//! - \b CAN_MSG_OBJ_USE_EXT_FILTER   - Use filtering based on the Extended
//!                                     Message ID
//! - \b CAN_MSG_OBJ_USE_DIR_FILTER   - Use filtering based on the direction of
//!                                     the transfer
//! - \b CAN_MSG_OBJ_FIFO             - Message object is part of a FIFO
//!                                     structure and isn't the final message
//!                                     object in FIFO
//!
//! If filtering is based on message identifier, the value
//! \b CAN_MSG_OBJ_USE_ID_FILTER has to be logically ORed with the \e flag
//! parameter and \b CAN_MSG_OBJ_USE_EXT_FILTER also has to be ORed for
//! message identifier filtering to be based on the extended identifier.
//!
//! \note The \b msgLen Parameter for the Receive Message Object is a "don't
//!       care" but its value should be between 0-8 due to the assert.
//!
//! \return None.
//
//*****************************************************************************
extern void
CAN_setupMessageObject(uint32_t base, uint32_t objID, uint32_t msgID,
                       CAN_MsgFrameType frame, CAN_MsgObjType msgType,
                       uint32_t msgIDMask, uint32_t flags, uint16_t msgLen);

  • For the flags argument I was passing CAN_MSG_OBJ_NO_FLAGS before and after some digging I thought

    CAN_MSG_OBJ_USE_ID_FILTER | CAN_MSG_OBJ_USE_ID_FILTER | CAN_MSG_OBJ_USE_EXT_FILTER

    might work but it is still having the same behavior of broadcasting to all interfaces.

  • If I understand your setup correctly, you are using one CAN controller on TMS320F28379D, and one NI CAN controller acting as the receiver monitoring the bus. In this setup there is only one physical bus and all active controllers sees all traffic on that bus. You configured two TX mailboxes and transmitting same data using those two mailboxes on to the same bus.

    I am not familiar with NI CAN "interface"; You have to configure the receive controller/mailboxes to filter Message IDs of interest.

    Looks like the TX side is working, except your TX MSG-ID is too long  - truncated to 29-bits in EXT format as seen on the monitor/RX side.