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.

Comments

  1. egasimus says:

    What’s the regulator? It’s listed as TO-220, which is just the package.

    • WA says:

      If you click the link to Mouser you can see the component. It is a LD1086V33

      • egasimus says:

        Hmm, do you think this would work on 2.8 V? Cuz I can only easily obtain a LD1086V28 where I live.

      • egasimus says:

        Nevermind, discovered the LD1117 series, which seems to be compatible. Just ordered up the last LD1117V33 my local supplier has on stock. Lucky me!

      • NewCommentor1283 says:

        “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.

      • NewCommentor1283 says:

        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.

      • egasimus says:

        @NewCommentor1283
        Yeah, right. Where you live, people throw, like, working Hammond organs in the trash. Where I live, people still watch their VCR.

  2. jrsmile says:

    this already exists it is called the teensy its cheeper, no external programmer needed and comes in two processor variants.

    • egasimus says:

      And what if it might happen to possibly be cheaper for me maybe to perhaps build one of these instead of ordering a Teensy?

    • chango says:

      Teensy isn’t good for learning how USB works since the HW USB engine and SW stack are already made for you.

      • Paul says:

        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.

    • Drone says:

      Teensy is locked-up tight proprietary nonsense.

  3. Estoban says:
  4. JB says:

    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.

  5. John Smith says:

    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.”

  6. wowme@wtf.com says:

    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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,633 other followers