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: TDA4 CAN issue

Part Number: TDA4VM
Other Parts Discussed in Thread: DRA821U, DRA821,

Hi.

My customer is testing the TDA4 CAN on their PCB.

They already verified the CAN bus on the DRA821U of their pcb. It works well.

But, they migrate the code from DRA821U to TDA4. they found the CAN TX has no signal, meanwhile, CAN loop has no signal.

Any comments? (They are testing SDK8.2)

THanks.

BR Rio

  • Porting TDA4 in our PCB and test MCU_MCAN0 in MCU1_0 with IPC sample code.

    1. Remove MCAN related item in LINUX device tree (DTS).

    2. Add EN & STB PIN setting in RTOS pinmux setting.

    3. Refer sample code : pdk/packages/ti/csl/example/mcan/mcanEvmLoopback/mcan_evm_loopback_app_main_k3.c to test CAN message.

    static int32_t App_mcanRegisterIsr(uint32_t mcanInstAddr)
    {
        int32_t configStatus = STW_SOK;

        /* Running Code from Mcu R5 */
        /* MCU MCAN Inst 0 */
        configStatus =  App_mcanRegisterInterrupt(MCU_MCAN0_TX_INT_NUM, &App_mcanIntr0ISR);
        configStatus += App_mcanRegisterInterrupt(MCU_MCAN0_RX_INT_NUM, &App_mcanIntr1ISR);
        configStatus += App_mcanRegisterInterrupt(MCU_MCAN0_TS_INT_NUM, &App_mcanTSIntrISR);

        if(STW_SOK != configStatus)
        {
            UART_printf("CrossBar/Interrupt Configuration failed.\n");
        }
        else
        {
            UART_printf("CrossBar/Interrupt Configuration done.\n");
        }

        return configStatus;
    }

    We met the problem:

    1. call APP_mcanLpbkTest() CAN loopback test Fail, because TX/RX ISR does not trigger. (for other normal test, CAN TX/RX ISR also does not trigger.)

    it will stop on the while loop.

                while (gMcanIsrIntr1Flag)
                {}
                gMcanIsrIntr1Flag = 1U;

    Why TX/RX ISR does not trigger, could you provide some suggestion?

    Thanks.

  • Hi Jay,

    Are you getting an error while registering the interrupt? Or is this successfully getting registered but somehow not getting triggered?

    Is this issue only seen for MCU MCAN0 or for MCU MCAN1 as well?

    Regards

    Karan

  • Hi Karan,

    1.this is successfully getting registered but somehow not getting triggered.

    2.MCU MCAN0 and MCU MCAN1 all have this problem.

    Thanks.

  • Hi Karan:

    Any feedback?

    Jay needs this issue to be solved asap.

    BR Rio

  • Hi Rio, Jay,

    1. When you have moved from DRA821 to TDA4VM, did you take care of the interrupt numbers?

    2. Can you check the MCAN IPs raw interrupt status? Check the register MCAN_IR?

    There could be an issue where the MCAN IP's interrupt is not correctly hooked to the R5F interrupt but even in that case the MCAN_IR should give the correct status.

    3. Have you been able to run this example on the TDA4VM EVM? The loopback test, at least from the CAN perspective, should not be board dependent as the transceiver doesn't come in the picture during an internal loopback test.

    Regards

    Karan

  • Hi Karan,

    1. DRA821 and TDA4VM are the same and use the below interrupt number:

    #define MCU_MCAN0_TX_INT_NUM (CSLR_MCU_R5FSS0_CORE0_INTR_MCU_MCAN0_MCANSS_MCAN_LVL_INT_0)
    #define MCU_MCAN0_RX_INT_NUM (CSLR_MCU_R5FSS0_CORE0_INTR_MCU_MCAN0_MCANSS_MCAN_LVL_INT_1)
    #define MCU_MCAN0_TS_INT_NUM (CSLR_MCU_R5FSS0_CORE0_INTR_MCU_MCAN0_MCANSS_EXT_TS_ROLLOVER_LVL_INT_0)

    #define MCU_MCAN1_TX_INT_NUM (CSLR_MCU_R5FSS0_CORE0_INTR_MCU_MCAN1_MCANSS_MCAN_LVL_INT_0)
    #define MCU_MCAN1_RX_INT_NUM (CSLR_MCU_R5FSS0_CORE0_INTR_MCU_MCAN1_MCANSS_MCAN_LVL_INT_1)
    #define MCU_MCAN1_TS_INT_NUM (CSLR_MCU_R5FSS0_CORE0_INTR_MCU_MCAN1_MCANSS_EXT_TS_ROLLOVER_LVL_INT_0)

    2.  what is "MCAN IPs raw interrupt status", could you explain more detail or give some example?

    3. I had tested CAN PASS with /pdk_08_01_00_36/packages/ti/board/diag/mcan/ on TDA4VM EVM before, but not test CAN with pdk_08_02 on TDA4VM EVM.

    Thanks.

  • Hi,

    2.  what is "MCAN IPs raw interrupt status", could you explain more detail or give some example?

    This is the MCAN_IR register.

    The way a core gets an interrupt is as below:

    1. IP generated an interrupt - raw interrupt

    2. IP's raw interrupt is then masked with the enable bits, if the interrupt is enabled then it will drive the interrupt line to the core.

    3. The Core gets an interrupt on the dedicated line from the IP (or via an interrupt router). If this interrupt is registered with an ISR on the Core, then the the ISR fires.

    I would think the issue is with 3 and that is why MCAN_IR register should still show a valid status.

    Regards

    Karan

  • Hi Karan,

    I read the MCU_MCAN0_CFG  IR&IE&ILS&ILE address value, like above. Check with Doc, it seems to be OK. 

    But Why ISR does not been triggered?  (you have our source code in mail attached file, please help to check the code, and provide the right solution)

    Thanks very much.

    Regards

    Jay  

  • Notes:

    1. Summary of the MCAN registers:
      1. IR (0x50) -> 0x0 -> no IP interrupt -> "Problem"
      2. IE (0x54) -> 0x1FFFFFFF -> ARA interrupt disabled, rest all enabled -> correct config configuration
      3. ILS (0x58) -> 0x0 -> Selecting INT0 -> correct config configuration
      4. ILE (0x5C) -> 0x3 -> INT0 is enabled -> correct config configuration
    2. Issue is that the MCAN IP itself is not generating the interrupt.
    3. Next steps:
      1. Kolin to replicate this on the TDA4VM EVM and share the code (patches) with Karan by 30th Jun.
      2. Karan to revert back in 1-2 days after the code is shared for the TDA4VM EVM.

    Regards

    Karan

  • Hi Karan,

    We can reproduce this issue on TDA4VM  EVM with SDK 8.0.1 & 8.0.2.

     

    Polling TX

    Polling Rx

    Interrupt TX

    Interrupt RX

    loopback

    Test Case1:

    board_diag_mcan @pdk_jacinto_08_01_00_36

    OK

    FAIL

    FAIL*(1)

    FAIL*(2)

    NA

    Test Case 2:

    csl_mcan_evm_loopback_app @ pdk_jacinto_08_02_00_21

    FAIL*(3)

    FAIL*(3)

    FAIL*(3)

    FAIL*(3)

    FAIL*(3)

    Test Case3:

    board_diag_mcan + pdk_jacinto_08_02_00_21

    NA

    NA

    NA

    NA

    FAIL*(4)

    Please check the mail and help to solve this issue in 1-2 Days.

    Thanks very much.

    Regards,

    Jay

  • Hi Jay,

    I took a brief look at this issue and seems like there is an issue with the interrupt registration for the MCAN ISR. I can see the MCAN_IR getting set properly by this is not translating to a core's interrupt because the interrupt is not correctly registered.

    I will try to provide a working example on the EVM which you can refer.

    Regards

    Karan

  • Hi Jay,

    As per my previous response, the ISR registration for the MCU R5F is the issue.

    You can use the attached mcan_test_modify.c and compare it with yours. With the changes on the interrupt configuration and changing code to do internal loopback, I was able to get the Tx interrupts.

    Note, I change the mode to internal loopback because maybe some transceiver configuration was not taken care of in your code, and even with the ISR triggering the message was not able to get out on the bus.

    Please refer to the attached file.

    mcan_test_modify.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    /******************************************************************************
    * Copyright (c) 2018-2021 Texas Instruments Incorporated - http://www.ti.com
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the
    * distribution.
    *
    * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Logs:

    loopback_mcan_csl_app.log
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    SBL Revision: 01.00.10.01 (Dec 17 2021 - 09:24:15)
    TIFS ver: 21.9.1--v2021.09a (Terrific Lla
    ***********************************************
    * MCAN Test_FL *
    ***********************************************
    CrossBar/Interrupt Configuration done.
    MCANSS Revision ID:
    scheme:0x1
    Business Unit:0x2
    Module ID:0x8e0
    RTL Revision:0x9
    Major Revision:0x1
    Custom Revision:0x0
    Minor Revision:0x1
    CAN-FD operation is enabled through E-Fuse.
    Endianess Value:0x87654321
    Successfully configured MCAN0
    MCANSS Revision ID:
    scheme:0x1
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Regards

    Karan

  • Hi Karan,

    In your code, we can not run, and stay in while(ccs_loop);

    This code "while(ccs_loop);" had a problem.

    Beside, according to the ISR registration that you modify,  I check our TDA4 code, the ISR registration is  the same, but our TDA4 still can not trigger ISR function.

    Please check this problem again.

    Thanks.

    BR,

    Jay

  • Hi Jay

    1. The while(ccs_loop) is only for debug purpose, you can change the ccs_loop = 0x0.

    2. You mention that the ISR registration is the same, do you mean you were already using that or now you modified based on my suggestion and still facing the issue? To make sure that the MCU R5F has the MCAN IP’s interrupt enabled, please check the VIM_INTR_EN_SET_j register value at address 0x40F80408. The  value at the 0th bit for this register should be set. This 0th bit corresponds to the MCU R5Fs 0th interrupt which is connected to the MCU MCAN0’s interrupt MCU_MCAN0_MCANSS_MCAN_LVL_INT_0.

    VIM register:

    Regards

    Karan

  • Hi Karan,

    1. Remove while(ccs_loop), TX ISR can work, but RX ISR still can not trigger.(In your log, we don't see RX work well?)

    2. do you mean you were already using that or now you modified based on my suggestion and still facing the issue? ==> Yes

    I printf the VIM_INTR_EN_SET_j register, the value is 3F. The  value at the 0th bit for this register had be set. But our TDA4 code ISR still can not been triggered.

    3. In 8.0.2 sample code mcan_evm_loopback_app_main_k3.c, we cannot run normally. Would you provide the mcan_evm_loopback_app_main_k3.c code that can run well on EVM?

  • Hi Jay

    1. Remove while(ccs_loop), TX ISR can work, but RX ISR still can not trigger.(In your log, we don't see RX work well?)

    The initial issue was with the TX ISR and that is what I tested. With the changes from my patch you too are now able to see the TX ISR hence I would consider the Tx ISR issue resolved.

    3. In 8.0.2 sample code mcan_evm_loopback_app_main_k3.c, we cannot run normally. Would you provide the mcan_evm_loopback_app_main_k3.c code that can run well on EVM?

    I used the modified application from you and did not run the default mcan_evm_loopback_app_main_k3.c, let me give this a try.

    but RX ISR still can not trigger.(

    Can you tell me what is the configuration for the filters on the MCU MCAN0 side? The ISR for Rx will hit only when the incoming message on the CAN bus is intended for the MCU MCAN0 controller i.e. the message ID associated with the message matches the filter configuration for the MCU MCAN0. What is the message ID (and what kind of message - standard ID or extended ID) are you sending from the external CAN emulator & and what is the filter configuration?

    Regards

    Karan

  • Closing the loop on this.

    The last issue open on this thread for the Rx interrupt was due to internal loopback configuration. With disabling internal loopback, Rx interrupts too are getting triggered.

    Regards

    Karan