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 Identifier Mask question

Part Number: TMS320F28377S
Other Parts Discussed in Thread: CONTROLSUITE

Hi Champs,

I try to testing the Identifier Mask function of F2837x CAN using below example:

C:\ti\controlSUITE\device_support\F2837xS\v191\F2837xS_examples_Cpu1\can_loopback

In  the CANInit(CANA_BASE) , i had set the IF2MCTL.UMASK bit. by using below instruction,

  HWREGH(ui32Base + CAN_O_IF2MCTL ) = CAN_IF2MCTL_UMASK;

I  modified the message ID and mask as below:

    sTXCANMessage.ui32MsgID = 0x04000164;                      // 
    sTXCANMessage.ui32MsgIDMask = 0x1f00ffff;                  //

    sRXCANMessage.ui32MsgID = 0x04000168;                      // 
    sRXCANMessage.ui32MsgIDMask = 0x1f00fff0;                  //

but the message object 2 cannot receive the message from object 1 ,.

Could you help to check anything else be  ignored for Identifier Mask function or how to configure the Identifier Mask function ?

  • Huihuang,

                Does this work if you don't use any filtering? i.e. if you make the MSGIDs of both mailboxes identical, is the message received? If it does, you could then set all the bits of the mask to "don't care" and see if that works. If that works as well, you could try masking chosen bits like you have done in the code snip that you posted.

  • Hi Hareesh,

    Thanks for your help!

    If the MSGIDs of both mailboxes are same like below   ,no matter the mask bit be setting to  0x00 or 0x1fffffff, the message can be received,

    sTXCANMessage.ui32MsgID = 0x04000164; //

    sRXCANMessage.ui32MsgID = 0x04000164; //

    but if i change the MSGIDS as below, No matter  the mask bit  is 0X00 or 0x1fffffff like below , the message cannot be received.

    sTXCANMessage.ui32MsgID = 0x04000164; //

    sRXCANMessage.ui32MsgID = 0x04000168; //

    //Set to don't care

    sTXCANMessage.ui32MsgIDMask = 0x00; // 

    sRXCANMessage.ui32MsgIDMask = 0x00;      

    //Set the mask bit

    sTXCANMessage.ui32MsgIDMask = 0x1fffffff; // 

    sRXCANMessage.ui32MsgIDMask = 0x1fffffff;            

             

    May i know anything wrong with my setting  and anything else need to take care or do you have workable example about mask bit setting?

  • Huihuang,
    Have you set MDir / MXtd in the IF1MSK register to the correct values? Sorry, I do not have an example to share right now.
  • Hi Hareesh,

    I just use the F2837x CAN  example project as below:

    C:\ti\controlSUITE\device_support\F2837xS\v191\F2837xS_examples_Cpu1\can_loopback

    In  the CANInit(CANA_BASE) , i had set the IF2MCTL.UMASK bit. by using below instruction,

      HWREGH(ui32Base + CAN_O_IF2MCTL ) = CAN_IF2MCTL_UMASK;

    I  modified the message ID and mask as below:

        sTXCANMessage.ui32MsgID = 0x04000164;                      // 
        sTXCANMessage.ui32MsgIDMask = 0x1f00ffff;                  //

        sRXCANMessage.ui32MsgID = 0x04000168;                      // 
        sRXCANMessage.ui32MsgIDMask = 0x1f00fff0;                  //

    except above modification , no otherthing  be changed  , this will be very easy to  reappear  the issue  based  on example project.

    In the Debug window ,i can see the MDir is 0 and MXtd is 1 in IF2MSK  register.

  • Hi Hareesh,

    Based on your suggestion, i modify the code as below , and the filtering function can working normal.

    Thanks a lot for your kindly help!

        *(unsigned long *)ucTXMsgData = 0;

        sTXCANMessage.ui32MsgID = 0x04000164;                                // CAN message ID

        sTXCANMessage.ui32Flags = MSG_OBJ_EXTENDED_ID | MSG_OBJ_TX_INT_ENABLE;

        sTXCANMessage.ui32MsgLen = sizeof(ucTXMsgData);                      // size of message is 4

        sTXCANMessage.pucMsgData = ucTXMsgData;                              // ptr to message content

     

        //

        // Initialize the message object that will be used for receiving CAN

        // messages.

       

        *(unsigned long *)ucRXMsgData = 0;

        sRXCANMessage.ui32MsgID = 0x04000168;                                // CAN message ID - use 1

         sRXCANMessage.ui32MsgIDMask = 0x1f00fff0;

        sRXCANMessage.ui32Flags = MSG_OBJ_EXTENDED_ID | MSG_OBJ_USE_ID_FILTER;

        sRXCANMessage.ui32MsgLen = sizeof(ucRXMsgData);                      // size of message is 4

        sRXCANMessage.pucMsgData = ucRXMsgData;                              // ptr to message content