AD5370, AD5371, AD5372 and AD5373 evaluation board software commands

Hi,

This discussion explains how to use the new dll library available for both Windows 32 and 64 bits OS.

We aim to provide a detailed explanation of the dll functions and the commands associate with each evaluation board.

This discussion WONT provide any more specific example than the .vi and VB6 code attached.

We are not software developers so for any other software platform, don’t ask please.

If you have some question you can use any search engine available in the web.

Before start you must install, ADI_PDA_Drivers.exe

The dll can be found in the next path:

“Program Files\Analog Devices\USB Drivers\ADI_CYUSB_USB4.dll”

Before continue, the dll has been developed in C++ so, some clarifications

-          The sign “*” before the name of the function means pointer

-          UInt: unsigned integer, 4 bytes

-          Int: Integer, 4 bytes

-          UShort: unsigned short, 2bytes

-          Char: char, 1 byte

-          UChar: unsigned char, 1 byte

The  three first functions are used to connect with the board and have to be  called in the order they are presented in this document.

  • Search For Boards

 

Function prototype:

Uint  Search_For_Boards (uint VID, uint PID, uint *Num_boards, char *PartPath[]);

 

This function searches the PC for USB devices that match the requested VID and PID.
It returns an error (zero for non-error) along with the number of  matching boards found and a path address in a buffer for each of them.

The PartPath returns the path for each board found in the PC that match PID and VID.

Ie. Num_boards = 2,

Path for the first board -> PartPath[0]

Path for the second board -> PartPath[1]

VID : 0x0456

PID : 0xB20F

  • Connect

Function prototype:

Int Connect(Uint VID, Uint PID, char PartPath, Uint *Handle);

The PID and the VID are the same than before.

This function connects with the board at address path after  making sure that it’s still the correct board (checks PID & VID). A  handle is returned, along with an error variable (zero for non-error).  The handle is the unique identifier for the PC-Board connection.

PartPath is a single location from the previous array, typically PartPath(0).

  • Download Firmware

 

                Function prototype:

Int Download_Firmware(Uint Handle, char  pcFilePath[]);

 

This  function programs the uC. The pcFilePath is the path where is located  the hexadecimal file (included in the attached file) to program the uC.  The char array should be null terminated (finish with 0)

  • Vendor Request

Function prototype:

Int   Vendor_Request(UInt  Handle, UChar Request, UShort Value, UShort Index,  UChar Direction, UShort DataLength, UChar *Buffer[]);

This  function sends commands between PC and board. The command table is  included in the hexadecimal code that has been downloaded previously.

Each command requires different parameters for the execution. The list of commands available for both boards is explained below.

An error value is returned (zero = no error)


Request

Value

Index

Direction

Datalength

Buffer

SPI_WRITE

0xDD

16 LSB data

8 MSB data

0

0

0

SPI_READ

0xDD

0

0

1

3

DATA[]

SETRESET

0xDA

0

0

0

0

0

CLRRESET

0xDB

0

0

0

0

0

SETCLR

0xDC

0

0

0

0

0

PULSE_LDAC

0xDE

0

0

0

0

0

CLRCLR

0xDF

0

0

0

0

0

SETLDAC

0xE2

0

0

0

0

0

CLRLDAC

0xE3

0

0

0

0

0

DATA returns 3 byte of data

  • Disconnect

 

                Function prototype:

Int Disconnect (Uint Handle)

This function closes the connection PC – board.

If do you think I miss something just let me know.

Regards,

Miguel

attachments.zip
  • Hi,

    I have read about the new dll for the ad5370 demo board.

    Learned a lot and wrote the attached by building on the example.

    This finds multiple boards and assigns i.d. When I choose board index #1 the vi executes without error but no

    voltage output to channel #1. I have saved the binary val and index in the vi.

    If I choose board index #2 the vi returns error writing.

    Both boards work with the old dll in windows xp but only one board at a time since the old dll has no multiple board ability.

    My failure occurs on a windows 7 64 bit machine running labview 2013 32 bit.

    I tried running the version that works perfectly on the xp machine using the old dll on the windows 7 machine but naturally that doesn't

    run because the dll is the wrong one for the the usb driver ( this is conjecture on my part)

    Any ideas ???????????

    Please ??????????

    Dave

    Message was edited by: David Persechini By the way, I tried the AD5370 evaluation software that requires hex input and this worked just fine. I used the voltage calculator to figure the base 10 values and input them as hex. The eval software predicted that correct value that was on the scope. Dave

  • 0
    •  Analog Employees 
    on Dec 26, 2013 4:39 PM

    Hi,

    Are you trying to connect two boards?

    My you provide more details about your setup?

    Regards,

    Miguel

  • 0
    •  Analog Employees 
    on Dec 26, 2013 7:45 PM

    Hi Dave,

    May you save the labview code for 11.0?

    Regards,

    Miguel

  • Hi Miguel,

    I attached my vi in the message above "persechini V1.vi"

    I am using win 7 64bit, with labview and as explained and the AD user interface works fine with one board.

    The vi above in which I tried to build on your example vi finds the boards (two) and returns handles. If I try to write

    the board 1, there are no errors but no channel voltage change. If I try to write to board two the vi returns an error

    (failure to download).

    If I have only one board the vi finds that board but if I write to channel one there are no errors but no voltage change.

    Feel free to call me in the lab at 310-317-5864. I am here now and that might be more efficient.

    Dave

  • Hi Miguel,

    Yes I can save it for labview 11. Is there something specific you are thinking ?

    Do you think it is a problem with 64 bit windows 7 ?

    Did you look at my vi and does it seem properly using your dll's ?

    Dave