{"id":336,"date":"2009-08-03T09:25:04","date_gmt":"2009-08-03T08:25:04","guid":{"rendered":"https:\/\/blogs.mentor.com\/colinwalls\/?p=336"},"modified":"2026-03-26T16:30:44","modified_gmt":"2026-03-26T20:30:44","slug":"usb-easy-but","status":"publish","type":"post","link":"https:\/\/blogs.sw.siemens.com\/embedded-software\/2009\/08\/03\/usb-easy-but\/","title":{"rendered":"USB: easy, but &#8230;"},"content":{"rendered":"<p>I love USB.<\/p>\n<p>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 <em>for ever<\/em>.  By the time I had finished, any excitement I had about this new cool device had long since evaporated.<\/p>\n<p>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.<\/p>\n<p>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&#8230;<\/p>\n<p><!--more-->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.<\/p>\n<p>In USB terminology, a computer is a &#8220;host&#8221; and the USB connected device is a &#8220;function&#8221;. 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 &#8211; 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 &#8220;On The Go&#8221; [OTG], which enables devices to dynamically swap roles as required.<\/p>\n<p>A USB device must fit into a &#8220;class&#8221;. 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 &#8220;class driver&#8221; is required, so adherence to standard classes minimizes the developer&#8217;s work.<\/p>\n<p>In some future posts, I will look in more detail at how USB works.<\/p>\n<p>Most commercial embedded operating systems offer USB support [Mentor Graphics&#8217; Nucleus being a <a href=\"http:\/\/www.mentor.com\/products\/embedded_software\/nucleus_rtos\/nucleus_usb\/\" target=\"_blank\" rel=\"noopener noreferrer\">good example<\/a>], which means that even developers may be insulated from the complex details of USB implementation.<\/p>\n<p>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 &#8220;chunky&#8221; 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 <a href=\"mailto:colin_walls@mentor.com\">email<\/a> me.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I love USB. I have worked with PCs since The Beginning, and I remember how it used to be. I&#8230;<\/p>\n","protected":false},"author":71677,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[1],"tags":[300,304,326],"industry":[],"product":[],"coauthors":[],"class_list":["post-336","post","type-post","status-publish","format-standard","hentry","category-news","tag-embedded-software","tag-nucleus","tag-usb"],"_links":{"self":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/users\/71677"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/comments?post=336"}],"version-history":[{"count":1,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/336\/revisions"}],"predecessor-version":[{"id":9776,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/336\/revisions\/9776"}],"wp:attachment":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/media?parent=336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/categories?post=336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/tags?post=336"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/industry?post=336"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/product?post=336"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/coauthors?post=336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}