I'm using RT1021 lwip stack and need to account for the IP info could be changed dynamically. This info is needed when initialize LWIP stack, below:
netifapi_netif_add(&g_netif, &netif_ipaddr, &netif_netmask, &netif_gw, &enet_config, EXAMPLE_NETIF_INIT_FN,tcpip_input);
netifapi_netif_set_default(&g_netif);
netifapi_netif_set_up(&g_netif);
My questions are:
1. Is there such API de_init_lwip to properly delete/remove previously lwip stack setup with old IP info to repeat the re-initialization with new IP info? (I tried to re-init anyways this without the non existing de_init API and ran into a ASSERT code halt "Function called without core lock").
2. How do I handle properly when getting the new IP info to re-initialize lwip stack to effect the new IP?
thanks.
Hi @JamesNgo ,
Thanks for your interest in NXP MIMXRT series!
LWIP is an open source lightweight networking stack, it does not provide an API such as lwip_deinit(). including the SDK provided by NXP does not change this.There are some APIs in LWIP that are thread-unsafe, and the error you are experiencing should be for this reason.
Consider using the netif_remove() function to remove the network interface, removing the current network interface configuration.And use mem_free() to manually free the memory resources associated with the network interface.Ensure that all related tasks and data transfers are stopped before removing the interface to avoid resource conflicts.
Best regards,
Gavin