
Communication Processor Module
MOTOROLA
MPC823 USER’S MANUAL
16-349
USB
COMMUNICATION
16
PROCESSOR
MODULE
16.10.4.2 IN TOKEN. To guarantee data transfer, the control software must preload the
endpoint FIFO with a data packet prior to receiving an IN token. The software should set up
the endpoint transmit buffer descriptor table and set the STR bit in the USB command
register. The USB controller will fill the transmit FIFO and wait until it receives the IN token.
Once it is received, transmission begins.
If data is not ready in the transmit FIFO or if the THS field in the endpoint’s configuration
register is set to respond with NAK, a NAK handshake is returned. If the THS field in the
endpoint’s configuration register is set to respond with STALL, a STALL handshake is
returned. When the end of the current buffer descriptor has been reached and the last buffer
in the packet bit is set, the CRC is appended. Following the transmission of a frame, the USB
controller waits for a handshake packet, depending on the configuration of the endpoint. If
the host fails to acknowledge the packet, the timeout status bit will be set in the buffer
descriptor. It is your responsibility to program the driver software to set the proper
DATA0/DATA1 PID in the transmitted packet.
16.10.4.3 SETUP TOKEN. Setup transactions are similar in format to an OUT token, but
you should use a SETUP rather than an OUT PID. A SETUP token is only recognized by an
endpoint that is configured as a control endpoint. Once the SETUP token is received, setup
data reception begins. The USB controller fetches the next buffer descriptor associated with
the endpoint, and if it is empty, starts transferring the incoming packet to the buffer
descriptor’s associated data buffer. When the data buffer has been filled, the USB controller
clears the E bit in the buffer descriptor and generates an interrupt if the I bit in the buffer
descriptor is set. If the incoming packet exceeds the length of the data buffer, the USB
controller fetches the next buffer descriptor in the table and, if it is empty, continues
transferring the rest of the packet to this buffer descriptor’s associated buffer. If it is full, an
error occurs. The entire data packet including the DATA0 PID are written to the receive
buffers. If the packet was received error-free (no CRC errors and no bit stuff error) an ACK
handshake will be transmitted to the host. If a reception error occurred, no handshake
packet will be returned and the error status bits will be set in the last buffer descriptor
associated with this packet.
Table 16-33. USB In Token Reception
DATA PACKET
CORRUPTED
USEP
x
THS FIELD
HANDSHAKE
SENT TO HOST
Yes
N/A
None (Data Discarded)
No
00 (Normal)
ACK
No
01 (Ignore)
None
No
10 (NAK)
NAK
No
11 (STALL)
STALL