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

Chapter 8: Error Recovery

Figure 8-4: IN Transaction With Data Toggle Sequence and No Errors

Transaction 1

Host

 

 

1

0

1

4

 

5

 

 

 

6

Target

IN Token

2

 

 

DATA0

3

0

1

 

 

 

 

 

8

ACK Handshake

7

 

 

Transaction 2

Host

 

 

1

1

0

4

 

 

5

 

 

 

6

 

 

Target

IN Token

2

 

DATA1

3

1 0

 

 

8

ACK Handshake

7

 

Data Toggle Procedure with Data Packet Errors

If data packet errors occur during a transfer, the toggle bits are not incremented by either the host or target devices. The following sections describe the operation of data toggle when data packet errors occur.

179

USB System Architecture

Data Toggle and Data Packet Errors — OUT Transactions

Figure 8-5 on page 180 illustrates a sequence of packet transfers during consecutive OUT transactions. During the first transaction, a data packet error occurs.

Figure 8-5: OUT Transaction With Data Toggle and Data Packet Errors

Transaction 1

+RVW

 

 

 

7DUJHW

 

 

 

OUT Token

 

 

 

0

0

 

DATA0

 

0

0

 

 

 

 

 

 

 

 

 

 

1R KDQGVKDNH SDFNHW LV UHWXUQHG GXH WR WKH GDWD SDFNHW HUURU

Transaction 2 - Retry

+RVW

 

 

 

7DUJHW

 

 

OUT Token

 

 

0 1

 

DATA0

 

0 1

 

 

 

 

 

 

 

ACK Handsh

 

a

180

Chapter 8: Error Recovery

The actions taken by the host and target are as follows:

Transaction 1

1.An OUT packet is transmitted by the host.

2.The target receives the packet without errors.

3.The host transmits data using DATA0 packet (consistent with its toggle bit).

4.Packet errors are encountered when the target receives the DATA0 packet.

5.Having detected errors in the data packet, the target device ignores the packet. Data is discarded and no handshake packet is sent to the host. Since the data packet was not received correctly, the toggle bit remains unchanged.

6.The host awaits the return of the handshake packet but gets no reply. After the bus time-out period (16 bit times), the host detects no response and recognizes that the data packet transfer was not successful. The toggle bit remains unchanged and the host must retry the transaction later.

Transaction 2 — the retry

1.The host transmits an OUT token to the target device.

2.The target device receives the token without any packet errors.

3.The host then retransmits the DATA0 packet (consistent with its toggle bit) that failed during the previous transaction.

4.The target successfully receives data packet zero, which matches the toggle bit.

5.This time, having received DATA0 without errors, the target toggles the bit to one.

6.The target then transmits an ACK handshake packet to inform the host that data was received without error.

7.The host receives the ACK packet without error.

8.Having successfully received the ACK packet, the host transitions its toggle bit to one.

The host and the target remain synchronized even though the data transfer was corrupted.

181

USB System Architecture

Data Toggle and Data Packet Errors — IN Transactions

Figure 8-6 on page 182 illustrates a sequence of packet transfers during consecutive IN transactions. In this example the IN transaction incurs a data packet error.

Figure 8-6: IN Transaction With Data Toggle and Data Packet Errors

Transaction 1

Host

 

 

 

Target

 

1

IN Token

2

 

0 0

4

DATA0

3

0 0

5

 

 

 

6

1R KDQGVKDNH SDFNHW LV UHWXUQHG GXH WR WKH GDWD SDFNHW HU U R U

Transaction 2 - Retry

Host

 

 

 

Target

 

1

IN Token

2

 

0 1

4

DATA0

3

0 1

5

 

 

 

8

 

6

ACK Handshake

7

 

The actions taken by the host and target are as follows:

Transaction 1

1.An IN packet is transmitted by the host.

2.The target receives the packet without errors.

3.The target returns data via the DATA0 packet (consistent with its toggle bit).

182

Chapter 8: Error Recovery

4.Packet errors are encountered by the host when it receives the DATA0 packet.

5.Having detected errors in the data packet, the host ignores the packet. Data is discarded and no handshake packet is returned to the target. Since the data packet was received with errors, the toggle bit remains unchanged.

6.The target awaits the return of the handshake packet but gets no reply from the host. After the bus time-out period (16 bit times), the target detects no response and recognizes that the data packet transfer was not successful. The target’s toggle bit remains unchanged and the host must retry the transaction later.

Transaction 2 — the retry

1.The host once again transmits the OUT token to the target device.

2.The target device receives the token without any packet errors.

3.The target then retransmits the DATA0 packet (consistent with its toggle bit), knowing that data was not received by the host during the previous transaction.

4.This time the host successfully receives data packet zero, which matches the toggle bit.

5.Having received DATA0 without errors, the host toggles the bit to one.

6.The host then transmits an ACK handshake packet to inform the target that data was received without error.

7.The target receives the ACK packet without error.

8.Having successfully received the ACK packet, the target transitions its toggle bit to one.

The host and the target maintain their synchronization, and the retry ensures that data is not lost.

Data Toggle Procedure With Handshake Packet

Errors

The previous discussions of data toggle describe the actions taken by the host and target when either no packet errors occur or when data packet errors occur. While it’s important that the host and target toggle bits remain synchronized, the error recovery mechanism does not require the use of the data toggle bits. However, when errors occur during the handshake phase, the host and target become de-synchronized, and data loss would occur without the use of the data toggle mechanism.

183

USB System Architecture

Data Toggle and Handshake Errors — OUTTransactions

Figure 8-7 on page 184 illustrates an OUT transaction that fails due to an ACK packet error.

Figure 8-7: OUT Transaction With Data Toggle and Handshake Errors

Transaction 1

+RVW

 

 

 

7DUJHW

 

 

 

287 7RNHQ

 

 

 

0

0

 

'$7$

 

0

1

 

 

 

 

 

 

 

 

 

 

 

 

 

$&. +DQGVK

D

 

 

(Handshake Corrupted)

Transaction 2 - Retry

+RVW

 

 

 

7DUJHW

 

 

287 7RNHQ

 

 

0 1

 

'$7$

 

1 1

 

 

 

 

 

 

 

$&. +DQGVK

 

D

184

Chapter 8: Error Recovery

The sequence of events that occur in detecting and recovering from the error is enumerated below:

Transaction 1

1.The host transmits an OUT token to the target device.

2.The target device receives the token without any packet errors.

3.The host then transmits a DATA0 packet (consistent with its toggle bit) to the target device.

4.The target receives data packet zero, which matches the toggle bit.

5.Having successfully received the DATA0 packet, the toggle bit transitions to one.

6.The target transmits an ACK handshake packet to inform the host that data was received without error.

7.The host receives the ACK packet with errors.

8.Since errors are detected by the host, it cannot verify that the target has successfully received the data. Thus, the host leaves the toggle bit unchanged (zero). The host presumes that the target did not receive the data and therefore initiates a retry.

Transaction 2 — the retry

1.The host transmits the OUT token to the target.

2.The target device receives the packet without errors.

3.The host retransmits the DATA0 packet (consistent with the state of its toggle bit).

4.The target receives the packet without error, but DATA0 does not match the state of its toggle bit.

5.The target recognizes that it is out of sync with the host and therefore discards the data and leaves the toggle bit unchanged (one).

6.The target transmits an ACK handshake packet to inform the host that data was received without error. This is because the host apparently did not receive the previous ACK handshake.

7.The host receives the ACK packet without error.

8.Having successfully received the ACK packet, the host transitions the toggle bit to a one. The host and target are now ready to proceed to the next transaction.

The host and target temporarily disagreed on whether the data had actually been completed. However, the data toggle mechanism ensures that the de-syn- chronization is detected and permits re-synchronization.

185

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