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: [MCAN] Play CAN msg by TSMaster but no data can be got from canBus0RxQueue and canBus1RxQueue

Part Number: TDA4AL-Q1

Tool/software:

Hello TI partner,

CODEBASE INFO
【SDK】J721S2 10.01.00.04
【PDK】pdk_j721s2_10_01_00_25

20250513-1-TI_Question.zip
【CODE】/codes
【PATCH】057a657.diff
【CAN TOOL】TSMaster. 20250513-1-Code_and_TSMaster_Config.docx
【ASC FILE】XCP_Trigger_svnv27639_V2.ASC

Our requirement is use Classic CAN for tx/rx operation but most examples in pdk_j721s2_10_01_00_25 are CAN-FD format. 

We refered \pdk_j721s2_10_01_00_25\packages\ti\csl\example\mcan\mcanEvmLoopback for implementation and adjusted mcan config as patch 057a657.diff or codes dir.

For mcan tx test, TSMaster can interpret CAN msg from DUT successfully.

For mcan rx test, we used TSMaster to play CAN data but cannot capture any MCAN_RxBufElement from canBus0RxQueue. Pls refer 20250513-1-Code_and_TSMaster_Config.docx.

Because mcan tx test is ok, we think TSMaster configuration should be correct and problem should be occurred in our mcan configuration.

Could you help us check where the problem is?

20250513-1-TI_Question.zip

Thanks!

Troy Chen

(O) +886-2-22685511#61836
(M) +886-9-10-709335
troyywchen@fih-foxconn.com

  • Hello,

    May i know what msg id you are expecting to receive in MCAN RX?

    Regards

    Tarun Mukesh

  • Hello Tarun Mukesh,

    0x700.

    1.629460 1 700 Rx d 4 E3 00 00 04
    1.633703 1 700 Rx d 6 E2 00 00 01 00 00
    1.634188 1 700 Rx d 8 E1 FF 04 00 FE 01 24 8C

  • Hello,

    I need to look into your example changes and will get back to you.

    Regards

    Tarun Mukesh

  • Hello Tarun Mukesh,

    Do you have any finding about which settings should be modified?

    Thanks!

  • Hello,

    I did the preliminary check and initall parameters looks good .I will dig deep and go through each individually but expect some delay.

    Regards

    Tarun Mukesh

  • Hello Tarun Mukesh,

    I tried to restore App_mcanConfig() settings back to default (CAN-FD) and then TDA4AL-Q1 can acquire MCAN_RxBufElement from canBus0RxQueue successfully. Attached screenshot and CAN-FD one msg ASC file for your reference.

    When finished played CAN-Classic msg on TSMaster, I didn't see error msg.
    (If some configurations are wrong, the tool will show warning text. e.g.: Configure HW to wrong mode)

    I think the classic msg is sent to TDA4AL-Q1 via CAN0 bus but don't know why it doesn't exist in canBus0RxQueue.

    #define ENABLE_CAN_FD

    static int32_t App_mcanConfig(uint32_t mcanInstAddr, bool enableInternalLpbk, uint32_t clock)
    {
        uint32_t fdoe;
        int32_t configStatus = CSL_PASS;
        MCAN_RevisionId revId;
        MCAN_InitParams initParams;
        MCAN_ConfigParams configParams;
        MCAN_MsgRAMConfigParams msgRAMConfigParams;
        MCAN_StdMsgIDFilterElement stdFiltelem;
        MCAN_BitTimingParams bitTimes;

        /* Initialize MCAN Init params */
    #ifdef ENABLE_CAN_FD
        initParams.fdMode = 0x1U;
        initParams.brsEnable = 0x1U;
    #else
        initParams.fdMode = 0x0U;
        initParams.brsEnable = 0x0U;
    #endif

        initParams.txpEnable = 0x0U;
        initParams.efbi = 0x0U;
        initParams.pxhddisable = 0x0U;
        /* To enable automatic retransmission of the packet,
        * program initParams.darEnable to "0" */
        initParams.darEnable = 0x1U;
        initParams.wkupReqEnable = 0x1U;
        initParams.autoWkupEnable = 0x1U;
        initParams.emulationEnable = 0x1U;
        initParams.emulationFAck = 0x0U;
        initParams.clkStopFAck = 0x0U;
        initParams.wdcPreload = 0xFFU;
        initParams.tdcEnable = 0x1U;
        initParams.tdcConfig.tdcf = 0xAU;
        initParams.tdcConfig.tdco = 0x6U;
        /* Initialize MCAN Config params */
        configParams.monEnable = 0x0U;
        configParams.asmEnable = 0x0U;
        configParams.tsPrescalar = 0xFU;
        configParams.tsSelect = 0x0U;
        configParams.timeoutSelect = MCAN_TIMEOUT_SELECT_CONT;
        configParams.timeoutPreload = 0xFFFFU;
        configParams.timeoutCntEnable = 0x0U;
        configParams.filterConfig.rrfs = 0x1U;
        configParams.filterConfig.rrfe = 0x1U;
        configParams.filterConfig.anfe = 0x1U;
        configParams.filterConfig.anfs = 0x1U;
        /* Initialize Message RAM Sections Configuration Parameters */
        msgRAMConfigParams.flssa = APP_MCAN_STD_ID_FILT_START_ADDR;
        msgRAMConfigParams.lss = APP_MCAN_STD_ID_FILTER_NUM;
        msgRAMConfigParams.flesa = APP_MCAN_EXT_ID_FILT_START_ADDR;
        msgRAMConfigParams.lse = APP_MCAN_EXT_ID_FILTER_NUM;
        msgRAMConfigParams.txStartAddr = APP_MCAN_TX_BUFF_START_ADDR;
        msgRAMConfigParams.txBufNum = APP_MCAN_TX_BUFF_SIZE;
        msgRAMConfigParams.txFIFOSize = 0U;
        msgRAMConfigParams.txBufMode = 0U;

    #ifdef ENABLE_CAN_FD
        msgRAMConfigParams.txBufElemSize = MCAN_ELEM_SIZE_64BYTES;
    #else
        msgRAMConfigParams.txBufElemSize = MCAN_ELEM_SIZE_8BYTES;
    #endif

        msgRAMConfigParams.txEventFIFOStartAddr = APP_MCAN_TX_EVENT_START_ADDR;
        msgRAMConfigParams.txEventFIFOSize = APP_MCAN_TX_BUFF_SIZE;
        msgRAMConfigParams.txEventFIFOWaterMark = 3U;
        msgRAMConfigParams.rxFIFO0startAddr = APP_MCAN_FIFO_0_START_ADDR;
        msgRAMConfigParams.rxFIFO0size = APP_MCAN_FIFO_0_NUM;
        msgRAMConfigParams.rxFIFO0waterMark = 3U;
        msgRAMConfigParams.rxFIFO0OpMode = 0U;
        msgRAMConfigParams.rxFIFO1startAddr = APP_MCAN_FIFO_1_START_ADDR;
        msgRAMConfigParams.rxFIFO1size = APP_MCAN_FIFO_1_NUM;
        msgRAMConfigParams.rxFIFO1waterMark = 3U;
        msgRAMConfigParams.rxFIFO1OpMode = 0U;
        msgRAMConfigParams.rxBufStartAddr = APP_MCAN_RX_BUFF_START_ADDR;

    #ifdef ENABLE_CAN_FD
        msgRAMConfigParams.rxBufElemSize = MCAN_ELEM_SIZE_64BYTES;
        msgRAMConfigParams.rxFIFO0ElemSize = MCAN_ELEM_SIZE_64BYTES;
        msgRAMConfigParams.rxFIFO1ElemSize = MCAN_ELEM_SIZE_64BYTES;
    #else
        msgRAMConfigParams.rxBufElemSize = MCAN_ELEM_SIZE_8BYTES;
        msgRAMConfigParams.rxFIFO0ElemSize = MCAN_ELEM_SIZE_8BYTES;
        msgRAMConfigParams.rxFIFO1ElemSize = MCAN_ELEM_SIZE_8BYTES;
    #endif

        /* Initialize Tx Buffer Config params */
        stdFiltelem.sfid2 = 0x0U;
        stdFiltelem.sfid1 = 0x4U;
        stdFiltelem.sfec = 0x7U;
        stdFiltelem.sft = 0x0U;

        /* Initialize bit timings 500 Kbps | 1Mbps | 5Mbps as nominal and data bit-rate respectively */
    #ifdef ENABLE_CAN_FD
        bitTimes.nomRatePrescalar = 0x7U;
        bitTimes.nomTimeSeg1 = 0x5U;
        bitTimes.nomTimeSeg2 = 0x2U;
        bitTimes.nomSynchJumpWidth = 0x1U;
        bitTimes.dataRatePrescalar = 0x1U;
        bitTimes.dataTimeSeg1 = 0x3U;
        bitTimes.dataTimeSeg2 = 0x2U;
        bitTimes.dataSynchJumpWidth = 0x1U;
        App_ConsolePrintf("[App_mcanConfig] 1 Mbps bit rates -> f_clock=80000000(80 MHz)|nom_brp=8|nom_tseg1=6|nom_tseg2=3|nom_sjw=1|data_brp=2|data_tseg1=4|data_tseg2=3|data_sjw=1\n");
    #else
        /* bit rate = 80MHz / (16 * (6 + 3 + 1)) = 80MHz / (16 * 10) = 500Kbps */
        if (clock == CLOCK_500KBPS)
        {
        bitTimes.nomRatePrescalar = 0xFU;
        bitTimes.nomTimeSeg1 = 0x5U;
        bitTimes.nomTimeSeg2 = 0x2U;
        bitTimes.nomSynchJumpWidth = 0x1U;
        bitTimes.dataRatePrescalar = 0x1U;
        bitTimes.dataTimeSeg1 = 0x3U;
        bitTimes.dataTimeSeg2 = 0x2U;
        bitTimes.dataSynchJumpWidth = 0x1U;
        App_ConsolePrintf("[App_mcanConfig] 500 Kbps bit rate -> f_clock=80000000(80 MHz)|nom_brp=16|nom_tseg1=6|nom_tseg2=3|nom_sjw=1|data_brp=2|data_tseg1=4|data_tseg2=3|data_sjw=1\n");
        }
    ......
    ......

    【TDA4AL-Q1 can acquire CAN-FD rx msg from canBus0RxQueue

    【CAN-FD ASC sample file】

    one_mesg-fd.zip

  • Hi Gibbs,

    This issue is solved after configured correct filterAPP_MCAN_STD_ID_FILTER_NUM global vairant. Appreciated for your information so much.