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.

TDA4AL-Q1: CAN use FIFO recive data

Part Number: TDA4AL-Q1

Hi TI,

I want to deal with frame loss when CAN_FD receives data, but there are a few things I need to make sure:

  1. I set the FIFO size to be 5, but how many data will be in the FIFO after an interrupt?
  2. How do I get how much data is currently in the FIFO?
  3. If the FIFO has multiple data, how can the software read the second data after reading the data once? Or will another call to the read function automatically read the second data?

The picture is the logic of the receiving function,

[sdk version] 8.6.0

Looking forward to your reply.

  • Hi,

    Any specific CAN driver you are asking about LINUX or RTOS?  or in general ?

    Regards

    Tarun Mukesh

  • Hi,

    I refer to the following documents,

    tda4-s2/rtos-sdk/pdk_j721s2/packages/ti/csl/example/mcan/mcanEvmLoopback/mcan_evm_loopback_app_main_k3.c

    I want to keep looping through the data, but sometimes I lose frames, because I didn't read all the data? So I want to know how to read all the FIFO data.

  • Hello,

    • I set the FIFO size to be 5, but how many data will be in the FIFO after an interrupt?
    • How do I get how much data is currently in the FIFO?
    • If the FIFO has multiple data, how can the software read the second data after reading the data once? Or will another call to the read function automatically read the second data?

    In CAN, the "Water Mark" typically refers to a feature used in CAN controllers, particularly in the context of FIFOs. The Water Mark is a threshold level set in the receive FIFO, and it's used to trigger an interrupt or signal when the number of messages or data bytes in the FIFO reaches a specified level.

    By setting a Water Mark level, you can control when the CAN controller generates an interrupt to inform the microcontroller or processor that there's a certain amount of data available in the FIFO. This helps in efficient utilization of system resources and avoids constant polling of the FIFO.

    The Water Mark interrupt ensures that you can process received data promptly. When the FIFO reaches the specified level, an interrupt is triggered, indicating that it's an appropriate time to read and handle the data

    I want to keep looping through the data, but sometimes I lose frames, because I didn't read all the data? So I want to know how to read all the FIFO data.

    The Water Mark helps prevent FIFO overflows. If you disable or set the Water Mark too high and the FIFO fills up with incoming messages, you might lose new messages if they arrive before you have a chance to read the FIFO. Having a Water Mark set at an appropriate level can help avoid such message loss.

    The Water Mark is a feature in CAN controllers that helps manage the reception of messages efficiently, prevents message loss, and allows for timely processing of incoming data by using interrupts or signals to indicate when the receive FIFO has reached a specified fill level. It's an important tool for managing message reception in CAN systems, especially in real-time or resource-constrained applications.

    How do I get how much data is currently in the FIFO?

    Based on the respective FIFO status registers we can know number of pending messages, received messages etc..

    Regards

    Tarun Mukesh