• 0
RFtmi

Using USB 2.0 on Cora Z7 board

Question

Posted (edited)

Short story:

I want to use the Cora board to combined multiple low data rate signals and send it through the USB 2.0 port to a computer. I need the full speed of the USB 2.0. Do I need to buy a license for USB 2.0 from Xilinx to use Vivado for programming it? Is there any example code for running the USB 2.0 you could refer me to?

Long story:

I have a test setup for a chip that has 128 digitized data outputs less than 4Mbps each. I need to transfer these data outputs into a computer with real-time speed. I thought the easiest way is to use an FPGA, combine the 128 data lines, and send them through the USB port. I am looking at the Digilent Cora Z7 board that has the USB 2.0 port on the board. When I was reading Xilinx USB 2.0 manual I noticed the licensing part. Does the license come with the Digilent boards? Do I need to purchase a license to activate the USB IP on Vivado and programming the FPGA? 

Also, it seems that it is a lot of work to figure out the USB IP and getting it working. Is there any example code for running the USB 2.0 you could refer me to? 

Would it be easier if I use Ethernet or something else?

Edited by RFtmi

Share this post


Link to post
Share on other sites

10 answers to this question

Recommended Posts

  • 0
2 hours ago, RFtmi said:

I want to use the Cora board to combined multiple low data rate signals and send it through the USB 2.0 port to a computer. I need the full speed of the USB 2.0. Do I need to buy a license for USB 2.0 from Xilinx to use Vivado for programming it? Is there any example code for running the USB 2.0 you could refer me to?

Reading between the lines (apologies if I'm wrong, this is based solely on four sentences you wrote so prove me wrong): I see someone ("need the full speed ...") who'll have a hard time in embedded / FPGA land. For example, what is supposed to sit on the other end of the cable? A driver, yes, but for what protocol and where does that come from?

Have you considered Ethernet? It's relatively straightforward for passing generic data and you could use multiple ports for different signals to keep the software simple. UDP is less complex than TCP/IP and will drop excess data (which may be what I want, e.g. when single-stepping code on the other end with a debugger).

Share this post


Link to post
Share on other sites
  • 0
11 hours ago, RFtmi said:

128 digitized data outputs about 4Mbps each.

isn't that 512 Mbps, with USB 2.0 ~ 480 Mbps max? And I wouldn't bet on achieving that.

You could set up a simple Ethernet UDP dummy data generator on Zynq with what would be a few lines of C code on regular Linux, to check how much of that "gigabit" is actually achievable. But I suspect your requirements are deep in PCI territory.

BTW, I'm still looking for the 128 IOs on this board.

 

Share this post


Link to post
Share on other sites
  • 0

The total data rate will be less than the full speed of USB 2.0. I can multiplex the lines before feeding the FPGA or pick another board with more IOs. The main question here is 1- Do I need a license? 2- Is there an example of doing it? (without Linux just through the hardware and possibly a C code)

Share this post


Link to post
Share on other sites
  • 0

Hi @RFtmi,

Welcome to the Digilent Forums!

Are you referring to using the USB OTG and the USB 2.0 On-The-Go IP?

Or the USB UART Bridge and the uartlite and the uart16550

I'm not aware of a free IP Core that facilitates using the USB OTG without linux.

The USB UART Bridge is accessible through the ZYNQ Processor. Here is an Cora-Z7-10 XADC project that uses the USB UART Bridge which can be used through the Webpack edition of the Vivado.

best regards,

Jon

Share this post


Link to post
Share on other sites
  • 0

I am considering the AXI USB 2.0 Device Controller https://www.xilinx.com/products/intellectual-property/axi_usb2_device.html

I need about 400 Mbps total speed. I think the speed on USB UART is around 12 Mbps. Thank you for the link. I might use USB UART for the first round with smaller number of data channels (not the total 128 output channels of my setup).

Is there any other way to reach this speed? I need to record a couple of seconds of data. Can I write on a memory with this speed and then transfer it to the computer with a lower speed of USB UART? Is there an example for using the on board RAM?

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
17 hours ago, RFtmi said:

I need about 400 Mbps total speed. I think the speed on USB UART is around 12 Mbps.

Calculating data rates from clock frequencies for most PC interfaces is not as straight-forward as it might seem. For USB 2.0 the peak transfer rate might be 60 million bytes per second  (about 57.22 MB/s) but you'll never achieve anything close to that as an average for any payload size. This is partly due to the nature of the USB protocol and OS overhead. Also, there are latency issues if you want to stream data at some minimal rate. If you look around I've been posting lately on a project to use inexpensive single-board computers with FPGA boards like the CMOD. At best I can get around 42 MB/s data rates; if you ignore OS overhead. And this is with an FTDI device using the fastest synchronous 245 FIFO mode. The Cypress USB interface that is on the Altas FPGA board is more capable than the FTDI devices and provides somewhat better average performance.

For Ethernet there are the same OS latencies as well as packet format overhead so even 1G Ethernet is likely to provide at most around 30 MB/s data rates; unless you do something very creative.

UART data rates are the easiest to quantify. They don't work on 8-bit words. At least you will have 1 start and 1 stop bit per baud; so actual data rates are at best 8/10th the raw bit rate.

It is possible to stream data at a rate that meets your requirements using USB 3.0. If using Digilent boards you need to have a board with an FMC connector and add a USB mezzanine board with a USB 3.0 interface. Fortunately, FTDI and Cypress both offer inexpensive development boards that work with the Nexys Video or Genesys2. Unfortunately, these FPGA boards are in a different price range than the one the you have. Other vendors offer FPGA boards with a USB 3.0 interface such as Opal Kelly but again the price is usually much higher than Digilent boards and have a lot less in terms of interfaces.

Edited by zygot

Share this post


Link to post
Share on other sites
  • 0

Terasic has the C5P board with the largetst Cyclone V GX device and 4 lanes of Gen 1 PCIe. The significant aspects of this board are the low price ( for an FPGA board with PCIe ) and the Terasic provided PCIe drivers for Linux and Windows. To my knowledge this is the first reasonable cost solution for doing FPGA development with  a PCIe interface not requiring any third party IP or drivers. I've been using one for a couple of weeks now and am impressed. I've built both FPGA designs and PC applications using free tools. If you really need to develop an FPGA centric project with a high speed PC interface and don't want to bother developing your own USB 3.0 code  (4 lanes of PCIe Gen 1 have data rates that are a good deal faster than USB 3.0) I suggest looking into this board. The C5P started out as a stand-alone board but now is connected to Intel's OpenVino Deep learning initiative. My only complaints so far are that it took so long for one of the big FPGA vendors to allow such a platform to be available to developers with a small budget; and that there is no similar board for those of use who prefer to use Xilinx tools and devices. I have used similarly priced boards from Microsemi and Lattice but you need a licence for the tools  and the drivers are limited.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now