Sending data from PC

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

Sending data from PC

Postby FPGA_land » Fri Oct 03, 2008 1:22 pm

Hi
I am trying to send data via USB from the PC to buff2 of Xylo LM board. I have tried examples of USB bidirectional (provided with kit). In the eg, every time a data(5 bytes) is sent a counter gets incremented by 5 and displays on the screen indicating that 5 or 10 or 15 and so on bytes of data were received .
I am new to C++ and I am not very sure how to send diff values? do I need to give my values to buf[0],buf[1] and so on and just use the Xferdata function? What are the parameters that i need to send? If anyone has a simple pgm so as to send data to buff kindly share it with me. I have written codes using timing diagram for FPGA to read the data from buff2 using verilog. It works well in simulation,so now I need to check the read pgm by sending data to buff2 and make sure I am not losing any data .
Any help is appreciated.
Thanks
FPGA_land
 
Posts: 5
Joined: Mon Aug 25, 2008 6:08 pm

Postby FPGA_land » Fri Oct 03, 2008 7:17 pm

please anyone?
FPGA_land
 
Posts: 5
Joined: Mon Aug 25, 2008 6:08 pm

Postby prbellamy » Fri Oct 17, 2008 3:14 pm

Here's a little C# app which should show you how to send and receive.
Cheers, Phil

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CyUSB;

namespace CyUSBreadwrite
{
class Program
{
static void Main(string[] args)
{
USBDeviceList devs;
CyUSBDevice myusbdev;

CyUSBEndPoint endptTX;
CyUSBEndPoint endptRX;

devs = new USBDeviceList(CyConst.DEVICES_CYUSB);
if (devs.Count == 0)
return;
myusbdev = devs[0x04B4, 0x8613] as CyUSBDevice;

endptTX = myusbdev.EndPoints[3];
endptRX = myusbdev.EndPoints[5];

byte[] data = new byte[4];
data[0] = 0;
data[1] = 3;
data[2] = 1;
data[3] = 1;

int len = 4;

endptTX.XferData(ref data, ref len); //send data to FIFO2
endptRX.XferData(ref data, ref len); //receive from FIFO4

Console.WriteLine("Received {0} byte: {1}", len, data[0]);

}
}
}
prbellamy
 
Posts: 9
Joined: Wed Jul 18, 2007 11:51 am


Return to FX2 FPGA boards