I'm collecting data on the ADC12J4000EVM using the TSW14J56EVM and the High Speed Data Converter (HSDC) Pro software and ADC12J4000EVM GUI. Trying to capture raw time domain data to a binary file 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'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, 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. Some posts say the data is stored in two's complement. Is this only for the CSV, not the binary file? What is the format of the binary file?
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 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');
fclose(fid);
N = 12;
Vfs = 0.95;
Data = Vfs*Data/2^(N-1);
If I use this code and take an FFT of the data, 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.).
Also, should I be grabbing Vfs from control tab of the ADC12J4000EVM GUI? For instance, "Gain Full Scale" is set by default to 612.5 mV Vpp with an offset of -37.4999 mV. Should these values be used in the conversion from ADC Code to voltage?
Also note that the User's Guide says that if the Single Tone FFT test is active, the FFT plot is saved along with statistics and setup information, and if the Time Domain test is active, the Time Domain plot is saved along with statistics. HSDC simply does not work as described here. No matter which test is active, I get the same CSV and Binary output files, which contain raw data only without statistics or setup information.