主题中讨论的其他器件:IWR6843
工具/软件:TI C/C++编译器
您好!
我尝试在我从另一个论坛获得的 Matlab 代码下运行、但为什么 readUartCallbackFcn (hDataSerialPort、0);函数无效、我只是知道我是否可以将此代码用于 IWR6843 ES 1.0?
%读取字节
readUartCallbackFcn (hDataSerialPort、0);
如果 bytes_available 标志= 1
bytes_available _FLAG = 0;
%fprintf ('bytevec_cp_len、bytevecAcclen =%d %d \n'、bytevec_cp_len、bytevecAcclen)
如果(bytevec_cp_len + bytevecAcclen)< bytevec_cp_max_len
bytevec_cp (bytevec_cp_len+1:bytevec_cp_len + bytevecAcclen)= bytevecAcc (1:bytevecAcclen);
bytevec_cp_len = bytevec_cp_len + bytevecAcclen;
bytevecAccLen = 0;
其他
fprintf (错误:缓冲区溢出、字节 vec_cp_len、字节 vecAcclen =%d %d \n'、字节 vec_cp_len、字节 vecAcclen)
结束
结束
bytevecStr = char (bytevec_CP);
magicOk = 0;
startIdx = strfind (bytevecStr'、char ([2 1 4 3 6 5 8 7]);
如果~IsEmpty (startIdx)
如果 startIdx (1)> 1
bytevec_cp (1:bytevec_cp_len-(startIdx (1)-1))= bytevec_cp (startIdx (1):bytevec_cp_len);
bytevec_cp_len = bytevec_cp_len -(startIdx (1)-1);
结束
如果 bytevec_cp_len < 0
fprintf (错误:%d %d \n'、bytevec_cp_len、bytevecAccLen)
字节 vec_cp_len = 0;
结束
totalPacketLen = sum (bytevec_CP (8+4+[1:4]).*[1 256 65536 16777216]');
如果 bytevec_cp_len >= totalPacketLen
magicOk = 1;
其他
magicOk = 0;
结束
结束
byteVecIdx = 0;
if (magicOk = 1)
%fprintf ('OK、bytevec_cp_len =%d\n'、bytevec_cp_len);
IF debugFlag
fprintf ('Frame Interval =%.3f sec、'、TOC (tStart));
结束
tStart = tic;
[标头、byteVecIdx]= getHeader (bytevec_CP、byteVecIdx);
detObj.numObj = 0;
对于 tlvIdx = 1:header.numTLV
[TLV、byteVecIdx]= getTlv (bytevec_CP、byteVecIdx);
切换 tlv.type
案例 MMWDEMO_UART_MSG_Detected_Points
如果 tlv.length >= obj_struct_size_bytes
[detObj、byteVecIdx]= getDetObj (bytevec_CP、...
byteVecIdx,……
TLV.length、...
Params.dataPath.rangeIdxToMeters,...
Params.dataPath.dopplerResolutionMps,...
Params.dataPath.numDopplerBins);
结束
案例 MMWDEMO_UART_MSG_RANGE_PROFILE
[RP、byteVecIdx]= getRangeProfile (bytevec_CP、...
byteVecIdx,……
TLV.length);
案例 MMWDEMO_UART_MSG_Noise_profile
[np、byteVecIdx]= getRangeProfile (bytevec_CP、...
byteVecIdx,……
TLV.length);
案例 MMWDEMO_UART_MSG_Azimut_static_Hear_map
[Q、byteVecIdx]= getAzimuthStaticHeatMap (bytevec_CP、...
byteVecIdx,……
Params.dataPath.numTxAzimAnt,...
Params.dataPath.numRxAnt、...
Params.dataPath.numRangeBins、...
num_angle_bins);
案例 MMWDEMO_UART_MSG_RANGE_DMPLOP_HEAT_MAP
[RANGEPLOPLOPLOPLOPLOPLOP、byteVecIdx]= getRangeDopplerHeatMap (bytevec_CP、...
byteVecIdx,……
Params.dataPath.numDopplerBins,...
Params.dataPath.numRangeBins);
案例 MMWDEMO_UART_MSG_STATS
[StatsInfo、byteVecIdx]= getStatsInfo (bytevec_CP、...
byteVecIdx);
%fprintf ('sInfo:%d、%d、%d %d %d \n'、StatsInfo.interFrameProcessingTime、StatsInfo.transmitOutputTime、 StatsInfo.interFrameProcessingMargin、StatsInfo.interChirpProcessingMargin);
displayUpdateCntr = displayUpdateCntr + 1;
InterFrameCPULoad =[InterFrameCPULoad (2:End);StatsInfo.interFrameCPULoad];
activeFrameCPULoad =[activeFrameCPULoad (2:End);StatsInfo.activeFrameCPULoad];
guiCPULoad =[guiCPULoad (2:End);100*guiProcTime/Params.frameCfg.framePeriodicity];
如果 displayUpdateCntr =40
UpdateDisplayTable (Params);
displayUpdateCntr = 0;
结束
否则
结束
结束
byteVecIdx = header.totalPacketLen;
if ((Header.frameNumber - packetNumberPrev)~= 1)&&(packetNumberPrev ~= 0)
fprintf ('Error: packets lost:%d,Current frame num =%d \n',(Header.frameNumber - packetNumberPrev - 1),Header.frameNumber)
结束
packetNumberPrev = Header.frameNumber;
结束