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.

Using TM4C123 USB connection and TM4c1294 Ethernet connection to update firmware

Other Parts Discussed in Thread: EK-TM4C1294XL, EK-TM4C123GXL

Hi.

I have MCUs communicating via USB and via Ethernet to a computer running Linux.
I was wondering about using the same connections to update their firmware (instead of JTAG). This was to prevent having too much physical connections just to update the firmware remotely sometimes.
For that i read about the possibility of using a JTAG programmer once, where i'd flash the bootloder + first_firmware. Then i'd remove the programmer and use the USB or Ethernet communication to perform the programming task. With the help of the bootloader the new firmware updates could be loaded into memory and start running.

Could someone point me to the right direction to testing programming the bootloader, and a small test code (without bootloader). The examples in tivaware launchpads only generate one binary file so how to split into bootloader+rest and how to flash each one in its correct section? (using lm4flash command line for example).

This is what i read:
http://www.ti.com/lit/ug/spmu301d/spmu301d.pdf

I understood most of what it says but in practice i just don't know how to start.

Thanks,
André

  • There is a lot of information about bootloaders on the E2E forum, but I understand that also makes it hard to get started. I think it is best to start with some of the examples that are in TivaWare. I know you do not plan to use the UART for a bootloader, but the demo files in C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\ek-tm4c1294xl boot_serial, boot_demo1 and boot_demo2 can help you understand how to prepare the application code to run with a bootloader in the first sectors of flash. More close to your requirements is the example project (in the same directory) boot_emac_flash. There is also a demo project that supports USB DFW (Device Firmware Upgrade) from a USB memory stick. The project is usb_stick_updater.

    There are also some examples for the TM4C123 devices in the TivaWare directory "C:\ti\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c123g". Since they make use of a small LCD display on the DK-TM4C123G, they will require some modification to run on an EK-TM4C123GXL.
  • Thanks Bob.

    I'll go through those examples!

  • Hi.

    I went through the boot_emac_flash and boot_demo_emac_flash but got confused about how to test without tweaks.

    I then found this github.com/.../tiva-enet-booloader

    It looks like a similar example. I flashed boot_emac_flash.bin present but then in "2. Get The example app: boot_demo_emac_flash on the device." they talk about opening in CCS and changing stuff. Am i supposed to flash another binary? the boot_demo_emac_flash.bin is to be flashed too?

    then on the "3 Make a push from the server "eflash" to initiate the BOOTP process" i use eflash to send the new code via ethernet:

    ./eflash -i 192.168.22.109 --mac 00:1a:b6:00:00:01 -l 192.168.22.1 blinky.bin --verbose

    but i get this output:

    EFLASH Ethernet Boot Loader Download Utility (Version: 10636)
    
    Copyright (c) 2009-2013 Texas Instruments Incorporated.  All rights reserved.
    
    Starting BOOTP/TFTP Server ...
    % Complete:   0%
    Reading file (../blinky.out) to be downloaded
    ... Allocating buffer for file length 51148
    ... Reading the file
    Setting up network connections
    ... Creating sockete for BOOTP server
    ... Creating sockete for TFTP server
    ... Creating sockete for MAGIG packet transmission
    Sending "Magic" packet to initiate Ethernet Boot Loader
    Starting BOOTP/TFTP Server
    Waiting for packet ...
    ... Resending "Magic" packet.
    Waiting for packet ...
    ... Resending "Magic" packet.
    Waiting for packet ...
    ... Resending "Magic" packet.
    Waiting for packet ...
    ... Reading BOOTP packet
    ... Verifying BOOTP packet
    Waiting for packet ...
    ... Resending "Magic" packet.

  • Regarding the TM4C123 board (EK...) is there a way to upload the binary to a different section using linux lm4flash?
    github.com/.../lm4tools

    Because i already tried the boot_usb example from dk-tm4c123g and changed the Makefile PART and -DTARGET_IS_.. Then i am supposed to also flash the boot_demo1 or 2. But i guess the binary for the bootloader should be flashed in 0x0000 address and the application codes in 0x4000 or something like this.

    I saw that lm4flash exe for windows has a possibility to change the section area (program address offset)
  • Sorry, I am not familiar with the linux lm4flash. The fact that it is on github instead of on ti.com makes me suspect that it came from the user community, not from TI. Here is another thread that discusses that tool:

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

    I am not a linux user, but in the Windows version of UniFlash, I see the option of changing the base load address.

  • Hi. I Tried to follow this post http://e2e.ti.com/support/microcontrollers/other/f/908/t/442999#pi320995=1 in Windows.

    They try to run the boot_emac_flash.bin + boot_demo_emac_flash. In the 3rd page the guy finds that he is not doing the MAC address fields separating with the correct character. And then he says its working.

    I configured and flashed like they say but when it comes to the part where we flash via ethernet LM Flash Programmer (manual configuration via ethernet + IP + MAC address) i got errors.

    - Should i connect tiva ethernet cable to the router? or to the laptop ethernet port? i tried both. nothing changed

    - They are using DHCP. When connecting to the router i get a IP but can't ping it

  • Hi Andre,
    Have you tried the TivaWare boot_emac_flash and boot_demo_emac_flash as is (no modification at all) and get it to work? This is a a proven example. Below are are the steps you need to do.

    1. Run enet_lwip example and record the IP address. The IP address will be displayed via the terminal window. The reason to first run this example is to simply acquire an IP address. The bootloader is meant to be very compact in size using the BOOTP protocol. However, the BOOTP is static in nature, unlike the DHCP which provides dynamic IP address to the client upon request. Normally your DHCP will lease an IP address to your client (the MCU) for a certain time frame, may be hours or a day. Right after you acquire the IP address by running the enet_lwip the IP address will still be valid for a while. This is the IP address you want to enter in the LM flash programmer. If you are using the launchpad then in the back of the board, there is a sticker that shows the MAC address. The LM flash programmer is acting as the BOOTP and TFTP server. It must have the association between the IP address and the MAC address pre-recorded in its system. Please note that you must have the correct IP address and MAC address entered in the LM flash programmer. Without them, the sever cannot accept the BOOTP request from the client.
    2. Program the emac_boot_flash into the flash via the JTAG interface.
    3. Open the LM flash programmer and enter the IP address and MAC address from step 1 shown in the terminal widow
    4. Run the emac_boot_flash program
    5. Go to the LM flash programmer under Program tab, specify the boot_demo_emac_flash.bin and hit Program button

    Hope the below post will help.
    e2e.ti.com/.../2784506
  • Hi Charles

    Thanks for the input.

    I've already followed these two threads:

    Regarding your steps i followed them. They are similar to the above.

    When i flash the boot_demo_emac_flash.bin via Ethernet but i got it to attempt infinitely. Other times returns a BOOTP error.

  • Hi Andre,
    First of all, when you run the enet_lwip, did you see the IP address displayed on the terminal window? When you type the IP address on the URL on your browser did you see example working? I think this is important before you venture to the bootloader. If the enet_lwip by itself does not work then you have some network problem to deal with? Are you connecting to a switch on the network? Do you have a DHCP server on your network? These are the questions you need to clarify first.
  • Hi Charles.

    I've just made a video of the steps:

    Regarding the network setup: my Laptop is connected to a switch (SW1) via wifi and this one is connected to another switch via ethernet cable (SW2). The Launchpad is connected via cable to SW2. SW2 is then connected to the main router which is running a DHCP server. It atributes IP from 10.10.0.1 to 10.10.1.254 (subnet 255.255.254.0)

    I don't mind using this setup but i intend to use my laptop ethernet port to flash the Launchpad directly.

  • Hi Andre,
    My company blocks us from accessing cloud database so I can't access your dropbox.
  • I did exactly as you and I don't see a problem. Right after you program the boot_emac_flash, can you first press the reset button on the board and then hit the program button in the LM flash programmer to bootload the boot_demo_emac_flash?
  • Strange! I tried that reset but without success. There is also a checkbox "Reset MCU After Program" so i think there is no need to give perform other reset.

    I even tried with a new ek-tm4c1294xl right out of the box. New MAC. New attributed IP. It gives me "**ERROR**: Problem starting the BOOTP server!".

    new tiva IP: 10.10.0.177
    my laptop IP: 10.10.0.84

    The ethernet adapter shows two options (Qualcomm wireless and Ncap Loopback adapter) I tried both but i understand that in this case i could only use the wireless adapter because that is how i am connected to the network - how i stated before. I also tried via the ethernet port of my laptop (10.0.0.178) to the same switch where tiva is connected. Same errors.

    Does the program address offset  for boot_emac_flash.bin is correct? 0?

    Does the program address offset  for boot_demo_emac_flash.bin is correct? 0x4000?

    PS - i have just checked that i have the latest version of Tivaware 2.1.4.178. Even though i installed it again and tested. Same results.

  • Hi,

      After you run the enet_lwip and if the terminal window displays 10.10.0.177 then this is the IP address that you need to type in in the LM flash programmer, not the IP address of your laptop.

      If you are loading the boot_demo_emac_flash.bin via the Ethernet then the LM flash programmer will gray out the box to enter the offset address. It is only when you are loading the  boot_demo_emac_flash.bin via the JTAG ICDI will you need to specify the 0x4000. When you are bootloading via the Ethernet, the bootloader knows that the application will start at 0x4000 because this is what is specified in the bl_config.h where it #define APP_START_ADDRESS       0x00004000. This is changeable by users but the default is 0x4000 per the example. 

     The MCU running the bootloader is the client, not the server. Therefore, the message you see related to BOOTP server unable to start is on your laptop side. Can you use the wireshark to capture and diagnose the traffic. 

     Do you use a linux machine or PC? Earlier you were saying you are using the linux machine. The LM flash programmer only support Windows PC. Please try with a PC and will you see the same result? 

     

  • Solution found.

    The problem was the Npcap Loopback Adapter that Wireshark installs. It was enabled. After disabling that adapter and rebooting the PC i managed to flash the tiva.

    Thanks for your time Charles
  • But this is very strange. I flashed boot_demo_emac_flash.bin via ethernet. it worked several times but after flashing enet_lwip.bin via ethernet it wouldn't accept more binaries via ethernet. Now it is giving the the BOOTP error again and can't flash the boot_demo_emac_flash.bin via ethernet again.

    Well it looks like i need to reboot the PC, flash the boot_emac_flash.bin and the boot_demo_emac_flash.bin all over again after doing an incorrect ethernet flash... Otherwise i get the BOOTP error or attempts to connect and nothing works.

  • The enet_lwip.bin is an application starting at 0x0 unless you change the linker command file to start the program image at 04000. The bootloader must start at 0x0. You are asking the bootloader to overwrite itself.

    You also need to note that the boot_demo_emac_flash contains code to monitor the magic packet from the BOOTP server. Please go through the demo code. After detecting the magic packet the application will transfer control to the bootloader. Any application you build should have these code so that when you hit the program button in the LM flash programmer the bootloader will reprogram the firmware application again and again. This is a feature you need to decide if you want to have. Without it, you need some other means such as detecting a pin pressed so that you can force to reprogram the firmware image again.

    I will suggest you go through the bl_config.h, boot_demo_emac_flash source code and the TivaWare Bootloader user guide.
  • ahh
    of course yes the 0x4000 is only configured for the boot_demo_emac_flash.bin and yes the code to monitor the magic packet is not present in enet_lwip.bin.
    Ok thank you very much. I'll go through the example code again to adapt it to my application.

    Earlier i was using linux because that will be my target OS. But right now i just wanted to make the examples work to understand the setup and instructions.

    BTW do you know if lm4flash (linux) is capable of performing this ethernet flash like LM Flash Programmer is doing in WIndows? i believe there is the eflash.exe but only runs on windows

  • Hi,
    If you are referring to the LM Flash Programmer then there is no such tool for Linux by TI. If you found such tool on internet then that is not a TI tool. We cannot support it. The source code for eflash is available in the TivaWare release. You can try to reference it and create one for Linux if you want. The bottom line is that as you know the LM flash programmer and the eflash.exe are both Windows applications only.