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.

AM5728: Dcan normal mode configure

Part Number: AM5728

Hi,ti

refer to the Dcan loopback example in <PDK Roor/ti/csl/example/dcan/dcanLoopback>,I test both internal loopback mode and external loopback mode,system working fine.

system info as follows:

Hardware: AM572x Industrial EVM,Rev 1.3B        

Software info: processor-sdk-rtos-am57xx-evm-06.03.00.106   and  processor-sdk-linux-am57xx-evm-06.03.00.106.

I try to change Dcan workmode from loopback to normal,it does not work,Dcan even can not send data out.

I search both linux and rtos sdk for Dcan normal mode demo code , but only dcan_loopback mode code exsist,so,can you provide a normal mode demo code or Dcan configuraration.

BR.

  • Hi,

    We don't have example code in AM57xx SDK other than loopback test.

    However, the same DCAN IP is used on other TI SoC so I was able to find some example from other TI SDK below for your reference.

    Please also make sure you configure the pinmux for both CAN TX and RX.

    /cfs-file/__key/communityserver-discussions-components-files/791/3173.dcan.zip


    /** ***************************************************************************** * \brief Intialize default values for DCAN rx mailbox configuration * * \param pDcanRxCfgPrms Config params rx mailbox intialization * \param msgId Message Id asscoiated with the mailbox * ***************************************************************************** */ static void Utils_dcanInitRxMsgObjParams(dcanMsgObjCfgParams_t *pDcanRxCfgPrms, UInt32 msgId,UInt32 msgType) { /*Intialize DCAN Rx Config Params*/ pDcanRxCfgPrms->xIdFlagMask = 0x1; pDcanRxCfgPrms->dirMask = 0x1; pDcanRxCfgPrms->msgIdentifierMask = 0x1FFFFFFF; pDcanRxCfgPrms->msgValid = TRUE; pDcanRxCfgPrms->xIdFlag = msgType; pDcanRxCfgPrms->direction = DCAN_DIR_RX; if (FALSE == pDcanRxCfgPrms->xIdFlag) { msgId = (msgId & 0x7FF) << 18; } pDcanRxCfgPrms->msgIdentifier = msgId; pDcanRxCfgPrms->uMaskUsed = TRUE; pDcanRxCfgPrms->intEnable = TRUE; pDcanRxCfgPrms->remoteEnable = FALSE; pDcanRxCfgPrms->fifoEOBFlag = TRUE; } /** ***************************************************************************** * \brief Intialize default values for DCAN tx mailbox configuration * * \param pDcanTxCfgPrms Config params tx mailbox intialization * \param msgId Message Id asscoiated with the mailbox * ***************************************************************************** */ static void Utils_dcanInitTxMsgObjParams(dcanMsgObjCfgParams_t *pDcanTxCfgPrms, UInt32 msgId,UInt32 msgType) { /*Intialize DCAN tx Config Params*/ pDcanTxCfgPrms->xIdFlagMask = 0x1; pDcanTxCfgPrms->dirMask = 0x1; pDcanTxCfgPrms->msgIdentifierMask = 0x1FFFFFFF; pDcanTxCfgPrms->msgValid = TRUE; pDcanTxCfgPrms->xIdFlag = msgType; pDcanTxCfgPrms->direction = DCAN_DIR_TX; if (FALSE == pDcanTxCfgPrms->xIdFlag) { msgId = (msgId & 0x7FF) << 18; } pDcanTxCfgPrms->msgIdentifier = msgId; pDcanTxCfgPrms->uMaskUsed = TRUE; pDcanTxCfgPrms->intEnable = TRUE; pDcanTxCfgPrms->remoteEnable = FALSE; pDcanTxCfgPrms->fifoEOBFlag = TRUE; } /** ***************************************************************************** * \brief DCAN controller configuration default params initialization * * \param pDcanCfgPrms Config params to intialize * ***************************************************************************** */ static void Utils_dcanInitControllerParams(dcanCfgParams_t *pDcanCfgPrms) { /*Intialize DCAN Config Params*/ pDcanCfgPrms->parityEnable = FALSE; pDcanCfgPrms->autoRetransmitDisable = TRUE; pDcanCfgPrms->autoBusOnEnable = FALSE; pDcanCfgPrms->intrLine0Enable = FALSE; pDcanCfgPrms->intrLine1Enable = TRUE; pDcanCfgPrms->errIntrEnable = FALSE; pDcanCfgPrms->stsChangeIntrEnable = FALSE; #ifdef TDA3XX_FAMILY_BUILD pDcanCfgPrms->eccModeEnable = FALSE; #endif pDcanCfgPrms->autoBusOnTimerVal = FALSE; if (dcanConfig.enableLoopback) { pDcanCfgPrms->testModeEnable = TRUE; pDcanCfgPrms->testMode = DCAN_TEST_MODE_EXT_LPBACK; } else { pDcanCfgPrms->testModeEnable = FALSE; pDcanCfgPrms->testMode = DCAN_TEST_MODE_NONE; } pDcanCfgPrms->if1DmaEnable = FALSE; pDcanCfgPrms->if2DmaEnable = FALSE; pDcanCfgPrms->if3DmaEnable = FALSE; pDcanCfgPrms->ramAccessEnable = FALSE; }

    Regards,
    Stanley

  • Hi ,Stanley

    Thanks for your support,add Rx pinmux to  the dcan loopback mode demo default configuration ,system now work fine in dcan loopback mode and normal mode.