Using: TM4C1294NCPDT
Peripheral Library: TivaWare 2.1.4.178
I am trying to provide a way for our FSE folks a simple way to update our products firmware in the field using the LMI Flasher utility on their laptop computers.
In the code for simplicity, after setting the CPU clock (I do this if a push button is pushed) I want to dive into the ROM_UpdateUSB(0) function to begin the update.
When I run the code and look at Device Manager (sorry, win10) I see "Unknown USB Device (Device Descriptor Request Failed)". I try to update the driver with the SW-TM4C-2.1.4.178.PATCH-1.0 but windows tells me the best drivers for your device are already installed. I even tried to uninstall the existing driver as a previous post has suggested, but that has not help.
I have posted my code below in case I am not doing something correctly in the code. I hope to rule out my code as being the problem, then I can turn my attention to my PC.
Any suggestions would be greatly appreciated? Thanks!
#include "inc/hw_memmap.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/rom_map.h"
#include "driverlib/usb.h"
#include "usblib/usblib.h"
#include "usblib/device/usbdevice.h"
int main(void)
{
uint32_t SysClock;
uint32_t ui32PLLRate;
//
// Run from the PLL at 120 MHz.
//
SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);
//
// Tell the USB library the CPU clock and the PLL frequency. This is a
// new requirement for TM4C129 devices.
//
SysCtlVCOGet(SYSCTL_XTAL_25MHZ, &ui32PLLRate);
USBDCDFeatureSet(0, USBLIB_FEATURE_CPUCLK, &SysClock);
USBDCDFeatureSet(0, USBLIB_FEATURE_USBPLL, &ui32PLLRate);
//
// Enable other GPIO peripherals used for update.
//
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
//
MAP_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
MAP_GPIOPinTypeUSBAnalog(GPIO_PORTL_BASE, GPIO_PIN_6 | GPIO_PIN_7);
//
// Enable and reset the USB peripheral.
//
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
MAP_SysCtlPeripheralReset(SYSCTL_PERIPH_USB0);
MAP_USBClockEnable(USB0_BASE, 8, USB_CLOCK_INTERNAL);
//
// Wait for about a second.
//
MAP_SysCtlDelay(SysClock / 3);
//
// Re-enable interrupts at the NVIC level.
//
MAP_IntMasterEnable(); // Enable interrupts at NVIC level
//
// Call the USB boot loader within ROM.
//
ROM_UpdateUSB(0);
while(1)
{
}
}