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.

ADS58J89: How to export data real-time to Matlab

Part Number: ADS58J89

Dear Sir/Madam,

I am working with a ADS58J89 as my ADC and a TSW14J56 as the capture card.

I was wondering how to export real-time data of all the 4 channels from HSDCpro to Matlab for processing. Do I need to install any interface?

Thanks

Farshid

  • Hi Farshid,

    You can export the data from File>>Save Integer I32 Codes as CSV File
    There is also an example Matlab script that can be used to automate the data capture process.
    The script is located at: C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\HSDCPro Automation DLL\Manual and Examples\Automation DLL Matlab Example

    Thanks,
    Eben.
  • Hi Eben,

    Thanks for the help.

    Well, I opened the Matlab codes and after putting the right serial number of the ADC and Capture card, and giving the right path and name of the firmware to Matlab, I ran Matlab. 

    First, HSDC pro stopped showing data on its screen. The following figure:

    I imported the right path of everything. Here is a screenshot of my Worksapce in Matlab.

    I went ahead and checked the directory the data is supposed be saved, but the CSV file is empty. Do you have any idea why it is not saving data? 

    Also, here is my command window:

    "

    Please open the HSDCPro GUI before using these Automation DLL functions.
    Press ENTER to start...


    Connecting to board : T825T9tu-TSW14J56revD
    Error Status = 0 (No Error)

    Selecting ADC Device : ADS58Jx_LMF_442
    Error Status = 0 (No Error)

    Configuration Settings:

    Passing ADC Output Data Rate = 250000000
    Error Status = 0 (No Error)

    ADC Input Target Frequency = 169990000
    Error Status = 0 (No Error)

    Number of Samples per Channel = 65536
    Error Status = 0 (No Error)Warning: Escaped character '\A' is not valid. See 'doc sprintf' for
    supported special characters.
    > In HSDCPro_Automation_DLL_ADC_Example_64bit (line 102)


    Error Status = 0 (No Error)

    Applying FFT Notch Filter Settings
    Error Status = 0 (No Error)

    Applying Trigger Settings
    Error Status = 0 (No Error)

    Start Normal Capture. Press ENTER to continue...

    Starting Normal Capture...
    Error Status = 7014 (Read DDR to File Timeout Error.)

    Checking if HSDCPro GUI has completed all its operations...
    Error Status = 0 (No Error)

    Saving ADC Raw Data as CSV file at C:/HSDCPro Data/ADCdata.csv
    Error Status = 0 (No Error)

    Test Selection Option = 1 (Time Domain-0; Single Tone-1; Two Tone-2; Channel Power-3)
    Error Status = 0 (No Error)

    Graph Plot Type = 2 (Codes - 0; Bits - 1; Real FFT - 2; Complex FFT - 3)
    Error Status = 0 (No Error)

    FFT Window Type = 3 (Rectangular - 0; Hamming - 1; Hanning - 2; Blackman - 3)
    Error Status = 0 (No Error)

    Saving ADC FFT as PNG image at C:/HSDCPro Data/ADCFFT.png
    Error Status = 0 (No Error)

    Selecting the ADC Channel Index = 0
    Error Status = 0 (No Error)

    Getting the FFT Data of the active channel.
    Error Status = 0 (No Error)

    Getting the Single Tone Parameter Values.
    Error Status = 0 (No Error)
    The Parameter Values are:
    SNR = 0 dBFs
    SFDR = 0 dBc
    THD = 0 dBFs
    SINAD = 0 dBFs
    ENOB = 0 Bits
    Fund. = 0 dBFs
    Next Spur = 0 dBFs
    HD2 = 0 dBc
    HD3 = 0 dBc
    HD4 = 0 dBc
    HD5 = 0 dBc
    NSD = 0 dBFs/Bin

    Disconnecting from the board
    Error Status = 0 (No Error)

    "

  • Hi Farshid,

    From your screenshots, it looks like the firmware was not loaded to the TSW14J56 EVM. So try connecting HSDCPRO manually to TSW14J56 and loading the firmware. After the firmware is loaded, start the matlab automation script.

    Thanks,
    Eben.
  • Hi Eben,

    First, manually I loaded the firmware to HSDCPRO. It was sampling fine.
    Then, I opened Matlab and ran the codes. I saw an empty screen on my HSDCPRO (I put the photo in my last comment). I'm not sure it is only due to the firmware or not. In your Matlab codes, there is a line which calls the firmware as well. I gave same directory address I used to give to HSDCPRO manually. But, it doesnt work. Any idea how to fix it?

    Thanks
  • Hi Farshid,

    The 64bit Matlab DLL also requires you to download and install 64-bit labview 2014 run time engine. There is a readme.txt file in the Automation DLL Matlab Example>>64Bit Matlab folder with a link to download this run time engine.

    If you are using 32bit Matlab DLL, you do not need to install any extra run time engine.

    Thanks,
    Eben.
  • Hi Eben,

    Actually I read the readme.txt file and I followed the instructions. I use 64bit Matlab DLL, so I installed 64-bit labview run time engine.

  • Hi Farshid,

    Can you try with the ini file attached. Put the ini file in the directory below and then restart HSDCPRO

    C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\14J56revD Details\ADC files

    Thanks,

    Eben.

    ADS58Jx_LMF_442_ALT_SYNC.ini

  • Well, I opened the Matlab codes and after putting the right serial number of the ADC and Capture card, and giving the right path and name of the firmware to Matlab, I ran Matlab.
  • HI Eben,

    I used the ini file you sent and ran Matlab codes, but again the data disappeared from HSDCPro window and it is not sampling anymore. It was sampling before running the Matlab codes though. What do you think about it? Here is a screenshot.

    Thanks

  • Hi Eben,

    I was wondering if you have any idea how to solve the issue?
  • Hi Farshid,

    Can you post the output of the matlab command window when you use the new ini file I sent?

    Thanks,
    Eben.
  • Hi Eben,

    Finally I found out how to do it. Here are the steps:

    1- Loading the firmware manually in HSDC Pro

    2- Running the codes, and pressing Enter in Matlab command window

    3- Loading the firmware again manually in HSDC pro

    4- Press capture in HSDC Pro

    5- In Matlab after seeing "Start normal capture", press Enter again

    SO, it captures data and save it in a CSV file.

    Now, I have three questions. First, it seems when I run the codes, it captures data only once and it does not update the CVS file over time. Is that what it is? What if I want to sample data continuously?

    Second, what type of data is saved in the CSV file? It doesnt look like to be in dBFS unit as it's plotted in HSDC Pro window.

    Third, it took 2.6 second for me to sample and write in CSV file which is slow. Does the time I reported make sense? Or something is wrong? Also, how can I make it faster? Here are my parameters.

    ADCOutputDataRate = 250e6;
    ADCInputTargetFrequency = 169.994354248e6;
    NumberOfSamplesPerChannel = 65536;

    NumberOfSamplesForAnalysis = 65536/2;

    I appreciate your help.

  • Hi Farshid,

    Looking at your Matlab workspace again, your firmware filepath is incorrect. Change the back slash to a forward slash after 14j56 RevD Details\firmware\

    Alternatively, you can comment out line 86 and manually download the firmware before running the matlab code.
    %[Error_Status] = calllib('HSDCProAutomation_64Bit','Download_Firmware',FirmwareFilePath,WaitToCheck,60000);

    If you confirm this fix works for you, I will want to close this thread. Please start a new one if you have more questions.

    Thanks,
    Eben.