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.

TMS320F28377D: CAN masking with mixed identifier

Part Number: TMS320F28377D
Other Parts Discussed in Thread: C2000WARE

On our CAN Bus mixed identifiers are used.  To our surprise the masking is not working when the Identifier is zero and a extended identifier is received.

We suing the following source from TI:

//###########################################################################
//
// FILE:   can.c
//
// TITLE:  F2837xD CAN Initialization & Support Functions.
//
// NOTE: The CAN bus bridge uses a different addressing scheme in order to
//       allow byte accesses. Because of this, 32-bit reads/writes can execute
//       abnormally at higher optimization levels. The CAN driver functions
//       have been adjusted to explicitly use two 16-bit read/writes to access
//       the full 32-bit register where HWREGH(base + offset) represents the
//       lower 16-bits and HWREGH(base + offset + 2) represents the upper
//       16-bits.
//
//###########################################################################
// $TI Release: F2837xD Support Library v200 $
// $Release Date: Tue Jun 21 13:00:02 CDT 2016 $
// $Copyright: Copyright (C) 2013-2016 Texas Instruments Incorporated -
//             http://www.ti.com/ ALL RIGHTS RESERVED $
//###########################################################################

  // Configure the Mask Registers.
    if(pMsgObject->ui32Flags & MSG_OBJ_USE_ID_FILTER)
    {
        if(bUseExtendedID)
        {
            // Set the 29 bits of Identifier mask that were requested.
            ui32MaskReg = pMsgObject->ui32MsgIDMask & CAN_IF1MSK_MSK_M;
        }
        else
        {

            // Put the 11 bit Mask Identifier into the upper bits of the field
            // in the register.
            ui32MaskReg = ((pMsgObject->ui32MsgIDMask << CAN_IF1ARB_STD_ID_S) & CAN_IF1ARB_STD_ID_M);
            ui32MaskReg = ui32MaskReg | 0x3ffff;
        }
    }

When adding line 1213 the masking is working also when the identifier 0 is used.

Is it an issue with the processor?

Reto

  • To our surprise the masking is not working when the Identifier is zero

    Are you saying filtering is not working when all the bits of the received message ID is zero? If so, is the filtering working for all non-zero IDs?

    and a extended identifier is received.

    Does it work properly for standard identifiers?

    Is it an issue with the processor?

    No, the CAN module has passed conformance testing. This design is well over 15 years old with millions of devices shipped.

    1. Have you looked at the masking example in www.ti.com/lit/SPRACE5?
    2. Can you please try an_ex10_mask.c in the latest version of C2000ware C:\ti\c2000\C2000Ware_4_02_00_00\driverlib\f2837xd\examples\cpu1\can?
    3. Can you please provide the following: ARBID of the receive message object, its mask value, ARBID of the received message frame?
  • Thank you Hareesh Janakiraman

    I have taken over the analysis of the problem on our side.

    Thank you for pointing to SPRACE5. What we saw in our system is the case summarized in table 2-3 but vice versa.

    The problem in our system is caused by not setting the MXtd in the mask register. Setting it, resolves the problem. By not setting the MXtd bit in the mask register we did receive messages with extended CAN IDs in our message box intended to receive only CAN ID 0 (as 11bit). In fact we do receive all messages with extended CAN Ids in range 0x0 - 0x3FFFF.

    Let me point out that can_ex10_mask.c (c2000ware v4.2.0) example also contains this 'not really correct' or at least misleading initialization of the CAN msg box:

        CAN_setupMessageObject(CANA_BASE, RX_MSG_OBJ_ID, 0x1F9FFFFA,
                               CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_RX, 0x1F000000,
                               (CAN_MSG_OBJ_USE_ID_FILTER | CAN_MSG_OBJ_NO_FLAGS),
                                  MSG_DATA_LENGTH);

    With this setting the message box receives all extended messages with ID 0x1Fxxxxxx. But it also receives CAN messages with Standard ID 0x7C0-0x7FF.

    The example code (and our code too, of course) should also use CAN_MSG_OBJ_USE_EXT_FILTER to set the MXtd bit in the mask register. In fact I think this bis should always be set as soon a filtering on a CAN ID is in place.

    Yes, I saw the comment in can.h of driverlib for function doc CAN_setupMessageObject(). I think it could be more clear to point out that CAN_MSG_OBJ_USE_EXT_FILTER  is also needed if you intend to receive a 11bit identifier.

    //! 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.

    Thank you very much for your support!

    Problem solved!

    Best regards

    Roger

  • Roger,

          Glad your problem is solved. Will notify the software team for possible improvements in Driverlib.