Protocol Layer Bottom-up view of the USB protocol – Byte/Bit Ordering – SYNC Field – Packet Field Formats PID Field Address Field Frame Number Field Data Field CRC – Packet Formats Token Packets Split Transaction Special Token Packets Start-of-Frame Packets Data Packets Handshake Packets Byte/Bit Ordering Bits are sent onto the bus – LSB first, MSB last Multiple bytes are interpreted – Little endian order, i.e., LSB to MSB Endian Order 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 – Will be arranged in memory as follows Base Base Base Base Big Endian Address+0 Byte0 Address+1 Byte1 Address+2 Byte2 Address+3 Byte3 – Will be arrange in memory as follows Base Base Base Base Address+0 Byte3 Address+1 Byte2 Address+2 Byte1 Address+3 Byte0 SYNC Field Synchronization field All packets begin with SYNC field Align incoming data with the local clock Length – 8 bits for full/low speed – 32 bits for high speed Serves only synchronization mechanism The last two bits are a marker of the end of the SYNC field Packet Field Formats Field formats for – Token packets – Data packets – Handshake packets SOP / EOP – All packets have distinct Start-Of-Packet (SOP) and End-Of-Packet (EOP) delimiters PID (Packet IDentifier Field) Immediately follows the SYNC field of every USB packets Indicates the type of packet A PID consists of – 4 bits packet type field Packet format, error type – 4 bits check field Complements of the their respective packet identifier bits PID (Packet IDentifier Field) 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 Valid PID for a transaction but does not support, the function must not respond – IN-only endpoint must ignore an OUT token PID Types Address Fields Function endpoints are addressed using two fields – The function ADDRess field (ADDR) – The ENDPoint field (ENDP) Address Field (ADDR) Specifies the function via its address Either the source or destination of a data packet, depending on the value of the token PID 128 addresses are specified as ADDR<6:0> Function address zero is reserved as the default address Endpoint Field (ENDP) More flexible addressing of functions in which more than one endpoint is required Is defined for IN, SETUP, OUTPUT and PING token 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 Frame Number Field 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 Data Field Data packet size varies with the transfer type May range from zero to 1,024 bytes Data bits within each bytes are shifted out LSB first CRC-Cyclic Redundancy Checks 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 Packet Formats Token packets Data packets Handshake packets Token Packets PID – IN, OUT, or SETUP ADDR / ENDP – For OUT, SETUP Identify the endpoint that will receive the subsequent Data packet – For IN Identify which endpoint transmit a Data packet – For PING Identify which endpoint will respond with a handshake packet A five bit CRC that covers that address and endpoint fields 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 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 Split Transaction Special Token Packets SPLIT – A special token for split transaction – 4 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 – Start SPLIT transaction – Complete SPLIT transaction Packets in a split Transaction Relationship of Interrupt IN Transaction to High-speed Split Transaction Relationship of Interrupt OUT Transaction to High-speed Split OUT Transaction Start-Split (SSPLIT) Transaction Token SC (Start/Complete) – Zero indicates that this is a start-split transaction (SSPLIT) Port – The port number of the target hub for which this full/low speed transaction is destined Start-Split (SSPLIT) Transaction Token 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 Start-Split (SSPLIT) Transaction Token ET (Endpoint Type) – Tells the hub which split transaction state machine to use for this full/low speed transaction Complete-Split Transaction Token A SPLIT special token packet with the SC field set to one U: reserved/unused and must be reset to zero 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 USB Frames and Microframes A full speed 1 ms 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 Data Packets Four types of data packets – DATA0, DATA1, DATA2, MDATA Handshake Packets Used to report the status of a data transaction 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 – Unable to accept data from the host (OUT) or has no data to transmit to the host (IN) STALL – Unable to transmit or receive data or a control pipe request is not supported NYET and ERR – High speed only handshake
© Copyright 2026 Paperzz