Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 371 – UNIT 20 Universal Serial Bus (USB). References 1. Universal Serial Bus Specification, Revision 2.0. This specification is available on the World.

Similar presentations


Presentation on theme: "ECE 371 – UNIT 20 Universal Serial Bus (USB). References 1. Universal Serial Bus Specification, Revision 2.0. This specification is available on the World."— Presentation transcript:

1 ECE 371 – UNIT 20 Universal Serial Bus (USB)

2 References 1. Universal Serial Bus Specification, Revision 2.0. This specification is available on the World Wide Web site http://www.usb.org. http://www.usb.org 2. Universal Serial Bus Device Class Definition for Printing Devices, Version 1.1. This specification is available on the World Wide Web site http://www.usb.org.http://www.usb.org 3. Jan Axelson, USB Complete: Everything You Need to Develop Custom USB Peripherals, Second Edition, ISBN 0-96508-5-8, Lakeview Research, Madison, WI 53704, 2001. 4. Microchip PIC16C745/765. This single chip computer supports USB. Data sheets and application notes are available on the World Wide Web site http://www.microchip.com.

3

4 USB Overview Universal Serial Bus (USB) is a fast and flexible interface. Connects up to 127 devices to a personal computer. All recent PCs are marketed with at least one and often several USB ports.

5 USB Overview The USB interface is versatile enough to support all standard peripherals such as keyboards, printers, mice, network interfaces, RS 232 serial, cameras, and disk drives. The older standard interfaces such as the parallel port, the COM ports, the PS2 ports, and infrared ports are slowly being eliminated on newer PCs and being replaced with USB as the standard interfaces to peripherals.

6 USB Components Host computer provides two components: –A host controller –A root hub

7 USB Topology USB uses a “tiered star” configuration for connecting hubs and devices to the Root Hub Hub is the center of each star Hubs provide the data path between the device and the root hub Root Hub is limited to 127 devices Tree cannot be more than 6 levels deep.

8 Topology

9 Host Centric Architecture USB is a host centric architecture Host is always the master Devices are allowed to transmit only when specifically instructed to by the host Devices are polled by the host.

10 Example Host with 2 Peripherals

11 Example PC with 6 Peripherals

12 Example – Host with 15 Peripherals

13 Connectors Type A Type B

14 USB Cable Wiring There are 4 wires in the cable 2 Power (+5 Volts, ground) 2 Signal wires (–D, +D) Low Power Devices and Hubs can be powered from 2 power wires

15 USB 1.0 Full Speed 12 Megabits/sec Low Speed 1.5 Megabits/Sec

16 USB 2.0 High Speed 480 Megabits/Sec

17 Bus States “Differential 1” : D+ is more positive that D- “Differential 0” : D- is more positive than D+

18 Relation Between Bus States and Data States Bus State Data State Low Speed Full Speed High Speed Differential 0 J K K Differential 1 K J J

19 USB 1.0 Bus States (Low Speed and Full Speed) Vout high min = 2.8 v Vout low max =.3v Vin high min = 2.0 v Vin low max =.8v

20 USB 2.0 Bus States (High Speed) Vout high min =.360 v Vout low max =.010v

21 Data Encoding – NRZI NRZI defines logic “0” as a voltage change and a logic “1” as a voltage that remains the same. The least significant bits are transmitted first. The receiver is automatically synchronized with the transmitter by transitions in the signal.

22 NRZI with Bit Stuffing Insure synchronization. A logic “0” is automatically inserted after 6 “1”s on transmission A logic “0” is deleted automatically after 6 “1”s on receive.

23 Example of NRZI 0: Voltage change 1: No voltage change

24 Frames The host schedules transactions within 1- millisecond frames for low speed and full speed. For high speed, 125 microsecond frames are used. Each frame begins with a Start-of-Frame packet followed by transactions that transfer data to or from device endpoints. The host can schedule transactions anywhere inside a frame.

25 Start of frame Device 1,endpoint 2 Device 2, Endpoint 0 Device 2, Endpoint 2 Unused Transactions Start of Frame Packet Token Packet: (First Packet in Each Frame) Example of Frame (1 msec)

26 Example of Frame SOFTransaction... SOFTransaction 1 ms or 125 us Frame Number is incremented from One Frame to the Next

27 Define: “Transfer” The process of making and carrying out a communication request. A complete transfer may take place over multiple frames Each transfer consists of 1 or more Transactions.

28 Define: “Transaction” Delivery of service to an end-point ( the host’s sending a chunk of data to a device or the host’s requesting and receiving a chunk of information from the device) No other other communication on the bus can break into a transaction Each transaction consists of 1 - 3 phases (packets)

29 Define: “Packet” A block of information with a fixed format All packets start with a packet id, which identify the packet type Other information that may be included in packet: - Endpoint Address - Data - Status Information - Frame Number - Error Checking Bits

30 Example Transfers

31 Four Types of Transfers Control Transfers Bulk Transfers Interrupt Transfers Isosynchronous Transfers

32 Control Transfers Used by the host to: Read information about a device Set a device’s address Select configurations and other settings Send custom requests that send and receive data for any purpose.

33 Bulk Transfers Intended for situations where the transfer rate is not critical, such as: Sending a file to a printer Receiving data from a scanner

34 Interrupt Transfers Used for devices that must have attention periodically, without large delay such as: Mice Keyboards Joysticks

35 Isosynchronous Transfers Used for applications that must have a guaranteed delivery time, such as - Transferring audio files that must be played in real time. Guarantees a fixed amount of data at a fixed rate. Trades off guaranteed data accuracy for guaranteed timeliness. No data checking is performed, and the loss of data is not catastrophic.

36 3 Types of Transactions Status – For sending control/transfer requests to a device In - For receiving data from a device Out – For sending data to a device

37 4 Types of Packets (each type has 4 sub-types, for a total of 16 kinds of packets) Token – Identifies the transaction type Data - Carries data or status information Handshake – Carries status information Special

38 Start of Frame Packet (One of the 4 Token Packets) Packet ID One’s complement of Packet ID 1010 0101

39 Format for Other 3 Token Packets (Out, In, Setup_ Select 1 of 127 devices Select 1 of 16 device endpoints

40 Device Addresses ADDR – 7 bits Each device is assigned a 7-bit address Assigned addresses are 1, 2, …, 127

41 End Points ENDP – 4 bits End points are device registers Each device has 1 to 16 End Points Assigned end points are 0, 1, …, 15 End point 0 is device control Up to 16 IN End Points Up to 16 OUT End Points

42 Data Packet

43 Handshake Packet

44 CRC Error Checking CRC5 – 5-bit Cyclic Redundancy Check CRC16 – 16-bit Cyclic Redundancy Check

45 Token Packets - 4 Kinds

46 Date Packets - 4 Kinds

47 Handshake Packets - 4 Kinds

48 Special Packets - 4 Kinds

49 Handshake Packets PING and NYET packets require High Speed (USB 2.0). ACK – Packet was received correctly. NAK – The NAK is sent for a number of reasons. Packet was received correctly but the host should resend data because of a temporary condition such as a buffer overflow caused a loss of data. Sender can not send data. Sender has no data to send. If packet was received in error, then no response is sent.

50 Packet Coding Prior to transmitting a packet, line is in the Idle State (J). Each packet begins with a SYNC character and is terminated with an End- of-Packet signal. For low and full speeds, the SYNC is eight bits and is KJKJKJKK. For high speed, the SYNC is 32 bits: 15 KJ repetitions following by KK.

51 Packet SYNCPacketEOP

52 Summary of Transfer Format

53 Enumeration (Overview) Enumeration is the process that the host uses to either identify a hub or device whenever it is connected to or disconnected from a hub. USB Enumeration is started whenever a hub or device is plugged into USB hub port or system powers up. Enumeration includes (among other things): –Hub determines speed of device (High, Full, or Low) –Hub determines class of device (e.g, printer, keyboard, camera, etc.) –Hub assigns address to device –(Full list of Enumeration step are shown on following slides)

54 Enumeration (in detail) Enumeration is the process that the root uses to either identify a hub or device whenever it is connected to or disconnected from a hub. 1. USB Enumeration is started whenever a hub or device is plugged into USB hub port or system powers up. 2. Hub detects the device. D+ = High, D- = Low – full speed device or high speed D+ = Low, D- = High – low speed device 3. Host sends the hub a Get_Port_Status and other hub class-class requests for information. 4. Hub returns speed in response to Get_Port_Status request from host.

55 Enumeration 5. Host sends a Set_Port_Feature to instruct hub to reset the port. Reset = D+ = D- = Low for at least 10 milliseconds 6. Host determines if full-speed device supports high speed. Device sends Chirp K. High speed hub responds with Chirp KJKJKJ Device detects Chirp KJKJKJ and performs all further communications at High Speed.

56 Enumeration 7. Host establishes signal path between host and device Host sends Get_Port_Status until the hub exits reset state Device now in Default state. Responds to Address = 0, Endpoint = 0 8. Host sends Get_Descriptor to get device’s maximum packet size. 9. Host assigns an address with Set_Address request.

57 Enumeration 10. Host sends one or more Get_Descriptor request to learn the identify of the device and the device’s abilities. 11. Host assigns and load a device driver. 12. Host send Set_Configuration to selects a configuration supported by driver


Download ppt "ECE 371 – UNIT 20 Universal Serial Bus (USB). References 1. Universal Serial Bus Specification, Revision 2.0. This specification is available on the World."

Similar presentations


Ads by Google