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.

IWR6843ISK: CAN interrupt issue in firmware update OTA

Part Number: IWR6843ISK
Other Parts Discussed in Thread: MMWAVEICBOOST

Tool/software:

Hi,

Referring to the previous thread IWR6843: IWR6843 firmware update over CAN - Sensors forum - Sensors - TI E2E support forums continuing this new thread.

Summarizing all together, I am trying to update firmware of IWR6843ISK radar module over the air. I am referring TI's CAN_SBL. I am able to run the bootloader successfully but while updating the firmware or transmitting the binary file over CAN using PEAK CAN analyzer I am not able to receive anything on radar module side. I tried correcting parameters and as suggested I tried to check the interrupt bit of CAN. It is not getting any interrupt when I check for the interrupt status using MCAN_getIntrStatus(0xFF500000); this function. 

Just to clarify, which CAN transceiver are you using, MCANA or MCANB? - MCANA or MCANB you mean CAN connectors? I am connecting it to the J3 connector of IWR6843ISK.

Thanks,
Manoj

  • Hey Manoj,

    Thanks for opening up a new thread for this. I referenced these incorrectly on my part - i.e., MCANA = CAN1 and MCANB = CAN2 - but I was talking about both the physical connection and the CAN instance instantiated in code when calling CANFD_init. Since you are using J3, CANFD_init should use 0 as the instanceId - i.e., CAN1 - if you weren't already.

    I know it was mentioned on the previous thread, but just to confirm once more, there is no error or warning being thrown in PCAN View at all when sending a single message over the PCAN while the SBL is running? If the interrupt is not being triggered at all, I would suspect there to be no ACK which would be visible in PCAN View.

    Regards,

    Kristien

  • Hi Kristien,

    I am sending instance id as 0. canHandle = CANFD_init(0, mcanCfgParams, &errCode);

    Also please confirm CAN init parameters are okay, please find the attached file.

    Thanks,

    Manoj

    static void MCANParamInit(void)
    {
        int32_t errCode, retVal;
        /*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;
    
    
        /* Setup the PINMUX to bring out the XWR18XX CANFD pins. */
        Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PINE14_PADAE, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
        Pinmux_Set_FuncSel(SOC_XWR68XX_PINE14_PADAE, SOC_XWR68XX_PINE14_PADAE_CANFD_TX);
        Pinmux_Set_OverrideCtrl(SOC_XWR68XX_PIND13_PADAD, PINMUX_OUTEN_RETAIN_HW_CTRL, PINMUX_INPEN_RETAIN_HW_CTRL);
        Pinmux_Set_FuncSel(SOC_XWR68XX_PIND13_PADAD, SOC_XWR68XX_PIND13_PADAD_CANFD_RX);
    
        MCAN_enableIntr(0xFF500000U, MCAN_INTR_SRC_DEDICATED_RX_BUFF_MSG, 1);
    
        /* Initialize the CANFD driver. */
        canHandle = CANFD_init(0, mcanCfgParams, &errCode);
        if (canHandle == NULL)
        {
            SBL_printf("Error: CANFD Module Initialization failed [Error code %d]\n", errCode);
            return;
        }
    
          mcanBitTimingParams.nomBrp     = 0x2U;
          mcanBitTimingParams.nomPseg1   = 0x14U;
          mcanBitTimingParams.nomPseg2   = 0x5U;
          mcanBitTimingParams.nomSjw     = 0x1U;
    
          mcanBitTimingParams.dataBrp     = 0x1U;
          mcanBitTimingParams.dataPseg1   = 0x4U;
          mcanBitTimingParams.dataPseg2   = 0x3U;
          mcanBitTimingParams.dataSjw     = 0x1U;
    
        retVal = CANFD_configBitTime(canHandle, &mcanBitTimingParams, &errCode);
        if (retVal < 0)
        {
            SBL_printf("Error: CANFD Module configure bit time failed [Error code %d]\n", errCode);
            return;
        }
    
        /*********Update meta image message object has been received. Proceed with downloading
        the image and writing to flash. *******/
        /* Setup the receive message object for receiving data packets. */
        rxMsgObject2Params.direction     = CANFD_Direction_RX;
        rxMsgObject2Params.msgIdType     = CANFD_MCANXidType_11_BIT;
        rxMsgObject2Params.msgIdentifier = SBL_CANFD_DATA_MSG_ID;
        rxMsgObj2Handle                  = CANFD_createMsgObject(canHandle, &rxMsgObject2Params, &errCode);
        if (rxMsgObj2Handle == NULL)
        {
            SBL_printf("Error: CANFD create Rx message object failed [Error code %d]\n", errCode);
            return;
        }
        /* Setup the receive message object for receiving terminate packets. */
        rxMsgObject3Params.direction     = CANFD_Direction_RX;
        rxMsgObject3Params.msgIdType     = CANFD_MCANXidType_11_BIT;
        rxMsgObject3Params.msgIdentifier = SBL_CANFD_TERMINATE_MSG_ID;
        rxMsgObj3Handle                  = CANFD_createMsgObject(canHandle, &rxMsgObject3Params, &errCode);
        if (rxMsgObj3Handle == NULL)
        {
            SBL_printf("Error: CANFD create Rx message object failed [Error code %d]\n", errCode);
            return;
        }
    }

  • Hey Manoj,

    It appears you haven't set the propagation segment for the nominal and data bit timings. The propagation segment, PropSeg, is needed to account for bus propagation delay and the individual phase segments, Pseg1 and Pseg2, are used as separate means of bit timing synchronization. You may have misinterpreted Pseg1 as Tseg1 which is the sum of PropSeg and Pseg1. Therefore, you should use the following PropSeg and Pseg1 values:

    • nomPropSeg = 8
    • nomPseg1 = 6
    • dataPropSeg = 2
    • dataPseg1 = 2

    Please retest with the included PropSeg and adjusted Pseg1 values.

    Regards,

    Kristien

  • Hi Kristien,

    I have tried below configuration,

    mcanBitTimingParams.nomBrp = 0x2U;
    mcanBitTimingParams.nomPropSeg = 0x8U;
    mcanBitTimingParams.nomPseg1 = 0x6U;
    mcanBitTimingParams.nomPseg2 = 0x5U;
    mcanBitTimingParams.nomSjw = 0x1U;

    mcanBitTimingParams.dataBrp = 0x1U;
    mcanBitTimingParams.dataPropSeg = 0x2U;
    mcanBitTimingParams.dataPseg1 = 0x2U;
    mcanBitTimingParams.dataPseg2 = 0x3U;
    mcanBitTimingParams.dataSjw = 0x1U;

    Still facing the same issue. Shall I share my complete code here? 

    Thanks,
    Manoj

  • Hey Manoj,

    As stated before, have you verified there is no error or warning being thrown in PCAN View at all when sending a single message over the PCAN while the SBL is running? If the interrupt is not being triggered at all, I would suspect there to be no ACK which would be visible in PCAN View.

    Regards,

    Kristen

  • Hi Kristien,

    There is a progress in this. I am sharing screenshot below,

    In this screenshot if you see I have put some debug messages in sblDataCallback function. So, now if I try to send the binary over CAN using PCAN it hits this call back and I get debug messages two times (you can see in black window of real term serial terminal).

    "Debug: In sblDataCallback

    Debug: reason = 1

    Debug: retVal = 0

    Debug: gRxPkts = 1

    Debug: gLastMsgFlag = 0

    Debug: In sblDataCallback

    Debug: reason = 1

    Debug: retVal = 0

    Debug: gRxPkts = 2

    Debug: gLastMsgFlag = 0

    Debug: In sblDataCallback

    Debug: reason = 1"

    In above debug messages it shows that call back function hits 2 times since "gRxPkts" incremented to 2. But on third time it gets stuck in that call back where I am getting value of "reason" is 1 but it stuck there.

    So, it looks like now radar is receiving the binary file in 2 chunks but why it gets stuck on third time that need to check. Let me know your suggestions on this.

    Thanks,
    Manoj

  • Hey Manoj,

    I would guess that the program failing after the second message received could be due to a fault when copying over the data from the CAN buffer to the candataBuff. If you had an MMWAVEICBOOST, you could step through and verify if the pointers are initialized and pointing to the correct addresses. Otherwise, I would suggest adding System_printf statements to print the value of the data pointer and dataPtr and value pointed to by ptrDataLength.

    Regards,

    Kristien   

  • Hi Kristien,

    I’ll try to implement this using printf statements as suggested.

    Additionally, I noticed another behavior: when I press the reset button, debug messages appear on the serial terminal, and the system prompts me to press the space bar to upload the binary file over CAN. However, when I press the space bar and start sending the binary, it doesn’t enter the callback function.

    Interestingly, if I first send a random message from PCAN View before transmitting the binary file, the callback function is triggered. Once the callback is triggered by the random message, sending the binary file over CAN will also invoke the callback function. Even after resetting the radar module or turning it off and on again, as long as I try to send the binary file, the radar module accepts it and triggers the callback function twice, as I mentioned earlier.

    It seems that sending a random frame from PCAN View is necessary for the callback function to trigger before the binary file is sent over CAN.

    Thanks,
    Manoj

  • Hi Kristien,

    I was trying to use System_printf in canfd.c to check if it stucks anywhere in CANFD_getData() function. While building the code it is giving me error "function "System_printf" declared implicitly". I tried including its required System.h file in canfd.c file but it didn't work. Any suggestions on this?

    Thanks,
    Manoj

  • Hey Manoj,

    This may be due to an issue with linking or compiling in which the function prototype for System_printf is missing. The XDC tool is called directly to build a package containing the XDC system files which can then be referenced afterwards, but this is only done for demo applications, not libraries. You would have to modify the makefile for the CAN library and call the XDC tool which requires a lot more setup.

    This brings me to my next point: I have to apologize as I won't be able to help you further unless you have an MMWAVEICBOOST. Most of the recent issues we've discussed have been about how to workaround problems that can be solved by having the debugger - e.g., adding print statements to check when the CANFD_getData function is failing vs. stepping through the CANFD_getData function using the debugger. 

    I want to help you, but I don't think my current methods for supporting you are the most efficient use of either of our times at this point. 

    Regards,

    Kristien