Learning The Ins And Outs Of USB With A Simple Dev Board

We can’t count the number of projects we’ve seen on Hackaday with a USB port.  Unfortunately, most of these builds – from RepRap controllers to wireless data loggers – don’t use the full capabilities offered to them with USB. [Ben] came up with a very cool USB breakout board that allows you to explore the USB protocol with just a single inexpensive ATtiny.

Instead of relying on an FTDI chip or otherwise sending serial data down a USB pipe, [Ben]’s project is meant to be the hardware compliment to his book on programming USB devices. His hardware board is exceedingly simple, just an ATtiny 2313, a USB port, and a handful of other components, but allows [Ben] to receive data on eight pins on a breadboard and send them over USB to a computer.

[Ben] had sent in his USB figure eight controller, a board that displays the numbers 0 through 9 according to what data is received via USB, a while ago. It’s a truly useless build aside from learning how USB works, but an excellent tool if you’d like to program your own USB device.

17 thoughts on “Learning The Ins And Outs Of USB With A Simple Dev Board

      1. “ordered” a linear 5v -> 3.3v voltage regulator ???

        you DO know that those are litterally in EVERYTHING from outdated video cards to VCR power-supplies???
        … which makes them free… (NOT a special-order part)

        lol @ “not available where i live”
        then how the heck did you type that post??? if you typed it, its available in the garbage, ready for de-soldering.

      2. just bought a used laptop today, the fastest used laptop that has a HARDWARE serial port and a HARDWARE parallel port… and its still fast enough to do what i need it to do! :)

        suckers!
        have fun with USB, while i demo my cool projects to the world, you sit in the corner stealing VID/PID pairs and dreaming of ways to actually make use of what was supposeed to be a seamless replacement to “ports”. HA

        PS: i did NOT purchase it to play games, i already have a laptop and desktop for that…
        its for work/programming/getting it done INSTANTLY, without days of USB debugging and driver mucking-about.

      1. It depends on what you intend to learn about USB. With VUSB, you’re limited to only low speed 1.5 Mbit/sec, which is limited to only control and interrupt transfers. Some operating systems allow you to use bulk protocol (eg, for CDC Serial), but especially modern versions of Windows are now enforcing the USB spec, which forbids those 2 transfer types at 1.5 Mbit/sec.

        Even if the OS lets you violate the spec, the host controller chip in your PC agressively polls, with the assumption you devices has dedicated hardware generating the ACK/NAK response, which makes bulk-based protocols pretty infeasible in terms of consuming nearly all the CPU time on your device.

        Even with interrupt and control transfers, at 1.5 Mbit/sec, you’re limited to 8 byte packets. If you want to try experimenting with complex HID devices, like making a 9-axis joystick, the larger packets you’d need just aren’t allowed.

        So if you want to dig into low level protocol details like tokens and bit stuffing, then VUSB is great. True, on proper USB hardware, the serial interface engine and fifos (or DMA engine) takes care of that stuff so you never see it, but hardware USB also gives you the ability to work with many more higher level protocols. If the things you want to learn about USB involve actually using all 4 transfer types, and especially bulk & isochronous, VUSB just isn’t going to get you there.

        Software emulated USB also consumes a lot of CPU time and imposes massive interrupt latency. If you want to do any sort of low-latency response to something other than USB communication – if you want to learn about USB *and* something else too, like an actual application that uses USB for something substantial, the limitations add up quickly.

        Of course, my opinion is biased. I’m the author of Teensyduino. But I’ve gotta admit, ATTINY-based VUSB is pretty amazing, in that it works at all on such tiny chips using only software emulation. If you’re looking to learn about the very low level USB details, VUSB definitely gives you access to stuff that’s normally done by hardware. Just be aware of its limiations.

  1. I have to check that book out. This guy http://www.lvr.com has long been considered “the bible of usb” but I found his book tedious. I managed to get a USB build to work but was no fun to learn. Still prefer serial port to communicate to a PC, but I always welcome a better book (hopefully) as USB is a better port to develop on, and most new computers don’t even have a serial port anymore.

  2. I wish people writing books would find a good editor. Reading the sample on Amazon is painful.

    “Since I use C and assembly to build all of the projects in this series, I will assume that you know enough about these two langauges and I will use these two languages through out this book.”

  3. This guy?

    Janet Louise Axelson is an author of technical books in English. Most of her books relate to interfacing of computers using the serial port, the parallel port, USB and ethernet. Janet uses the name Jan Axelson on the cover of her books.

Leave a Reply to WACancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.