This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TM4C1294NCPDT:无法在 lwipInitTM 中分配静态 IP 地址?

Guru**** 2468460 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/671108/tm4c1294ncpdt-failed-to-assign-static-ip-address-in-lwipinit

器件型号:TM4C1294NCPDT

1)从 TiVAware 2.14->示例->电路板->EK-tm4c1294xl->Enet_lwip 开始,它使用 DHCP 选项,运行良好

2)基于  //e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/396803

3) lwIPInit (g_ui32SysClock、pui8MACArray、0、0、0、 ipaddr_use_dhcp) 替换为

struct ip_addr ipaddr、netmask、gw;
IP4_ADDR (&GW、192、168、0、1);
IP4_ADDR (&ipaddr、192、168、0、222);
IP4_ADDR (网络掩码、255、255、255、255、0);

lwIPInit(g_ui32SysClock、pui8MACArray、ipaddr.addr、netmask.addr、gw.addr、 ipaddr_use_static);//192.168.0.222

项目编译良好、但不会获取 IP、我是否错过了什么?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    尊敬的 David:

    也许可以尝试 GW、&ipaddr、&netmask。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    下面是另一个讨论如何使用静态 ipaddr 的线程。
    e2e.ti.com/.../1225476
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    我知道这种方法、但这不能帮助这种常见情况:我希望代码中同时包含 DHCP 和静态 IP 选项、并根据用户配置选择一个选项、例如、如果0.0.0在 EEPROM 中、我将使用 DHCP、否则、我将使用静态 IP