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: ROM bootloader corrupting flash during program.

Part Number: TM4C123GH6PM


I am using the ROM bootloader in a TM4C123GH6PM part to reprogram the internal flash following the protocol and state machine in spma074a. The processor is running code and is instructed to execute the bootloader with a call to ROM_UpdateSSI():

            /*! Switch back to the internal oscillator at 16MHZ */
            SysCtlClockSet(SYSCTL_USE_OSC | SYSCTL_SYSDIV_1 | SYSCTL_OSC_INT);
            /*! Once the #app_Manager_Status and #app_Bridge_Status are
             * #APP_ST_SHUTDOWN, execute #ROM_UpdateSSI to begin the ROM
             * bootloader application.
             * Stop the watchdog and disable all interrupts.
             */
            watchdog_Disable();
            //
            // 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;
            ROM_UpdateSSI();

I have implemented the SSI version of the bootloader protocol on a TM4C1294 microcontroller and, when I run it from the TM4C1294, it completes without reporting any errors. However, the TM4C123 remains locked up.

When I connect the debugger and examine the flash, addresses up to 0x00001000 program perfectly. However, after this address, the code looks like swiss cheese, peppered with words written as 0x00000000 instead of the correct firmware. These seem to be random. 

I am wondering if there is some issue with transferring to the bootloader which means the flash program function is not working after the first page. I have tried slowing down the processor clock and reducing the SSI transfer speed, but the issue remains. Does anyone have any advice for what I should be looking for?

Thanks.

  • I am not sure I understand your setup. Is the TM4C1294 programming the TM4C123 using SSI and the bootloader, or is some other device programming both the TM4C1294 and the TM4C123 with the TM4C1294 working, but the TM4C123 not working? What size are the transport packets? The SSI is operating as a slave therefore the transfer rate must be less than 1/12 of the system clock.

  • Hi Bob.

    Thanks for the response. I found my issue. It turns out the incoming data (to the 1294) was corrupted in 4k stripes (i.e. 1st 4k was fine, second was corrupted, 3rd was fine etc...). On two previous checks, by chance I had stopped inside a 'good' stripe and the incoming data looked good. I had also checked both start and end of the data (both also in good stripes) so hadn't spotted. Just a mixture of a data storage bug and some random chance. You can close this one.

    Thanks again.

  • P.S. Yes the TM4C1294 was the master accessing data on a flash card and using it to program the TM4C123.