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.

RTOS/TM4C129CNCPDT: Bootloader over UART(0) with TI-RTOS does not work

Part Number: TM4C129CNCPDT
Other Parts Discussed in Thread: TM4C129ENCPDT,

Tool/software: TI-RTOS

Hi!

I was trying the following:

1. Compiled and executed the boot_demo1 sample on a development board (using TM4C129ENCPDT) - Works fine

2. Modified the target MCU and ran the boot_demo1 on my own board (using TM4C129CNCPDT) - Works fine

3. Used my own project that is using TI-RTOS and added a call to ROM_UpdateUART() - as I call ROM_UpdateUART() the program stops responding and obviously no update takes place.

UART0 is working fine through the TI-RTOS before we call ROM_UpdateUART().

Is there any special way to execute the default (UART) ROM bootloader if I am using TI-RTOS?

Thank you!

  • When you call ROM_UpdateUART(), the boot loader expects that the UART is already initialized. I suspect that TI-RTOS has configured UART0 to use interrupts. Before calling ROM_UpdateUART() disable the interrupts and reconfigure UART0.
  • Issue resolved!

    As it turns out, it was not enough to execute code that stops all interrupts and to close the UART (using the RTOS'es  UART_close() routine) and to reinitialize the UART.

    What I was missing it to exit the BIOS altogether.

    So the solution has 3 parts:

    1. Write a function that will handle all the interrupts and UART stuff and then execute ROM_UpdateUART()

    2. Add this function to the list of "atexit" routines

    3. Call BIOS_exit() that will terminate all RTOS tasks and clocks (and then execute the "atexit" routines).

    I am adding the actual code that I now use in case anyone else has the same problem. When it's time to update the FW I just need to execute my "ExecuteUpdateFirmware()" and that's about it...

    
    
    void ExecuteUpdateFirmware(){
        System_atexit( UpdateFirmware );
        BIOS_exit(0);
    }
    
    
    void UpdateFirmware(int val){
        // Disable SysTick and its interrupt
        ROM_SysTickIntDisable();
        ROM_SysTickDisable();
    
        
        // Disable all interrupts
        HWREG(NVIC_DIS0) = 0xffffffff;
        HWREG(NVIC_DIS1) = 0xffffffff;
        HWREG(NVIC_DIS2) = 0xffffffff;
        HWREG(NVIC_DIS3) = 0xffffffff;
    
        // Prepare UART0
        ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
        ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    
        //
        // Set GPIO PA0 and PA1 as UART.
        //
        ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
        ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
        ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    
        //
        // Configure UART0 for 9600, n, 8, 1
        // gSysClockFreq is the value that was previously returned
        // by the call to SysCtlClockFreqSet()
        //
        ROM_UARTConfigSetExpClk(UART0_BASE, gSysClockFreq, 9600,
                    (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE |
                    UART_CONFIG_WLEN_8));
    
        //
        // Enable the UART operation.
        //
        ROM_UARTEnable(UART0_BASE);
    
        // Call the built-in boot loader routine
        ROM_UpdateUART();
    }