my graduate project using FPGA (need some help)


Recommended Posts

Hi everyone


im Haider Ali from iraq

4th stage Computer Engineering Techniques


maybe i have mistakes in my englsih ... sorry about it


While I'm writing this I tired from how many time asking about it

I was thinking it's easy to learn FPGA and then make your idea real by using it

Asking about problem in FPGA and get right answer is million time harder than learning FPGA and VHDL professionally……..


      I have graduate project next year in college so I decide to choice good idea and make it

I want to work on fiber optic and FPGA by making device to convert the data signal from USB port or Ethernet Port to light by encode it and translate it via Optical Fiber to another Station to decode it and reconvert it to the Original Digital Discrete signal …

I have some question about this and how should I work

I make thread about my problem I Xilinx Forum buy I wish I didn't make it before I don't know why this company have Forum if they don't reply to the post

After month someone reply by tell me go and read support file …

I post the same thread in Altera Forum again and I get many replies from many members

This link for my thread in Altera Forum please read it to understand what I want.


My first problem in this project in how to decode USB protocol signal

This is Daixiwen reply



"You can find a few solutions to decode USB signals directly in an FPGA but they usually licensed, which means you will have to pay to use them. There is a free core available at Opencores but I don't know how usable it is. There is another problem though, for these cores to work you will need an external PHY chip. I don't know about any development kit that has one, so it means you would have to do your own daughterboard with the correct chip.

Another solution is to use a development kit that already has a USB interface. Almost all the Altera kits have one, but it is used for JTAG access. You can reprogram the MAX II chip to use the USB interface for your own purposes, but then you don't have the USB blaster functionality anymore and can't configure the FPGA without an external USB-Blaster. Other kits such as the one you show here, or some Altera Cyclone V kits, have a second USB connector that you could use without loosing the JTAG functionality. But note that in all those cases, you won't emulate a generic USB device. Usually the integrated USB functionality on those kits is a serial link (UART) so you won't be able to directly emulate a USB flash drive."


What I understand from Daixiwen said on post #6, I will need to decode USB  protocol on USB Device side(FPGA1) and pass command to another Board(FPGA2) via optical, and FPGA2 will decode your optical command and issue USB protocol command in order to receive data from USB Flash Driver. And then send these data(from Flash Driver) back to FPGA1 and FPGA1 will provide data to PC via USB protocol


But Daixiwen said there is no board have the ability to analyze USB protocol with speed 480 MBPS

I get no more comment in this thread about it



I send many messages in Facebook for many people and make many post in FPGA Group and FPGA Developer Group and I don’t get something better than my thread in Altera Forum


Today visit sparkfun try to read all comment in Mojo v3 page and all Papilio model Pages

After I read it I visit and go to learn sectionI read "High Speed Data Transfer Between Two Papilios" tutorial


I find it great project I didn't know that papilios have the ability to translate data in high speed

I feel one half is solved

If I connect laser diode with high speed raise time and fail time response

I could generate high speed discrete light beam via optical fiber

But there is another half of my problem

Is how to analyze USB PROTOCOL? 

I read this tutorial "VHDL SD Card Writer v1.0 For Papilio" In learn section too


The person who make this tutorial use USB Card Reader as I thing so the USB analyze problem is solved too


I wish if any member know anything tell me and post in this thread and can I make this project by using papilio board and analyze USB Port


This is last time I asking about this idea if I get help from you I will work on it if not I'll leave it


Thank you very much









Link to comment
Share on other sites



At what speed do you want to transfer data ?

What encoding/protocol you want to use in the optical part ? is that a full-duplex or half-duplex protocol ?

Do you really need to use USB ? Or just using it as a transport protocol ? (implementing USB is really hard)


Best regards,


Link to comment
Share on other sites



At what speed do you want to transfer data ?

What encoding/protocol you want to use in the optical part ? is that a full-duplex or half-duplex protocol ?

Do you really need to use USB ? Or just using it as a transport protocol ? (implementing USB is really hard)


Best regards,



thanks for reply


i want to send data at same speed that USB 2.0 have 480 Mbps

 i want to use full-duplex protocol


but sir what is the hard in USB protocol

the use have D+ and D- these termials transfare discrete data signal




i have have an idea


if analyze use protocol is hard

Why we don't consider as a signal source

by another world there is many Digital logic analyzer in the internet based on FPGA


like this Great one












so we could analyze the signal from D+ and D-

then process it inside FPGA to run the Laser Diode to Generate the Pulse Light Beam


i forget some thing


DSlogic based on Spartan 6


Papilio Pro FPGA also Based on Spartan 6


so i thing there is no problem to make the Papilio Analyze the Signal as Logic Analyzer...or you what to say some thing




what about this sir

Link to comment
Share on other sites

>> I was thinking it's easy to learn FPGA and then make your idea real by using it


It is not. It is 1000x harder than it looks.

You would use a "virtual com port", send serial data from PC to FPGA. This is relatively easy. Even easier, implement a pseudorandom generator to create the data.


But, sorry for being direct, you're totally in over your head.


Proposal: Why don't you buy some cheap low-end FPGA board. Papilio is fine, so is any other, just don't try to anticipate what you think you need.

What you really need is one LED and two months hard work. Learn to make it blink, control it through the PC (USB-serial port and UART). When you can do that, you'll be in a much better position to judge the task at hand. It would be realistic for an experienced engineer but not if you're starting from square one.


PS you don't actually have to buy it, just get the design tools and learn to use them (and get used to simulate: Hardware just tells you "it doesn't work". Not "why").

The tools are neither beginner- nor user friendly, takes a lot of patience.

Link to comment
Share on other sites

I have often thought about a USB 1.0 stack (12Mb/s), based on the virtual USB HID for Arduino that you can set up with a couple of Zeners and a few resistors (


However, even that is too hard for me to comtemplate moving to a FPGA, - every time I start to attempt it I feel like I am pounding my head against a brick wall.

Link to comment
Share on other sites

offroad thnk you for posting

you said the truth but your comment made ​​me desperate :D


hamster thank you for posting


i dont thing arduino have the ability to send data in speed up to 12Mb/s

also this tutorial show how to connect device have usb port to arduino not to use usb data signal or analyze it because arduino have just Atmel Microcontroller 16 Mhz

that's all

Link to comment
Share on other sites

You should maybe discuss this project with a university supervisor, set up some realistic targets and put you on the right track with the "architecture".


Generating a 12 Mbit/s signal is trivial, simply put it onto a block ram.

It can be as simple as the following (this is quick-and-dirty, haven't actually compiled it)


module myPatternGenerator(input wire clk, output reg outPos, output reg outNeg);

reg [255:0] sequence = 256'b01001001010110111011...;

always @(posedge clk) begin

outPos <= sequence[255];

outNeg <= !sequence[255];

sequence <= {sequence[254:0], sequence[255]};




I'd expect clk can go up to maybe 170 MHz, higher with careful coding. You can generate it inside the FPGA from the oscillator on the FPGA board.

Then delay it by a variable amount inside the FPGA. Analyze synchronously within the same circuit, and here it starts to get interesting.


You can test this with a simulator, i.e. "iverilog" and "gtkwave", if you like. Or use "isim" that comes with the Xilinx tools.

Link to comment
Share on other sites



what FPGA board you suggest to me to start

there is


Nexys 3

Nexys 4

Papilio Pro

Papilio Duo(im waiting this Board)

Altera DE1

Altera DE1-Soc


every one i asked him about xilinx he toold me there is no enough materials and help file on the internet as like altera

also xilinx forum not like Altera Forum is better thousands time and i try that by myself


its really hard to choice

i dont want Spartan 3e its old and don't support matlab

Link to comment
Share on other sites

>> its really hard to choice

that's why I'm saying it doesn't matter as long as it's cheap (you don't want to accidentally destroy a 3000$ board while learning to blink a LED). Consider it a write-off. If you don't give up, it will be the most important 100 bucks you have ever spent, career-wise.


Papilio Pro is my personal favorite, cheap, easy to deal with (papilio loader) and you won't get ripped off on shipping. But this is the Papilio forum, after all.

Again, don't try to anticipate what you think you need. There's a whole industry thriving on fools who do this, the mission being "squeeze the most money out of them before they invariably give up. Many (most?) do.

For example, after realizing that "comes with a free design kit CD" is not the same as "comes with a license to use it". Oops. Sorry, that's another USD 3k. Per year. And it won't let you use much of the FPGA's functionality like DRAM controller, needs more licenses.

That's one reason why I'm suggesting you get some support from the school or you'll be learning all this the hard way.

Link to comment
Share on other sites

last what i do is sending email to Benjamin David Lunt asking him to read this thread trying to help me
this man have great website and tutorials about FPGA and Microcontroller also programming with USB Interface and use it in electronic projects

i got his answer and i thing that's enough to me
i will try to do it by myself from scratch
thank you very much Ben for your answer
and thanks for every one post trying to help me

admin please close the thread

the answer from BEN :-

First let me say that I congratulate you on your desire to
build this project.
After reading the replies in the links you sent me, and not
knowing what kind of background and experience you have with
electronics, I might have to agree with some of the replies
when they say "start smaller".  A blinking LED is a pretty
easy project once you get started and learn a bit.
However, if I was going to create a communications device
between two PC's, 100 meters apart, using fiber optic cable,
I would start with a device at both ends, similar as you
see in the .pdf file above.
Each device would allow you to send and receive data to
and from the device using a low- or full-speed USB port
on the PC.
Then I would use the ATTiny2313 to send bits (flashes of light)
across the fiber optic wire.
However, you will have to write software (firmware) for the
2313 to send start, stop, and parity bit information, just
like the old time serial ports do.
This would also be considerably slow, maybe 8 megabits per second,
since the 2313 runs at about 16500000 Khz (or 16.5Mhz).  (Normal
USB communication is 12Mhz, for low speed devices such as the
one listed above)
However, this would accomplish the task you are trying to do, though
considerably slow.
You would also have to have an external power supply for the sending
and receiving diodes, (each device having one of each).  The USB's
5.0 volts, 500milliamps most likely will not power them.
Here is my suggestion, and please take it as one guy who learned
hands on just as explained above, to another with all due respect
and admiration for your desire to learn.
1. Buy a cheap bread board, something similar to
2. Buy all the components described on page three of
  (minus the break out board (line 2)).
3. Assemble the three projects described in that appendix.
Once you have a good knowledge of what they do and how they do it,
I think you could go quite far creating a device to send and receive
data across a fiber optic wire.
You will need to realize, though, that it would be considerably slow,
and maybe even unreliable, though if you are simply doing it for the
task, then by all means, do it.
Now, there are a few other questions you had, that I will try to answer.
You want to be able to grab the data from D+ and D- and simply send
a 1 or 0 bit along the optic depending on the values D+ and D- are.
This will not work.  The USB must have an ACKnowledge that you received
the data, etc.  You can not simply monitor D+ and D-.  The USB will
expect bytes in return after each packet is sent, using these two
Second, by sending the commands explained in the AppendixQ .pdf listed
above, you will see that you can bring high one of the pins of the
2313, maybe hooking it to pin 7 of your "transmitter" as you explain
in your post(s), keeping in mind the amount of current supplied by
the 2313 will be less than 500milli-amps.  Therefore, you may need
an external power supply and a "relay" (a transistor?).
I hope that I have been of some help to you.

Link to comment
Share on other sites

well, to send a signal through USB and a fiber optic cable, you can even take a simple USB-to-serial chip:

then a LED on one end and a photodiode at the other end, going into a 2nd USB-to-serial chip (or even into the receiver section of the same chip).

There is no need for microcontrollers, FPGAs etc.

But this won't earn you any credits in a computer science course, it's just basic electronics tinkering. And no, driving fiber optics with a simple UART is not how it's done in real life even if the bits will go through just fine if you lowpass filter the detector to 0.01 % of its designed bandwidth.

Link to comment
Share on other sites

offroad good to see you post again


you are right about using USB to URAT for Building but it will be slow


now im thinking in idea more scientific than fiber optic idea




i want to ask you about Papilio Duo in any time it will be relased

Link to comment
Share on other sites

USB host is hard because its a very complicated protocol you need to speak and the timings are tricky. USB slave is fair bit simpler, at least at the lower speeds.


Simply using the USB connector is also not necessarily easy because on most FPGA boards it isn't wired to the FPGA directly in a useful fashion.


The other problem for board choice and software is that Haider is in Iraq, and a lot of FPGA devices and software are on the controlled lists so export rules may be a problem (especially as the US enforces them its end with the 'shock and awe' scheme).


Hamster: I assume you've seen, which only needs a UTMI buffer ?



Link to comment
Share on other sites

Mr. alan thank you very much :wub:


i want to ask about Papilio Pro

Does this board support matlab (system generaor)


and does it have MicroBlaze Processor


because i have another idea about using FPGA in Graduate project  :D 


and i want to use matlab


i think Papilio is enough if its support matlab like Xilinx Atlys or Nexus 4



my regards :)

Link to comment
Share on other sites

  • 4 months later...

Oh my God

Don't make FPGA a monster...

Let's to think about implementing an FFT inside an FPGA then

Building 3D LED cube and finally mix them together to have

A 3D equalizer that can show sound harmonics via several

Fantastic patterns in 3D LED cube just like

Media player...

Well what is your idea?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.