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.

Ethernet bootloader issues

Other Parts Discussed in Thread: TM4C1294NCPDT, EK-TM4C1294XL, ENERGIA

I'm currently trying to get the ROM-based ethernet bootloader to work on a TIVA (TM4C1294NCPDT) test board. I have RA1 silicon, which I think has the bootloader, and it's not working with LM Flash Tool. My current working theory is that ROM_UpdateEmac doesn't start it listening for the "magic packet", which I can do myself, but I don't know what response to send from the device to start LM Flash into the TFTP part of things. 

What response is LM Flash looking for from its magic packets?

  • Hi,

    The only problem that I can see is that "LMFlash Programmer" requires the IP address of the device, to program. If the TM4C1294NCPDT is connected to a DHCP server, then the IP address will change. You should some how figure out the IP address of the board. If using a router, then typically you can access the IP addresses of the DHCP clients that are connected to the router.

    The use of the ROM Ethernet Boot Loader on a flashed part requires the use of BOOTCFG register setting.

    Regards,
    QJ
  • I know the IP address of the device, and have LM Flash tool set to that IP. 

    And from what I can see, the BOOTCFG register is only dealing with starting the bootloader at bootup based on a GPIO pin state. Can I not call into the ROM updater at any time with ROM_UpdateEmac? 

  • Hello Rudolph

    You can call the ROM_UpdateEMAC any time. But then your application needs to ensure that there is no existing interrupt being called from the application, when the device is in update mode. Have you switched the interrupts OFF?

    Regards
    Amit
  • Amit,

    Here is the full contents of the function I have defined to start the Ethernet bootloader. 

    digitalWrite(D1_LED, HIGH);
    
    // Disable all processor interrupts.  Instead of disabling them
    // one at a time (and possibly missing an interrupt if new sources
    // are added), 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;
    HWREG(NVIC_DIS4) = 0xffffffff;
    
    ROM_SysTickIntDisable();
    ROM_SysTickDisable();
    
    ROM_IntMasterDisable();
    
    delay(1000);
    
    ROM_UpdateEMAC(120000000);

    That should stop all interrupts, and I have a delay before starting the bootloader to be sure. I also only call this function after setting up Ethernet with DHCP. I had a test sketch running on an EK-TM4C1294XL Launchpad and the LM Flash Tool hangs forever at "Attempting to connect". I have RA1 silicon, am I correct that it even has the Ethernet bootloader in ROM?

  • Hello Rudolph

    Your configuration looks correct. Is the TM4C129x device on the same sub net? Did you connect the board to the same switch as the PC is connected?

    Regards
    Amit
  • Amit,

    It was not on the same subnet before, but I just got it set up to DHCP to the same subnet as the PC running LM Flash Tool and the results are the same. I have my own ethernet switch in my office, and both my PC and the EK-TM4C are on it.
  • Hello Rudolph

    I have tried the same on my LaunchPad and it is working. Can you share your project?

    Regards
    Amit
  • My project is an Energia sketch to keep things simple. It's rather short, so I'll paste it here. 

    #include <EthernetUdp.h>
    #include <EthernetServer.h>
    #include <EthernetClient.h>
    #include <Ethernet.h>
    
    #ifndef ROM_UpdateEMAC
    #define ROM_UpdateEMAC ((void (*)(uint32_t ui32Clock))ROM_EMACTABLE[71])
    #endif
    
    EthernetUDP udp;
    
    void setup()
    {
    	Ethernet.begin();
    
    	pinMode(D1_LED, OUTPUT);
    
    	Ethernet.enableActivityLed();
    	Ethernet.enableLinkLed();
    	
    	udp.begin(9);
    
    	Serial.begin(9600);
    	Serial.println(Ethernet.localIP());
    }
    
    void loop()
    {
    	udp.parsePacket();
    
    	if (udp.available() > 0)
    	{
    		char* buf = new char[128];
    		memset(buf, 0, 128);
    
    		size_t N = udp.readBytes(buf, 128);
    
    		byte filter[6] = { 0xAA,0xAA, 0xAA,0xAA, 0xAA, 0xAA };
    
    		if (memcmp(buf, filter, 6) == 0)
    		{
    			udp.beginPacket(udp.remoteIP(), udp.remotePort());
    			//udp.print("ack");
    			udp.write((byte*)buf, N);
    			udp.endPacket();
    
    			delete[] buf;
    
    			updateEmac();
    		}
    		else
    		{
    			delete[] buf;
    		}
    	}
    }
    
    void updateEmac()
    {
    	digitalWrite(D1_LED, HIGH);
    
    	// Disable all processor interrupts.  Instead of disabling them
    	// one at a time (and possibly missing an interrupt if new sources
    	// are added), 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;
    	HWREG(NVIC_DIS4) = 0xffffffff;
    
    	ROM_SysTickIntDisable();
    	ROM_SysTickDisable();
    
    	ROM_IntMasterDisable();
    
    	delay(1000);
    
    	ROM_UpdateEMAC(120000000);
    }

    EDIT: I should clarify, the sketch is responding on UDP port 9 because I wasn't sure if the bootloader would do that or if my firmware should. 

  • Hello Rudolph

    I think you should check with Energia forum on this as we test it purely in TivaWare.

    Regards
    Amit