Functional Description
1286
SPRUH22I – April 2012 – Revised November 2019
Copyright © 2012–2019, Texas Instruments Incorporated
M3 Universal Serial Bus (USB) Controller
These USB interfaces can be used to simultaneously schedule as many as 15 independent OUT and 15
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 device’s bulk OUT endpoint 1, while the IN portion is communicating with
a device’s interrupt IN endpoint 2.
Before accessing any device, whether for point-to-point communications or for communications via 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.
18.2.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
μ
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.
18.2.2.2.1 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
μ
DMA controller to perform complete bulk transfers without software
intervention.