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.

IWR6843AOP: TI Rtos Crashes When Calling MMWave_Open

Part Number: IWR6843AOP
Other Parts Discussed in Thread: SYSBIOS

Hello, I am developing an application for the IWR6843AOP and am having issues related to opening the mmwave sensor. Whenever I call MMWave_open and pass it my MMWave_Handle, MMWave_OpenCfg, and MMWave_CalibrationData. The operating system gives me the following error, I am using mmwave_sdk_03_05_00_04:

{module#36}: line 449: error {id:0xa0000, args:[0x8001e10, 0x0]}
xdc.runtime.Error.raise: terminating execution

The crash is ultimately occurring in the line that opens the mmwavelink within MMWave_Open:

retVal = MMWave_openLink (ptrMMWaveMCB, ptrCalibrationData, errCode);

MMWave_openLink is failing here:

line 1757 in mmwave_link.c: retVal = rlRfSetCalMonTimeUnitConfig(RL_DEVICE_MAP_INTERNAL_BSS, &timeCfg);

rlRfSetCalMonTimeUnitConfig is failing here:

line 2381 in rl_sensor.h: retVal = rlDriverExecuteSetApi(deviceMap, RL_RF_DYNAMIC_CONF_SET_MSG, RL_RF_CALIB_MON_TIME_UNIT_SB, rlUInt8_t*)data, rlUInt16_t)sizeof(rlRfCalMonTimeUntConf_t));

rlDriverExecuteSetApi is failing here:

line 3118 in rl_driver.c: retVal = rlDriverCmdInvoke(deviceMap, inMsg, &outMsg);

rlDriverCmdInvoke is failing here:

line 2740 in rl_driver.c: retVal = rlDriverCmdSendRetry(deviceMap, outMsg);

At this point the optimizations make it very difficult to trace through the error, but at this point the function calls are no longer being made with the input variables I provided and are being called with local variables needed by the various functions.

The task calls MMWave_init, MMWave_flushCfg, and MMWave_sync all prior to calling MMWave_open without errors or bad return codes.

My task size stack is 4096, which is larger than what the demo use to run and initialize the sensor combined, so that is likely not the issue, dramatically increasing the stack size has not solved the problem.

The initial config for the MMWave sensor is as follows:

g_tiMmWaveInitCfg.cfgMode = MMWave_ConfigurationMode_FULL;
g_tiMmWaveInitCfg.domain = MMWave_Domain_MSS;
g_tiMmWaveInitCfg.eventFxn = tks_MMWave_eventFxn;
g_tiMmWaveInitCfg.executionMode = MMWave_ExecutionMode_ISOLATION;
g_tiMmWaveInitCfg.linkCRCCfg.crcChannel = CRC_Channel_CH1;
g_tiMmWaveInitCfg.linkCRCCfg.useCRCDriver = 1U;
g_tiMmWaveInitCfg.socHandle = g_tiSocHandle;

The calibration data is a nullptr, as per the documentation, this an acceptable value:

MMWave_CalibrationData* tempCalData = nullptr;

The MMWave_OpenCfg data is populated as follows:

m_mmWaveOpenCfg->freqLimitLow = 600U;
m_mmWaveOpenCfg->freqLimitHigh = 640U;

m_mmWaveOpenCfg->disableFrameStartAsyncEvent = false;
m_mmWaveOpenCfg->disableFrameStopAsyncEvent = false;

m_mmWaveOpenCfg->useCustomCalibration = false;
m_mmWaveOpenCfg->customCalibrationEnableMask = 0x0;

m_mmWaveOpenCfg->calibMonTimeUnit = 1;
m_mmWaveOpenCfg->adcOutCfg.fmt.b2AdcBits = 2;
m_mmWaveOpenCfg->adcOutCfg.fmt.b2AdcOutFmt = 1;
m_mmWaveOpenCfg->lowPowerMode.lpAdcMode = 0;

m_mmWaveOpenCfg->chCfg.rxChannelEn = 15;
m_mmWaveOpenCfg->chCfg.txChannelEn = 7;
m_mmWaveOpenCfg->chCfg.cascading = 0;

  • To follow up on this, our team has determined that all of the config values are not causing issues outside of:

    m_mmWaveOpenCfg->calibMonTimeUnit = 1;

    Which causes the rtos to crash with the error:
    {module#35}: line 222: error {id:0x10000, args:[0x18a68, 0x18a6c]}
    xdc.runtime.Error.raise: terminating execution

    Commenting out this line makes MMWave_open() run, but populates an error code of: -205062142 and a return code of: -1

    All of the demo's we look through set calibMonTimeUnit to 1 so we are puzzled why this is causing errors for us.

  • Hi, 

    Thank you for your post and for the detailed explanation of where the issue seems to occur. Unfortunately, the RTOS error info is rarely very helpful in identifying the issue in the application. Though, from experience I can say that the xdc.runtime.Error often comes when execution gets hung up somewhere. 

    calibMonTimeUnit = 1; should be fine also. As you mentioned that is used in many demos without issue. 

    In developing your application, have you started from one of our examples (i.e. the Out-of-Box demo)? If so, how extensive are your changes? It may of course be difficult for us to identify the root cause of an issue in custom code but since you already seem to have narrowed down where the issue is coming from I can try to help identify the potential problem. Please let me look at this a bit deeper and get back to you next week. 

    Best regards,

    Josh

  • The code is pretty different from the provided demos, but the setup should be very similar. We added a task delay after calling MMWave_Sync() and discarded our custom hardware mailbox configurations for the time being and that has gotten us further through MMWave_Open().

    We are still stuck in MMWave_openLink, but we now are stuck in MMWave_internalLinkSync forever.

    Line 1956 of mmwave_link.c:     MMWave_internalLinkSync(ptrMMWaveMCB, MMWAVE_RF_INITIALIZED | MMWAVE_RF_INIT_FAILED);

    We also have come across a different forum post determining that the ldo bypass config needs to be set like so:

    g_rfLdoBypassCfg.ldoBypassEnable = 3;
    g_rfLdoBypassCfg.supplyMonIrDrop = 1;
    g_rfLdoBypassCfg.ioSupplyIndicator = 0;

    But we are not seeing success with this value or all 0's for the iwr6843aop evm.

  • Hello, we are still having issues within the MMWave_open() function. As described in my post above, our code is stuck within:

    Line 1956 of mmwave_link.c:     MMWave_internalLinkSync(ptrMMWaveMCB, MMWAVE_RF_INITIALIZED | MMWAVE_RF_INIT_FAILED);

    When calling MMWave_open() and while loop runs infinitely. Our code is not setting up the datapath yet, is that necessary for this function to complete correctly?

  • We've determined that the only place the flag MMWAVE_RF_INITIALIZED gets set for ptrMMWaveMCB->linkStatus within MMWave_internalLinkSync() is through the MMWave_asyncEventHandler (line 685 of mmwave_link.c). This callback should not have anything to do with our code and should get set up when we call MMWave_init() with the initial configuration we already provided. Additionally we have attached our own callback to the mmwave init config which should be getting called after the async handler does it's logic (line 769 of mmwave_link.c). We are never entering our custom callback which leads us to believe that the MMWave_asyncEventHandler is never getting called despite MMWave_init() running successfully with an error code of 0 and returning a handle.

    What are we missing? From what we can tell, we need MMWave_asyncEventHandler to pre-empt us and release the linkStatus flag. Yet this never happens.

  • Hello, 

    Sorry for the delay here and thank you for the additional information. 

    From what we can tell, we need MMWave_asyncEventHandler to pre-empt us and release the linkStatus flag.

    This is correct. So either the async event message from the BSS is never sent or it is sent but it is never received. I'm curious if the event message is missed due to priority issue. What is the priority of your task? Are any additional tasks created?

    I am reaching out internally to our software dev team to confirm if there are any potential issues with what you have told me about your setup. I will update you within the next 1-2 days. Thank you for your patience.

    Please also let me know if there are any other major differences when comparing your code with the initialization in the out of box demo.

    Best Regards,

    Josh

  • The project our team is working on is predominately written in c++ so it structurally differs a lot from the out of box demo. We have gone through the majority of the demo located in mmwave_sdk_03_05_00_04\packages\ti\demo\xwr64xx\mmw to base our hardware initialization off of. Our understanding is this should work as well for the iwr6843aop because the 64xx lacks a dsp and we want to develop a project that excludes the dsp for a minimum viable product.

    We have 5 operating tasks: Blink, Data_Transmitter, Datapath, MMWave, and Init.

    Blink operates the led to report operating status easily to the developer, it is the lowest priority (1) and runs at ~2hz.

    Data_Transmitter will be responsible for outputting data over the higher speed write only uart (uart3) and is event based over a sysbios mailbox. Since we are not currently publishing to this mailbox it should be waiting forever and not interfering with the rtos:

            Mailbox_pend(
                m_mailbox,
                m_dataTransmitterBuffer,
                BIOS_WAIT_FOREVER);

    Datapath will run DPM execute and do the post processing of the results buffer. This task is not implemented yet as we want to get the mmwave radar running before attempting to process the data.

    MMWave is responsible for running MMWave execute and that is it. It waits on a semaphore for init to complete.

    //Within the mmwave task
    
    Semaphore_pend(
        *m_initCompleteSemaphore,
        BIOS_WAIT_FOREVER);
    
    while (true)
    {
        m_mmWaveController->execute();
        Task_sleep(500);
    }

    For context m_mmWaveController->execute() essentially is just:

    retCode = MMWave_execute(
        *m_mmWaveHandle,
        &errCode);

    There's a bit more of business protection code, but it does not effect MMWave_execute from getting called when the object is correctly set up.

    Init does all initialization that is required to happen within a task. Most of our hardware is set up before we start the bios. The documentation does say we need to create our mmwave handle within a task context as well as the dpm. The init task is responsible for doing both of these things. For the mmwave it calls: 

    • MMWave_init
    • MMWave_flushCfg
    • MMWave_sync
    • MMWave_addProfile
    • MMWave_addChirp (3 times)
    • Task_sleep(5000)
    • MMWave_open -> stuck here
    • MMWave_config
    • MMWave_start

    The intention is to then release the semaphore for the MMWave task which would allow execute to run. We can call execute part way through init in the MMWave task, but since it just pends on a semaphore itself, we don't think we have to have execute waiting for MMWave_open to work. In fact, we tried switching our order around for this to happen, and it didn't fix our problem.

    The tasks priorities are as listed:

    enum TaskPriorities : uint8_t
    {
        BLINK = 1,
        DATA_TRANSMITTER,
        DATAPATH,
        MMWAVE,
        INIT,
    };

    So Init, which calls MMWave_open, is currently our most important task. It seems unlikely then that task priorities would be the reason we do not receive this callback.

  • We went and got a print out of the BSS' rlFwVersionParam if that helps.

    BSS: 
    hwVarient: 6
    hwMajor: 2
    hwMinor: 0
    fwMajor: 6
    fwMinor: 3
    fwBuild: 2
    fwDebug: 6
    fwYear: 20
    fwMonth: 8
    fwDay: 11
    patchMajor: 0
    patchMinor: 0
    patchYear: 0
    patchMonth: 0
    patchDay: 0
    patchBuildDebug: 0

  • For anyone that comes across this in the future, if you are stuck within the MMWave_internalLinkSync() function, you are not calling MMWave_execute(). That function will allow the 'interrupt' to work. So the function that calls MMWave_execute() must be continuously called from a higher priority task than the one that calls MMWave_open().