Post Go back to editing

AD7785 Eval Board connect with C# or VB

It seems the code here could be modified to connect to the AD7785 Eval Board:

ftp://ftp.analog.com/pub/evalcd/AD5667/code%2064%20bits/USBStuff.bas

... but what is the PID for this board? (I assume the VID is the Vendor ID which is still 1110.)

Thanks, Dave.

  • I found it under the Property page - Hardware Ids as 0xB480 (46208) but as soon as I try to access the  function:

    Search_For_Boards(VID, PID, Number_Boards, PartPath(0))

    the search fails. The changed parts of the code are:

    ... the Lib path is:

    Lib "C:\Program Files (x86)\Analog Devices\EVAL-AD7785EBZ\data\ADI_CYUSB_USB4.dll" _

    and the Hex is (it doesn't make it this far):

    HexFilePath = "C:\Program Files (x86)\Analog Devices\EVAL-AD7785EBZ\Icv_spi.hex"

    ... other than that the code is unchanged. I tried both forward and backslashes for the Lib path but it makes no difference.

  • I have made progress over the weekend:

    [DllImport(@"\ADI_CYUSB_USB4.dll", EntryPoint = "Search_For_Boards")]
    public static extern uint Search_For_Boards_Imp(uint VID, uint PID, ref uint Number_Boards, ref char PartPath);
    [DllImport(@"\ADI_CYUSB_USB4.dll", EntryPoint = "Connect")]
    public static extern int Connect_Imp(uint VID, uint PID, char PartPath, ref uint Handle);
    [DllImport(@"\ADI_CYUSB_USB4.dll", EntryPoint = "Download_Firmware")]
    public static extern int Download_Firmware_Imp(uint Handle, IntPtr PartPath);
    [DllImport(@"\ADI_CYUSB_USB4.dll", EntryPoint = "Vendor_Request")]
    public static extern int
    Vendor_Request_Imp(uint Handle, byte Request, ushort Value, ushort Index, byte Direction, ushort DataLength, ref byte Buffer);
    [DllImport(@"\ADI_CYUSB_USB4.dll", EntryPoint = "Disconnect")]
    public static extern int
    Disconnect_Imp(uint Handle);
    uint VID = 1110; // 0x456
    uint PID = 46208; // 0xB480
    uint Number_Boards = 0, Handle = 0;
    char PartPath = '\0';
    byte[] BuffeS = new byte[120];
    byte SelectchannelADC = 0xDD;
    ushort Index = 0, Datalength = 3;
    byte Direction = (byte)1;

    string firmPath = "Icv_spi.hex";

    uint found = Search_For_Boards_Imp(VID, PID, ref Number_Boards, ref PartPath);
    int error = Connect_Imp(VID, PID, PartPath, ref Handle);
    var result = System.Text.Encoding.ASCII.GetBytes(firmPath);
    IntPtr firmware = Marshal.AllocHGlobal(result.Length);
    Marshal.Copy(result, 0, firmware, result.Length);

    int downloaded = Download_Firmware_Imp(Handle, firmware);

    int success = Vendor_Request_Imp(Handle, SelectchannelADC, (ushort)0, Index, Direction, Datalength, ref BuffeS[0]);

    But, I have run into a roadblock with the last line and keep getting a return code of 3011 (after a few seconds delay) while trying to read the data.

  • Hi Dwwaddell,

         Apologies for the delay. But here is a link of a wiki page for AD7785 driver that can be your reference for the software development. AD7793 IIO Low Power Sigma-Delta ADC Linux Driver [Analog Devices Wiki]

    Regards,

    Jonathan

  • Yes, I have already looked at all that code. What I can't figure out is the correct arguments to

    Vendor_Request_Imp(Handle, SelectchannelADC, (ushort)0, Index, Direction, Datalength, ref BuffeS[0])

    ... in the code I have written above, to read the data from AIN(+)-AIN(-). Any help is appreciated.

    Thanks, Dave.

  • Hi dwwaddell,

         The evalboard uses cypress ucontoller, I can refer you to the Cypress dll documentation, which may help you on some arguments on the function. Please check on the xferdata function or function related. Please refer to the link http://www.cypress.com/?docID=41366

    Regards,

    Jonathan

  • This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

    Thank you,
    EZ Admin