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]);
}
}
}