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.

EK-TM4C1294XL: boot_emac_flash with static IP address

Part Number: EK-TM4C1294XL


Hello, 

    I can use "boot_emac_flash" with DHCP protocol to complete firmware update.

But as the "bootstrap protocol (BOOTP) is a predecessor to the DHCP protocol and is used to find the IP address of the clent",

how do I use static IP address to complete the firmware update? how to modify the "boot_emac_flash"?

Best Regards

Leo Liao

  

  • Hello Leo,

    I think the process outlined in this post would work for the boot_emac_flash example as well. Please give it a try: e2e.ti.com/.../1949657
  • Hi Ralph, 

       I modified the "enet_io" as static IP address: 192.168.1.3 and added the "swupdate.c" ....  for firmware update  (it's work), and set the application address 0x4000,

    set the "boot_emac_flash" to address 0x0000. 

    I do the following

    Step 1. 

    step 2.

    I traced the code when I pressed the "Program" button, the code actually receive some packet form PC and enter to SoftwareUpdateBegin(g_ui32SysClock); 

    It seems the boot_emac_flash out of work in static ip address ? 

    Please give me some advice.

    Thanks & Best Regards

    Leo Liao

    int
    main(void)
    {
    	uint32_t ui32User0, ui32User1;
    	uint8_t pui8MACArray[8];
    	uint32_t ui32IPaddr,ui32NetMask,ui32GW,i;
    
    	//
    	// Make sure the main oscillator is enabled because this is required by
    	// the PHY. The system must have a 25MHz crystal attached to the OSC
    	// pins. The SYSCTL_MOSC_HIGHFREQ parameter is used when the crystal
    	// frequency is 10MHz or higher.
    	//
    	SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ);
    
    	//
    	// Run from the PLL at 120 MHz.
    	//
    	g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
    			SYSCTL_OSC_MAIN |
    			SYSCTL_USE_PLL |
    			SYSCTL_CFG_VCO_480), 120000000);
    
    	//
    	// Configure the device pins.
    	//
    	PinoutSet(true, false);
    
    	//
    	// Configure debug port for internal use.
    	//
    	UARTStdioConfig(0, 115200, g_ui32SysClock);
    
    	//
    	// Clear the terminal and print a banner.
    	//
    	UARTprintf("\033[2J\033[H");
    	UARTprintf("Ethernet IO Example\n\n");
    
    	ui32IPaddr=((uint32_t)((IP_ADDR0) & 0xff) << 24) |
    			((uint32_t)((IP_ADDR1) & 0xff) << 16) |
    			((uint32_t)((IP_ADDR2) & 0xff) << 8) |
    			(uint32_t)((IP_ADDR3) & 0xff);
    	ui32NetMask=((uint32_t)((NET_MASK0) & 0xff) << 24) |
    			((uint32_t)((NET_MASK1) & 0xff) << 16) |
    			((uint32_t)((NET_MASK2) & 0xff) << 8) |
    			(uint32_t)((NET_MASK3) & 0xff);
    	ui32GW=((uint32_t)((IP_GW0) & 0xff) << 24) |
    			((uint32_t)((IP_GW1) & 0xff) << 16) |
    			((uint32_t)((IP_GW2) & 0xff) << 8) |
    			(uint32_t)((IP_GW3) & 0xff);
    
    	//
    	// Configure SysTick for a periodic interrupt.
    	//
    	MAP_SysTickPeriodSet(g_ui32SysClock / SYSTICKHZ);
    	MAP_SysTickEnable();
    	MAP_SysTickIntEnable();
    
    	//
    	// Configure the hardware MAC address for Ethernet Controller filtering of
    	// incoming packets. The MAC address will be stored in the non-volatile
    	// USER0 and USER1 registers.
    	//
    	MAP_FlashUserGet(&ui32User0, &ui32User1);
    	if((ui32User0 == 0xffffffff) || (ui32User1 == 0xffffffff))
    	{
    		//
    		// Let the user know there is no MAC address
    		//
    		UARTprintf("No MAC programmed!\n");
    
    		while(1)
    		{
    		}
    	}
    
    	//
    	// Tell the user what we are doing just now.
    	//
    	UARTprintf("Waiting for IP.\n");
    
    	//
    	// Convert the 24/24 split MAC address from NV ram into a 32/16 split
    	// MAC address needed to program the hardware registers, then program
    	// the MAC address into the Ethernet Controller registers.
    	//
    	pui8MACArray[0] = ((ui32User0 >> 0) & 0xff);
    	pui8MACArray[1] = ((ui32User0 >> 8) & 0xff);
    	pui8MACArray[2] = ((ui32User0 >> 16) & 0xff);
    	pui8MACArray[3] = ((ui32User1 >> 0) & 0xff);
    	pui8MACArray[4] = ((ui32User1 >> 8) & 0xff);
    	pui8MACArray[5] = ((ui32User1 >> 16) & 0xff);
    
    	//
    	// Initialze the lwIP library, using DHCP.
    	//
    	// lwIPInit(g_ui32SysClock, pui8MACArray, 0, 0, 0, IPADDR_USE_DHCP);
    
    	lwIPInit(g_ui32SysClock, pui8MACArray,ui32IPaddr,ui32NetMask, ui32GW,IPADDR_USE_STATIC);
    
    	//
    	// Start the remote software update module.
    	//
    	SoftwareUpdateInit(SoftwareUpdateRequestCallback);
    
    	//
    	// Setup the device locator service.
    	//
    	LocatorInit();
    	LocatorMACAddrSet(pui8MACArray);
    	LocatorAppTitleSet("EK-TM4C1294XL enet_io");
    
    	//
    	// Initialize a sample httpd server.
    	//
    	httpd_init();
    
    	//
    	// Set the interrupt priorities. We set the SysTick interrupt to a higher
    	// priority than the Ethernet interrupt to ensure that the file system
    	// tick is processed if SysTick occurs while the Ethernet handler is being
    	// processed. This is very likely since all the TCP/IP and HTTP work is
    	// done in the context of the Ethernet interrupt.
    	//
    	MAP_IntPrioritySet(INT_EMAC0, ETHERNET_INT_PRIORITY);
    	MAP_IntPrioritySet(FAULT_SYSTICK, SYSTICK_INT_PRIORITY);
    
    	//
    	// Pass our tag information to the HTTP server.
    	//
    	http_set_ssi_handler((tSSIHandler)SSIHandler, g_pcConfigSSITags,
    			NUM_CONFIG_SSI_TAGS);
    
    	//
    	// Pass our CGI handlers to the HTTP server.
    	//
    	http_set_cgi_handlers(g_psConfigCGIURIs, NUM_CONFIG_CGI_URIS);
    
    	//
    	// Initialize IO controls
    	//
    	io_init();
    
    	//
    	// Loop forever, processing the on-screen animation. All other work is
    	// done in the interrupt handlers.
    	//
    	while(1)
    	{
    		//
    		// Wait for a new tick to occur.
    		//
    		while(!g_ulFlags)
    		{
    			//
    			// Do nothing.
    			//
    		}
    
    		//
    		// Clear the flag now that we have seen it.
    		//
    		HWREGBITW(&g_ulFlags, FLAG_TICK) = 0;
    
    		//
    		// Toggle the GPIO
    		//
    		MAP_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1,
    				(MAP_GPIOPinRead(GPIO_PORTN_BASE, GPIO_PIN_1) ^
    						GPIO_PIN_1));
    
    		//
    		//
    		//
    		if (g_bFirmwareUpdate)
    			SoftwareUpdateBegin(g_ui32SysClock); 
    	}
    }

    5710.boot_emac_flash.rar7776.enet_io.rar

  • Sorry for correction the step 1 picture

  • Hi,

      I'm not too clear on what you are trying to do? Are you running the boot_emac_flash and using it to download your firmware image enet_io.bin for the very first time? What I'm not clear is why are you changing to static address for the enet_io which is supposed to be the firmware you are trying to download?

      BTW, is there any reason why you want to use static address rather than taking the address dynamically from the BOOTP/DHCP server?

  • Hi Charles,
    My product in the Ethernet IP option allows the user to choose to use static IP Address or DHCP to obtain IP Address, That is, I have to support both Ethernet Firmware Update in both modes. My question is how to implement firmware update by Ethernet in static IP mode.

    Best Regards
    Leo Liao
  • Hi Leo,
    Where did you specify the client static IP address? It looks like you need to add/specify the static address as in
    psBOOTP->ui32CIAddr = <your static address>; // in the SendBOOTPRequest() function in bl_emac.c.

    By searching the forum I have not come across with anyone trying to use the BOOTP with a static address. Even though this is supposed to work, you may be the first one to try it. Let's us know your result.