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.

TM4C1294NCPDT: CAN controller message objects understanding

Part Number: TM4C1294NCPDT

Dear SupportTeam,

I was going through this thread

https://e2e.ti.com/support/microcontrollers/other-microcontrollers-group/other/f/other-microcontrollers-forum/344328/can-message-filter-multiple-matches

I am fairly new to CAN and message object concepts; I have couple of queries regarding message objects.

1) If using just 1 message object for reception and before it is processed by application, a new message receives; will it override existing message in the message object?

2) if using 2 message objects both with no filtering setting(accept all CAN messages), message in message object 1 is not yet processed by application, a new message receives; will it overwrite object 1 or copy to object 2.

Thanks & Regards

Abhijit

  • Hi,

    1) If using just 1 message object for reception and before it is processed by application, a new message receives; will it override existing message in the message object?

    The previous message will be lost. The incoming message will overwrite. Please see below in datasheet. 

    The NEWDAT bit of the CANIFnMCTL register
    is set to indicate that new data has been received. The CPU should clear this bit when it reads the
    message object to indicate to the controller that the message has been received, and the buffer is
    free to receive more messages. If the CAN controller receives a message and the NEWDAT bit is
    already set, the MSGLST bit in the CANIFnMCTL register is set to indicate that the previous data
    was lost.

    2) if using 2 message objects both with no filtering setting(accept all CAN messages), message in message object 1 is not yet processed by application, a new message receives; will it overwrite object 1 or copy to object 2.

    It will have the same effect as the previous scenario. The reason is that the 2nd incoming message matches the acceptance filter of the first message object. But it didn't know that the first message object has not been read yet. What you can do is to configure for FIFO mode. In this case, the 2nd incoming message will go to the second message object. 

    19.3.6 Accepting Received Message Objects
    When the arbitration and control field (the ID and XTD bits in the CANIFnARB2 and the RMTEN and
    DLC[3:0] bits of the CANIFnMCTL register) of an incoming message is completely shifted into
    the CAN controller, the message handling capability of the controller starts scanning the message
    RAM for a matching valid message object. To scan the message RAM for a matching message
    object, the controller uses the acceptance filtering programmed through the mask bits in the
    CANIFnMSKn register and enabled using the UMASK bit in the CANIFnMCTL register. Each valid
    message object, starting with object 1, is compared with the incoming message to locate a matching
    message object in the message RAM. If a match occurs, the scanning is stopped and the message
    handler proceeds depending on whether it is a data frame or remote frame that was received.

    If you configure message object 1 and message object 2 then see below description. Please refer to the datasheet more details and info. 

    19.3.11.2 Reception of Messages with FIFO Buffers
    Received messages with identifiers matching to a FIFO buffer are stored starting with the message
    object with the lowest message number. When a message is stored into a message object of a
    FIFO buffer, the NEWDAT of the CANIFnMCTL register bit of this message object is set. By setting
    NEWDAT while EOB is clear, the message object is locked and cannot be written to by the message
    handler until the CPU has cleared the NEWDAT bit. Messages are stored into a FIFO buffer until the
    last message object of this FIFO buffer is reached. Until all of the preceding message objects have
    been released by clearing the NEWDAT bit, all further messages for this FIFO buffer are written into
    the last message object of the FIFO buffer and therefore overwrite previous messages.

  • Thank you for your response. Will it enable FIFO buffer if I set EOB to 0 ? Any other configuration to be taken care

  • Hi,

      That is correct. Set the EOB of the first message object to 0 and set the EOB of the second message object to 1. This will a two-entry FIFO. 

  • Sorry couple of more doubts

    - If need to enable more than two message objects for FIFO buffer then EOB of last message object should set to 1 for others it should be 0. is it correct?

    - If we enable FIFO buffer, is there any additional handling to receiving logic? Dose existing single object reception logic still work?

  • - If need to enable more than two message objects for FIFO buffer then EOB of last message object should set to 1 for others it should be 0. is it correct?

    correct.

    - If we enable FIFO buffer, is there any additional handling to receiving logic? Dose existing single object reception logic still work?

    For those message objects that are not part of the FIFO, they will work according to the normal reception logic. 

  • Thank you for your response. I will elaborate my second question - My current rx_isr works for single message object without FIFO; will the same logic work for multiple message objects with FIFO buffer