2020-10-13 02:10 AM
Hi, I use LWIP to establish a connection, We want to change the IP address, how can I update IP?
tcpip_init( NULL, NULL );
/* IP addresses initialization without DHCP (IPv4) */
IP4_ADDR(&ipaddr, IP_ADDRESS[0], IP_ADDRESS[1], IP_ADDRESS[2], IP_ADDRESS[3]);
IP4_ADDR(&netmask, NETMASK_ADDRESS[0], NETMASK_ADDRESS[1] , NETMASK_ADDRESS[2], NETMASK_ADDRESS[3]);
IP4_ADDR(&gw, GATEWAY_ADDRESS[0], GATEWAY_ADDRESS[1], GATEWAY_ADDRESS[2], GATEWAY_ADDRESS[3]);
/* add the network interface (IPv4/IPv6) with RTOS */
netif_add(&gnetif, &ipaddr, &netmask, &gw, NULL, ðernetif_init, &tcpip_input);
/* Registers the default network interface */
netif_set_default(&gnetif);
if (netif_is_link_up(&gnetif))
{
/* When the netif is fully configured this function must be called */
netif_set_up(&gnetif);
}
else
{
/* When the netif link is down this function must be called */
netif_set_down(&gnetif);
}
I used to remove the link and reconnect, it doesn't work. is there any ideas?
Solved! Go to Solution.
2020-10-13 06:13 AM
Hello @YiKai
You need to Disable the LWIP_DHCP then under IP Address settings you can update it.
Please use the latest CubeMX release (6.0.1) because there's an issue related to LWIP in the previous version (5.6.1).
Best Regards,
Khouloud
2020-10-13 06:13 AM
Hello @YiKai
You need to Disable the LWIP_DHCP then under IP Address settings you can update it.
Please use the latest CubeMX release (6.0.1) because there's an issue related to LWIP in the previous version (5.6.1).
Best Regards,
Khouloud
2020-10-13 06:05 PM
Thanks, I use the latest CubeMX release, it's work.