This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C123GH6PM: Device Can't Enumerate after Jumping to USB DFU Bootloader from Code

Part Number: TM4C123GH6PM
Other Parts Discussed in Thread: EK-TM4C123GXL

I am trying to make my device jump to the bootloader and accept a firmware update over USB DFU. However, when I do this, the device disconnects correctly, but my kernel logs show me that the device can't enumerate.

Code:

uint32_t
GoToBootloader(void)
{
  ROM_IntMasterDisable();
  ROM_USBDevDisconnect(USB0_BASE);
  ROM_UpdateUSB(0);
  return(0);
}

Error:

USB disconnect, device number 48

new full-speed USB device number 49 using xhci_hcd

device descriptor read/64, error -110

Is something wrong with my bootloader code?

  • Hello Steven,

    Can you please elaborate on how the USB is being configured?
  • Hi Amit, thanks for replying.

    Here is a snippet of the configuration code

    // Configure the required pins for USB operation.
    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    MAP_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_5 | GPIO_PIN_4);
    
    // Initialize the transmit and receive buffers.
    USBBufferInit(&g_sTxBuffer);
    USBBufferInit(&g_sRxBuffer);
    
    // Set the USB stack mode to Device mode with VBUS monitoring.
    USBStackModeSet(0, eUSBModeForceDevice, 0);
    
    // Pass our device information to the USB library and place the device
    // on the bus.
    USBDCDCInit(0, &g_sCDCDevice);
    
    // Register USB interrupt handler
    USBIntRegister(USB0_BASE, USB0DeviceIntHandler);
    
    // Enable processor interrupts.
    MAP_IntMasterEnable();

    The full USB configuration file is here: github.com/.../tivac_hardware_usb.h

  • Hello Stephen

    The right approach would be

    USBDCDTerm(0);

    //
    // Disable all interrupts.
    //
    ROM_IntMasterDisable();

    //
    // Disable SysTick and its interrupt.
    //
    ROM_SysTickIntDisable();
    ROM_SysTickDisable();

    //
    // Disable all processor interrupts. Instead of disabling them one at a
    // time, a direct write to NVIC is done to disable all peripheral
    // interrupts.
    //
    HWREG(NVIC_DIS0) = 0xffffffff;
    HWREG(NVIC_DIS1) = 0xffffffff;
    HWREG(NVIC_DIS2) = 0xffffffff;
    HWREG(NVIC_DIS3) = 0xffffffff;
    HWREG(NVIC_DIS4) = 0xffffffff;

    //
    // Enable and reset the USB peripheral.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
    ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_USB0);

    //
    // Wait for about a second.
    //
    ROM_SysCtlDelay(ui32SysClock / 3);

    //
    // Re-enable interrupts at the NVIC level.
    //
    ROM_IntMasterEnable();

    //
    // Call the USB boot loader.
    //
    ROM_UpdateUSB(0);

    This is an example code from the TM4C129x device, but should work for TM4C123x.
  • With your code, my device disconnects but never makes an attempt to reconnect. Note that I replaced ROM_SysCtlDelay(ui32SysClock / 3); with ROM_SysCtlDelay(SysCtlClockGet() / 3);. I also tried it without the delay.

  • Hello Steven

    Found the missing line in the earlier post from a similar code for the EK-TM4C123GXL which I had done for SPMA074 Application Note

    //
    // Enable and reset the USB peripheral.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);
    ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_USB0);
    ROM_SysCtlUSBPLLEnable();
  • Hi Amit,

    I included that line and now I see the device attempting to reconnect, but I get the same error as before
  • Hello Steven

    Can you try the TM4C123x code as part of the application note on your board, as it has been proved to be working by customers as well? This will give us an idea if the issue is with the system or the embedded firmware.
  • Hi,

    Which sample code are you referring to? I have not been able to find it in the Tivaware examples.

    Thanks,

    Steven

  • Hello Steven

    The code in SPMA074 Application Note.