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.

TCAN4550EVM: CAN message loss on TCAN4550

Part Number: TCAN4550EVM
Other Parts Discussed in Thread: TCAN4550

Hi,

I am using TCAN4550 along with NXP's imx8 nano board to transmit and receive the messages.when i am sending CAN messages from simulator to TCAN and  further to NANO board,there is huge CAN message loss when sending multiple CAN messages with frequency 1,2,5,10,20,50ms. SPI baud rate configured is 4mbps and TCAN is configured with 56 RXFIFO elements and all messages are stored in RXFIFO0.can i avoid message loss with just 1 RXFIFO?please help how can i avoid message loss when sending multiple messages at a time.

here are the configurations -

*/
TCAN4x5x_MRAM_Config MRAMConfiguration = {0};
MRAMConfiguration.SIDNumElements = 5;//1; // Standard ID number of elements, you MUST have a filter written to MRAM for each element defined
MRAMConfiguration.XIDNumElements = 5;//1; // Extended ID number of elements, you MUST have a filter written to MRAM for each element defined
MRAMConfiguration.Rx0NumElements = 64;//5; // RX0 Number of elements
MRAMConfiguration.Rx0ElementSize = MRAM_64_Byte_Data; // RX0 data payload size
MRAMConfiguration.Rx1NumElements = 5;//0; // RX1 number of elements
MRAMConfiguration.Rx1ElementSize = MRAM_64_Byte_Data; // RX1 data payload size
MRAMConfiguration.RxBufNumElements = 0; // RX buffer number of elements
MRAMConfiguration.RxBufElementSize = MRAM_64_Byte_Data; // RX buffer data payload size
MRAMConfiguration.TxEventFIFONumElements = 0; // TX Event FIFO number of elements
MRAMConfiguration.TxBufferNumElements = 2; // TX buffer number of elements
MRAMConfiguration.TxBufferElementSize = MRAM_64_Byte_Data; // TX buffer data payload size

Thanks in advance.

Regards,

Bipin

  • Hi Bipin,

    The limiting factor in the total message throughput is in how quickly and efficiently the MCU can read the received messages from the TCAN4550 through the SPI bus.  The SPI interface is a benefit that allows the TCAN4550 to be paired with any MCU without a CAN FD controller, but this SPI interface also comes with additional overhead.

    I do not know how you have configured your MCU's firmware, but here are some suggestions on how to optimize it for the maximum CAN message throughput.

    • Use the maximum supported SPI data rate.  The TCAN4550 can support up to 18 Mbps and if you can increase your SPI rate from 4 Mbps to a faster rate, the absolute time required to read a message through the SPI interface is reduced, allowing more messages to be received.
    • Use bulk or burst reads for multiple words of data at a time.  Read and entire message in a single SPI transaction using multiple word reads with only requiring a single address "write" for the start location.  If you are currently reading a single word of data at a time, you will have to write the address for every word.  For a 64 byte data message, there are 17 words in the RX message including the header.  Reading the entire message allows you to save 16 address writes.  Furthermore, if you can read multiple consecutive messages from memory, you can reduce the overhead even further.  For example if there are 5 messages that have arrived since the last read, then you can read them all at once assuming they haven't wrapped around from the end to the beginning of the FIFO.  You will need to be mindful of this wrap around and start a new SPI read every time you read the first FIFO position.
    • Optimize the MCU main loop and reduce the amount of functions it is performing in between message reads.  Also make sure the functions that handle the incoming data are optimized.

    Increasing the FIFO depth will allow the TCAN4550 to store more messages before becoming full and rejecting messages, but the real bottle neck is in the SPI interface and how fast the MCU can empty the FIFO's.  Every optimization you can make will increase the amount of CAN messages that can be supported in a given period of time.

    Regards,

    Jonathan