USB: easy, but …
I love USB.
I have worked with PCs since The Beginning, and I remember how it used to be. I would buy new peripheral device, spend lots of time and effort ripping apart my PC to install the card and then start worrying about software, drivers etc. It took for ever. By the time I had finished, any excitement I had about this new cool device had long since evaporated.
USB changed all that. Nowadays, I just plug a standard USB cable into the back of the computer and into the device and switch on. Sometimes it will take a moment or two to figure out drivers and so forth, but in no time I am up and running.
USB has been very successful. USB 2.0 is well established and does a excellent job. With USB 3.0 beginning to appear, I look forward to great things, but it does surprise me how many people do not know how USB works…
It is not so surprising really, as USB highlights an interesting phenomenon in the high-tech world: the simpler something is to use on the outside, the more horribly complex it is on the inside! A user does not need to know about that complexity, but a developer does.
In USB terminology, a computer is a “host” and the USB connected device is a “function”. Broadly speaking, the host is in control of the communication. Any device could be a host; it does not need to be a computer. The USB software for a host and a function is different; there is either a host stack or a function stack. Some devices might need to be able to take on both roles – like a digital camera that might be a function to upload pictures to a PC, but be a host to send pictures to a printer. Such a device would need to have both host and function stacks or it could take advantage of a newer USB variant called “On The Go” [OTG], which enables devices to dynamically swap roles as required.
A USB device must fit into a “class”. There are many standard classes and it is very advantageous if a device that you are developing can be made to logically belong to one of these. On both the host side and the function, a “class driver” is required, so adherence to standard classes minimizes the developer’s work.
In some future posts, I will look in more detail at how USB works.
Most commercial embedded operating systems offer USB support [Mentor Graphics’ Nucleus being a good example], which means that even developers may be insulated from the complex details of USB implementation.
I do have a minor frustration. I cannot find USB hubs with more than 7 ports. Also the sockets tend to be too close together, which is a problem with “chunky” things like USB drives. If anyone know where I can get a powered hub with, say, 20 ports and a bit of space around the sockets, please email me.
Posted August 3rd, 2009, by Colin Walls
- Choose your weapons – options for debugging
- Dissatisfaction, customer service and surprises
- Video blog about getting into embedded software
- Embedded software article: RTOS Revealed #9
- Lost in translation
- One return from a function: a good idea?
- The A380 experience
- Embedded Software Masterclass
- How to get rich