How to change ip address using LWIP on K64

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to change ip address using LWIP on K64

ソリューションへジャンプ
3,742件の閲覧回数
inorman
Contributor III

Hi, I've managed to incorporate the LWIP stack into our project and can successfully ping etc.. and have now moved on to try and make the ip address as a user setting but I'm have trouble getting this to apply. I've followed the ping example and adding netif_set_down first to the sequence as 

netif_set_down(&fsl_netif0);

printf("ip address set as %d.%d.%d.%d\r\n",configIP_ADDR[0],configIP_ADDR[1],configIP_ADDR[2],configIP_ADDR[3]);

IP4_ADDR(&fsl_netif0_ipaddr, configIP_ADDR[0], configIP_ADDR[1], configIP_ADDR[2], configIP_ADDR[3]);
IP4_ADDR(&fsl_netif0_netmask, configNET_MASK[0], configNET_MASK[1], configNET_MASK[2], configNET_MASK[3]);
IP4_ADDR(&fsl_netif0_gw, configGW_ADDR[0], configGW_ADDR[1], configGW_ADDR[2], configGW_ADDR[3]);


lwip_init();

netif_add(&fsl_netif0, &fsl_netif0_ipaddr, &fsl_netif0_netmask, &fsl_netif0_gw,
&fsl_enet_config0, ethernetif0_init, ethernet_input);

netif_set_default(&fsl_netif0);
netif_set_up(&fsl_netif0);

After setting a new ip address pinging the previous address now fails so it's had some effect but I can't successfully ping the new address.

Any ideas on what steps I'm missing?

Thanks

Ian

タグ(2)
0 件の賞賛
返信
1 解決策
3,587件の閲覧回数
inorman
Contributor III

For anyone having this issue I found the answer in the LWIP wiki under the IPv4 section https://lwip.fandom.com/wiki/IPv4 

and use the function netif_set_ipaddr instead of adding the interface again.

Cheers

Ian

元の投稿で解決策を見る

1 返信
3,588件の閲覧回数
inorman
Contributor III

For anyone having this issue I found the answer in the LWIP wiki under the IPv4 section https://lwip.fandom.com/wiki/IPv4 

and use the function netif_set_ipaddr instead of adding the interface again.

Cheers

Ian