FPGA <=> USB

How's fpga4fun working for you?

FPGA <=> USB

Postby martin » Wed Jan 07, 2004 8:22 pm

Hello...
First sorry for my poor English!

I start to make a board with an FPGA and an USB interface:
FPGA: Xilinx XC4010E (very old device)
USB: FTDI FT8U245AM (http://www.ftdichip.com/index.html)
I choose this component because the driver is already made. You have just to download it from FTDI site and it is free.
Software: Labview for the software connection between the dll driver of the USB chip and the graphical user interface (GUI).

I just want to tell you that is very easy with this chip to connect a PC to FPGA by USB.

I don't know Verilog or VHDL, i maked my design with schematic (Xilinx Foundation 1.5).
Could you, if you are interested, just see the possibilities to design the interface between the FPGA and the USB chip in Verilog or VHDL language ?
I think it is usefull to have a connection with the USB port of PC for people that like to have fun with FPGA.

Thank you.
martin
 
Posts: 1
Joined: Wed Jan 07, 2004 7:48 pm
Location: France

Postby spacecap » Sat Mar 27, 2004 5:21 pm

Next is also a link to a implementation of a USB to FPGA board with this chip.

http://www.ftdichip.com/FT2232C2.htm
http://www.morph-ic.com/index.html

With this FT2232 chip it could be also a good start to a interface.

If you get a really small USB=>JTAG interface near the size of a standard JTAG connector plus a mini USB connector, then I am interested!

Regards
spacecap
spacecap
 
Posts: 1
Joined: Sat Mar 27, 2004 5:08 pm

Postby fpga4fun » Sat Mar 27, 2004 6:31 pm

I believe the FTDI is the simplest way to get USB going. I didn't try it because I use Cypress chips - they sell for about the same price but are more powerful :-) and also more complicated to get working :-(

For the price, they could have used a bigger FPGA. Dragon costs $25 extra and is much more powerful.
Anyway, the idea of making a tiny FPGA board with a mini-USB is good. Anyone knows where can we buy these mini-USB connectors/cables?
fpga4fun
Site Admin
 
Posts: 837
Joined: Thu Sep 18, 2003 6:47 am

Postby geekything » Sun Mar 28, 2004 11:22 pm

http://www.digikey.com/scripts/DkSearch ... 83&Site=US

Obviously a little expensive for production, but quick and easy to get for prototyping or small production runs :-)

-marc
geekything
 
Posts: 31
Joined: Wed Mar 17, 2004 12:52 am
Location: Deepest, darkest Toronto

Postby fpga4fun » Sun Mar 28, 2004 11:39 pm

digikey is not known to have the best prices, but they do have the best selection.
I looked for the mini-USB cables and they are not cheap. Anyway I'll keep my eyes open.
fpga4fun
Site Admin
 
Posts: 837
Joined: Thu Sep 18, 2003 6:47 am

Postby haiqu » Wed Apr 07, 2004 4:18 pm

haiqu
 
Posts: 11
Joined: Wed Apr 07, 2004 4:16 pm

Postby fpga4fun » Wed Apr 07, 2004 7:10 pm

Yes, here's why we need mini-USB with tiny boards:
http://www.dontronics.com/graphics/245da.jpg
Last edited by fpga4fun on Fri Sep 21, 2007 5:22 am, edited 1 time in total.
fpga4fun
Site Admin
 
Posts: 837
Joined: Thu Sep 18, 2003 6:47 am

mini USB connectors

Postby csavery » Mon May 24, 2004 3:43 am

Hello,

I bought some mini USB connectors (thereare several different kinds being used by diferetn camera cos) from a place in Taiwan for a very good price. They have a web site for bulk sales but they are very good with samples - small qty excellent prices. The site is www.4uconnectors.com. I ordered and had them a week later by regular air mail. I wish all places would offer air mail instead of forcing high cost couriers upon you. Anyway, they have tons of connectors at the best prices I've ever seen.

I'm working on a fpga / usb project and needed them for this. I'm using the TUSB3210 from ti as my usb i/o as it's very cheap (even from Digikey) and has lots of i/o and good 8051 support everywhere. There's also a guy out there who wrote a free sample TUSB3210 usb driver for windows and I plan to adapt that to give me a custom usb interface. Can't remember the site for that free driver but if you're interested then I'll get it.

Chris :)
csavery
 
Posts: 5
Joined: Mon May 24, 2004 3:34 am
Location: Thailand

Postby fpga4fun » Mon May 24, 2004 4:08 am

I think it's http://www.4uconnector.com/ (no s)
Looks like they do have lots of things, thanks for the link.

The TUSB3210 looks similar to the AN2131SC that I'm using. I'm surprised TI doesn't provide a driver for it though. Sure, please post the driver info once you find it.
fpga4fun
Site Admin
 
Posts: 837
Joined: Thu Sep 18, 2003 6:47 am

Driver, will do

Postby csavery » Sat May 29, 2004 3:01 pm

Ok. I'll go fetch it. It's not where I'm typing today. The guy wrote a simple encryption device to run in the TUSB3210 as an exmple project. You send data to the device by usb and it encrypts it and sends it back. Nothing fancy but it served the purpose as an exmple driver on the windows side. I looked through his code and it was easy enough to follow so I figured I'd adapt it to my own device quite easily.

My real background is software and I worked for over 10 years as a systems software engineer in Canada before quitting the fast life and moving to Thailand (where I am right now). Now I'm getting back into my first love, which was electronics, and I'm building up the tool set to put together some new projects and eventually some neat productcs perhaps.

Oh, well I just googled it and found the info...

check out www.goldenbits.com

he has an article that posted in Dr. Dobbs and he reposts it on his site. The link to the smaple driver is Magazine

www.goldenbits.com/newsletter/issue2/usbsample.zip.

Maybe it'll be useful not only for the TUSB but for any USB device (I would expect).

Philips makes some cheap usb transeivers and if you implemented a usb SIE to handle the data and crc part then hooking one of those to an fpga would be a great low cost usb option.

On the ethernet end I see everywhere these huge 100 pin chips just to do 2 differential signals on the wire. I can't figure out why there isn't a simple 8 pin xcvr chip to do that and then, as you did, handle the data in the fpga. I'd like to see something like that as then the signals would be more compliant. I tried downloading the 802.3 spec but at the time the site was broken and it wouldn't download. Will have to try again soon...

BTW they have some pretty cheap (price, not materials) development boards here in Thailand for the Altera and Xilinx fpgas. I bought one for 1000 baht ($25) that has leds and power adapter, and 2-7 seg displays (what on earth for) and a jtag cable (well a cable with with the chips on the board), and switches and other stuff BUT a Thai user manual (which I can't read and doesn't look much use). This one was for a 9572 CPLD but they also had some for the XC2S15 and 30 fpgas that were much the same and only a wee bit more. I bought this one because I wanted the ISE software and didn't want to download it or pay for the Xilinx shipping charge to here... played with the board as a bonus. There's a place here that makes circuit boards in a couple days for 6 baht per sq inch, single units qty. They can't do fine designs but they pump out tons of audio boards for the local guys who seem to be nuts about audio stuff and not digital at all.

I talk too much...

Cheers,
Chris :)
csavery
 
Posts: 5
Joined: Mon May 24, 2004 3:34 am
Location: Thailand

Cypress USB and FPGA

Postby rleitner » Mon Oct 04, 2004 7:16 am

Hy,
...I have read the thread below, and have a question about the Cypress chips.
For my application I use an Altera Stratix Board (Microtronix) with an Cypresschip (SL811HST), and as you said it is more complicated to get it working. :cry:
I would like to use windows and Labview, but I can't find a Windowsdriver for the Chip. Can you give me any Tips how to make the USBChip working?


fpga4fun wrote:I believe the FTDI is the simplest way to get USB going. I didn't try it because I use Cypress chips - they sell for about the same price but are more powerful :-) and also more complicated to get working :-(
rleitner
 
Posts: 4
Joined: Fri Sep 24, 2004 9:51 am

Postby fpga4fun » Mon Oct 04, 2004 10:02 pm

I'd go after Microtronix or Cypress to get a driver...
fpga4fun
Site Admin
 
Posts: 837
Joined: Thu Sep 18, 2003 6:47 am

Postby rleitner » Fri Nov 26, 2004 2:09 pm

Hy again,

I wrote a VHDL-Statemachine for the communication between the FPGA and the Cypress SL811. I meet all the timings from the SL811-manual.
But when i connect the System via USB to an WinXP-Pc and reset it (to initialize it, and start data transfer), nothing happen.
Windows doesnot recognize the new hardware.
I am not sure I set all the registers correct, can you please help me to find the mistake.
After the Reset (i meet the timings on page 26 of the manual) i write the init-Data to the registers.
after the ARM, i write data to the buffer of the SL811 (starting at 0x10) with auto-increment-address-mode. (i also meet the timing there). when finished, i send again the ARM Signal (0x07 to adress 0x00).

Init-Data:
Adress Value
0x01 0x10 set bufferadress to 0x10
0x02 0x08 set transactionlenth to 8 byte
0x03 0xD0 (11010000) SETUP-PID
0x04 0x01 Adress = 1
0x06 0x73 (01110011) device detect interrupt, slave inserted, sof-Timer, USB-A,B
0x00 0x07 ARM, Enable, transmittion to host

I communicate with an PC which has USB2.0 so i dont need reg.0x05 (only the first bit maybe? enable Hardware SOF?)
I guess Reg. 0xFH is also not important for me, it is only to make a specific SOF.

I have to tell the SL811 how many bytes i would like to send, but when? Before or after i filled the buffer?

In register 0x03 do I have to follow the sequenz? ( 1. Setup, 2.IN 3. OUT,..)
Well ,after the reset, i would net to follow another sequenz : setup, preamble, SOF, out (when sending data to the PC) and Data0

Is it right, that when i connect the SL811 (as an host) to a PC , the pc will allocate an adress to the Sl811 ,
or is the adress fixed, (so i have to write the adress to the reg. 0x04) ?

Do i have to send preamble and SOF everytime before i start a transittion in the Register 0x03?

I am very gratefull for every help regarding the registers.
rleitner
 
Posts: 4
Joined: Fri Sep 24, 2004 9:51 am

Postby tkbits » Sat Nov 27, 2004 8:17 am

I hate to say this, but USB devices connect to the PC as slaves, not hosts.

When sending data, you must set up both the data buffer and length BEFORE arming.
tkbits
 
Posts: 114
Joined: Mon Aug 02, 2004 10:36 pm

Postby rleitner » Mon Dec 13, 2004 4:14 pm

tkbits wrote:I hate to say this, but USB devices connect to the PC as slaves, not hosts.


Ok, that is a good point. :) Thank you!!

Now I changed the Initial Data reffering to the Datasheet for the SL811S/T
(when you use the SL811HST as Slave you should use the SL811S Datasheet. (SL811HST-manual page 5)).
I hope that this is correct, but i don't understand why the registerspace depends on the function (slave or host) of the chip. (if you compare the SL811HST and the SL811S/T data-sheet, there a big differences in the registerspaces).

The new initials are:
I set up the chip as slave : value 0x00 at Reg 0x0F.
disable Interupt enable : 0x00 0x06
set usb-address to 0 : 0x00 0x07
set EP0 bufferaddress to 0x40 : 0x40 0x01
EP0 bufferlenght to 0x40 : 0x40 0x02
enable, arm EP0 : 0x03 0x00
set EP1 bufferaddress to 0x80 : 0x80 0x11
EP1 bufferlenght to 0x40 : 0x40 0x12
enable, arm EP1 : 0x03 0x10

when i now connect the Board via USB to the PC I get a message:
"One of the USB devices attached to the computer has malfunctioned, and Windows does not recognize it. "
Windows recognizes it as an 'unknown Device' and doesnot install a driver for it.

Has anyone an idea what Settings are necessary that windows finds the chip and can install a standart USB-HID-driver?

Why i set up EP0 and EP1?
I have read that EP0 is the default pipe for Controltransfer from the host. So i want to use EP1 to transfer the data to the pc.
I guess the procedure works like this: fill buffer of EP1 with the data, Set the lenght of the data, then ARM the EP1 with the correct dataset and direction. Please tell me if that is wrong.
I would like to transfer the data in bulk mode, but I don't know how to tell the SL811 that. (I guess the host decides the mode of the transfer).

Do you have a advice for me if i am on the right way?
Thank you very much.
rleitner
 
Posts: 4
Joined: Fri Sep 24, 2004 9:51 am

Postby tkbits » Tue Dec 14, 2004 3:23 pm

You will receive commands via EP0 from the PC as SETUP packets.

You need to provide descriptors in response to the GET_DESCRIPTOR command. There will be a request for a Device Descriptor and a Configuration Descriptor. The request for a Configuration Descriptor will actually require you to transfer an entire group of descriptors. If the group of descriptors include HID descriptors, then there will also be a request for a Report Descriptor. There may be requests for String Descriptors even if you specify 0 for all your string IDs in the other descriptors.

The descriptors tell your PC what your device is, what endpoints it will provide, and what kind of transfer each endpoint will use. You may want to start with some sample mouse or keyboard descriptors. Or you can probably use the descriptors provided by John Hyde or Jan Axelson for each of their USB books.

You need to respond to the SET_ADDRESS command and set the device to the new address. (Some chips do this for you.)

You need to respond (very simple) to the SET_CONFIGURATION command to signal that your device has been activated.
tkbits
 
Posts: 114
Joined: Mon Aug 02, 2004 10:36 pm


Return to Comments