cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 does not working in Eth IAP bootloader mode

hzTurqay
Associate II

Hi everyone

i have connected ethernet to stm32f4vet6 mcu. i am using LWIP and tcp_echoserver provided by stm and tftp server also provided by stm.

Now i am facing with an issue , i have two programs , first of them is LWIP_TFTP_BOOT, which has start flash adress of 0x8000000. here is the code :

	while(!HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_10)){
		 MX_LWIP_Init();
		 tcp_echoserver_init();
	  do
	  {
		  MX_LWIP_Process();

		  if(enterBootloader == 25)
		  {
			  enterBootloader = 0;
			  IAP_tftpd_init();
			  refus = uwTick;

			  while(1)
			  {
				  MX_LWIP_Process();

				  if((uwTick >= (refus+20000))||(enterBootloader == 30))
				  {
					  HAL_NVIC_SystemReset();
				  }
			  }
		  }
	  }while(uwTick < (refus+20000));
	}

	  if (((*(__IO uint32_t*)USER_FLASH_FIRST_PAGE_ADDRESS) & 0x2FFE0000) == 0x20020000)
	  {
		  JumpAddress = *(__IO uint32_t*) (USER_FLASH_FIRST_PAGE_ADDRESS + 4);
		  Jump_To_Application = (pFunction) JumpAddress;

		  __set_MSP(*(__IO uint32_t*) USER_FLASH_FIRST_PAGE_ADDRESS);
		  Jump_To_Application();
		  while(1);
	  }
	  else
	  {
		  while(1){

		  }
	  }

it uploads and works fine ,  everything is okay here, then i have another code LWIP_TCP_APP which has start flash adress is 0x8020000 and flash size 512 - 128 K. LWIP_TCP_APP code is for updating the stm32 over ethernet , means once i upload the LWIP_TFTP_BOOT code , it will work in boot mode and other times i will upload the code to stm32 via ethernet. 

here is my problem , when LWIP_TCP_APP code is only consists of led blinks and etc , it works just fine , but when i include ethernet and tcp functions in it , when the code reachs to MX_LWIP_Process() line mcu just stops and does nothing. when i debug the code reaches to this line : 

netif_add(&gnetif, &ipaddr, &netmask, &gw, NULL, &ethernetif_init, &ethernet_input);

and then just stops , it stuck there. 

i think the netif_add tries to reach to memory adress above 0x8020000 so it stucks, but i have no idea how to solve it. 

can you guys please share your ideas?

thanx you very much.

3 REPLIES 3
hzTurqay
Associate II

C'mon guys , there must be someone know something about this topic

LCE
Principal

You don't de-init anything, maybe that's the problem.

I'll have to build an ethernet bootloader for H7 soon, I'm not there yet, but I remember having seen that before jumping between app or bootloader, each and every peripheral must be de-initialized cleanly. And initialized anew if used.

hzTurqay
Associate II

i did try that but does not work , i will try it again