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.

Compiler/AWR1642BOOST: Question on C Code that retrieves CLI script inputs // bpmCfg vs bpmCfgAdvanced API

Part Number: AWR1642BOOST
Other Parts Discussed in Thread: AWR1642

Tool/software: TI C/C++ Compiler

Hi,

FYSA, I am using the AWR1642 2.0 (SDK ver 2.0).

I look in the cli_mmwave.c code and notice how most every command specifically correlates to the inputs for each API discussed in the SDK, except for bpmCfg. Why is this? bpmCfg in the code is even referenced as bpmCfgAdvanced... are they even the same API? What file retrieves the inputs from the bpmCfg API on the CLI script? 

Ex of one that correlates: advFrameCfg

    {
        "advFrameCfg",
#ifdef CLI_MMWAVE_HELP_SUPPORT
        "<numOfSubFrames> <forceProfile> <numFrames> <triggerSelect> <frameTrigDelay>",
#else
        NULL,
#endif
        CLI_MMWaveAdvFrameCfg
    },
static int32_t CLI_MMWaveAdvFrameCfg (int32_t argc, char* argv[])
{
    rlAdvFrameCfg_t  advFrameCfg;

    /* Sanity Check: Minimum argument check */
    if (argc != 6)
    {
        CLI_write ("Error: Invalid usage of the CLI command\n");
        return -1;
    }
    
    /* Sanity Check: Frame configuration is valid only for the Frame or
                     Advanced Frame Mode: */
    if (gCLIMMWaveControlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_ADVANCED_FRAME)
    {
        CLI_write ("Error: Configuration is valid only if the DFE Output Mode is Advanced Frame\n");
        return -1;
    }

    /* Initialize the frame configuration: */
    memset ((void *)&advFrameCfg, 0, sizeof(rlAdvFrameCfg_t));

    /* Populate the frame configuration: */
    advFrameCfg.frameSeq.numOfSubFrames      = atoi (argv[1]);
    advFrameCfg.frameSeq.forceProfile        = atoi (argv[2]);
    advFrameCfg.frameSeq.numFrames           = atoi (argv[3]);
    advFrameCfg.frameSeq.triggerSelect       = atoi (argv[4]);
    advFrameCfg.frameSeq.frameTrigDelay      = (uint32_t)((float)atof(argv[5]) * 1000000 / 5);

    /* Save Configuration to use later */
    memcpy ((void *)&gCLIMMWaveControlCfg.u.advancedFrameCfg.frameCfg,
            (void *)&advFrameCfg, sizeof(rlAdvFrameCfg_t));
    return 0;
}

bpmCfg:

    {
        "bpmCfgAdvanced",
#ifdef CLI_MMWAVE_HELP_SUPPORT
        "<chirpStartIdx> <chirpEndIdx> <constBpmVal>",
#else
        NULL,
#endif
        CLI_MMWaveBPMCfgAdvanced
    },

static int32_t CLI_MMWaveBPMCfgAdvanced (int32_t argc, char* argv[])
{   
    rlBpmChirpCfg_t         bpmChirpCfg;
    int32_t                 errCode;
       
    /* Sanity Check: Minimum argument check */
    if (argc != 4)
    {
        CLI_write ("Error: Invalid usage of the CLI command\n");
        return -1;
    }

    /* Sanity Check: BPM Chirp configuration is valid only for the Frame or
                     Advanced Frame Mode: */
    if ((gCLIMMWaveControlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_FRAME) &&
        (gCLIMMWaveControlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_ADVANCED_FRAME))
    {
        CLI_write ("Error: BPM Configuration is valid only if the DFE Output Mode is frame or advanced frame\n");
        return -1;
    }

    /* Initialize the chirp configuration: */
    memset ((void *)&bpmChirpCfg, 0, sizeof(rlBpmChirpCfg_t));

    /* Populate the chirp configuration: */
    bpmChirpCfg.chirpStartIdx   = atoi (argv[1]);
    bpmChirpCfg.chirpEndIdx     = atoi (argv[2]);
    bpmChirpCfg.constBpmVal     = atoi (argv[3]);
   
    /* Add the BPM chirp configuration to the list */
    if (MMWave_addBpmChirp (gCLI.cfg.mmWaveHandle, &bpmChirpCfg, &errCode) == NULL)
    {
        /* Error: Unable to add the BPM configuration. Return the error code. */
        return errCode;
    }

    return 0;

}

Thanks!

George

  • Hello George,

    bpmCfgAdvanced CLI command (which callback function is implemented in cli_mmwave.c) is not being used in the mmw demo.

    AWR16xx Demo uses 'bpmCfg' CLI command which is being implemented under MmwDemo_CLIBpmCfg in mmw_cli.c of same mmw demo itself.

    However both of these CLI commands do the same thing.

     

     CLI_MMWaveAdvFrameCfg is for advanced frame configuration different from BPM config.

    Regards,

    Jitendra

  • Hello Jitendra,

    Great, this was exactly where I needed to be pointed to. 

    As we discussed in this thread (https://e2e.ti.com/support/tools/ccs/f/81/t/931205), I am increasing the mmw demo BPM pattern from a 2 chirp pattern to 4.

    Therefore, I am thinking of changing the bellow parts of mmw_cli.c:

    NEW Lines 1300 - 1303:

        cliCfg.tableEntry[cnt].cmd            = "bpmCfg";
        cliCfg.tableEntry[cnt].helpString     = "<subFrameIdx> <enabled> <chirp0Idx> <chirp1Idx> <chirp2Idx> <chirp3Idx>";
        cliCfg.tableEntry[cnt].cmdHandlerFxn  = MmwDemo_CLIBpmCfg;
        cnt++;

    NEW Lines 934 - 974:

    static int32_t MmwDemo_CLIBpmCfg (int32_t argc, char* argv[])
    {
    
        int8_t           subFrameNum;
        MmwDemo_BpmCfg   cfg;
        MmwDemo_message  message;
        
        /* Sanity Check: Minimum argument check */
        /*CHANGED 5 to 7 because I increased the number of CLI arguments*/
        if (argc != 7)
        {
            CLI_write ("Error: Invalid usage of the CLI command\n");
            return -1;
        }
        
        /*Changed 5 to 7 here too, not exactly sure what this is doing but seems right?*/
        if(MmwDemo_CLIGetSubframe(argc, argv, 7, &subFrameNum) < 0)
        {
            return -1;
        }
    
        /* Initialize configuration for DC range signature calibration */
        memset ((void *)&cfg, 0, sizeof(MmwDemo_BpmCfg));
    
        /* Populate configuration: */
        cfg.isEnabled = (bool) atoi(argv[2]) ;
        cfg.chirp0Idx = (uint16_t) atoi(argv[3]) ;
        cfg.chirp1Idx = (uint16_t) atoi(argv[4]) ;
        cfg.chirp2Idx = (uint16_t) atoi(argv[5]) ;
        cfg.chirp3Idx = (uint16_t) atoi(argv[6]) ;
    
        /* Save Configuration to use later */
        MmwDemo_mssCfgUpdate((void *)&cfg, offsetof(MmwDemo_CliCfg_t, bpmCfg),
            sizeof(MmwDemo_BpmCfg), subFrameNum);
            
        message.type = MMWDEMO_MSS2DSS_BPM_CFG;
        message.subFrameNum = subFrameNum;
        memcpy((void *)&message.body.bpmCfg, (void *)&cfg, sizeof(MmwDemo_BpmCfg));
    
        if (MmwDemo_mboxWrite(&message) == 0)
            return 0;
        else
            return -1;
            
    }

    In addition to giving me the thumbs up on the above code:

    1) What does the the if statement for MmwDemo_GetCLISubframe do? I am only setting the <subFrameIdx> to -1 for legacy mode and applying to all frames. 

    2) What do these lines of code do? 

     /* Initialize configuration for DC range signature calibration */
        memset ((void *)&cfg, 0, sizeof(MmwDemo_BpmCfg));

    3) In addition to changing this cli.c code as well as the mss_main.c that we discussed in the precious thread, are there any other pieces of code you would recommend changing to increase the pre-coded BPM scheme?

    Thank you!

  • Code changes look fine. Final goal of BPM CLI command is to configure BSS for those number of BPM config.

    So with these changes you need to verify mmwave_link.c -> MMWave_configBPM() -> rlSetMultiBpmChirpConfig()  ; check here is all the requested BPM chirps are being send to BSS 

    George Denove said:
    1) What does the the if statement for MmwDemo_GetCLISubframe do? I am only setting the <subFrameIdx> to -1 for legacy mode and applying to all frames. 

    For legacy frame config you can ignore this CLI command

    George Denove said:
    2) What do these lines of code do? 

    This initializes mmwdemo_bpmCfg structure to zero. Comment is wrong here.

    George Denove said:
    3) In addition to changing this cli.c code as well as the mss_main.c that we discussed in the precious thread, are there any other pieces of code you would recommend changing to increase the pre-coded BPM scheme?

    CLI command purpose is partially mentioned above. And on top of that in the DSS you need to handle the processing chain based on these BPM config. Search of 'bpm' in dss_data_path.c to find relevant source.

     

    Regards,

    Jitendra

  • Jitendra,

    Thank you so much for all the information. That really helped!

    Jitendra Gupta said:

    So with these changes you need to verify mmwave_link.c -> MMWave_configBPM() -> rlSetMultiBpmChirpConfig()  ; check here is all the requested BPM chirps are being send to BSS 

    From my understanding of the above statement, you recommend using the rlSetMultiBpmChirpConfig API, correct? Through my implementation, I feel like I just hardcode in more BPM chirps to the mmWave Demo backbone. I think that works on Tx1 that does the BPM of yours.

    Thank you again for taking so much time to help me, it means a lot!

    George

  • Hi Jitendra,

    I am looking for an update on this. I tried implementing a [0 0 1 1] 4 chirp bpm sequence on the AWR1642 but after analyzing the data and decoding it, I now realize that the AWR only transmitted a [0 1 0 1] bpm scheme, a "stale implementation". So, I am assuming the BPM values for the chirps are not sent to the BSS or the front end, but the chirp and frame configuration are.

    Any thoughts? I can explain more if necessary.

    George

  • Hello George,

    As I mentioned earlier, try to put a breakpoint mmwave_link.c -> MMWave_configBPM() -> rlSetMultiBpmChirpConfig() to verify for the latest configuration you have requested over CLI cmd.

    If you are using mmwave library in your application then this is the only place it configures the BPM to BSS.

     

    Regards,

    Jitendra

  • Hi Jitendra,

    Yes, you mentioned that before - thank you for your constant support. Yes, I am using the mmwave library / TIs demo framework for my project.

    In your opinion, what should a breakpoint look like at this part of the code? I am trying to print the BPM configuration to the command line, but not quite sure how.

    Thanks!

    George

    Specific Section:

        /* Set the BPM chirp configuration in the mmWave link */
        retVal = rlSetMultiBpmChirpConfig(RL_DEVICE_MAP_INTERNAL_BSS, 
                                         (rlUInt16_t)numBpmChirps,
                                         bpmPtrArray);
                                         
        /* Free the memory used by the config array) */
        MemoryP_ctrlFree ((void *)bpmPtrArray, arraySize);   

    Full Code:

    int32_t MMWave_configBPM
    (
        MMWave_MCB*         ptrMMWaveMCB,
        MMWave_CtrlCfg*     ptrControlCfg,
        int32_t*            errCode
    )
    {
        int32_t                 retVal;
        uint32_t                numBpmChirps = 0;
        uint32_t                index;
        MMWave_BpmChirpHandle   bpmChirpHandle;
        rlBpmChirpCfg_t**       bpmPtrArray;
        rlBpmCommonCfg_t        bpmCommonCfg;
        uint32_t                arraySize;
        MMWave_BpmChirp*        ptrMMWaveBpmChirp;
    
        
        /* Get the number of BPM chirps configured */
        if (MMWave_getNumBpmChirp ((MMWave_Handle)ptrMMWaveMCB, &numBpmChirps, errCode) < 0)
        {
            /* Error: Unable to get the number of BPM chirps. Error code is already setup */
            retVal = MINUS_ONE;
            goto end;
        }
    
        if(numBpmChirps == 0)
        {
            /* No BPM chirp configured. Nothing to be done.*/
            retVal = 0;
            goto end;
        }
        
        arraySize = numBpmChirps * sizeof(rlBpmChirpCfg_t*);
        
        /* Allocate array to store pointers to BPM configurations*/
        bpmPtrArray = (rlBpmChirpCfg_t**) MemoryP_ctrlAlloc (arraySize, 0);
    
        if (bpmPtrArray == NULL)
        {
            /* Error: Out of memory */
            *errCode = MMWave_encodeError (MMWave_ErrorLevel_ERROR, MMWAVE_ENOMEM, 0);
            retVal   = MINUS_ONE;
            goto end;
        }
    
        /* Initialize the allocated memory for the chirp: */
        memset ((void*)bpmPtrArray, 0, arraySize);
        
        /* Select source of BPM pattern to be from BPM chirp cfg defined in bpmChirpCfg*/
        memset ((void *)&bpmCommonCfg, 0, sizeof(rlBpmCommonCfg_t));
        bpmCommonCfg.mode.b2SrcSel = 0U;
        
        /* Set the BPM common config */
        retVal = rlSetBpmCommonConfig(RL_DEVICE_MAP_INTERNAL_BSS, &bpmCommonCfg);
        if (retVal != RL_RET_CODE_OK)
        {
            /* Error: Setting the BPM configuration failed */
            *errCode = MMWave_encodeError (MMWave_ErrorLevel_ERROR, MMWAVE_ECOMMONBPMCFG, retVal);
            retVal   = MINUS_ONE;
            goto end;
        }
    
        /* Cycle through all the BPM configurations and populate array. */
        for (index = 1U; index <= numBpmChirps; index++)
        {
            /* Get the Handle associated to the specified index */
            if (MMWave_getBpmChirpHandle ((MMWave_Handle)ptrMMWaveMCB, index, &bpmChirpHandle, errCode) < 0)
            {
                /* Error: Unable to get the handle. Error code is already setup */
                retVal = MINUS_ONE;
                goto end;
            }
    
            /* Populate the BPM cfg array. Note that index starts from 1 and array starts from zero. */
            ptrMMWaveBpmChirp = (MMWave_BpmChirp*)bpmChirpHandle;
            bpmPtrArray[index-1] = (rlBpmChirpCfg_t*)(&ptrMMWaveBpmChirp->bpmChirp); 
        }
    
        /* Set the BPM chirp configuration in the mmWave link */
        retVal = rlSetMultiBpmChirpConfig(RL_DEVICE_MAP_INTERNAL_BSS, 
                                         (rlUInt16_t)numBpmChirps,
                                         bpmPtrArray);
                                         
        /* Free the memory used by the config array) */
        MemoryP_ctrlFree ((void *)bpmPtrArray, arraySize);                          
    
        if (retVal != RL_RET_CODE_OK)
        {
            /* Error: Setting the BPM configuration failed */
            *errCode = MMWave_encodeError (MMWave_ErrorLevel_ERROR, MMWAVE_EBPMCFG, retVal);
            retVal   = MINUS_ONE;
            goto end;
        }
    
    end:
        return retVal;
    }

  • Hi George,

    To run/debug code in the CCS debugger, it is recommended to flash the device with the "CCS Debug" image, provided by the SDK.  Please refer to section 3.2.2 of the SDK's user guide for instructions on how to do this.  Once you have flashed the device, started the CCS debugger, connected the ARM and DSP cores, and loaded their respective executables, you are ready to set breakpoint(s). Simply double-click to the left of the desired line number and you should see a blue circle and checkmark appear. Your breakpoint is now set, and you can start the cores.

    Sometimes CCS will not let you set a breakpoint on the line you want. If this happens and you can't move it to another convenient line, you may need to recompile that file/library and change the -O3 optimization setting to -O0.  If stepping through code is erratic, this is another indication that the debugger is having trouble dealing with the highly optimized code.  Another issue with debugging optimized code is that local variables may not be accessible or trustworthy.

    -dave