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.

C2000WARE: CAN Message Objects Configuration

Part Number: C2000WARE

Hello,

I'm trying to decipher how to configure CAN message objects (a.k.a. mailboxes). I have been referencing the SPRACE5A documentation and the technical reference manual for the mcu I am currently using (F280025C).

My goal is to have a separate receive mailbox per CAN ID (let's assume I want to receive less than 32 different CAN IDs and so I have sufficient mailboxes).

What I'm not sure of is how to use the provided CAN_setupMessageObject() function to make this happen.

  • Do I need to configure a mask if I simply want to use the exact msgID I pass to that function, or can I achieve this with a mask of 0 and some Message object flags?
  • What is the difference between the CAN_MSG_OBJ_USE_ID_FILTER and CAN_MSG_OBJ_USE_EXT_FILTER?
    • In C2000Ware_4_01 can_ex8_mask.c, I see it uses CAN_MSG_OBJ_USE_ID_FILTER with message frame set to CAN_MSG_FRAME_EXT, what is this doing?

Any help is appreciated,

Regards,

  • Hi Sasha,

    Do I need to configure a mask if I simply want to use the exact msgID I pass to that function, or can I achieve this with a mask of 0 and some Message object flags?

         JC: As shown in the examples, if you used the exact msg ID you can set the mask to a value of 0.  Mask is used in conjunction with ID filtering.  For instance, if you only want to receive a set of message IDs, you can enable filtering.  For instance, if you set mask value to 0x1FFFFFFF (meaning 29-bit extended ID is desired) and you set the message ID to 0x1111 and and set CAN_MSG_OBJ_USE_EXT_FILTER flag, then only message ID 0x1111 will be accepted.  However if mask value is set to 0x1FFFFFF0, message IDs 0x1110 to 0x111F are accepted.

    What is the difference between the CAN_MSG_OBJ_USE_ID_FILTER and CAN_MSG_OBJ_USE_EXT_FILTER?
    • In C2000Ware_4_01 can_ex8_mask.c, I see it uses CAN_MSG_OBJ_USE_ID_FILTER with message frame set to CAN_MSG_FRAME_EXT, what is this doing?

         JC: There are two ID types used in CAN, standard which is 11-bit and extended which is 29-bit.  If filtering is desired, flag CAN_MSG_OBJ_USE_ID_FILTER can be used for standard 11-bit IDs or flag CAN_MSG_OBJ_USE_EXT_FILTER can be used for extended 29-bit ID.

    Regards,

    Joseph

  • Using a mask set to 0 and flags set to CAN_MSG_OBJ_NO_FLAGS seems to do the trick, as you suggested.

    Setting the mask to all 1s and CAN_MSG_OBJ_USE_EXT_FILTER for extended CAN msg IDs seems to also do the trick, as I assume these are exactly equivalent.

    JC: There are two ID types used in CAN, standard which is 11-bit and extended which is 29-bit

    I find that example confusing, as I think it is using extended CAN message IDs, but is using the regular filter instead of the extended filter. Is this an error in the example? If not perhaps more detailed comments would make the intended behaviour more clear.

    Thanks for your assistance,

  • Hi Sasha,

    Can you let me know which example you are referring to and i will take a look?

    Thanks,
    Joseph

  • C2000Ware_4_01 can_ex8_mask.c

    My relative path finds it here: C2000Ware_4_01_00_00\driverlib\f28002x\examples\can

  • Hi Sasha,

    Good catch.  Let me notify our SW team.  Looks like this might have been a bug in the example.  Will let you know.

    Thanks,

    Joseph