I'm collecting single-tone test data on the ADC12J4000EVM using the TSW14J56EVM and the High Speed Data Converter (HSDC) Pro software and ADC12J4000EVM GUI. I am trying to capture raw time domain data to a binary or csv file format so I can post-process the data in MATLAB.

Following the HSDC User's Guide, in the HSDC GUI I save data using File-->Save Raw ADC Codes as Binary File. I also explore the option of saving the data as Signed 32-bit ints using File-->Save I32 Codes as CSV file. I'm having trouble figuring out the correct way to parse the data, which is apparently stored as ADC Codes rather than voltage levels. I've seen a few similar posts on the TI forums, but I would like an explicit explanation on how to parse the data, and if MATLAB code could be provided, it would be much appreciated.

Here's my MATLAB code thus far, assuming the binary data is stored as 32-bit integers, non-2's complement. N is the number of bits, Vfs is the typical input full-scale peak-to-peak voltage from the Analog Input Characteristics section of the ADC12J4000 online datasheet.

function Data = ReadTiAdcData(filename)
fid = fopen(filename,'r');
Data = fread(fid,'int32');
N = 12;
Vfs = 0.75;
Data = Vfs*Data/(2^N-1);

ReadTiAdcData calls a Spectrum_Analyzer.m function which I provide with time-domain voltage data, and the sampling rate of the ADC. It generates a FFT spectrum, SNR, SFDR, and ENOB from this information.

Now, there is nothing wrong with the Spectrum Analyzer function. I have used it before many times on raw ADC data I took from another ADC (the Analog AD9625) with the same number of samples (65536). Other people have also used it with no problems. So the problem is not with the code, it's with the data I'm getting.

If I use this code on the binary data and take an FFT of the data using a MATLAB Spectrum Analyzer function, the spectrum looks nothing like what's recorded in the HSDC GUI. It's not just a scaling issue (fundamental shows up in the wrong location, there's very high spurs, etc.).

If I instead read in the CSV data directly, the spectrum looks similar to what is displayed in the HSDC GUI. There is a fundamental at the right frequency. The noise floor is about the same shape and dB down. However, the SNR, ENOB, and SFDR calculations are wrong by a significant margin.

It boils down to this:

  1. What is the difference between how HSDC formats the CSV file and binary file?
  2. What is the correct way to parse raw ADC data that is stored in a binary file or csv file into time-domain voltage data?
  • \$\begingroup\$ I'd start with a known signal, then work through the various binary format possibilities (sign vs offset, endianess, etc) until I recovered something that looks right. Scaling is usually a linear function of the number of codes, multiplied by the voltage reference and taking into account any offset or differential nature of the input architecture. If you can get data form the same measurement as both binary and CSV, that should be a real clue to sorting things out. \$\endgroup\$ Commented Jan 19, 2015 at 1:47

1 Answer 1


The problem has been solved.

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

Jim B's post explains the HSDC's binary file encoding and how to convert from it. N = 12. Turns out the full scale voltage didn't matter because we just needed the scaled voltage level relative to full scale, which was already encoded in the binary file, "full scale" being 4096.

I hope this is helpful for those who are struggling with converting raw ADC data using the TI HSDC.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.