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: Receiving CAN message

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

Dear support,

I'm trying to transmit/receive CAN messages on my LAUNCHXL-F28379D evaluation board.

Have no problems with transmit, but fail to receive any message.

I'm sending a message to the board and getting the interrupt.

After that I read the value of the CAN_INT register (addr = 0x10) and the value I get there is 0x8000. (I expected to read here the mailbox number instead of 0x8000)

After getting 0x8000, I read the status register (addr = 0x04), and see the value 0x10 means RX_OK.

I configured only one rx mailbox (6), but I see no data in that mailbox. (trying to read the message with: CANMessageGet(CANB_BASE, 6, &sRXCANMessage, true);)

The RX MB configured in that way:

CanMailboxConfig(RECEIVE_MAILBOX,6,(Uint32)MbxHeaderId.all,SET_OVERWRITE_PROTECT_CONTROL,ENABLE_MAILBOX_INTERRUPT,0x00001e00);


void CanMailboxConfig(Bool bDir, Uint16 uiMBNunmer, Uint32 uiMSGID,Bool bOPC,Bool bEnableInt, Uint32 uiMaskID)
{

    if( uiMBNunmer > MAILBOX_NUM_31 )
    {
        return;
    }

    switch (bDir)
    {
    case RECEIVE_MAILBOX:
        *(unsigned long *)ucRXMsgData = 0;

        sRXCANMessage.ui32MsgID = uiMSGID;                        // CAN message ID - use 1
        sRXCANMessage.ui32MsgIDMask = uiMaskID;                    // no mask needed for TX
        sRXCANMessage.ui32Flags = MSG_OBJ_RX_INT_ENABLE | MSG_OBJ_EXTENDED_ID | MSG_OBJ_USE_ID_FILTER; //MSG_OBJ_FIFO|MSG_OBJ_RX_INT_ENABLE | MSG_OBJ_EXTENDED_ID;         // Use Extended message
        sRXCANMessage.ui32MsgLen = sizeof(ucRXMsgData);       // The message size is between 0 - 8 bytes
        sRXCANMessage.pucMsgData = (unsigned char *)ucRXMsgData;           // ptr to message content

        // Setup the message object being used to receive messages
        CANMessageSet(CANB_BASE, uiMBNunmer, &sRXCANMessage, MSG_OBJ_TYPE_RX);
    break;
.
.
.

Please advise.

Alex.

  • Here is what I see when I'm trying to read from mailbox 6:

  • Looks like I found a solution.
    The issue is about MASK register and MsgID.
    After fixing that, I can see the data (in case of single RX mailbox defined), but I still don't understand why I get 0x8000 value in CAN_INT register.
    In case I define several RX mailboxes, I need to know from what mailbox to read the message.
    According to the datasheet, I expect to get the mailbox number from CAN_INT.
    Could you please explain?

  • Hi Alex,

    Glad you could find the solution.

    As mentioned in the TRM Section 22.6 The value 0x8000 indicates that an interrupt is pending because the CAN Core has updated (not necessarily changed) the Error and Status Register (Error Interrupt or Status Interrupt). This interrupt has the highest priority.


    Thanks and Regards
    Harshmeet Singh
  • The interrupt service routine is called when an interrupt is triggered. It will be executed twice for every frame received. First time for status-change; second time for Mailbox receive. Please take a look at the C2000ware Driverlib examples.
  • Hi Hareesh,

    Thank you so much for your answer.
    In case I read the message from the mailbox upon the 1-st interrupt (when I get status==0x8000), I don't receive the 2-nd interrupt.
    Now, when upon the 1-st interrupt I just check the status and clear the interrupt bit, I get the 2-nd interrupt with the mailbox number in CAN_INT register.

    BR,
    Alex.