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.

CCS/IWR1642: MmwDemo_dssMmwaveConfigCallbackFxn function

Part Number: IWR1642

Tool/software: Code Composer Studio

Hi,

The callback fucntion MmwDemo_dssMmwaveConfigCallbackFxn is assigned to initCfg which is then sent to MMWave_init function.

I couldn't understand when the callback function will be called?

and where does the parameter ptrCtrlCfg of MmwDemo_dssMmwaveConfigCallbackFxn come from?

static void MmwDemo_dssMmwaveConfigCallbackFxn(MMWave_CtrlCfg* ptrCtrlCfg)
{
    /* Save the configuration */
    memcpy((void *)(&gMmwDssMCB.cfg.ctrlCfg), (void *)ptrCtrlCfg, sizeof(MMWave_CtrlCfg));

    gMmwDssMCB.stats.configEvt++;

    /* Post event to notify configuration is done */
    Event_post(gMmwDssMCB.eventHandle, MMWDEMO_CONFIG_EVT);

    return;
}

Thanks and Best Regards,

Ardeal

  • Hi Ardeal,

    I assume you are referring to SDK 2.1.0.4.

    The call back function is registered with the mmwave library during initialization as shown below (dss_main.c line 2751) 

        /************************************************************************
         * mmwave library initialization
         ************************************************************************/
    
        /* Populate the init configuration for mmwave library: */
        initCfg.domain                      = MMWave_Domain_DSS;
        initCfg.socHandle                   = gMmwDssMCB.socHandle;
        initCfg.eventFxn                    = MmwDemo_dssMmwaveEventCallbackFxn;
        initCfg.linkCRCCfg.useCRCDriver     = 1U;
        initCfg.linkCRCCfg.crcChannel       = CRC_Channel_CH1;
        initCfg.cfgMode                     = MMWave_ConfigurationMode_FULL;
        initCfg.executionMode               = MMWave_ExecutionMode_COOPERATIVE;
        initCfg.cooperativeModeCfg.cfgFxn   = MmwDemo_dssMmwaveConfigCallbackFxn;
        initCfg.cooperativeModeCfg.startFxn = MmwDemo_dssMmwaveStartCallbackFxn;
        initCfg.cooperativeModeCfg.stopFxn  = MmwDemo_dssMmwaveStopCallbackFxn;
        initCfg.cooperativeModeCfg.openFxn  = MmwDemo_dssMmwaveOpenCallbackFxn;
        initCfg.cooperativeModeCfg.closeFxn = MmwDemo_dssMmwaveCloseCallbackFxn;
    
        /* Initialize and setup the mmWave Control module */
        gMmwDssMCB.ctrlHandle = MMWave_init (&initCfg, &errCode);

    As shown in the function comments, this function is called by the mmwave library when it has completed the BSS configuration. You can put a breakpoint in this function before sending the sensor configuration and it should be called when the configuration is complete.

    /**
     *  @b Description
     *  @n
     *      Registered config callback function on DSS which is invoked by MMWAVE library when the remote side
     *  has finished configure mmWaveLink and BSS. The configuration need to be saved on DSS and used for DataPath.
     *
     *  @param[in]  ptrCtrlCfg
     *      Pointer to the control configuration
     *
     *  @retval
     *      Not applicable
     */
    static void MmwDemo_dssMmwaveConfigCallbackFxn(MMWave_CtrlCfg* ptrCtrlCfg)
    {
        /* Save the configuration */
        memcpy((void *)(&gMmwDssMCB.cfg.ctrlCfg), (void *)ptrCtrlCfg, sizeof(MMWave_CtrlCfg));
    
        gMmwDssMCB.stats.configEvt++;
    
        /* Post event to notify configuration is done */
        Event_post(gMmwDssMCB.eventHandle, MMWDEMO_CONFIG_EVT);
    
        return;
    }

    Thanks

    -Nitin

  • HI Nitin,

    Many thanks for your reply!

    as you mentioned:

    this function is called by the mmwave library when it has completed the BSS configuration.

    Does this mean that this callback function will be called when BSS sends a certain command to DSS?

    what command will be sent to DSS to invoke this callback function?  Could you please point out the piece of BSS code which will send command to DSS and invoke this callback function?

    when this callback function is called, how to generate the input parameter ptrCtrCfg? Is the parameter sent from BSS by mailbox message?

    is the message(ptrCtrCfg) configured in config file(xwr1642_profile_VitalSigns_20fps_Front.cfg)?

    Thanks and Best Regards,

    Ardeal

  • Hi Ardeal,

    We do not provide source for the BSS firmware. The application code interfaces with the BSS (i.e. the firmware running on the BSS) through the mmWaveLink API which is provided in the SDK at the following location:

    C:\ti\mmwave_sdk_03_04_00_03\packages\ti\control\mmwavelink. Details of this API are available in the HTML documentation

    at: C:\ti\mmwave_sdk_03_04_00_03\packages\ti\control\mmwavelink\docs\doxygen\html\index.html

    The SDK also includes the high level mmWave API which abstracts the low level mmwavelink API into simple application level calls. This is the API used in the out of box demo and all other demos. For example: The function MMWave_init is part of the high level mmwave API. Details of this API are available in the HTML documentation at:

    C:\ti\mmwave_sdk_03_04_00_03\packages\ti\control\mmwave\docs\doxygen\html\index.html

    Armed with the above resources, you should be able to follow the code for MMWave_init function into the mmWave API and see where the function pointer for the above call back is registered inside the mmWave layer and then invoked on which event from the BSS. I would also follow the same path and hence would leave this as a learning exercise for you.

    Regards

    -Nitin

     

  • Hi,

    One more question:

    static int32_t MmwDemo_dssDataPathConfig(void)
    {
        int32_t             retVal = 0;
        MMWave_CtrlCfg      *ptrCtrlCfg;
        MmwDemo_DSS_DataPathObj *dataPathObj;
        uint8_t subFrameIndx;
    
        /* Get data path object and control configuration */
        ptrCtrlCfg   = &gMmwDssMCB.cfg.ctrlCfg;
    
        if (ptrCtrlCfg->dfeDataOutputMode == MMWave_DFEDataOutputMode_ADVANCED_FRAME)
        {
            gMmwDssMCB.numSubFrames =
                ptrCtrlCfg->u.advancedFrameCfg.frameCfg.frameSeq.numOfSubFrames;
        }
        else
        {
            gMmwDssMCB.numSubFrames = 1;
        }
    

    in above code, when is gMmwDssMCB.cfg.ctrlCfg initialized? Could you please tell me the location where gMmwDssMCB.cfg.ctrlCfg is initialized?

    Thanks and Best Regards,

    Ardeal

  • I couldn't figure out when and where the member is initialized?

    rlUInt16_t numAdcSamples;

    Thanks and Best Regards,

    Ardeal

  • Hi,

    Please refer to the System startup flow provided in the html documentation at the following path. Let us know if you are not able to get the required information.

    file:///C:/ti/mmwave_sdk_02_01_00_04/packages/ti/demo/xwr16xx/mmw/docs/doxygen/html/index.html

    Regards

    -Nitin