Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
USB System Architecture (USB 2.0).pdf
Скачиваний:
172
Добавлен:
03.05.2015
Размер:
7.03 Mб
Скачать

USB System Architecture

Data Packets — DATA0 and Data1

Data packets carry the data payload associated with a given transaction. Direction of a data packet transfer is specified by the transaction type and may be used to transfer data either to or from a target USB device as listed in Table 7-2 below.

Table 7-2: Direction of Data Packets

Transaction Type

Direction of Data Packet

 

 

 

 

IN transaction

from USB device

 

 

OUT transaction

to USB device

 

 

SETUP transaction

to USB device

 

 

Two types of data packets (DATA0 and DATA1) are defined to support synchronization of long transfers between the sender and receiver. For example, if a long transfer is being sent from the host to a printer, the transfer will be performed in small blocks, usually over large number of frames. To verify that a data transaction is not missed during a long transfer, a technique called data toggle can be employed. For a detailed discussion of data toggle see “Data Toggle Errors” on page 175.

The format of DATA0 packets is illustrated in Figure 7-11, and the format for the DATA1 packet is illustrated in Figure 7-12. The maximum packet size is specified as 1023 bytes for isochronous transactions. Other transfer types are limited to a maximum of 64 bytes of data in each packet.

 

Figure 7-11: DATA0 Packet Format

 

 

 

CRC

 

 

msb

lsb

 

 

CRC1

CR5

C

Idle

Sync

 

EOP

152

Chapter 7: Packets & Transactions

 

Figure 7-12: DATA1 Packet Format

 

 

 

CRC

 

msb

lsb

 

CRC15 CRC0

Idle

Sync

EOP

The maximum data field size for the DATA1 packet is shown to be 1023 bytes in Figure 7-12. This large packet size is only possible if DATA1 is used when transferring data to or from an isochronous endpoint. However, the specification states that isochronous transactions “should” use only DATA0 packets but that the host must accept DATA1 packets associated with isochronous IN transfers. If implementers of all isochronous devices follow the recommendation of the specification, then all DATA1 packets will be limited to a maximum data payload of 64 bytes.

Handshake Packets

USB devices use handshake packets to report the completion status of a given transaction. The receiver of the data payload (either the target device or the root hub) is responsible for sending a handshake packet back to the sender. Three possible results can be reported via different handshake packets:

Acknowledge packet (ACK) — this acknowledges error-free receipt of the data packet.

No Acknowledge packet (NAK) — reports to the host that the target is temporarily unable to accept or return data. During interrupt transactions NAK signifies that no data is currently available to return to the host (i.e., no interrupt request is currently pending).

Stall packet (STALL) — used by the target to report that it is unable to complete the transfer and that software intervention will be required for the device to recover from the stall condition.

The handshake packets are illustrated in Figure 7-13.

153

USB System Architecture

Figure 7-13: Handshake Packet Formats

 

 

 

 

 

 

 

ACK PID

 

 

 

 

 

 

 

 

 

 

Type Field

 

 

 

Check Field

 

 

 

 

lsb

 

 

msb

 

lsb

0

 

msb

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

1

0

0

 

1

1

1

 

EOP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Idle

Sync

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

NAK PID

 

 

 

 

 

 

 

 

 

 

Type Field

 

 

 

Check Field

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

lsb

 

 

msb

 

lsb

0

 

msb

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0

1

0

1

1

1

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

EOP

Idle

Sync

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

STALL PID

 

 

 

 

 

 

 

 

 

Type Field

 

 

Check Field

 

 

 

 

lsb

 

 

msb

lsb

0

 

msb

 

 

0

1

1

1

1

0

0

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

EOP

Idle

Sync

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Preamble Packet

Hubs disable low-speed ports to block all high-speed transactions from occurring over low-speed cable segments. Prior to broadcasting a low-speed packet, a preamble packet must be broadcast to notify all hubs that a low-speed transaction will follow. Hubs must respond to a preamble packet by enabling their low-speed ports, while all other devices must ignore the preamble packet. The host guarantees that the packet transferred immediately after the preamble

154

Chapter 7: Packets & Transactions

packet will be sent at low speed. All low-speed packets are broadcast across all cable segments, requiring high-speed hub ports to transmit at both low and full speed in the downstream direction. Upstream connectivity is not affected by whether a packet is sent at low or full speed. That is, the hub receivers and upstream transmitters are designed to handle both lowand full-speed packets.

Figure 7-14 illustrates the format of the preamble packet. The preamble packet consists of a synchronization sequence and a packet ID that are transferred at full speed. Following the PID, the host must delay the beginning of the lowspeed packet transfer by inserting four full-speed bit times. This delay gives hubs time to enable their low-speed ports and configure their repeater to accept low-speed signaling. During this delay hubs drive their ports (lowand fullspeed) to the idle state. Note that the preamble packet differs from all other packets in that it does not end with an EOP.

Once the preamble packet and four bit-time delay have completed, a low-speed token packet is sent by the host over the USB, specifying the type of transaction to be performed. The hub once again disables its low-speed ports when it detects the low-speed EOP.

In the event of an IN transaction, the target device returns data at low speed to the host controller. Data returned upstream to hub receiver ports can be either lowor full-speed transactions. In the event of an OUT transaction, the data packet must also be transferred at low speed to the USB device, requiring another preamble packet to be sent directly preceding the data packet.

Low-speed devices can support control and interrupt transfers only, and the data payload size is limited to eight bytes during a transaction.

155

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]