你好!
:\mmwave_industrial_toolbox_4_7_0\labs\out_of_box_demo\68xx_mmwave_sdk_dsp里面的例程有相位校准方面的程序
DPC_ObjDetDSP_rangeBiasRxChPhaseMeasure
里面相位校准,看了一下,实部,虚部都取的是rxSym[i]里面的实部和虚部,而rxSym[i]是从radarCube里面的数据,想知道的是怎么校准相位的?
校准相位目的不是应该11个虚拟天线和最小幅值的那个校准成幅度一致,相位一致吗?
具体程序如下:
DPC_ObjDetDSP_rangeBiasRxChPhaseMeasure(&subFrmObj->staticCfg,
objDetObj->commonCfg.measureRxChannelBiasCfg.targetDistance,
objDetObj->commonCfg.measureRxChannelBiasCfg.searchWinSize,
subFrmObj->dpuCfg.dopplerCfg.hwRes.detMatrix.data,
(uint32_t *) subFrmObj->dpuCfg.dopplerCfg.hwRes.radarCube.data,
&objDetObj->compRxChanCfgMeasureOut);
static void DPC_ObjDetDSP_rangeBiasRxChPhaseMeasure
(
DPC_ObjectDetection_StaticCfg *staticCfg,
float targetDistance,
float searchWinSize,
uint16_t *detMatrix,
uint32_t *symbolMatrix,
DPU_AoAProc_compRxChannelBiasCfg *compRxChanCfg
)
{
cmplx16ImRe_t rxSym[SYS_COMMON_NUM_TX_ANTENNAS * SYS_COMMON_NUM_RX_CHANNEL];
cmplx16ImRe_t *tempPtr;
float sumSqr;
uint32_t * rxSymPtr = (uint32_t * ) rxSym;
float xMagSq[SYS_COMMON_NUM_TX_ANTENNAS * SYS_COMMON_NUM_RX_CHANNEL];
int32_t iMax;
float xMagSqMin;
float scal;
float truePosition;
int32_t truePositionIndex;
float y[3];
float x[3];
int32_t halfWinSize ;
float estPeakPos;
float estPeakVal;
int32_t i, ind;
int32_t txIdx, rxIdx;
uint32_t numRxAntennas = staticCfg->ADCBufData.dataProperty.numRxAntennas;
uint32_t numTxAntennas = staticCfg->numTxAntennas;
uint32_t numRangeBins = staticCfg->numRangeBins;
uint32_t numDopplerChirps = staticCfg->numDopplerChirps;
uint32_t numSymPerTxAnt = numDopplerChirps * numRxAntennas * numRangeBins;
uint32_t symbolMatrixIndx;
uint16_t maxVal = 0;
truePosition = targetDistance / staticCfg->rangeStep;
truePositionIndex = (int32_t) (truePosition + 0.5);
halfWinSize = (int32_t) (0.5 * searchWinSize / staticCfg->rangeStep + 0.5);
/**** Range calibration ****/
iMax = truePositionIndex;
for (i = truePositionIndex - halfWinSize; i <= truePositionIndex + halfWinSize; i++)
{
if (detMatrix[i * staticCfg->numDopplerBins] > maxVal)
{
maxVal = detMatrix[i * staticCfg->numDopplerBins];
iMax = i;
}
}
/* Fine estimate of the peak position using quadratic fit */
ind = 0;
for (i = iMax - 1; i <= iMax + 1; i++)
{
sumSqr = 0.0;
for (txIdx=0; txIdx < numTxAntennas; txIdx++)
{
for (rxIdx=0; rxIdx < numRxAntennas; rxIdx++)
{
symbolMatrixIndx = txIdx * numSymPerTxAnt + rxIdx * numRangeBins + i;
tempPtr = (cmplx16ImRe_t *) &symbolMatrix[symbolMatrixIndx];
sumSqr += (float) tempPtr->real * (float) tempPtr->real +
(float) tempPtr->imag * (float) tempPtr->imag;
}
}
#ifdef SUBSYS_DSS
y[ind] = sqrtsp(sumSqr);
#else
y[ind] = sqrt(sumSqr);
#endif
x[ind] = (float)i;
ind++;
}
DPC_ObjDetDSP_quadFit(x, y, &estPeakPos, &estPeakVal);
compRxChanCfg->rangeBias = (estPeakPos - truePosition) * staticCfg->rangeStep;
/*** Calculate Rx channel phase/gain compensation coefficients ***/
for (txIdx = 0; txIdx < numTxAntennas; txIdx++)
{
for (rxIdx = 0; rxIdx < numRxAntennas; rxIdx++)
{
i = txIdx * numRxAntennas + rxIdx;
symbolMatrixIndx = txIdx * numSymPerTxAnt + rxIdx * numRangeBins + iMax;
rxSymPtr[i] = symbolMatrix[symbolMatrixIndx];
xMagSq[i] = (float) rxSym[i].real * (float) rxSym[i].real +
(float) rxSym[i].imag * (float) rxSym[i].imag;
}
}
xMagSqMin = xMagSq[0];
for (i = 1; i < staticCfg->numVirtualAntennas; i++)
{
if (xMagSq[i] < xMagSqMin)
{
xMagSqMin = xMagSq[i];
}
}
for (txIdx=0; txIdx < staticCfg->numTxAntennas; txIdx++)
{
for (rxIdx=0; rxIdx < numRxAntennas; rxIdx++)
{
int32_t temp;
i = txIdx * numRxAntennas + rxIdx;
scal = 32768./ xMagSq[i] * sqrt(xMagSqMin);
temp = (int32_t) MATHUTILS_ROUND_FLOAT(scal * rxSym[i].real);
MATHUTILS_SATURATE16(temp);
compRxChanCfg->rxChPhaseComp[staticCfg->txAntOrder[txIdx] * numRxAntennas +
rxIdx].real = (int16_t) (temp);
temp = (int32_t) MATHUTILS_ROUND_FLOAT(-scal * rxSym[i].imag);
MATHUTILS_SATURATE16(temp);
compRxChanCfg->rxChPhaseComp[staticCfg->txAntOrder[txIdx] * numRxAntennas
+ rxIdx].imag = (int16_t) (temp);
}
}