(1)根据ethernet/basic例程,在办公室HUAWEI wifi6路由器,只在上电第一次可以从路由器分配到地址,ESP32以太网插拔网线后无法再次分配到IP地址。
研究为何DHCPC没有再次申请?
(2)换了一个路由器,用家里的联通路由器,又好使,
[0;32mI (32337) eth_example: Ethernet Link Down[0m [0;32mI (36337) eth_example: Ethernet Link Up[0m [0;32mI (36337) eth_example: Ethernet HW Addr 02:00:00:12:34:56[0m [0;32mI (39287) esp_netif_handlers: eth ip: 192.168.1.210, mask: 255.255.255.0, gw: 192.168.1.1[0m [0;32mI (39287) eth_example: Ethernet Got IP Address[0m [0;32mI (39287) eth_example: ~~~~~~~~~~~[0m [0;32mI (39287) eth_example: ETHIP:192.168.1.210[0m [0;32mI (39297) eth_example: ETHMASK:255.255.255.0[0m [0;32mI (39297) eth_example: ETHGW:192.168.1.1[0m [0;32mI (39307) eth_example: ~~~~~~~~~~~[0m
看来不同路由器对DHCP处理不同。如何添加代码让系统能适应所有路由器?
(3)参考window10上搭建open DHCP server_llhm的博客-CSDN博客_win10搭建dhcp服务器open DHCP Server在windows上设立,
?
复现了。。。。
windows DHCP server实际上提供了DHCP offer,ESP32-S2为何没有显示?第一次完整过程包括如下四步:看来问题还是在ESP32-S2这边。
经过多次测试,发现是有时可以,又不行。成功过后,经过多次插拔,就复现了。
?对比2次offer报文是否有区别
(a)成功流程的DISCOVER报文?
(b)成功流程的OFFER报文?
??(c)不成功流程的OFFER报文 --并没有什么不同
(4)打开DEBUG输出LOG
拔出网线过程
D (1824851) event: running post ETH_EVENT:3 with handler 0x4008bb28 and context 0x3ffc810c on loop 0x3ffc6ef0[0m D (1824851) esp_netif_handlers: esp_netif action disconnected with netif0x3ffc7e18 from event_id=3[0m D (1824851) esp_netif_lwip: check: remote, if=0x3ffc7e18 fn=0x4008c698 [0m D (1824861) esp_netif_lwip: esp_netif_down_api esp_netif:0x3ffc7e18[0m D (1824871) esp_netif_lwip: esp_netif_start_ip_lost_timer esp_netif:0x3ffc7e18[0m D (1824871) esp_netif_lwip: if0x3ffc7e18 start ip lost tmr: no need start because netif=0x3ffc7e98 interval=120 ip=0[0m D (1824891) esp_netif_lwip: check: local, if=0x3ffc7e18 fn=0x4008ccf4 [0m D (1824891) esp_netif_lwip: esp_netif_update_default_netif_lwip 0x3ffc7e18[0m D (1824901) esp_netif_lwip: call api in lwip: ret=0x0, give sem[0m D (1824901) event: running post ETH_EVENT:3 with handler 0x400873c0 and context 0x3ffc8184 on loop 0x3ffc6ef0[0m [0;32mI (1824911) eth_example: Ethernet Link Down[0m
插入网线过程 D (1890851) emac_dm9051: working in full duplex[0m D (1890851) emac_dm9051: Flow control not enabled for the link[0m D (1890851) event: running post ETH_EVENT:2 with handler 0x4008b9ec and context 0x3ffc80dc on loop 0x3ffc6ef0[0m D (1890861) esp_netif_handlers: esp_netif action connected with netif0x3ffc7e18 from event_id=2[0m D (1890871) esp_netif_lwip: check: remote, if=0x3ffc7e18 fn=0x4008c654 [0m D (1890881) esp_netif_lwip: esp_netif_up_api esp_netif:0x3ffc7e18[0m D (1890881) esp_netif_lwip: check: local, if=0x3ffc7e18 fn=0x4008ccf4 [0m D (1890891) esp_netif_lwip: esp_netif_update_default_netif_lwip 0x3ffc7e18[0m D (1890901) esp_netif_lwip: call api in lwip: ret=0x0, give sem[0m D (1890901) esp_netif_lwip: check: remote, if=0x3ffc7e18 fn=0x4008c2c0 [0m D (1890911) esp_netif_lwip: esp_netif_dhcpc_start_api esp_netif:0x3ffc7e18[0m D (1890911) esp_netif_lwip: esp_netif_start_ip_lost_timer esp_netif:0x3ffc7e18[0m D (1890921) esp_netif_lwip: if0x3ffc7e18 start ip lost tmr: no need start because netif=0x3ffc7e98 interval=120 ip=0[0m D (1890931) esp_netif_lwip: starting dhcp client[0m D (1890941) esp_netif_lwip: call api in lwip: ret=0x0, give sem[0m D (1890941) event: running post ETH_EVENT:2 with handler 0x400873c0 and context 0x3ffc8184 on loop 0x3ffc6ef0[0m [0;32mI (1890951) eth_example: Ethernet Link Up[0m [0;32mI (1890961) eth_example: Ethernet HW Addr 02:00:00:12:34:56[0m [0;32mI (1890961) eth_example: CONNECTED:dhcpc_get_status failed[0m
PC端一直有显示,每隔15秒,但是ESP32端一直没有显示更新了。 DHCPDISCOVER for 02:00:00:12:34:56 (espressif) from interface 192.168.0.1 received Host 02:00:00:12:34:56 (espressif) offered 192.168.0.2
(4)如何补救?大概等了100秒,raise ip lost event能否触发重启?
[0;32mI (54951) eth_example: Ethernet Link Up[0m [0;32mI (54951) eth_example: Ethernet HW Addr 02:00:00:12:34:56[0m [0;32mI (54961) eth_example: CONNECTED:dhcpc_get_status failed[0m D (150881) esp_netif_lwip: esp_netif_ip_lost_timer esp_netif:0x3ffc7e18[0m D (150881) esp_netif_lwip: if0x3ffc7e18 ip lost tmr: raise ip lost event[0m
申请只找到IP_EVENT_STA_LOST_IP,为何没有以太网的?
没有技术支持,不好搞了! ?
|