【TI毫米波雷达】雷达芯片框架解析:out_of_box开箱demo代码重构,绕过上位机CLI指令(IWR6843AOP)_azimuth target separation with sra(1)

毫米波雷达芯片结构框架解析

CLI指令:

毫米波雷达芯片out_of_box开箱demo代码解读

上位机操作方式:

IWR6843AOPEVM开箱功能测试

上位机指令一览

上位机通过串口发送配置命令
芯片初始化以后 会输出mmwDemo:/>即表示可以接受命令
每次发送的指令都会通过CLI模块执行对应的函数 执行完成后 又会输出mmwDemo:/>
如果是不正确的指令 则实现串口回环(发送什么数据就回复什么数据)
TI官方的上位机配置如图所示:
在这里插入图片描述
对应导出的cfg文件:

% \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
% Created for SDK ver:03.06
% Created using Visualizer ver:3.6.0.0
% Frequency:60
% Platform:xWR68xx_AOP
% Scene Classifier:best_range_res
% Azimuth Resolution(deg):30 + 30
% Range Resolution(m):0.044
% Maximum unambiguous Range(m):9.02
% Maximum Radial Velocity(m/s):1
% Radial velocity resolution(m/s):0.13
% Frame Duration(msec):100
% RF calibration data:None
% Range Detection Threshold (dB):15
% Doppler Detection Threshold (dB):15
% Range Peak Grouping:enabled
% Doppler Peak Grouping:enabled
% Static clutter removal:disabled
% Angle of Arrival FoV: Full FoV
% Range FoV: Full FoV
% Doppler FoV: Full FoV
% \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
sensorStop
flushCfg
dfeDataOutputMode 1
channelCfg 15 7 0
adcCfg 2 1
adcbufCfg -1 0 1 1 1
profileCfg 0 60 359 7 57.14 0 0 70 1 256 5209 0 0 158
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 16 0 100 1 0
lowPower 0 0
guiMonitor -1 1 1 0 0 0 1
cfarCfg -1 0 2 8 4 3 0 15 1
cfarCfg -1 1 0 4 2 3 1 15 1
multiObjBeamForming -1 1 0.5
clutterRemoval -1 0
calibDcRangeSig -1 0 -5 8 256
extendedMaxVelocity -1 0
lvdsStreamCfg -1 0 0 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.5 0.2
CQRxSatMonitor 0 3 5 121 0
CQSigImgMonitor 0 127 4
analogMonitor 0 0
aoaFovCfg -1 -90 90 -90 90
cfarFovCfg -1 0 0 8.92
cfarFovCfg -1 1 -1 1.00
calibData 0 0 0
sensorStart


上位机输出结果:
在这里插入图片描述
对应log:


mmwDemo:/>% \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Skipped

mmwDemo:/>% Created for SDK ver:03.06
Skipped

mmwDemo:/>% Created using Visualizer ver:3.6.0.0
Skipped

mmwDemo:/>% Frequency:60
Skipped

mmwDemo:/>% Platform:xWR68xx_AOP
Skipped

mmwDemo:/>% Scene Classifier:best_range_res
Skipped

mmwDemo:/>% Azimuth Resolution(deg):30 + 30
Skipped

mmwDemo:/>% Range Resolution(m):0.044
Skipped

mmwDemo:/>% Maximum unambiguous Range(m):9.02
Skipped

mmwDemo:/>% Maximum Radial Velocity(m/s):1
Skipped

mmwDemo:/>% Radial velocity resolution(m/s):0.13
Skipped

mmwDemo:/>% Frame Duration(msec):100
Skipped

mmwDemo:/>% RF calibration data:None
Skipped

mmwDemo:/>% Range Detection Threshold (dB):15
Skipped

mmwDemo:/>% Doppler Detection Threshold (dB):15
Skipped

mmwDemo:/>% Range Peak Grouping:enabled
Skipped

mmwDemo:/>% Doppler Peak Grouping:enabled
Skipped

mmwDemo:/>% Static clutter removal:disabled
Skipped

mmwDemo:/>% Angle of Arrival FoV: Full FoV
Skipped

mmwDemo:/>% Range FoV: Full FoV
Skipped

mmwDemo:/>% Doppler FoV: Full FoV
Skipped

mmwDemo:/>% \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Skipped

mmwDemo:/>sensorStop
Ignored: Sensor is already stopped

Done

mmwDemo:/>flushCfg
Done

mmwDemo:/>dfeDataOutputMode 1
Done

mmwDemo:/>channelCfg 15 7 0
Done

mmwDemo:/>adcCfg 2 1
Done

mmwDemo:/>adcbufCfg -1 0 1 1 1
Done

mmwDemo:/>profileCfg 0 60 359 7 57.14 0 0 70 1 256 5209 0 0 158
Done

mmwDemo:/>chirpCfg 0 0 0 0 0 0 0 1
Done

mmwDemo:/>chirpCfg 1 1 0 0 0 0 0 2
Done

mmwDemo:/>chirpCfg 2 2 0 0 0 0 0 4
Done

mmwDemo:/>frameCfg 0 2 16 0 100 1 0
Done

mmwDemo:/>lowPower 0 0
Done

mmwDemo:/>guiMonitor -1 1 1 0 0 0 1
Done

mmwDemo:/>cfarCfg -1 0 2 8 4 3 0 15 1
Done

mmwDemo:/>cfarCfg -1 1 0 4 2 3 1 15 1
Done

mmwDemo:/>multiObjBeamForming -1 1 0.5
Done

mmwDemo:/>clutterRemoval -1 0
Done

mmwDemo:/>calibDcRangeSig -1 0 -5 8 256
Done

mmwDemo:/>extendedMaxVelocity -1 0
Done

mmwDemo:/>lvdsStreamCfg -1 0 0 0
Done

mmwDemo:/>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
Done

mmwDemo:/>measureRangeBiasAndRxChanPhase 0 1.5 0.2
Done

mmwDemo:/>CQRxSatMonitor 0 3 5 121 0
Done

mmwDemo:/>CQSigImgMonitor 0 127 4
Done

mmwDemo:/>analogMonitor 0 0
Done

mmwDemo:/>aoaFovCfg -1 -90 90 -90 90
Done

mmwDemo:/>cfarFovCfg -1 0 0 8.92
Done

mmwDemo:/>cfarFovCfg -1 1 -1 1.00
Done

mmwDemo:/>calibData 0 0 0
Done

mmwDemo:/>sensorStart
Debug: Init Calibration Status = 0x1ffe

Done

上位机发送配置指令时 串口发送结果:
在这里插入图片描述

version
queryDemoStatus
% \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
% Created for SDK ver:03.06
% Created using Visualizer ver:3.6.0.0
% Frequency:60
% Platform:xWR68xx_AOP
% Scene Classifier:best_range_res
% Azimuth Resolution(deg):30 + 30
% Range Resolution(m):0.044
% Maximum unambiguous Range(m):9.02
% Maximum Radial Velocity(m/s):1
% Radial velocity resolution(m/s):0.13
% Frame Duration(msec):100
% RF calibration data:None
% Range Detection Threshold (dB):15
% Doppler Detection Threshold (dB):15
% Range Peak Grouping:enabled
% Doppler Peak Grouping:enabled
% Static clutter removal:disabled
% Angle of Arrival FoV: Full FoV
% Range FoV: Full FoV
% Doppler FoV: Full FoV
% \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
sensorStop
flushCfg
dfeDataOutputMode 1
channelCfg 15 7 0
adcCfg 2 1
adcbufCfg -1 0 1 1 1
profileCfg 0 60 359 7 57.14 0 0 70 1 256 5209 0 0 158
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 16 0 100 1 0
lowPower 0 0
guiMonitor -1 1 1 0 0 0 1
cfarCfg -1 0 2 8 4 3 0 15 1
cfarCfg -1 1 0 4 2 3 1 15 1
multiObjBeamForming -1 1 0.5
clutterRemoval -1 0
calibDcRangeSig -1 0 -5 8 256
extendedMaxVelocity -1 0
lvdsStreamCfg -1 0 0 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.5 0.2
CQRxSatMonitor 0 3 5 121 0
CQSigImgMonitor 0 127 4
analogMonitor 0 0
aoaFovCfg -1 -90 90 -90 90
cfarFovCfg -1 0 0 8.92
cfarFovCfg -1 1 -1 1.00
calibData 0 0 0
sensorStart
 

芯片返回到上位机的结果 串口数据:
在这里插入图片描述

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

xWR64xx MMW Demo 03.06.00.00

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

mmwDemo:/>version
Platform                : xWR68xx_AOP

mmWave SDK Version      : 03.06.00.00

Device Info             : IWR68XX QM non-secure AOP ES 02.00

RF F/W Version          : 06.03.02.06.20.08.11

RF F/W Patch            : 00.00.00.00.00.00.00

mmWaveLink Version      : 01.02.06.06

Lot number              : 5509421

Wafer number            : 6

Die coordinates in wafer: X = 26, Y = 8

Done

mmwDemo:/>queryDemoStatus
Sensor State: 0

Data port baud rate: 921600

Done

mmwDemo:/>configDataPort 921600 1
Done

mmwDemo:/>version
Platform                : xWR68xx_AOP

mmWave SDK Version      : 03.06.00.00

Device Info             : IWR68XX QM non-secure AOP ES 02.00

RF F/W Version          : 06.03.02.06.20.08.11

RF F/W Patch            : 00.00.00.00.00.00.00

mmWaveLink Version      : 01.02.06.06

Lot number              : 5509421

Wafer number            : 6

Die coordinates in wafer: X = 26, Y = 8

Done

mmwDemo:/>queryDemoStatus
Sensor State: 0

Data port baud rate: 921600

Done

mmwDemo:/>configDataPort 921600 1
Done

mmwDemo:/>% \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Skipped

mmwDemo:/>% Created for SDK ver:03.06
Skipped

mmwDemo:/>% Created using Visualizer ver:3.6.0.0
Skipped

mmwDemo:/>% Frequency:60
Skipped

mmwDemo:/>% Platform:xWR68xx_AOP
Skipped

mmwDemo:/>% Scene Classifier:best_range_res
Skipped

mmwDemo:/>% Azimuth Resolution(deg):30 + 30
Skipped

mmwDemo:/>% Range Resolution(m):0.044
Skipped

mmwDemo:/>% Maximum unambiguous Range(m):9.02
Skipped

mmwDemo:/>% Maximum Radial Velocity(m/s):1
Skipped

mmwDemo:/>% Radial velocity resolution(m/s):0.13
Skipped

mmwDemo:/>% Frame Duration(msec):100
Skipped

mmwDemo:/>% RF calibration data:None
Skipped

mmwDemo:/>% Range Detection Threshold (dB):15
Skipped

mmwDemo:/>% Doppler Detection Threshold (dB):15
Skipped

mmwDemo:/>% Range Peak Grouping:enabled
Skipped

mmwDemo:/>% Doppler Peak Grouping:enabled
Skipped

mmwDemo:/>% Static clutter removal:disabled
Skipped

mmwDemo:/>% Angle of Arrival FoV: Full FoV
Skipped

mmwDemo:/>% Range FoV: Full FoV
Skipped

mmwDemo:/>% Doppler FoV: Full FoV
Skipped

mmwDemo:/>% \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
Skipped

mmwDemo:/>sensorStop
Ignored: Sensor is already stopped

Done

mmwDemo:/>flushCfg
Done

mmwDemo:/>dfeDataOutputMode 1
Done

mmwDemo:/>channelCfg 15 7 0
Done

mmwDemo:/>adcCfg 2 1
Done

mmwDemo:/>adcbufCfg -1 0 1 1 1
Done

mmwDemo:/>profileCfg 0 60 359 7 57.14 0 0 70 1 256 5209 0 0 158
Done

mmwDemo:/>chirpCfg 0 0 0 0 0 0 0 1
Done

mmwDemo:/>chirpCfg 1 1 0 0 0 0 0 2
Done

mmwDemo:/>chirpCfg 2 2 0 0 0 0 0 4
Done

mmwDemo:/>frameCfg 0 2 16 0 100 1 0
Done

mmwDemo:/>lowPower 0 0
Done

mmwDemo:/>guiMonitor -1 1 1 0 0 0 1
Done

mmwDemo:/>cfarCfg -1 0 2 8 4 3 0 15 1
Done

mmwDemo:/>cfarCfg -1 1 0 4 2 3 1 15 1
Done

mmwDemo:/>multiObjBeamForming -1 1 0.5
Done

mmwDemo:/>clutterRemoval -1 0
Done

mmwDemo:/>calibDcRangeSig -1 0 -5 8 256
Done

mmwDemo:/>extendedMaxVelocity -1 0
Done

mmwDemo:/>lvdsStreamCfg -1 0 0 0
Done

mmwDemo:/>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
Done

mmwDemo:/>measureRangeBiasAndRxChanPhase 0 1.5 0.2
Done

mmwDemo:/>CQRxSatMonitor 0 3 5 121 0
Done

mmwDemo:/>CQSigImgMonitor 0 127 4
Done

mmwDemo:/>analogMonitor 0 0
Done

mmwDemo:/>aoaFovCfg -1 -90 90 -90 90
Done

mmwDemo:/>cfarFovCfg -1 0 0 8.92
Done

mmwDemo:/>cfarFovCfg -1 1 -1 1.00
Done

mmwDemo:/>calibData 0 0 0
Done

mmwDemo:/>sensorStart
Debug: Init Calibration Status = 0x1ffe

Done

mmwDemo:/> 

CLI配置流程

CLI的SDK内置函数:

static int32\_t CLI\_MMWaveVersion (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveFlushCfg (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveDataOutputMode (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveChannelCfg (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveADCCfg (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveProfileCfg (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveChirpCfg (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveFrameCfg (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveAdvFrameCfg (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveSubFrameCfg (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveLowPowerCfg (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveContModeCfg (int32\_t argc, char\* argv[]);
static int32\_t CLI\_MMWaveBPMCfgAdvanced (int32\_t argc, char\* argv[]);

demo代码用户自定义函数:

static int32\_t MmwDemo\_CLICfarCfg (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLIMultiObjBeamForming (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLICalibDcRangeSig (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLIClutterRemoval (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLISensorStart (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLISensorStop (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLIGuiMonSel (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLIADCBufCfg (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLICompRangeBiasAndRxChanPhaseCfg (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLIMeasureRangeBiasAndRxChanPhaseCfg (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLICfarFovCfg (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLIAoAFovCfg (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLIExtendedMaxVelocity (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLIChirpQualityRxSatMonCfg (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLIChirpQualitySigImgMonCfg (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLIAnalogMonitorCfg (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLILvdsStreamCfg (int32\_t argc, char\* argv[]);
static int32\_t MmwDemo\_CLIConfigDataPort (int32\_t argc, char\* argv[]);

其中 SDK内置的函数在接受到串口命令时 也会调用 但是是存在内部一个全局变量gCLI
最后再通过CLI_getMMWaveExtensionConfigCLI_getMMWaveExtensionOpenConfig把变量复制到用户自定义的全局变量结构体gMmwMCB中 从而完成配置
这里的配置仅仅是写入结构体 真正配置的地方是在调用MMwave相关API函数时 在这里是在MmwDemo_CLISensorStart函数中完成配置

CLI重构

根据官方手册 跳过CLI配置需要以下几个步骤:
在这里插入图片描述
但是按照这个来 完全没用
会在配置时报错参数无效/冲突等等
但是 首先还是覆写CLI初始化函数 使其只执行我们定义的函数

void MmwDemo\_CLIInit (uint8\_t taskPriority)
{
    if(Remix_Flag)
    {
        MmwDemo\_sensorConfig\_task();
    }
    else
    {
        CLI_Cfg     cliCfg;
        char        demoBanner[256];
        uint32\_t    cnt;
        /\* Create Demo Banner to be printed out by CLI \*/
        sprintf(&demoBanner[0],
                           "\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\n" \
                           "xWR64xx MMW Demo %02d.%02d.%02d.%02d\n"  \
                           "\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\n",
                            MMWAVE_SDK_VERSION_MAJOR,
                            MMWAVE_SDK_VERSION_MINOR,
                            MMWAVE_SDK_VERSION_BUGFIX,
                            MMWAVE_SDK_VERSION_BUILD
                );
...
...

在我们自定义的函数中 仿照命令配置函数的方式来写各个配置函数 同时 通过上位机确定想要的配置:
当然 无关紧要的函数可以省去

void MmwDemo\_sensorConfig\_task(void)
{
    int32\_t         errCode;

    /\* Sanity Check: We need the mmWave handle to work. \*/
    if (gMmwMCB.ctrlHandle == NULL)
    {
        return;
    }

    /\* Initialize the mmWave control configuration: \*/
    memset ((void \*)&gMmwMCB.cfg.ctrlCfg, 0, sizeof(MMWave_CtrlCfg));

    mmwave_freq_scale_factor = SOC\_getDeviceRFFreqScaleFactor(gMmwMCB.socHandle, &errCode);
    if(errCode < 0)
    {
        return;
    }

    CLI\_Remix\_sensorStop();
    CLI\_Remix\_flushCfg();
    CLI\_Remix\_dfeDataOutputMode(1);
    CLI\_Remix\_channelCfg(15,7,0);
    CLI\_Remix\_adcCfg(2,1);
    CLI\_Remix\_adcbufCfg(-1,0,1,1,1);
    CLI\_Remix\_profileCfg(0,60,47,7,57.14,0,0,70,1,272,5535,0,0,158);
    CLI\_Remix\_chirpCfg(0,0,0,0,0,0,0,1);
    CLI\_Remix\_chirpCfg(1,1,0,0,0,0,0,2);
    CLI\_Remix\_chirpCfg(2,2,0,0,0,0,0,4);
    CLI\_Remix\_frameCfg(0,2,16,0,50,1,0);
    CLI\_Remix\_lowPower(0,0);
    CLI\_Remix\_guiMonitor(-1,1,1,0,0,0,1);
    CLI\_Remix\_cfarCfg(-1,0,2,8,4,3,0,15,1);
    CLI\_Remix\_cfarCfg(-1,1,0,4,2,3,1,15,1);
    CLI\_Remix\_multiObjBeamForming(-1,1,0.5);
    CLI\_Remix\_clutterRemoval(-1,0);
    CLI\_Remix\_calibDcRangeSig(-1,0,-5,8,256);
    CLI\_Remix\_extendedMaxVelocity(-1,0);
    CLI\_Remix\_lvdsStreamCfg(-1,0,0,0);
    CLI\_Remix\_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);
    CLI\_Remix\_measureRangeBiasAndRxChanPhase(0,1.5,0.2);
    CLI\_Remix\_CQRxSatMonitor(0,3,5,121,0);
    CLI\_Remix\_CQSigImgMonitor(0,89,6);
    CLI\_Remix\_analogMonitor(0,0);
    CLI\_Remix\_aoaFovCfg(-1,-90,90,-90,90);
    CLI\_Remix\_cfarFovCfg(-1,0,0,9.48);
    CLI\_Remix\_cfarFovCfg(-1,1,-4,4.00);
    CLI\_Remix\_calibData(0,0,0);
    CLI\_Remix\_sensorStart();

    return;
}


另外 正如之前所说 内部SDK的函数在覆写时 直接把配置参数给到我们用户自定义的结构体gMmwMCB中即可
比如配置chirp profile frame的函数:

void CLI\_Remix\_profileCfg(int a1,float a2,float a3,float a4,float a5,int a6,int a7,float a8,float a9,int a10,int a11,int a12,int a13,int a14)
{
    rlProfileCfg\_t          profileCfg;
    uint8\_t                 index;
    int32\_t                 errCode;
    MMWave_ProfileHandle    profileHandle;
    MMWave_ProfileHandle\*   ptrBaseCfgProfileHandle;

    /\* Sanity Check: Profile configuration is valid only for the Frame or
 Advanced Frame Mode: \*/
    if ((gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_FRAME) &&
        (gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_ADVANCED_FRAME))
    {
        //CLI\_write ("Error: Configuration is valid only if the DFE Output Mode is Frame or Advanced Frame\n");
        return;
    }

    if (gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode == MMWave_DFEDataOutputMode_FRAME)
    {
        ptrBaseCfgProfileHandle = &gMmwMCB.cfg.ctrlCfg.u.frameCfg.profileHandle[0U];
    }
    else
    {
        ptrBaseCfgProfileHandle = &gMmwMCB.cfg.ctrlCfg.u.advancedFrameCfg.profileHandle[0U];
    }

    /\* Initialize the profile configuration: \*/
    memset ((void \*)&profileCfg, 0, sizeof(rlProfileCfg\_t));

    /\* Populate the profile configuration: \*/
    profileCfg.profileId             = a1;

    /\* Translate from GHz to [1 LSB = gCLI\_mmwave\_freq\_scale\_factor \* 1e9 / 2^26 Hz] units
 \* of mmwavelink format \*/
    profileCfg.startFreqConst        = (uint32\_t) (((float)a2) \* (1U << 26) /mmwave_freq_scale_factor);

    /\* Translate below times from us to [1 LSB = 10 ns] units of mmwavelink format \*/
    profileCfg.idleTimeConst         = (uint32\_t)((float)a3 \* 1000 / 10);
    profileCfg.adcStartTimeConst     = (uint32\_t)((float)a4 \* 1000 / 10);
    profileCfg.rampEndTime           = (uint32\_t)((float)a5 \* 1000 / 10);

    profileCfg.txOutPowerBackoffCode = a6;
    profileCfg.txPhaseShifter        = a7;

    /\* Translate from MHz/us to [1 LSB = (gCLI\_mmwave\_freq\_scale\_factor \* 1e6 \* 900) / 2^26 kHz/uS]
 \* units of mmwavelink format \*/
    profileCfg.freqSlopeConst        =     (int16\_t)((float)a8 \* (1U << 26) /((mmwave_freq_scale_factor \* 1e3) \* 900.0));

    /\* Translate from us to [1 LSB = 10 ns] units of mmwavelink format \*/
    profileCfg.txStartTime           = (int32\_t)(((float)a9) \* 1000 / 10);

    profileCfg.numAdcSamples         = a10;
    profileCfg.digOutSampleRate      = a11;
    profileCfg.hpfCornerFreq1        = a12;
    profileCfg.hpfCornerFreq2        = a13;
    profileCfg.rxGain                = a14;

    /\* Search for a free space in the mmWave configuration block: \*/
    for (index = 0U; index < MMWAVE_MAX_PROFILE; index++)
    {
        /\* Did we get a free entry? \*/
        if (ptrBaseCfgProfileHandle[index] == NULL)
        {
            /\* YES: We can add the profile. \*/
            break;
        }
    }
    if (index == MMWAVE_MAX_PROFILE)
    {
        /\* Error: All the profiles have been exhausted \*/
        return;
    }

    /\* Add the profile to the mmWave module: \*/
    profileHandle = MMWave\_addProfile (gMmwMCB.ctrlHandle, &profileCfg, &errCode);
    if (profileHandle == NULL)
    {
        /\* Error: Unable to add the profile. Return the error code back \*/
        return;
    }

    /\* Record the profile: \*/
    ptrBaseCfgProfileHandle[index] = profileHandle;
    return;
}
void CLI\_Remix\_chirpCfg(int a1,int a2,int a3,float a4,float a5,float a6,float a7,int a8)
{
    rlChirpCfg\_t            chirpCfg;
    MMWave_ProfileHandle    profileHandle;
    int32\_t                 errCode;

    /\* Sanity Check: Chirp configuration is valid only for the Frame or
 Advanced Frame Mode: \*/
    if ((gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_FRAME) &&
        (gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_ADVANCED_FRAME))
    {
        //CLI\_write ("Error: Configuration is valid only if the DFE Output Mode is Chirp\n");
        return;
    }

    /\* Initialize the chirp configuration: \*/
    memset ((void \*)&chirpCfg, 0, sizeof(rlChirpCfg\_t));

    /\* Populate the chirp configuration: \*/
    chirpCfg.chirpStartIdx   = a1;
    chirpCfg.chirpEndIdx     = a2;
    chirpCfg.profileId       = a3;

    /\* Translate from Hz to number of [1 LSB = (gCLI\_mmwave\_freq\_scale\_factor \* 1e9) / 2^26 Hz]
 \* units of mmwavelink format \*/
    chirpCfg.startFreqVar    = (uint32\_t) ((float)a4 \* (1U << 26) /
                                            (mmwave_freq_scale_factor \* 1e9));

    /\* Translate from KHz/us to number of [1 LSB = (gCLI\_mmwave\_freq\_scale\_factor \* 1e6) \* 900 /2^26 KHz/us]
 \* units of mmwavelink format \*/
    chirpCfg.freqSlopeVar    = (uint16\_t) ((float)a5 \* (1U << 26) /
                                           ((mmwave_freq_scale_factor \* 1e6) \* 900.0));

    /\* Translate from us to [1 LSB = 10ns] units of mmwavelink format \*/
    chirpCfg.idleTimeVar     = (uint32\_t)((float)a6 \* 1000.0 / 10.0);

    /\* Translate from us to [1 LSB = 10ns] units of mmwavelink format \*/
    chirpCfg.adcStartTimeVar = (uint32\_t)((float)a7 \* 1000.0 / 10.0);

    chirpCfg.txEnable        = a8;

    /\* Get the profile handle to which the chirp is to be added: \*/
    if (MMWave\_getProfileHandle (gMmwMCB.ctrlHandle, chirpCfg.profileId,
                                 &profileHandle, &errCode) < 0)
    {
        /\* Error: Unable to get the profile handle. Return the error code \*/
        return;
    }

    /\* Add the chirp to the profile \*/
    if (MMWave\_addChirp (profileHandle, &chirpCfg, &errCode) == NULL)
    {
        /\* Error: Unable to add the chirp. Return the error code. \*/
        return;
    }
    return;
}
void CLI\_Remix\_frameCfg(int a1,int a2,int a3,int a4,float a5,int a6,float a7)
{
    rlFrameCfg\_t    frameCfg;

    /\* Sanity Check: Frame configuration is valid only for the Frame or
 Advanced Frame Mode: \*/
    if (gMmwMCB.cfg.ctrlCfg.dfeDataOutputMode != MMWave_DFEDataOutputMode_FRAME)
    {
        //CLI\_write ("Error: Configuration is valid only if the DFE Output Mode is Chirp\n");
        return;
    }

    /\* Initialize the frame configuration: \*/
    memset ((void \*)&frameCfg, 0, sizeof(rlFrameCfg\_t));

    /\* Populate the frame configuration: \*/
    frameCfg.chirpStartIdx      = a1;
    frameCfg.chirpEndIdx        = a2;
    frameCfg.numLoops           = a3;
    frameCfg.numFrames          = a4;
    frameCfg.framePeriodicity   = (uint32\_t)((float)a5 \* 1000000 / 5);
    frameCfg.triggerSelect      = a6;
    frameCfg.frameTriggerDelay  = (uint32\_t)((float)a7 \* 1000000 / 5);

    /\* Save Configuration to use later \*/
    memcpy((void \*)&gMmwMCB.cfg.ctrlCfg.u.frameCfg.frameCfg, (void \*)&frameCfg, sizeof(rlFrameCfg\_t));
    return;
}

配置完成后 调用MmwDemo_CLISensorStart即可 但是这个函数会将CLI内部结构体gCLI的值读到用户结构体中 如果没有用CLI来配置的话 内部结构体时空的 所以得重构MmwDemo_CLISensorStart

MmwDemo_CLISensorStart函数重构

在此函数中 由于我们先前已经将所有的配置覆写了 并且赋值到用户结构体中 所以我们只需要将CLI_getMMWaveExtensionConfigCLI_getMMWaveExtensionOpenConfig注释掉即可
如:

int CLI\_Remix\_sensorStart(void)
{
    bool doReconfig = true;
    int32\_t     retVal = 0;

    /\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
 \* Do sensor state management to influence the sensor actions
 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

    /\* Error checking initial state: no partial config is allowed
 until the first sucessful sensor start state \*/
    if ((gMmwMCB.sensorState == MmwDemo_SensorState_INIT) ||
         (gMmwMCB.sensorState == MmwDemo_SensorState_OPENED))
    {
        MMWave_CtrlCfg ctrlCfg;

        /\* need to get number of sub-frames so that next function to check
 \* pending state can work \*/
        //CLI\_getMMWaveExtensionConfig (&ctrlCfg);
        memcpy((void\*)&ctrlCfg,(void\*)&gMmwMCB.cfg.ctrlCfg,sizeof(MMWave_CtrlCfg));
        gMmwMCB.dataPathObj.objDetCommonCfg.preStartCommonCfg.numSubFrames =
            MmwDemo\_RFParser\_getNumSubFrames(&ctrlCfg);

        if (MmwDemo\_isAllCfgInPendingState() == 0)
        {
            System\_printf ("Error: Full configuration must be provided before sensor can be started "
                       "the first time\n");

            /\* Although not strictly needed, bring back to the initial value since we
 \* are rejecting this first time configuration, prevents misleading debug. \*/
            gMmwMCB.dataPathObj.objDetCommonCfg.preStartCommonCfg.numSubFrames = 0;

            return -1;
        }
    }

    if (gMmwMCB.sensorState == MmwDemo_SensorState_STARTED)
    {
        System\_printf ("Ignored: Sensor is already started\n");
        return 0;
    }

    if (doReconfig == false)
    {
         /\* User intends to issue sensor start without config, check if no
 config was issued after stop and generate error if this is the case. \*/
         if (! MmwDemo\_isAllCfgInNonPendingState())
         {
             /\* Message user differently if all config was issued or partial config was
 issued. \*/
             if (MmwDemo\_isAllCfgInPendingState())
             {
                 System\_printf ("Error: You have provided complete new configuration, "
                            "issue \"sensorStart\" (without argument) if you want it to "
                            "take effect\n");
             }
             else
             {
                 System\_printf ("Error: You have provided partial configuration between stop and this "
                            "command and partial configuration cannot be undone."
                            "Issue the full configuration and do \"sensorStart\" \n");
             }
             return -1;
         }
    }
    else
    {
        /\* User intends to issue sensor start with full config, check if all config
 was issued after stop and generate error if is the case. \*/
        MMWave_CtrlCfg ctrlCfg;

        /\* need to get number of sub-frames so that next function to check
 \* pending state can work \*/
        //CLI\_getMMWaveExtensionConfig (&ctrlCfg);
        memcpy((void\*)&ctrlCfg,(void\*)&gMmwMCB.cfg.ctrlCfg,sizeof(MMWave_CtrlCfg));
        gMmwMCB.dataPathObj.objDetCommonCfg.preStartCommonCfg.numSubFrames =
                    MmwDemo\_RFParser\_getNumSubFrames(&ctrlCfg);

        if (MmwDemo\_isAllCfgInPendingState() == 0)
        {
            /\* Message user differently if no config was issued or partial config was
 issued. \*/
            if (MmwDemo\_isAllCfgInNonPendingState())
            {
                System\_printf ("Error: You have provided no configuration, "
                           "issue \"sensorStart 0\" OR provide "
                           "full configuration and issue \"sensorStart\"\n");
            }
            else
            {
                System\_printf ("Error: You have provided partial configuration between stop and this "
                           "command and partial configuration cannot be undone."
                           "Issue the full configuration and do \"sensorStart\" \n");
            }
            /\* Although not strictly needed, bring back to the initial value since we
 \* are rejecting this first time configuration, prevents misleading debug. \*/
            gMmwMCB.dataPathObj.objDetCommonCfg.preStartCommonCfg.numSubFrames = 0;

            return -1;
        }
    }


    /\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
 \* Retreive and check mmwave Open related config before calling openSensor
 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

    /\* Fill demo's MCB mmWave openCfg structure from the CLI configs\*/
    if (gMmwMCB.sensorState == MmwDemo_SensorState_INIT)
    {
        /\* Get the open configuration: \*/
        //CLI\_getMMWaveExtensionOpenConfig (&gMmwMCB.cfg.openCfg);
        /\* call sensor open \*/
        retVal = MmwDemo\_openSensor(true);
        if(retVal != 0)
        {
            return -1;
        }
        gMmwMCB.sensorState = MmwDemo_SensorState_OPENED;
    }
    else
    {
        /\* openCfg related configurations like chCfg, lowPowerMode, adcCfg
 \* are only used on the first sensor start. If they are different
 \* on a subsequent sensor start, then generate a fatal error
 \* so the user does not think that the new (changed) configuration
 \* takes effect, the board needs to be reboot for the new
 \* configuration to be applied.
 \*/
        MMWave_OpenCfg openCfg;
        //CLI\_getMMWaveExtensionOpenConfig (&openCfg);
        memcpy((void\*)&openCfg,(void\*)&gMmwMCB.cfg.openCfg,sizeof(MMWave_OpenCfg));
        /\* Compare openCfg->chCfg\*/
        if(memcmp((void \*)&gMmwMCB.cfg.openCfg.chCfg, (void \*)&openCfg.chCfg,
                          sizeof(rlChanCfg\_t)) != 0)
        {
            MmwDemo\_debugAssert(0);
        }

        /\* Compare openCfg->lowPowerMode\*/
        if(memcmp((void \*)&gMmwMCB.cfg.openCfg.lowPowerMode, (void \*)&openCfg.lowPowerMode,
                          sizeof(rlLowPowerModeCfg\_t)) != 0)
        {
            MmwDemo\_debugAssert(0);
        }
        /\* Compare openCfg->adcOutCfg\*/
        if(memcmp((void \*)&gMmwMCB.cfg.openCfg.adcOutCfg, (void \*)&openCfg.adcOutCfg,
                          sizeof(rlAdcOutCfg\_t)) != 0)
        {
            MmwDemo\_debugAssert(0);
        }
    }



    /\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
 \* Retrieve mmwave Control related config before calling startSensor
 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/
    /\* Get the mmWave ctrlCfg from the CLI mmWave Extension \*/
    if(doReconfig)
    {
        /\* if MmwDemo\_openSensor has non-first time related processing, call here again\*/
        /\* call sensor config \*/
        //CLI\_getMMWaveExtensionConfig (&gMmwMCB.cfg.ctrlCfg);
        retVal = MmwDemo\_configSensor();
        if(retVal != 0)
        {
            return -1;
        }
    }

    retVal = MmwDemo\_startSensor();
    if(retVal != 0)
    {
        return -1;
    }

    /\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
 \* Set the state
 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/
    gMmwMCB.sensorState = MmwDemo_SensorState_STARTED;
    return 0;
}

数据输出

在main.c中的数据输出函数MmwDemo_transmitProcessedOutput(位于线程函数MmwDemo_DPC_ObjectDetection_dpmTask中)之前 可以定义一个用于输出点云数据的函数(传参为result) 比如:

MMWave\_Remix\_Result\_Output(result);
//MmwDemo\_transmitProcessedOutput(gMmwMCB.loggingUartHandle, result,&currSubFrameStats->outputStats);


可以进行方位角等计算
其中 方位角 俯仰角与距离、坐标的关系如下:
在这里插入图片描述

TargetList[i].x = TargetList[i].range\*cos(TargetList[i].elevation \* sin(TargetList[i].azimuth);
## 最后

**自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。**

**深知大多数Java工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。**

**因此收集整理了一份《2024年嵌入式&物联网开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。**

![img](https://img-blog.csdnimg.cn/img_convert/37307b5625a7fb5ae34230a88a9a649f.png)

![img](https://img-blog.csdnimg.cn/img_convert/a3b9b80b145f8ece9fa825d2b7a8116c.jpeg)

![img](https://img-blog.csdnimg.cn/img_convert/cf62113ed216967b9bcff5239677c944.png)

 ![img](https://img-blog.csdnimg.cn/img_convert/d762db0b9306c5c1318f353a461b2613.png)

![img](https://img-blog.csdnimg.cn/img_convert/7cd4f4a48943a9a9ba307bb1d82f1849.png)

![img](https://img-blog.csdnimg.cn/img_convert/427c7decbc955016716f667567f8891b.png)

![](https://img-blog.csdnimg.cn/img_convert/9770878ad044735ef565901657bd32a4.png)

 

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上嵌入式&物联网开发知识点,真正体系化!**

[**如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!**](https://bbs.csdn.net/topics/618654289)

**由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新**!!


Result\_Output(result);
//MmwDemo\_transmitProcessedOutput(gMmwMCB.loggingUartHandle, result,&currSubFrameStats->outputStats);


可以进行方位角等计算
其中 方位角 俯仰角与距离、坐标的关系如下:
在这里插入图片描述

TargetList[i].x = TargetList[i].range\*cos(TargetList[i].elevation \* sin(TargetList[i].azimuth);
## 最后

**自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。**

**深知大多数Java工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。**

**因此收集整理了一份《2024年嵌入式&物联网开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。**

[外链图片转存中...(img-JmMdgs4q-1715608709740)]

[外链图片转存中...(img-ABx4nRfQ-1715608709741)]

[外链图片转存中...(img-eKKRS3Do-1715608709742)]

 [外链图片转存中...(img-7WKMIpSl-1715608709742)]

[外链图片转存中...(img-vH11WJk0-1715608709742)]

[外链图片转存中...(img-O8Uc8J6N-1715608709743)]

[外链图片转存中...(img-ZyBhMPF3-1715608709744)]

 

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上嵌入式&物联网开发知识点,真正体系化!**

[**如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!**](https://bbs.csdn.net/topics/618654289)

**由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新**!!


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值