Functional Description
1327
SPRUHE8E – October 2012 – Revised November 2019
Copyright © 2012–2019, Texas Instruments Incorporated
M3 Universal Serial Bus (USB) Controller
When the USB OTG controller B device has finished using the bus, the USB controller goes into
SUSPEND mode by setting the SUSPEND bit in the USBPOWER register. The A device detects this and
either terminates the session or reverts to Host mode. If the A device is USB OTG controller, it generates
a disconnect interrupt.
18.2.4 DMA Operation
The USB peripheral provides an interface connected to the
μ
DMA controller with separate channels for
three transmit endpoints and 3 receive endpoints. Software selects which endpoints to service with the
μ
DMA channels using the USB DMA Select (USBDMASEL) register. The
μ
DMA operation of the USB is
enabled through the USBTXCSRHn and USBRXCSRHn registers, for the TX and RX channels
respectively. When
μ
DMA operation is enabled, the USB asserts a
μ
DMA request on the enabled receive
or transmit channel when the associated FIFO can transfer data. When either FIFO can transfer data, the
burst request for that channel is asserted. The
μ
DMA channel must be configured to operate in Basic
mode, and the size of the
μ
DMA transfer must be restricted to whole multiples of the size of the USB
FIFO. Both read and write transfers of the USB FIFOs using
μ
DMA must be configured in this manner. For
example, if the USB endpoint is configured with a FIFO size of 64 bytes, the
μ
DMA channel can be used
to transfer 64 bytes to or from the endpoint FIFO. If the number of bytes to transfer is less than 64, then a
programmed I/O method must be used to copy the data to or from the FIFO.
If the DMAMOD bit in the USBTXCSRHn/USBRXCSRHn register is clear, an interrupt is generated after
every packet is transferred, but the
μ
DMA continues transferring data. If the DMAMOD bit is set, an
interrupt is generated only when the entire
μ
DMA transfer is complete. The interrupt occurs on the USB
interrupt vector. Therefore, if interrupts are used for USB operation and the
μ
DMA is enabled, the USB
interrupt handler must be designed to handle the
μ
DMA completion interrupt.
Care must be taken when using the
μ
DMA to unload the receive FIFO as data is read from the receive
FIFO in 4 byte chunks regardless of value of the MAXLOAD field in the USBRXCSRHn register. The
RXRDY bit is cleared as follows.
Table 18-1. Remainder (MAXLOAD/4)
Value
Description
0
MAXLOAD = 64 bytes
1
MAXLOAD = 61 bytes
2
MAXLOAD = 62 bytes
3
MAXLOAD = 63 bytes
Table 18-2. Actual Bytes Read
Value
Description
0
MAXLOAD
1
M3
2
M2
3
M1
Table 18-3. Packet Sizes That Clear RXRDY
Value
Description
0
MAXLOAD, MAXLOAD-1, MAXLOAD-2, MAXLOAD-3
1
MAXLOAD
2
MAXLOAD, MAXLOAD-1
3
MAXLOAD, MAXLOAD-1, MAXLOAD-2