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.

AWR1642: High Accuracy Demo; Phase Estimation Correction Algorithm

Part Number: AWR1642

TI Team,

There is a section of code in the AWR1642 High Accuracy Demo, specifically in the RADARDEMO_highAccuRangeProc_rangeEst function in RADARDEMO_highAccuRangeProc_priv.c file which was left in the source, but was commented out. I'm trying to understand the underlying algorithm behind this, because when I uncomment the code, the accuracy drops off significantly, and I'm not sure if that's a side effect of what is going on, or if there is an error in the source. Is there an associated white paper for this algorithm or what?

if (highAccuRangeHandle->enablePhaseEst) {
            float phaseCoarseEst1, phaseCoarseEst2, phaseInitial;
            double PI = 3.14159265358979323846f;
            double real, imag, denom, initReal, initImag, dtemp1, dtemp2, dtemp;
            float phaseEst, totalPhase = 0.f, phaseCorrection, rangePhaseCorrection;
            __float2_t demodSig, corrSig;

            inputPtr = (__float2_t *)highAccuRangeHandle->inputSig;
            phaseCoarseEst1 = 2 * (float)PI * highAccuRangeHandle->fc
                    * (divsp(2 * (*estRange), (float)3e8) + highAccuRangeHandle->adcStartTimeConst);
            phaseCoarseEst2 = (float)PI * highAccuRangeHandle->chirpSlope
                    * (divsp(2 * (*estRange), (float)3e8) + highAccuRangeHandle->adcStartTimeConst)
                    * (divsp(2 * (*estRange), (float)3e8) + highAccuRangeHandle->adcStartTimeConst);
            phaseInitial = phaseCoarseEst1 - phaseCoarseEst2;

            denom = divdp(1.0, (double)highAccuRangeHandle->fft1DSize);
#if 0
            dtemp1 = cos((double)phaseInitial);
            dtemp2 = sin(-(double)phaseInitial);
            initReal = cos(2.0 * PI * highAccuRangeHandle->chirpRampTime * (double) freqFineEst * denom);
            initImag = sin(-2.0 * PI * highAccuRangeHandle->chirpRampTime * (double) freqFineEst * denom);
#else
            dtemp1 = cosdp_i((double)phaseInitial);
            dtemp2 = sindp_i(-(double)phaseInitial);
            initReal = cosdp_i(2.0 * PI * highAccuRangeHandle->chirpRampTime * (double)freqFineEst * denom);
            initImag = sindp_i(-2.0 * PI * highAccuRangeHandle->chirpRampTime * (double)freqFineEst * denom);
#endif

            //sample @ t = 0;
            corrSig = _ftof2((float)dtemp1, (float)dtemp2);
            demodSig = _complex_mpysp(_amem8_f2(inputPtr++), corrSig);
            RADARDEMO_atan((cplxf_t *)&demodSig, &phaseEst);
            totalPhase += phaseEst;

            if ((highAccuRangeHandle->enableFilter == 0) && (highAccuRangeHandle->enableLinearFit == 0)) {
                //sample @ t = 1;
                dtemp = dtemp1 * initReal - dtemp2 * initImag;
                imag = dtemp1 * initImag + dtemp2 * initReal;
                real = dtemp;
                corrSig = _ftof2((float)real, (float)imag);
                demodSig = _complex_mpysp(_amem8_f2(inputPtr++), corrSig);
                RADARDEMO_atan((cplxf_t *)&demodSig, &phaseEst);
                totalPhase += phaseEst;

                for (j = 2; j < (int32_t)highAccuRangeHandle->fft1DSize; j++) {
                    dtemp = real * initReal - imag * initImag;
                    imag = real * initImag + imag * initReal;
                    real = dtemp;
                    corrSig = _ftof2((float)real, (float)imag);
                    demodSig = _complex_mpysp(_amem8_f2(inputPtr++), corrSig);
                    RADARDEMO_atan((cplxf_t *)&demodSig, &phaseEst);
                    totalPhase += phaseEst;
                }
                phaseCorrection = totalPhase * (float)denom;
                rangePhaseCorrection = divsp((phaseCorrection * (float)3e8),
                                             (4.f * (float)PI * highAccuRangeHandle->fc));
                *estRange += rangePhaseCorrection;
            } else {
                //Not implemented yet
            }
        }