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.

TDA4VM: PDK/MCAN - configuration for classic CAN mode

Part Number: TDA4VM
Other Parts Discussed in Thread: TDA2

Hello,

We are transmitting data over MCAN2.

For the configuration of MCAN, we referred to the Gateway demo and MCAN EVM Loopback example from PDK.

Our current configuration sets the mode of MCAN to CAN-FD with nominal bit rate of 1 Mbps.

We wish to change this to classic CAN operating at 500 kbps.

First, we simply tested the following change, but it did not work out.

In the second attempt, we configured the following values, but these changes are also not working.

Are these bit timings correct? Do we need to make any other changes to the MCAN configuration?

Thank you.

  • Hi,

    Can you please make the following changes and check - 

    bit.Times.nomRatePrescalar = 0xFU;

    bit.Times.nomTimeSeg1       = 0x5U;

    bit.Times.nomTimeSeg2       = 0x2U;

    You can find how to calculate bit rate in - https://processors.wiki.ti.com/index.php/PDK/PDK_FAQ#How_is_bit-rate_calculated.3F

    Regards,

    Karan

  • Hello Karan,

    We made your suggested changes, switched the mode to Classic CAN, and tested our vision app.

    The app loads and processes camera frames for 1 to 4 minutes, and after that, it freezes/hangs.

    We were able to reproduce this behavior 4 different times.

    We are able to see some CAN signals, but we did not validate whether those were correct, because that is irrelevant if the app hangs.

    Later, we reverted all changes, and the same application runs fine in CAN-FD mode with 1 Mbps data rate configuration.

    Your suggested changing one value for the MCAN_NBTP register.

    Do we need to make any more changes?

    Also, are there any changes required for the MCAN_DBTP register?

    Thank you.

  • Hi Sagar,

    I suspect this to an SW timing issue. Can you please check by adding inter packet delay's. i.e. transmit every 3rd or 4th frame.

    500 Kbps has been used in many usecases without any issues.

    Regards, Sujith

  • Hello Sujith,

    The J7 TRM states that for MCAN functional clock (MCAN2_FCLK) frequency of 8 MHz, setting the MCAN_NBTP register to its reset value configures it to work at 500 kbps. Accordingly, we set 'fdMode' to (0x0U) and modified the bitTimes values in our vision app. But the vision app is not able to start.

    We will try out your suggestion and reply with our observations on this thread. In the meantime, I have two questions:

    1. What is the nominal value of MCAN2 Functional Clock (FCLK) frequency?

    2. Is this frequency being modified in the K3 MCAN EVM Loopback example?

    Thank you.

  • Hello Sujith,

    Sujith said:

    Can you please check by adding inter packet delay's. i.e. transmit every 3rd or 4th frame.

    We tested this, first for every 3rd frame, and then for every alternate (2nd) frame. In both tests, the vision app worked fine without any hang/freeze problem. We concluded both tests at the end of around 30000 frames, but I am assuming that the app would work fine for longer durations as well.

    So the MCAN settings shared by Karan are working for J7 MCAN 500 kbps operation. However, we are not able to transmit our CAN packets after every frame (33 ms). How can we resolve this issue?

    Note that on TDA2, we were able to transmit even larger CAN packets at every 30 ms or so. The difference is we used System_LinkControl on TDA2, and we are using Remote Service API on TDA4.

    Since my core issue is resolved, I can close this thread and open another one for further discussion. Kindly let me know.

    Thank you.

  • Hi Sagar,

    Yes, please close this thread and open a new one.

    Regards,

    Karan

  • Closing this thread.

    Thank you.