« Encoding and Streaming to your Pocket PC (3) | Home | USB - Communication »
USB - Topology
By admin | April 26, 2007
USB connects several devices to a host controller through a chain of hubs. In USB terminology devices are referred to as functions, because in theory what we know as a device may actually host several functions, such as a router that is a Secure Digital Card reader at the same time. The hubs are special purpose devices that are not officially considered functions. There always exists one hub known as the root hub, which is attached directly to the host controller.
USB uses a multi-level star topology which looks like a tree. Where the bus divides into two or more branches is a hub. At the end of each branch is a peripheral function. The word function in this context is a specific USB term.
Each physical USB device consists of a bus interface, a logical device and one or more functions. The bus interface is standard for all USB devices. The logical device is the user view of the device. In physical terms it might contain a single function, or it could consist of several functions with an embedded hub. An example of a multi-function device with embedded hub is a keyboard with built-in trackball.
Hubs have ports or attachment points that allow other USB devices to be connected to them. Each length of cable starts at a hub and ends at another device. Each connector is terminated, so cable termination is automatic and not something users will need to worry about. At the host there is just a single hub – known as the root hub – attached internally to one or more USB ports. There can be only one root hub per USB.
In PC hardware terms the root hub, or rather the USB controller through which the PC software controls it, is a single device with its own IRQ and I/O requirements. Once set up, the USB will not require any hardware reconfiguration no matter what devices you plug in to it. All you will need to do is install the driver software for the new device.
The USB is designed to allow dynamic attachment and removal of devices, while the system is running. This is achieved using an ongoing process of bus enumeration, which constantly checks what devices are on the bus.
When no device is connected to an attachment point, pulldown resistors ensure that both data lines are at ground potential. When a device is attached, a pullup resistor within the device raises one line to above the 2.8V threshold, so the hub knows that a device is attached. The hub can also tell whether a device is low or high speed: low speed devices pull up the D- line, while high speed devices pull D+ high. Having established the presence of a device and its communication speed, the system software can interrogate it to find out what its requirements are, and load the relevant drivers for it.
There are similarities between the USB software and the Card and Socket Services PC Card software. There are three software levels. At the lowest level is the host controller driver (HCD) software that interfaces directly to the USB controller. Above this is the USB driver (USBD) software that provides USB support for the operating system the PC is running. Above these two layers is the client software required for each USB function.
Neither applications nor the operating system can talk directly to USB devices. Applications may make I/O requests to the client software, or they may access a USB device indirectly using operating system functions which themselves call the client software. Client software may either make calls directly to the USBD layer, or through an operating system defined interface.
The USBD converts client software requests to the bus transaction level, for example, breaking a request to transfer a large block of data into the requisite number of packet-sized transfers. These are passed to the HCD layer. The HCD interacts directly with the USB controller, turning the transaction requests into a low level implementation dependent form which the controller then responds to by creating bus activity.
Sources: http://www.tech-pro.net/intro_usb.html, http://en.wikipedia.org/wiki/Usb
Topics: Computers & Software |
