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: Selecting Device and ADC in HSDC pro using MATLAB

Part Number: TSW1400EVM

Hi...

I am using TSW1400EVM to read the ADC Data.

I just want to know how to 

1) Select the Device using MATLAB

2) Select the ADC using MATLAB.

When we open HSDC pro, the first option we get is to select the device. The device name is displayed in a pop-up screen, and we just want to click OK.

The next step is to select the ADC for which, we go to the menu in top left and select the ADC we want to use.

I just want to perform these two steps using MATLAB. What would be the commands that can help me do these? Secondly, do I need to write a command for Firmware as well? In HSDC pro, I don't select the firmware manually. While installation and patch, the firmware .rbf file was placed in the specific folder. So I hope I do not need to write a MATLAB command or firmware explicitly.

Thanks in advance

  • Hi Anum,

    We are looking at your question and will get back to you soon.

    Regards,
    Neeraj
  • Anum,
    All of our automation functions are designed for HSDC Pro to be running with popups cleared before execution.

    Are you able to find the example matlab code ?
    C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\HSDCPro Automation DLL\Manual and Examples\Automation DLL Matlab Example\32Bit Matlab

    BoardSerialNumber as it appears in HSDC Pro to connect to TSW board
    ADCDevice will be the converter device you choose from the dropdown in the upper left of the HSDC Pro GUI

    The firmware will be loaded as part of the ADCDevice selection (it is called out in the .INI file)
    If you need to use a different firmware the most straight-forward option is to copy it to the Firmware folder in the board you are using, then copy one of the INI files in 'ADC files' to a new unique name and replace the 'Interface name' in this file with your new firmware.

    Close then re-open HSDC Pro and your new INI file should show up as an option in the top-left dropdown box.

    Regards,
    Brian
  • Hey Brian,

    I have been able to locate this file. But when I try to run it, either my PC becomes busy, or it keeps on getting recurrent errors, even if I pause the code.

    1) As my Matlab is installed in Program Files, so I should be looking in the 64bit Matlab examples. Right?

    2) I should run this code will the pop-up screen of HSDC closed without selecting any device in HSDC. Right?

    Thanks...

  • Hello Anum,
    We are going to run and example and see if there is some error.

    Is there an error that you see that you can tell us ?

    1) Yes this should be correct
    2) You can select device or cancel and the code should work the same, we will confirm

    Regards,
    Brian
  • Hi Brian,

    So I am using following portion in the Matlab code you mentioned:

    addpath(genpath('C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\HSDCPro Automation DLL\64Bit DLL'));

    % Load the Automation DLL
    if ~libisloaded('HSDCProAutomation_64Bit')
    [notfound,warnings]= ...
    loadlibrary('C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\HSDCPro Automation DLL\64Bit DLL\HSDCProAutomation_64Bit.dll', @HSDCProAutomationHeader);
    end

    BoardSerialNumber = 'K1227057-TSW1400'; % Board Serial Number with board type separated by hyphen. Eg: TIVHIV9Z-TSW1400

    FirmwareFilePath = 'C:/Program Files (x86)/Texas Instruments/High Speed Data Converter Pro/1400 Details/Firmware/AR1642_FIRMWARE.rbf'; 
    WaitToCheck=1; 
    ADCDevice = 'AR16xx_lvds_4Channel_ddr_4bit_par_centre_16_bit'; 

    What I do is that I open the HSDC pro, and run the code. But the firmware is not loaded, as LEDs on TSW1400EVM doesnt glow.

    Also, when I run the complete code "HSDCPro_Automation_DLL_ADC_Example_64bit.m", I get error that "Automation DLL Error Codes.csv" not found

  • Anum,
    The automation error codes CSV is in C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\HSDCPro Automation DLL
    There might be a working directory or search directory needed.

    The firmware should download when 'Select_ADC_Device' is called. If there is an error the code should report back an Error_Status code.
    Can you confirm if you see an error code?

    Best regards,
    Brian (Daniel) Kincaid
  • Thanks for the reply.

    I do not get an error, but the firmware if not loaded, because LEDs of TSW1400EVM do not glow.

  • Anum,
    We are working through some confirmed issue with MATLAB right now. I will give you an update when we find the issue.

    Regards,
    Brian
  • Sure, thanks...

  • Anum,
    We worked through an unrelated MATLAB issue that I thought was part of this problem. It was a code sequencing issue and I think is unrelated to your issue.

    I think we have a firmware download issue with your board. Most of the time this is related to a power supply problem.

    Can you confirm the DC power supply that you are using with the board? If it is a wall-plug can you send the power rating (Voltage & Current) information?
    If you are able to send me a portion of your code that is failing I can try it on the bench here and confirm the issue.

    Regards,
    Brian
  • Dear Brian,

    Many thanks for the reply. The supply I am using is 5V, 5A. The supply is fine because the firmware is loaded if I do manually as mentioned in the user guide. I only get the problem when I try it using the MATLAB script. 

    My Steps:

    1) Start the HSDC Pro as administrator.

    2) Pop-up screen to select the device. I close the popup screen and go to MATLAB with HSDC Pro opened.

    3) As I run the code, following happens.

    (In the code, I have only changed the location of the files, the ADC I require and the firmware.)

    4) The main error I get is:

    Selecting ADC Device : AR16xx_lvds_4Channel_ddr_4bit_par_centre_16_bit
    Error Status = 7002 (Could not open "Automation DLL Error Codes.csv"

     

    MATLAB SCRIPT

    % Add folder into path that contains the Automation DLL
    addpath(genpath('C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\HSDCPro Automation DLL\64Bit DLL'));
    % Load the Automation DLL
    if ~libisloaded('HSDCProAutomation_64Bit')
    [notfound,warnings]= ...
    loadlibrary('C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\HSDCPro Automation DLL\64Bit DLL\HSDCProAutomation_64Bit.dll', @HSDCProAutomationHeader);
    end
    %BoardSerialNumber = 'TIV72HK9-TSW1400'; % Board Serial Number with board type separated by hyphen. Eg: TIVHIV9Z-TSW1400
    BoardSerialNumber = 'K1227057-TSW1400'; % Board Serial Number with board type separated by hyphen. Eg: TIVHIV9Z-TSW1400

    FirmwareFilePath = 'C:/Program Files (x86)/Texas Instruments/High Speed Data Converter Pro/1400 Details/Firmware/AR1642_FIRMWARE.rbf'; % Firmware file path which needs to be loaded to the board.
    WaitToCheck=1; % Wait to check if firmware is downloaded properly? 0 - No, 1 - Yes. If yes, timeout should be greater than 60sec.

    % ADCDevice = 'ADS5294_2W_12b'; %ADC device to be selected(should be same as what appears in the HSDC Pro GUI selection drop down box.
    ADCDevice = 'AR16xx_lvds_4Channel_ddr_4bit_par_centre_16_bit'; %ADC device to be selected(should be same as what appears in the HSDC Pro GUI selection drop down box.

    TimeoutInMs = 30000;

    ADCOutputDataRate = 614.4e6;
    ADCInputTargetFrequency = 10e6;
    NumberOfSamplesPerChannel = 65536;
    NumberOfSamplesForAnalysis = 32768;
    ChannelIndex=0; % Interested channel's index(0-based)

    % Trigger Settings
    TriggerModeEnable=0; % Enable Trigger - 1; Disable Trigger - 0
    SoftwareTriggerEnable=0; % Hardware Trigger - 0; Software Trigger - 1
    ArmOnNextCaptureButtonPress = 0;
    TriggerCLKDelays = 0; % The number of clock delays for the trigger
    WaitToCheckTrigger = 1; % 0 - Don't Wait, 1 - Wait and check whether trigger has occurred.

    FFTSettingsType = 1; % 0 - Rectangular ; 1 - Other Windows
    NumberOfHarmonics = 5; % Number of harmonics to be considered
    % Number of bins to remove on either side of the frequency
    NoOfBinsToRemoveAfterDC = 1;
    NoOfBinsToRemoveEitherSideOfHarmonics = 0;
    NoOfBinsToRemoveEitherSideOfFundamental = 25;
    % Custom frequency and the corresponding number of bins to remove for that frequency
    CustomNotchFrequencies = [50000000, 25000000];
    NoOfBinsToRemoveOnEitherSideOfCustomFrequencies = [25, 20];
    NumberOfCustomFreq = 2; % Number of custom frequencies
    % For Real FFT, FFT Array length is half the number of samples
    % For Complex FFT, FFT Array length is equal to the number of samples
    FFTArrayLength = 32768;

    % Enable/Disable the automatic notching of (Fs/2 - Fin) frequency, when Fs/2 or Fin is changed.
    enableFsby2MinusFinNotching = 0; % 0 - Disable, 1 - Enable
    binsToRemoveOnEitherSideOfFsby2 = 10; % Number of Bins to remove on either side of (Fs/2 - Fin) frequency

    % File Save Settings. Please provide file path with the respective extension
    %CSVFilePathWithName = 'C:/HSDCPro Data/ADCdata.csv';

    % CSVFilePathWithName = 'C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\HSDCPro Automation DLL/ADCdata.csv';

    CSVFilePathWithName = 'C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\HSDCPro Automation DLL\Automation DLL Error Codes.csv';

    %PNGFilePathWithName = 'C:/HSDCPro Data/ADCFFT.png';
    PNGFilePathWithName = 'C:\Program Files (x86)\Texas Instruments\High Speed Data Converter Pro\HSDCPro Automation DLL/ADCFFT.png';

    % Selection Settings
    TestSelection = 1; % Time Domain-0; Single Tone-1; Two Tone-2; Channel Power-3
    PlotType = 2; % Codes - 0; Bits - 1; Real FFT - 2; Complex FFT - 3
    FFTWindowType = 3; % Rectangular - 0; Hamming - 1; Hanning - 2; Blackman - 3

    % Getting the Single Tone Parameters
    % The parameters whose values are needed must be sent separated by ";" as a string(char array)
    ParametersIn = 'SNR;SFDR;THD;SINAD;ENOB;Fund.;Next Spur;HD2;HD3;HD4;HD5;NSD';
    ParameterValueLength = 12; % Size of "ParameterValues" array. Should be at least equal to the no. of parameters requested
    dBFs = 1; % dBc - 0, dBFs - 1. Required Unit for Parameters - SNR, THD, SINAD, Next Spur and NSD

    % ********************************************************************************//
    % ********** The actual call to the function contained in the dll ****************//
    % ********************************************************************************//

    fprintf('\nPlease open the HSDCPro GUI before using these Automation DLL functions.');
    input('\nPress ENTER to start...');

    % % Connecting to the board and selecting DAC device
    % fprintf('\n\nConnecting to board : %s',BoardSerialNumber);
    % [Error_Status] = calllib('HSDCProAutomation_64Bit','Connect_Board',BoardSerialNumber,TimeoutInMs);
    % fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nSelecting ADC Device : %s',ADCDevice);
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Select_ADC_Device',ADCDevice,120000);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    % Download Firmware(OPTIONAL). Selecting device itself(above function) will automatically download the firmware
    % fprintf('\n\nDownloading Firmware : %s',FirmwareFilePath);
    % [Error_Status] = calllib('HSDCProAutomation_64Bit','Download_Firmware',FirmwareFilePath,WaitToCheck,60000);
    % fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nConfiguration Settings:');
    fprintf('\n\nPassing ADC Output Data Rate = %d',ADCOutputDataRate);
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Pass_ADC_Output_Data_Rate',ADCOutputDataRate,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nADC Input Target Frequency = %d',ADCInputTargetFrequency);
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Set_ADC_Input_Target_Frequency',ADCInputTargetFrequency,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nNumber of Samples per Channel = %d',NumberOfSamplesPerChannel);
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Set_Number_of_Samples',NumberOfSamplesPerChannel,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\Analysis Window Length = %d',NumberOfSamplesForAnalysis);
    [Error_Status] = calllib('HSDCProAutomation_64Bit','ADC_Analysis_Window_Length',NumberOfSamplesForAnalysis,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nApplying FFT Notch Filter Settings');
    [Error_Status] = calllib('HSDCProAutomation_64Bit','FFT_Window_Notching',FFTSettingsType, NumberOfHarmonics, NoOfBinsToRemoveEitherSideOfHarmonics,NoOfBinsToRemoveAfterDC, NoOfBinsToRemoveEitherSideOfFundamental,CustomNotchFrequencies,NoOfBinsToRemoveOnEitherSideOfCustomFrequencies,NumberOfCustomFreq,enableFsby2MinusFinNotching,binsToRemoveOnEitherSideOfFsby2,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nApplying Trigger Settings');
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Trigger_Option',TriggerModeEnable,SoftwareTriggerEnable,ArmOnNextCaptureButtonPress,TriggerCLKDelays,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    % Data Acquisition
    if TriggerModeEnable == 0 % Normal Capture
    input('\n\nStart Normal Capture. Press ENTER to continue...');
    fprintf('\nStarting Normal Capture...');
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Pass_Capture_Event',TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));
    elseif (TriggerModeEnable==1 && SoftwareTriggerEnable==0) % External Hardware Trigger
    input('\n\nRead DDR Memory. Press ENTER to continue...');
    fprintf('\nReading DDR Memory...');
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Read_DDR_Memory',WaitToCheckTrigger,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));
    elseif (TriggerModeEnable==1 && SoftwareTriggerEnable==1) % Software Trigger
    input('\n\nGenerate Software Trigger. Press ENTER to continue...');
    fprintf('\nGenerating Software Trigger...');
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Generate_Software_Trigger',WaitToCheckTrigger,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));
    end

    fprintf('\n\nChecking if HSDCPro GUI has completed all its operations...');
    [Error_Status] = calllib('HSDCProAutomation_64Bit','HSDC_Ready',TimeoutInMs); % Waiting to check if HSDCPro has completed all its operations.
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nSaving ADC Raw Data as CSV file at %s', CSVFilePathWithName);
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Save_Raw_Data_As_CSV',CSVFilePathWithName,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    % Applying FFT Settings
    fprintf('\n\nTest Selection Option = %d (Time Domain-0; Single Tone-1; Two Tone-2; Channel Power-3)',TestSelection);
    [Error_Status] = calllib('HSDCProAutomation_64Bit','ADC_Test_Selection',TestSelection,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nGraph Plot Type = %d (Codes - 0; Bits - 1; Real FFT - 2; Complex FFT - 3)',PlotType);
    [Error_Status] = calllib('HSDCProAutomation_64Bit','ADC_Plot_Type',PlotType,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nFFT Window Type = %d (Rectangular - 0; Hamming - 1; Hanning - 2; Blackman - 3)',FFTWindowType);
    [Error_Status] = calllib('HSDCProAutomation_64Bit','FFT_Window',FFTWindowType,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nSaving ADC FFT as PNG image at %s',PNGFilePathWithName);
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Save_FFT_As_PNG',ChannelIndex,PNGFilePathWithName,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nSelecting the ADC Channel Index = %d',ChannelIndex);
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Select_ADC_Channel',ChannelIndex,TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    fprintf('\n\nGetting the FFT Data of the active channel.');
    f0 = [];
    df = [];
    ActiveChannelFFT = zeros(FFTArrayLength,1);
    [Error_Status, f0, df, ActiveChannelFFT,FFTArrayLength] = calllib('HSDCProAutomation_64Bit','Get_FFT_Data',TimeoutInMs, f0, df, ActiveChannelFFT, FFTArrayLength);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    ParameterValues = zeros(ParameterValueLength,1);
    fprintf('\n\nGetting the Single Tone Parameter Values.');
    [Error_Status,ParametersIn,ParameterValues] = calllib('HSDCProAutomation_64Bit','Single_Tone_Parameters',ParametersIn,dBFs,TimeoutInMs,ParameterValues,ParameterValueLength);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));
    if (dBFs>0)
    ParamUnit = 'dBFs';
    else
    ParamUnit = 'dBc';
    end
    fprintf('\nThe Parameter Values are:');
    fprintf('\nSNR = %g %s',ParameterValues(1),ParamUnit);
    fprintf('\nSFDR = %g dBc',ParameterValues(2));
    fprintf('\nTHD = %g %s',ParameterValues(3),ParamUnit);
    fprintf('\nSINAD = %g %s',ParameterValues(4),ParamUnit);
    fprintf('\nENOB = %g Bits',ParameterValues(5));
    fprintf('\nFund. = %g dBFs',ParameterValues(6));
    fprintf('\nNext Spur = %g %s',ParameterValues(7),ParamUnit);
    fprintf('\nHD2 = %g dBc',ParameterValues(8));
    fprintf('\nHD3 = %g dBc',ParameterValues(9));
    fprintf('\nHD4 = %g dBc',ParameterValues(10));
    fprintf('\nHD5 = %g dBc',ParameterValues(11));
    fprintf('\nNSD = %g %s/Bin',ParameterValues(12),ParamUnit);

    % Disconnecting from the board
    fprintf('\n\nDisconnecting from the board');
    [Error_Status] = calllib('HSDCProAutomation_64Bit','Disconnect_Board',TimeoutInMs);
    fprintf('\nError Status = %d (%s)',Error_Status,HSDCPro_Automation_Error_to_String(Error_Status));

    input('\n\nPress ENTER to exit..');

    ERROR:

    HSDCPro_Automation_DLL_ADC_Example_64bit

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


    Selecting ADC Device : AR16xx_lvds_4Channel_ddr_4bit_par_centre_16_bit
    Error Status = 7002 (Could not open "Automation DLL Error Codes.csv")

    Configuration Settings:

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

    ADC Input Target Frequency = 10000000
    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 105)


    Error Status = 0 (No Error)

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

    Applying Trigger Settings
    Error Status = 7002 (Could not open "Automation DLL Error Codes.csv")

    Start Normal Capture. Press ENTER to continue...

     

  • Hello Anum,
    We are going to try to reproduce the problem and get back to you
    Regards,
    Brian