cancel
Showing results for 
Search instead for 
Did you mean: 

The STM32F407 lwIP does not work after the second reboot

embedtekin
Associate

After the device powers on, lwIP works properly. I reboot it once using the code below, and it continues to function correctly. However, if I reboot it a second time with the same code, it stops working. It goes through the PCB initialization, but no data reaches the callbacks. Normally, DHCP is enabled, but after the second reboot, it doesn't acquire an IP via DHCP either. What should I do to ensure the device reboots properly?

 

void Reboot_Device(void){
	close_udp();
        taskDISABLE_INTERRUPTS();
	netif_set_down(&gnetif);   
	netif_remove(&gnetif);   
	HAL_ETH_DeInit(&heth);
	NVIC_SystemReset();

}

 

1 REPLY 1
Imen.D
ST Employee

Hello @embedtekin ,

Make sure to proper reinitialization after reboot. So, reinitialize System Clock, Ethernet Peripheral (using the HAL_ETH_Init) and reinitialize lwIP stack.

Maybe this issue is caused by one interrupt from the previous execution that remains pending in the NVIC. So, make sure to clear any pending interrupts in the NVIC to avoid spurious interrupts after reboot.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen