2
\$\begingroup\$

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

\$\endgroup\$

4 Answers 4

5
\$\begingroup\$

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.

\$\endgroup\$
3
\$\begingroup\$

A clearer image of the architecture might help you: http://www.usblyzer.com/usb-topology.htm
All endpoint devices are of course I/O devices if they are using the USB serial protocol.
The USB controller is separate from the USB Root hub (though built together in the controller chip).

Read the documentation for the NEC720201 controller chip to understand the current architecture. The USB controller is split in two ...on one side is the PCIE to USB controller interface (called the xHCI) ...and on the other the USB Root Hub and Phy.

enter image description here

The HCI contains all the parallel to serial logic and the memory management/DMA logic. The USB Root Hubs handle only serial data for the USB data/command protocol.

If you are not learning about USB 3.0, then you might be better to start with the upd720101 which was the classical reference chip for USB 2.0 implementations.

enter image description here

\$\endgroup\$
3
\$\begingroup\$

I agree with the other answer that the nomenclature is inaccurate. The USB specification provides lots of vocabulary to clearly define every device and every bit in the USB protocol. This tree graph doesn't reflect that.

However, I think the best answer to your question is simply that a USB Hub allows you to connect to more USB devices besides itself. Not all devices do and therefore aren't hubs. Hubs can connect to other hubs, and therefore provide even more ports, up to 5 levels, if I recall correctly (someone check me on this).

This answer may also be interesting to you.

\$\endgroup\$
1
  • \$\begingroup\$ USB architecture allows only up to 5 layers of hubs in a USB tree. \$\endgroup\$ Oct 23, 2017 at 4:15
1
\$\begingroup\$

That reference is making invalid assumptions - what they are labeling an "I/O device" is merely a USB device - it might or might not have any I/O capability.

For example, in a USB flash drive, nothing goes any further. Communication with it via USB could be argued to be I/O from the perspective of the computer, but so could communication with an intermediate hub, and those aren't being categorized as I/O devices. Therefore the proposed model is meaningless, and invalid.

\$\endgroup\$
9
  • \$\begingroup\$ All end point devices are by definition I/O devices on the USB tree. If they were not I/O devices then they'd be a bit useless. A USB Flash drive is clearly an I/O device, and a USB Hub is clearly and I/O device, since it feeds further down the USB tree. \$\endgroup\$ Oct 22, 2017 at 2:54
  • \$\begingroup\$ @JackCreasey essentially yes - the point is that the proposed diagram is invalid because it draws a false distinction. If something that does not even have further wires coming out of it gets categorized as an "I/O device" then a hub which does have further wires coming out of it obviously has to fit that category even more so. \$\endgroup\$ Oct 22, 2017 at 17:50
  • \$\begingroup\$ Here we disagree, an I/O device supports some type of input and output ...clearly a USB Flash drive, camera and keyboard fit this bill. A Hub however does not fit this bill, IMO you think of these as pass-through devices, they don't provide I/O in the USB sense ... they simply buffer and manage signals on the USB tree, and I think that is what the diagram tried to convey. In that sense it is correct ....there are endpoint devices (I/O) and intermediaries (Hubs) ....they are not the same in any way. \$\endgroup\$ Oct 22, 2017 at 18:27
  • \$\begingroup\$ Sorry, but your logic is just not valid. If a flash stick, which has no external interface other than the upstream USB side counts as an I/O device, then a hub must also count, as it also has an upstream USB interface... and a downstream one, too. Either the USB bus itself counts as I/O, or it doesn't - can't have it both ways. (Incidentally, many hub chips also have downstream power control output signals - though few boards have the switches those could control) \$\endgroup\$ Oct 22, 2017 at 19:44
  • \$\begingroup\$ Additionally, you can use a USB hub's downstream ports for direct real world input, by wiring a switch to connect a pullup resistor to D+ or D-. \$\endgroup\$ Oct 22, 2017 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.