Serial Port Complete - Latest Microcontroller projects

(lily) #1

Chapter 14


data periodically. USB virtual COM-port devices use interrupt transfers to send
status information to the host. Isochronous transfers have guaranteed delivery
time but no error correcting. Real-time audio uses isochronous transfers. With
driver support, USB virtual COM-port devices can use isochronous transfers
for COM-port data in place of bulk transfers.

1  


Each USB transfer consists of one or more transactions (Table 14-2). Each
transaction contains a token packet, a data packet, and a handshake packet. (An
exception is isochronous transfers, which don’t have handshake packets.) Each
packet begins with a packet ID (PID). The function of the PID varies with the
packet type.
The token packet contains the device address and the endpoint number the
transaction is directed to. The token packet’s PID identifies the type of packet:
SETUP (the first packet in a control transfer), OUT (other host-to-device
packet), IN (device-to-host packet), or SOF (start-of-frame marker).
The data packet contains any data the host or device is sending in the transac-
tion. For control transfers, the transfer’s stage and the specific request determine
who sends the data. For other transfers, the endpoint’s direction determines
who sends the data. The PID contains the data-toggle value, explained below.
The receiver of the data packet (or the device if there is no data packet) sends
the handshake packet. The PID contains a code to indicate the status of the
transaction. ACK means success. NAK on an IN transaction means the device
has no data to send. NAK on an OUT transaction means the device was too
busy to accept the data sent. (The host can try again later.) STALL means the
device doesn’t support a received request in a control transfer or the endpoint’s

Table 14-1: Each of USB’s four transfer types suit different uses.


+ 
+!

1 


9
 

Control Three stages (Setup, Data, Status). Enumeration. Set and get serial-port
parameters. Set serial-port control
signals.
Interrupt Guaranteed maximum latency. Status information.
Bulk Fastest on an otherwise idle bus. COM-port data.
Isochronous Guaranteed transfer rate but no error
detecting.

COM-port data (requires driver
support from vendor).
Free download pdf