初創(chuàng)業(yè)公司做網(wǎng)站營銷伎巧第一季
和USB應(yīng)該是老朋友了,從2011年接觸Android開發(fā)開始,就天天和USB打交道了。那時候還有不
對稱扁頭的usb/方口的usb,直到如今使用廣泛的防反插USB3.0 type-C。
但是,一直有一個不是很清楚的問題縈繞在心頭,那就是。先有USB協(xié)議還是先有USB connector定義?
什么USB1.0,USB2.0,USB3.0 , USB PD, 等等。這些協(xié)議和接口又是一個什么樣的關(guān)系?今天就來簡單整理一下。但是重心會放在移動設(shè)備上廣泛使用的USB2.0/USB OTG/ USB3.0,Type-B和Type-C。
認(rèn)識USB設(shè)備,帶USB插槽的Laptop,U盤,USB鼠標(biāo)/鍵盤,USB移動硬盤,USB充電寶,USB Type-C。
USB 設(shè)備分類
通常USB設(shè)備分為主設(shè)備和從設(shè)備。通常,筆記本會充當(dāng)主設(shè)備,而其它接在筆記本上的設(shè)備為從設(shè)備,也可以統(tǒng)一稱為外設(shè)。
通信過程
以U盤為例:
Powering on the Laptop: When you power on the laptop, the system boots up, and the operating system (such as Windows, macOS, or Linux) is loaded into the laptop's memory (RAM). The operating system takes control of the laptop's hardware and manages the execution of software applications.
Connecting the USB Interface Disk: You connect the USB interface disk (such as a USB flash drive or an external hard drive) to one of the available USB ports on the laptop. The USB port provides both power and data connectivity for the attached device.
Device Recognition(枚舉的過程): The operating system detects the presence of the connected USB interface disk. It identifies the device and loads the appropriate device drivers if necessary. Device drivers are software components that enable the operating system to communicate with and control the connected device.
Mounting the Disk: Once the USB interface disk is recognized, the operating system "mounts" it(掛在文件系統(tǒng)), which means it makes the storage space on the disk accessible to the laptop's file system. The operating system assigns a drive letter or mount point to the disk, allowing you to access its contents.
File System Access: With the USB interface disk mounted, you can interact with its contents through the file manager or file explorer of the operating system. You can browse files, copy, move, delete, or perform other file operations on the disk, similar to how you would interact with files on the laptop's internal storage.
Data Transfer: You can transfer data between the laptop and the USB interface disk by simply dragging and dropping files or using copy-paste operations. The operating system manages the data transfer process, ensuring that the data is written to or read from the appropriate locations on the disk.
Safe Removal: To safely remove the USB interface disk, you should use the operating system's "eject" or "safely remove" feature. This ensures that all pending write operations are completed and the file system is properly unmounted from the disk. Following this procedure helps prevent data corruption or loss.
Disconnecting the Disk: After safely removing the USB interface disk, you can physically disconnect it from the laptop's USB port.
協(xié)議上 通信過程:
In USB communication, the transfer process is typically initiated by the USB master device.(所有的通信都應(yīng)該由主設(shè)備法起)。?The USB master device, also known as the host, is responsible for controlling the USB bus and managing communication with connected USB devices.
The USB master device takes the initiative to initiate various USB transactions such as data(數(shù)據(jù)) transfers, control commands(命令), and enumeration(枚舉). It sends requests to the connected USB devices, instructing them to perform specific actions or transfer data.
On the other hand, USB slave devices, also called peripherals(通稱為外設(shè)), respond to the commands and requests from the USB master device. They do not initiate communication actively but instead wait for commands or requests from the master device.
When you connect a USB interface disk (a slave device) to a laptop (the master device), the laptop's operating system, acting as the USB host, recognizes the presence of the USB device and initiates the communication. It sends commands and requests to the USB interface disk to perform actions such as reading or writing data.
The USB master device controls the entire transfer process, including the direction of data flow (from the host to the device or vice versa), the type of transfer (bulk, control, isochronous, or interrupt), and the timing and coordination of the transfer.
總而言之,USB主設(shè)備控制一切通信過程!
電氣差異,作為主設(shè)備時候
- 4-Pin USB2.0
- 5-Pin USB2.0 OTG
- 9-Pin USB 3.0?USB3.0向后兼容USB2.0,另外支持一個SuperSeepd bus。
電氣差異,作為從設(shè)備時候
???????????????1. 4-Pin USB2.0
? ? ? ? ? ? ? ?2. 4-Pin USB2.0 OTG
? ? ? ? ? ? ? ?3. 9-Pin USB3.0
USB3.0 Type A 對應(yīng)的引腳說明
USB3.0 Type-B的長下面的樣子
USB3.0 Type-C,24Pin
發(fā)展時間
速度對比
總結(jié)
USB的協(xié)議發(fā)展很快,從USB協(xié)議1.0/2.0/3.0/4.0 ...對應(yīng)的connector也是4pin/5pin/9pin/24pin的演化。
如果9pin的USB3.0 需要支持OTG,那么要將上圖中的一路GND_DRAIN設(shè)備ID pin. 而我的使用case是設(shè)備作為USB3.0 prepherial 和USB2.0 host(支持OTG,并對外供電,5pin)。
當(dāng)我們使用USB3.0時候,不建議帶OTG,因?yàn)閁SB2.0已經(jīng)支持,3.0追求的是更快/更大電流!
萬能的WWW,什么知識都有,就看你是否愿意花時間了。Serial port, RS232 and RS485 software. Data logging and monitoring software for COM, RS232, USB and TCP ports, OPC and DDE interfaces