MCU單晶片韌體設計

2017年3月26日 星期日

USB Host 端如何區別 Low Speed, Full Speed , High Speed ?



  • USB 1.0 Low Speed: 1.5Mbps : D- 接一個上拉電阻
  • USB 1.1 Full Speed : 12Mbps : D+ 接一個上拉電阻
  • USB 2.0 High Speed: 480Mbps : D+ 接一個上拉電阻

USB Electrical

其中, R2, R3 接15K (下拉)電阻到GND(在晶片內控制)。


Full Speed 為例, 如下圖 , 當USB Device 插入USB Host 端時, USB_D+ 可以查覺到High (1.5K和15K分壓的結果), Host 便知道有USB Device 插入了, 並且知道這是Full Speed的狀置。若是USB_D- 接上拉電阻, 則知這是插入了Low Speed設備。
USB 1.1 Full Speed : D+ 接一個上拉電阻

如何知道是Full Speed 或  High Speed ?

要知道一個設備是否支援High Speed,需使用兩個特殊的信號狀態。


USB 2.0 devices use a special protocol during reset, called chirping, to negotiate the high bandwidth mode with the host/hub. 
  • A device that is USB 2.0 High Speed capable first connects as an Full Speed device (D+ pulled high), but upon receiving a USB RESET (both D+ and D− driven LOW by host for 10 to 20 ms) it pulls the D− line high, known as chirp K. This indicates to the host that the device is high bandwidth. 
  • If the host/hub is also HS capable, it chirps (returns alternating J and K states on D− and D+ lines) letting the device know that the hub operates at high bandwidth. The device has to receive at least three sets of KJ chirps before it changes to high bandwidth terminations and begins high bandwidth signaling. 
  • Because USB 3.0 uses wiring separate and additional to that used by USB 2.0 and USB 1.x, such bandwidth negotiation is not required.

在Reset期間,支援High Speed的設備會送出一個 Chirp K。支援High Speed的Hub檢測到該 Chirp 後,會送出交替的 Chirp K 與 J。當設備檢測到 KJKJKJ 的樣式後,它會移除它的Full Speed上升電阻,然後在High Speed執行所有的通信。如果集線器沒有對設備的 Chirp K 做出相應,設備知道它必須 繼續使用Full Speed通信。

Signalling 

USB 1.1 full-speed

  • D+ high :is J;  and K is inverse of J state
  • Sync --> Line Transitions: KJKJKJKK
  • End of Packet (EOP): Line Transitions: SE0 + SE0 (D+, D+ are low) + J


Line transition pattern


Example of a Negative Acknowledge packet transmitted by USB 1.1 full-speed device when there is no more data to read. It consists of the following fields: clock synchronization byte, type of packet and end of packet. Data packets would have more information between the type of packet and end of packet.

USB Packet Format


 參考


  1. https://en.wikipedia.org/wiki/USB
  2.  USB-IF
  3. http://www.ittraining.com.tw/ittraining/course/firmware/usb




沒有留言 :

張貼留言