May 13
Review of Bitwise System’s QuickUSB 2.0 Module
I’ve been working on a project for about a year which requires a high speed digital data link between a GUI (running on a generic windows computer) and an Altera Cyclone II FPGA. I wanted to implement this link with a high-speed USB 2.0 connection, a hardware task I was sure I could undertake. However, I didn’t want to spend a whole lot of time writing windows USB drivers and implementing the USB standard in an FPGA. Enter the Bitwise Systems QuickUSB 2.0 Module.
The module is available for $150 and offers a wealth of features. The module implements a high-speed USB 2.0 connection using the Cypress EZ-USB FX2LP microcontroller. The microcontroller provides a 16-bit bi-directional data port synchronized to an onboard 48MHz clock. An optional auto-incrementing address bus is also available. This makes it extremely easy to connect the QuickUSB module to a RAM block in an FPGA for simple data transfers. Additionally, the pins on the Cypress microcontroller which are not used for the data bus can be configured on a pin-by-pin basis as basic I/O.
The two most important features which separated the QuickUSB from other solutions during the planning stages of the project were the availability of a complete programming API and the ability to program an Altera FPGA using passive serial. The programming API (when the project was started, and I believe this is still accurate) is available for the windows platform in C (as well as other languages in the documentation), but I was interested in creating a graphical user interface in C#. While the QuickUSB API I used was written in C, I was able to marshal just about all of the functions available in the library into managed C# code. Three examples of how this works are given below. I’m not a great programmer, but I had some help from a friend.
//extern int WINAPI QuickUsbOpen( HANDLE *hDevice, char *deviceName ); [DllImport("QuickUsb.dll", EntryPoint = "QuickUsbOpen", ExactSpelling = false)] internal static extern int QuickUsbOpen( out IntPtr hDevice, [MarshalAs(UnmanagedType.LPArray)] Byte[] devName ); //extern int WINAPI QuickUsbClose( HANDLE hDevice ); [DllImport("QuickUsb.dll", EntryPoint = "QuickUsbClose", ExactSpelling = false)] internal static extern int QuickUsbClose( IntPtr hDevice ); //extern int WINAPI QuickUsbReadData( HANDLE hDevice, unsigned char *data, unsigned long *length ); [DllImport("QuickUsb.dll", EntryPoint = "QuickUsbReadData", ExactSpelling = false)] internal static extern int QuickUsbReadData( IntPtr hDevice, [MarshalAs(UnmanagedType.LPArray)] UInt16[] data, [MarshalAs(UnmanagedType.LPArray)] UInt32[] length );
By creating a wrapper for the QuickUSB library, I was able to write a C# GUI for my application in managed code. On the other end of the USB cable, I used Altium Designer to lay out a printed circuit board with an Altera Cyclone II FPGA and the connector required for the QuickUSB module. A footprint and schematic library are available from Bitwise Systems to simplify this process. The finished PCB with and without the module is show below.
Using this setup, I was able to easily implement some RAM blocks in the FPGA which I could read from and write data to in a very convenient manner. Using the library in managed code also works flawlessly with no detectable loss of functionality. After playing with this thing for a couple of months, I’ve come up with the following lists of Pros and Cons which I believe are fairly important.
Pros:
- The QuickUSB module contains all the hardware necessary to implement the high speed USB 2.0 link in a small, complete package.
- All of the analog layout required for the USB link is already done for you.
- All of the embedded programming in the Cypress microcontroller needed to implement the USB endpoints and 2.0 specification is already done.
- The library is easy to use and can be ported to managed code for .NET 2.0
- Bitwise Systems provides a schematic and footprint library for a few different types of PCB layout software simplifying host board design.
- The ability to program Altera and Xilinx FPGAs over USB is a great feature.
- No windows USB l33t driver writing skills are required.
Cons:
- It costs $150, which could be prohibitively expensive for hobbyists.
- The library implements minimal error reporting. Basically, it either worked or it didn’t.
- This one was a big one for me: If the computer is hibernated, on return from hibernation, the QuickUSB device would have to be physically unplugged and plugged back in for it to work.
If you can afford the $150 pricetag, the module really does work as advertised. It is capable of extremely high data transfer speeds (in a quick test, I was measuring about 20MB/s just transferring a counter value from the FPGA as quickly as possible), and the general purpose I/O pins which are controllable over USB are also very useful. The ability to program an FPGA over USB means you don’t necessarily have to include eeprom on your PCB for RAM-based FPGAs if you don’t want to. A tough one for me was the hibernation issue though. My project is battery-powered and relies on putting the computer into hibernation. I found that if I could unload all classes which used the QuickUSB library, I could programatically disable the device in the windows hardware device manager, and then reenable the device upon return from hibernation. This is a major pain in the neck though, and shouldn’t be necessary since just about every USB device I’ve ever owned works just fine after hibernation. Hopefully they’ll release an update to their library and everything will just work in the future.
7 comments7 Comments so far
Leave a comment
![[del.icio.us]](http://www.electrosizzle.com/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.electrosizzle.com/wp-content/plugins/bookmarkify/digg.png)
![[Facebook]](http://www.electrosizzle.com/wp-content/plugins/bookmarkify/facebook.png)
![[Furl]](http://www.electrosizzle.com/wp-content/plugins/bookmarkify/furl.png)
![[Google]](http://www.electrosizzle.com/wp-content/plugins/bookmarkify/google.png)
![[Slashdot]](http://www.electrosizzle.com/wp-content/plugins/bookmarkify/slashdot.png)
![[Technorati]](http://www.electrosizzle.com/wp-content/plugins/bookmarkify/technorati.png)
![[Yahoo!]](http://www.electrosizzle.com/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.electrosizzle.com/wp-content/plugins/bookmarkify/email.png)

Hi E. Sizzle,
Out of curiosity, did you implement your project with QuickUSB module in master FIFO mode or in slave FIFO mode? If you are did it with master mode, how is your data rate? I hope you don’t mind me asking because I am also implementing a similar project. Thanks.
Shan
Hi Shan,
I ended up going with the Simple I/O Model. Since I was only writing data to and from RAM blocks in the FPGA with a fixed address space, not FIFOs particularly, I found this to be the easiest to implement. In testing, I achieved read speeds (from FPGA RAM to the computer) of anywhere from 11 to 20 MB/s, but it’s difficult to tell whether the bottleneck was the device or my computer. Good luck!
TheSizzle
Hi Sizzle,
That sounds almost like my project speed (15MB/S tops). Thanks!
Shan
Hi Sizzle,
I am having a bit of trouble implementing the writing part of the Simple I/O model of QuickUSB. It seems like either WEN(the writing enable signal) is either not turned on, or maybe my FIFO block is messed up that nothing is being written to them. Reading, on the other hand, seems fine. Would you mind share some opinion on this problem? Because it seems really hard to debug the writing part… (cannot really write them to a text file anymore
) Thanks in advance!
Shan
Shan,
It’s hard to say what could be causing that kind of behavior. I would first check the physical connection between the pins. Then, I would use what ever tool your FPGA manufacturer provides to look at the digital logic. Altera has the SignalTap II embedded logic analyzer while Xilinx has the ChipScope analyzer.
Also, I’m assuming that you’ve configured those data pins as Input/Output pins with some sort of tri-state buffer whose direction is chosen by whether or not the the REN or WEN pins are active. Obviously, if the data pins on the FPGA are configured as outputs always, you’ll be able to read and not write. Good luck!
TheSizzle
Hello there!
I would like to know whether it can be used apart from it quickdriver and api. I want to usb it with the cypress driver cyusb!
Thanks
Faisal,
I’m not really sure. I don’t even know if Bitwise supports this product anymore. Probably a question best left to them.