47

USB Universal Serial Bus

Embed Size (px)

Citation preview

Page 1: USB Universal Serial Bus

VARUN [email protected]

Page 2: USB Universal Serial Bus

OVERVIEW• Industrial standard developed in 1990s.• Cable + connector + communication protocol• Developed by group of seven companies-

Compaq, DEC, IBM, Intel, Microsoft, NEC and Nortel.

• Packet based architecture with start frame,transactions,ACK and NAK controls.

Page 3: USB Universal Serial Bus

FEATURES OF USB

• Ease of Use 1.

Page 4: USB Universal Serial Bus

SOME USB KEY TERMS

Page 5: USB Universal Serial Bus

FEATURES• 2 CONTROLLERS USB controller+ Root Hub.

• USB controller: Formats the data for the operating system on read and write.

• Root Hub: connection point to the host.• Host is always the reference• IN: Host is going to receive the data; OUT: Host is

going to send the Data.• 3layers:Lower,Middle,Upper

Page 6: USB Universal Serial Bus

USB LOWER LAYER

Page 7: USB Universal Serial Bus

D+>D- =>Enumeration happen at full speed, or vice versa

Page 8: USB Universal Serial Bus
Page 9: USB Universal Serial Bus
Page 10: USB Universal Serial Bus
Page 11: USB Universal Serial Bus

EXAMPLE :SET UP TRANSACTION

TOKEN PACKET

DATA PACKET

HAND SHAKE PACKET

PID+ADDRESS+END POINT NO

SUCCESS/FAILURE

HOST WANTS TO READ/WRITE

Page 12: USB Universal Serial Bus
Page 13: USB Universal Serial Bus
Page 14: USB Universal Serial Bus
Page 15: USB Universal Serial Bus
Page 16: USB Universal Serial Bus
Page 17: USB Universal Serial Bus
Page 18: USB Universal Serial Bus
Page 19: USB Universal Serial Bus
Page 20: USB Universal Serial Bus
Page 21: USB Universal Serial Bus

USB MIDDLEWARE

Page 22: USB Universal Serial Bus

ENUMERATION• Before the application can communicate with the device host

needs to learn about the device and has to assign the device diver

• Assigning address to the device-reading descriptors from the device-assigning and loading drivers-selecting configuration(Device power requirement, end point).Then device will be ready for data transfer with any of the endpoint.

• Duty of HUB: detect attachment and removal using IN end points. Host polls the root hub to find any device is connected. After boot up also it continues the poll to find any newly attached device.

Page 23: USB Universal Serial Bus

ENUMERATION (cont..)

• Standard USB request: Host sends series request to the device HUB .They are followed by control transfers. Endpoint 0.

• For a user enumeration process is completely invisible. But get announcement of detection of new devices.

• When the enumeration is over OS adds new devices to DEVICE MANAGER list in the control panel. When the user removes device from the bus windows removes the device from the device manager.

Page 24: USB Universal Serial Bus
Page 25: USB Universal Serial Bus

DESCRIPTORSData structures or formatted block of information which enable the host to learn about the device.The device must store information in the descriptors and should respond for standard USB requestsClassification of Descriptors:I. DeviceII. Configuration III. InterfaceIV. Endpoint

Page 26: USB Universal Serial Bus
Page 27: USB Universal Serial Bus

bLength:The length of the bytes in the descriptorbDescriptortype: 01H for the device descriptorbcdUSB:The USB specification version that the device and its descriptor supports currently.1.00100h;1.10110hIdvendor:deivce manufacturer uses unique id to identify the device by paying money.The host may have an INF file which contains this value to load the drivers.idProduct:The owner of the vendor ID assigns product id to identify the device.bcdDevice:it is the device release No.iManufacturer:Index which points to a string describing the manufacturerIdProduct:Index points a string describing the product.iSerailNo: ’0’ Device with no serial No

To identify if the user has more than one identical device on the busbNumconfigurations:The no of configurations that the device supports.bMax Packet0:The maximum packet size for end point 0

LS:8 bytes;FS:8/16/32/64;HS:64

Page 28: USB Universal Serial Bus

Device Class, Device Subclass: The devices whose function is defined at device level, this field specifies the device class02h:Communications.09h:Hub.E0h:Wireless controller.Device Protocol: It specifies protocol defined by selected class or subclass

E.g.: What kind of transfer is going currently

Page 29: USB Universal Serial Bus
Page 30: USB Universal Serial Bus
Page 31: USB Universal Serial Bus
Page 32: USB Universal Serial Bus
Page 33: USB Universal Serial Bus

ENUMERATION STEPS12 STEP PROCESS

Page 34: USB Universal Serial Bus

1.USER ATTACH DEVICE TO PORT

• Attachment of USB port to the device or System power up with a device already attached

• The port may be on the root hub at a hub which connects the downstream from the host

Page 35: USB Universal Serial Bus

2.HUB DETECTS THE DEVICE

• Hub monitors the voltage on the signal lines of each of its ports

• If a full speed device is attached D+ is pulled up to V+

• If a full speed device is attached D- is pulled up to V+

Page 36: USB Universal Serial Bus

3.HOST LEARNS ABOUT NEW DEVICE

• Each hub uses its interrupt end point to report events at the HUB

• Host sends Get_Port_Status request .The returned information tells new device is attached.

Get_Port_Status REQ

Page 37: USB Universal Serial Bus

4.DETECTING … HIGH/LOW SPEED?

• Checks the voltage on D+ and D-• D+>D- =>full speed device• Hub sends information in response to

next Get_Port_Status

Get_Port_Status REQ

Page 38: USB Universal Serial Bus

5.HUB RESETS THE DEVICE• When the host learns of new device HOST

CONTROLLER send Set_Port_Request which ask the hub to reset the port

• Port reset within 10 ms• Reset means D+ and D- ‘0’• Other USB device may not be affected

Set_Port_Status REQ

Page 39: USB Universal Serial Bus

6.HOST CHECKS FULL SPEED DEVICE SUPPORTS HIGH SPEED

• If the device supports High speed after reset It will send chirp “K”

• A high speed capable hub detects the chirp and responds with a series of alternating chirp “J” &” K”.

• Device detects KJKJ..removes full speed pull up, enumeration starts at high speed.

• If the Hub is not responding continues at full speed

Page 40: USB Universal Serial Bus

7.HUB ESTABLISHES A SIGNAL PATH B/W DEVICE AND BUS

• Verification of reset state by sending Get_Port_Status request

• Hub removes the reset Default state• USB registers are at reset state, Device is

ready for control transfer with endpoint 0.• Device communicates to host using Default

address 00h.• Can draw up to 100mA.

Get_Port_Status REQ

Page 41: USB Universal Serial Bus

8.HOST SEND GET_DISCRIPTOR TO LEARN PACKET SIZE OF THE DEFAULT PIPE.

• Host sends request to device address endpoint 0

• Enumeration of only one device at a time; one device will respond if multiple devices.

• 8Th byte of the device descriptor contains maximum packet size supported by endpoint 0.

• After receiving one packet ,OS requests 64 bytes.

• Host begins status stage transfer

Page 42: USB Universal Serial Bus

9.HOST ASSIGNS ADDRESS TO THE DEVICE

• Host assigns a unique address to the device by sending a set_Address request.

• The device completes status stage of request using default address-Implementation of new address.

• Address is valid until the device is detached, port is reset, system reboots.

• Next enumeration new address.

Set_Address

Page 43: USB Universal Serial Bus

10.HOST LEARNS ABOUT THE DEVCIE ABILITY

• To read device descriptor Host sends get_Discriptor request

• Request for the configuration descriptor

Page 44: USB Universal Serial Bus

11.THE HOST ASSIGNS & LOADS DEVICE DRIVER

• Tries to match PC,INF files with vendor ID, Product ID &release No retrieved from device

• If no match windows look class, subclass & protocol values from device. If no match user has to browse it externally.

• If already enumerated windows look registry file instead of .INF file

• Once the driver is obtained it is installed. After installation driver may request the device to resend descriptors or other class descriptors.

Page 45: USB Universal Serial Bus

12.THE HOST DEVICE DRIVER SELECTS A CONFIGURATION

• Device driver request configuration by sending set configuration request .

• The device reads the request and enables the requested configuration.

• The device is in the configured states and interfaces are enabled.

Page 46: USB Universal Serial Bus
Page 47: USB Universal Serial Bus

Thank you!!