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.
Hi,
I have developed a custom board with TM4C129ENCPDT with Ethernet module enabled. I am able to talk to the controller via UDP and TCP/IP protocols using FreeRTOS-TCP and UDP stacks.
Now I want to implement a remote firmware update mechanism however I have no idea where to start. I have already read many posts on the forum regarding the same topic. I have tried connecting to the controller using LMFlash Programmer by providing the MAC address and IP address however it doesnt work and it says attempting to connect.... And it appears to stuck as it doesnt get any response from controller.
Please also mention;
I thank you all for your time and help.
Regards,
Sahil
Hello Sahil,
I'm going to loop in our Ethernet expert to explain more about Ethernet boot loader operations, but a couple early comments:
1) For the ROM Boot loader to be invoked, you either need to:
See this post for more details: e2e.ti.com/.../1946942
2) For this application, I would probably recommend using a Flash boot loader which gives you more flexibility, but Charles may have an easy means to use the ROM boot loader.
3) You cannot save anything to ROM. ROM is Read Only Memory. It is not possible to alter the ROM at all.
4) Not clear what you mean by this.
I am sorry I confused ROM with on device EEPROM.
Your second point i.e. "Configure a GPIO to be checked via the BOOTCFG register which on start-up will be checked by ROM to determine whether or not to enter boot loader" is it an alternative to the first point i.e. "Trigger that on your application with a ROM_UpdateXXX API where XXX would be UART, USB, I2C, SPI, or Ethernet"
If it is a second step then it is not feasible in my case because I will have a firmware already running and just in case if I need to update the firmware I will simply send the firmware through ethernet port. I dont want someone to go to the device locally and hit a switch that will trigger the bootloader.
My device will have a firmware already running and need to update it.
4) Not clear what you mean by this.
I mean where can I download the bootloader from TI website.
Thanks
Hello Sahil,
Those are 3 separate options to invoke the ROM boot loader. You just have to pick one of the three.
Our flash boot loader is available within TivaWare. There is also a boot_emac_flash/boot_demo_emac_flash in the dk-tm4c129x folder you can look at as a reference for the Ethernet portion.
We do not provide the full source for the ROM code used for the boot loader, but there are parts of it is based on the same files used for the Flash boot loader, just like how many TivaWare API's are included in ROM as well.
Hi Thanks
I have implemented the Remote Firmware Update. I am following a thread on this LINK
I am invoking the ROM_UpdateEMAC()
Here is the code I am using before invoking the fucntion;
IntMasterDisable();
HWREG(NVIC_DIS0_R) = 0xFFFFFFFF;
HWREG(NVIC_DIS1_R) = 0xFFFFFFFF;
HWREG(NVIC_DIS2_R) = 0xFFFFFFFF;
HWREG(NVIC_DIS3_R) = 0xFFFFFFFF;
SysTickIntDisable();
SysTickDisable();
and then I use LM Flash Programmer to connect to the device;
I provide the EMAC and the IP address of the device as well.
However when I hit the Program button it says "Attempting to connect...." and it stays there.
Any idea ?
Hi,
How did you acquire which IP address to use and put into the LM flash programmer?
Can you first try the emac_boot_flash (the flash based bootloader) and boot_demo_emac_flash.bin (the example application to be loaded by the bootloader) as it is and can you get it to work?
The below will be instructions to use to try the emac_boot_flash example.
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
Hi Charles,
Thank you for your reply.
As I said I am using FreeRTOS_TCP/IP Stack and it is working fine.
I can talk to the controller using Ethernet UDP as well as TCP protocol.
When my controller resets, it prints its IP and MAC address to local UART port...
I think i am putting the right MAC and IP address that it just acquires on Reset from DHCP Server.
ok, the IP address is fine.
When the LM flash programmer shows that it is attempting to connect, how long did you wait? Please note that the board will first send a bootp request and if there is no BOOTP server response it will then wait for 2 seconds before it sends another bootp request. If there is still no bootp response from the server then it will wait 4 seconds. In another words, it will wait for a duration of 1s, 2s, 4s, 8s, 16s, 32s and up to 64s before sending its next bootp request if no response from the server. Let's say your application calls the ROM_UpdateEMAC() and you didn't hit the Program button on the LM flash programmer after 16 seconds have elapsed then the board will wait another 32s before sending its next bootp request. During this 32s of time, the LM flash programmer will show that it is attempting to connect. If you don't wait long enough you may not see the handshake happen. The worst case will be to wait for 64s. This is the reason I asked how long did you wait. If you wait a couple of minutes and there is nothing going on then the first thing to check if the board is sending the bootp request out. To find out, you will really need to use the Wireshark to observe the ethernet traffic. You should see something like below.
The reason I asked that you try the emac_boot_flash example is that it is a proven example. The This is a flash based EMAC bootloader. If you call ROM_UpdateEMAC() then it is invoking the Ethernet bootloader stored in the ROM. The boot_demo_emac_flash also contains code that will detect the magic packet from the Bootp server. This means that anytime you push the Program button on the LM flash programmer a new update to the firmware can be done remotely. I don't know how you are writing your application. But you should at least take a look at how the boot_demo_emac_flash is done so that it can transfer control to the bootloader.
Hello Charles,
Thanks for your guidline. I installed wireshark and started sniffing the packets. When I invoke the function that executes the following lines of code, it noticed my controller will not reach to the last line and will hang-up till i reset.
It will print the first statement to UART and after that it hangs up.
UARTprintf("\r\nUpdating Firmware"); //IntMasterDisable(); HWREG(NVIC_DIS0_R) = 0xFFFFFFFF; HWREG(NVIC_DIS1_R) = 0xFFFFFFFF; HWREG(NVIC_DIS2_R) = 0xFFFFFFFF; HWREG(NVIC_DIS3_R) = 0xFFFFFFFF; ROM_SysTickIntDisable(); ROM_SysTickDisable(); ROM_UpdateEMAC(sys_clock);
I commented out all the lines and only left the last line as shown bellow;
// UARTprintf("\r\nUpdating Firmware"); //IntMasterDisable(); // HWREG(NVIC_DIS0_R) = 0xFFFFFFFF; // HWREG(NVIC_DIS1_R) = 0xFFFFFFFF; // HWREG(NVIC_DIS2_R) = 0xFFFFFFFF; // HWREG(NVIC_DIS3_R) = 0xFFFFFFFF; // ROM_SysTickIntDisable(); // ROM_SysTickDisable(); ROM_UpdateEMAC(sys_clock);
Doing so results in Restarting the controller. I dont understand why the controller will get Reset ?
If you look in my code above I am not writing to NVIC_DIS4_R register contrary to the thread I am following as a reference LINK. This is because this registers doesnt exist on TM4C129ENCPDT. This is the only difference in my code and the code on the link I mentioned.
A side Note: Please keep in mind, my controller is continuously logging to a remote UDP Server on Port 5000 and I can see the data being logged using YAT (YAT is similar to Putty). I can see the same data logging packets on wireshark as well.
Commenting on you suggestion to use emac_flash_example. I am a bit afraid on going down that road as my worry is I am using FreeRTOS UDP stack and I can not remove FreeRTOS USP Stack and replace with lwIP Stack at this time.
Please advise.
Thanks
Hello Charles,
I just changed my code and i included the NVIC_DIS4 register as well, and now it looks like the controller is sending BOOTP packet as I captured on wireshark.
Please note my controller IP address is 192.168.0.1 NOT 0.0.0.0 and my LM Flash Programmer is on 192.168.0.2.
Also you can see the LM FlashProgrammer is also sending a broadcast message as higlighet in red circle in above picture.
In the following image it shows the LM Flash Programmer is also sending a magick packet ??
However the LM Flash controller status is "Attempting to connect..." . I left it in that status for 3-4 minutes to see if it connects but it looks as if it is stuck there.
BOOOMM,
So I found the issue was the Ethernet Adapter selected was LoopBack on. I changed the network adapter and it programmed the controller. Now it is working.
I have one question. Accroding to Datasheet there isnt any register NVIC_DIS4 ( 0xE000E190 ) on the chip while in actual if I comment writing to that register in my code, the controller will hang.
Here is the working code;
HWREG(NVIC_DIS0) = 0xFFFFFFFF; HWREG(NVIC_DIS1) = 0xFFFFFFFF; HWREG(NVIC_DIS2) = 0xFFFFFFFF; HWREG(NVIC_DIS3) = 0xFFFFFFFF; HWREG(NVIC_DIS4) = 0xFFFFFFFF; ROM_SysTickIntDisable(); ROM_SysTickDisable(); ROM_UpdateEMAC(sys_clock);