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.

RTOS/AWR1642: There's a problem about CAN-FD of Secondary BootLoader

Part Number: AWR1642
Other Parts Discussed in Thread: , MMWAVE-SDK

Tool/software: TI-RTOS

I follow the PDF to use CAN-FD as a serial interface to download the application meta image.

It can't receive data. So I try to transmit data from AWR1642 to PC.
I have this problem.

I have confirmed that the Bit rate(Nominal and Date) on both sides is the same.
It is OK when I use the same device for other project(packages\ti\drivers\canfd).

  • Hello JuiYang Chi,

    It is difficult to understand the problem, but looking at the log it seems like these errors are due to the improper termination of the CAN lines.

    Are you putting the PCAN and the AWR1642BOOST CAN lines on the some CAN bus?

    -Raghu
  • Hi Rafhu,

    I connect PCAN and CAN of AWR1642BOOST with same Bit-Rate.
    I also use termination resistors.

    It's most important thing that they are OK when I test the same configuration with other code for CAN-FD.

    JuiYang
  • Hello JuiYang,

    What is the version of the AWR1642BOOST?

    -Raghu
  • Hello Rafhu,

    We use AWR1642-ES2.0 .
    And the version of mmwave-SDK is 3_0_0_8 .

    JuiYang
  • Hello Juiyang,

    Can you please check if you have configured the right receiver message objects in your application and also on the image on the device side?

    Please post the code in this thread so that we can review and check if something is missing in your code.

    Thanks,
    -Raghu
  • Hello Raghu,

    This is my code. After initialize, I transmit a package.
    But I can't read this package.
    --------------------------------------------------------------------------------------------------------
    static void MCANAppInitParams(CANFD_MCANInitParams* mcanCfgParams)

    {
    /*Intialize CANFD configuration parameters. */
    memset(mcanCfgParams, sizeof(CANFD_MCANInitParams), 0);

    mcanCfgParams->fdMode = 0x1U;
    mcanCfgParams->brsEnable = 0x1U;
    mcanCfgParams->txpEnable = 0x0U;
    mcanCfgParams->efbi = 0x0U;
    mcanCfgParams->pxhddisable = 0x0U;
    mcanCfgParams->darEnable = 0x1U;
    mcanCfgParams->wkupReqEnable = 0x1U;
    mcanCfgParams->autoWkupEnable = 0x1U;
    mcanCfgParams->emulationEnable = 0x0U;
    mcanCfgParams->emulationFAck = 0x0U;
    mcanCfgParams->clkStopFAck = 0x0U;
    mcanCfgParams->wdcPreload = 0x0U;
    mcanCfgParams->tdcEnable = 0x1U;
    mcanCfgParams->tdcConfig.tdcf = 0U;
    mcanCfgParams->tdcConfig.tdco = 8U;
    mcanCfgParams->monEnable = 0x0U;
    mcanCfgParams->asmEnable = 0x0U;
    mcanCfgParams->tsPrescalar = 0x0U;
    mcanCfgParams->tsSelect = 0x0U;
    mcanCfgParams->timeoutSelect = CANFD_MCANTimeOutSelect_CONT;
    mcanCfgParams->timeoutPreload = 0x0U;
    mcanCfgParams->timeoutCntEnable = 0x0U;
    mcanCfgParams->filterConfig.rrfe = 0x1U;
    mcanCfgParams->filterConfig.rrfs = 0x1U;
    mcanCfgParams->filterConfig.anfe = 0x1U;
    mcanCfgParams->filterConfig.anfs = 0x1U;
    mcanCfgParams->msgRAMConfig.lss = 127U;
    mcanCfgParams->msgRAMConfig.lse = 64U;
    mcanCfgParams->msgRAMConfig.txBufNum = 32U;
    mcanCfgParams->msgRAMConfig.txFIFOSize = 0U;
    mcanCfgParams->msgRAMConfig.txBufMode = 0U;
    mcanCfgParams->msgRAMConfig.txEventFIFOSize = 0U;
    mcanCfgParams->msgRAMConfig.txEventFIFOWaterMark= 0U;
    mcanCfgParams->msgRAMConfig.rxFIFO0size = 0U;
    mcanCfgParams->msgRAMConfig.rxFIFO0OpMode = 0U;
    mcanCfgParams->msgRAMConfig.rxFIFO0waterMark = 0U;
    mcanCfgParams->msgRAMConfig.rxFIFO1size = 64U;
    mcanCfgParams->msgRAMConfig.rxFIFO1waterMark = 64U;
    mcanCfgParams->msgRAMConfig.rxFIFO1OpMode = 64U;
    mcanCfgParams->eccConfig.enable = 1;
    mcanCfgParams->eccConfig.enableChk = 1;
    mcanCfgParams->eccConfig.enableRdModWr = 1;
    mcanCfgParams->errInterruptEnable = 1U;
    mcanCfgParams->dataInterruptEnable = 1U;
    mcanCfgParams->appErrCallBack = sblErrStatusCallback;
    mcanCfgParams->appDataCallBack = sblDataCallback;
    }

    int32_t mcanInitialize()
    {
    CANFD_Handle canHandle;
    CANFD_MCANInitParams mcanCfgParams;
    CANFD_MCANBitTimingParams mcanBitTimingParams;
    CANFD_MsgObjHandle rxMsgObj1Handle;
    CANFD_MsgObjHandle rxMsgObj2Handle;
    CANFD_MsgObjHandle rxMsgObj3Handle;
    CANFD_MCANMsgObjCfgParams rxMsgObject1Params;
    CANFD_MCANMsgObjCfgParams rxMsgObject2Params;
    CANFD_MCANMsgObjCfgParams rxMsgObject3Params;
    CANFD_MsgObjHandle txMsgObjHandle;
    CANFD_MCANMsgObjCfgParams txMsgObjectParams;

    int32_t errCode, retVal = 0U;
    uint8_t txData[8U] =
    {0xA1, 0x1A, 0xFF, 0xFF, 0xC1, 0x1C, 0xB1, 0x1B};

    MCANAppInitParams (&mcanCfgParams);

    /* Initialize the CANFD driver. */
    canHandle = CANFD_init(&mcanCfgParams, &errCode);
    if (canHandle == NULL)
    {
    SBL_printf("Error: CANFD Module Initialization failed [Error code %d]\r\n",
    errCode);
    return -1;
    }
    /* Nominal Bit rate = (40)/(((8+6+5)+1)*BRP) = 1Mhz */
    mcanBitTimingParams.nomBrp = 0x2U; // BRP(Baud rate Prescaler): 2
    mcanBitTimingParams.nomPropSeg = 0x8U; // Prop seg: 8
    mcanBitTimingParams.nomPseg1 = 0x6U; // Ph seg 1: 6
    mcanBitTimingParams.nomPseg2 = 0x5U; // Ph Seg 2: 5
    mcanBitTimingParams.nomSjw = 0x1U; // Sync jump: 1

    /* Date Bit rate = (40)/(((2+2+3)+1)*BRP) = 5Mhz */
    mcanBitTimingParams.dataBrp = 0x1U; // BRP(Baud rate Prescaler): 1
    mcanBitTimingParams.dataPropSeg = 0x2U; // Prop seg: 2
    mcanBitTimingParams.dataPseg1 = 0x2U; // Ph seg 1: 2
    mcanBitTimingParams.dataPseg2 = 0x3U; // Ph Seg 2: 3
    mcanBitTimingParams.dataSjw = 0x1U; // Sync jump: 1

    retVal = CANFD_configBitTime(canHandle, &mcanBitTimingParams, &errCode);
    if (retVal < 0)
    {
    SBL_printf("Error: CANFD Module configure bit time failed [Error code %d]\r\n",
    errCode);
    return -1;
    }

    /* Setup the transmit message object */
    txMsgObjectParams.direction = CANFD_Direction_TX;
    txMsgObjectParams.msgIdType = CANFD_MCANXidType_29_BIT;
    txMsgObjectParams.msgIdentifier = CANFD_SEND_MSG_ID;
    txMsgObjHandle = CANFD_createMsgObject (canHandle, &txMsgObjectParams,
    &errCode);
    if (txMsgObjHandle == NULL)
    {
    SBL_printf("Error: CANFD create Tx message object failed [Error code %d]\r\n",
    errCode);
    return -1;
    }

    /* Setup the receive message object */
    rxMsgObject1Params.direction = CANFD_Direction_RX;
    rxMsgObject1Params.msgIdType = CANFD_MCANXidType_29_BIT;
    rxMsgObject1Params.msgIdentifier = CANFD_DATA_MSG_ID;

    rxMsgObj1Handle = CANFD_createMsgObject(canHandle, &rxMsgObject1Params,
    &errCode);
    if (rxMsgObj1Handle == NULL)
    {
    SBL_printf("Error: CANFD create Rx message object failed [Error code %d]\r\n",
    errCode);
    return -1;
    }
    rxMsgObject2Params.direction = CANFD_Direction_RX;
    rxMsgObject2Params.msgIdType = CANFD_MCANXidType_29_BIT;
    rxMsgObject2Params.msgIdentifier = CANFD_TERMINATE_MSG_ID;
    rxMsgObj2Handle = CANFD_createMsgObject(canHandle, &rxMsgObject2Params,
    &errCode);
    if (rxMsgObj2Handle == NULL)
    {
    SBL_printf("Error: CANFD create Rx message object failed [Error code %d]\r\n",
    errCode);
    }
    rxMsgObject3Params.direction = CANFD_Direction_RX;
    rxMsgObject3Params.msgIdType = CANFD_MCANXidType_29_BIT;
    rxMsgObject3Params.msgIdentifier = CANFD_START_MSG_ID;
    rxMsgObj3Handle = CANFD_createMsgObject(canHandle, &rxMsgObject3Params,
    &errCode);
    if (rxMsgObj3Handle == NULL)
    {
    SBL_printf("Error: CANFD create Rx message object failed [Error code %d]\r\n",
    errCode);
    }

    retVal = CANFD_transmitData (txMsgObjHandle, txMsgObjectParams.msgIdentifier, CANFD_MCANFrameType_FD, 8, &txData[0], &errCode);
    if (retVal < 0)
    {
    SBL_printf("Debug: Error transmitting CAN data %x , Errcode %x\r\n", retVal, errCode);
    }
    SBL_printf("Debug: Init MCAN\r\n");
    return retVal;
    }


    JuiYang

  • Hello Juiyang,

    To me it looks like you are not processing the ack from the transmitted message .

    Can you create another Rx message object to handle the Ack .
    rxMsgObject4Params.direction = CANFD_Direction_RX;
    rxMsgObject4Params.msgIdType = CANFD_MCANXidType_29_BIT;
    rxMsgObject4Params.msgIdentifier = CANFD_SEND_MSG_ID;
    rxMsgObj4Handle = CANFD_createMsgObject(canHandle, &rxMsgObject4Params,
    &errCode);
    if (rxMsgObj3Handle == NULL)
    {
    SBL_printf("Error: CANFD create Rx message object failed [Error code %d]\r\n",
    errCode);
    }

    With this you should have the callback being called when you transmit your message.

    Let me know if this helps.

    Thanks,
    Raghu
  • Hello Raghu,

    Thank you for your help.But it is still not working.

    This is my configuration parameters in PCAN.

    I read the SBL Software Design.

    In Appendix, you have tested CANFD in SBL.

    Can I see the code of SBL which make to download with CANFD

    JuiYang

  • JuiYang,

    The SBL code is same as you have except for there is no Tx message object and no CAN_TransmitData() like you have added in the initialization function.

    Attached are the screenshots from my setup for the PCAN USBFD.

    -Raghu