Hard Coded Config User Guide

Table of Contents

Overview

This user guide will walk through the necessary steps to have basic Out of Box Demo configuration commands be hard coded to the EVM. Hard Coded Configuration will be abbreviated in this user guide with HCC.

The configuration commands for many mmWave radar labs are normally sent over UART to the EVM. The configuration commands are stored in a separate text file and sent at startup, but this requires a PC connection and manual user control steps. It can be very helpful to have these configuration values ‘hard coded’ so the device will boot, configure, chirp, and output data immediately when powered up without further manual setup from the user.

⚠️ Previous Hard Coded Configuration User Guide
The older version of this User Guide can be found in the Industrial Toolbox 4.9 in the Out of Box Demo folder under Labs.

Quickstart

Prerequisite

⚠️ Run Out of Box Demo
Before continuing with this lab, users should first run the out of box demo for the EVM. This will enable users to gain familiarity with the sensor’s capabilities as well as the various tools used across all labs in the mmWave Radar Toolbox.

1. Software Requirements

Tool Version Download Link
TI mmWave SDK 3.5.x.x Link to Latest mmWave SDK. To access a previous version of the mmWave SDK scroll to the bottom of the table and click the link under “MMWAVE-SDK previous release”. Repeat to continue stepping back to previous versions.
Code Composer Studio Latest Code Composer Studio
Terminal Emulator Latest TeraTerm or another terminal emulation software to ensure proper data streaming upon device bootup. The instructions provided in this user guide are based on TeraTerm

2. Flashing the EVM

A prebuilt binary setup for HCC for the Out of Box Demo has already been generated and has the configuration commands from the profile_3d.cfg file stored inside the cli.c file alongside additional code overhead.

Detailed steps can be found in the later Developer’s Guide section of the user guide on how to create this modified cli.c file and the integration steps needed.

Please find the prebuilt binary file xwr68xx_mmw_demo_hcc.bin in the below directory and flash it onto the EVM.

<RADAR_TOOLBOX_INSTALL_DIR>\source\ti\examples\Fundamentals\Hard_Coded_Config\prebuilt_binaries\xwr68xx_mmw_demo_hcc.bin

3. Checking HCC Functionality with Tera Term Data Stream

To check that the EVM has been configured correctly, set the EVM to functional mode after flashing. Power up the device and connect the EVM’s Data COM port to a Tera Term Instance to receive the EVM’s data stream.

1. Launch the UART Terminal

2. Observe the Sensor’s Data Stream

📝 NOTE Initially, the data stream will appear as a long series of characters. To view a more coherent data stream, enable debug mode within the TERATERM.ini configuration file and change the output to hex mode. Once debug mode is configured properly, pressing Shift+Esc will enable debug mode and adjust the output to a readable format. Refer to the Tera Term setup webpage for more information

4. Running the EVM in the Visualizer GUI

Now that the EVM has been configured for HCC, the normal Visualizer GUI implementations will not work because the send configuration button will attempt to still send configuration commands to the EVM and will mess up and block any other additional threads to start the GUI.

The mmWave Industrial Visualizer has updated configuration control buttons to be compatible with the EVM with HCC or without HCC. The executable for this visualizer can be found in the below directory.

<RADAR_TOOLBOX_INSTALL_DIR>\tools\visualizers\Industrial_Visualizer\

Ensure that the Config Type is set for SDK Out of Box Demo.

Press the Select Configuration button and load the configuration data for use with the GUI setup. This step does not send the configuration or interact with the EVM and is mainly used to configure GUI settings. Then press the Start without Send Configuration button and the GUI will function like normal.

The Visualizer GUI will start to run like normal and you may notice the Frame count Statistic is non zero because the EVM has already started running on power up before a connection to the GUI is made.

This concludes the Hard Coded Configuration User’s Guide setup with the Out of Box Demo.

Developer’s Guide

Editing the cli.c File

The normal approach to send the configuration commands is to have a separate text file that will be sent through CLI (command line interface). Instead of using the separate text file, the commands will be stored inside an existing file called cli.c which houses CLI utility functions and implementations. The cli.c file will be part of the Out of Box Demo project and be included in the generated binary file that will be flashed to the EVM.

The setup of the EVM device and CLI has the following simplified flow.

initTask –> CLIInit –> CLI_open

The general initialization task calls the CLIInit function. At the end of this CLIInit function, the CLI is opened to receive commands. However, at this point there are still other initializations that need to happen before the device is ready to start. The cfg parameters cannot be set directly after this CLIInit function but instead should be added to the CLI_task() in cli.c.

Note that a copy of the cli.c file containing all of the following code additions can be found here and is already setup.

<RADAR_TOOLBOX_INSTALL_DIR>\source\ti\examples\Fundamentals\Hard_Coded_Config\src\hcc_cli.c

The below example uses the default configuration commands from the profile_3d.cfg file found here but you can add in whatever configuration commands you would like.

<MMWAVE_SDK3_INSTALL_DIR>\packages\ti\demo\xwr68xx\mmw\profiles\profile_3d.cfg

1. Navigate to Folder

Navigate to the cli.c file located in the following path in the SDK folder.

<MMWAVE_SDK3_INSTALL_DIR>\packages\ti\utils\cli\src

2. Add Macro

Add “#define USE_HARD_CODED_CONFIG” to the top of the file. (You can use any macro name you like)

3. Add Additional Variables

Add a char array of all the config parameters as they would appear in the .cfg file. Use ‘#ifdef USE_HARD_CODED_CONFIG’ to enable turning off HCC functionality in the future if desired. Include an integer variable for looping through the cfg parameters.

4. Add Identifier

Include an identifier to signal the end of the commands inside the array with a ‘!’ or other character not used in the cfg parameters. e.g. “!!!END_OF_HARD_CODED_COMMANDS”

#define USE_HARD_CODED_CONFIG

#ifdef USE_HARD_CODED_CONFIG

int32_t hardCodedConfigIndex;


char *hardCodedConfigCommands[] = {
    "sensorStop",
    "flushCfg",
    "dfeDataOutputMode 1",
    "channelCfg 15 7 0",
    "adcCfg 2 1",
    "lowPower 0 0",
    "profileCfg 0 60 7 7 40.32 1315860 0 99 1 256 8000 0 0 104", // add BO = 20, reduce RX gain
    "channelCfg 15 7 0",
    "adcbufCfg -1 0 1 1 1",
    "chirpCfg 0 0 0 0 0 0 0 1",
    "chirpCfg 1 1 0 0 0 0 0 2",
    "chirpCfg 2 2 0 0 0 0 0 4",
    "frameCfg 0 2 32 0 100 1 0",
    "guiMonitor -1 0 1 1 0 0 0",
    "cfarCfg -1 0 2 8 4 3 0 12.0 0",
    "cfarCfg -1 1 0 4 2 3 1 12.0 0",
    "multiObjBeamForming -1 1 0.5",
    "calibDcRangeSig -1 1 -5 8 256",
    "clutterRemoval -1 0",

    "compRangeBiasAndRxChanPhase 0.0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0",
    "measureRangeBiasAndRxChanPhase 0 1. 0.2",

    "aoaFovCfg -1 -90 90 -90 90",
    "cfarFovCfg -1 0 0.1 10", // 10cm to 10m.
    "cfarFovCfg -1 1 -13.39 13.39",
    "extendedMaxVelocity -1 0",

    "CQRxSatMonitor 0 3 4 63 0",
    "CQSigImgMonitor 0 127 4",
    "analogMonitor 0 0",
    "lvdsStreamCfg -1 0 0 0",
    "calibData 0 0 0",
    "sensorStart",
    "!!!END_OF_HARD_CODED_COMMANDS"
};

#endif

5. Adjust Timing

Inside CLI_task() and before the while(1) loop you need to add a section to pause the task for further system initialization. Include some UART prints for clarity if desired.

#ifdef USE_HARD_CODED_CONFIG

    hardCodedConfigIndex = 0;

    CLI_write("Wait some time for system to initialize...\n");

    Task_sleep(100);

    CLI_write("Performing hard-coded config\n");

#endif

6. Replace UART Reads

Inside the while(1) loop, add the loop to read in the char array of cfg parameters added at the top of the file. This replaces the UART_read line that would get the cfg parameter from the UART connection. Bypass this with a #ifdef/#else to revert to the UART communication if HCC is turned off.

#ifdef USE_HARD_CODED_CONFIG

        /* Run hard-coded commands, one at a time until '!!!END_OF_HARD_CODED_COMMANDS' is reached: */

        if (hardCodedConfigCommands[hardCodedConfigIndex][0] != '!')

        {

            // CLI_write (hardCodedConfigCommands[hardCodedConfigIndex]);

            CLI_write("Command\n");

            memcpy((void *)&cmdString[0], (void *)hardCodedConfigCommands[hardCodedConfigIndex],

                   strlen(hardCodedConfigCommands[hardCodedConfigIndex]));

            hardCodedConfigIndex++;
        }

        /* Accept commands from UART after all hard-coded commands done: */

        else

        {

            /* Read the command message from the UART: */

            UART_read(gCLI.cfg.cliUartHandle, &cmdString[0], (sizeof(cmdString) - 1));
        }


#else

        /* Read the command message from the UART: */

        UART_read(gCLI.cfg.cliUartHandle, &cmdString[0], (sizeof(cmdString) - 1));

#endif

Building Flash Binary with HCC Implementation

There are two methods (A and B) for building the flash binary with HCC. Within Method A there are two submethods that will be explained.

Method A.1 (Using Projectspec File)

This method is simpler to implement but will involve unlinking the Out of Box Demo project from CLI files and libraries. The edited cli.c file and supporting files will be loaded directly into the Out of Box Demo project in CCS and will not affect any other project.

Note:This first explanation assumes the use of the projectspec files while there will be an additional section explanation on how to modify an existing project to work with HCC manually.

The project spec files when imported into Code Composer Studio (Abbreviated as CCS) will automate the unlinking and direct loading of the edited cli.c file from above step.

If you wish to change anything different from the above steps you will need to replace the hcc_cli.c file found in the below path with your new file.

<RADAR_TOOLBOX_INSTALL_DIR>\source\ti\examples\Fundamentals\Hard_Coded_Config\src\hcc_cli.c

If the edited cli.c file name was changed from hcc_cli.c you will need to update the name in the mss project spec file.

Make sure that you undefine and disable hard coded config settings in the edited cli.c file from <MMWAVE3_SDK_INSTALL_DIR>\packages\ti\utils\cli\src so that it does not affect any other projects in CCS.

Open up the project spec files for both the MSS and DSS in CCS that can be found here.

<RADAR_TOOLBOX_INSTALL_DIR>\source\ti\examples\Fundamentals\Hard_Coded_Config\src

Take note that the following two files are present in the MSS project.

Rebuild the rebuild the DSS project and then the MSS project and then flash the newly generated binary onto the EVM.

Method A.2 (Editing an Existing CCS Project for HCC)

To understand the manual steps involved, the following explains in detail how to modify an existing project to make it compatible with the newly edited cli.c file from the above step.

Right click the specific project and choose the “Add File” button and a separate window will pop up. Make sure to click copy files so the files are directly inside the project and not linked. Add your edited cli.c file as well as the cli_mmwave.c file which can be found here. <RADAR_TOOLBOX_INSTALL_DIR>\source\ti\examples\Fundamentals\Hard_Coded_Config\src

Note that if you want to make any additional changes, make sure you are making it to the correct cli.c file inside the project in CCS.

Now right click the mss project you are working on and click properties. On the left side you should see on the left drop menu Arm Linker and then File Search Path. In this method the specific library cli file will be unlinked as well as the cli library folder path in general so the project only uses the inserted cli.c file. In the below image are the two highlighted items that need to be deleted from the File Search Path.

Rebuild the rebuild the DSS project and then the MSS project for the Out of Box Demo Project in CCS and then flash the newly generated binary onto the EVM.

Method B

This method will recompile the CLI driver in the SDK and maintain path linking with CLI. Because the cli.c file is in the SDK folder, anytime a project that is also linked to the same SDK folder is rebuilt in CCS, it will utilize the same edited cli.c file. Since many labs will use different configuration commands, you may need to edit and double check correct settings in the cli.c file everytime projects are rebuilt in CCS which may be inconvenient.

The first steps will involve first recompiling the cli drivers as outlined in the SDK user guide section “Developing Using SDK”.

After all initial settings are configured, the first step is to go to the SDK folder and setup the environment by going to the following path (MMWAVE_SDK_INSTALL_PATH\packages\scripts\windows)and running the setenv.bat command. You should see the mmWave Build Environment Configured message after the command is done.

The next step will be to go to the CLI folder in the SDK folder and rebuild by running gmake clean and gmake all as shown below.

The final step will be to go to CCS and rebuild the DSS project and then the MSS project for the Out of Box Demo Project. Lastly flash the newly generated binary onto the EVM.

Need More Help?