Serial Port Complete - Latest Microcontroller projects

(lily) #1
Inside USB

Halt feature is set. High-speed bulk OUT endpoints can also return a NYET
handshake code, which means that the endpoint accepted the data in the cur-
rent transaction but isn’t yet ready for more data.

1
$
1 


The data toggle is a data-sequencing value that guards against lost or duplicated
data. If you’re debugging a device where it appears that the proper data is trans-
mitting on the bus but the receiver is discarding the data, chances are good that
the device isn’t sending or expecting the correct data toggle.
Each endpoint address maintains its own data-toggle value, which alternates
between DATA0 and DATA1. Devices typically store the value in a register bit.
When the host configures a device on power up or attachment, the host and
device each set their data toggles to DATA0. On detecting an incoming data
packet, the host or device compares the state of its data toggle with the data tog-
gle in the received data packet. If the values match, the data packet’s receiver
toggles its value for the next transaction and returns an ACK. On receiving the
ACK, the data packet’s sender toggles its value for the next transaction.
The next received packet should contain a data toggle of DATA1, and again the
receiver toggles its bit and returns an ACK. In additional transactions, the data
toggle continues to alternate between DATA0 and DATA1. An exception is
control transfers, where the Status stage always uses DATA1.
If the receiver is busy and returns a NAK, or if the receiver detects corrupted
data and returns no response, the sender doesn’t toggle its bit and tries again
with the same data and data toggle.

Table 14-2: Transactions that carry control-transfer requests and other data contain
token, data, and handshake packets.


7
+!     
Token Device address, endpoint
number and direction,
transaction type

Host

Data Transaction-specific data.
Not used in some
transactions.

Host or device

Handshake Status code In transactions with a data packet, the receiver of
the data packet.
In transactions with no data packet, the device.
Not used in isochronous transactions.
Free download pdf