Functional Description
1691
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
Universal Serial Bus (USB) Controller
27.3.6.4.3 Multiple Packets: Rx Endpoint
The transfer of multiple packets is normally carried out using DMA Mode 1. Where multiple packets are to
be received using DMA Mode 1, the DMA Controller should be programmed as follows:
1. The USB DMA Address n (USBDMAADDRn) register should be written with the memory address of
the buffer in which to store the transfer.
2. The USB DMA Count n (USBDMACOUNTn) register should be programmed with the size of the buffer.
3. The BRSTM field should be configured in the USB DMA Control n (USBDMACTLn) register and the
remaining bits should be programmed with the following:
ENABLE = 0x1, DIR = 0x0, MODE = 0x1, IE = 0x1.
The USB Rx endpoint should be programmed as follows:
1. The relevant interrupt enable bit in the USB Receive Interrupt Enable (USBRXIE) register should be
set to 1.
2. The AUTOCL, DMAEN and DMAMOD bit of the appropriate USB Receive Control and Status Endpoint
n High (USBRXCSRHn) register is set to 1. In host mode, the AUTORQ bit should also be set to 1 and
the USB Request Packet Count in Block Transfer Endpoint n (USBRQPKTCOUNTn) register should
be programmed with the number of packets in the transfer.
As each packet is received by the USB, the DMA controller requests bus mastership and transfers the
packet to memory. With AutoClear set, the USB automatically clears the RXRDY bit. In device mode or
where Request Packet Count (COUNT) is zero, this process continues automatically until the USB
receives a short packet (one of less than the maximum packet size for the endpoint) signifying the end of
the transfer. This short packet is not be transferred by the DMA controller; instead, the USB interrupts the
processor by generating the appropriate Endpoint interrupt. The processor can then read the USB
Receive Byte Count Endpoint n (USBRXCOUNTn) register to see the size of the short packet and either
unload it manually or reprogram the DMA controller in Mode 0 to unload the packet. In host mode with
AUTORQ set and the USBRQPKTCOUNTn register non-zero, the USB decrements the value in the
USBRQPKTCOUNTn register following each request. When the value decrements from 1 to 0, the
AUTORQ bit is cleared to prevent any further transactions being attempted.
The USB DMA Address n (USBDMAADDRn) register is incremented as the packets were unloaded so the
processor can determine the size of the transfer by comparing the current value of th USB DMA Address
n (USBDMAADDRn) register against the start address of the memory buffer.
NOTE:
If the size of the transfer exceeds the data buffer size, the DMA controller stops unloading
the FIFO and interrupts the processor through a DMA interrupt.
27.3.6.4.4 Multiple Packets: Tx Endpoint
To carry out this operation using DMA Mode 1, the DMA controller should be programmed as follows:
1. The USB DMA Address n (USBDMAADDRn) register should be written with the memory address of
the data block to send.
2. The USB DMA Count n (USBDMACOUNTn) register should be programmed with the size of the data
block.
3. The BRSTM field should be configured in the USB DMA Control n (USBDMACTLn) register and the
remaining bits should be programmed with the following:
ENABLE = 0x1, DIR = 0x1, MODE = 0x1, IE = 0x1.
The USB Tx endpoint should be programmed as follows:
1. The relevant interrupt enable bit in the USB Transmit Interrupt Enable (USBTXIE) register should be
set to 1.
2. The AUTOSET, DMAEN and DMAMOD bit of the appropriate USB Transmit Control and Status
Endpoint n High (USBTXCSRHn) register is set to 1.