AD9278-50EBZ + HSC-ADC-EVALCZ Acquisition from MATLAB has some errors

%The following dlls are required for using the library.
%These three dlls are needed in the same directory:
%If you have installed VisualAnalog these dlls will be in the VisualAnalog
%install folder as shown below.

%This needs to be the path to HadBoardApi.dll . Change if necessary.
hadInfo = NET.addAssembly('C:\Program Files (x86)\Analog Devices\VisualAnalog\HadBoardApi.dll');
% NET.addAssembly('C:\Program Files (x86)\Analog Devices\VisualAnalog\HadSdpSupport.dll');

% hadInfo.Classes
% showGenericMethods('HadBoardApi.HadBoard')

%*** Set FPGA file path. ***
%This FPGA program file is for the AD9653. The FPGA program file for AD9253 is AD9253_Main.bin
fpgaFilePath = 'C:\Program Files (x86)\Analog Devices\VisualAnalog\Hardware\HSC_ADC_EVALC\Octal_High_Speed.bin';
% fpgaFilePath = 'C:\Program Files (x86)\Analog Devices\VisualAnalog\Hardware\HSC_ADC_EVALC\High_Speed_Octal_synchronous_capture.bin';

% HadBoardApi.HadBoard.Compatibility;
% NET.setStaticProperty('HadBoardApi.HadBoard.Compatibility',HadBoardApi.CompatibilityFlags.('HadSdp'));

%This assumes we found at least one board and want the first capture board found.

board = HadBoardApi.HadBoard.Board;

%Configure FPGA.

%Configure memory map on ADC.
param = HadBoardApi.HadSpiParameters(1, 0, 1)
%param.LongInst = 1, param.LsbFirst = 0, param.SdoActive = 1
board.SpiInitInterface(1, param)

%This section is ADC specific.
%These are ADC SPI register addresses
%Write ADC registers as desired.
% Capture (mail)
board.SpiWrite(int16(hex2dec('00')), uint8(hex2dec('3C'))); % Soft Reset
board.SpiWrite(int16(hex2dec('08')), uint8(hex2dec('03'))); % Digital Reset
board.SpiWrite(int16(hex2dec('08')), uint8(hex2dec('00'))); % release from Digital Reset
board.SpiWrite(int16(hex2dec('14')), uint8(hex2dec('00'))); % set output format to Offset binary

% Power down unwanted channels
% board.SpiWrite(int16(hex2dec('04')), uint8(hex2dec('0F'))); % Disable channels E-H
% board.SpiWrite(int16(hex2dec('22')), uint8(hex2dec('01'))); % Power down channels E-H% 
% board.SpiWrite(int16(hex2dec('05')), uint8(hex2dec('0E'))); % Disable channels B-D
% board.SpiWrite(int16(hex2dec('22')), uint8(hex2dec('01'))); % Power down channels B-D

% Reset channels
% board.SpiWrite(int16(hex2dec('04')), uint8(hex2dec('0F'))); % Disable channels E-H
% board.SpiWrite(int16(hex2dec('22')), uint8(hex2dec('02'))); % Power down channels E-H% 
% board.SpiWrite(int16(hex2dec('05')), uint8(hex2dec('0E'))); % Disable channels B-D
% board.SpiWrite(int16(hex2dec('22')), uint8(hex2dec('02'))); % Power down channels B-D

board.SpiWrite(int16(hex2dec('05')), uint8(hex2dec('31'))); % Enable channel A only
board.SpiWrite(int16(hex2dec('21')), uint8(hex2dec('00'))); % Set bit resolution
% board.SpiWrite(int16(hex2dec('14')), uint8(hex2dec('00'))); % Set data format (offset binary(00) or two's complement(01))
% board.SpiWrite(int16(hex2dec('0D')), uint8(hex2dec('03'))); % Set a Digital Test Pattern
board.SpiWrite(int16(hex2dec('FF')), uint8(hex2dec('01'))); % Device Update 

%% Configure FPGA memory map and capture data.

% Configure FPGA memory map.???????? Does this apply to the AD9278 and HSC-ADC-EVALCZ  ?????????
% param = HadBoardApi.HadSpiParameters(1, 0, 1)
% param.LongInst = 1, param.LsbFirst = 0, param.SdoActive = 1
% board.SpiInitInterface(0, param)

% This section configures the FPGA for a specific ADC.
% Again, the register writes here are ADC specific.
% These are FPGA register addresses
% board.SpiWrite(int16(hex2dec('01')), uint8(hex2dec('30'))); %16bits
% 1xframe DDR2lane byte-wise 

%Select which AD9653 or AD9253 channel you would like to read data.
%Select only 1
% board.SpiWrite(int16(hex2dec('02')), uint8(hex2dec('00'))) %read ChA
% board.SpiWrite(int16(hex2dec('02')), uint8(hex2dec('01'))); %read ChB
%board.SpiWrite(int16(hex2dec('02')), uint8(hex2dec('02'))); %read ChC
%board.SpiWrite(int16(hex2dec('02')), uint8(hex2dec('03'))); %read ChD


numWords = 2^8;     % What exactly is a 'Word' in the context of these two devices (AD9278 & HSC-ADC-EVALCZ)?  Is this just a fancy name for 'Number of samples to acquire?'
board.FillFifos(int32(numWords), int32(10));

numBytes = numWords*2;  % Why multiple by 2?  Should it not be numWords*12bits/8bits?

% Capture bytes. May need to use 2 for the second parameter instead of 1
% for your eval board - How will I know which one to use?????
dataABytes = HadBoardApi.HadBoard.Board.CaptureFifoBytes(int32(numBytes), int16(1)); 

% Convert to matrix
dataABytesMatrix = uint32(dataABytes);

% Create new matrix with each two adjacent bytes combined into a single
% word
% dataAMatrix = dataABytesMatrix(1:2:end) + dataABytesMatrix(2:2:end)*256;

plot(dataABytesMatrix); ylim([-512 512]);
axis 'square'


   we brougt an evlaution kit of AD9278-50EBZ + HSC-ADC-EVALCZ ,now we want to use these boards under Matlab(64bit), i copy the code  above, and change the correct  road of the HadBoardApi.dll ,but it  has the following error: 

"Not possible to load the file DLL 'FIFOInterface.dll': Not possible to find the specified module. (HRESULT exception: 0x8007007E)
Source: HadBoardApi"

  we have some questions:  1. does the 32-bit Matlab is necessary?  if not, can i add some code to adapt 64-bit Matlab?

                                             2. can you give us a ditail guide to use these two boards on Matlab ,cause we only look this knowledge from QA,but not a step by step user guide 


  • 0
    •  Analog Employees 
    on Aug 22, 2019 9:44 PM

    Hi Niqilulu,

    I believe 32bit Matlab is required to interface with the HSC-ADC-EVALCZ.

    It looks like you copied the Matlab script for another part. This is OK but you'll need to account for differences in the registers functions between AD9278 and the other part that the Matlab script was originally written for. Also, you'll need to account for the differences in the FPGA program and different FPGA registers.

    So, the first thing is to try 32bit Matlab. Once you have that, then it will still take a lot of work to get the script working. The fastest would be if someone has a working script they could share with you, but I'm sorry to say that I do not have such a script.

    I'm sorry I don't have better news for you.