Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers

USB or Ethernet

Altera_Forum
Honored Contributor II
1,744 Views

Hi, 

 

I have designed a board around a Stratix II and I am looking for a quicker and more efficient way to get data from the FPGA (registers read, writes, etc) than using I2C. I do not need to program the FPGA through USB or Ethernet, just for data transfers. 

 

I have started to look at Ethernet and USB and I am trying to determine which interface is easier to implement and what kind of data transfer rates I can realistically expect. For USB, I have looked at chips such as CY7C68000 but really am not sure about the difficulty to implement on the FPGA side. I am quite new to USB and Ethernet and have never really written drivers for them. I would also like to interface these to the FPGA without using expensive IP.  

 

I know USB is probably more difficult than Ethernet but the Powers to be would really like to see USB on my board. If I were to implement USB which hardware would you recommend to make it easier to interface to the Stratix II. What kind of data rates could I expect by using similar hardware to the USB blaster which I believe is USB to JTAG. I do not need high speed USB (480 Mbps), but something close to full speed would work (12 Mbps). Even something a little less would be okay. I have also seen such interfaces such as USB to I2C, but I was unsure if the data rates were any faster than regular I2C. I would definitely need something greater than 1 Mbps. I have already written verilog code for the I2C interface, so if I could acheive faster data rates than 1 Mbps by using USB to I2C, this would be awesome. 

 

I am very new to this subject, so please excuse my ignorance.  

I am really just flustered with the amount of interfaces out there and am really just looking for a starting direction in which I should look. I would really like to get this interface up and running fast, but really do not have much experience with USB and almost none with Ethernet. I would just like the easiest interface in which I could transmit/receive data to the Stratix II at rates faster than 1 Mbps. 

 

 

Any help or ideas are greatly appreciated. 

 

Andrew
0 Kudos
12 Replies
Altera_Forum
Honored Contributor II
846 Views

You need to give us more details. I can tell you that using cypress (slave) hooked to a PC and using cypress drivers is not that bad. From start to finish it took me about a month to figure out the C code, the fpga code and talking in one direction, and I had never touched USB before. Now if you want two way communications between FPGA's that's another story and I would think you might want to use NIOS II and ethernet or usb if drivers are available. I wouldn't want to develop a TCP/IP (or even UDP/IP) stack on an FPGA, unless my boss was willing to buy some IP that takes care of the physical layer and presents you something like a buffer or memory mapped interface. Otherwise if you are completely new to it, you are looking at probably a few months of a lot of work, if you're the only one on the project.

0 Kudos
Altera_Forum
Honored Contributor II
846 Views

Yeah, I hear you. 

 

I am basically just looking for two way communication between PC and FPGA. I know development takes time, but a month is too long for my time frame (I am the only one on the project).  

 

What kind of hardware did you use from Cypress to implement your interface?
0 Kudos
Altera_Forum
Honored Contributor II
846 Views

I have done both USB and Ethernet in my designs. 

 

I previously used the Cypress EZ-USB SX2 series. They were extremely easy to interface to on the FPGA side. We did it with and without the NIOS (the NIOS was obviously much easier). Basically the chip just looks like a FIFO that you write to / read from. It seems like we were able to get around 300Mbps without doing anything special. 

 

For the PC-side driver, we modified Microsofts bulksys driver to meet our needs. For Linux, we wrote our own driver but we were able to use libUSB both on Linux and Windows. If I had to write a driver again, I'd go the libUSB route. 

 

Apparently the FTDI USB chips must be very easy to work with because it seems like everybody is using them now. They provide a driver for you but I've noticed that you can't have more than one device on a machine that uses that driver. Also they only support 12Mbps. 

 

There are some advantages to using USB. USB can be done with a minor amount of buffering and the FPGA-side driver is light and fast. Implementing the TCP/IP stack for Ethernet is a huge overhead burden. It requires a lot of processing power and a lot of buffer memory. In my USB designs, I was able to run the entire operating system for the NIOS out of onchip memory within the Stratix II. With ethernet, I need external memory to accomodate the TCP/IP stack. 

 

The downsides to USB are that it has limited connectivity (length, point-to-point) and you have to write everything pretty much yourself. You don't get to take advantage of the existing software and hardware that are built around TCP/IP. Ethernet is nice because you don't have to write any of the low-level stuff. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
846 Views

Consider using an FTDI (USB) chip. FT245x USB to parallel converter chip (http://ftdichip.com/products/ft245r.htm) is a good choice. 

It allows bi-directionnal transfer between PC and FPGA. 

Bandwidth is very good (near 12 MBits), and the chip is *VERY* easy to interface. 

 

On the PC side, Windows DLL provided by FTDI is also easy to use and well documented. In a couple of day, you shoud be done.  

 

This is the chip used in the Altera USB-Blaster. 

 

Hope this helps.
0 Kudos
Altera_Forum
Honored Contributor II
846 Views

Thanks for the input! 

 

For my design, it looks as though using a FTDI chip is the way to go. I really only need FS USB, anything more would be an overkill. 

 

Are there any resources (code examples, etc) for interfacing FTDI chip to an Altera FPGA? 

 

I appreciate the help.
0 Kudos
Altera_Forum
Honored Contributor II
846 Views

When I said a month it was because i had NO HELP. I used the first week just reading about USB physical layer, packet layer, etc. Then I discovered I didn't necessarily need to know all that stuff. Sounds like the FTDI is a good way to go. Also note that if their interface isn't all that great you might look into libusb for win32 which is released under LGPL. Also note that there are a couple of usb snoopers that are good for watching data trafic on the usb. One is here http://www.hhdsoftware.com/products/home/usb-monitor.html but it's not free. There is another called usb snoopy, but it was a tad bit crash prone, but it is free if you are under budget constraints.

0 Kudos
Altera_Forum
Honored Contributor II
846 Views

I am currently looking at using the FT245R which seems extremely easy to interface to the Stratix II and will be used to read/write data to the FPGA. 

 

But, I also see that another chip from FTDI, the FT2232. After reading a few resources, I see that people are easily interfacing these chips to both read data and program the FPGA on the fly. (http://www.ftdichip.com/documents/datasheets/morph-ic/ds_morphic.pdf

 

I am wondering if it really is this easy, and if I should include this interface too. Does anyone have experience with the FT2232 and the MPSSE. Is it going to be quite a bit more hassles than just using the FT245R and simple commands to interface to the Stratix II? 

 

If easy enough, I wouldn't mind adding this programming interface, but am not too sure of the complexity. 

 

Anyone have any experience with this?
0 Kudos
Altera_Forum
Honored Contributor II
846 Views

 

--- Quote Start ---  

 

I was able to run the entire operating system for the NIOS out of onchip memory within the Stratix II. With ethernet, I need external memory to accomodate the TCP/IP stack. 

Jake 

--- Quote End ---  

 

 

Hi Jake, 

 

Can you elaborate on this please ? Which OS did you manage to shove into SII's internal memory (and which SII was it ?) ?  

Did you use a bootloader for that ? 

 

I've ran SW out of SII's internal memory in a project, but that didn't have an OS. 

 

Thanks
0 Kudos
Altera_Forum
Honored Contributor II
846 Views

Sorry. I used the term OS loosely. What I should have said was I ran the entire software project for the design out of onchip memory. It was essentially a home-grown OS for that design. 

 

Jake
0 Kudos
Altera_Forum
Honored Contributor II
846 Views

 

--- Quote Start ---  

Sorry. I used the term OS loosely. What I should have said was I ran the entire software project for the design out of onchip memory. It was essentially a home-grown OS for that design. 

 

Jake 

--- Quote End ---  

 

 

Oh, that sounds much more logical. Due to not being able to initialize MRAM cells, it's not possible to place much software inside the internal memory w/o using a bootloader (64KB for EP2S30, for example).
0 Kudos
Altera_Forum
Honored Contributor II
846 Views

It's really interface Ethernet. I and you can see a problem similar. I think you should be reference here (http://www.altera.com/search?output=xml_no_dtd&sort=date%3ad%3al%3ad1&client=www_frontend&proxystylesheet=www_frontend&ie=utf-8&oe=utf-8&site=www&q=ethernet)

0 Kudos
Altera_Forum
Honored Contributor II
846 Views

I think that you should look for at www.alterawiki.com 

 

there are much information which you need 

 

good luck
0 Kudos
Reply