Protocol Layer - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

Protocol Layer

Description:

Is defined for IN, SETUP, OUTPUT and PING token. Device Endpoint: ... For OUT, SETUP. Identify the endpoint that will receive the subsequent Data packet ... – PowerPoint PPT presentation

Number of Views:93
Avg rating:3.0/5.0
Slides: 30
Provided by: jerry66
Category:
Tags: layer | protocol | setup

less

Transcript and Presenter's Notes

Title: Protocol Layer


1
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

2
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

3
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 Address0 Byte0
  • Base Address1 Byte1
  • Base Address2 Byte2
  • Base Address3 Byte3
  • Big Endian
  • Will be arrange in memory as follows
  • Base Address0 Byte3
  • Base Address1 Byte2
  • Base Address2 Byte1
  • Base Address3 Byte0

4
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

5
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

6
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

7
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

8
PID Types
9
Address 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
  • Either the source or destination of a data
    packet, depending on the value of the token PID
  • 128 addresses are specified as ADDRlt60gt
  • 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
  • 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

12
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

13
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

14
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

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

16
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

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
  • 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

18
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

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)
  • 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

23
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

24
Start-Split (SSPLIT) Transaction Token
  • 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
  • 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

27
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

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

29
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
Write a Comment
User Comments (0)
About PowerShow.com