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.

TSW1400EVM: HSDC Raw Data File Confusion (related)

Part Number: TSW1400EVM

This is in reference to an older thread but I was trying to run the script to convert the *.bin ADC codes binary file to time domain data in matlab.

In HSDC I noticed for long sample times (much larger than 524288 samples), the maximum number of time domain data points I can save to excel is 2^16 (in the upper time domain window). I wanted to be able to run long time sequences but save all the data points at the smallest resolution (i.e. if I was collecting 20 ms of data at 100MHz, I want samples at every 10 ns, not 305 ns).

It appears if I save the data to *bin file (ADC Codes) the resolution of the data is maintained. It also appears that the software saves data for all channels into one bit stream. (hence if Im saving 4194304 samples per channel, the file will produce (4194304)*4 entries for a four channel ADC).

I tried the following script in matlab to extract the time domain data, but it doesn't seem to make sense or match HSDC outputs. (file name = somthing.bin)

fid = fopen('Filename','r');
N=14
X = fread(fid,'int16');
fclose(fid);
X = X-2^(N-1);
X = X./2^(N-1);

I omitted the ReadTiAdcData() function because I did not have the spectrum_analyzer.m file required to run it.

The resulting data doesn't seem to make sense and im not sure if im parsing it correctly from the get go. Im using the TSW1400EVM with a ADC3444EVM (14 bit). The ADC is four channel but I only have data coming in on one. When I tried to separate the data by four it also didn't seem to change (since one channel is only receiving data) so I suspect my assumption of how the data is separated above is incorrect.

Previous question about this: e2e.ti.com/.../1397498

  • Hi Ajay
    We have received your question. Someone will provide a more detailed response soon.
    Best regards,
    Jim B
  • Hello Ajay,
    The saved CSV files should be sequential time domain samples for a single channel. You should not need to decimate by channel. If you are trying to work with the .bin files, the data is stored by channel to file as 16b data structure (even when using a 14b converter). This is to keep the byte boundaries at the expense of some file space. I will look into this and see if there is some more information I can find to help on this.

    I am also going to check with another colleague about CSV or .bin file import into MatLab. He has done some work on this in the past, and we can discuss your script. I will need a little time as he is out of office for a few days.

    Regards,
    Brian
  • Hi Brian,

    Thank you for your response. I think I found the solution and its alluding to what your saying. The issue with the save *.CSV file from left clicking and saving to excel on the upper time domain window is that its limited to 2^16 samples. Hence if samples were taken for 5ms , 10ms, etc.. only 2^16 samples would be allowed to be saved to *.CSV from the upper time domain window.  So the resolution of the data collected is dependant on the length of data collected.

    However, I can save to *.Bin file and collect the data I want with the resolution I want. My mistake was that I was parsing the data incorrectly in that the binary data should read like Ch1,ch2,ch3,ch4,ch1,ch2,ch3,ch4,... and I was assuming is was ch1,ch1,ch1,ch1..to N,ch2, ch2,ch2,ch2..to 2N ..etc.. When I corrected this the data streamed in correctly and matches my expectation. Here is my script for this.

    fid = fopen('filename.bin','r');
    N=14;
    X = fread(fid,'int16');
    fclose(fid);
    X = X-2^(N-1);
    X = X./2^(N-1);

    ch1 = X(1:4:end);
    ch2 = X(2:4:end);
    ch3 = X(3:4:end);
    ch4 = X(4:4:end);

    Thanks for your help!