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: How to read ADC raw data from Ti in mmw demo.

Part Number: AWR1642

Hi,

In mmw demo, I tried to read the raw ADC data of one chirp using the following code changes, Please can you confirm is it proper or not.

1) dss_main.c: Read raw data from obj->ADCdataBuf into Uart local buffer ptrCurrBuffer in MmwDemo_dssSendProcessOutputToMSS() function.

/* Sending raw data information */

{
itemPayloadLen = obj->numRxAntennas*obj->numRangeBins*sizeof(cmplx16ReIm_t);
totalHsmSize += itemPayloadLen;
if(totalHsmSize > outputBufSize)
{
retVal = -1;
goto Exit;
}
memcpy(ptrCurrBuffer, (void *)obj->ADCdataBuf, itemPayloadLen);
for(i=0;i<obj->numRangeBins*obj->numRxAntennas;i++)
{
CheckSum = CheckSum+obj->ADCdataBuf[i].real;
CheckSum = CheckSum+obj->ADCdataBuf[i].imag;
}

iptr1 = (int32_t *)((uint32_t)ptrHsmBuffer + totalHsmSize);
//iptr1[0] = CheckSum;
itemPayloadLen = itemPayloadLen+4; //4 is for check sum
totalHsmSize += 4; //4 is for check sum

message.body.detObj.tlv[tlvIdx].length = itemPayloadLen;
message.body.detObj.tlv[tlvIdx].type = MMWDEMO_OUTPUT_MSG_STATS; //currently dummy
message.body.detObj.tlv[tlvIdx].address = (uint32_t) ptrCurrBuffer;;
tlvIdx++;

/* Incrementing pointer to HSM buffer */
ptrCurrBuffer = (uint8_t *)((uint32_t)ptrHsmBuffer + totalHsmSize);
//totalPacketLen += sizeof(MmwDemo_output_message_tl) + itemPayloadLen; //not incrementing so that same code can be used with TI gui
}

2)mss_main.c: sending the raw adc data from local uart buffer to PC in MmwDemo_mboxReadTask().

3)raw and fft plot of adc data in scilab.

4) Scilab Code to plot the raw data.





NumAdcSamples = 256;
ComplexSamples = (2*NumAdcSamples);
ChRawDataStartIndex = 2;
Numch  = 4;

Ch1Start = 2;
Ch1End   = (Ch1Start+ComplexSamples-1);
Ch2Start = Ch1End+1;
Ch2End   = (Ch2Start+ComplexSamples-1);
Ch3Start = Ch2End+1;
Ch3End   = (Ch3Start+ComplexSamples-1);
Ch4Start = Ch3End+1;
Ch4End   = (Ch4Start+ComplexSamples-1);

B = read_csv('D:\ScilabModel\DataRawAdc1.csv',',','double');
Tag = evstr(B(:,1));

Temp1 = size(B);
TotFrames = Temp1(1);

for Frm=1:TotFrames
    for ch=1:Numch
        StartIndex = ChRawDataStartIndex+((ch-1)*ComplexSamples);
        EndIndex   = StartIndex+ComplexSamples-1;
        RawIQ(ch,:) = evstr(B(Frm,StartIndex:EndIndex));
        RawI(ch,:) = RawIQ(ch,1:2:ComplexSamples);
        RawQ(ch,:) = RawIQ(ch,2:2:ComplexSamples);
        CmplxIQ(ch,:) = RawI(ch,:)+sqrt(-1)*RawQ(ch,:);
        //D1 = CmplxIQ(ch,(64+1):(64+64));
        FFTCmplxIQ(ch,:) = fft(CmplxIQ(ch,:));
        Phase_FFTCmplxIQ(ch,:) = atan(imag(FFTCmplxIQ(ch,:)),real(FFTCmplxIQ(ch,:)));
        //FFTCmplxIQ = fft(D1);
        //Phase_FFTCmplxIQ = atan(imag(FFTCmplxIQ),real(FFTCmplxIQ));

        scf(1);
        clf(1);
        drawlater();
        subplot(3,1,1);plot(RawI(ch,:)');plot(RawQ(ch,:)');
        title("Ch, IQ");
        subplot(3,1,2);plot(abs(FFTCmplxIQ(ch,:)'));
        //subplot(3,1,2);plot(abs(FFTCmplxIQ'));
        title("Ch, Mag FFT IQ");
        subplot(3,1,3);plot(Phase_FFTCmplxIQ(ch,:)');
        //subplot(3,1,3);plot(Phase_FFTCmplxIQ');
        title("Ch, phase FFT IQ");
        drawnow();
        sleep(100);
    end
end

  • Hi Maruthi, 

    As far as the 'C' code is concerned it looks correct. Make sure that the 'frame periodicity' is large enough for the extra data to be transferred through UART. 

    The ADC data that you are plotting also looks fine, except for a glitch in the first few samples. Could you plot the first few ADC samples of the other channels? and see if that glitch is seen? Also make sure that your sign extension algorithm is working correctly. nbsp;

    Regards,

    Anil

  • Hi Anil,

    Thanks, I am seeing the glitch in the other channels also, please check the attached images with 64 samples of all the 4 channels.

    Regards,

    Maruthi.

  • Hi Maruthi. 

    Could you share the configuration file - especially the lines for the profile and chirp configuration - for this capture. It is possible that the idle time provided is insufficient for your configuration. 

    Let me check with my colleagues and see

    Regards,

    Anil

  • Hi Anil,

    The following configuration are used.

    sensorStop
    flushCfg
    dfeDataOutputMode 1
    channelCfg 15 3 0
    adcCfg 2 1
    adcbufCfg 0 0 1 1
    profileCfg 0 77 3 3 56 0 0 8 1 256 5000 0 0 30
    chirpCfg 0 0 0 0 0 0 0 1
    chirpCfg 1 1 0 0 0 0 0 2
    frameCfg 0 1 64 0 100 1 0
    lowPower 0 0
    guiMonitor 1 1 1 0 0 1
    cfarCfg 0 0 8 4 4 0 5000
    cfarCfg 1 0 8 4 4 0 5000
    peakGrouping 1 1 1 1 224
    multiObjBeamForming 0 0.5
    calibDcRangeSig 1 -5 8 256
    sensorStart


    Regards,
    Maruthi.