Interfacing

Saxo/-L & Xylo/-EM/-L/-LM boards

Interfacing

Postby FPGA_land » Tue Sep 09, 2008 1:28 pm

Hi all,
I recently got the Xylo LM board. I am trying to receive real time data from say a spectrometer and transmit it as input to my FPGA for some processing. I have drivers and .dll files for spectrometer and able to program it using a windows API (Visual basic) to receive the data. But on the FPGA side I have drivers for the USB. I would like to use Visual Basic wherein I can operate a GUI to receive data, configure FPGA etc. How do I do this? I did download CyUSB.dll from cypress website but unable to find a way to program it and call particular functions and interface. I have used FTDI D2xx before in which I just had to make fuction calls in VB.
Any help is appreciated as to how I can go about this.
Thanks
FPGA_land
 
Posts: 5
Joined: Mon Aug 25, 2008 6:08 pm

Postby seattleEE » Thu Sep 18, 2008 6:53 am

I think I have run into the same issue. When you have the xylo CyUSB.sys driver, the Cypress libs cannot see the xylo. When you install the CyUSB.sys driver from Cypress, then the cypress desktop tools work, but the xylo tools fail.
seattleEE
 
Posts: 13
Joined: Sat Sep 13, 2008 4:42 pm

Postby fpga4fun » Thu Sep 18, 2008 8:26 am

It is probably because the GUID used by the Cypress tool is different from the one FPGAconf uses by default.

Try that: open a command-line window, and type "FPGAconf /?". You can see the list of parameters accepted. One of them allows to contol the GUID. Use it to match the one used by Cypress (you can find it in the .inf file of the Cypress driver).
fpga4fun
Site Admin
 
Posts: 837
Joined: Thu Sep 18, 2003 6:47 am

Postby seattleEE » Thu Sep 18, 2008 8:47 am

I saw a comment from John Miles that said FPGAConf had to be run at least once before the USB stuff worked. And after switching back to the original xylo driver and trying that, it indeed works.

Here's the bidi communication example in c#. And it works :)

Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using CyUSB;

namespace Test1
{
    public partial class Form1 : Form
    {
        USBDeviceList usbDevices;
        CyUSBDevice MyDevice;

        public Form1()
        {
            InitializeComponent();

            App_PnP_Callback evHandler = new App_PnP_Callback(PnP_Event_Handler);

            usbDevices = new USBDeviceList(CyConst.DEVICES_CYUSB, evHandler);
            //myDevice = new CyUSBDevice();

            MyDevice = usbDevices[0x04B4, 0x8614] as CyUSBDevice;
        }


        public void PnP_Event_Handler(IntPtr pnpEvent, IntPtr hRemovedDevice)
        {
            if (pnpEvent.Equals(CyConst.DBT_DEVICEREMOVECOMPLETE))
            {
                usbDevices.Remove(hRemovedDevice);

                // Other removal event handling
                MyDevice = null;
            }

            if (pnpEvent.Equals(CyConst.DBT_DEVICEARRIVAL))
            {
                usbDevices.Add();

                // Other arrival event handling 
                MyDevice = usbDevices[0] as CyUSBDevice;
            }
        }

        private void button1_Click(object sender, EventArgs ee)
        {
            CyUSBEndPoint BulkOutPipe0 = MyDevice.EndPoints[1];
            CyUSBEndPoint BulkInPipe1 = MyDevice.EndPoints[2];
            CyUSBEndPoint BulkOutPipe2 = MyDevice.EndPoints[3];
            CyUSBEndPoint BulkOutPipe3 = MyDevice.EndPoints[4];
            CyUSBEndPoint BulkInPipe4 = MyDevice.EndPoints[5];
            CyUSBEndPoint BulkInPipe5 = MyDevice.EndPoints[6];

            byte[] buf = new byte[256];

            int len =5;
            BulkOutPipe2.XferData(ref buf, ref len);

            len = 256;
            BulkInPipe4.XferData(ref buf, ref len);
            Console.WriteLine("Received {0} bytes of value: {1}", len, buf[0]);
        }
    }
}
seattleEE
 
Posts: 13
Joined: Sat Sep 13, 2008 4:42 pm

Postby FPGA_land » Thu Sep 18, 2008 2:12 pm

thanks ..shall try this and see if it works...
I found this Windriver from Jungo's website that provides .dll , .inf (similiar to one provided with the board) files for the cypress usb and makes interfacing so much easier. It provides the API and VB codes and function calls. Only prob I am facing, sometimes this driver doesn't recognise the XYLO board. I am working on that issue...
FPGA_land
 
Posts: 5
Joined: Mon Aug 25, 2008 6:08 pm

Postby iammegatron » Fri Feb 05, 2010 7:19 pm

On power-up the FX2 on my saxo-L board doesn't show any endpoints (checked by USB view.exe).

I got exception error when trying to run the bi-direction communication exe in the KNJN example folder, which needs to access endpoints.

But after running FPGAConf once, the endpoints appear.

My question is how to configure FX2 to have the endpoints armed/ready.

Is it a firmware load or talking to the default control endpoint in FPGAConf?

Please help.


seattleEE wrote:I saw a comment from John Miles that said FPGAConf had to be run at least once before the USB stuff worked. And after switching back to the original xylo driver and trying that, it indeed works.

Here's the bidi communication example in c#. And it works :)

Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using CyUSB;

namespace Test1
{
    public partial class Form1 : Form
    {
        USBDeviceList usbDevices;
        CyUSBDevice MyDevice;

        public Form1()
        {
            InitializeComponent();

            App_PnP_Callback evHandler = new App_PnP_Callback(PnP_Event_Handler);

            usbDevices = new USBDeviceList(CyConst.DEVICES_CYUSB, evHandler);
            //myDevice = new CyUSBDevice();

            MyDevice = usbDevices[0x04B4, 0x8614] as CyUSBDevice;
        }


        public void PnP_Event_Handler(IntPtr pnpEvent, IntPtr hRemovedDevice)
        {
            if (pnpEvent.Equals(CyConst.DBT_DEVICEREMOVECOMPLETE))
            {
                usbDevices.Remove(hRemovedDevice);

                // Other removal event handling
                MyDevice = null;
            }

            if (pnpEvent.Equals(CyConst.DBT_DEVICEARRIVAL))
            {
                usbDevices.Add();

                // Other arrival event handling 
                MyDevice = usbDevices[0] as CyUSBDevice;
            }
        }

        private void button1_Click(object sender, EventArgs ee)
        {
            CyUSBEndPoint BulkOutPipe0 = MyDevice.EndPoints[1];
            CyUSBEndPoint BulkInPipe1 = MyDevice.EndPoints[2];
            CyUSBEndPoint BulkOutPipe2 = MyDevice.EndPoints[3];
            CyUSBEndPoint BulkOutPipe3 = MyDevice.EndPoints[4];
            CyUSBEndPoint BulkInPipe4 = MyDevice.EndPoints[5];
            CyUSBEndPoint BulkInPipe5 = MyDevice.EndPoints[6];

            byte[] buf = new byte[256];

            int len =5;
            BulkOutPipe2.XferData(ref buf, ref len);

            len = 256;
            BulkInPipe4.XferData(ref buf, ref len);
            Console.WriteLine("Received {0} bytes of value: {1}", len, buf[0]);
        }
    }
}
iammegatron
 
Posts: 4
Joined: Thu Feb 04, 2010 4:56 pm


Return to FX2 FPGA boards