
21-44
MC68SZ328 Reference Manual
MOTOROLA
USB Device Module
21.8.2.2.1 Control Transfers
The USB host sends commands to the device via control transfers. Control transfers can be addressed to
any control endpoint. Control transfers consist of up to three distinct phases: a setup phase, an optional data
phase, and a status phase. Command processing occurs in the following order:
1. Receive the SETUP packet on the control endpoint. The DEVREQ and EOF interrupts assert
for that endpoint.
2. Read 8 bytes of the setup packet from the appropriate FIFO data register and decode the
command.
3. Clear the EOF and DEVREQ interrupts.
4. Set up and perform the data transfer if a data transfer is implied by the command. Be careful
not to send back more bytes to the USB host than were requested in the wLength field of
the SETUP packet. The hardware does not check for an incorrect data phase length. The
EOT interrupt will assert on completion of the data phase.
5. Assert the CMD_OVER/CMD_ERROR bits to indicate processing or error status. The
UDC module will generate appropriate handshakes on the USB to implement the status
phase. CMD_OVER automatically clears at the end of the status phase.
6. Wait for CMD_OVER to clear, indicating that the device request has completed.
The USB device module assumes that the UDC module will handle most of the standard requests without
software intervention. User software does not need to handle any of the so-called “Chapter 9” requests
listed in the USB specification, except for SYNCH_FRAME, GET_DESCRIPTOR, and
SET_DESCRIPTOR. The requests are passed through endpoint 0 as a device request and must be
processed by the device driver software
21.8.2.2.2 Bulk Traffic
Bulk traffic guarantees the error-free delivery of data in the order that it was sent, but the rate of transfer is
not guaranteed. Bandwidth is allocated to bulk, interrupt, and control packets based on the bandwidth
usage policy of the USB host.
BULK OUT
— Internal logic marks the start of the packet location in the FIFO for OUT transfers (from host to
device). If an error occurs in a transfer, the logic forces the FIFO to back up to the start of the
current packet and try again. No software intervention is required to handle packet retries.
— User software reads packets from the FIFOs as they appear and stops when an EOT interrupt is
received. To enable further data transfers, software services and clears the pending interrupts
(EOF or EOT) and then waits for the next transfer to begin. For a Bulk Out endpoint, until the
CPU has serviced the EOT interrupt, the device will NAK any further requests to that endpoint
from the host. This guarantees that data from two different transfers will never be intermixed
within the FIFO.
BULK IN
— Software tags the last byte in a packet to mark the end of the frame for IN transfers (from device
to host). If an error occurs in a transfer, the hardware automatically forces the FIFO to back up
to the start of the current packet and resend the data. User software is expected to write data to
the FIFO data register in units of the associated endpoint’s maximum packet size. The end of
frame may be indicated via the WFR bit in the endpoint FIFO control register
(USB_EPN_FCTRL) or via the End of Frame tag signal from the DMA controller.
— In the USB protocol, the last packet in a transfer is allowed to be short (smaller than the
endpoint’s maximum packet size) or even of zero length. In order to indicate a zero-length
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
..
.