完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
ti mmWave sensor是高集成度的毫米波雷达传感器SOC,在开发过程中,SDK及TI DEMO均使用灵活的UART接口发送CLI命令进行射频参数配置及相关算法参数的配置。对于量产及或者有固化参数的产品而言,将参数固化在代码中会是一项明确的需求。本文介绍一种可以快速将CFG文件参数固化到应用代码中的实现方式,同时支持原有串口的CLI配置,无需修改SDK驱动层代码,可方便快捷的完成参数的固化。
本文的测试环境如下:
1. 运行SDK mmWave sensor demo的流程及对外接口说明 在现有的TI mmWave SDK及TOOLBOX相关的示例代码中,均使用两个串口进行参数的配置及数据的获取,EVM板载的TM4C MCU是一个板载XDS110仿真器,仿真器自带两路串口,可以直接完成SDK DEMO中的参数配置及数据输出。在客制化产品中,可以使用外部的2个USB<->UART桥接线缆进行调试,两个串口的默认使用情况如下: 配置命令口:Application/User Uart: Configuration port 115200bps: UART_RX/TX port <-> USB-UART cable <-> PC 数据口:Auxilliary Data Port: Data port 921600bps: MSS_LOGGER-> USB-UART cable -> PC mmWave sensor的启动配置流程 2. 修改CLI参数以调整mmWave sensor 的配置参数 以SDK内的Out of Box demo为例,将BIN文件(比如:.mmwave_sdk_ 对于Toolbox内的demo,则需要同时参考SDK user’s Guide 及toolbox内的demo guide,其配置文件有SDK通用的部分,也有属于此demo独有的配置命令,包含SDK参数、目标检测层的参数、追踪器层的参数,示例如下(.mmwave_industrial_toolbox_4_9_0labspeople_counting68xx_3D_people_countingchirp_configsAOP_6m_default.cfg): % SDK Parameters % See the SDK user's guide for more information % "C: immwave_sdk_[VER]docsmmwave_sdk_user_guide.pdf" sensorStop flushCfg dfeDataOutputMode 1 channelCfg 15 7 0 adcCfg 2 1 adcbufCfg -1 0 1 1 1 lowPower 0 0 % Detection Layer Parameters % See the Detection Layer Tuning Guide for more information % "C: immwave_industrial_toolbox_[VER]labspeople_countingdocs3D_people_counting_detection_layer_tuning_guide.pdf" profileCfg 0 60.75 30.00 25.00 59.10 394758 0 54.71 1 96 2950.00 2 1 36 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 96 0 55.00 1 0 dynamicRACfarCfg -1 4 4 2 2 8 12 4 8 5.00 8.00 0.40 1 1 staticRACfarCfg -1 6 2 2 2 8 8 6 4 8.00 15.00 0.30 0 0 dynamicRangeAngleCfg -1 0.75 0.0010 1 0 dynamic2DAngleCfg -1 1.5 0.0300 1 0 1 0.30 0.85 8.00 staticRangeAngleCfg -1 0 8 8 antGeometry0 -1 -1 0 0 -3 -3 -2 -2 -1 -1 0 0 antGeometry1 -1 0 -1 0 -3 -2 -3 -2 -3 -2 -3 -2 antPhaseRot 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 fovCfg -1 70.0 20.0 compRangeBiasAndRxChanPhase 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 % Tracker Layer Parameters % See the Tracking Layer Tuning Guide for more information % "C: immwave_industrial_toolbox_[VER]labspeople_countingdocs3D_people_counting_tracker_layer_tuning_guide.pdf" staticBoundaryBox -3 3 0.5 7.5 0 3 boundaryBox -4 4 0 8 0 3 sensorPosition 2 0 15 gatingParam 3 2 2 2 4 stateParam 3 3 12 500 5 6000 allocationParam 20 100 0.1 20 0.5 20 maxAcceleration 0.1 0.1 0.1 trackingCfg 1 2 800 30 46 96 55 presenceBoundaryBox -3 3 0.5 7.5 0 3 sensorStart 3. 固化CLI参数以实现芯片上电后自动加载配置 固化配置参数有几种操作方式,如SDK文档描述(file:///C:/ti/mmwave_sdk_03_05_00_04/packages/ti/demo/xwr68xx/mmw/docs/doxygen/html/index.html#bypassCLI),用户可以将CFG文件中每一条都使用对应的函数调用替换。这种方式比较底层,代码的改动量较大,但是可以节省一部分代码空间。实现方法可参考Toolbox中提供的一个hard-coded chirp configurations的参考示例代码,位于:.mmwave_industrial_toolbox_4_9_0labsout_of_box_demo68xx_mmwave_sdk_hcc 本文所介绍的CLI参数固化方式将保留原有的CLI串口调试的接口,同时将现有的CFG参数以CLI的格式配置进去,可视化程度高,实现更为简单,实现方式如下。
#include
extern CLI_MCB gCLI;
extern void MmwDemo_Bypass_CLI (void);
MmwDemo_Bypass_CLI();
#define CLI_BYPASS 1 #define MAX_RADAR_CMD 30 uint8_t* radarCmdString[MAX_RADAR_CMD] = { {"sensorStop "}, {"flushCfg "}, {"dfeDataOutputMode 1 "}, {"channelCfg 15 5 0 "}, {"adcCfg 2 1 "}, {"adcbufCfg -1 0 1 1 1 "}, {"lowPower 0 0 "}, {"profileCfg 0 60 7 3 24 0 0 166 1 256 12500 0 0 158 "}, {"chirpCfg 0 0 0 0 0 0 0 1 "}, {"chirpCfg 1 1 0 0 0 0 0 4 "}, {"frameCfg 0 1 32 0 100 1 0 "}, {"guiMonitor -1 1 1 1 0 0 1 "}, {"cfarCfg -1 0 2 8 4 3 0 15.0 0 "}, {"cfarCfg -1 1 0 4 2 3 1 15.0 0 "}, {"multiObjBeamForming -1 1 0.5 "}, {"calibDcRangeSig -1 0 -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.25 9.0 "}, {"cfarFovCfg -1 1 -20.16 20.16 "}, {"extendedMaxVelocity -1 0 "}, {"CQRxSatMonitor 0 3 4 63 0 "}, {"CQSigImgMonitor 0 127 4 "}, {"analogMonitor 0 0 "}, {"lvdsStreamCfg -1 0 0 0 "}, {"bpmCfg -1 0 0 0 "}, {"calibData 0 0 0 "}, {"sensorStart "} }; static int32_t CLI_ByPassApi(CLI_Cfg* ptrCLICfg) { //uint8_t cmdString[128]; char* tokenizedArgs[CLI_MAX_ARGS]; char* ptrCLICommand; char delimitter[] = " "; 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 "); } else { CLI_write ("Error %d ", 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 ", tokenizedArgs[0]); } } } return 0; } void MmwDemo_Bypass_CLI (void) { if (CLI_ByPassApi(&gCLI.cfg) != 0) { System_printf ("Error: Unable to CLI_ByPassApi "); return; } return; } 4. 运行测试例程 将上述代码集成进测试程序后,mmWave sensor成功配置。将此BIN文件烧写到EVM板卡中,可以实现上电自动配置参数及运行的功能,代码上电自动运行功能添加成功。 CCS debug运行模式下,CCS控制台打印信息如下: [Cortex_R4_0] ********************************************** Debug: Launching the MMW Demo on MSS ********************************************** Debug: Launched the Initialization Task Debug: mmWave Control Initialization was successful Debug: mmWave Control Synchronization was successful [C674X_0] Debug: DPM Module Sync is done [Cortex_R4_0] Debug: CLI is operational Debug: Sending rlRfSetLdoBypassConfig with 0 0 0 ============ Heap Memory Stats ============ Size Used Free DPCUsed System Heap(TCMB) 32768 28016 4752 2048 L3 786432 262144 524288 localRam(TCMB) 4096 512 3584 ============ Heap Memory Stats ============ Size Used Free DPCUsed System Heap(L2) 32768 16112 16656 0 L3 786432 16384 770048 localRam(L2) 50176 15272 34904 localRam(L1) 16384 5728 10656 Starting Sensor (issuing MMWave_start) 直接烧写BIN文件到EVM板卡,串口打印信息如下: ****************************************** xWR68xx MMW Demo 03.05.00.04 ****************************************** mmwDemo:/>Ignored: Sensor is already stopped Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Done Debug: Init Calibration Status = 0x1ffe Done mmwDemo:/> 5. 附加说明 在部分的demo(比如3D people counting demo)中,会出现堆栈溢出导致上电后,initTask中,bypasscli配置失败的情况,此时只需要需要适当增加此task的stacksize为4*1024,即可完成参数的配置。 /* Initialize the Task Parameters. */ Task_Params_init(&taskParams); taskParams.stackSize = 4*1024; gMmwMssMCB.taskHandles.initTask = Task_create(MmwDemo_initTask, &taskParams, NULL);
|
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
692 浏览 0 评论
1106 浏览 1 评论
2473 浏览 5 评论
2808 浏览 9 评论
移植了freeRTOS到STMf103之后显示没有定义的原因?
2646 浏览 6 评论
使用eim外接fpga可是端口一点反应都没有有没有大哥指点一下啊
653浏览 9评论
649浏览 7评论
请教大神怎样去解决iMX6Q在linux3.0.35内核上做AP失败的问题呢
781浏览 6评论
628浏览 5评论
668浏览 5评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 01:09 , Processed in 0.636984 second(s), Total 74, Slave 50 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号