USB HUB is used for device extension connection. All USB DEVICE is connected to the USB HUB port. A USB HOST is always connected to a root HUB (USB ROOT HUB). USB HUB provides 100mA current for each port to be used by the device.
At the same time, the USB HUB can diagnose the device's pluggable operation through the electrical changes of the port and report the port state to the USB HOST by the response to the USB HOST packet. Generally speaking, the connection length between USB device and USB HUB is no more than 5m, and the cascade of USB system can't exceed 5 levels (including ROOT HUB).
The downstream interfaces of the USB Hub will divide the upstream interface bandwidth, and the USB Hub itself also needs to transmit the control signal, so the bandwidth of the downstream devices is necessarily less than the total bandwidth of the upstream device.
The actual situation is, now the mainstream USB 3 equipment is very difficult to occupy the total bandwidth (5Gbps), such as the mainstream of the 3 U disk is probably only 100MB~200MB/s transmission speed, the bandwidth is not 2Gbps, so the actual situation is not necessarily.
The principle of USB Hub is complex, and the most complex part of the USB protocol specification is the chapter of Hub. USB Hub is quite different from the Hub principle of network devices (Ethernet). If the analogy is true, the complexity is roughly equivalent to the router in the network device.
USB protocol has four modes: control transmission, Bulk transmission, interrupt transmission and synchronous transmission.
Control transmission is used to transmit instructions at the level of the control device.
Bulk transmission (Chinese name may be called batch transmission) is mainly used to transmit USB bulk data, such as U disk read and write data.
Interrupt transmission is used to transmit small pieces of data, and mouse and keyboard are mainly used for interrupt transmission.
Synchronous transmission is used to transmit data that is not strong in real-time. That is to say, it doesn't guarantee reliability. Some USB audio devices use this transmission.
USB Hub is responsible for the integration of various transmission signals of downstream devices, in which synchronous transmission is limited. If a certain proportion of the total bandwidth (memory is 20%), the synchronous transmission beyond the proportion will be discarded; the interruption transmission and control transmission occupy the bandwidth, not discarded; the Bulk transmission takes up the remaining band. Wide, if there is no synchronous transmission, then Bulk transmission can account for more than 90% of the total bandwidth.
After USB Hub integrates data, it sends to upstream equipment. If upstream has USB Hub, then the upstream device will continue to do the same operation. In addition, it needs to be explained that, in general, the USB interface on the host is itself a Root Hub, and if there are multiple interfaces on a PC, it may be that multiple interfaces share a controller, and each controller has a Root Hub.
So USB Hub is equivalent to repackaging a variety of packets, similar to a router in a network device, not as simple as a switch or a hub .
At the same time, USB Type C Hub itself is also a USB device, which is responsible for reporting to the superior of how many devices at its own lower level, and it itself also takes up some bandwidth to report its own state periodically.
Because a lot of networks such as Ethernet, such as the common network of shared HUB connections, are bus-based and are physically broadcast, that is, when a machine sends data to another machine, the shared HUB first receives and sends the data it receives to the other (the incoming port does not send) every mouth, so the shared HUB, all the network cards of the same network segment can receive data.
The internal monolithic program of the switched HUB can remember the MAC address of each port, then which machine is sent to which port to receive, instead of sending it to all the ports like shared HUB, so the network card that only receives the received data can receive the data under the exchange of HUB, of course, broadcast packets or send it to all ports. It is obvious that the working mode of sharing HUB allows two machines to transmit data in other ports, so sharing HUB determines that the same segment can only have two machines for data communication at the same time, while the exchange of HUB and two machines is not occupied by other ports, so the other ports can also be used in the same way. Shi Chuanshu.
This is the two place where the shared HUB is different from the exchange of USB HUB . Sharing HUB is the same time that only one machine sends data and all the machines can receive it, as long as it is not a broadcast data exchange HUB at the same time it can have data transmission to the machine and the data is private.