Initialization and Configuration
1693
SLAU723A – October 2017 – Revised October 2018
Copyright © 2017–2018, Texas Instruments Incorporated
Universal Serial Bus (USB) Controller
NOTE:
When used in OTG mode, USB0VBUS and USB0ID do not require any configuration as they
are dedicated pins for the USB controller and directly connect to the USB connector's VBUS
and ID signals. If the USB controller is used as either a dedicated host or device, the
DEVMOD field in the USB General-Purpose Control and Status (USBGPCS) register can be
used to connect the USB0VBUS and USB0ID inputs to fixed levels internally, freeing the
PB0 and PB1 pins for GPIO use. Note that PB1 (USB0VBUS) is a 5-V tolerant signal as
required. For proper self-powered device operation, the VBUS value must still be monitored
to assure that if the host removes VBUS, the self-powered device disables the D+ and D–
pullup resistors. This function can be accomplished by connecting a standard GPIO to
VBUS.
The termination resistors for the USB PHY have been added internally, and thus there is no
need for external resistors. For a device, there is a 1.5-k
Ω
pullup on the D+ and for a host
there are 15-k
Ω
pulldowns on both D+ and D–.
27.4.1 Pin Configuration
When using the device controller portion of the USB controller in a system that also provides host
functionality, the power to VBUS must be disabled to allow the external host controller to supply power.
Usually, the USB0EPEN signal is used to control the external regulator and should be negated to avoid
having two devices driving the USB0VBUS power pin on the USB connector.
When the USB controller is acting as a host, it is in control of two signals that are attached to an external
voltage supply that provides power to VBUS. The host controller uses the USB0EPEN signal to enable or
disable power to the USB0VBUS pin on the USB connector. An input pin, USB0PFLT, provides feedback
when there has been a power fault on VBUS. The USB0PFLT signal can be configured to either
automatically negate the USB0EPEN signal to disable power, andit can generate an interrupt to the
interrupt controller to allow software to handle the power fault condition. The polarity and actions related to
both USB0EPEN and USB0PFLT are fully configurable in the USB controller. The controller also provides
interrupts on device insertion and removal to allow the host controller code to respond to these external
events.
27.4.2 Endpoint Configuration
To start communication in host or device mode, the endpoint registers must first be configured. In host
mode, this configuration establishes a connection between an endpoint register and an endpoint on a
device. In device mode, a n endpoint must be configured before enumerating to the host controller.
In both cases,the endpoint 0 configuration is limited because it is a fixed-function, fixed-FIFO-size
endpoint. In device and host modes,the endpoint requires little setup but does require a software-based
state machine to progress through the setup, data, and status phases of a standard control transaction. In
device mode,the configuration of the remaining endpoints is done once before enumerating and then only
changed if an alternate configuration is selected by the host controller. In host mode, the endpoints must
be configured to operate as control, bulk, interrupt or isochronous mode. Once the type of endpoint is
configured, a FIFO area must be assigned to each endpoint. In the case of bulk, control and interrupt
endpoints, each has a maximum of 64 bytes per transaction. Isochronous endpoints can have packets
with up to 1023 bytes per packet. In either mode, the maximum packet size for the given endpoint must be
set prior to sending or receiving data.
Configuring the FIFO of each endpoint involves reserving a portion of the overall USB FIFO RAM to each
endpoint. The total FIFO RAM available is Kbytes with the first 64 bytes reserved for endpoint 0. The
endpoint's FIFO must be at least as large as the maximum packet size. The FIFO can also be configured
as a double-buffered FIFO so that interrupts occur at the end of each packet and allow filling the other half
of the FIFO.
If operating as a device, the soft connect of the USB device controller must be enabled when the device is
ready to start communications, indicating to the host controller that the device is ready to start the
enumeration process. If operating as a host controller, the device soft connect must be disabled and
power must be provided to VBUS through the USB0EPEN signal.