This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AWR6843ISK: AWR6843isk How to get each RX channel phase data & Magnitude

Part Number: AWR6843ISK

Hi TI team,

         My platform is AWR6843isk with SDK mmwave_sdk_03_05_00_04 and labs long range people detection 6843 SW

I want to know if there is any API to get the phase data of each RX(im,re) ?

I have found a calculated phase compensation function in objectdetection.c as shown below.

can I get the phase value without calculated compensation from this function?

/**
 *  @b Description
 *  @n
 *      get the rx phase value from the detection matrix
 *      during calibration measurement procedure of these parameters.
 *
 *  @param[in]  staticCfg Pointer to static configuration
 *  @param[in]  targetDistance Target distance in meters
 *  @param[in]  searchWinSize Search window size in meters
 *  @param[in] detMatrix Pointer to detection matrix
 *  @param[in] symbolMatrix Pointer to symbol matrix
 *  @param[out] compRxChanCfg computed output range bias and rx phase comp vector
 *
 *  @retval   None
 *
 * \ingroup DPC_OBJDET__INTERNAL_FUNCTION
 */
static void DPC_ObjDetDSP_RxChPhaseMeasure
(
    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);
        }
    }
}

Thanks alot

Allen

  • HI, Allen:

    If you get the complex value x, you can use angle(x) in MATLAB to get the angle/phase information in radians. 

    Mathematically,  by definition, angle = atan(real(x)/imag(x)); 

    You can get the complex value from the memory and then use the methods above to calculate the phase.

    Best,

    Zigang