Hallo TI,
Currently we are using AWR1843BOOST developement board along with odd_demo example. Everything works well if we load the configurational parameters from the od_demo_18xx_4zone_strong file as mentioned in the documentation.
Now we would like to update the config parameters inside the code, so that we do not need to send them again and again. I have gone through the following thread and changed the code according to the thread.
Now my cli.c file looks like the following:
/* * @file cli.c * * @brief * CLI Utility implementation * * \par * NOTE: * (C) Copyright 2016 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/std.h> #include <ti/sysbios/knl/Task.h> /* mmWave SDK Include Files: */ #include <ti/common/sys_common.h> #include <ti/drivers/uart/UART.h> #include <ti/utils/cli/cli.h> #include <ti/utils/cli/include/cli_internal.h> /************************************************************************** *************************** Global Variables ***************************** **************************************************************************/ /** * @brief Global variable which tracks the CLI MCB */ CLI_MCB gCLI; #define CLI_BYPASS 1 #define MAX_RADAR_CMD 35 /************************************************************************** **************************** CLI Functions ******************************* **************************************************************************/ uint8_t* radarCmdString[MAX_RADAR_CMD] = { { "sensorStop \n\r" }, { "flushCfg \n\r" }, { "dfeDataOutputMode 1 \n\r" }, { "channelCfg 15 5 0 \n\r" }, { "adcCfg 2 1 \n\r" }, { "adcbufCfg -1 0 0 1 1 \n\r" }, { "profileCfg 0 77 250 10 40 0 0 98 1 64 2200 0 0 40 \n\r" }, { "chirpCfg 0 0 0 0 0 0 0 1 \n\r" }, { "chirpCfg 1 1 0 0 0 0 0 4 \n\r" }, { "chirpCfg 2 2 0 0 0 0 0 1 \n\r" }, { "chirpCfg 3 3 0 0 0 0 0 4 \n\r" }, { "frameCfg 0 3 128 0 160 1 0 \n\r" }, { "lowPower 0 1 \n\r" }, { "guiMonitor 0 1 16 \n\r" }, { "zoneDef 6 9 10 8 15 9 10 25 15 24 10 7 15 24 10 25 15 8 12 8 32 23 12 7 33 \n\r" }, { "coeffMatrixRow 0 0 -4.754324 -2.918187 -3.092203 0.830907 0.552929 -0.687147 \n\r" }, { "coeffMatrixRow 0 1 -5.703177 0.674435 -1.478906 2.245525 -4.206239 1.663890 \n\r" }, { "coeffMatrixRow 0 2 -5.943565 -1.577987 0.767365 -4.969552 2.312347 0.649023 \n\r" }, { "coeffMatrixRow 0 3 -3.703190 2.756885 3.185698 5.074520 5.700438 -1.095576 \n\r" }, { "meanVector 0 24.037678 24.190493 -3.548437 -3.395622 0.781468 \n\r" }, { "stdVector 0 6.573913 6.361020 2.047009 2.197788 0.235027 \n\r" }, { "coeffMatrixRow 1 0 -4.352746 -2.823618 -3.224717 0.759691 0.487618 -0.582427 \n\r" }, { "coeffMatrixRow 1 1 -7.148465 0.546920 -1.852454 2.332433 -5.030055 2.240273 \n\r" }, { "coeffMatrixRow 1 2 -6.355251 -1.247689 1.201112 -4.680427 2.418175 0.433769 \n\r" }, { "coeffMatrixRow 1 3 -3.381314 2.879600 2.633233 6.402036 6.471842 -0.586713 \n\r" }, { "meanVector 1 24.398743 25.289200 -3.856646 -2.966190 0.782421 \n\r" }, { "stdVector 1 5.997018 5.500159 2.139213 1.685689 0.230110 \n\r" }, { "coeffMatrixRow 2 0 -3.506743 -2.779804 -3.963650 2.476710 2.402796 -0.088806 \n\r" }, { "coeffMatrixRow 2 1 -7.534330 0.563958 -2.105546 1.121132 -4.824188 0.669537 \n\r" }, { "coeffMatrixRow 2 2 -6.765194 -1.941965 0.997140 -4.181822 1.059862 -0.219922 \n\r" }, { "coeffMatrixRow 2 3 -2.723959 3.377164 3.557205 2.347750 2.817945 -0.344288 \n\r" }, { "meanVector 2 22.447967 24.521007 -5.382478 -3.309438 0.371322 \n\r" }, { "stdVector 2 8.796452 7.459647 5.076880 3.104276 0.402330 \n\r" }, { "oddemoParms 1 8 0.001 0.50 18 \n\r" }, { "sensorStart \n\r" }, }; static int32_t CLI_ByPassApi(CLI_Cfg* ptrCLICfg) { //uint8_t cmdString[128]; char* tokenizedArgs[CLI_MAX_ARGS]; char* ptrCLICommand; char delimitter[] = " \r\n"; uint32_t argIndex; CLI_CmdTableEntry * ptrCLICommandEntry; int32_t cliStatus; uint32_t index, idx; uint16_t numCLICommands = 0U; /* Sanity Check: Validate the arguments */ if (ptrCLICfg == NULL) return -1; /* Cycle through and determine the number of supported CLI commands: */ for (index = 0; index < CLI_MAX_CMD; index++) { /* Do we have a valid entry? */ if (ptrCLICfg->tableEntry[index].cmd == NULL) { /* NO: This is the last entry */ break; } else { /* YES: Increment the number of CLI commands */ numCLICommands = numCLICommands + 1; } } /* Execute All Radar Commands */ for (idx = 0; idx < MAX_RADAR_CMD; idx++) { /* Reset all the tokenized arguments: */ memset((void *) &tokenizedArgs, 0, sizeof(tokenizedArgs)); argIndex = 0; ptrCLICommand = (char*) radarCmdString[idx]; /* Set the CLI status: */ cliStatus = -1; /* The command has been entered we now tokenize the command message */ while (1) { /* Tokenize the arguments: */ tokenizedArgs[argIndex] = strtok(ptrCLICommand, delimitter); if (tokenizedArgs[argIndex] == NULL) break; /* Increment the argument index: */ argIndex++; if (argIndex >= CLI_MAX_ARGS) break; /* Reset the command string */ ptrCLICommand = NULL; } /* Were we able to tokenize the CLI command? */ if (argIndex == 0) continue; /* Cycle through all the registered CLI commands: */ for (index = 0; index < numCLICommands; index++) { ptrCLICommandEntry = &ptrCLICfg->tableEntry[index]; /* Do we have a match? */ if (strcmp(ptrCLICommandEntry->cmd, tokenizedArgs[0]) == 0) { /* YES: Pass this to the CLI registered function */ cliStatus = ptrCLICommandEntry->cmdHandlerFxn(argIndex, tokenizedArgs); if (cliStatus == 0) { CLI_write("Done\n"); } else { CLI_write("Error %d\n", cliStatus); } break; } } /* Did we get a matching CLI command? */ if (index == numCLICommands) { /* NO matching command found. Is the mmWave extension enabled? */ if (ptrCLICfg->enableMMWaveExtension == 1U) { /* Yes: Pass this to the mmWave extension handler */ cliStatus = CLI_MMWaveExtensionHandler(argIndex, tokenizedArgs); } /* Was the CLI command found? */ if (cliStatus == -1) { /* No: The command was still not found */ CLI_write("'%s' is not recognized as a CLI command\n", tokenizedArgs[0]); } } } return 0; } /** * @b Description * @n * The function is the HELP generated by the CLI Module * * \ingroup CLI_UTIL_INTERNAL_FUNCTION * * @retval * Not Applicable. */ static int32_t CLI_help(int32_t argc, char* argv[]) { uint32_t index; /* Display the banner: */ CLI_write("Help: This will display the usage of the CLI commands\n"); CLI_write("Command: Help Description\n"); /* Cycle through all the registered CLI commands: */ for (index = 0; index < gCLI.numCLICommands; index++) { /* Display the help string*/ CLI_write( "%s: %s\n", gCLI.cfg.tableEntry[index].cmd, (gCLI.cfg.tableEntry[index].helpString == NULL) ? "No help available" : gCLI.cfg.tableEntry[index].helpString); } /* Is the mmWave Extension enabled? */ if (gCLI.cfg.enableMMWaveExtension == 1U) { /* YES: Pass the control to the extension help handler. */ CLI_MMWaveExtensionHelp(); } return 0; } /** * @b Description * @n * This is the CLI Execution Task * * \ingroup CLI_UTIL_INTERNAL_FUNCTION * * @retval * Not Applicable. */ static void CLI_task(UArg arg0, UArg arg1) { // uint8_t cmdString[256]; // char* tokenizedArgs[CLI_MAX_ARGS]; // char* ptrCLICommand; // char delimitter[] = " \r\n"; // uint32_t argIndex; // CLI_CmdTableEntry * ptrCLICommandEntry; // int32_t cliStatus; // uint32_t index; // // /* Do we have a banner to be displayed? */ // if (gCLI.cfg.cliBanner != NULL) // { // /* YES: Display the banner */ // CLI_write(gCLI.cfg.cliBanner); // } // // /* Loop around forever: */ // while (1) // { // /* Demo Prompt: */ // CLI_write(gCLI.cfg.cliPrompt); // // /* Reset the command string: */ // memset((void *) &cmdString[0], 0, sizeof(cmdString)); // // /* Read the command message from the UART: */ // UART_read(gCLI.cfg.cliUartHandle, &cmdString[0], // (sizeof(cmdString) - 1)); // // /* Reset all the tokenized arguments: */ // memset((void *) &tokenizedArgs, 0, sizeof(tokenizedArgs)); // argIndex = 0; // ptrCLICommand = (char*) &cmdString[0]; // // /* comment lines found - ignore the whole line*/ // if (cmdString[0] == '%') // { // CLI_write("Skipped\n"); // continue; // } // // /* Set the CLI status: */ // cliStatus = -1; // // /* The command has been entered we now tokenize the command message */ // while (1) // { // /* Tokenize the arguments: */ // tokenizedArgs[argIndex] = strtok(ptrCLICommand, delimitter); // if (tokenizedArgs[argIndex] == NULL) // break; // // /* Increment the argument index: */ // argIndex++; // if (argIndex >= CLI_MAX_ARGS) // break; // // /* Reset the command string */ // ptrCLICommand = NULL; // } // // /* Were we able to tokenize the CLI command? */ // if (argIndex == 0) // continue; // // /* Cycle through all the registered CLI commands: */ // for (index = 0; index < gCLI.numCLICommands; index++) // { // ptrCLICommandEntry = &gCLI.cfg.tableEntry[index]; // // /* Do we have a match? */ // if (strcmp(ptrCLICommandEntry->cmd, tokenizedArgs[0]) == 0) // { // /* YES: Pass this to the CLI registered function */ // cliStatus = ptrCLICommandEntry->cmdHandlerFxn(argIndex, // tokenizedArgs); // if (cliStatus == 0) // { // CLI_write("Done\n"); // } // else // { // CLI_write("Error %d\n", cliStatus); // } // break; // } // } // // /* Did we get a matching CLI command? */ // if (index == gCLI.numCLICommands) // { // /* NO matching command found. Is the mmWave extension enabled? */ // if (gCLI.cfg.enableMMWaveExtension == 1U) // { // /* Yes: Pass this to the mmWave extension handler */ // cliStatus = CLI_MMWaveExtensionHandler(argIndex, tokenizedArgs); // } // // /* Was the CLI command found? */ // if (cliStatus == -1) // { // /* No: The command was still not found */ // CLI_write("'%s' is not recognized as a CLI command\n", // tokenizedArgs[0]); // } // } // } /* By Pass CLI Code starts Here .. */ CLI_ByPassApi(&radarCmdString[0]); } /** * @b Description * @n * Logging function which can log the messages to the CLI console * * @param[in] format * Format string * * \ingroup CLI_UTIL_EXTERNAL_FUNCTION * * @retval * Not Applicable. */ void CLI_write(const char* format, ...) { va_list arg; char logMessage[256]; int32_t sizeMessage; /* Format the message: */ va_start(arg, format); sizeMessage = vsnprintf(&logMessage[0], sizeof(logMessage), format, arg); va_end(arg); /* If CLI_write is called before CLI init has happened, return */ if (gCLI.cfg.cliUartHandle == NULL) { return; } /* Log the message on the UART CLI console: */ if (gCLI.cfg.usePolledMode == true) { /* Polled mode: */ UART_writePolling(gCLI.cfg.cliUartHandle, (uint8_t*) &logMessage[0], sizeMessage); } else { /* Blocking Mode: */ UART_write(gCLI.cfg.cliUartHandle, (uint8_t*) &logMessage[0], sizeMessage); } } /** * @b Description * @n * This is the function which is used to initialize and setup the CLI * * @param[in] ptrCLICfg * Pointer to the CLI configuration * * \ingroup CLI_UTIL_EXTERNAL_FUNCTION * * @retval * Success - 0 * @retval * Error - <0 */ int32_t CLI_open(CLI_Cfg* ptrCLICfg) { Task_Params taskParams; uint32_t index; /* Sanity Check: Validate the arguments */ if (ptrCLICfg == NULL) return -1; /* Initialize the CLI MCB: */ memset((void*) &gCLI, 0, sizeof(CLI_MCB)); /* Copy over the configuration: */ memcpy((void *) &gCLI.cfg, (void *) ptrCLICfg, sizeof(CLI_Cfg)); /* Cycle through and determine the number of supported CLI commands: */ for (index = 0; index < CLI_MAX_CMD; index++) { /* Do we have a valid entry? */ if (gCLI.cfg.tableEntry[index].cmd == NULL) { /* NO: This is the last entry */ break; } else { /* YES: Increment the number of CLI commands */ gCLI.numCLICommands = gCLI.numCLICommands + 1; } } /* Is the mmWave Extension enabled? */ if (gCLI.cfg.enableMMWaveExtension == 1U) { /* YES: Initialize the CLI Extension: */ if (CLI_MMWaveExtensionInit(ptrCLICfg) < 0) return -1; } /* Do we have a CLI Prompt specified? */ if (gCLI.cfg.cliPrompt == NULL) gCLI.cfg.cliPrompt = "CLI:/>"; /* The CLI provides a help command by default: * - Since we are adding this at the end of the table; a user of this module can also * override this to provide its own implementation. */ gCLI.cfg.tableEntry[gCLI.numCLICommands].cmd = "help"; gCLI.cfg.tableEntry[gCLI.numCLICommands].helpString = NULL; gCLI.cfg.tableEntry[gCLI.numCLICommands].cmdHandlerFxn = CLI_help; /* Increment the number of CLI commands: */ gCLI.numCLICommands++; /* Initialize the task parameters and launch the CLI Task: */ Task_Params_init(&taskParams); taskParams.priority = gCLI.cfg.taskPriority; taskParams.stackSize = 4 * 1024; gCLI.cliTaskHandle = Task_create(CLI_task, &taskParams, NULL); return 0; } /** * @b Description * @n * This is the function which is used to close the CLI module * * \ingroup CLI_UTIL_EXTERNAL_FUNCTION * * @retval * Success - 0 * @retval * Error - <0 */ int32_t CLI_close(void) { /* Shutdown the CLI Task */ Task_delete(&gCLI.cliTaskHandle); /* Cleanup the memory */ memset((void*) &gCLI, 0, sizeof(CLI_MCB)); return 0; }
After changing the code it is not working (I am not receiving any data from the Radar). Is there any other information I overlooked ?
Thank you.
Best Regards,
Venkatesh Vasanthapu.