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.

TSW14J56EVM: Help with population of data into csv file

Part Number: TSW14J56EVM

Hi I am using the tsw14j56EVM board along with the High speed data converter pro GUI.I am trying to come up with a way to generate my own data and place it into a CSV file within Matlab. I have tried multiple times but cant seem to generate any data which Give me any type of signal from the custom file. I have already tried using the predefined test files which I have managed to succesfully test. I will put some code I wrote in matlab below as well as a photo of the GUI when I load the file, If there is any help you can provide I would appreciate it very much, Thanks.

rng(0,'twister');
a = -30000;
b = 30000;
r = (b-a).*rand(153600,1) + a;
r=round(r,3,'decimals');
r=r*1000;
c = (b-a).*rand(153600,1) + a;
c=round(c,3,'decimals');
c=c*1000;
Idata=r;
Qdata=c;
iqdata=zeros(length(Idata),4);%generate two column variable with length of the data (32k)
iqdata(:,1)=Idata; %copy data into 1st column
iqdata(:,2)=Qdata; %copy data into 2nd column
iqdata(:,3)=Idata;
iqdata(:,4)=Qdata;
csvwrite('IQdata.csv',iqdata); %write into csv file

  • Dillon,

    We are looking into this now.

    Jalen
  • Dillon,

    Have a look at the test file in the HSDC Pro folder.
    C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\Test Files

    There is a .csv file called single_tone_cmplx...

    This file is a sine and cosine wave that is coherent to 32768 samples. It's frequency bin is approx at 1/10 the sampling rate. If you were to plot the columns you can see that they are sine waves. The format of the signals should be signed integer values from -32768 to +32767. If you need coherency the length of the file must be a multiple of 256 samples long - this is due to how the memory is structured.

    This format stays the same and does not need to be changed for 2s of offset binary. That will be handled in HSDC Pro before it sends the data to the FPGA board.

    Ken.
  • Hi, I have seen this file but I dont know how to produce something like this. I am not sure what you mean by frequency bin. Is there any matlab code to fill that csv file which I could see or use as an example?
  • Dillon,

    Plot those samples and you will see a sine wave. The signal is a sinewave that is oversampled by 10x. In other words the file indicates that it is a 25M signal at 250Msps. In reality it is a Fs/10 frequency sinewave as it is always about 10 samples per cycle.

    If you have signal samples, just convert them to signed integer and save as a column. If you can do this then the signal should look fine once it is loaded into HSDC Pro DAC screen. If you want sinewaves, you should be able to find many example codes on mathworks or just a general google search.

    The code you posted earlier is just generating random codes and as such you will get a flat spectrum in the FFT. If that is what you are trying to generate then it is working as expected.

    Ken.
  • sorry but I have no idea how to do this. My ultimate goal would to be able to generate data in matlab and then modulate it using QAM or QPSK. I have done this so far but I cant get a way to populate the data into a csv file which produces a signal of some kind in matlab. So far the tests I have tried have given me data which I can't see. Is there any way you can provide me with matlab code. I have searched through google for the sine wave generation and tried it but I get similiar results.
  • Dillon,

    You already have code that can populate the data into csv in your 1st post, ie using csvwrite.

    Are you able to load the single_tone_cmplx_32768_250MSPS__BW_25.1MHZ.csv file into HSDC Pro? If so I'm not sure what else you need. I have added a bit of simple code below that manipulates the existing file and saves it back into the same csv format. They load fine into HSDC Pro - if it loads into HSDC Pro it will be sent to the DAC correctly. I'm not sure what else you need help with.

    This code loads the test file, extracts column a and b, plots a, scales a, plots the scale signal and saves the scaled column with column b. The file can be loaded into HSDC Pro and the columns can be plotted and manipulated in matlab.

    csvread('C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\Test Files\single_tone_cmplx_32768_250MSPS__BW_25.1MHZ.csv');
    a=ans(:,1);
    b=ans(:,2);
    plot(a)
    hold
    c=round(a*0.5);
    plot(c)
    csvwrite('outtest.csv',[c b]);

    The code you send earlier and the file loaded into HSDC Pro match - so I'm not sure what the problem is.

    Ken.
  • Hi again, I have managed to come up with code using QAM modulation and load it into HSDCpro. I used a bandpass filter to shape the data and I  can see the shape on the GUI. My next immediate question is how can I increase the amplitude? As you can see from the picture below the dB is quite low and I am afraid my spectrum analyzer won't be able to see this signal. I would like the noise floor to begin at around -90dB.

    M = 16; % Size of signal constellation
    k = log2(M); % Number of bits per symbol
    numBits = 3e5; % Number of bits to process
    numSamplesPerSymbol = 1; % Oversampling factor
    d = fdesign.bandpass('Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2',75,100,150,175,50,0.5,50,1e3);
    Hd = design(d);
    rng default % Use default random number generator
    dataIn = randi([0 1], numBits, 1); % Generate vector of binary data
    dataInMatrix = reshape(dataIn, length(dataIn)/k, k); % Reshape data into binary 4-tuples
    dataSymbolsIn = bi2de(dataInMatrix); % Convert to integers
    dataMod = qammod(dataSymbolsIn, M);
    d=round(dataMod,3,'decimals');
    d=d*1000;
    txSignal = filter(Hd,d);
    Idata=real(txSignal);
    Qdata=imag(txSignal);
    iqdata=zeros(length(Idata),4);%generate two column variable with length of the data (32k)
    iqdata(:,1)=Idata; %copy data into 1st column
    iqdata(:,2)=Qdata; %copy data into 2nd column
    iqdata(:,3)=Idata; %copy data into 1st column
    iqdata(:,4)=Qdata; %copy data into 2nd column
    csvwrite('IQ3data.csv',iqdata); %write into csv file

  • Dillon,

    If you look at the modulated waveforms provide in the test files folder, you will see that they are similar. The integrated power will be close to the PAR dBFS (assuming the full swing of the DAC is used). The level looks low, butthe power output is as expected.

    You cannot get any higher amplitude without saturating the DAC output, the swing of the DAC needs to accommodate the largest peak value of the signal. The only way to increase RMS output power is to perform CFR (crest factor reduction is smart/shaped clipping and will increase RMS power while degrading inband noise floor), this is not something we can help you with on this forum.

    Ken.