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/AWR1642BOOST: Issue Debugging a modified Traffic Monitoring project

Part Number: AWR1642BOOST
Other Parts Discussed in Thread: SYSBIOS, AWR1642

Tool/software: Code Composer Studio

I'm trying to hardcode a cfg in traffic monitoring lab, and I have modified cli.c as follows:

/*
 *   @file  cli.c
 *
 *   @brief
 *      Mmw (Milli-meter wave) DEMO CLI Implementation
 *
 *  Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ 
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *    Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 *    Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the
 *    distribution.
 *
 *    Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/**************************************************************************
 *************************** Include Files ********************************
 **************************************************************************/

/* Standard Include Files. */
#include <stdint.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>

/* BIOS/XDC Include Files. */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/IHeap.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/Memory.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Event.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/heaps/HeapBuf.h>
#include <ti/sysbios/heaps/HeapMem.h>
#include <ti/sysbios/knl/Event.h>

/* mmWave SDK Include Files: */
#include <ti/common/sys_common.h>
#include <ti/drivers/uart/UART.h>
#include <ti/drivers/osal/MemoryP.h>
#include <ti/drivers/osal/DebugP.h>
#include <ti/control/mmwavelink/mmwavelink.h>
#include <ti/utils/cli/cli.h>

#include <gtrack.h>

/* Demo Include Files */
#include "mss_mmw.h"
#include <common/mmw_messages.h>
//#include "customcfg.h"

/**************************************************************************
 *************************** Local Definitions ****************************
 **************************************************************************/

/******************************TYPEDEF*************************************/
typedef struct String_Cfg_Cmds_t
{
    /*! @brief   */
    char*                 sensorStop[1];

    /*! @brief   */
    char*                   flushCfg[1];

    /*! @brief   */
    char*          dfeDataOutputMode[2];

    /*! @brief   */
    char*                 channelCfg[4];

    /*! @brief   */
    char*                     adcCfg[3];

    /*!@brief    */
    char*                  adcbufCfg[5];

    /*! @brief   */
    char*                profileCfg[15];

    /*! @brief   */
    char*                  chirpCfg1[9];

    /*! @brief   */
    char*                  chirpCfg2[9];

    /*! @brief   */
    char*                   lowPower[3];

    /*! @brief   */
    char*                 guiMonitor[5];

    /*! @brief   */
    char*                   cfarCfg[12];

    /*! @brief   */
    char*                     doaCfg[8];

    /*! @brief   */
    char*              sceneryParam[19];

    /*! @brief   */
    char*                gatingParam[5];

    /*! @brief   */
    char*                 stateParam[6];

    char*            allocationParam[7];

    char*             variationParam[4];

    char*                trackingCfg[9];

    char*            compRangeBiasAndRxChanPhase[18];

    char*                   frameCfg[8];

    /*! @brief   */
    char*                sensorStart[1];

} String_Cfg_Cmds;

/* CLI Extended Command Functions */
static int32_t MmwDemo_CLICfarCfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIDoACfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLISensorStart (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIFrameStart (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLISensorStop (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIGuiMonSel (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLISetDataLogger (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLIADCBufCfg (int32_t argc, char* argv[]);
static int32_t MmwDemo_CLICompRangeBiasAndRxChanPhaseCfg (int32_t argc, char* argv[]);

/* Tracking configuration is done by application */
extern int32_t MmwDemo_CLITrackingCfg (int32_t argc, char* argv[]);

/* SceneryParam configuration is done by application */
extern int32_t MmwDemo_CLISceneryParamCfg (int32_t argc, char* argv[]);
/* GatingParam configuration is done by application */
extern int32_t MmwDemo_CLIGatingParamCfg (int32_t argc, char* argv[]);
/* StateParam configuration is done by application */
extern int32_t MmwDemo_CLIStateParamCfg (int32_t argc, char* argv[]);
/* AllocationParam configuration is done by application */
extern int32_t MmwDemo_CLIAllocationParamCfg (int32_t argc, char* argv[]);
/* VariationParam configuration is done by application */
extern int32_t MmwDemo_CLIVariationParamCfg (int32_t argc, char* argv[]);

extern int32_t CLI_MMWaveExtensionHandler(int32_t argc, char* argv[]);


/**************************************************************************
 *************************** External Definitions *************************
 **************************************************************************/
extern MmwDemo_MCB    gMmwMssMCB;
extern int32_t MmwDemo_mboxWrite(MmwDemo_message     * message);
extern void MmwDemo_printHeapStats(void);

/**************************************************************************
 *************************** CLI  Function Definitions **************************
 **************************************************************************/

/**
 *  @b Description
 *  @n
 *      This is the CLI Handler for the sensor start command
 *
 *  @param[in] argc
 *      Number of arguments
 *  @param[in] argv
 *      Arguments
 *
 *  @retval
 *      Success -   0
 *  @retval
 *      Error   -   <0
 *
 */


/************************************************************************************************************************
 * **************************************************  CODIGO NUEVO******************************************************
 * *********************************************************************************************************************/

void MmwDemo_CfgWithCmdString (uint32_t num_arg, char* cmd[])
{
    if(         strcmp("sensorStart",          cmd[0]) == 0)
                MmwDemo_CLISensorStart         (num_arg, cmd);

    else if(    strcmp("sensorStop",          cmd[0]) == 0)
                MmwDemo_CLISensorStop          (num_arg, cmd);

    else if(    strcmp("guiMonitor",          cmd[0]) == 0)
                MmwDemo_CLIGuiMonSel(num_arg, cmd);

    else if(    strcmp("cfarCfg",          cmd[0]) == 0)
                MmwDemo_CLICfarCfg  (num_arg, cmd);

    else if(    strcmp("doaCfg",          cmd[0]) == 0)
                MmwDemo_CLIDoACfg (num_arg, cmd);

    else if(    strcmp("trackingCfg",          cmd[0]) == 0)
                MmwDemo_CLITrackingCfg(num_arg, cmd);

    else if(    strcmp("adcbufCfg",          cmd[0]) == 0)
                MmwDemo_CLIADCBufCfg(num_arg, cmd);

    else if(    strcmp("compRangeBiasAndRxChanPhase",          cmd[0]) == 0)
                MmwDemo_CLICompRangeBiasAndRxChanPhaseCfg(num_arg, cmd);

    else if(    strcmp("sceneryParam",          cmd[0]) == 0)
                MmwDemo_CLISceneryParamCfg(num_arg, cmd);

    else if(    strcmp("gatingParam",          cmd[0]) == 0)
                MmwDemo_CLIGatingParamCfg(num_arg, cmd);

    else if(    strcmp("stateParam",          cmd[0]) == 0)
                MmwDemo_CLIStateParamCfg(num_arg, cmd);

    else if(    strcmp("allocationParam",          cmd[0]) == 0)
                MmwDemo_CLIAllocationParamCfg(num_arg, cmd);

    else if(    strcmp("variationParam",          cmd[0]) == 0)
                MmwDemo_CLIVariationParamCfg(num_arg, cmd);


    else
                CLI_MMWaveExtensionHandler    (num_arg, cmd);

    return;
}

/**
 *  @b Description
 *  @n
 *      Creo una estructura de tipo String_Cfg_Cmds y la lleno con los valores de la configuración
 *
 *  @param[in] cmd
 *      Commands
 *
 *  @retval
 *      Not Applicable.
 */
void customcfg1(void)
{
    String_Cfg_Cmds iniCfgCmds; //vector de punteros
    uint32_t c = 0;

    iniCfgCmds.sensorStop[0] = "sensorStop";

    iniCfgCmds.flushCfg[0] = "flushCfg";

    iniCfgCmds.dfeDataOutputMode[0] = "dfeDataOutputMode";
    iniCfgCmds.dfeDataOutputMode[1] = "1";

    iniCfgCmds.channelCfg[0] = "channelCfg";
    iniCfgCmds.channelCfg[1] = "15";
    iniCfgCmds.channelCfg[2] = "3";
    iniCfgCmds.channelCfg[3] = "0";

    iniCfgCmds.adcCfg[0] = "adcCfg";
    iniCfgCmds.adcCfg[1] = "2";
    iniCfgCmds.adcCfg[2] = "1";

    iniCfgCmds.adcbufCfg[0] = "adcbufCfg";
    iniCfgCmds.adcbufCfg[1] = "0";
    iniCfgCmds.adcbufCfg[2] = "1";
    iniCfgCmds.adcbufCfg[3] = "1";
    iniCfgCmds.adcbufCfg[4] = "1";

    iniCfgCmds.profileCfg [0] = "profileCfg";
    iniCfgCmds.profileCfg[ 1] = "0";
    iniCfgCmds.profileCfg[ 2] = "76";
    iniCfgCmds.profileCfg[ 3] = "15";
    iniCfgCmds.profileCfg[ 4] = "6.5";
    iniCfgCmds.profileCfg[ 5] = "48.3";
    iniCfgCmds.profileCfg[ 6] = "0";
    iniCfgCmds.profileCfg[ 7] = "0";
    iniCfgCmds.profileCfg[ 8] = "7.481";
    iniCfgCmds.profileCfg[ 9] = "1";
    iniCfgCmds.profileCfg[10] = "125";
    iniCfgCmds.profileCfg[11] = "3117";
    iniCfgCmds.profileCfg[12] = "0";
    iniCfgCmds.profileCfg[13] = "0";
    iniCfgCmds.profileCfg[14] = "48";

    iniCfgCmds.chirpCfg1[0] = "chirpCfg";
    iniCfgCmds.chirpCfg1[1] = "0";
    iniCfgCmds.chirpCfg1[2] = "0";
    iniCfgCmds.chirpCfg1[3] = "0";
    iniCfgCmds.chirpCfg1[4] = "0";
    iniCfgCmds.chirpCfg1[5] = "0";
    iniCfgCmds.chirpCfg1[6] = "0";
    iniCfgCmds.chirpCfg1[7] = "0";
    iniCfgCmds.chirpCfg1[8] = "1";

    iniCfgCmds.chirpCfg2[0] = "chirpCfg";
    iniCfgCmds.chirpCfg2[1] = "1";
    iniCfgCmds.chirpCfg2[2] = "1";
    iniCfgCmds.chirpCfg2[3] = "0";
    iniCfgCmds.chirpCfg2[4] = "0";
    iniCfgCmds.chirpCfg2[5] = "0";
    iniCfgCmds.chirpCfg2[6] = "0";
    iniCfgCmds.chirpCfg2[7] = "0";
    iniCfgCmds.chirpCfg2[8] = "2";

    iniCfgCmds.frameCfg[0] = "frameCfg";
    iniCfgCmds.frameCfg[1] = "0";
    iniCfgCmds.frameCfg[2] = "1";
    iniCfgCmds.frameCfg[3] = "125";
    iniCfgCmds.frameCfg[4] = "0";
    iniCfgCmds.frameCfg[5] = "33.3";
    iniCfgCmds.frameCfg[6] = "1";
    iniCfgCmds.frameCfg[7] = "0"; //frame delay upon sensor startup; change this value between different sensors to avoid sensor cross-interference

    iniCfgCmds.lowPower[0]= "lowPower";
    iniCfgCmds.lowPower[1]= "0";
    iniCfgCmds.lowPower[2]= "1";

    iniCfgCmds.guiMonitor[0] = "guiMonitor";
    iniCfgCmds.guiMonitor[1] = "1";
    iniCfgCmds.guiMonitor[2] = "0";
    iniCfgCmds.guiMonitor[3] = "0";
    iniCfgCmds.guiMonitor[4] = "0";


    iniCfgCmds.cfarCfg[0] = "cfarCfg";
    iniCfgCmds.cfarCfg[1] = "4";
    iniCfgCmds.cfarCfg[2] = "4";
    iniCfgCmds.cfarCfg[3] = "15";
    iniCfgCmds.cfarCfg[4] = "16";
    iniCfgCmds.cfarCfg[5] = "8";
    iniCfgCmds.cfarCfg[6] = "6";
    iniCfgCmds.cfarCfg[7] = "0";
    iniCfgCmds.cfarCfg[8] = "63";
    iniCfgCmds.cfarCfg[9] = "63";
    iniCfgCmds.cfarCfg[10] = "0";
    iniCfgCmds.cfarCfg[11] = "1";

    iniCfgCmds.doaCfg[0] = "doaCfg";
    iniCfgCmds.doaCfg[1] = "1";
    iniCfgCmds.doaCfg[2] = "0";
    iniCfgCmds.doaCfg[3] = "1047";
    iniCfgCmds.doaCfg[4] = "3";
    iniCfgCmds.doaCfg[5] = "600";
    iniCfgCmds.doaCfg[6] = "10";
    iniCfgCmds.doaCfg[7] = "100";

    iniCfgCmds.sceneryParam[0] = "sceneryParam";
    iniCfgCmds.sceneryParam[1] = "1";
    iniCfgCmds.sceneryParam[2] = "-15";
    iniCfgCmds.sceneryParam[3] = "15";
    iniCfgCmds.sceneryParam[4] = "0.0";
    iniCfgCmds.sceneryParam[5] = "75.0";
    iniCfgCmds.sceneryParam[6] = "0";
    iniCfgCmds.sceneryParam[7] = "0";
    iniCfgCmds.sceneryParam[8] = "0";
    iniCfgCmds.sceneryParam[9] = "0";
    iniCfgCmds.sceneryParam[10] = "1";
    iniCfgCmds.sceneryParam[11] = "1.25";
    iniCfgCmds.sceneryParam[12] = "11.0";
    iniCfgCmds.sceneryParam[13] = "20.0";
    iniCfgCmds.sceneryParam[14] = "50.0";
    iniCfgCmds.sceneryParam[15] = "0";
    iniCfgCmds.sceneryParam[16] = "0";
    iniCfgCmds.sceneryParam[17] = "0";
    iniCfgCmds.sceneryParam[18] = "0";

    iniCfgCmds.gatingParam[0] = "gatingParam";
    iniCfgCmds.gatingParam[1] = "12";
    iniCfgCmds.gatingParam[2] = "8";
    iniCfgCmds.gatingParam[3] = "4";
    iniCfgCmds.gatingParam[4] = "0";

    iniCfgCmds.stateParam[0] = "stateParam";
    iniCfgCmds.stateParam[1] = "3";
    iniCfgCmds.stateParam[2] = "10";
    iniCfgCmds.stateParam[3] = "20";
    iniCfgCmds.stateParam[4] = "2000";
    iniCfgCmds.stateParam[5] = "10";

    iniCfgCmds.allocationParam[0] = "allocationParam";
    iniCfgCmds.allocationParam[1] = "30";
    iniCfgCmds.allocationParam[2] = "60";
    iniCfgCmds.allocationParam[3] = "1.0";
    iniCfgCmds.allocationParam[4] = "3";
    iniCfgCmds.allocationParam[5] = "2.8";
    iniCfgCmds.allocationParam[6] = "2.0";

    iniCfgCmds.variationParam[0] = "variationParam";
    iniCfgCmds.variationParam[1] = "1.15";
    iniCfgCmds.variationParam[2] = "0.433";
    iniCfgCmds.variationParam[3] = "1.0";

    iniCfgCmds.trackingCfg[0] = "trackingCfg";
    iniCfgCmds.trackingCfg[1] = "1";
    iniCfgCmds.trackingCfg[2] = "1";
    iniCfgCmds.trackingCfg[3] = "250";
    iniCfgCmds.trackingCfg[4] = "20";
    iniCfgCmds.trackingCfg[5] = "78";
    iniCfgCmds.trackingCfg[6] = "110";
    iniCfgCmds.trackingCfg[7] = "33";
    iniCfgCmds.trackingCfg[8] = "90";

    iniCfgCmds.compRangeBiasAndRxChanPhase[0] = "compRangeBiasAndRxChanPhase";
    iniCfgCmds.compRangeBiasAndRxChanPhase[1] = "0";
    iniCfgCmds.compRangeBiasAndRxChanPhase[2] = "1";
    iniCfgCmds.compRangeBiasAndRxChanPhase[3] = "0";
    iniCfgCmds.compRangeBiasAndRxChanPhase[4] = "1";
    iniCfgCmds.compRangeBiasAndRxChanPhase[5] = "0";
    iniCfgCmds.compRangeBiasAndRxChanPhase[6] = "1";
    iniCfgCmds.compRangeBiasAndRxChanPhase[7] = "0";
    iniCfgCmds.compRangeBiasAndRxChanPhase[8] = "1";
    iniCfgCmds.compRangeBiasAndRxChanPhase[9] = "0";
    iniCfgCmds.compRangeBiasAndRxChanPhase[10] = "1";
    iniCfgCmds.compRangeBiasAndRxChanPhase[11] = "0";
    iniCfgCmds.compRangeBiasAndRxChanPhase[12] = "1";
    iniCfgCmds.compRangeBiasAndRxChanPhase[13] = "0";
    iniCfgCmds.compRangeBiasAndRxChanPhase[14] = "1";
    iniCfgCmds.compRangeBiasAndRxChanPhase[15] = "0";
    iniCfgCmds.compRangeBiasAndRxChanPhase[16] = "1";
    iniCfgCmds.compRangeBiasAndRxChanPhase[17] = "0";

    iniCfgCmds.sensorStart[0] = "sensorStart";




    //llamo a las funciones de CLI con los valores de iniCfgCmds

    MmwDemo_CfgWithCmdString ( 1, iniCfgCmds.sensorStop         );
    for (c = 1 ; c <= 50000000 ; c++); //this delay ensures the sensor stops
    MmwDemo_CfgWithCmdString ( 1, iniCfgCmds.flushCfg           );
    MmwDemo_CfgWithCmdString ( 2, iniCfgCmds.dfeDataOutputMode  );
    MmwDemo_CfgWithCmdString ( 4, iniCfgCmds.channelCfg         );
    MmwDemo_CfgWithCmdString ( 3, iniCfgCmds.adcCfg             );
    MmwDemo_CfgWithCmdString ( 5, iniCfgCmds.adcbufCfg          );
    MmwDemo_CfgWithCmdString (15, iniCfgCmds.profileCfg         );
    MmwDemo_CfgWithCmdString ( 9, iniCfgCmds.chirpCfg1          );
    MmwDemo_CfgWithCmdString ( 9, iniCfgCmds.chirpCfg2          );
    MmwDemo_CfgWithCmdString ( 3, iniCfgCmds.lowPower           );
    MmwDemo_CfgWithCmdString ( 5, iniCfgCmds.guiMonitor         );
    MmwDemo_CfgWithCmdString ( 12, iniCfgCmds.cfarCfg           );
    MmwDemo_CfgWithCmdString ( 8, iniCfgCmds.doaCfg             );
    MmwDemo_CfgWithCmdString ( 19, iniCfgCmds.sceneryParam      );
    MmwDemo_CfgWithCmdString ( 5, iniCfgCmds.gatingParam        );
    MmwDemo_CfgWithCmdString ( 6, iniCfgCmds.stateParam         );
    MmwDemo_CfgWithCmdString ( 7, iniCfgCmds.allocationParam    );
    MmwDemo_CfgWithCmdString ( 4, iniCfgCmds.variationParam     );
    MmwDemo_CfgWithCmdString ( 9, iniCfgCmds.trackingCfg        );
    MmwDemo_CfgWithCmdString ( 18, iniCfgCmds.compRangeBiasAndRxChanPhase);
    MmwDemo_CfgWithCmdString ( 1, iniCfgCmds.sensorStart        );

    //System_printf("cfgwithcmdstring");
    return;
}

/*********************************************************************************************************************************************
 * **************************************************  FIN CODIGO NUEVO***********************************************************************
 * ********************************************************************************************************************************************/
static int32_t MmwDemo_CLISensorStart (int32_t argc, char* argv[])
{
    gMmwMssMCB.stats.cliSensorStartEvt ++;

    /* Get the configuration from the CLI mmWave Extension */
    CLI_getMMWaveExtensionConfig (&gMmwMssMCB.cfg.ctrlCfg);

    /* Get the open configuration from the CLI mmWave Extension */
    CLI_getMMWaveExtensionOpenConfig (&gMmwMssMCB.cfg.openCfg);

    /* Post sensorSTart event to notify configuration is done */
    Event_post(gMmwMssMCB.eventHandle, MMWDEMO_CLI_SENSORSTART_EVT);
    return 0;
}

/**
 *  @b Description
 *  @n
 *      This is the CLI Handler for the frame start command
 *
 *  @param[in] argc
 *      Number of arguments
 *  @param[in] argv
 *      Arguments
 *
 *  @retval
 *      Success -   0
 *  @retval
 *      Error   -   <0
 */
static int32_t MmwDemo_CLIFrameStart (int32_t argc, char* argv[])
{
    gMmwMssMCB.stats.cliFrameStartEvt ++;

    /* Post sensorSTart event to notify configuration is done */
    Event_post(gMmwMssMCB.eventHandle, MMWDEMO_CLI_FRAMESTART_EVT);
    return 0;
}


/**
 *  @b Description
 *  @n
 *      This is the CLI Handler for the sensor stop command
 *
 *  @param[in] argc
 *      Number of arguments
 *  @param[in] argv
 *      Arguments
 *
 *  @retval
 *      Success -   0
 *  @retval
 *      Error   -   <0
 */
static int32_t MmwDemo_CLISensorStop (int32_t argc, char* argv[])
{
    gMmwMssMCB.stats.cliSensorStopEvt ++;

    /* Post sensorSTOP event to notify sensor stop command */
    Event_post(gMmwMssMCB.eventHandle, MMWDEMO_CLI_SENSORSTOP_EVT);

    return 0;
}

/**
 *  @b Description
 *  @n
 *      This is the CLI Handler for gui monitoring configuration
 *
 *  @param[in] argc
 *      Number of arguments
 *  @param[in] argv
 *      Arguments
 *
 *  @retval
 *      Success -   0
 *  @retval
 *      Error   -   <0
 */
static int32_t MmwDemo_CLIGuiMonSel (int32_t argc, char* argv[])
{
    MmwDemo_GuiMonSel   guiMonSel;
    MmwDemo_message     message;

    /* Sanity Check: Minimum argument check */
    if (argc != 5)
    {
        CLI_write ("Error: Invalid usage of the CLI command\n");
        return -1;
    }

    /* Initialize the ADC Output configuration: */
    memset ((void *)&guiMonSel, 0, sizeof(MmwDemo_GuiMonSel));

    /* Populate configuration: */
    guiMonSel.detectedObjects           = atoi (argv[1]);
    guiMonSel.logMagRange               = atoi (argv[2]);
    guiMonSel.rangeAzimuthHeatMap       = atoi (argv[3]);
    guiMonSel.rangeDopplerHeatMap       = atoi (argv[4]);

    /* Save Configuration to use later */
    memcpy((void *)&gMmwMssMCB.cfg.guiMonSel, (void *)&guiMonSel, sizeof(MmwDemo_GuiMonSel));
    
    /* Send configuration to DSS */
    memset((void *)&message, 0, sizeof(MmwDemo_message));

    message.type = MMWDEMO_MSS2DSS_GUIMON_CFG;
    memcpy((void *)&message.body.guiMonSel, (void *)&guiMonSel, sizeof(MmwDemo_GuiMonSel));

    if (MmwDemo_mboxWrite(&message) == 0)
        return 0;
    else
        return -1;
}

/**
 *  @b Description
 *  @n
 *      This is the CLI Handler for CFAR configuration
 *
 *  @param[in] argc
 *      Number of arguments
 *  @param[in] argv
 *      Arguments
 *
 *  @retval
 *      Success -   0
 *  @retval
 *      Error   -   <0
 */
static int32_t MmwDemo_CLICfarCfg (int32_t argc, char* argv[])
{
	mmwDemoCfarConfig     cfarCfg;
    MmwDemo_message     message;

    /* Sanity Check: Minimum argument check */
    if (argc != 12)
    {
        CLI_write ("Error: Invalid usage of the CLI command\n");
        return -1;
    }

    /* Initialize the ADC Output configuration: */
    memset ((void *)&cfarCfg, 0, sizeof(mmwDemoCfarConfig));

    //System_printf("CFAR config\n");

    //cliCfg.tableEntry[4].helpString     = "<detMode> <discardLeft> <discardRight> <refWinSize1> <refWinSize2> <guardWinSize1> <guardWinSize2> <thre>";
    /* Populate configuration: */
    cfarCfg.cfarMethod       = (uint16_t) atoi (argv[1]);
    cfarCfg.cfarDiscardLeft  = (uint16_t) atoi (argv[2]);
    cfarCfg.cfarDiscardRight = (uint16_t) atoi (argv[3]);
    cfarCfg.refWinSize[0]    = (uint16_t) atoi (argv[4]);
    cfarCfg.refWinSize[1]    = (uint16_t) atoi (argv[5]);
    cfarCfg.guardWinSize[0]  = (uint16_t) atoi (argv[6]);
    cfarCfg.guardWinSize[1]  = (uint16_t) atoi (argv[7]);
    cfarCfg.thre             = (float) atoi (argv[8]) * 0.1f;
    cfarCfg.dopplerSearchRelThr     = (float) atoi (argv[9]) * 0.1f;
    cfarCfg.log2MagFlag        = (uint16_t) atoi (argv[10]);
    cfarCfg.clRemoval        = (uint16_t) atoi (argv[11]);
    //System_printf("CFAR config:method = %d\n", cfarCfg.cfarMethod);

    /* Save Configuration to use later */
    memcpy((void *)&gMmwMssMCB.cfg.cfarCfg, (void *)&cfarCfg, sizeof(mmwDemoCfarConfig));

    /* Send configuration to DSS */
    memset((void *)&message, 0, sizeof(MmwDemo_message));

    message.type = MMWDEMO_MSS2DSS_CFAR_CFG;
    memcpy((void *)&message.body.cfar, (void *)&cfarCfg, sizeof(mmwDemoCfarConfig));

    if (MmwDemo_mboxWrite(&message) == 0)
        return 0;
    else
        return -1;    
}

/**
 *  @b Description
 *  @n
 *      This is the CLI Handler for DOA configuration
 *
 *  @param[in] argc
 *      Number of arguments
 *  @param[in] argv
 *      Arguments
 *
 *  @retval
 *      Success -   0
 *  @retval
 *      Error   -   <0
 */
static int32_t MmwDemo_CLIDoACfg (int32_t argc, char* argv[])
{
	mmwDemoDoaConfig     doaCfg;
    MmwDemo_message     message;

    /* Sanity Check: Minimum argument check */
    if (argc != 8)
    {
        CLI_write ("Error: Invalid usage of the CLI command\n");
        return -1;
    }

    /* Initialize the ADC Output configuration: */
    memset ((void *)&doaCfg, 0, sizeof(mmwDemoDoaConfig));

    //cliCfg.tableEntry[5].helpString     = "<doaMode> <doaGamma> <sideLobe_dB> <searchRange> <searchRes> <varThre>";
    /* Populate configuration: */
    doaCfg.doaMethod       	= (uint16_t) atoi (argv[1]);
    doaCfg.vmaxUnrollFlag      = (uint8_t) atoi (argv[2]);
    doaCfg.doaGamma            = (float) atoi (argv[3]) * 0.001f;
    doaCfg.doaSideLobeLevel_dB = (uint16_t) atoi (argv[4]);
    doaCfg.doaSearchRange      = (float) atoi (argv[5]) * 0.1f;
    doaCfg.doaSearchRes        = (float) atoi (argv[6]) * 0.1f;
    doaCfg.doaVarThr      		= (float) atoi (argv[7]) * 0.1f;

    /* Save Configuration to use later */
    memcpy((void *)&gMmwMssMCB.cfg.doaCfg, (void *)&doaCfg, sizeof(mmwDemoDoaConfig));

    /* Send configuration to DSS */
    memset((void *)&message, 0, sizeof(MmwDemo_message));

    message.type = MMWDEMO_MSS2DSS_DOA_CFG;
    memcpy((void *)&message.body.doa, (void *)&doaCfg, sizeof(mmwDemoDoaConfig));

    if (MmwDemo_mboxWrite(&message) == 0)
        return 0;
    else
        return -1;
}

/**
 *  @b Description
 *  @n
 *      This is the CLI Handler for data logger set command
 *
 *  @param[in] argc
 *      Number of arguments
 *  @param[in] argv
 *      Arguments
 *
 *  @retval
 *      Success -   0
 *  @retval
 *      Error   -   <0
 */
static int32_t MmwDemo_CLIADCBufCfg (int32_t argc, char* argv[])
{
    MmwDemo_ADCBufCfg   adcBufCfg;
    MmwDemo_message     message;

    /* Sanity Check: Minimum argument check */
    if (argc != 5)
    {
        CLI_write ("Error: Invalid usage of the CLI command\n");
        return -1;
    }

    /* Initialize the ADC Output configuration: */
    memset ((void *)&adcBufCfg, 0, sizeof(MmwDemo_ADCBufCfg));

    /* Populate configuration: */
    adcBufCfg.adcFmt          = (uint8_t) atoi (argv[1]);
    adcBufCfg.iqSwapSel       = (uint8_t) atoi (argv[2]);
    adcBufCfg.chInterleave    = (uint8_t) atoi (argv[3]);
    adcBufCfg.chirpThreshold  = (uint8_t) atoi (argv[4]);

    /* Save Configuration to use later */
    memcpy((void *)&gMmwMssMCB.cfg.adcBufCfg, (void *)&adcBufCfg, sizeof(MmwDemo_ADCBufCfg));

    /* Send configuration to DSS */
    memset((void *)&message, 0, sizeof(MmwDemo_message));
    message.type = MMWDEMO_MSS2DSS_ADCBUFCFG;
    memcpy((void *)&message.body.adcBufCfg, (void *)&adcBufCfg, sizeof(MmwDemo_ADCBufCfg));

    if (MmwDemo_mboxWrite(&message) == 0)
        return 0;
    else
        return -1;
}


/**
 *  @b Description
 *  @n
 *      This is the CLI Handler for compensation of range bias and channel phase offsets
 *
 *  @param[in] argc
 *      Number of arguments
 *  @param[in] argv
 *      Arguments
 *
 *  @retval
 *      Success -   0
 *  @retval
 *      Error   -   <0
 */
static int32_t MmwDemo_CLICompRangeBiasAndRxChanPhaseCfg (int32_t argc, char* argv[])
{
    MmwDemo_compRxChannelBiasCfg_t   cfg;
    MmwDemo_message     message;
    int32_t argInd;
    int32_t i;

    /* Sanity Check: Minimum argument check */
    if (argc != (1+1+SYS_COMMON_NUM_TX_ANTENNAS*SYS_COMMON_NUM_RX_CHANNEL*2))
    {
        CLI_write ("Error: Invalid usage of the CLI command\n");
        return -1;
    }

    /* Initialize configuration: */
    memset ((void *)&cfg, 0, sizeof(MmwDemo_compRxChannelBiasCfg_t));

    /* Populate configuration: */
    cfg.rangeBias          = (float) atof (argv[1]);

    argInd = 2;
    for (i=0; i < SYS_COMMON_NUM_TX_ANTENNAS*SYS_COMMON_NUM_RX_CHANNEL; i++)
    {
        cfg.rxChPhaseComp[2 * i + 0] = (float) atof (argv[argInd++]);
        cfg.rxChPhaseComp[2 * i + 1] = (float) atof (argv[argInd++]);
    }
    /* Save Configuration to use later */
    memcpy((void *) &gMmwMssMCB.cfg.antCompCfg, &cfg, sizeof(MmwDemo_compRxChannelBiasCfg_t));

    /* Send configuration to DSS */
    memset((void *)&message, 0, sizeof(MmwDemo_message));
    message.type = MMWDEMO_MSS2DSS_COMP_RANGE_BIAS_AND_RX_CHAN_PHASE;
    memcpy((void *)&message.body.antCompCfg, (void *)&cfg, sizeof(MmwDemo_compRxChannelBiasCfg_t));

    if (MmwDemo_mboxWrite(&message) == 0)
        return 0;
    else
        return -1;
}


/**
 *  @b Description
 *  @n
 *      This is the CLI Handler for data logger set command
 *
 *  @param[in] argc
 *      Number of arguments
 *  @param[in] argv
 *      Arguments
 *
 *  @retval
 *      Success -   0
 *  @retval
 *      Error   -   <0
 */
static int32_t MmwDemo_CLISetDataLogger (int32_t argc, char* argv[])
{
    MmwDemo_message     message;

    /* Sanity Check: Minimum argument check */
    if (argc != 2)
    {
        CLI_write ("Error: Invalid usage of the CLI command\n");
        return -1;
    }


    /* Save Configuration to use later */
    if (strcmp(argv[1], "mssLogger") == 0)  
        gMmwMssMCB.cfg.dataLogger = 0;
    else if (strcmp(argv[1], "dssLogger") == 0)  
        gMmwMssMCB.cfg.dataLogger = 1;
    else
    {
        CLI_write ("Error: Invalid usage of the CLI command\n");
        return -1;
    }
       
    /* Send configuration to DSS */
    memset((void *)&message, 0, sizeof(MmwDemo_message));

    message.type = MMWDEMO_MSS2DSS_SET_DATALOGGER;
    message.body.dataLogger = gMmwMssMCB.cfg.dataLogger;

    if (MmwDemo_mboxWrite(&message) == 0)
        return 0;
    else
        return -1;
}

/**
 *  @b Description
 *  @n
 *      This is the CLI Execution Task
 *
 *  @retval
 *      Not Applicable.
 */
void MmwDemo_CLIInit (void)
{
    CLI_Cfg     cliCfg;
    char        demoBanner[256];

    /* Create Demo Banner to be printed out by CLI */
    sprintf(&demoBanner[0], "******************************************\n" \
                       "MMW TM Demo %s\n"  \
                       "******************************************\n", MMW_VERSION);
    
    /* Initialize the CLI configuration: */
    memset ((void *)&cliCfg, 0, sizeof(CLI_Cfg));

    /* Populate the CLI configuration: */
    cliCfg.cliPrompt                    = "mmwDemo:/>";
    cliCfg.cliBanner                    = demoBanner;
    cliCfg.cliUartHandle                = gMmwMssMCB.commandUartHandle;
    cliCfg.taskPriority                 = 3;
    cliCfg.mmWaveHandle                 = gMmwMssMCB.ctrlHandle;
    cliCfg.enableMMWaveExtension        = 1U;
    cliCfg.usePolledMode                = true;
    cliCfg.tableEntry[0].cmd            = "sensorStart";
    cliCfg.tableEntry[0].helpString     = "No arguments";
    cliCfg.tableEntry[0].cmdHandlerFxn  = MmwDemo_CLISensorStart;
    cliCfg.tableEntry[1].cmd            = "sensorStop";
    cliCfg.tableEntry[1].helpString     = "No arguments";
    cliCfg.tableEntry[1].cmdHandlerFxn  = MmwDemo_CLISensorStop;
    cliCfg.tableEntry[2].cmd            = "frameStart";
    cliCfg.tableEntry[2].helpString     = "No arguments";
    cliCfg.tableEntry[2].cmdHandlerFxn  = MmwDemo_CLIFrameStart;
    cliCfg.tableEntry[3].cmd            = "guiMonitor";
    cliCfg.tableEntry[3].helpString     = "<detectedObjects> <logMagRange> <rangeAzimuthHeatMap> <rangeDopplerHeatMap>";
    cliCfg.tableEntry[3].cmdHandlerFxn  = MmwDemo_CLIGuiMonSel;
    cliCfg.tableEntry[4].cmd            = "cfarCfg";
    cliCfg.tableEntry[4].helpString     = "<detMode> <discardLeft> <discardRight> <refWinSize1> <refWinSize2> <guardWinSize1> <guardWinSize2> <thre>";
    cliCfg.tableEntry[4].cmdHandlerFxn  = MmwDemo_CLICfarCfg;
    cliCfg.tableEntry[5].cmd            = "doaCfg";
    cliCfg.tableEntry[5].helpString     = "<doaMode> <doaGamma> <sideLobe_dB> <searchRange> <searchRes> <varThre>";
    cliCfg.tableEntry[5].cmdHandlerFxn  = MmwDemo_CLIDoACfg;
    cliCfg.tableEntry[6].cmd            = "trackingCfg";
    cliCfg.tableEntry[6].helpString     = "<enable> <paramSet> <numPoints> <numTracks> <maxDoppler> <framePeriod>";
    cliCfg.tableEntry[6].cmdHandlerFxn  = MmwDemo_CLITrackingCfg;
    cliCfg.tableEntry[7].cmd            = "dataLogger";
    cliCfg.tableEntry[7].helpString     = "<mssLogger | dssLogger>";
    cliCfg.tableEntry[7].cmdHandlerFxn  = MmwDemo_CLISetDataLogger;
    cliCfg.tableEntry[8].cmd            = "adcbufCfg";
    cliCfg.tableEntry[8].helpString     = "<adcOutputFmt> <SampleSwap> <ChanInterleave> <ChirpThreshold>";
    cliCfg.tableEntry[8].cmdHandlerFxn  = MmwDemo_CLIADCBufCfg;
    cliCfg.tableEntry[9].cmd            = "compRangeBiasAndRxChanPhase";
    cliCfg.tableEntry[9].helpString     = "<rangeBias> <Re00> <Im00> <Re01> <Im01> <Re02> <Im02> <Re03> <Im03> <Re10> <Im10> <Re11> <Im11> <Re12> <Im12> <Re13> <Im13> ";
    cliCfg.tableEntry[9].cmdHandlerFxn  = MmwDemo_CLICompRangeBiasAndRxChanPhaseCfg;
	cliCfg.tableEntry[10].cmd            = "sceneryParam";
    cliCfg.tableEntry[10].helpString     = "<numBoundaryBox> <Left1> <Right1> <Bottom1> <Top1> <Left2> <Right2> <Bottom2> <Top2> <numStaticBox> <Left1> <Right1> <Bottom1> <Top1> <Left2> <Right2> <Bottom2> <Top2>";
    cliCfg.tableEntry[10].cmdHandlerFxn  = MmwDemo_CLISceneryParamCfg;
    cliCfg.tableEntry[11].cmd            = "gatingParam";
    cliCfg.tableEntry[11].helpString     = "<gating volume> <length> <width> <doppler>";
    cliCfg.tableEntry[11].cmdHandlerFxn  = MmwDemo_CLIGatingParamCfg;
	cliCfg.tableEntry[12].cmd            = "stateParam";
    cliCfg.tableEntry[12].helpString     = "<det2act> <det2free> <act2free> <stat2free> <exit2free>";
    cliCfg.tableEntry[12].cmdHandlerFxn  = MmwDemo_CLIStateParamCfg;
	cliCfg.tableEntry[13].cmd            = "allocationParam";
    cliCfg.tableEntry[13].helpString     = "<SNRs> <minimal velocity> <points> <in distance> <in velocity>";
    cliCfg.tableEntry[13].cmdHandlerFxn  = MmwDemo_CLIAllocationParamCfg;
	cliCfg.tableEntry[14].cmd            = "variationParam";
    cliCfg.tableEntry[14].helpString     = "<height> <width> <doppler>";
    cliCfg.tableEntry[14].cmdHandlerFxn  = MmwDemo_CLIVariationParamCfg;
    /* Open the CLI: */
   if (CLI_open (&cliCfg) < 0)
    {
        System_printf ("Error: Unable to open the CLI\n");
        return;
    }
    System_printf ("Debug: CLI is operational\n");

    //Configuracion inicial sin CLI
    customcfg1();

    System_printf ("loading custom cfg\n");
    return;
}


When I try to debug, I get the Error: MMWDemoMSS mmWave Configuration failed [Error code -203816650]

Any thoughts?

  • also, if I terminate the debugging session and I start it again, the console shows a different error:

    [Cortex_R4_0] Exception occurred in ThreadType_Main.
    Main handle: 0x0.
    Main stack base: 0x801d800.
    Main stack size: 0x1000.
    R0 = 0x000089d0 R8 = 0x0801e7b8
    R1 = 0x00007c00 R9 = 0x00000008
    R2 = 0x0801c4cc R10 = 0x0000000b
    R3 = 0x0801d800 R11 = 0x00000000
    R4 = 0x00000000 R12 = 0x0801c3cc
    R5 = 0x000089d0 SP(R13) = 0x00000000
    R6 = 0x0000000c LR(R14) = 0x00014538
    R7 = 0x0801e7ac PC(R15) = 0x00007c00
    PSR = 0x600c019f
    DFSR = 0x00000808 IFSR = 0x0000000d
    DFAR = 0xfffffff8 IFAR = 0x00080000
    ti.sysbios.family.arm.exc.Exception: line 205: E_dataAbort: pc = 0x00007c00, lr = 0x00014538.
    xdc.runtime.Error.raise: terminating execution
  • Former Member
    0 Former Member in reply to Carlos del Amo
    Hello Carlos,

    Have you tried the method for hardcoding the CLI as mentioned in this thread post here?
    e2e.ti.com/.../2616079

    Additionally can you confirm whether the cfg file you are sending by CLI commands runs without issue before the hardcoding of the parameters?

    Thanks,
    Amanda
  • Hello,

    I can confirm the cfg is correct, it worked via GUI without problems.

    I see that the files on the solution you linked are for mmwave 14xx, I'm using awr1642, will it work?

  • also, I was using sdk 2.00.04, is it compatible?

  • Former Member
    0 Former Member in reply to Carlos del Amo
    Hello Carlos,

    Yes please follow the steps as outlined in the post. It is compatible with 16xx demo and SDK 2.00.04.

    Amanda
  • Hi amanda, tried your solution. First time seemed to work, but the second time I try to debug, I get the following console message loading the mss project:

    [Cortex_R4_0] Exception occurred in ThreadType_Main.
    Main handle: 0x0.
    Main stack base: 0x801d860.
    Main stack size: 0x1000.
    R0 = 0x00000000 R8 = 0x00000005
    R1 = 0x00013318 R9 = 0x00015b94
    R2 = 0x080001b1 R10 = 0x12e20000
    R3 = 0x0801a3dc R11 = 0x000000d1
    R4 = 0x0801a414 R12 = 0x00017bd9
    R5 = 0x00000001 SP(R13) = 0x080052e0
    R6 = 0x0801c856 LR(R14) = 0x00017bdf
    R7 = 0x0801c844 PC(R15) = 0x00015b94
    PSR = 0x400c019f
    DFSR = 0x00000000 IFSR = 0x00000000
    DFAR = 0x00000000 IFAR = 0x00000000
    ti.sysbios.family.arm.exc.Exception: line 209: E_undefinedInstruction: pc = 0x00015b94, lr = 0x00017bdf.
    xdc.runtime.Error.raise: terminating execution

    what can cause this?

  • Former Member
    0 Former Member in reply to Carlos del Amo
    Hello Carlos,

    Are you repeating the entire process of launching the debug and dss also?

    Amanda
  • Hi, I solved it, I wasn't power cycling the device before performing the next debug session. The method you provided for the hard code worked. Thanks!