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