Presentation is loading. Please wait.

Presentation is loading. Please wait.

Protocol Layer Bottom-up view of the USB protocol Bottom-up view of the USB protocol –Byte/Bit Ordering –SYNC Field –Packet Field Formats PID Field PID.

Similar presentations


Presentation on theme: "Protocol Layer Bottom-up view of the USB protocol Bottom-up view of the USB protocol –Byte/Bit Ordering –SYNC Field –Packet Field Formats PID Field PID."— Presentation transcript:

1 Protocol Layer Bottom-up view of the USB protocol Bottom-up view of the USB protocol –Byte/Bit Ordering –SYNC Field –Packet Field Formats PID Field PID Field Address Field Address Field Frame Number Field Frame Number Field Data Field Data Field CRC CRC –Packet Formats Token Packets Token Packets Split Transaction Special Token Packets Split Transaction Special Token Packets Start-of-Frame Packets Start-of-Frame Packets Data Packets Data Packets Handshake Packets Handshake Packets

2 Byte/Bit Ordering Bits are sent onto the bus Bits are sent onto the bus –LSB first, MSB last Multiple bytes are interpreted Multiple bytes are interpreted –Little endian order, i.e., LSB to MSB

3 Endian Order Little Endian Little Endian –The low-order byte of the number is stored in memory at the lowest address, and the high-order byte at the highest address (The little end comes first) –Example, a 4 byte Long Int Byte3 Byte2 Byte1 Byte0 Byte3 Byte2 Byte1 Byte0 –Will be arranged in memory as follows Base Address+0 Byte0 Base Address+0 Byte0 Base Address+1 Byte1 Base Address+1 Byte1 Base Address+2 Byte2 Base Address+2 Byte2 Base Address+3 Byte3 Base Address+3 Byte3 Big Endian Big Endian –Will be arrange in memory as follows Base Address+0 Byte3 Base Address+0 Byte3 Base Address+1 Byte2 Base Address+1 Byte2 Base Address+2 Byte1 Base Address+2 Byte1 Base Address+3 Byte0 Base Address+3 Byte0

4 SYNC Field Synchronization field Synchronization field All packets begin with SYNC field All packets begin with SYNC field Align incoming data with the local clock Align incoming data with the local clock Length Length –8 bits for full/low speed –32 bits for high speed Serves only synchronization mechanism Serves only synchronization mechanism The last two bits are a marker of the end of the SYNC field The last two bits are a marker of the end of the SYNC field

5 Packet Field Formats Field formats for Field formats for –Token packets –Data packets –Handshake packets SOP / EOP SOP / EOP –All packets have distinct Start-Of-Packet (SOP) and End-Of-Packet (EOP) delimiters

6 PID (Packet IDentifier Field) Immediately follows the SYNC field of every USB packets Immediately follows the SYNC field of every USB packets Indicates the type of packet Indicates the type of packet A PID consists of A PID consists of –4 bits packet type field Packet format, error type Packet format, error type –4 bits check field Complements of the their respective packet identifier bits Complements of the their respective packet identifier bits

7 PID (Packet IDentifier Field) The host and all functions must perform a complete decoding of all received PID fields The host and all functions must perform a complete decoding of all received PID fields Any PID received with a failed check field or which decodes to a non-defined value is assumed to be corrupted  ignored by the packet receiver Any PID received with a failed check field or which decodes to a non-defined value is assumed to be corrupted  ignored by the packet receiver Valid PID for a transaction but does not support, the function must not respond Valid PID for a transaction but does not support, the function must not respond –IN-only endpoint must ignore an OUT token

8 PID Types

9 Address Fields Function endpoints are addressed using two fields Function endpoints are addressed using two fields –The function ADDRess field (ADDR) –The ENDPoint field (ENDP)

10 Address Field (ADDR) Specifies the function via its address Specifies the function via its address Either the source or destination of a data packet, depending on the value of the token PID Either the source or destination of a data packet, depending on the value of the token PID 128 addresses are specified as ADDR 128 addresses are specified as ADDR Function address zero is reserved as the default address Function address zero is reserved as the default address

11 Endpoint Field (ENDP) More flexible addressing of functions in which more than one endpoint is required More flexible addressing of functions in which more than one endpoint is required Is defined for IN, SETUP, OUTPUT and PING token Is defined for IN, SETUP, OUTPUT and PING token Device Endpoint: Device Endpoint: –A uniquely addressable portion of a USB device that is the source or sink of information in a communication flow between the host and device

12 Frame Number Field 11-bit field that is incremented by the host on a per-frame basis 11-bit field that is incremented by the host on a per-frame basis Maximum value of 7FFh and rolls over after reaching its maximum value Maximum value of 7FFh and rolls over after reaching its maximum value

13 Data Field Data packet size varies with the transfer type Data packet size varies with the transfer type May range from zero to 1,024 bytes May range from zero to 1,024 bytes Data bits within each bytes are shifted out LSB first Data bits within each bytes are shifted out LSB first

14 CRC-Cyclic Redundancy Checks CRCs are used to protect all non-PID fields in token and data packets CRCs are used to protect all non-PID fields in token and data packets Token and data packet CRCs provide 100% coverage for all single and double bit errors Token and data packet CRCs provide 100% coverage for all single and double bit errors

15 Packet Formats Token packets Token packets Data packets Data packets Handshake packets Handshake packets

16 Token Packets PID PID –IN, OUT, or SETUP ADDR / ENDP ADDR / ENDP –For OUT, SETUP Identify the endpoint that will receive the subsequent Data packet Identify the endpoint that will receive the subsequent Data packet –For IN Identify which endpoint transmit a Data packet Identify which endpoint transmit a Data packet –For PING Identify which endpoint will respond with a handshake packet Identify which endpoint will respond with a handshake packet A five bit CRC that covers that address and endpoint fields A five bit CRC that covers that address and endpoint fields

17 Split Transactions A high speed split transaction is used only between the host controller and a hub when the hub has full/low speed devices attached to it A high speed split transaction is used only between the host controller and a hub when the hub has full/low speed devices attached to it Only defined to be used between the host controller and a hub Only defined to be used between the host controller and a hub No other high speed or full/low speed devices ever use split transactions No other high speed or full/low speed devices ever use split transactions

18 Split Transaction Special Token Packets SPLIT SPLIT –A special token for split transaction –4 byte token packets Other normal 3 byte token packets Other normal 3 byte token packets –Provides additional transaction types with its specific information –Is used to support split transactions between the host controller communicating with a hub operating at high speed with full/low speed devices to some of its downstream facing ports SSPLIT / CSPLIT SSPLIT / CSPLIT –Start SPLIT transaction –Complete SPLIT transaction

19 Packets in a split Transaction

20 Relationship of Interrupt IN Transaction to High-speed Split Transaction

21 Relationship of Interrupt OUT Transaction to High-speed Split OUT Transaction

22 Start-Split (SSPLIT) Transaction Token SC (Start/Complete) SC (Start/Complete) –Zero indicates that this is a start-split transaction (SSPLIT) Port Port –The port number of the target hub for which this full/low speed transaction is destined

23 Start-Split (SSPLIT) Transaction Token For full-speed isochronous OUT start-splits, For full-speed isochronous OUT start-splits, –S and E fields specify how the high speed data payload corresponds to data for a full-speed data packet as show in this table –Allow the hub to detect various error cases due to lack of receiving start-split transactions

24 Start-Split (SSPLIT) Transaction Token ET (Endpoint Type) ET (Endpoint Type) –Tells the hub which split transaction state machine to use for this full/low speed transaction

25 Complete-Split Transaction Token A SPLIT special token packet with the SC field set to one A SPLIT special token packet with the SC field set to one U: reserved/unused and must be reset to zero U: reserved/unused and must be reset to zero

26 Start-of-Frame Packets Start-of-Frame (SOF) packets are issued by the host at a nominal rate of once every 1 ms for full-speed bus and 125 μs for a high-speed bus Start-of-Frame (SOF) packets are issued by the host at a nominal rate of once every 1 ms for full-speed bus and 125 μs for a high-speed bus

27 USB Frames and Microframes A full speed 1 ms frame time A full speed 1 ms frame time A high speed microframe with a 125 μs frame time A high speed microframe with a 125 μs frame time High speed devices see an SOF packet with the same frame number each times during each 1 ms period High speed devices see an SOF packet with the same frame number each times during each 1 ms period

28 Data Packets Four types of data packets Four types of data packets –DATA0, DATA1, DATA2, MDATA

29 Handshake Packets Used to report the status of a data transaction Used to report the status of a data transaction ACK ACK –The data packet was received without bit stuff or CRC errors over the data field and that the data PID was received correctly NAK NAK –Unable to accept data from the host (OUT) or has no data to transmit to the host (IN) STALL STALL –Unable to transmit or receive data or a control pipe request is not supported NYET and ERR NYET and ERR –High speed only handshake


Download ppt "Protocol Layer Bottom-up view of the USB protocol Bottom-up view of the USB protocol –Byte/Bit Ordering –SYNC Field –Packet Field Formats PID Field PID."

Similar presentations


Ads by Google