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.

TM4C129DNCPDT: Bootloader using USB COM/Serial Port

Part Number: TM4C129DNCPDT

Hello everyone,

I'm using a TM4C129DNCPDT. One of the requirements of our project is to provide our users with the ability to update our firmware from the RS-232 port (UART0), the USB port (USB0), and a wireless module that resides on UART1. Because we need to perform updates on UART1, we can't use the ROM-based bootloaders. Instead, I've been modifying the boot_serial example to serve our needs. Also, because our back-end software is set up to communicate over a COM port with the USB, I'd prefer that the USB operate as a COM/serial port (CDC) to keep things simple on the software side (it's old code, with no support for USB devices implemented or DFU, just serial ports).

Configuring the UART ports in the boot_serial demo went smoothly, but the USB has been giving me trouble for a while now. My main problem at the moment is that when I plug in the USB cable, no devices show up in the Device Manager. The window refreshes, suggesting that Windows recognized that a device was connected to it, but no new COM Ports show up, nor do any new devices under the Universal Serial Bus controllers section. A few seconds later, the Device Manager window refreshes a second time. I haven't been able to see if anything new appears, but certainly not in those two sections.

I felt like I had exhausted all my options, so I decided to start a new project that ran from a main (unlike the boot_serial example that runs from ResetISR), and I followed the CDC example provided by Ralph Jacobi in the following thread:

https://e2e.ti.com/support/microcontrollers/other/f/908/t/670258

This code, merged with the boot_serial code that's involved in reprogramming the flash, worked almost perfectly. The computer recognized the USB serial port, and I could perform a code update through the LM Flash Programmer using the COM port that was created from the USB CDC. The only problem I ran into was when the bootloader tried to jump to the main application. I was getting a FaultISR. I'm not entirely sure why, but I'm guessing it had to do with two 'main's in the Flash.

Going back to the modified boot_serial example, I've been comparing all the USB-related registers in both projects, to see if they are the same. And from what I can tell, the important ones are the same (like running from PLL or not, VBUS, ID, DP, and DM enabled, USB0 actually powered, etc). The USB CDC structures in the code are also set up the same way, and I'm calling the same functions between both projects. Yet for the project that runs from int main(), I get a USB COM port. For the project that runs from the ResetISR, I don't get a COM port.

I've run out of ideas as to what could be causing problems. I know I've written a lot in this post, but is there anything that I may have overlooked that could be causing this problem?

- Tom

  • Tom,

    I am going to ask Ralph to help with the USB part. The issue with getting FaultISR might be that you are trying to jump to the actual address of the application's main instead of main+1. The M4 processor only operates in Thumb2 mode and (for compatibility with ARM processors that run in ARM and Thumb mode) the branch must be to an odd address.

  • Hi Bob,

    I'm not sure why I said I was jumping to the main. I'm really jumping to my main application's Reset Vectors, at address 0x8000, start of the application's code. I did test to see if going directly to the main would change anything. It seems to lock up at a specific address, but I can't see what's there.

  • You don't want to jump to the reset vectors. They do not contain code. You want jump to the location pointed to by the reset vector.

        (*((void (*)(void))(*(uint32_t *)0x00008004)))(); 
    

  • I must be looking pretty green right now. Thanks for the help, Bob. This did the trick. I think I'll be able to move forward with this new Bootloader project that I created, but I am still curious why I couldn't get a USB serial port going on the boot_serial example.

    - Tom