TMS320F28335: MSGID and LAM Setup

Part Number: TMS320F28335

Tool/software:

Hi yall,

I must receive these groups of CAN IDs

- Group 1 CAN ID: 0x510, 0x511, 0x512, ..., 0x519

- Group 2 CAN ID: 0x520, 0x521, 0x522, ..., 0x529

- Group 3 CAN ID: 0x530, 0x531, 0x532, ..., 0x539

I set up three mailboxes as follows:

- MSGIDs (1, 2, and 3) to receive different groups of CAN IDs.  

ECanbMboxes.MBOX1.MSGID.all = 0x54400000; // Mail box ID = 0x510
ECanbMboxes.MBOX2.MSGID.all = 0x54800000; // Mail box ID = 0x520
ECanbMboxes.MBOX3.MSGID.all = 0x54C00000; // Mail box ID = 0x530

- Local-Acceptance-Mask Register

ECanbLAMRegs.LAM1.bit.LAMI = 1;               // This allows standard and extended frames can be received
ECanbLAMRegs.LAM1.bit.LAM_H = 0x1470; // This allows standard and extended frames can be received
ECanbLAMRegs.LAM1.bit.LAM_L = 0xFFFF; // This allows standard and extended frames can be received

ECanbLAMRegs.LAM2.bit.LAMI = 1;               // This allows standard and extended frames can be received
ECanbLAMRegs.LAM2.bit.LAM_H = 0x14B0; // This allows standard and extended frames can be received
ECanbLAMRegs.LAM2.bit.LAM_L = 0xFFFF; // This allows standard and extended frames can be received

ECanbLAMRegs.LAM3.bit.LAMI = 1;               // This allows standard and extended frames can be received
ECanbLAMRegs.LAM3.bit.LAM_H = 0x14F0; // This allows standard and extended frames can be received
ECanbLAMRegs.LAM3.bit.LAM_L = 0xFFFF; // This allows standard and extended frames can be received

When I ran the program, all CAN ID frames were received by mailbox3.

If I commented out these lines

// ECanbLAMRegs.LAM2.bit.LAMI = 1;               // This allows standard and extended frames can be received
// ECanbLAMRegs.LAM2.bit.LAM_H = 0x14B0; // This allows standard and extended frames can be received
// ECanbLAMRegs.LAM2.bit.LAM_L = 0xFFFF; // This allows standard and extended frames can be received
//
// ECanbLAMRegs.LAM3.bit.LAMI = 1;               // This allows standard and extended frames can be received
// ECanbLAMRegs.LAM3.bit.LAM_H = 0x14F0; // This allows standard and extended frames can be received
// ECanbLAMRegs.LAM3.bit.LAM_L = 0xFFFF; // This allows standard and extended frames can be received

I can receive all CAN IDs (0x510 to 0x519) in mailbox1.

If I commented out these lines


// ECanbLAMRegs.LAM3.bit.LAMI = 1;               // This allows standard and extended frames can be received
// ECanbLAMRegs.LAM3.bit.LAM_H = 0x14F0; // This allows standard and extended frames can be received
// ECanbLAMRegs.LAM3.bit.LAM_L = 0xFFFF; // This allows standard and extended frames can be received

I can receive all CAN IDs (0x510 to 0x519 and 0x520 to 0x529) in mailbox2.

This meant that a higher mailbox number has a higher priority to receive messages.  

My question: Is there any way to set up each mailbox to receive a group of CAN IDs as above?

Thank you very much for your help. 

  • Hi,

    The LAM is used to mask out the bits of the message ID that should not be compared. The "1" value in LAM register means "don't care" or accept either a "0" or "1" for that bit position. A "0" value means that the incoming bit value must match the corresponding bit in the message ID.

    Please try the following LAM config:

    LAMI = 0

    LAM1 = 0x00F << 28

    LAM2 = 0x00F << 28

    LAM3 = 0x00F << 28

  • This meant that a higher mailbox number has a higher priority to receive messages.  

    An incoming message is stored in the highest numbered mailbox with a matching identifier.