ESP32 DHCP 获取不到IP

axellin
Posts: 200
Joined: Mon Sep 17, 2018 9:09 am

Re: ESP32 DHCP 获取不到IP

Postby axellin » Thu May 11, 2023 2:42 am

I hit the same issue on one device.
My log is similar to https://esp32.com/viewtopic.php?f=25&t= ... =30#p93297
And compare to working devices, I found the working device will show below message:
I (19728) wifi:<ba-add>idx:0 (ifx:0, ac:84:c6:32:1a:26), tid:6, ssn:2, winSize:64
dhcp_recv(pbuf = 0x3ffdc370) from DHCP server 192.168.1.1 port 67

However, on the failure device it won't show above message but just shows below message:
I (12870) wifi:<ba-add>idx:0 (ifx:0, ac:84:c6:32:1a:26), tid:0, ssn:2, winSize:64

Note. Change LWIP_DHCP_DISABLE_VENDOR_CLASS_ID does not help for such case.
Tested on : v4.4.4-433-g3cec3a0026 and v4.3.5-83-g33b3db35d7

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Mon May 22, 2023 7:51 am

I think you can enable DHCP_DEBUG and share the log.

axellin
Posts: 200
Joined: Mon Sep 17, 2018 9:09 am

Re: ESP32 DHCP 获取不到IP

Postby axellin » Thu Dec 21, 2023 1:46 am

ESP_YJM wrote:
Mon May 22, 2023 7:51 am
I think you can enable DHCP_DEBUG and share the log.
From dhcp server's log, this device already assigned a IP.
But the esp32 device actually never got a IP.

I (11672) wifi:connected with IGS-MESH, aid = 2, channel 8, 40D, bssid = d8:47:32:7c:34:ba
I (11679) wifi:security: WPA2-PSK, phy: bgn, rssi: -72
D (11684) wifi:remove all except d8:47:32:7c:34:ba from rc list
D (11690) wifi:clear blacklist
D (11693) wifi:filter: set rx policy=7
I (11696) wifi:pm start, type: 1

D (11700) wifi:Send sta connected event
D (11703) wifi:connect status 2 -> 5
D (11706) wifi:obss scan is disabled
D (11710) wifi:start obss scan: obss scan is stopped
0x40138934: wifi_default_action_sta_connected at /home/axel/esp/esp-idf/components/esp_wifi/src/wifi_default.c:85

D (11724) esp_netif_handlers: esp_netif action connected with netif0x3ffc1cb4 from event_id=4
D (11733) esp_netif_lwip: check: remote, if=0x3ffc1cb4 fn=0x40118410
0x40118410: esp_netif_up_api at /home/axel/esp/esp-idf/components/esp_netif/lwip/esp_netif_lwip.c:1649


D (11739) esp_netif_lwip: esp_netif_up_api esp_netif:0x3ffc1cb4
D (11745) esp_netif_lwip: check: local, if=0x3ffc1cb4 fn=0x40119138
0x40119138: esp_netif_update_default_netif_lwip at /home/axel/esp/esp-idf/components/esp_netif/lwip/esp_netif_lwip.c:315


D (11752) esp_netif_lwip: esp_netif_update_default_netif_lwip 0x3ffc1cb4
D (11759) esp_netif_lwip: call api in lwip: ret=0x0, give sem
D (11764) esp_netif_lwip: check: remote, if=0x3ffc1cb4 fn=0x4011889c
0x4011889c: esp_netif_dhcpc_start_api at /home/axel/esp/esp-idf/components/esp_netif/lwip/esp_netif_lwip.c:1440


D (11771) esp_netif_lwip: esp_netif_dhcpc_start_api esp_netif:0x3ffc1cb4
D (11778) esp_netif_lwip: esp_netif_start_ip_lost_timer esp_netif:0x3ffc1cb4
D (11785) esp_netif_lwip: if0x3ffc1cb4 start ip lost tmr: no need start because netif=0x3ffc1d38 interval=120 ip=0
W (11798) esp_netif_lwip: starting dhcp client
dhcp_start(netif=0x3ffc1d38) st1
dhcp_start(): restarting DHCP configuration
dhcp_start(): starting DHCP configuration
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(f623a0c3)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 500 msecs
D (11844) esp_netif_lwip: call api in lwip: ret=0x0, give sem



dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(f623a0c3)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 1000 msecs

dhcp_coarse_tmr()

dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(f623a0c3)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 2000 msecs

dhcp_coarse_tmr()
I (14053) wifi:AP's beacon interval = 102400 us, DTIM period = 1
D (14055) wifi:set max rate: from <rate=130, phy=3, sig=0> to <rate=144, phy=3 sig=0>
D (14056) wifi:sig_b=0, sig_g=0, sig_n=0, max_b=22, max_g=108, max_n=144
D (14062) wifi:update trc

dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(f623a0c3)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 4000 msecs

dhcp_coarse_tmr()

dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(f623a0c3)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 4000 msecs

dhcp_coarse_tmr()

dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): restarting discovery
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(f623a0c3)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 4000 msecs
...

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Fri Dec 22, 2023 11:36 am

It seems the router not response the DHCP Discovery packet. Do other device like mobile phone connected to this router can get the IP address?

axellin
Posts: 200
Joined: Mon Sep 17, 2018 9:09 am

Re: ESP32 DHCP 获取不到IP

Postby axellin » Sat Dec 23, 2023 1:58 am

ESP_YJM wrote:
Fri Dec 22, 2023 11:36 am
It seems the router not response the DHCP Discovery packet. Do other device like mobile phone connected to this router can get the IP address?
Other devices can get IP.
Actually, many other esp32 devices can get IP in this environment.
Only this one always cannot get IP (Join successfully but cannot get IP address), I just cannot figure out why.
In additional, this device can get IP address in other environment. So the device itself is fine in the functionality.
Any hint for debug direction?

ESP_YJM
Posts: 300
Joined: Fri Feb 26, 2021 10:30 am

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Mon Dec 25, 2023 11:54 am

You can change the mac address in the device that cannot get IP. It seems the router add the device to black list.

Who is online

Users browsing this forum: No registered users and 61 guests