NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
Tiva C USB Mode Force Device
This wiki is open and can be edited by all! More information available @ www.ti.com/launchpad
|
Contents
Correction of TivaWare (and StellarisWare) USB Device Mode Issue[edit]
This tutorial is written to help users correct a defect in TivaWare release 1.0 and 1.1 that prevents USB device applications from running correctly on Tiva EK-TM4C123GXL LaunchPad.
StellarisWare software contains a similar issue which prevents StellarisWare USB examples from running on the Tiva EK-TM4C123GXL LaunchPad. This tutorial will also demonstrate a change to StellarisWare need for a StellarisWare USB device example to be successfully run on an EK-TM4C123GXL Tiva LaunchPad.
This issue only concerns USB device mode examples. Other examples that do not use USB are still believed to be fully interchangeable between TivaWare, StellarisWare and the EK-TM4C123GXL and EK-LM4F120XL.
Background TivaWare and StellarisWare USB Modes[edit]
The StellarisWare and TivaWare software packages contain a USB library for using the Stellaris and Tiva USB hardware peripheral to enumerate and operate on a USB connection. The MCU hardware on some devices contains sensing circuitry that can sense the VBUS voltage and react accordingly to changes to VBUS. For example disconnecting from the bus if VBUS drops or goes away. The StellarisWare and TivaWare software support options at run time to enable or disable VBUS monitoring.
The EK-LM4F120XL contains a MCU with device only USB hardware. VBUS monitoring is not supported by the MCU hardware.
The EK-TM4C123GXL contains a MCU with full USB hardware support. Device, Host and OTG are supported by the MCU. VBUS monitoring is supported.
StellarisWare USB example code for the EK-LM4F120XL contains a function call to place the USB hardware into device mode with VBUS monitoring. Since the LM4F120 is a device only part VBUS monitoring is ignored by the hardware. The software functions correctly as a USB device.
TivaWare USB example code for the EK-TM4C123GXL contains a similar mode setting to enable VBUS monitoring. In the case of the EK-TM4C123GXL VBUS monitoring is supported by the hardware. However, VBUS is not connected to the appropriate pin by default. Therefore Tivaware USB example code may not function correctly on the EK-TM4C123GXL Tiva LaunchPad. Likewise, StellarisWare USB examples for the EK-LM4F120XL may not run correctly on the EK-TM4C123GXL.
Changing StellarisWare USB Examples to Force Device Mode[edit]
In StellarisWare you will find the following code for USB device examples. This example is taken from usb_dev_serial.c line 1129.
//
// Set the USB stack mode to Device mode with VBUS monitoring.
//
USBStackModeSet(0, USB_MODE_DEVICE, 0);
Change this from USB_MODE_DEVICE to USB_MODE_FORCE_DEVICE as follows.
//
// Set the USB stack mode to force Device mode without VBUS monitoring.
//
USBStackModeSet(0, USB_MODE_FORCE_DEVICE, 0);
Changing TivaWare USB Examples to Force Device Mode[edit]
In TivaWare you will find the following code USB device examples. This example is taken from usb_dev_serial.c line 1133
//
// Set the USB stack mode to device mode with VBUS monitoring.
//
USBStackModeSet(0, eUSBModeDevice, 0);
Change eUSBModeDevice to eUSBModeForceDevice.
//
// Set the USB stack mode to force device mode without VBUS monitoring.
//
USBStackModeSet(0, eUSBModeForceDevice, 0);
Results[edit]
After making these changes TivaWare and StellarisWare examples will run correctly on either the EK-LM4F120XL or the EK-TM4C123GXL.