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.

TCAN4551-Q1: Distinguishing between Tx FIFO and Tx Queue topologies

Part Number: TCAN4551-Q1

I have been using the TCAN45xx Software User's Guide SLLU270 and the sample software, and it has been helpful to get the device going. 

I am struggling to differentiate between the Tx FIFO and Tx Queue setups and usage. I believe I need to use Tx FIFO topology for my application.

1) The sample software function TCAN4x5x_MRAM_Configure always sets REG_BITS_MCAN_TXBC_TFQM. Shouldn't this be a configurable part of the input structure? (although I know that the transmit example in main() is as "Dedicated Tx Buffers").

2) The example section 4.3.1 "Writing a CAN Message to the Tx Buffer" seems to describe Tx FIFO transmitting one message. If i wanted to transmit multiple messages, is the step between 4 and 5 to read TXFQS.TFQPI again, or can I just increment/wrap according to the value I read originally from TXFQS.TFFL? 

3) Once I have loaded more than one message, is step 5 a request to transmit from the TXFQS.TFGI index, and not TXFQS.TFPI ? or have I misunderstood:

"2. Tx FIFO: The TCAN45xx handles buffer management. The microcontroller reads the Tx FIFO put
index to place new messages in the correct buffer. When requesting multiple messages be sent, the
Tx FIFO get index is referenced and sends data based on what was first added to the FIFO"

Many thanks, 

Ed.

  • Hi Ed,

    I am glad to hear that the Software User's Guide and sample software has been helpful to you.  You have asked a lot of good questions and I will try to answer them clearly for you.  But first, I will point out one additional resource that you may find very helpful in understanding how to configure the TCAN4551.

    The TCAN4551 contains a CAN FD core that was developed by Bosch called the M_CAN and this controller is well known in the CAN FD community.  Bosch has a lot of good documentation and resources that could not be duplicated into the TCAN4551 datasheet.  But you can use their documentation as a supplemental resource to the datasheet and the TCAN45xx Software User's Guide SLL270.

    Here is a link to the M_CAN User's Guide on Bosch's website.

    I am struggling to differentiate between the Tx FIFO and Tx Queue setups and usage. I believe I need to use Tx FIFO topology for my application.

    While I am not sure of what TX method is best for your application, I will try to briefly clarify each method so that you can chose the best one.

    One of the benefits of CAN is that each message is assigned an Identifier based on the message's priority in the system and the different system node's will arbitrate such that the message with the highest priority is transmitted first.

    However, each node can only transmit one message at a time and this is where the two methods come in. 

    Do you want your messages to be transmitted based on the message's priority or Identifier number? If so, dedicated TX Queue Operation is a better choice because the TCAN4551 will transmit the message with the lowest ID first, regardless of which TX Buffer the MCU has used to place the message.  This ensures that a newer message with a higher priority is transmitted before an older message with lower priority.  Also, any unused buffer can be used for the messages, which can simplify the firmware because only a simple check of the buffer's status is required before transferring the message from the MCU to the TCAN4551.

    Or do you want the messages to be transmitted in more of a chronological order based on when the MCU has passed them to the TCAN4551 to transmit?  If so, you will want to use a TX FIFO because the TCAN4551 will transmit the messages in the order they were placed in the FIFO regardless of their message ID.  However, when the FIFO is used, the messages must be placed in the next chronological buffer location and the MCU will need to read the Get and Put index values and determine the next available buffer to use for the next message.  Once the index has reach the last buffer element, the MCU will need to cycle around to the first buffer element again.  Keeping track of the indices and FIFO fill levels can make the firmware more complicated as compared to the Queue method.

    1) The sample software function TCAN4x5x_MRAM_Configure always sets REG_BITS_MCAN_TXBC_TFQM. Shouldn't this be a configurable part of the input structure? (although I know that the transmit example in main() is as "Dedicated Tx Buffers").

    The sample code demonstrates the Queue method by default that allows any message buffer to be used allowing the TCAN4551 to determine which message ID has the highest priority.  This is usually the easier method to implement and is consistent with the CAN arbitration scheme.  However, you are welcome to modify this in your code if you would prefer to use the FIFO method. 

    2) The example section 4.3.1 "Writing a CAN Message to the Tx Buffer" seems to describe Tx FIFO transmitting one message. If i wanted to transmit multiple messages, is the step between 4 and 5 to read TXFQS.TFQPI again, or can I just increment/wrap according to the value I read originally from TXFQS.TFFL? 

    To transfer multiple messages, you simply transfer them to next consecutive memory buffer elements making sure the first message is stored at the Put Index location.  You will need to ensure there is enough open elements in the FIFO for all of your messages.  And you will also need to make sure that once the index reaches the last value, that you wrap around to beginning of the FIFO buffers as required.  Note the device will not transfer the message data from buffer to buffer as it transmits the messages.  Instead, it simply increments the Get and Put index values in a cyclical fashion and the MCU has to determine if there are enough elements available in the FIFO and what index to use.  But it only needs to read the TXFQS register once before transferring one or more messages to the TCAN4551 MRAM block.

    3) Once I have loaded more than one message, is step 5 a request to transmit from the TXFQS.TFGI index, and not TXFQS.TFPI ? or have I misunderstood:

    No, to send a message you will need to set the TXBAR bit for each TX Buffer Element you have stored a message in.  Once these bits are set, the device will transmit the messages as quickly as possible following the CAN arbitration protocol, and it will clear the TXBAR bits once the message has been transmitted and update the TXFQS register fields accordingly.  The TXFQS is a Read only register that simply provides information to the MCU about the status of the FIFO. The TX Buffer Add Request is the register that tells the MCU which buffers contain messages to be sent.  If you were to use the Queue method, you simply place your message in any available buffer and set the corresponding TXBAR bit.  It will be cleared once the message has been transmitted.

    "2. Tx FIFO: The TCAN45xx handles buffer management. The microcontroller reads the Tx FIFO put
    index to place new messages in the correct buffer. When requesting multiple messages be sent, the
    Tx FIFO get index is referenced and sends data based on what was first added to the FIFO"

    Yes. After initialization the Get Index and Put Index values are both at "0" indicating an empty FIFO.  Then let's say the MCU transfers one message into the FIFO at Buffer 0.  The Put Index will then increment to 1, while the Get Index will stay at 0 until the message has been transmitted, and then it will be incremented to 1. 

    If the MCU then transfers two messages to the TCAN4551, it should place them in buffer elements 1 and 2 (according to the Put Index = 1).  Then If the MCU transfers one more message, it should be placed in buffer 3.  If there were a total of 4 elements used (buffers 0-3), then the next message the MCU tries to send would need to be placed back in buffer 0 assuming the Get Index is not equal to 0 which would indicate a Full FIFO.  The process repeats cyclically with the MCU placing new messages at the Put Index, and the TCAN4551 transmitting messages according to the Get Index.

    I hope I have been clear in my response, but let me know if you have additional questions or I was not clear.

    Regards,

    Jonathan

  • Hi Jonathan, 

    Thank you very much for the detailed explanations. 

    Yes, I want the chronological transmission, so Tx FIFO it is.

    I forgot about the TXBAR bitmap because I was thinking of the demonstration function TCAN4x5x_MCAN_TransmitBufferContents which takes just one integer as the transmit parameter. 

    I understand the position loading requirements of the put index, TFFL, and the wraparound. so I just need to confirm one last point: 

    If I have loaded the messages into the right locations, and I send a TXBAR bitmap covering all the messages, then the difference is that if TFQM is set, the messages are transmitted in identifier priority order, but if TFQM is clear, then it transmits them in order from TFGI wrapping around to TFPI?

    Kind regards, 

    Ed.

  • Hi Ed,

    Yes, that is correct. 

    If the TXBC.TFQM bit = "0" then the device will be in "Tx FIFO Operation Mode" and the messages will be sent in the order you have placed them in the FIFO starting with the Get Index message and working its way to the Put Index.

    If the TXBC.TFQM bit = "1" then the device will be in "Tx Queue Operation Mode" and the messages will be sent according to message ID's priority level where the lowest ID value has the Highest Priority per the CAN protocol standard.

    I'm glad I can help.  Let me know if you have any additional questions.

    Regards,

    Jonathan

  • Perfect! thank you so much.