Electronic – the difference between a USB Hub and an the I/O device

computer-architectureusb

I am learning about the USB interface. My current understanding is the following:

The Host Computer contains an I/O interface, called root hub. This root hub is connected with either other hubs or I/O devices.

Now my question is. What is exactly the difference between hubs and I/O devices? There is a diagram in the textbook I am reading that shows the two as clearly being difference from each other:

enter image description here

Best Answer

A USB hub is formally a USB device too. As such, it is a subject of USB enumeration process as any other USB device on the bus. Therefore a hub gets its own dedicated USB address, and responds to various host inquiries on its own, like reporting status of its downstream ports, and responding to interrupt pipe when something is connected or disconnected.

However, hubs are special devices in the sense that their main function is to relay/channel all USB packets to downstream ports (and back), so other devices can be connected and enumerated. If there are connected and enabled USB devices in HS (High-Speed, 480 Mbps) mode on its downstream ports, anything that comes to its upstream port will be re-transmitted (repeated) downstream, and anything that comes from downstream devices will be repeated upstream. This is a fairly simple two-way repeater functionality.

However, if the connected downstream device is Low Speed or Full speed, USB hubs have additional responsibilities when relaying the USB packets - they translate the fast upstream transactions into slow LS/FS transactions. For this purpose hubs have dedicated buffers with enough size to accommodate longest FS/LS packets. For this purpose the USB host uses special class of communication, so-called "split transactions". The rules of split transactions are fairly complicated, and USB specifications have nothing better than list many examples that took more than 100 pages to explain. The host feeds the hub TT (transaction Translator) just enough to keep slow devices running, and this saves the upstream HS bandwidth for other devices. In this sense USB hubs are fairly sophisticated communication processors.

In short, normal USB devices perform specific I/O functions, like storing data in flash memory, or adapting a WIFi modem, or bridging/converting USB I/O data into other interfaces like UART or I2C, or relaying keys pressed on a keyboard. The hubs have an universal function to repeat/broadcast/ any data regardless of their origin or purpose.