USB Debugging Tips

about | archive


[ 2004-February-01 16:20 ]

I have developed a few USB devices. First, my fourth year design project as part of my degree in Computer Engineering at the University of Waterloo was a USB Oscilloscope. It was built using an Altera Excalibur FPGA development board and the OpenCores USB1.1 IP Core. My second USB device is a Super Nintendo controller USB adapter, currently under development. Here is a collection of tips that I have on debugging USB devices.

  1. Get an established reference design working first. The USB descriptors are complex and easy to screw up. Do not modify them until you have the PC recognizing the device correctly.
  2. The USB specification is your friend. It is massive, but it contains everything you really need.
  3. Use Linux. The information that is generated by the Linux kernel with the USB debugging option enabled is very useful. It will report that it thinks a device is connected and will dump parts of the descriptors. I don't even know how to get this information from Windows.
  4. Use libusb to avoid writing a device driver. Libusb is a user space USB library. It only supports bulk reads and writes, but provides a straightforward interface. It sure beats writing a driver for simple devices. There is a Windows port as well, but I didn't have much success with a very early version.
  5. Prototype your descriptors and your device using an easy device, like Cypress's EZ-USB. You can hack an existing device and download different firmware to it. It provides a very nice development environment.
  6. Use HID Explorer to view your HID device report descriptor, as seen by your Mac OS X machine.