Forum Discussion
Altera_Forum
Honored Contributor
14 years agoFast & Large block data transfer over USB - DE1/DE2 ?
Hi I have a DE1 fpga module, which has a single USB port that seems to be dedicated to programming. Is it possible to use it to do fast, large block data transfers over the USB ?
I see quite a bit of discussion here in a similar vein, but do not see anything conclusive. I see the USB is connected to an FTDI FT245BL - this should be capable of 1M Byte / Sec, using their D2XX Drivers. It is then connected to an Altera MAX chip. Previous fpga modules that I have used with FTDI chips have been able to use the USB port for both programming and for data transfer. Or am I better to junk the DE1 board and buy a DE2 which I see has a second USB port ? cheers, Beau54 Replies
- Altera_Forum
Honored Contributor
The USB-Blaster circuit is a FT245BM and a CPLD.
The host communicates with the USB-Blaster via a protocol described here: http://sourceforge.net/apps/mediawiki/urjtag/index.php?title=cable_altera_usb-blaster The parallel output data from the FT245BM FIFO is serialized by the CPLD to drive the JTAG pins on the attached FPGA. The highest performance mode will be when the packets are 'byte-mode' packets, where each byte from the host generates 8-bits of of JTAG TDI activity. I haven't got performance measurements yet, but the best data rate will be 1MB/s divided by 8, or about 1Mbps. Under Linux, using the FTD2XX direct access drivers, you can add the VID/PID of the USB-Blaster, and then access the device. The direct access API functions for adding a custom VID/PID do not exist under Windows, so I'm not sure what the solution is there (probably edit an .inf file). Cheers, Dave - Altera_Forum
Honored Contributor
Ah, that is very helpful, thanks.
I will have a careful read, and hope to report on how I get on. Yes I am sort of familiar with .inf editing, but may have to go to an XP machine - a Windows 7 (64bit) machine like my laptop will only install the certified drivers. - Altera_Forum
Honored Contributor
--- Quote Start --- I will have a careful read, and hope to report on how I get on. --- Quote End --- Great! --- Quote Start --- Yes I am sort of familiar with .inf editing, but may have to go to an XP machine - a Windows 7 (64bit) machine like my laptop will only install the certified drivers. --- Quote End --- Huh? The FTDI drivers and DLL install fine under Windows. Its getting it to allow the DLL to access the USB-Blaster that I'm not sure how to do, given that the add VID/PID DLL call does not exist under Windows. A pretty simple solution is to use FT_PROG to capture the EEPROM settings from your USB-Blaster, and then erase the EEPROM. Then your USB-Blaster will appear as an FT245BM device, and you can access it using the DLLs directly (since the VID/PID will be FTDI). Cheers, Dave - Altera_Forum
Honored Contributor
--- Quote Start --- Great! Huh? The FTDI drivers and DLL install fine under Windows. Its getting it to allow the DLL to access the USB-Blaster that I'm not sure how to do, given that the add VID/PID DLL call does not exist under Windows. --- Quote End --- Yes, that is sort of what I meant - yes the drivers and dll work great, but I can only load devices with different PIDs in XP, in Windows 7 I have to change the PIDS back to the standard value. But the ftdi dll seems to be able to access the usb blaster fine : ftlstndev 1 ftgetdescriptions USB-Blaster ftopen 0 FTDI USB device 0 opened, Handle : 40973760 40973760 But now I am not sure what will happen to any data I write to the handle .... ftclose 40973760 0 --- Quote Start --- A pretty simple solution is to use FT_PROG to capture the EEPROM settings from your USB-Blaster, and then erase the EEPROM. Then your USB-Blaster will appear as an FT245BM device, and you can access it using the DLLs directly (since the VID/PID will be FTDI). --- Quote End --- Scary, but that sounds good. I have had no problems using the EEPROM erase and write to-date. Do I then have just an 8-bit port in effect ? I will read up the info you pointed me to. Thanks! - Altera_Forum
Honored Contributor
--- Quote Start --- But the ftdi dll seems to be able to access the usb blaster fine : ftlstndev 1 ftgetdescriptions USB-Blaster ftopen 0 FTDI USB device 0 opened, Handle : 40973760 40973760 --- Quote End --- Great. I haven't tried accessing a USB-Blaster under windows. --- Quote Start --- But now I am not sure what will happen to any data I write to the handle --- Quote End --- Write some test code; a) Toggle TCK, while keeping all other bits high, so according to the protocol: 0011_1111 b /* bit mode, don't read-back, OE + TDI + CS# + CE# + TCK high */ 0011_1110 b /* drop TCK low */ So fill a write buffer with 3-bytes, i.e., 3Fh, 3Eh, 3Fh, and write it to the USB-Blaster. Probe the TCK pin and you will see a ~1us low pulse on TCK. Viola, you now have control of your USB-Blaster! Cheers, Dave - Altera_Forum
Honored Contributor
Thanks for being so very precise, I can do that, but maybe not until tomorrow !
- Altera_Forum
Honored Contributor
--- Quote Start --- Thanks for being so very precise, I can do that, but maybe not until tomorrow ! --- Quote End --- If you're running Linux, then you can use Wireshark to monitor the USB-Blaster transactions. Cheers, Dave - Altera_Forum
Honored Contributor
I used to have wireshark for windows - did not realise it worked on the usb as well - perhaps just what I need for a related I/O problem I am having doing the same on a Morphic II board.
- Altera_Forum
Honored Contributor
--- Quote Start --- I used to have wireshark for windows - did not realise it worked on the usb as well - perhaps just what I need for a related I/O problem I am having doing the same on a Morphic II board. --- Quote End --- Wireshark only supports USB sniffing under Linux. I tried both the latest version of VMWare (workstation 7.1) and VirtualBox, and neither could capture the USB-Blaster to sniff from Linux in a VM. I installed Ubuntu 11.04 (Wubi - binary blob on the windows partition), and it works great. I was also doing some testing with a Morph-IC (the older ACEX 1K device). Cheers, Dave - Altera_Forum
Honored Contributor
Apart from being able to access the USB Blaster through ftd2xx.dll, how do you want connect to the FPGA on the DE1/DE2 side?
Did you notice, that DE1 and DE2 implement a second set of software JTAG lines between the embedded USB-Blaster CPLD and the FPGA? The interface is used in the DEx_USB_API demonstration for data transfer from and to the Control Panel application. Alternatively, you have communication options based on the VJTAG channel, e.g. the JTAG UART.