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: Firmware programming through UART

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

Hi ,

We are using TM4C123GH6PM in one of our projects and we wanted to know whether we can flash the binary into the TM4C using UART commands.

If this is possible please let us know the commands and the procedure to do the same.

Thank you,

Deepanraj

  • Yes, there is lots of information available about implementing a serial bootloader for TM4C123 devices. If you have downloaded the TivaWare device drivers you have the following three example projects:
    C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c123g\boot_serial
    C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c123g\boot_demo1
    C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c123g\boot_demo2

    Also, here is some information on the protocol:
    www.ti.com/.../spma074a.pdf
    Details about the bootloader software that is provided with the TivaWare library:
    www.ti.com/.../spmu301d.pdf
    Information about the serial bootloader that is provided in the on-chip ROM (chapter 2):
    www.ti.com/.../spmu367.pdf
  • Hi Bob,

    Actually we are able to give the command and get response from the device.

    Please let us know how to program the binary file. Since we are not aware of the start address and the size to give in the download command.

    Also how do we make the device to retrieve data from the flash and program other devices.

    For programming the Flash how do we call the functions from the host PC which library do i need to use

    Thank you,
    Deepanraj

  • Hi Bob,

    Also Please let us know, How do we program the TM4C using USB. My TM4c is connected to PC via USB. We wanted to program the TM4C binary from the PC using USB.
  • Deepanraj Anbarasan said:
    Please let us know how to program the binary file

    Do you want to write your own program for the PC, or use an existing one? You can use LMFlashProgrammer to load a binary file to a device using the serial boot loader. If you want to write your own code, there is a sample code in TivaWare at: C:\ti\TivaWare_C_Series-2.1.4.178\tools\sflash

    Deepanraj Anbarasan said:
    Also how do we make the device to retrieve data from the flash and program other devices.

    You can use the boot loader to upload the flash contents of a device, but that device must be running a boot loader. Unless the application code in the device has a way to call the boot loader, it will be running the application, not the boot loader. In that case, you need to use an in-circuit emulator (JTAG or SWD) to read the contents of the part. Also be aware that a device could have the debug port disabled, or part of the flash configured as "Execute only". In this case you cannot read the contents of the flash.

    Perhaps if you tell me exactly what you are trying to do, I can give you better suggestions.

  • Hi Bob,

    We wanted to program the TM4C from our PC(Linux).  Is it possible to program the TM4C from a linux based machine.

    Actually we are not able to find the start address and size. From where do we get the start address and size of the application.

    What is the maximum size which can be given for the application.Is there any constrains?

    Please let us know, In the application suggested by you C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c123g\boot_demo1. is the Bootloader present ?

    How do we flash both bootloader and application.

    Below is the procedure we are following:

    flashed the boot_serial into the device and using the  LM flash programmer we are trying to flash the binary but we are getting error for baud rate synchronization.

    Thank you,

    Deepanraj

  • Deepanraj Anbarasan said:
    We wanted to program the TM4C from our PC(Linux).  Is it possible to program the TM4C from a linux based machine.

    If you are using a JTAG scan controller, you can use UniFlash on a Linux machine. If you plan on using a serial boot loader you will need to create your own application. There is example source code in; C:\ti\TivaWare_C_Series-2.1.4.178\tools\sflash

    Deepanraj Anbarasan said:
    Actually we are not able to find the start address and size. From where do we get the start address and size of the application.

    That depends on your application. Typically applications start at address 0, but if a flash boot-loader is used, the application start may be offset. The example serial boot-loader offsets the application to address 0x2800. You should see the start address and size of the application in the .map file generated by Code Composer.

    Deepanraj Anbarasan said:
    Please let us know, In the application suggested by you C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c123g\boot_demo1. is the Boot-loader present ?

    No, the bootloader is in boot_serial. boot_demo1 and boot_demo2 are applications that are offset to start at address 0x2800 so that they can be programmed by the boot-loader without overwriting the boot-loader.

    Deepanraj Anbarasan said:
    flashed the boot_serial into the device and using the  LM flash programmer we are trying to flash the binary but we are getting error for baud rate synchronization

    Reset the device after programming boot_serial.out. Then use LM Flash programmer set at 115200 baud to program boot_demo1.bin using a starting address of 0x2800.

  • Hi Bob,

    But still we are getting the same error as was observed earlier.
    Even checked the com ports setting everything seemed to be proper.

    Thank you
    Deepanraj
  • Are you able to program boot_serial.out into the device using Code Composer Studio? Is the device on an EK-TM4C123GXL launchpad?
  • Hi Bob,

    We are able to program using CCS.

    Yes, we are using EK-TM4C123GXL.

    Thank you,

    Deepanraj

  • Ok, lets verify that the serial connection is working properly. Do you see the Stellaris Virtual Com port in your device manager? It should look something like this:

    Then import the "hello" project into your workspace from:

    C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c123gxl\hello

    Build and load "hello". Configure "Terminal" in Code Composer using the COM port identified in the device manager and set the baud rate to 115200.

    Let the program run. You should see "Hello, world!" printed in the terminal window.

    Are you able to execute these steps successfully?

  • Hi Bob,

    We are able to execute these steps successfully.

    Also let us know,In our final design we are using external flash. Please let us know, whether any GPIO setting is required both in hardware/software in-order for the device to boot from external flash.

    Thank you,
    Deepanraj

  • Have you done these steps using a Windows or a Linux system?

    There is no support for booting from external flash. There is no "External Peripheral Interface" on the TM4C123 parts that would provide address and data bus signals for an external flash. That interface is available on the TM4C129 family of parts.

    External flash could be interfaced to the TM4C123 device through the serial USB or SPI ports, but the CPU cannot execute instructions from those ports. The flash would need to be read and copied into RAM for execution.
  • Hi Bob,

    We have done these steps in windows system.

    Thank you,

    Deepanraj

  • OK,  do you have an EK-TM4C123GXL Launchpad? I have attached a .zip file with three projects. The first is just the serial bootloader "boot_serial". The next two are simple LED blinking projects that are offset to address 0x2800 and can demonstrate the serial bootloader. First, program boot_serial.out into the TM4C123 device using Code Composer Studio. Next, use LM Flash Programmer to program either "EK-bootDemoBlueBlinky.bin" or  "EK-bootDemoRedBlinky.bin"  through the serial port at 115200 baud. You should see the LED blink. Press and hold SW1 until the LED stops blinking. You are now back in the bootloader and can program the routine for the other color. This should demonstrate the use of a serial bootloader on the PC.

    /cfs-file/__key/communityserver-discussions-components-files/908/EK_2D00_SerialBootDemo.zip

  • Hi Bob,

    Actually our is evaluation board and we have connected the usb cable to the debug port.

    Is this the right way to program the binary through UART.

    Since with your binary also we are not able to program we are getting the same error.
  • That is the correct configuration.
  • Hi Bob,

    Please let us know, what we are doing wrong.

    Since we have checked all the configurations but not able to flash the binary using the tool.

    Thank you,

    Deepanraj

  • Sorry, I have no idea. I am also using an EK-TM4c123GXL and I cannot reproduce your problem.
  • Hi Bob,

    Is there any other method to load the binary to the offset address without using the tool.

    Thank you,
    Deepanraj
  • Hi Deepanraj,
    I am hesitant to suggest anything more complex when we cannot get the simple part working. I sent you a friend request. I know that we have a significant time zone difference, but hopefully we can identify a mutual time for a WebEx session. Perhaps that way we can get things working.
  • Hi Bob,

    Thanks for the support.

    Sure will have a Web Ex session. Please suggest a time which is comfortable for you for the webEx session.

    Thank you,
    Deepanraj
  • Hi Bob,

    We are able to flash the .bin file into our TM4C device.

    But boot loader serial commands we are not be to execute and get reply.

    Is there any BIM for tm4c devices ?

    Thank you,
    Deepanraj

  • I am sorry, what is "BIM"?
  • Hi Bob,

    By BIM i mean like Boot image manager.

    Thank you,

    Deepanraj

  • I am not aware of anything like that used for PCs, but there is a lot of information on using the ROM based bootloader that comes on the part or using custom flash based bootloaders.
    www.ti.com/.../spmu301d.pdf
    www.ti.com/.../spma074a.pdf
    www.ti.com/.../spmu367