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.
Hello,
I am struggling with getting the USB bootloader to work.
Here is what I have done.
1. USB Bulk Device application works just fine.
2. I send a command from the PC over USB bulk to my code to jump to the USB bootloader located in ROM
3. Here is the code that gets executed before trying to jump to the ROM based USB bootloader:
USBDevDisconnect(USB0_BASE);
//
// 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;
//
// Call the USB boot loader.
//
ROM_UpdateUSB(0);
4. For reference, here is my .cmd file for the project.
#define APP_BASE 0x00000000
#define RAM_BASE 0x20000000
/* System memory map */
MEMORY
{
/* Application stored in and executes from internal flash */
FLASH (RX) : origin = APP_BASE, length = 0x00100000
/* Application uses internal RAM for data */
SRAM (RWX) : origin = 0x20000000, length = 0x00040000
}
/* Section allocation in memory */
SECTIONS
{
.intvecs: > APP_BASE
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH
.vtable : > RAM_BASE
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM
}
__STACK_TOP = __stack + 1024;
5. After jumping to the bootloader, the code is executing around location 0x0100CB58.
6. Eventually Device Manager shows Unknown USB Device (Device Descriptor Request Failed)
Any help or hints would be appreciated.
Bob,
Nice to hear from you. I hope all is well.
I erased the device, and yes I see Stellaris Device Firmware Upgrade show up in device manager.
Are you using a composite device? If so, this post might help explain: e2e.ti.com/.../2517326
I have noticed some engineers jump to a bootloader programmed at address 0 with their application code shifted up to 0x4000, and some call the ROM functions. What are the pros and cons of these two strategies?
An example of the calling the programmed bootloader can be found in usbdfu-rt.c:
HWREG(NVIC_DIS0) = 0xffffffff; HWREG(NVIC_DIS1) = 0xffffffff; // // Reset the USB peripheral // MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); MAP_SysCtlPeripheralReset(SYSCTL_PERIPH_USB0); MAP_SysCtlPeripheralDisable(SYSCTL_PERIPH_USB0); // // Wait for about a second. // MAP_SysCtlDelay(MAP_SysCtlClockGet() / 3); // // Re-enable interrupts at the NVIC level. // MAP_IntMasterEnable(); // // Return control to the boot loader. This is a call to the SVC // handler in the boot loader. // (*((void (*)(void))(*(uint32_t *)0x2c)))(); // // Should never get here, but just in case. // while(1) { }
Ralph,
Yes, I can program the flash using TI LMFlash Programmer when the device is erased.
The command just comes from PC software we created to communicate to our board over USB bulk. I receive the command properly and run the same lines of code that are mentioned on the forum.
The code seems to jump to ROM to start executing the bootloader (the code branches to ~0x1000000. I then get the following message on my PC.
"USB device not recognized."
In control panel I see "Unknown USB Device (Device Descriptor Request Failed."
Hello Richard,
Okay, now I think I better understand the issue. I looked for an example that would be close to what you are doing and found the boot_demo_usb for our DK-TM4C1294X board in TivaWare. In that program, there were quite a few more steps for invoking the ROM bootloader via the ROM_UpdateUSB API.
// // Terminate the USB device and detach from the bus. // 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); ROM_USBClockEnable(USB0_BASE, 4, USB_CLOCK_INTERNAL); // // 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);
I posted the full code, obviously the CDC function wouldn't apply and instead your Bulk function does, but there are a number of configurations made that you are lacking on your example code. Can you please try and include these as well?
I believe you will also need the ROM_IntMasterDisable(); call near the top.