TI mmWave sensor是高集成度的毫米波雷達(dá)傳感器SOC,在開發(fā)過程中,SDK及TI DEMO均使用靈活的UART接口發(fā)送CLI命令進(jìn)行射頻參數(shù)配置及相關(guān)算法參數(shù)的配置。對于量產(chǎn)及或者有固化參數(shù)的產(chǎn)品而言,將參數(shù)固化在代碼中會是一項明確的需求。本文介紹一種可以快速將CFG文件參數(shù)固化到應(yīng)用代碼中的實現(xiàn)方式,同時支持原有串口的CLI配置,無需修改SDK驅(qū)動層代碼,可方便快捷的完成參數(shù)的固化。
本文的測試環(huán)境如下:
- 此方法適用器件型號:I/AWR1443, I/AWR1642, I/AWR1843, I/AWR6843
- 本文測試軟件版本:mmWave SDK 3.5.0.4
- 本文測試硬件平臺:IWR6843ISK EVM
1. 運(yùn)行SDK mmWave sensor demo的流程及對外接口說明
在現(xiàn)有的TI mmWave SDK及TOOLBOX相關(guān)的示例代碼中,均使用兩個串口進(jìn)行參數(shù)的配置及數(shù)據(jù)的獲取,EVM板載的TM4C MCU是一個板載XDS110仿真器,仿真器自帶兩路串口,可以直接完成SDK DEMO中的參數(shù)配置及數(shù)據(jù)輸出。在客制化產(chǎn)品中,可以使用外部的2個USB<->UART橋接線纜進(jìn)行調(diào)試,兩個串口的默認(rèn)使用情況如下:
配置命令口:Application/User Uart: Configuration port 115200bps: UART_RX/TX port <-> USB-UART cable <-> PC
數(shù)據(jù)口:Auxilliary Data Port: Data port 921600bps: MSS_LOGGER-> USB-UART cable -> PC
mmWave sensor的啟動配置流程
2. 修改CLI參數(shù)以調(diào)整mmWave sensor 的配置參數(shù)
以SDK內(nèi)的Out of Box demo為例,將BIN文件(比如:.\mmwave_sdk_\packages\ti\demo\xwr68xx\mmw\xwr68xx_mmw_demo.bin)燒寫至板卡后,啟動后,需要通過GUI下發(fā)CFG配置(比如:.\mmwave_sdk_\packages\ti\demo\xwr68xx\mmw\profiles\profile_2d.cfg),成功將配置加載后,IWR6843雷達(dá)芯片及開始射頻發(fā)波及目標(biāo)探測的工作。CFG文件各項配置具體信息在mmWave SDK user’s guide中有詳細(xì)描述(文檔路徑:.\mmwave_sdk_\docs\mmwave_sdk_user_guide.pdf),通過CLI參數(shù)的配置,可靈活修改雷達(dá)的RF參數(shù)及信號處理的參數(shù),方便調(diào)試工作的進(jìn)行。
對于Toolbox內(nèi)的demo,則需要同時參考SDK user’s Guide 及toolbox內(nèi)的demo guide,其配置文件有SDK通用的部分,也有屬于此demo獨(dú)有的配置命令,包含SDK參數(shù)、目標(biāo)檢測層的參數(shù)、追蹤器層的參數(shù),示例如下(.\mmwave_industrial_toolbox_4_9_0\labs\people_counting\68xx_3D_people_counting\chirp_configs\AOP_6m_default.cfg):
% See the SDK user's guide for more information
% "C:\ti\mmwave_sdk_[VER]\docs\mmwave_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:\ti\mmwave_industrial_toolbox_[VER]\labs\people_counting\docs\3D_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:\ti\mmwave_industrial_toolbox_[VER]\labs\people_counting\docs\3D_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參數(shù)以實現(xiàn)芯片上電后自動加載配置
固化配置參數(shù)有幾種操作方式,如SDK文檔描述(file:///C:/ti/mmwave_sdk_03_05_00_04/packages/ti/demo/xwr68xx/mmw/docs/doxygen/html/index.html#bypassCLI),用戶可以將CFG文件中每一條都使用對應(yīng)的函數(shù)調(diào)用替換。這種方式比較底層,代碼的改動量較大,但是可以節(jié)省一部分代碼空間。實現(xiàn)方法可參考Toolbox中提供的一個hard-coded chirp configurations的參考示例代碼,位于:.\mmwave_industrial_toolbox_4_9_0\labs\out_of_box_demo\68xx_mmwave_sdk_hcc
本文所介紹的CLI參數(shù)固化方式將保留原有的CLI串口調(diào)試的接口,同時將現(xiàn)有的CFG參數(shù)以CLI的格式配置進(jìn)去,可視化程度高,實現(xiàn)更為簡單,實現(xiàn)方式如下。
- 在c 增加頭文件
#include
- 在c中增加外部結(jié)構(gòu)體的定義。
extern CLI_MCB gCLI;
- 在c中,增加如下外部函數(shù)定義。
extern void MmwDemo_Bypass_CLI (void);
- 在c的"void MmwDemo_initTask(UArg arg0, UArg arg1)"函數(shù)中,在CLI_OPEN之后,調(diào)用” MmwDemo_Bypass_CLI”函數(shù)。
MmwDemo_Bypass_CLI();
- 在C中增加如下配置命令及代碼。
#define CLI_BYPASS 1
#define MAX_RADAR_CMD 30
uint8_t* radarCmdString[MAX_RADAR_CMD] =
{
{"sensorStop\r\n"},
{"flushCfg\r\n"},
{"dfeDataOutputMode 1\r\n"},
{"channelCfg 15 5 0\r\n"},
{"adcCfg 2 1\r\n"},
{"adcbufCfg -1 0 1 1 1\r\n"},
{"lowPower 0 0\r\n"},
{"profileCfg 0 60 7 3 24 0 0 166 1 256 12500 0 0 158\r\n"},
{"chirpCfg 0 0 0 0 0 0 0 1\r\n"},
{"chirpCfg 1 1 0 0 0 0 0 4\r\n"},
{"frameCfg 0 1 32 0 100 1 0\r\n"},
{"guiMonitor -1 1 1 1 0 0 1\r\n"},
{"cfarCfg -1 0 2 8 4 3 0 15.0 0\r\n"},
{"cfarCfg -1 1 0 4 2 3 1 15.0 0\r\n"},
{"multiObjBeamForming -1 1 0.5\r\n"},
{"calibDcRangeSig -1 0 -5 8 256\r\n"},
{"clutterRemoval -1 0\r\n"},
{"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\r\n"},
{"measureRangeBiasAndRxChanPhase 0 1. 0.2\r\n"},
{"aoaFovCfg -1 -90 90 -90 90\r\n"},
{"cfarFovCfg -1 0 0.25 9.0\r\n"},
{"cfarFovCfg -1 1 -20.16 20.16\r\n"},
{"extendedMaxVelocity -1 0\r\n"},
{"CQRxSatMonitor 0 3 4 63 0\r\n"},
{"CQSigImgMonitor 0 127 4\r\n"},
{"analogMonitor 0 0\r\n"},
{"lvdsStreamCfg -1 0 0 0\r\n"},
{"bpmCfg -1 0 0 0\r\n"},
{"calibData 0 0 0\r\n"},
{"sensorStart\r\n"}
};
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;
}
void MmwDemo_Bypass_CLI (void)
{
if (CLI_ByPassApi(&gCLI.cfg) != 0)
{
System_printf ("Error: Unable to CLI_ByPassApi\n");
return;
}
return;
}
4. 運(yùn)行測試?yán)?/h3>
將上述代碼集成進(jìn)測試程序后,mmWave sensor成功配置。將此BIN文件燒寫到EVM板卡中,可以實現(xiàn)上電自動配置參數(shù)及運(yùn)行的功能,代碼上電自動運(yùn)行功能添加成功。
CCS debug運(yùn)行模式下,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)
直接燒寫B(tài)IN文件到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)中,會出現(xiàn)堆棧溢出導(dǎo)致上電后,initTask中,bypasscli配置失敗的情況,此時只需要需要適當(dāng)增加此task的stacksize為4*1024,即可完成參數(shù)的配置。
/* Initialize the Task Parameters. */
Task_Params_init(&taskParams);
taskParams.stackSize = 4*1024;
gMmwMssMCB.taskHandles.initTask = Task_create(MmwDemo_initTask, &taskParams, NULL);
6. 參考資料
- IWR6843、IWR6443 單芯片 60GHz 至 64GHz 毫米波傳感器 數(shù)據(jù)表 (Rev. D)
- mmWave SDK: mmWave Software Development Kit http://www.ti.com/tool/mmwave-sdk
- mmWave SDK User’s Guide: C:\ti\mmwave_sdk_03_05_00_04\docs\mmwave_sdk_user_guide.pdf
- mmWave SDK Out of Box Demo - XWR68XX: C:/ti/mmwave_sdk_03_05_00_04/packages/ti/demo/xwr68xx/mmw/docs/doxygen/html/index.html
- mmWave SDK Out of Box Demo - 68xx Hard-Coded Config Version User's Guide: C:/ti/mmwave_industrial_toolbox_4_9_0/labs/out_of_box_demo/68xx_mmwave_sdk_hcc/docs/mmWave_sdk_68xx_hcc_user_guide.html
-
汽車
+關(guān)注
關(guān)注
13文章
3389瀏覽量
37114 -
AWR1443
+關(guān)注
關(guān)注
0文章
3瀏覽量
2235
發(fā)布評論請先 登錄
相關(guān)推薦
評論