Functional Description
1680
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
Universal Serial Bus (USB) Controller
These USB interfaces can be used to simultaneously schedule as many as seven independent OUT and
seven independent IN transactions to any endpoints on any device. The IN and OUT controls are paired in
three sets of registers. However, they can be configured to communicate with different types of endpoints
and different endpoints on devices. For example, the first pair of endpoint controls can be split so that the
OUT portion is communicating with a bulk OUT endpoint 1 of a device, while the IN portion is
communicating with an interrupt IN endpoint 2 of a device.
Before accessing any device, whether for point-to-point communications or for communications through a
hub, the relevant USB Receive Functional Address Endpoint n (USBRXFUNCADDRn) or USB Transmit
Functional Address Endpoint n (USBTXFUNCADDRn) registers must be set for each receive or transmit
endpoint to record the address of the device being accessed.
The USB controller also supports connections to devices through a USB hub by providing a register that
specifies the hub address and port of each USB transfer. The FIFO address and size are customizable
and can be specified for each USB IN and OUT transfer. Customization includes allowing one FIFO per
transaction, sharing a FIFO across transactions, and allowing for double-buffered FIFOs.
27.3.2.2 IN Transactions as a Host
IN transactions are handled in a similar manner to the way in which OUT transactions are handled when
the USB controller is in device mode except that the transaction first must be initiated by setting the
REQPKT bit in the USBCSRL0 register, indicating to the transaction scheduler that there is an active
transaction on this endpoint. The transaction scheduler then sends an IN token to the target device. When
the packet is received and placed in the receive FIFO, the RXRDY bit in the USBCSRL0 register is set,
and the appropriate receive endpoint interrupt is signaled to indicate that a packet can now be unloaded
from the FIFO.
When the packet has been unloaded, RXRDY must be cleared. The AUTOCL bit in the USBRXCSRHn
register can be used to have RXRDY automatically cleared when a maximum-sized packet has been
unloaded from the FIFO. The AUTORQ bit in USBRXCSRHn causes the REQPKT bit to be automatically
set when the RXRDY bit is cleared. The AUTOCL and AUTORQ bits can be used with USB DMA
accesses to perform complete bulk transfers without main processor intervention. When the RXRDY bit is
cleared, the controller sends an acknowledge to the device. When there is a known number of packets to
be transferred, the USB Request Packet Count in Block Transfer Endpoint n (USBRQPKTCOUNTn)
register associated with the endpoint should be configured to the number of packets to be transferred. The
USB controller decrements the value in the USBRQPKTCOUNTn register following each request. When
the USBRQPKTCOUNTn value decrements to 0, the AUTORQ bit is cleared to prevent any further
transactions being attempted. For cases where the size of the transfer is unknown, USBRQPKTCOUNTn
should be cleared. AUTORQ then remains set until cleared by the reception of a short packet (that is, less
than the MAXLOAD value in the USBRXMAXPn register) such as may occur at the end of a bulk transfer.
If the device responds to a bulk or interrupt IN token with a NAK, the USB host controller keeps retrying
the transaction until any NAK Limit that has been set has been reached. If the target device responds with
a STALL, however, the USB host controller does not retry the transaction but sets the STALLED bit in the
USBCSRL0 register. If the target device does not respond to the IN token within the required time, or the
packet contained a CRC or bit-stuff error, the USB host controller retries the transaction. If after three
attempts the target device has still not responded, the USB host controller clears the REQPKT bit and sets
the ERROR bit in the USBCSRL0 register.
27.3.2.3 OUT Transactions as a Host
OUT transactions are handled in a similar manner to the way in which IN transactions are handled when
the USB controller is in device mode. The TXRDY bit in the USBTXCSRLn register must be set as each
packet is loaded into the transmit FIFO. Again, setting the AUTOSET bit in the USBTXCSRHn register
automatically sets TXRDY when a maximum-sized packet has been loaded into the FIFO. Furthermore,
AUTOSET can be used with the USB DMA controller to perform complete bulk transfers without software
intervention.