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.

LAUNCHXL-F28069M: Issue with CAN Bus Receiving Only CAN ID 000 (hex)

Part Number: LAUNCHXL-F28069M
Other Parts Discussed in Thread: TMS320F28335

Hello TI E2E Community,

I am currently facing a challenge with my CAN bus setup and would appreciate any insights or guidance from the community. My CAN bus is only receiving data from CAN ID 000 (hex), and messages with other CAN IDs are not being received. I have thoroughly checked my hardware connections, and they seem to be correct. 

I have attached configuration related to the CAN bus setup bellow. I would appreciate any advice or suggestions to troubleshoot and resolve this issue. Thank you in advance for your time and assistance.

//
// Included Files
//
#include "DSP28x_Project.h"     // Device Headerfile and Examples Include File

int     i;

long    RX_A_loopcount = 0; // Counts the # of times eCAN-A Received successfully
Uint16  rxMsgData[8];

Uint16  IDData[6];

/************************************************************
 These functions are invoked based on the GPIO value read
*************************************************************/

void Receive_A(void);       // Receive Mailbox Data function for eCAN-A

void CCR_Enable(void);
void CCR_Disable(void);

void Enable_Mailboxes(void);
void Disable_Mailboxes(void);


struct ECAN_REGS ECanaShadow;

main()
{

/* Kill Watchdog, Init PLL, Enable peripheral clocks */

    InitSysCtrl();

/* Initialize the CAN module */

    InitECan();
    InitECanGpio();

    EALLOW;

/* Configure Mailbox as Receive */

    ECanaShadow.CANMD.all = 0;
    ECanaShadow.CANMD.bit.MD4 = 1;                  /* Configure Mailbox 4 as Receive */
    ECanaRegs.CANMD.all = ECanaShadow.CANMD.all;

    Enable_Mailboxes();
    Receive_A();

    ESTOP0;
}

/*****************/
/* End of main() */
/*****************/

void Receive_A(void)                // Receive Data
{
    while(1)
    {
     while(ECanaRegs.CANRMP.all != 0x00000010 ) {}  // Wait for RMP4 to be set.. 

     ECanaRegs.CANRMP.all = 0x00000010;            // Clear RMP4 bit and start

     rxMsgData[0] = ECanaMboxes.MBOX4.MDL.byte.BYTE0;
     rxMsgData[1] = ECanaMboxes.MBOX4.MDL.byte.BYTE1;
     rxMsgData[2] = ECanaMboxes.MBOX4.MDL.byte.BYTE2;
     rxMsgData[3] = ECanaMboxes.MBOX4.MDL.byte.BYTE3;
     rxMsgData[4] = ECanaMboxes.MBOX4.MDH.byte.BYTE4;
     rxMsgData[5] = ECanaMboxes.MBOX4.MDH.byte.BYTE5;
     rxMsgData[6] = ECanaMboxes.MBOX4.MDH.byte.BYTE6;
     rxMsgData[7] = ECanaMboxes.MBOX4.MDH.byte.BYTE7;

     IDData[0] = ECanaMboxes.MBOX4.MSGID.bit.IDE;
     IDData[1] = ECanaMboxes.MBOX4.MSGID.bit.AME;
     IDData[2] = ECanaMboxes.MBOX4.MSGID.bit.AAM;
     IDData[3] = ECanaMboxes.MBOX4.MSGID.bit.STDMSGID;
     IDData[4] = ECanaMboxes.MBOX4.MSGID.bit.EXTMSGID_H;
     IDData[5] = ECanaMboxes.MBOX4.MSGID.bit.EXTMSGID_L;


     RX_A_loopcount++ ;                            // all over again...
    }
}

void CCR_Enable(void)
{
        ECanaShadow.CANMC.all = ECanaRegs.CANMC.all;
        ECanaShadow.CANMC.bit.CCR = 1 ;            // Set CCR = 1
        ECanaRegs.CANMC.all = ECanaShadow.CANMC.all;

        // Wait until the CPU has been granted permission to change the configuration registers
        do
        {
          ECanaShadow.CANES.all = ECanaRegs.CANES.all;
        } while(ECanaShadow.CANES.bit.CCE != 1 );       // Wait for CCE bit to be set..

        ECanaShadow.CANBTC.all = ECanaRegs.CANBTC.all;

}

void CCR_Disable(void)
{
            ECanaRegs.CANBTC.all = ECanaShadow.CANBTC.all;

            ECanaShadow.CANMC.all = ECanaRegs.CANMC.all;
            ECanaShadow.CANMC.bit.CCR = 0 ;            // Set CCR = 0
            ECanaRegs.CANMC.all = ECanaShadow.CANMC.all;

            // Wait until the CPU no longer has permission to change the configuration registers
            do
            {
              ECanaShadow.CANES.all = ECanaRegs.CANES.all;
            } while(ECanaShadow.CANES.bit.CCE != 0 );       // Wait for CCE bit to be  cleared..

}

void Enable_Mailboxes(void)         /* Enable Mailboxes under test */
{
    ECanaShadow.CANME.all = 0;
    ECanaShadow.CANME.bit.ME4 = 1;
    ECanaRegs.CANME.all = ECanaShadow.CANME.all;

}

void Disable_Mailboxes(void)         /* Disable Mailboxes  */
{
    ECanaRegs.CANME.all = 0;
}

  • You are not assigning a MSGID to the mailbox you are using. If you want to receive multiple MSGIDs in the same mailbox, you need to enable acceptance mask filtering. 

    Please download my Application report http://www.ti.com/lit/SPRA876. It has many tested examples. Note that the examples were written for the TMS320F28335 device. However, they can be easily adopted for any 28x device with eCAN, provided you take care of the change in SYSCLKOUT speed and the resultant changes warranted for the CANBTC register. I also request you to look at the Debug tips provided. Most CAN issues can be resolved by going through this checklist.

  • I appreciate the prompt response to my previous inquiry. As per the recommendation, if I aim to receive messages with MSGID other than 000, I should assign MSGID to my mailbox. If I intend to receive multiple MSGIDs (e.g., 101, 102, 103, 104), the suggestion is to utilize acceptance mask filtering. To confirm my understanding, would setting the acceptance mask to "10" effectively filter and allow the reception of these MSGIDs? Is my understanding correct ?

  • , if I aim to receive messages with MSGID other than 000, I should assign MSGID to my mailbox.

    You need to assign a MSGID to every mailbox you use. Every mailbox must be initialized and all the fields of the MSGID register must be initialized explicitly. You cannot/should not rely on the default values of any bit-field.

    would setting the acceptance mask to "10" effectively filter and allow the reception of these MSGIDs?

    Please refer to the filtering example in SPRA876