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.

TM4C1294NCPDT: Firmware update through ethernet

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: EK-TM4C1294XL, TM4C129DNCPDT

Hello,

I am using EK-TM4C1294XL evaluation board in my project. I have implemented ethernet based project using Tivaware library example which uses lwip library. Now for my project I wants update the firmware using ethernet remotely. Please can anybody suggest me how to implement it. 

Is there any example code or document so that I can refer that to implement in my application.

Thank You.

Regards,

Balaji TS

  • Hi,

      Please refer to C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\boot_emac_flash (this is a Ethernet bootloader) and C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\ek-tm4c1294xl\boot_demo_emac_flash (this is an example ethernet application that will jump back to the bootloader when a magic packet is received). The bootloader will load the application firmware to the flash. Once the application is running, it can jump back to the bootloader for an application update if the application detects an update is requested. 

  • Thank you Charles Tsai for your response,

    I have tried to implement using a suggestion given in the below thread. But LM flash programmer is showing Attempting to connect but not connecting.

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/667007/ek-tm4c1294xl-problem-in-ethernet-based-firmware-upgrade-functionality-using-flash-based-bootloader-boot_emac_flash-and-eflash-exe-utility

    I have implement as below.

    1. Programmed enet_lwip to TM4C1294XL launchpad to get the DHCP IP address. Found IP address.

    2. Now programmed emac_boot_flash to my TIVA launchpad using CCS.

    3. Now I am using LM flash programmer for programming boot_demo_emac_flash binary file by mentioning Client IP address, MAC address in configuration window of LM Flash programmer. When I click program button, its stuck at attempting to connect.

     

    Can you tell me where i am doing wrong or please suggest me proper procedure.

    Thank You.

    Regards,

    Balaji TS

  • Hi,

      The client (the MCU) will send the BootP request to the server (the PC) in a "incremental" time manner. For example, it will first send the BootP request. If the server does not respond then it wait 1s before sending another request. If it still does not receive a respond it will then wait 2s. It will go on to wait 4s, 8s, 16s, 32s.... What I'm trying to say is that if you start the boot_emac_flash and wait a while before you click on the "program" button on the LM flash programmer then you will just need to wait a while before the client send the BootP request. For example, when you click "Program" button, you may need to wait 64 seconds before the client sends the next request. What you can do is that as soon as you start the bootloader, you quickly hit the "program" button on the LM flash programmer.

      If this is not your issue, show your wireshark capture. 

  • Hi Charles Tsai,

    After programming emac_boot_flash code to TIVA board, I am not getting any BootP request. No data is showing on wireshark.

    Is there any other way to check whether emac_boot_flash working fine?

    And I have one more doubt: I have connected TM4C launchpad ethernet port directly to my PC ethernet port. Is this fine or Do I need to connect TM4C launchpad and PC ethernet ports to a router?

    Thank You.

    Regards,

    Balaji TS

  • And I have one more doubt: I have connected TM4C launchpad ethernet port directly to my PC ethernet port. Is this fine or Do I need to connect TM4C launchpad and PC ethernet ports to a router?

    If you are connecting directly to your PC then you need a cross-over cable. Cross-over cables means the TX+/TX- signals from the LaunchPad will be connect routed to the RX+/RX- on the PC side and vice-versa. You cannot use a straight-through cable. Straight-through means the TX on the LaunchPad is connected to the TX on the which will not work. Do some Google search to understand why you need a cross-over cable. I will suggest you try to connect both of the LaunchPad and your PC to the network through a switch first. The switch has the auto-MDIX capability so that it can take both straight-through or cross-over cable by detection.

    You should see something like this on the wireshark.

  • Hi Charles Tsai,

    Now I am getting bootP requests after using a ethernet switch and used LM flash programmer instead of CCS for programming boot_emac_flash program.

    But I am not able to program boot_demo_emac_flash program using LM flash programmer. Its stuck at attempting to connect part. Not connecting.

    I can see BootP requests on wireshark but LM flash programmer is showing Attempting to connec. I have mentioned proper MAC address and IP address only.

    Can you please tell me what might be causing this issue?

    Thank you.

    Regards,

    Balaji TS

  • Hi Balaji,

      glad that you are making progress - having seen the bootP requests now.  Do you know if you have more than one NIC (network interface card) on your PC. I'm aware that LM flash programmer has an issue that it may incorrectly send the bootP reply and magic packet to the wrong NIC. If you have more than one NIC on your PC, please disable all NIC in the Windows control panel except the one that is connected with the MCU. Please let me know if that will solve the problem. 

      

  • Hi Charles Tsai,

    I have checked in LM flash programmer. It has selected proper Ethernet Adapter. Is it compulsory to disable all the NIC except the MCU connected NIC?

    And one more thing is if program boot_demo_emac_flash program directly using CCS its not running? If I change the flash start address to 0x0000000 in .cmd file then its running continously. Why does it won't run continously is flash start address is 0x4000?

    Thank you. 

    Regards,

    Balaji TS

  • Hi,

    I have checked in LM flash programmer. It has selected proper Ethernet Adapter. Is it compulsory to disable all the NIC except the MCU connected NIC?

    Yes, due to a bug in LM flash programmer, please remove other NICs except the one that is connected to the same network as the MCU. 

    And one more thing is if program boot_demo_emac_flash program directly using CCS its not running? If I change the flash start address to 0x0000000 in .cmd file then its running continously. Why does it won't run continously is flash start address is 0x4000?

    You most likely erase the bootloader boot_emac_flash by programming boot_demo_emac_flash using CCS. By default, when you load a program in CCS, it will do a erase of the entire flash. Therefore, the bootloader at 0x0 is erased although the application is programmed to 0x4000. Since the bootlaoder is empty, when you do a power cycle, there is no stack pointer and reset vector in the flash, the program will not run. If you want to program the application at 0x4000 without affecting the bootloader then you need to click "By Address Range" for the erase option. 

  • Hello Charles Tsai,

    Thank you for your suggessions, Now I am able to program the softwave remotly after disabling not required NIC in control pannel.

    Now I want to implement same thing in my custom board project. This board contains TM4C129DNCPDT chip and an external PHY. Can you please tell what changes I need to do in boot_emac_flash project and boot_demo_emac_flash project.

    Thank you.

    Reagrds,

    Balaji TS

  • Hi,

      I think the changes you will need to make are the configuration for MII interface to use the external PHY. We don't have any examples using external PHY. But I found these posts to be useful. https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/559297/tm4c129dncpdt-with-external-phy-through-mii/2048845?tisearch=e2e-sitesearch&keymatch=EMAC_PHY_TYPE_EXTERNAL#2048845

    https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/559297/tm4c129dncpdt-with-external-phy-through-mii/2162933#2162933

      This is what I will highly recommend. Before you modify the bootloader for external PHY, start with a TivaWare ethernet example. Modify the TivaWare ethernet example to use an external PHY and make sure it works first. Later, modify the bootloader accordingly based on what you learned from the modified TivaWare example. Share with us and it should benefit the community.  

  • Hi Charles Tsai,

    I have already implemented enet_s2e(Tivaware library example) in my cusom board by following the above link. And the application works fine with external PHY. Now I need to implement remote software update in same application. For the I have tried as below but its now working.

    In emac_boot_flash application I have changed 

    LOCAL_EMACPHYConfigSet(EMAC0_BASE,(EMAC_PHY_TYPE_INTERNAL | EMAC_PHY_INT_MDIX_EN | EMAC_PHY_AN_100B_T_FULL_DUPLEX));

     with 

    LOCAL_EMACPHYConfigSet(EMAC0_BASE, EMAC_PHY_TYPE_EXTERNAL_RMII);

    And followed the same procedure which I have followed for TM4C1294XL launchpad. But I am not getting any bootP requests for my board. 

    Do I need to change anything else in emac_boot_flash code? 

    I have tried one more method as below

    1. Programmed updated emac_boot_flash project at address 0x0000 using LM flash programmer. (In normal Configuration) I am not receving any BootP requests as i have observed in wireshark.

    2. Programmed updated emac_boot_flash project at address 0x4000 using LM flash programmer by selecting option erase necessry pages in erase method. (In normal Configuration). Now my application runs fine.

    3. Now I have changed configuration to Manual Configuration and entered my device IP address and MAC. Then I have tried programming the board but it shows attempting to connect only.

    To check wether my device is receiving magic packets or not, I have kep test print statements in sw_update.c file of my project. What I observed is my device is successfully receiving magic packets and comapring it with device MAC address(comparision is successful) and calls SoftwareUpdateBegin(system_clk);. When this function is called my system stops working at it won't boot again.

    Can you please tell me what causing the issue?

    How to check boolloader application is present in my device?

    Thank you.

    Regards,

    Balaji TS

  • Do I need to change anything else in emac_boot_flash code? 

    I have tried one more method as below

    1. Programmed updated emac_boot_flash project at address 0x0000 using LM flash programmer. (In normal Configuration) I am not receving any BootP requests as i have observed in wireshark.

    2. Programmed updated emac_boot_flash project at address 0x4000 using LM flash programmer by selecting option erase necessry pages in erase method. (In normal Configuration). Now my application runs fine.

    I'm very confused here. You mentioned emac_boot_flash three times. Do you really mean boot_emac_flash (this is the example bootloader) or boot_demo_emac_flash (this is the example application firmware)? You said you program emac_boot_flash  (the bootloader) to 0x4000 and it is working. How can this be possible if emac_boot_flash is the bootloader which is supposed to be programmed at 0x0 only.

    Please be very clear what is your bootlaoder name and application name if you rename them so we are all on the same page what is what. 

    When you said you got it working for enet_s2e with the external PHY, is it true that the only thing you change is the 

    LOCAL_EMACPHYConfigSet(EMAC0_BASE, EMAC_PHY_TYPE_EXTERNAL_RMII) and nothing else? I think whatever changes you made to make enet_s2e work with the external PHY, you will need to do the same. 

  • Hello Charles Tsai,

    Sorry for the confusion. It was a typing mistake. Please consider the below lines.

    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    Do I need to change anything else in emac_boot_flash code? (Any other changes expet this line LOCAL_EMACPHYConfigSet). 

    I have tried one more method as below

    1. Programmed updated emac_boot_flash project at address 0x0000 using LM flash programmer. (In normal Configuration) I am not receving any BootP requests as i have observed in wireshark.

    2. Programmed my_enet_s2e application project at address 0x4000 using LM flash programmer by selecting option erase necessry pages in erase method. (In normal Configuration). Now my application runs fine.

    3. Now I have changed configuration to Manual Configuration and entered my device IP address and MAC. Then I have tried programming the board my_enet_s2e application but it shows attempting to connect only.

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    Your question:

    When you said you got it working for enet_s2e with the external PHY, is it true that the only thing you change is the 

    LOCAL_EMACPHYConfigSet(EMAC0_BASE, EMAC_PHY_TYPE_EXTERNAL_RMII) and nothing else? I think whatever changes you made to make enet_s2e work with the external PHY, you will need to do the same. 

    Answer:

    I have changed many things in lwipopts.h, lwiplib.c, lwip-1.4.1/ports/tiva-tm4c129/netif/tiva-tm4c129.c files for making it work with external PHY. So enet_s2e application works fine.

    But now my concern is on emac_boot_flash bootloader project because this poject doesn't conatin anything related to lwip. So my question is what all the changes need to be implemented in emac_boot_flash bootloader project for working with external PHY.

    Thank you.

    Regards,

    Balaji TS

  • Hi,

      Bootloader does not use lwIP stack because bootloader is meant to be a small program. lwIP would have taken too much memory space. I think bootloader uses uip stack. I will suggest you single step through SendBOOTPRequest() function in bl_emac.c and see if the bootp request is sent out or why it failed. SendBOOTPRequest() is called in BOOTPThread(). This is all I can suggest at this time as I have not much expertise myself in this area along with using the external PHY. Sorry for lack of guidance. 

  • Hi Charles,

    Thank You for your suggession. I will check it as per your suggession.

    Thank you.

    Regards,

    Balaji TS