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.

AWR1843: about CW Mode Setting failed

Other Parts Discussed in Thread: AWR1843

Hi Sir 

We followed the sample code and would like to enable continuous streaming mode(single tone).

But it will fail if we use below code sample. 

Could you advise where is the mistake and thanks.

#define CONV_FREQ_GHZ_TO_CODEWORD(X) ROUND_TO_INT32(X * (1.0e9/53.644))

    rlContModeCfg_t contModeCfg;

    contModeCfg.startFreqConst = (CONV_FREQ_GHZ_TO_CODEWORD(nFreqCent));

    contModeCfg.txOutPowerBackoffCode = 0;

    contModeCfg.txPhaseShifter = 0;

    contModeCfg.digOutSampleRate = 10000;

    contModeCfg.hpfCornerFreq1 = 0;

    contModeCfg.hpfCornerFreq2 = 0;

    contModeCfg.rxGain = 30;

    contModeCfg.vcoSelect = 0x0;

    contModeCfg.reserved0 = 0x0;

 

    rlContModeEn_t contModeEnable;

    contModeEnable.contModeEn = 1;

 

    retVal = rlSetContModeConfig(RL_DEVICE_MAP_INTERNAL_BSS, (rlContModeCfg_t*)&contModeCfg);

    /* Check for mmWaveLink API call status */

    if(retVal != 0)

    {

        /* Error: Link reported an issue. */

    System_printf("Error: rlSetContModeConfig retVal=%d\n", retVal);

        return -1;

    }

    System_printf("Debug: Finished rlSetContModeConfig\n");

 

    retVal = rlEnableContMode(RL_DEVICE_MAP_INTERNAL_BSS, (rlContModeEn_t*)&contModeEnable);

    /* Check for mmWaveLink API call status */

    if(retVal != 0)

    {

        /* Error: Link reported an issue. */

        System_printf("Error: rlEnableContMode retVal=%d\n", retVal);

        return -1;

    }

    System_printf("Debug: Finished rlEnableContMode\n");

BR

Yimin

  • Hi

    Is there a reason why you don't want to use mmwave studio?

    Thank you
  • Hi Sir

    1. We customized out MB and don’ t want to use dca1000

    2.another is for production test.

    FYI

  • Thank you

    Can you please let us know if you run this code as part of SDK?

    Please let us know and provide code patch so that we can reproduce this behavior

    thank you
    cesar
  • Hi Sir 

    base on SDK 3.1.0.2 AWR1843 mmw demo code. We add cli command ‘ContMode’  for CW mode test.

    you can refer to attachment which we got from below link

    sdk_03.01.00.02_1843\mmw_mss_18xx\mmw_cli.c

    /*
     *   @file  mmw_cli.c
     *
     *   @brief
     *      Mmw (Milli-meter wave) DEMO CLI Implementation
     *
     *  \par
     *  NOTE:
     *      (C) Copyright 2018 Texas Instruments, Inc.
     *
     *  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/runtime/System.h>
    
    /* mmWave SDK Include Files: */
    #include <ti/common/sys_common.h>
    #include <ti/common/mmwave_sdk_version.h>
    #include <ti/drivers/uart/UART.h>
    #include <ti/control/mmwavelink/mmwavelink.h>
    #include <ti/utils/cli/cli.h>
    #include <ti/utils/mathutils/mathutils.h>
    
    /* Demo Include Files */
    #include <ti/demo/xwr18xx/mmw/include/mmw_config.h>
    #include <ti/demo/xwr18xx/mmw/mss/mmw_mss.h>
    #include <ti/demo/utils/mmwdemo_adcconfig.h>
    
    /**************************************************************************
     *************************** Local function prototype****************************
     **************************************************************************/
    
    /* CLI Extended Command Functions */
    static int32_t MmwDemo_CLICfarCfg (int32_t argc, char* argv[]);
    static int32_t MmwDemo_CLIMultiObjBeamForming (int32_t argc, char* argv[]);
    static int32_t MmwDemo_CLICalibDcRangeSig (int32_t argc, char* argv[]);
    static int32_t MmwDemo_CLIClutterRemoval (int32_t argc, char* argv[]);
    static int32_t MmwDemo_CLISensorStart (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_CLIADCBufCfg (int32_t argc, char* argv[]);
    static int32_t MmwDemo_CLICompRangeBiasAndRxChanPhaseCfg (int32_t argc, char* argv[]);
    static int32_t MmwDemo_CLIMeasureRangeBiasAndRxChanPhaseCfg (int32_t argc, char* argv[]);
    static int32_t MmwDemo_CLICfarFovCfg (int32_t argc, char* argv[]);
    static int32_t MmwDemo_CLIAoAFovCfg (int32_t argc, char* argv[]);
    static int32_t MmwDemo_CLIContMode (int32_t argc, char* argv[]);
    
    /**************************************************************************
     *************************** Extern Definitions *******************************
     **************************************************************************/
    
    extern MmwDemo_MSS_MCB    gMmwMssMCB;
    
    /**************************************************************************
     *************************** Local Definitions ****************************
     **************************************************************************/
    
    
    /**************************************************************************
     *************************** 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
     */
    static int32_t MmwDemo_CLISensorStart (int32_t argc, char* argv[])
    {
        bool        doReconfig = true;
        int32_t     retVal = 0;
    
        /*  Only following command syntax will be supported 
            sensorStart
            sensorStart 0
        */
        if (argc == 2)
        {
            doReconfig = (bool) atoi (argv[1]);
    
            if (doReconfig == true)
            {
                CLI_write ("Error: Reconfig is not supported, only argument of 0 is\n"
                           "(do not reconfig, just re-start the sensor) valid\n");
                return -1;
            }
        }
        else
        {
            /* In case there is no argument for sensorStart, always do reconfig */
            doReconfig = true;
        }
    
        /***********************************************************************************
         * Do sensor state management to influence the sensor actions
         ***********************************************************************************/
    
        if ((gMmwMssMCB.sensorState == MmwDemo_SensorState_INIT) && (MmwDemo_isAllCfgInPendingState() == 0))
        {
            CLI_write ("Error: Full configuration must be provided before sensor can be started "
                       "the first time\n");
            return -1;
        }
    
        if (gMmwMssMCB.sensorState == MmwDemo_SensorState_STARTED)
        {
            CLI_write ("Ignored: Sensor is already started\n");
            return 0;
        }
    
        if (doReconfig == false)
        {
             /* User intends to issue sensor start without config, check if no
                config was issued after stop and generate error if this is the case. */
             if (MmwDemo_isAllCfgInNonPendingState() == 0)
             {
                 /* Message user differently if all config was issued or partial config was
                    issued. */
                 if (MmwDemo_isAllCfgInPendingState())
                 {
                     CLI_write ("Error: You have provided complete new configuration, "
                                "issue \"sensorStart\" (without argument) if you want it to "
                                "take effect\n");
                 }
                 else
                 {
                     CLI_write ("Error: There should be no configuration between stop and this "
                                "command. Issue the full configuration and do \"sensorStart\" "
                                "OR reboot system, we cannot undo partial config\n");
                 }
                 return -1;
             }
        }
        else
        {
            /* User intends to issue sensor start with full config, check if all config
               was issued after stop and generate error if  is the case. */
            if (MmwDemo_isAllCfgInPendingState() == 0)
            {
                /* Message user differently if no config was issued or partial config was
                   issued. */
                if (MmwDemo_isAllCfgInNonPendingState())
                {
                    CLI_write ("Error: You have provided no configuration, "
                               "issue \"sensorStart 0\" OR provide "
                               "full configuration and issue \"sensorStart\"\n");
                }
                else
                {
                    CLI_write ("Error: Entire configuration must be provided, partial "
                               "configuration is not allowed. Issue the full configuration "
                               "and do \"sensorStart\" OR reboot system, we cannot undo "
                               "partial config\n");
                }
                return -1;
            }
        }
    
        /***********************************************************************************
         * Retreive and check mmwave Open related config before calling openSensor
         ***********************************************************************************/
    
        /*  Fill demo's MCB mmWave openCfg structure from the CLI configs*/
        if (gMmwMssMCB.sensorState == MmwDemo_SensorState_INIT)
        {
            /* Get the open configuration: */
            CLI_getMMWaveExtensionOpenConfig (&gMmwMssMCB.cfg.openCfg);
        }
        else
        {
            /* openCfg related configurations like chCfg, lowPowerMode, adcCfg
             * are only used on the first sensor start. If they are different
             * on a subsequent sensor start, then generate a fatal error
             * so the user does not think that the new (changed) configuration
             * takes effect, the board needs to be reboot for the new
             * configuration to be applied.
             */
            MMWave_OpenCfg openCfg;
            CLI_getMMWaveExtensionOpenConfig (&openCfg);
            /* Compare openCfg->chCfg*/
            if(memcmp((void *)&gMmwMssMCB.cfg.openCfg.chCfg, (void *)&openCfg.chCfg,
                              sizeof(rlChanCfg_t)) != 0)
            {
                MmwDemo_debugAssert(0);
            }
            
            /* Compare openCfg->lowPowerMode*/
            if(memcmp((void *)&gMmwMssMCB.cfg.openCfg.lowPowerMode, (void *)&openCfg.lowPowerMode,
                              sizeof(rlLowPowerModeCfg_t)) != 0)
            {
                MmwDemo_debugAssert(0);
            }
            /* Compare openCfg->adcOutCfg*/
            if(memcmp((void *)&gMmwMssMCB.cfg.openCfg.adcOutCfg, (void *)&openCfg.adcOutCfg,
                              sizeof(rlAdcOutCfg_t)) != 0)
            {
                MmwDemo_debugAssert(0);
            }
        }
    
        retVal = MmwDemo_openSensor(gMmwMssMCB.sensorState == MmwDemo_SensorState_INIT);
        if(retVal != 0)
        {
            return -1;
        }
    
        /***********************************************************************************
         * Retrieve mmwave Control related config before calling startSensor
         ***********************************************************************************/
        /* Get the mmWave ctrlCfg from the CLI mmWave Extension */
        if(doReconfig)
        {
            CLI_getMMWaveExtensionConfig (&gMmwMssMCB.cfg.ctrlCfg);
            retVal = MmwDemo_configSensor();
            if(retVal != 0)
            {
                return -1;
            }
        }
        retVal = MmwDemo_startSensor();
        if(retVal != 0)
        {
            return -1;
        }
    
        /***********************************************************************************
         * Set the state
         ***********************************************************************************/
        gMmwMssMCB.sensorState = MmwDemo_SensorState_STARTED;
        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[])
    {
        if ((gMmwMssMCB.sensorState == MmwDemo_SensorState_STOPPED) ||
            (gMmwMssMCB.sensorState == MmwDemo_SensorState_INIT))
        {
            CLI_write ("Ignored: Sensor is already stopped\n");
            return 0;
        }
    
        MmwDemo_stopSensor();
    
        gMmwMssMCB.sensorState = MmwDemo_SensorState_STOPPED;
        return 0;
    }
    
    /**
     *  @b Description
     *  @n
     *      Utility function to get sub-frame number
     *
     *  @param[in] argc  Number of arguments
     *  @param[in] argv  Arguments
     *  @param[in] expectedArgc Expected number of arguments
     *  @param[out] subFrameNum Sub-frame Number (0 based)
     *
     *  @retval
     *      Success -   0
     *  @retval
     *      Error   -   <0
     */
    static int32_t MmwDemo_CLIGetSubframe (int32_t argc, char* argv[], int32_t expectedArgc,
                                           int8_t* subFrameNum)
    {
        int8_t subframe;
        
        /* Sanity Check: Minimum argument check */
        if (argc != expectedArgc)
        {
            CLI_write ("Error: Invalid usage of the CLI command\n");
            return -1;
        }
    
        /*Subframe info is always in position 1*/
        subframe = (int8_t) atoi(argv[1]);
    
        if(subframe >= (int8_t)RL_MAX_SUBFRAMES)
        {
            CLI_write ("Error: Subframe number is invalid\n");
            return -1;
        }
    
        *subFrameNum = (int8_t)subframe;
    
        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;
        int8_t              subFrameNum;
    
        if(MmwDemo_CLIGetSubframe(argc, argv, 8, &subFrameNum) < 0)
        {
            return -1;
        }
    
        /* Initialize the guiMonSel configuration: */
        memset ((void *)&guiMonSel, 0, sizeof(MmwDemo_GuiMonSel));
    
        /* Populate configuration: */
        guiMonSel.detectedObjects           = atoi (argv[2]);
        guiMonSel.logMagRange               = atoi (argv[3]);
        guiMonSel.noiseProfile              = atoi (argv[4]);
        guiMonSel.rangeAzimuthHeatMap       = atoi (argv[5]);
        guiMonSel.rangeDopplerHeatMap       = atoi (argv[6]);
        guiMonSel.statsInfo                 = atoi (argv[7]);
    
        MmwDemo_CfgUpdate((void *)&guiMonSel, MMWDEMO_GUIMONSEL_OFFSET,
            sizeof(MmwDemo_GuiMonSel), subFrameNum);
    
        return 0;
    }
    
    /**
     *  @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[])
    {
        DPU_CFARCAProc_CfarCfg   cfarCfg;
        uint32_t            procDirection;
        int8_t              subFrameNum;
    
        if(MmwDemo_CLIGetSubframe(argc, argv, 10, &subFrameNum) < 0)
        {
            return -1;
        }
    
        /* Initialize configuration: */
        memset ((void *)&cfarCfg, 0, sizeof(cfarCfg));
    
        /* Populate configuration: */
        procDirection             = (uint32_t) atoi (argv[2]);
        cfarCfg.averageMode       = (uint8_t) atoi (argv[3]);
        cfarCfg.winLen            = (uint8_t) atoi (argv[4]);
        cfarCfg.guardLen          = (uint8_t) atoi (argv[5]);
        cfarCfg.noiseDivShift     = (uint8_t) atoi (argv[6]);
        cfarCfg.cyclicMode        = (uint8_t) atoi (argv[7]);
        cfarCfg.thresholdScale    = (uint16_t) atoi (argv[8]);
        cfarCfg.peakGroupingEn    = (uint8_t) atoi (argv[9]);
    
        /* Save Configuration to use later */     
        if (procDirection == 0)
        {
            MmwDemo_CfgUpdate((void *)&cfarCfg, MMWDEMO_CFARCFGRANGE_OFFSET,
                              sizeof(cfarCfg), subFrameNum);
        }
        else
        {
            MmwDemo_CfgUpdate((void *)&cfarCfg, MMWDEMO_CFARCFGDOPPLER_OFFSET,
                              sizeof(cfarCfg), subFrameNum);
        }
        return 0;
    }
    
    /**
     *  @b Description
     *  @n
     *      This is the CLI Handler for CFAR FOV (Field Of View) configuration
     *
     *  @param[in] argc
     *      Number of arguments
     *  @param[in] argv
     *      Arguments
     *
     *  @retval
     *      Success -   0
     *  @retval
     *      Error   -   <0
     */
    static int32_t MmwDemo_CLICfarFovCfg (int32_t argc, char* argv[])
    {
        DPU_CFARCAProc_FovCfg   fovCfg;
        uint32_t            procDirection;
        int8_t              subFrameNum;
    
        if(MmwDemo_CLIGetSubframe(argc, argv, 5, &subFrameNum) < 0)
        {
            return -1;
        }
    
        /* Initialize configuration: */
        memset ((void *)&fovCfg, 0, sizeof(fovCfg));
    
        /* Populate configuration: */
        procDirection             = (uint32_t) atoi (argv[2]);
        fovCfg.min                = (float) atof (argv[3]);
        fovCfg.max                = (float) atof (argv[4]);
    
        /* Save Configuration to use later */
        if (procDirection == 0)
        {
            MmwDemo_CfgUpdate((void *)&fovCfg, MMWDEMO_FOVRANGE_OFFSET,
                              sizeof(fovCfg), subFrameNum);
        }
        else
        {
            MmwDemo_CfgUpdate((void *)&fovCfg, MMWDEMO_FOVDOPPLER_OFFSET,
                              sizeof(fovCfg), subFrameNum);
        }
        return 0;
    }
    
    /**
     *  @b Description
     *  @n
     *      This is the CLI Handler for AoA FOV (Field Of View) configuration
     *
     *  @param[in] argc
     *      Number of arguments
     *  @param[in] argv
     *      Arguments
     *
     *  @retval
     *      Success -   0
     *  @retval
     *      Error   -   <0
     */
    static int32_t MmwDemo_CLIAoAFovCfg (int32_t argc, char* argv[])
    {
        DPU_AoAProc_FovAoaCfg   fovCfg;
        int8_t              subFrameNum;
    
        if(MmwDemo_CLIGetSubframe(argc, argv, 6, &subFrameNum) < 0)
        {
            return -1;
        }
    
        /* Initialize configuration: */
        memset ((void *)&fovCfg, 0, sizeof(fovCfg));
    
        /* Populate configuration: */
        fovCfg.minAzimuthDeg      = (float) atoi (argv[2]);
        fovCfg.maxAzimuthDeg      = (float) atoi (argv[3]);
        fovCfg.minElevationDeg    = (float) atoi (argv[4]);
        fovCfg.maxElevationDeg    = (float) atoi (argv[5]);
    
        /* Save Configuration to use later */
        MmwDemo_CfgUpdate((void *)&fovCfg, MMWDEMO_FOVAOA_OFFSET,
                          sizeof(fovCfg), subFrameNum);
        return 0;
    }
    
    /**
     *  @b Description
     *  @n
     *      This is the CLI Handler for multi object beam forming configuration
     *
     *  @param[in] argc
     *      Number of arguments
     *  @param[in] argv
     *      Arguments
     *
     *  @retval
     *      Success -   0
     *  @retval
     *      Error   -   <0
     */
    static int32_t MmwDemo_CLIMultiObjBeamForming (int32_t argc, char* argv[])
    {
        DPU_AoAProc_MultiObjBeamFormingCfg cfg;
        int8_t              subFrameNum;
    
        if(MmwDemo_CLIGetSubframe(argc, argv, 4, &subFrameNum) < 0)
        {
            return -1;
        }
    
        /* Initialize configuration: */
        memset ((void *)&cfg, 0, sizeof(cfg));
    
        /* Populate configuration: */
        cfg.enabled                     = (uint8_t) atoi (argv[2]);
        cfg.multiPeakThrsScal           = (float) atof (argv[3]);
    
        /* Save Configuration to use later */
        MmwDemo_CfgUpdate((void *)&cfg, MMWDEMO_MULTIOBJBEAMFORMING_OFFSET,
                          sizeof(cfg), subFrameNum);
    
        return 0;
    }
    
    /**
     *  @b Description
     *  @n
     *      This is the CLI Handler for DC range calibration
     *
     *  @param[in] argc
     *      Number of arguments
     *  @param[in] argv
     *      Arguments
     *
     *  @retval
     *      Success -   0
     *  @retval
     *      Error   -   <0
     */
    static int32_t MmwDemo_CLICalibDcRangeSig (int32_t argc, char* argv[])
    {
        DPU_RangeProc_CalibDcRangeSigCfg cfg;
        uint32_t                   log2NumAvgChirps;
        int8_t                     subFrameNum;
    
        if(MmwDemo_CLIGetSubframe(argc, argv, 6, &subFrameNum) < 0)
        {
            return -1;
        }
    
        /* Initialize configuration for DC range signature calibration */
        memset ((void *)&cfg, 0, sizeof(cfg));
    
        /* Populate configuration: */
        cfg.enabled          = (uint16_t) atoi (argv[2]);
        cfg.negativeBinIdx   = (int16_t)  atoi (argv[3]);
        cfg.positiveBinIdx   = (int16_t)  atoi (argv[4]);
        cfg.numAvgChirps     = (uint16_t) atoi (argv[5]);
    
        if (cfg.negativeBinIdx > 0)
        {
            CLI_write ("Error: Invalid negative bin index\n");
            return -1;
        }
        if ((cfg.positiveBinIdx - cfg.negativeBinIdx + 1) > DPU_RANGEPROC_SIGNATURE_COMP_MAX_BIN_SIZE)
        {
            CLI_write ("Error: Number of bins exceeds the limit\n");
            return -1;
        }
        log2NumAvgChirps = (uint32_t) mathUtils_ceilLog2(cfg.numAvgChirps);
        if (cfg.numAvgChirps != (1U << log2NumAvgChirps))
        {
            CLI_write ("Error: Number of averaged chirps is not power of two\n");
            return -1;
        }
    
        /* Save Configuration to use later */
        MmwDemo_CfgUpdate((void *)&cfg, MMWDEMO_CALIBDCRANGESIG_OFFSET,
                          sizeof(cfg), subFrameNum);
    
        return 0;
    }
    
    /**
     *  @b Description
     *  @n
     *      Clutter removal Configuration
     *
     *  @param[in] argc
     *      Number of arguments
     *  @param[in] argv
     *      Arguments
     *
     *  @retval
     *      Success -   0
     *  @retval
     *      Error   -   <0
     */
    static int32_t MmwDemo_CLIClutterRemoval (int32_t argc, char* argv[])
    {
        DPC_ObjectDetection_StaticClutterRemovalCfg_Base cfg;
        int8_t              subFrameNum;
    
        if(MmwDemo_CLIGetSubframe(argc, argv, 3, &subFrameNum) < 0)
        {
            return -1;
        }
    
        /* Initialize configuration for clutter removal */
        memset ((void *)&cfg, 0, sizeof(cfg));
    
        /* Populate configuration: */
        cfg.enabled          = (uint16_t) atoi (argv[2]);
    
        /* Save Configuration to use later */
        MmwDemo_CfgUpdate((void *)&cfg, MMWDEMO_STATICCLUTTERREMOFVAL_OFFSET,
                          sizeof(cfg), subFrameNum);
    
        return 0;
    }
    
    /**
     *  @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;
        int8_t              subFrameNum;
    
        if(MmwDemo_CLIGetSubframe(argc, argv, 6, &subFrameNum) < 0)
        {
            return -1;
        }
    
        /* Initialize the ADC Output configuration: */
        memset ((void *)&adcBufCfg, 0, sizeof(adcBufCfg));
    
        /* Populate configuration: */
        adcBufCfg.adcFmt          = (uint8_t) atoi (argv[2]);
        adcBufCfg.iqSwapSel       = (uint8_t) atoi (argv[3]);
        adcBufCfg.chInterleave    = (uint8_t) atoi (argv[4]);
        adcBufCfg.chirpThreshold  = (uint8_t) atoi (argv[5]);
    
        /* Save Configuration to use later */
        MmwDemo_CfgUpdate((void *)&adcBufCfg,
                          MMWDEMO_ADCBUFCFG_OFFSET,
                          sizeof(MmwDemo_ADCBufCfg), subFrameNum);
        return 0;
    }
    
    
    /**
     *  @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[])
    {
        DPU_AoAProc_compRxChannelBiasCfg   cfg;
        int32_t Re, Im;
        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(cfg));
    
        /* 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++)
        {
            Re = (int32_t) (atof (argv[argInd++]) * 32768.);
            MATHUTILS_SATURATE16(Re);
            cfg.rxChPhaseComp[i].real = (int16_t) Re;
    
            Im = (int32_t) (atof (argv[argInd++]) * 32768.);
            MATHUTILS_SATURATE16(Im);
            cfg.rxChPhaseComp[i].imag = (int16_t) Im;
    
        }
        /* Save Configuration to use later */
        memcpy((void *) &gMmwMssMCB.objDetCommonCfg.preStartCommonCfg.compRxChanCfg,
               &cfg, sizeof(cfg));
    
        gMmwMssMCB.objDetCommonCfg.isCompRxChannelBiasCfgPending = 1;
    
        return 0;
    }
    
    /**
     *  @b Description
     *  @n
     *      This is the CLI Handler for measurement configuration 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_CLIMeasureRangeBiasAndRxChanPhaseCfg (int32_t argc, char* argv[])
    {
        DPC_ObjectDetection_MeasureRxChannelBiasCfg   cfg;
    
        /* Sanity Check: Minimum argument check */
        if (argc != 4)
        {
            CLI_write ("Error: Invalid usage of the CLI command\n");
            return -1;
        }
    
        /* Initialize configuration: */
        memset ((void *)&cfg, 0, sizeof(cfg));
    
        /* Populate configuration: */
        cfg.enabled          = (uint8_t) atoi (argv[1]);
        cfg.targetDistance   = (float) atof (argv[2]);
        cfg.searchWinSize   = (float) atof (argv[3]);
    
        /* Save Configuration to use later */
        memcpy((void *) &gMmwMssMCB.objDetCommonCfg.preStartCommonCfg.measureRxChannelBiasCfg,
               &cfg, sizeof(cfg));
    
        gMmwMssMCB.objDetCommonCfg.isMeasureRxChannelBiasCfgPending = 1;
    
        return 0;
    }
    #define ROUND_TO_INT32(X)    ((int32_t) (X))
    #define CONV_FREQ_GHZ_TO_CODEWORD(X) ROUND_TO_INT32(X * (1.0e9/53.644))
    static int32_t MmwDemo_CLIContMode (int32_t argc, char* argv[])
    {
    
      int32_t                 retVal;
       int32_t                 nFreqCent;
    
       rlContModeCfg_t contModeCfg;
    
       rlContModeEn_t contModeEnable;
    
       if (argc != 2)
       {
           CLI_write ("Error: Invalid usage of basicCfg command\n");
           return -1;
       }
    
    
    
       nFreqCent = atoi(argv[1]);
    
       contModeCfg.startFreqConst = (CONV_FREQ_GHZ_TO_CODEWORD(nFreqCent));
       contModeCfg.txOutPowerBackoffCode = 0;
       contModeCfg.txPhaseShifter = 0;
       contModeCfg.digOutSampleRate = 10000;
       contModeCfg.hpfCornerFreq1 = 0;
       contModeCfg.hpfCornerFreq2 = 0;
       contModeCfg.rxGain = 30;
      if (nFreqCent > 78)
       contModeCfg.vcoSelect = 0x2;
      else
       contModeCfg.vcoSelect = 0x0;
       contModeCfg.reserved = 0x0;
    
       contModeEnable.contModeEn = 1;
    
       retVal = rlSetContModeConfig(RL_DEVICE_MAP_INTERNAL_BSS, (rlContModeCfg_t*)&contModeCfg);
       /* Check for mmWaveLink API call status */
       if(retVal != 0)
       {
    
       System_printf("Error: rlSetContModeConfig retVal=%d\n", retVal);
           return -1;
       }
       System_printf("Debug: Finished rlSetContModeConfig\n");
    
    
        retVal = rlEnableContMode(RL_DEVICE_MAP_INTERNAL_BSS, (rlContModeEn_t*)&contModeEnable);
        /* Check for mmWaveLink API call status */
        if(retVal != 0)
        {
            /* Error: Link reported an issue. */
            System_printf("Error: rlEnableContMode retVal=%d\n", retVal);
            return -1;
        }
        System_printf("Debug: Finished rlEnableContMode\n");
            /* Package the command with given data and send it to device */
    
       return 0;
    
    
    }
    /**
     *  @b Description
     *  @n
     *      This is the CLI Execution Task
     *
     *  @retval
     *      Not Applicable.
     */
    void MmwDemo_CLIInit (uint8_t taskPriority)
    {
        CLI_Cfg     cliCfg;
        char        demoBanner[256];
        uint32_t    cnt;
    
        /* Create Demo Banner to be printed out by CLI */
        sprintf(&demoBanner[0], 
                           "******************************************\n" \
                           "xWR18xx MMW Demo %02d.%02d.%02d.%02d\n"  \
                           "******************************************\n", 
                            MMWAVE_SDK_VERSION_MAJOR,
                            MMWAVE_SDK_VERSION_MINOR,
                            MMWAVE_SDK_VERSION_BUGFIX,
                            MMWAVE_SDK_VERSION_BUILD
                );
    
        /* 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                 = taskPriority;
        cliCfg.socHandle                    = gMmwMssMCB.socHandle;
        cliCfg.mmWaveHandle                 = gMmwMssMCB.ctrlHandle;
        cliCfg.enableMMWaveExtension        = 1U;
        cliCfg.usePolledMode                = true;
        cnt=0;
        cliCfg.tableEntry[cnt].cmd            = "sensorStart";
        cliCfg.tableEntry[cnt].helpString     = "[doReconfig(optional, default:enabled)]";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLISensorStart;
        cnt++;
    
        cliCfg.tableEntry[cnt].cmd            = "sensorStop";
        cliCfg.tableEntry[cnt].helpString     = "No arguments";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLISensorStop;
        cnt++;
    
        cliCfg.tableEntry[cnt].cmd            = "guiMonitor";
        cliCfg.tableEntry[cnt].helpString     = "<subFrameIdx> <detectedObjects> <logMagRange> <noiseProfile> <rangeAzimuthHeatMap> <rangeDopplerHeatMap> <statsInfo>";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLIGuiMonSel;
        cnt++;
    
        cliCfg.tableEntry[cnt].cmd            = "cfarCfg";
        cliCfg.tableEntry[cnt].helpString     = "<subFrameIdx> <procDirection> <averageMode> <winLen> <guardLen> <noiseDiv> <cyclicMode> <thresholdScale> <peakGroupingEn>";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLICfarCfg;
        cnt++;
    
        cliCfg.tableEntry[cnt].cmd            = "multiObjBeamForming";
        cliCfg.tableEntry[cnt].helpString     = "<subFrameIdx> <enabled> <threshold>";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLIMultiObjBeamForming;
        cnt++;
    
        cliCfg.tableEntry[cnt].cmd            = "calibDcRangeSig";
        cliCfg.tableEntry[cnt].helpString     = "<subFrameIdx> <enabled> <negativeBinIdx> <positiveBinIdx> <numAvgFrames>";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLICalibDcRangeSig;
        cnt++;
    
        cliCfg.tableEntry[cnt].cmd            = "clutterRemoval";
        cliCfg.tableEntry[cnt].helpString     = "<subFrameIdx> <enabled>";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLIClutterRemoval;
        cnt++;
    
        cliCfg.tableEntry[cnt].cmd            = "adcbufCfg";
        cliCfg.tableEntry[cnt].helpString     = "<subFrameIdx> <adcOutputFmt> <SampleSwap> <ChanInterleave> <ChirpThreshold>";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLIADCBufCfg;
        cnt++;
    
        cliCfg.tableEntry[cnt].cmd            = "compRangeBiasAndRxChanPhase";
        cliCfg.tableEntry[cnt].helpString     = "<rangeBias> <Re00> <Im00> <Re01> <Im01> <Re02> <Im02> <Re03> <Im03> <Re10> <Im10> <Re11> <Im11> <Re12> <Im12> <Re13> <Im13> ";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLICompRangeBiasAndRxChanPhaseCfg;
        cnt++;
    
        cliCfg.tableEntry[cnt].cmd            = "measureRangeBiasAndRxChanPhase";
        cliCfg.tableEntry[cnt].helpString     = "<enabled> <targetDistance> <searchWin>";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLIMeasureRangeBiasAndRxChanPhaseCfg;
        cnt++;
    
        cliCfg.tableEntry[cnt].cmd            = "aoaFovCfg";
        cliCfg.tableEntry[cnt].helpString     = "<subFrameIdx> <minAzimuthDeg> <maxAzimuthDeg> <minElevationDeg> <maxElevationDeg>";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLIAoAFovCfg;
        cnt++;
    
        cliCfg.tableEntry[cnt].cmd            = "cfarFovCfg";
        cliCfg.tableEntry[cnt].helpString     = "<subFrameIdx> <procDirection> <min (meters or m/s)> <max (meters or m/s)>";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLICfarFovCfg;
        cnt++;
        cliCfg.tableEntry[cnt].cmd            = "ContMode";
        cliCfg.tableEntry[cnt].helpString     = "<Freq>";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLIContMode;
        cnt++;
        
        /* 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");
        return;
    }
    
    
    

    Keyword: MmwDemo_CLIContMode

    please advise

    BR

    Yimin

  • Hi Sir

    Any update

  • Hi

    I thought about this.

    The code you have is not enough. You also need to enable cotinuous mode in ADCBuf driver.

    Please take a look at the capture demo in mmwave SDK 1.1

    You will need to port this demo to SDK 3.1.

    Thank you

    Cesar

  • Hi Sir 

    We followed your suggestion to add ADC setting and it works.

    But we found some issues about CW mode.

    When we set 77GHz , we found the frequency will shift around 77GHz.

    ex:  a. set 77GHz CW mode

           b. we measure the frequency which is around 78.xx GHz CW tone

           c.And then the frequency will shift to 77Ghz  

           d. it seems the frequency cannot be set at 77GHz constantly.

    code:

    nFreqCent =77;

       contModeCfg.startFreqConst = (CONV_FREQ_GHZ_TO_CODEWORD(nFreqCent));

       contModeCfg.txOutPowerBackoffCode = 0;

       contModeCfg.txPhaseShifter = 0;

       contModeCfg.digOutSampleRate = 10000;

       contModeCfg.hpfCornerFreq1 = 0;

       contModeCfg.hpfCornerFreq2 = 0;

       contModeCfg.rxGain = 30;

      if (nFreqCent > 78)

       contModeCfg.vcoSelect = 0x2;

      else

       contModeCfg.vcoSelect = 0x0;

       contModeCfg.reserved = 0x0;

       contModeEnable.contModeEn = 1;

    please advise

    BR

    Yimin 

  • Hi Sir

    Any suggestion?

  • Hi,

    I have not made much progress.

    I recommend using the CW mode with Mmwave Studio.

    We need to submit this feature as an enhancement request to our development team.

    Unfortunately today we don't have an example

    thank you
    Cesar
  • Hi Sir

    Do you have any schedule or deadline?

  • Hi,

    Please see

    e2e.ti.com/.../778422

    Thank you
    Cesar
  • Hi,

    No Unfortunately this feature is not supported

    Thank you
    Cesar