Functional Description
1677
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
Universal Serial Bus (USB) Controller
27.3.1.4 Scheduling
The device has no control over the scheduling of transactions as scheduling is determined by the host
controller. The USB controller can set up a transaction at any time. The USB controller waits for the
request from the host controller and generates an interrupt when the transaction is complete or if it was
terminated due to some error. If the host controller makes a request and the device controller is not ready,
the USB controller sends a busy response (NAK) to all requests until it is ready.
27.3.1.5 Additional Actions
The USB controller responds automatically to certain conditions on the USB bus or actions by the host
controller such as when the USB controller automatically stalls a control transfer or unexpected zero
length OUT data packets.
27.3.1.5.1 Stalled Control Transfer
The USB controller automatically issues a STALL handshake to a control transfer under the following
conditions:
1. The host sends more data during an OUT data phase of a control transfer than was specified in the
device request during the SETUP phase. This condition is detected by the USB controller when the
host sends an OUT token (instead of an IN token) after the last OUT packet has been unloaded and
the DATAEND bit in the USB Control and Status Endpoint 0 Low (USBCSRL0) register has been set.
2. The host requests more data during an IN data phase of a control transfer than was specified in the
device request during the SETUP phase. This condition is detected by the USB controller when the
host sends an IN token (instead of an OUT token) after the CPU has cleared TXRDY and set
DATAEND in response to the ACK issued by the host to what should have been the last packet.
3. The host sends more than USBRXMAXPn bytes of data with an OUT data token.
4. The host sends more than a zero length data packet for the OUT STATUS phase.
27.3.1.5.2 Zero Length OUT Data Packets
A zero-length OUT data packet is used to indicate the end of a control transfer. In normal operation, such
packets should only be received after the entire length of the device request has been transferred.
However, if the host sends a zero-length OUT data packet before the entire length of device request has
been transferred, it is signaling the premature end of the transfer. In this case, the USB controller
automatically flushes any IN token ready for the data phase from the FIFO and sets the DATAEND bit in
the USBCSRL0 register.
27.3.1.5.3 Setting the Device Address
When a host is attempting to enumerate the USB device, it requests that the device change its address
from zero to some other value. The address is changed by writing the value that the host requested to the
USB Device Functional Address (USBFADDR) register. However, care should be taken when writing to
USBFADDR to avoid changing the address before the transaction is complete. This register should only
be set after the SET_ADDRESS command is complete. Like all control transactions, the transaction is
only complete after the device has left the STATUS phase. In the case of a SET_ADDRESS command,
the transaction is completed by responding to the IN request from the host with a zero-byte packet. Once
the device has responded to the IN request, the USBFADDR register should be programmed to the new
value as soon as possible to avoid missing any new commands sent to the new address.
NOTE:
If the USBFADDR register is set to the new value as soon as the device receives the OUT
transaction with the SET_ADDRESS command in the packet, it changes the address during
the control transfer. In this case, the device does not receive the IN request that allows the
USB transaction to exit the STATUS phase of the control transfer because it is sent to the
old address. As a result, the host does not get a response to the IN request, and the host
fails to enumerate the device.