News Centerposition:Baoxingwei > News Center > 正文
[Baoxingwei] USB interface (2)
Edit:Baoxingwei Technology | Time:2023-03-10 16:15 | Number of views:182
Electrical characteristics
Details of USB electrical characteristics related to the content is in the USB specification. Here, just a few features that users need to be aware of are listed. Figure 1 shows the connection of electrical characteristics between the full speed device and the PC host. In addition to the Vcc (+5 V) and ground wires, special attention should be paid to the D+ and D- differential data signal wires. First, connect a 9O to 44Ω resistor in series before connecting to the USB transceiver. Then, according to different USB transmission speed (full speed or low speed), change the position of lifting resistance 1.5 × (1± 5%) kΩ at each end of the set. This lifting resistance can also be regarded as setting the resistance of each end. For a full-speed device (12 Mbps), the lifting resistance is connected to the position between the D+ signal line and the power supply. In the case of low speed (1.5Mbps), connect the lifting resistance to the position between the D-1 signal line and the power supply, as shown in Figure 1.15. This voltage source ranges from 3.0 to 3.6 V. But for USB 2. For high speed transmission of 0, this lifting resistance has been omitted and replaced with an automatic switching mode. , D+ and D- Connect the 15 kΩ pull-down resistance to the root hub or hub of the PC and connect the two signal cables to the ground terminal. The user can also view these pull-down resistors as the hub end resistors.
Figure 1 Connection diagram of electrical characteristics between full-speed device and PC host
Figure 2 Connection diagram of electrical characteristics between the low-speed device and the PC host
How do the electrical characteristics between the whole PC host and the device operate? First of all, when the device is not connected to the root hub of the PC host or the connecting port of the hub, D+ and D- two signal wires are almost regarded as grounded because of the pull-down resistance relationship, but if there is a set of each just connected, due to the lifting resistance (1.5 kΩ) and pull-down resistance (15 kΩ) formed a voltage divider; Thus one of the data signal lines (D+ or D-) will be boosted to about 90% of the voltage Vdc. At this point, the hub determines that a device is connected when it detects that one of the data signal lines approaches 3 Vcc while the other remains grounded. The PC host constantly checks the root hub at regular intervals to check the potential change between D+ and D 1 to understand the connection status of the device.
Technical analysis and circuit design
USB structure and working principle
A USB system can be described in three ways
(1)USB interconnection.
(2)USB devices.
(3)USB host.
USB interconnection refers to the way in which a USB device is connected to and communicates with a USB host. It includes:
(1) Bus topology: the connection model of USB host and USB device.
(2) Relationship between layers: Each layer of USB in the system must complete certain tasks.
(3) Data flow model: data transmission mode between message source and information in USB system.
(4) Task planning: USB provides an interconnection mechanism that can be shared. By planning access to the interconnection mechanism, you can support
Hold synchronous data transmission.
The following is a brief discussion of USB hardware architecture and data streaming.
USB hardware architecture
A USB system consists of three types of hardware devices: USB HOST, USB DEVICE, and USB HUB. See Figure 2-1.
(1)USB HOST
In a USB system, if and only if there is a USB HOST, the USB HOST has the following functions:
USB management system;
◇ One frame of data is generated every millisecond;
Send configuration request for USB device configuration operation.
◇ Manage and recover errors on the bus.
(2)USB DEVICE
In a USB system, the total number of USB devices and hubs cannot exceed 127. The USB DEVICE receives all data packets on the USB bus and determines whether the data packets are sent to the device based on the address domain of the data packets. If the address does not match, the device simply discards the data packets. If the address matches, data is transmitted to the USB HOST through the packet that responds to the USB HOST.
(3)USB HUB
The USB HUB is used for DEVICE expansion connection. All USB devices are connected to the ports of the USB HUB. A USB HOST is always connected to a USB ROOT HUB. The USB HUB provides 100mA of current to each of its ports for device use. At the same time, the USB HUB can diagnose the plug and remove operation of the device based on the electrical changes of the port, and report the port status to the USB HOST by responding to the data packet. Generally speaking, the cable length between a USB device and a USB HUB should not exceed 5m, and the USB system cannot be cascaded to more than 5 levels (including the ROOT HUB).
The USB bus supports up to 127 USB peripherals to connect to the computer system. The USB topology is a tree structure with one USB root hub and several hubs below. Several USB ports can be connected under 1 hub. The USB cable consists of four cables: Vbus(USB power), D+(data), D-(data), and Gnd(USB ground). The cable length does not exceed 5m. USB1.1 has a transfer rate of 12Mb/s(standard rate is 1.5Mb/s for low speed peripherals and 12Mb/s for high speed peripherals). Figure 2-1 shows a typical block diagram of USB functional devices. Figure 2-3 shows the connection between USB cables and resistors of high-speed peripherals. In Figure 2-3, FS is full speed (high speed); LS is low speed; R1=15 kω, R2=15 kω. USB peripheral can use the power supply in the computer (+5V, 500mA), also can be connected to the external USB power supply. Dynamic bandwidth allocation among all USB channels is one of the characteristics of USB bus, which greatly improves the utilization of USB bandwidth. When a USB peripheral is not used for a long time (more than 3ms), it is in the suspended state, then only 0.5mA current consumption. According to the USB1.0/1.1 standard, the standard pulse clock frequency of USB is 12MHz, while its bus time pulse clock is 1ms(1kHz), that is, every 1ms, the USB device should generate a clock pulse train for the USB cable. This series of pulses is called Frame Start Packets (SOF). The high speed peripheral is 12000bit per frame, while the low speed peripheral is only 1500bit per frame. One USB packet can contain 0 to 1023 bytes of data. Each packet transmission begins with a synchronization field.
USB data stream transmission
The master controller is responsible for transferring data streams between the host and USB devices. These transmissions are treated as a continuous stream of bits. Each device provides one or more interfaces that can communicate with the client program. Each interface consists of zero or more pipes that independently transfer data between the client program and specific terminals of the device. USBD establishes interfaces and pipes for the real-world requirements of the host software, and when a configuration request is made, the host controller provides services according to the parameters provided by the host software.
USB supports four basic data transfer modes: control transfer, isochronous transfer, interrupt transfer, and block transfer. Each transport mode has different properties when applied to terminals with the same name.
Control transmission type: Supports the transmission of control, status, configuration and other information between peripherals and hosts, providing a control channel between peripherals and hosts. Each peripheral supports a control transfer type so that configuration and command/status information can be transferred between the host and the peripheral. Isochronous transmission: Supports periodic data transmission between peripherals and hosts with limited delay and bandwidth and constant data transmission rate. This type of error-free check does not guarantee correct data transmission. It supports data transmission between computer - telephone integrated system (CTI) and audio system and host.
Interrupt transmission type: Support input devices such as gamepads, mice, and keyboards, which transmit small amounts of data to and from the host computer without periodicity, but are sensitive to response time and require immediate response.
Data block transmission type: support printers, scanners, digital cameras and other peripherals, these peripherals and the host to transfer a large amount of data, USB can only meet the bandwidth of the case for this type of data transmission.
USB uses the block bandwidth allocation scheme. If a peripheral exceeds the current bandwidth allocation or potential requirements, the device cannot be accessed. Terminals of the synchronous and interrupt transmission types retain bandwidth and ensure that data is transferred at a certain rate. The central and control terminal transmits data according to the available bandwidth.
Two ways to realize USB peripheral controller
normal mode and DMA mode.
(1) General mode
The block diagram illustrates a simple mode of connecting peripherals. All registers and data reads and writes are simulated through the I/O of 8051, so the data throughput rate is low and suitable for intermittent data transmission.
(2) DMA mode
Data is transferred directly from D12 to the computer in DMA mode, and MCU only completes the initialization of DMA. The transmission speed is fast, which is suitable for high-speed real-time transmission such as video and digital signals.
Overall, USB provides a new interface standard for computer peripheral input and output. It enables devices with hot swap, plug and play, automatic configuration capabilities, and standardizes device connectivity. USB's cascading star topology greatly expands the number of peripherals, making it more convenient and fast to use peripherals. And the newly proposed USB2.0 standard is to increase the data transmission rate to a new height, which is a good application prospect.