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.

TMS320F28377S: CAN communication cannot receive data

Part Number: TMS320F28377S
Other Parts Discussed in Thread: C2000WARE

Dear team:

When a customer of mine was conducting CAN communication test, there was no problem sending data, but when receiving, the data could not be received. And from CCS expressions, you can see that sRXCANMessage.ui32MsgLen will change from 8 to 0.

When single-stepping, it is found that when the judgment statement that accepts data in the function CANMessageGet() is executed, the program will jump directly to the else statement. And "ui32MsgCtrl = HWREG(ui32Base + CAN_O_IF2MCTL);" is only related to the CAN_O_IF2MCTL control register. This register is only set to 0 during initialization, and there is no other operation afterwards. Should CAN_O_IF2MCTL be set first? How should it be set up?

if(ui32MsgCtrl & CAN_IF2MCTL_NEWDAT) 
{
// Get the amount of data needed to be read.
pMsgObject->ui32MsgLen = (ui32MsgCtrl & CAN_IF2MCTL_DLC_M);

// Don't read any data for a remote frame, there is nothing valid in
// that buffer anyway.
if((pMsgObject->ui32Flags & MSG_OBJ_REMOTE_FRAME) == 0)
{
// Read out the data from the CAN registers.
CANDataRegRead(pMsgObject->pucMsgData,
(uint32_t *)(ui32Base + CAN_O_IF2DATA),
pMsgObject->ui32MsgLen);
}

// Now clear out the new data flag.
HWREGH(ui32Base + CAN_O_IF2CMD + 2) = CAN_IF2CMD_TXRQST >> 16;

// Transfer the message object to the message object specified by
// ui32ObjID.
HWREGH(ui32Base + CAN_O_IF2CMD) = ui32ObjID & CAN_IF2CMD_MSG_NUM_M;

// Wait for busy bit to clear
while(HWREGH(ui32Base + CAN_O_IF2CMD) & CAN_IF2CMD_BUSY)
{
}

// Indicate that there is new data in this message.
pMsgObject->ui32Flags |= MSG_OBJ_NEW_DATA;
}
else
{
// Along with the MSG_OBJ_NEW_DATA not being set the amount of data
// needs to be set to zero if none was available.
pMsgObject->ui32MsgLen = 0;
}

Best regards

  • Green,

              The fact that a transmission is successful likely indicates there are no H/W issues here. I’ll make some general suggestions: 

    Please download and use the latest version of C2000ware (https://www.ti.com/tool/C2000WARE?keyMatch=&tisearch=search-everything&usecase=software). Every new version has many of the older bugs fixed. 

    To ensure the reception is working, please download my Application report http://www.ti.com/lit/sprace5 and try out the tested example for reception can_ex5_simple_receive.c . I also request you to look at the Debug tips provided. Most CAN issues can be resolved by going through this checklist. 

    How do you ensure that the data that you are expecting to receive has indeed been transmitted? Do you have a CAN bus analyzer that confirms that the data has indeed been transmitted? 

    When single-stepping, it is found that when the judgment statement that accepts data in the function CANMessageGet() is executed, 

    In the code snippet you sent, CANMessageGet()  is not there. 

     Should CAN_O_IF2MCTL be set first? How should it be set up?

    For a Receive mailbox, if you are not using interrupts for receive operation, the only important bit that needs to be initialized in EoB (bit 7).

    Once again, please request customer to move to the Driverlib framework in C2000ware.