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.

TCAN4550: MRAM configuration problem

Part Number: TCAN4550

Tool/software:

Hi,

I would need some help regarding the MRAM configuration for the TCAN4550. We are using the library which is provided by TI and configure the MRAM as it is shown bellow:

TCAN4x5x_MRAM_Config MRAMConfiguration = { 0 };
/// Standard ID number of elements, you MUST have a filter written to MRAM for each element defined
MRAMConfiguration.SIDNumElements = drv_can_config->filter_len;
/// Extended ID number of elements, you MUST have a filter written to MRAM for each element defined
MRAMConfiguration.XIDNumElements = 1;
// RX0 Number of elements
MRAMConfiguration.Rx0NumElements = 5;
// RX0 data payload size
MRAMConfiguration.Rx0ElementSize = MRAM_64_Byte_Data;
// RX1 number of elements
MRAMConfiguration.Rx1NumElements         = 0;
MRAMConfiguration.Rx1ElementSize         = MRAM_8_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    = 3;                 // TX buffer number of elements
MRAMConfiguration.TxBufferElementSize    = MRAM_64_Byte_Data; // TX buffer data payload size
What we want to achieve is to use a FIFO0 with 5 elements. The problem is that whatever number we insert, after reading the REG_MCAN_RXF0S status register, the fifo full flag is set always at 2 messages. After this we already get the message lost flag. Then we tried to configure the FIFO1 buffer, and it seems we can configure for elements up to 64. However, there we start experiencing that the filters which are set not seem to work. We experienced that a message with a specific ID is received at a random time.

Do you see any problem in this configuration?

Thank you
  • Hi Danijel,

    The MRAM configuration appears correct for the following elements:

    • SID Filter Elements =  value of drv_can_config->filter_len
    • XID Filter Elements = 1
    • RX FIFO 0 Elements = 5 (with 64byte data payload capacity)
    • RX FIFO 1 Elements = 0
    • RX Dedicated Buffer Elements = 0
    • TX Event FIFO Elements = 0
    • TX Buffer Elements = 3 (with 64byte data payload capacity)

    The TCAN4550 only has 2k of Message RAM (MRAM) that can be allocated for the various types of elements.  Depending on your application, you may need more or less of a particular type of element and you can tailor the configuration for your needs.  However, the overall configuration must fit within the 2k MRAM block and therefore you will not be able to support the maximum number of all element types.

    The problem is that whatever number we insert, after reading the REG_MCAN_RXF0S status register, the fifo full flag is set always at 2 messages. After this we already get the message lost flag.

    After you read the RXF0S register, to see if there are new messages and what the Get Index of the RX Buffer Number contains the oldest message in the FIFO, you will need to then read the message or messages and then write to the RX FIFO 0 Acknowledge register with the index number of the last message that was read.  This will free up the buffer numbers in the FIFO for new messages.

    You will need to read and acknowledge the messages faster than they are being received in order to avoid an overflow event where you lose messages.

    However, there we start experiencing that the filters which are set not seem to work. We experienced that a message with a specific ID is received at a random time.

    I expect part of your RX Overflow issue is also due to the Filter configuration.  By default the device is configured to accept all non-matching messages and store them into RX FIFO 0.  Therefore, if you do not use message filtering, the device will by default accept and store all messages by default.

    However, if you want to use message filtering, you will need to change the values in the Global Filter Configuration Register (0x1080) so that they "Reject" non-matching frames.  This will then configure the device to only accept and store messages that pass one of your filter elements.

    Hopefully this small adjustment makes a significant improvement to your test results.

    I would also refer you to the following documents that are good resources for information on how to configure this device.

    • TCAN45xx Software User's Guide (Link)
    • M_CAN User's Manual (Link)

    Note that in the M_CAN User's Manual published by Bosch for their IP, the only difference is that the register address range starts at 0x00.  The TCAN4550 has added an offset of 0x1000 to each MCAN register.  For example the  for the MCAN Control register has an address of 0x18 in the M_CAN User's Manual, but the TCAN4550 has an address of 0x1018.

    Regards,

    Jonathan

  • Hi Jonathan,

    thank you for the detailed explanation. It looks like some filter components influenced the FIFO0 register. Following all your guides this is now fixed. Thank you!

  • Hi Danijel,

    You're welcome, I'm glad to hear your issues have been resolved.

    Regards,

    Jonathan