ESP32 DHCP 获取不到IP

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

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Tue Mar 01, 2022 2:42 am

DHCP 的包没到 UDP 层,还需要你把 IP_DEBUG 打开,看包是否到了 IP 层。

liutao
Posts: 24
Joined: Fri Feb 25, 2022 3:11 am

Re: ESP32 DHCP 获取不到IP

Postby liutao » Tue Mar 01, 2022 3:02 am

[Codebox]ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x189c
load:0x403ce000,len:0x8d4
load:0x403d0000,len:0x2dc0
entry 0x403ce000
I (30) boot: ESP-IDF v4.3.2-dirty 2nd stage bootloader
I (30) boot: compile time 17:21:58
I (30) boot: chip revision: 3
I (32) boot.esp32c3: SPI Speed : 80MHz
I (37) boot.esp32c3: SPI Mode : DIO
I (42) boot.esp32c3: SPI Flash Size : 4MB
I (47) boot: Enabling RNG early entropy source...
I (52) boot: Partition Table:
I (56) boot: ## Label Usage Type ST Offset Length
I (63) boot: 0 nvs WiFi data 01 02 00009000 00004000
I (70) boot: 1 otadata OTA data 01 00 0000d000 00002000
I (78) boot: 2 phy_init RF data 01 01 0000f000 00001000
I (85) boot: 3 ota_0 OTA app 00 10 00010000 00180000
I (93) boot: 4 ota_1 OTA app 00 11 00190000 00180000
I (100) boot: 5 settings unknown 40 00 00310000 00001000
I (108) boot: 6 file unknown 40 00 00311000 000ef000
I (115) boot: End of partition table
I (120) esp_image: segment 0: paddr=00010020 vaddr=3c0e0020 size=312a8h (201384) mapI (158) esp_image: segment 1: paddr=000412d0 vaddr=3fc8fe00 size=03c10h ( 15376) load
I (161) esp_image: segment 2: paddr=00044ee8 vaddr=40380000 size=0b130h ( 45360) load
I (172) esp_image: segment 3: paddr=00050020 vaddr=42000020 size=ddc64h (908388) mapI (309) esp_image: segment 4: paddr=0012dc8c vaddr=4038b130 size=04b18h ( 19224) load
I (313) esp_image: segment 5: paddr=001327ac vaddr=50000000 size=00010h ( 16) load
I (319) boot: Loaded app from partition at offset 0x10000
I (321) boot: Disabling RNG early entropy source...
I (338) cpu_start: Pro cpu up.
I (350) cpu_start: Pro cpu start user code
I (350) cpu_start: cpu freq: 160000000
I (350) cpu_start: Application information:
I (353) cpu_start: Project name: blufi_demo
I (358) cpu_start: App version: 1
I (362) cpu_start: Compile time: Feb 28 2022 09:42:15
I (369) cpu_start: ELF file SHA256: df397a116b55b271...
I (374) cpu_start: ESP-IDF: v4.3.2-dirty
I (380) heap_init: Initializing. RAM available for dynamic allocation:
I (387) heap_init: At 3FC9B890 len 00024770 (145 KiB): DRAM
I (393) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
I (400) heap_init: At 50000010 len 00001FF0 (7 KiB): RTCRAM
I (407) spi_flash: detected chip: generic
I (411) spi_flash: flash io: dio
I (416) sleep: Configure to isolate all GPIO pins in sleep state
I (422) sleep: Enable automatic switching of GPIO sleep configuration
I (429) cpu_start: Starting scheduler.
netif: netmask of interface set to 255.0.0.0
netif: GW address of interface set to 127.0.0.1
netif_set_ipaddr: netif address being changed
netif: added interface lo IP addr 127.0.0.1 netmask 255.0.0.0 gw 127.0.0.1
I (458) coexist: coexist rom version 9387209
I (458) pp: pp rom version: 9387209
I (458) net80211: net80211 rom version: 9387209
I (478) wifi:wifi driver task: 3fca4630, prio:23, stack:6656, core=0
I (478) system_api: Base MAC address is not set
I (478) system_api: read default base MAC address from EFUSE
I (488) wifi:wifi firmware version: eb52264
I (488) wifi:wifi certification version: v7.0
I (488) wifi:config NVS flash: enabled
I (498) wifi:config nano formating: disabled
I (498) wifi:Init data frame dynamic rx buffer num: 32
I (508) wifi:Init management frame dynamic rx buffer num: 32
I (508) wifi:Init management short buffer num: 32
I (518) wifi:Init dynamic tx buffer num: 32
I (518) wifi:Init static tx FG buffer num: 2
I (518) wifi:Init static rx buffer size: 1600
I (528) wifi:Init static rx buffer num: 10
I (528) wifi:Init dynamic rx buffer num: 32
I (538) wifi_init: rx ba win: 6
I (538) wifi_init: tcpip mbox: 32
I (538) wifi_init: udp mbox: 6
I (548) wifi_init: tcp mbox: 6
I (548) wifi_init: tcp tx win: 5744
I (558) wifi_init: tcp rx win: 5744
I (558) wifi_init: tcp mss: 1440
I (558) wifi_init: WiFi IRAM OP enabled
I (568) wifi_init: WiFi RX IRAM OP enabled
I (568) phy_init: phy_version 905,7b93cd2,Oct 25 2021,15:05:11
I (618) wifi:set rx active PTI: 0, rx ack PTI: 12, and default PTI: 1
I (618) wifi:mode : sta (60:55:f9:28:88:c4)
I (618) wifi:enable tsf
netif: added interface st IP addr 0.0.0.0 netmask 0.0.0.0 gw 0.0.0.0
I (628) BLUFI_EXAMPLE: WIFI_EVENT_STA_START

W (628) BTDM_INIT: esp_bt_controller_mem_release not implemented, return OK
I (638) wifi:new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
I (648) wifi:state: init -> auth (b0)
I (648) BTDM_INIT: BT controller compile version [3e61eea]
I (658) coexist: coexist rom version 9387209
I (658) BTDM_INIT: Bluetooth MAC: 60:55:f9:28:88:c5

I (668) wifi:state: auth -> assoc (0)
I (678) BLUFI_EXAMPLE: BD ADDR: 60:55:f9:28:88:c5

I (678) BLUFI_EXAMPLE: BLUFI init finish

W (688) BT_BTM: BTM_BleWriteAdvData, Partial data write into ADV
I (688) BLUFI_EXAMPLE: BLUFI VERSION 0102

I (688) Protocol: 0x3fcb7d3c fa 00 00 00 00 02 00 11 8c ff 05 00 |............|
I (698) : start tcp_client_task
I (708) WIFI: wait to get IP
I (708) : start tcp_client_recv_task
I (708) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (718) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (728) wifi:state: assoc -> run (10)
I (738) : start state_led_task
W (738) wifi:<ba-add>idx:0 (ifx:0, 58:41:20:09:d9:62), tid:5, ssn:0, winSize:64
I (748) : start get_RSSI_task
I (748) BLUFI_EXAMPLE: set rssi threshold
I (838) wifi:connected with TP-LINK_JSB_WZ, aid = 1, channel 1, 40U, bssid = 58:41:20:09:d9:62
I (838) wifi:security: WPA2-PSK, phy: bgn, rssi: -39
I (848) wifi:pm start, type: 1

I (848) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 14, mt_pti: 25000, mt_time: 10000
I (858) wifi:BcnInt:102400, DTIM:1
netif: setting default interface st
dhcp_start(netif=0x3fca1d44) st1
dhcp_start(): restarting DHCP configuration
dhcp_start(): starting DHCP configuration
udp_bind(ipaddr = 0.0.0.0, port = 68)
udp_bind: bound to 0.0.0.0, port 68)
udp_connect: connected to 0.0.0.0, port 67)
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
pbuf_alloc(length=308)
pbuf_alloc(length=308) == 0x3fc9d888
transaction id xid(7929a813)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
pbuf_add_header: old 0x3fc9d8d8 new 0x3fc9d8d0 (8)
udp_send: added header in given pbuf 0x3fc9d888
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x4f58
udp_send: ip_output_if (,,,,0x11,)
pbuf_add_header: old 0x3fc9d8d0 new 0x3fc9d8bc (20)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 336 | (v, hl, tos, len)
+-------------------------------+
| 0 |000| 0 | (id, flags, offset)
+-------------------------------+
| 255 | 17 | 0xba9d | (ttl, proto, chksum)
+-------------------------------+
| 0 | 0 | 0 | 0 | (src)
+-------------------------------+
| 255 | 255 | 255 | 255 | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
pbuf_add_header: old 0x3fc9d8bc new 0x3fc9d8ae (14)
ethernet_output: sending packet 0x3fc9d888
dhcp_discover: deleting()ing
pbuf_free(0x3fc9d888)
pbuf_free: deallocating 0x3fc9d888
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 500 msecs
I (998) BLUFI_EXAMPLE: WIFI_EVENT_STA_CONNECTED

I (1008) BLUFI_EXAMPLE: rssi:-38
I (1008) Protocol: 0x3fcb7c84 fa 00 00 00 00 02 00 11 8c e7 04 1f |............|
I (1018) BLUFI_EXAMPLE: mac:MAC6055f92888c4
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
pbuf_alloc(length=308)
pbuf_alloc(length=308) == 0x3fc9d888
transaction id xid(7929a813)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
pbuf_add_header: old 0x3fc9d8d8 new 0x3fc9d8d0 (8)
udp_send: added header in given pbuf 0x3fc9d888
pbuf_alloc(length=320)
pbuf_alloc(length=320) == 0x3fcb7c84
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x4f58
udp_send: ip_output_if (,,,,0x11,)
pbuf_add_header: old 0x3fc9d8d0 new 0x3fc9d8bc (20)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 336 | (v, hl, tos, len)
+-------------------------------+
| 1 |000| 0 | (id, flags, offset)
+-------------------------------+
| 255 | 17 | 0xba9c | (ttl, proto, chksum)
+-------------------------------+
| 0 | 0 | 0 | 0 | (src)
+-------------------------------+
| 255 | 255 | 255 | 255 | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
pbuf_add_header: old 0x3fc9d8bc new 0x3fc9d8ae (14)
ethernet_output: sending packet 0x3fc9d888
dhcp_discover: deleting()ing
pbuf_free(0x3fc9d888)
pbuf_free: deallocating 0x3fc9d888
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 1000 msecs
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:58:41:20:09:d9:62, type:800
pbuf_remove_header: old 0x3fc9daba new 0x3fc9dac8 (14)
ip_input: iphdr->dest 0xffffffff netif->ip_addr 0x0 (0x0, 0x0, 0xffffffff)
ip_input: iphdr->dest 0xffffffff netif->ip_addr 0x100007f (0xff, 0x7f, 0xffffff00)
ip4_input: packet accepted on interface lo
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 306 | (v, hl, tos, len)
+-------------------------------+
| 0 |000| 0 | (id, flags, offset)
+-------------------------------+
| 64 | 17 | 0xb912 | (ttl, proto, chksum)
+-------------------------------+
| 192 | 168 | 0 | 1 | (src)
+-------------------------------+
| 255 | 255 | 255 | 255 | (dest)
+-------------------------------+
ip4_input: p->len 306 p->tot_len 306
pbuf_remove_header: old 0x3fc9dac8 new 0x3fc9dadc (20)
udp_input: received datagram of length 286
UDP header:
+-------------------------------+
| 67 | 68 | (src port, dest port)
+-------------------------------+
| 286 | 0xa866 | (len, chksum)
+-------------------------------+
udp (255.255.255.255, 68) <-- (192.168.0.1, 67)
pcb (0.0.0.0, 68) <-- (0.0.0.0, 67)
udp_input: calculating checksum
pbuf_remove_header: old 0x3fc9dadc new 0x3fc9dae4 (8)
dhcp_recv(pbuf = 0x3fcb7c84) from DHCP server 192.168.0.1 port 67
pbuf->len = 278
pbuf->tot_len = 278
searching DHCP_OPTION_MESSAGE_TYPE
DHCP_OFFER received in DHCP_STATE_SELECTING state
dhcp_handle_offer(netif=0x3fca1d44) st1
dhcp_handle_offer(): server 0x0100a8c0
dhcp_handle_offer(): offer for 0x7a00a8c0
dhcp_select(netif=0x3fca1d44) st1
dhcp_select(): dhcp state is REQUESTING
pbuf_alloc(length=308)
pbuf_alloc(length=308) == 0x3fc9e0b8
transaction id xid(7929a813)
pbuf_add_header: old 0x3fc9e108 new 0x3fc9e100 (8)
udp_send: added header in given pbuf 0x3fc9e0b8
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0xdb0b
udp_send: ip_output_if (,,,,0x11,)
pbuf_add_header: old 0x3fc9e100 new 0x3fc9e0ec (20)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 336 | (v, hl, tos, len)
+-------------------------------+
| 2 |000| 0 | (id, flags, offset)
+-------------------------------+
| 255 | 17 | 0xba9b | (ttl, proto, chksum)
+-------------------------------+
| 0 | 0 | 0 | 0 | (src)
+-------------------------------+
| 255 | 255 | 255 | 255 | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
pbuf_add_header: old 0x3fc9e0ec new 0x3fc9e0de (14)
ethernet_output: sending packet 0x3fc9e0b8
pbuf_free(0x3fc9e0b8)
pbuf_free: deallocating 0x3fc9e0b8
dhcp_select: REQUESTING
dhcp_select(): set request timeout 2000 msecs
pbuf_free(0x3fcb7c84)
pbuf_free: deallocating 0x3fcb7c84
etharp_timer
dhcp_coarse_tmr()
pbuf_alloc(length=320)
pbuf_alloc(length=320) == 0x3fc9fc44
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:58:41:20:09:d9:62, type:800
pbuf_remove_header: old 0x3fc9d932 new 0x3fc9d940 (14)
ip_input: iphdr->dest 0xffffffff netif->ip_addr 0x0 (0x0, 0x0, 0xffffffff)
ip_input: iphdr->dest 0xffffffff netif->ip_addr 0x100007f (0xff, 0x7f, 0xffffff00)
pbuf_alloc(length=320)
pbuf_alloc(length=320) == 0x3fcbc844
ip4_input: packet accepted on interface lo
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 306 | (v, hl, tos, len)
+-------------------------------+
| 0 |000| 0 | (id, flags, offset)
+-------------------------------+
| 64 | 17 | 0xb912 | (ttl, proto, chksum)
+-------------------------------+
| 192 | 168 | 0 | 1 | (src)
+-------------------------------+
| 255 | 255 | 255 | 255 | (dest)
+-------------------------------+
ip4_input: p->len 306 p->tot_len 306
pbuf_remove_header: old 0x3fc9d940 new 0x3fc9d954 (20)
udp_input: received datagram of length 286
UDP header:
+-------------------------------+
| 67 | 68 | (src port, dest port)
+-------------------------------+
| 286 | 0xb174 | (len, chksum)
+-------------------------------+
pbuf_alloc(length=60)
pbuf_alloc(length=60) == 0x3fcbc874
pbuf_alloc(length=305)
pbuf_alloc(length=305) == 0x3fcbc8a4
pbuf_alloc(length=60)
pbuf_alloc(length=60) == 0x3fcbc8d4
pbuf_alloc(length=60)
pbuf_alloc(length=60) == 0x3fcbc688
udp (255.255.255.255, 68) <-- (192.168.0.1, 67)
pcb (0.0.0.0, 68) <-- (0.0.0.0, 67)
pbuf_alloc(length=60)
pbuf_alloc(length=60) == 0x3fcbc6b8
udp_input: calculating checksum
pbuf_remove_header: old 0x3fc9d954 new 0x3fc9d95c (8)
dhcp_recv(pbuf = 0x3fc9fc44) from DHCP server 192.168.0.1 port 67
pbuf->len = 278
pbuf->tot_len = 278
searching DHCP_OPTION_MESSAGE_TYPE
pbuf_free(0x3fc9fc44)
pbuf_free: deallocating 0x3fc9fc44
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:58:41:20:09:d9:62, type:800
pbuf_remove_header: old 0x3fc9dfda new 0x3fc9dfe8 (14)
ip_input: iphdr->dest 0xffffffff netif->ip_addr 0x0 (0x0, 0x0, 0xffffffff)
ip_input: iphdr->dest 0xffffffff netif->ip_addr 0x100007f (0xff, 0x7f, 0xffffff00)
ip4_input: packet accepted on interface lo
ip4_input:
IP header:
+-------------------------------+
| 4 | 5 | 0x00 | 306 | (v, hl, tos, len)
+-------------------------------+
| 0 |000| 0 | (id, flags, offset)
+-------------------------------+
| 64 | 17 | 0xb912 | (ttl, proto, chksum)
+-------------------------------+
| 192 | 168 | 0 | 1 | (src)
+-------------------------------+
| 255 | 255 | 255 | 255 | (dest)
+-------------------------------+
ip4_input: p->len 306 p->tot_len 306
pbuf_remove_header: old 0x3fc9dfe8 new 0x3fc9dffc (20)
udp_input: received datagram of length 286
UDP header:
+-------------------------------+
| 67 | 68 | (src port, dest port)
+-------------------------------+
| 286 | 0x9d66 | (len, chksum)
+-------------------------------+
udp (255.255.255.255, 68) <-- (192.168.0.1, 67)
pcb (0.0.0.0, 68) <-- (0.0.0.0, 67)
udp_input: calculating checksum
pbuf_remove_header: old 0x3fc9dffc new 0x3fc9e004 (8)
dhcp_recv(pbuf = 0x3fcbc844) from DHCP server 192.168.0.1 port 67
pbuf->len = 278
pbuf->tot_len = 278
searching DHCP_OPTION_MESSAGE_TYPE
DHCP_ACK received
dhcp_check(netif=0x3fca1d44) st
dhcp_check(): dhcp state is CHECKING
etharp_find_entry: found empty entry 0
etharp_find_entry: selecting empty entry 0
etharp_request: sending ARP request.
pbuf_alloc(length=28)
pbuf_alloc(length=28) == 0x3fcbc6e8
etharp_raw: sending raw ARP packet.
pbuf_add_header: old 0x3fcbc710 new 0x3fcbc702 (14)
ethernet_output: sending packet 0x3fcbc6e8
pbuf_free(0x3fcbc6e8)
pbuf_free: deallocating 0x3fcbc6e8
dhcp_check(): set request timeout 500 msecs
pbuf_free(0x3fcbc844)
pbuf_free: deallocating 0x3fcbc844
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:58:41:20:09:d9:62, type:806
pbuf_remove_header: old 0x3fcbe9f2 new 0x3fcbea00 (14)
etharp_update_arp_entry: 192.168.0.1 - 58:41:20:09:d9:62
etharp_find_entry: found empty entry 1
etharp_find_entry: no empty entry found and not allowed to recycle
etharp_input: incoming ARP request
etharp_input: we are unconfigured, ARP request ignored.
pbuf_free(0x3fcbc874)
pbuf_free: deallocating 0x3fcbc874
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:9c:b6:d0:c1:1a:87, type:800
pbuf_remove_header: old 0x3fcbf09a new 0x3fcbf0a8 (14)
ip_input: iphdr->dest 0xff00a8c0 netif->ip_addr 0x0 (0x0, 0x0, 0xff00a8c0)
ip_input: iphdr->dest 0xff00a8c0 netif->ip_addr 0x100007f (0xc0, 0x7f, 0xff00a800)
ip4_input: UDP packet to DHCP client port 54915
ip4_input: packet not for us.
pbuf_free(0x3fcbc8a4)
pbuf_free: deallocating 0x3fcbc8a4
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:58:41:20:09:d9:62, type:806
pbuf_remove_header: old 0x3fcbf742 new 0x3fcbf750 (14)
etharp_update_arp_entry: 192.168.0.1 - 58:41:20:09:d9:62
etharp_find_entry: found empty entry 1
etharp_find_entry: no empty entry found and not allowed to recycle
etharp_input: incoming ARP request
etharp_input: we are unconfigured, ARP request ignored.
pbuf_free(0x3fcbc8d4)
pbuf_free: deallocating 0x3fcbc8d4
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:58:41:20:09:d9:62, type:806
pbuf_remove_header: old 0x3fcc078a new 0x3fcc0798 (14)
etharp_update_arp_entry: 192.168.0.1 - 58:41:20:09:d9:62
etharp_find_entry: found empty entry 1
etharp_find_entry: no empty entry found and not allowed to recycle
etharp_input: incoming ARP request
etharp_input: we are unconfigured, ARP request ignored.
pbuf_free(0x3fcbc688)
pbuf_free: deallocating 0x3fcbc688
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): CHECKING, ARP request timed out
dhcp_check(netif=0x3fca1d44) st
dhcp_check(): dhcp state is CHECKING
etharp_find_entry: found matching entry 0
etharp_request: sending ARP request.
pbuf_alloc(length=28)
pbuf_alloc(length=28) == 0x3fcbc6e8
etharp_raw: sending raw ARP packet.
pbuf_add_header: old 0x3fcbc710 new 0x3fcbc702 (14)
ethernet_output: sending packet 0x3fcbc6e8
pbuf_free(0x3fcbc6e8)
pbuf_free: deallocating 0x3fcbc6e8
dhcp_check(): set request timeout 500 msecs
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:58:41:20:09:d9:62, type:806
pbuf_remove_header: old 0x3fcc0e32 new 0x3fcc0e40 (14)
etharp_update_arp_entry: 192.168.0.1 - 58:41:20:09:d9:62
etharp_find_entry: found empty entry 1
etharp_find_entry: no empty entry found and not allowed to recycle
etharp_input: incoming ARP request
etharp_input: we are unconfigured, ARP request ignored.
pbuf_free(0x3fcbc6b8)
pbuf_free: deallocating 0x3fcbc6b8
I (2038) WIFI: wait to get IP
etharp_timer
etharp_request: sending ARP request.
pbuf_alloc(length=28)
pbuf_alloc(length=28) == 0x3fcbc844
etharp_raw: sending raw ARP packet.
pbuf_add_header: old 0x3fcbc86c new 0x3fcbc85e (14)
ethernet_output: sending packet 0x3fcbc844
pbuf_free(0x3fcbc844)
pbuf_free: deallocating 0x3fcbc844
dhcp_coarse_tmr()
dhcp_fine_tmr(): request timeout
dhcp_timeout()
dhcp_timeout(): CHECKING, ARP request timed out
dhcp_bind(netif=0x3fca1d44) st1
dhcp_bind(): t0 renewal timer 7200 secs
dhcp_bind(): set request timeout 7200000 msecs
dhcp_bind(): t1 renewal timer 3600 secs
dhcp_bind(): set request timeout 3600000 msecs
dhcp_bind(): t2 rebind timer 6300 secs
dhcp_bind(): set request timeout 6300000 msecs
dhcp_bind(): IP: 0x7a00a8c0 SN: 0x00ffffff GW: 0x0100a8c0
dhcp_bind(): dhcp state is BOUND
netif: netmask of interface st set to 255.255.255.0
netif: GW address of interface st set to 192.168.0.1
netif_set_ipaddr: netif address being changed
etharp_request: sending ARP request.
pbuf_alloc(length=28)
pbuf_alloc(length=28) == 0x3fc9fc30
etharp_raw: sending raw ARP packet.
pbuf_add_header: old 0x3fc9fc58 new 0x3fc9fc4a (14)
ethernet_output: sending packet 0x3fc9fc30
pbuf_free(0x3fc9fc30)
pbuf_free: deallocating 0x3fc9fc30
I (2538) esp_netif_handlers: sta ip: 192.168.0.122, mask: 255.255.255.0, gw: 192.168.0.1
I (2548) BLUFI_EXAMPLE: STA_GOT_IP

I (2558) BLUFI_EXAMPLE: BLUFI BLE is not connected yet

pbuf_alloc(length=60)
pbuf_alloc(length=60) == 0x3fcbc754
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:58:41:20:09:d9:62, type:806
pbuf_remove_header: old 0x3fc9d932 new 0x3fc9d940 (14)
pbuf_alloc(length=60)
pbuf_alloc(length=60) == 0x3fc9fc30
pbuf_alloc(length=60)
pbuf_alloc(length=60) == 0x3fc9fc60
pbuf_alloc(length=60)
pbuf_alloc(length=60) == 0x3fcbc858
etharp_update_arp_entry: 192.168.0.1 - 58:41:20:09:d9:62
etharp_find_entry: found empty entry 1
etharp_find_entry: no empty entry found and not allowed to recycle
etharp_input: incoming ARP request
etharp_input: ARP request was not for us.
pbuf_free(0x3fcbc754)
pbuf_free: deallocating 0x3fcbc754
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:58:41:20:09:d9:62, type:806
pbuf_remove_header: old 0x3fc9dfda new 0x3fc9dfe8 (14)
etharp_update_arp_entry: 192.168.0.1 - 58:41:20:09:d9:62
etharp_find_entry: found empty entry 1
etharp_find_entry: no empty entry found and not allowed to recycle
etharp_input: incoming ARP request
etharp_input: ARP request was not for us.
pbuf_free(0x3fc9fc30)
pbuf_free: deallocating 0x3fc9fc30
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:58:41:20:09:d9:62, type:806
pbuf_remove_header: old 0x3fcbe9f2 new 0x3fcbea00 (14)
etharp_update_arp_entry: 192.168.0.1 - 58:41:20:09:d9:62
etharp_find_entry: found empty entry 1
etharp_find_entry: no empty entry found and not allowed to recycle
etharp_input: incoming ARP request
etharp_input: ARP request was not for us.
pbuf_free(0x3fc9fc60)
pbuf_free: deallocating 0x3fc9fc60
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:58:41:20:09:d9:62, type:806
pbuf_remove_header: old 0x3fcbf09a new 0x3fcbf0a8 (14)
etharp_update_arp_entry: 192.168.0.1 - 58:41:20:09:d9:62
etharp_find_entry: found empty entry 1
etharp_find_entry: selecting empty entry 1
etharp_update_arp_entry: updating stable entry 1
etharp_input: incoming ARP request
pbuf_alloc(length=28)
pbuf_alloc(length=28) == 0x3fc9fc30
etharp_raw: sending raw ARP packet.
pbuf_add_header: old 0x3fc9fc58 new 0x3fc9fc4a (14)
ethernet_output: sending packet 0x3fc9fc30
pbuf_free(0x3fc9fc30)
pbuf_free: deallocating 0x3fc9fc30
pbuf_free(0x3fcbc858)
pbuf_free: deallocating 0x3fcbc858[/Codebox]
这里是获取到IP的,反复复位能获取到,换一个模块又会获取不到,两个模块都获取不到

liutao
Posts: 24
Joined: Fri Feb 25, 2022 3:11 am

Re: ESP32 DHCP 获取不到IP

Postby liutao » Tue Mar 01, 2022 3:11 am

ESP_YJM wrote:
Tue Mar 01, 2022 2:42 am
DHCP 的包没到 UDP 层,还需要你把 IP_DEBUG 打开,看包是否到了 IP 层。

Code: Select all

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x189c
load:0x403ce000,len:0x8d4
load:0x403d0000,len:0x2dc0
entry 0x403ce000
I (30) boot: ESP-IDF v4.3.2-dirty 2nd stage bootloader
I (30) boot: compile time 17:21:58
I (30) boot: chip revision: 3
I (32) boot.esp32c3: SPI Speed      : 80MHz
I (37) boot.esp32c3: SPI Mode       : DIO
I (42) boot.esp32c3: SPI Flash Size : 4MB
I (47) boot: Enabling RNG early entropy source...
I (52) boot: Partition Table:
I (56) boot: ## Label            Usage          Type ST Offset   Length
I (63) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (70) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (78) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (85) boot:  3 ota_0            OTA app          00 10 00010000 00180000
I (93) boot:  4 ota_1            OTA app          00 11 00190000 00180000
I (100) boot:  5 settings         unknown          40 00 00310000 00001000
I (108) boot:  6 file             unknown          40 00 00311000 000ef000
I (115) boot: End of partition table
I (120) esp_image: segment 0: paddr=00010020 vaddr=3c0e0020 size=2fb70h (195440) mapI (157) esp_image: segment 1: paddr=0003fb98 vaddr=3fc8fe00 size=00480h (  1152) load
I (158) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=dd01ch (905244) mapI (299) esp_image: segment 3: paddr=0011d044 vaddr=3fc90280 size=03790h ( 14224) load
I (302) esp_image: segment 4: paddr=001207dc vaddr=40380000 size=0fc48h ( 64584) load
I (316) esp_image: segment 5: paddr=0013042c vaddr=50000000 size=00010h (    16) load
I (322) boot: Loaded app from partition at offset 0x10000
I (322) boot: Disabling RNG early entropy source...
I (337) cpu_start: Pro cpu up.
I (349) cpu_start: Pro cpu start user code
I (349) cpu_start: cpu freq: 160000000
I (349) cpu_start: Application information:
I (352) cpu_start: Project name:     blufi_demo
I (357) cpu_start: App version:      1
I (361) cpu_start: Compile time:     Mar  1 2022 11:06:06
I (368) cpu_start: ELF file SHA256:  599887c811daf121...
I (374) cpu_start: ESP-IDF:          v4.3.2-dirty
I (379) heap_init: Initializing. RAM available for dynamic allocation:
I (386) heap_init: At 3FC9B890 len 00024770 (145 KiB): DRAM
I (392) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
I (399) heap_init: At 50000010 len 00001FF0 (7 KiB): RTCRAM
I (406) spi_flash: detected chip: generic
I (410) spi_flash: flash io: dio
I (415) sleep: Configure to isolate all GPIO pins in sleep state
I (421) sleep: Enable automatic switching of GPIO sleep configuration
I (428) cpu_start: Starting scheduler.
I (437) coexist: coexist rom version 9387209
I (437) pp: pp rom version: 9387209
I (437) net80211: net80211 rom version: 9387209
I (457) wifi:wifi driver task: 3fca46b4, prio:23, stack:6656, core=0
I (457) system_api: Base MAC address is not set
I (457) system_api: read default base MAC address from EFUSE
I (467) wifi:wifi firmware version: eb52264
I (467) wifi:wifi certification version: v7.0
I (467) wifi:config NVS flash: enabled
I (477) wifi:config nano formating: disabled
I (477) wifi:Init data frame dynamic rx buffer num: 32
I (487) wifi:Init management frame dynamic rx buffer num: 32
I (487) wifi:Init management short buffer num: 32
I (497) wifi:Init dynamic tx buffer num: 32
I (497) wifi:Init static tx FG buffer num: 2
I (497) wifi:Init static rx buffer size: 1600
I (507) wifi:Init static rx buffer num: 10
I (507) wifi:Init dynamic rx buffer num: 32
I (517) wifi_init: rx ba win: 6
I (517) wifi_init: tcpip mbox: 32
I (517) wifi_init: udp mbox: 6
I (527) wifi_init: tcp mbox: 6
I (527) wifi_init: tcp tx win: 5744
I (537) wifi_init: tcp rx win: 5744
I (537) wifi_init: tcp mss: 1440
I (537) wifi_init: WiFi IRAM OP enabled
I (547) wifi_init: WiFi RX IRAM OP enabled
I (547) phy_init: phy_version 905,7b93cd2,Oct 25 2021,15:05:11
I (597) wifi:set rx active PTI: 0, rx ack PTI: 12, and default PTI: 1
I (597) wifi:mode : sta (60:55:f9:28:88:c4)
I (597) wifi:enable tsf
I (597) BLUFI_EXAMPLE: WIFI_EVENT_STA_START

W (607) BTDM_INIT: esp_bt_controller_mem_release not implemented, return OK
I (607) wifi:new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
I (617) wifi:state: init -> auth (b0)
I (617) BTDM_INIT: BT controller compile version [3e61eea]
I (627) coexist: coexist rom version 9387209
I (627) BTDM_INIT: Bluetooth MAC: 60:55:f9:28:88:c5

I (637) wifi:state: auth -> assoc (0)
I (657) BLUFI_EXAMPLE: BD ADDR: 60:55:f9:28:88:c5

I (657) BLUFI_EXAMPLE: BLUFI init finish

W (657) BT_BTM: BTM_BleWriteAdvData, Partial data write into ADV
I (667) BLUFI_EXAMPLE: BLUFI VERSION 0102

I (667) Protocol: 0x3fcb7580   fa 00 00 00 00 02 00 11  8c ff 05 00              |............|
I (677) : start tcp_client_task
I (677) WIFI: wait to get IP
I (677) : start tcp_client_recv_task
I (687) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (697) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (697) wifi:state: assoc -> run (10)
I (707) : start state_led_task
W (707) wifi:<ba-add>idx:0 (ifx:0, 58:41:20:09:d9:62), tid:5, ssn:0, winSize:64
I (717) : start get_RSSI_task
I (717) BLUFI_EXAMPLE: set rssi threshold
I (817) wifi:connected with TP-LINK_JSB_WZ, aid = 1, channel 1, 40U, bssid = 58:41:20:09:d9:62
I (817) wifi:security: WPA2-PSK, phy: bgn, rssi: -47
I (817) wifi:pm start, type: 1

I (817) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 14, mt_pti: 25000, mt_time: 10000
dhcp_start(netif=0x3fca1d70) st1
dhcp_start(): restarting DHCP configuration
dhcp_start(): starting DHCP configuration
udp_bind(ipaddr = 0.0.0.0, port = 68)
udp_bind: bound to 0.0.0.0, port 68)
I (847) wifi:BcnInt:102400, DTIM:1
udp_connect: connected to 0.0.0.0, port 67)
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(15c2adad)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d888
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x1cb6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        0      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9d     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 500 msecs
I (947) BLUFI_EXAMPLE: WIFI_EVENT_STA_CONNECTED

I (957) BLUFI_EXAMPLE: rssi:-46
I (957) Protocol: 0x3fcbc958   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (967) BLUFI_EXAMPLE: mac:MAC6055f92888c4
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(15c2adad)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d888
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x1cb6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        1      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9c     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 1000 msecs
dhcp_coarse_tmr()
I (1677) WIFI: wait to get IP
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(15c2adad)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d888
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x1cb6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        2      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9b     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 2000 msecs
dhcp_coarse_tmr()
I (2677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (3677) WIFI: wait to get IP
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(15c2adad)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)      
udp_send: added header in given pbuf 0x3fc9d888
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x1cb6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        3      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9a     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 4000 msecs
dhcp_coarse_tmr()
I (4677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (5677) WIFI: wait to get IP
I (5727) BLUFI_EXAMPLE: set rssi threshold
dhcp_coarse_tmr()
I (6477) BLUFI_EXAMPLE: rssi:-43
I (6477) Protocol: 0x3fcbc958   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (6477) BLUFI_EXAMPLE: mac:MAC6055f92888c4
I (6677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (7677) WIFI: wait to get IP
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(15c2adad)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d888
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x1cb6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        4      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba99     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 8000 msecs
dhcp_coarse_tmr()
I (8677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (9677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (10677) WIFI: wait to get IP
I (10727) BLUFI_EXAMPLE: set rssi threshold
I (10987) BLUFI_EXAMPLE: rssi:-43
I (10987) Protocol: 0x3fcbc958   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (10987) BLUFI_EXAMPLE: mac:MAC6055f92888c4
dhcp_coarse_tmr()
I (11677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (12677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (13677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (14677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (15677) WIFI: wait to get IP
I (15727) BLUFI_EXAMPLE: set rssi threshold
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(15c2adad)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d888
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x1cb6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        5      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba98     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 15000 msecs
dhcp_coarse_tmr()
I (16617) BLUFI_EXAMPLE: rssi:-42
I (16617) Protocol: 0x3fcbc958   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (16617) BLUFI_EXAMPLE: mac:MAC6055f92888c4
I (16677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (17677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (18677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (19677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (20677) WIFI: wait to get IP
I (20727) BLUFI_EXAMPLE: set rssi threshold
I (21117) BLUFI_EXAMPLE: rssi:-42
I (21117) Protocol: 0x3fcbc958   fa 00 00 00 00 02 00 11  8c e7 04 1f              |
|............|
I (21127) BLUFI_EXAMPLE: mac:MAC6055f92888c4
dhcp_coarse_tmr()
I (21677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (22677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (23677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (24677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (25677) WIFI: wait to get IP
I (25727) BLUFI_EXAMPLE: set rssi threshold
dhcp_coarse_tmr()
I (26447) BLUFI_EXAMPLE: rssi:-47
I (26447) Protocol: 0x3fcbc958   fa 00 00 00 00 02 00 11  8c e7 04 1f              |
|............|
I (26447) BLUFI_EXAMPLE: mac:MAC6055f92888c4
I (26677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (27677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (28677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (29677) WIFI: wait to get IP
dhcp_coarse_tmr()
I (30677) WIFI: wait to get IP
I (30727) BLUFI_EXAMPLE: set rssi threshold
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(15c2adad)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)     
udp_send: added header in given pbuf 0x3fc9d888
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x1cb6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        6      |000|       0   | (id, flags, offset)

Code: Select all

#define IP_DEBUG                        LWIP_DBG_ON

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

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Tue Mar 01, 2022 3:31 am

看起 LWIP 模块没有收到底层上来的包,不确定是不是共存导致 WIFI RX 没收到路由器的 DHCP offer。你如果把蓝牙关了,能不能获取到 IP。

liutao
Posts: 24
Joined: Fri Feb 25, 2022 3:11 am

Re: ESP32 DHCP 获取不到IP

Postby liutao » Tue Mar 01, 2022 4:35 am

ESP_YJM wrote:
Tue Mar 01, 2022 3:31 am
看起 LWIP 模块没有收到底层上来的包,不确定是不是共存导致 WIFI RX 没收到路由器的 DHCP offer。你如果把蓝牙关了,能不能获取到 IP。

Code: Select all

Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x189c
load:0x403ce000,len:0x8d4
load:0x403d0000,len:0x2dc0
entry 0x403ce000
I (30) boot: ESP-IDF v4.3.2-dirty 2nd stage bootloader
I (30) boot: compile time 17:21:58
I (30) boot: chip revision: 3
I (32) boot.esp32c3: SPI Speed      : 80MHz
I (37) boot.esp32c3: SPI Mode       : DIO
I (42) boot.esp32c3: SPI Flash Size : 4MB
I (47) boot: Enabling RNG early entropy source...
I (52) boot: Partition Table:
I (56) boot: ## Label            Usage          Type ST Offset   Length
I (63) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (70) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (78) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (85) boot:  3 ota_0            OTA app          00 10 00010000 00180000
I (93) boot:  4 ota_1            OTA app          00 11 00190000 00180000
I (100) boot:  5 settings         unknown          40 00 00310000 00001000
I (108) boot:  6 file             unknown          40 00 00311000 000ef000
I (115) boot: End of partition table
I (120) esp_image: segment 0: paddr=00010020 vaddr=3c0e0020 size=2e978h (190840) map
I (157) esp_image: segment 1: paddr=0003e9a0 vaddr=3fc8fa00 size=01678h (  5752) load
I (158) esp_image: segment 2: paddr=00040020 vaddr=42000020 size=d9120h (889120) map
I (296) esp_image: segment 3: paddr=00119148 vaddr=3fc91078 size=02508h (  9480) load
I (298) esp_image: segment 4: paddr=0011b658 vaddr=40380000 size=0f9c4h ( 63940) load
I (313) esp_image: segment 5: paddr=0012b024 vaddr=50000000 size=00010h (    16) load
I (318) boot: Loaded app from partition at offset 0x10000
I (318) boot: Disabling RNG early entropy source...
I (333) cpu_start: Pro cpu up.
I (346) cpu_start: Pro cpu start user code
I (346) cpu_start: cpu freq: 160000000
I (346) cpu_start: Application information:
I (349) cpu_start: Project name:     blufi_demo
I (354) cpu_start: App version:      1
I (358) cpu_start: Compile time:     Mar  1 2022 11:06:06
I (364) cpu_start: ELF file SHA256:  dccdcc93cb891f02...
I (370) cpu_start: ESP-IDF:          v4.3.2-dirty
I (376) heap_init: Initializing. RAM available for dynamic allocation:
I (383) heap_init: At 3FC9B300 len 00024D00 (147 KiB): DRAM
I (389) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
I (396) heap_init: At 50000010 len 00001FF0 (7 KiB): RTCRAM
I (403) spi_flash: detected chip: generic
I (407) spi_flash: flash io: dio
I (411) sleep: Configure to isolate all GPIO pins in sleep state
I (418) sleep: Enable automatic switching of GPIO sleep configuration
I (425) cpu_start: Starting scheduler.
I (434) coexist: coexist rom version 9387209
I (434) pp: pp rom version: 9387209
I (434) net80211: net80211 rom version: 9387209
I (454) wifi:wifi driver task: 3fca4124, prio:23, stack:6656, core=0
I (454) system_api: Base MAC address is not set
I (454) system_api: read default base MAC address from EFUSE
I (464) wifi:wifi firmware version: eb52264
I (464) wifi:wifi certification version: v7.0
I (464) wifi:config NVS flash: enabled
I (474) wifi:config nano formating: disabled
I (474) wifi:Init data frame dynamic rx buffer num: 32
I (484) wifi:Init management frame dynamic rx buffer num: 32
I (484) wifi:Init management short buffer num: 32
I (494) wifi:Init dynamic tx buffer num: 32
I (494) wifi:Init static tx FG buffer num: 2
I (494) wifi:Init static rx buffer size: 1600
I (504) wifi:Init static rx buffer num: 10
I (504) wifi:Init dynamic rx buffer num: 32
I (514) wifi_init: rx ba win: 6
I (514) wifi_init: tcpip mbox: 32
I (514) wifi_init: udp mbox: 6
I (524) wifi_init: tcp mbox: 6
I (524) wifi_init: tcp tx win: 5744
I (534) wifi_init: tcp rx win: 5744
I (534) wifi_init: tcp mss: 1440
I (534) wifi_init: WiFi IRAM OP enabled
I (544) wifi_init: WiFi RX IRAM OP enabled
I (544) phy_init: phy_version 905,7b93cd2,Oct 25 2021,15:05:11
I (594) wifi:set rx active PTI: 0, rx ack PTI: 12, and default PTI: 1
I (594) wifi:mode : sta (60:55:f9:28:88:c4)
I (594) wifi:enable tsf
I (594) BLUFI_EXAMPLE: WIFI_EVENT_STA_START

W (604) BTDM_INIT: esp_bt_controller_mem_release not implemented, return OK        
I (604) wifi:new:<1,1>, old:<1,0>, ap:<255,255>, sta:<1,1>, prof:1
I (614) wifi:state: init -> auth (b0)
I (624) Protocol: 0x3fca9abc   fa 00 00 00 00 02 00 11  8c ff 05 00              |............|
I (624) : start tcp_client_task
I (634) WIFI: wait to get IP
I (634) : start tcp_client_recv_task
I (634) wifi:state: auth -> assoc (0)
I (644) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 
0| Intr:0
I (654) gpio: GPIO[5]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 
0| Intr:0
I (664) : start state_led_task
I (664) : start get_RSSI_task
I (664) BLUFI_EXAMPLE: set rssi threshold
I (694) wifi:state: assoc -> run (10)
W (704) wifi:<ba-add>idx:0 (ifx:0, 58:41:20:09:d9:62), tid:5, ssn:0, winSize:64
I (804) wifi:connected with TP-LINK_JSB_WZ, aid = 1, channel 1, 40U, bssid = 58:41:20:09:d9:62
I (804) wifi:security: WPA2-PSK, phy: bgn, rssi: -46
I (814) wifi:pm start, type: 1

I (814) wifi:set rx beacon pti, rx_bcn_pti: 14, bcn_timeout: 14, mt_pti: 25000, mt_time: 10000
dhcp_start(netif=0x3fca17e0) st1
dhcp_start(): restarting DHCP configuration
dhcp_start(): starting DHCP configuration
udp_bind(ipaddr = 0.0.0.0, port = 68)
udp_bind: bound to 0.0.0.0, port 68)
udp_connect: connected to 0.0.0.0, port 67)
dhcp_discover()
dhcp_discover(): dhcp state is DISCOVER
dhcp_select: could not allocate DHCP request
transaction id xid(42694118)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d2f8
I (864) wifi:BcnInt:102400, DTIM:1
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x0af6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        0      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9d     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 500 msecs
I (934) BLUFI_EXAMPLE: WIFI_EVENT_STA_CONNECTED

I (944) BLUFI_EXAMPLE: rssi:-46
I (944) Protocol: 0x3fca42a8   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (954) BLUFI_EXAMPLE: mac:MAC6055f92888c4
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(42694118)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d2f8
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x0af6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        1      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9c     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 1000 msecs
dhcp_coarse_tmr()
I (1634) WIFI: wait to get IP
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(42694118)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)     
udp_send: added header in given pbuf 0x3fc9d2f8
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x0af6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        2      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9b     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 2000 msecs
dhcp_coarse_tmr()
I (2634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (3634) WIFI: wait to get IP
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(42694118)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d2f8
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x0af6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        3      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba9a     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 4000 msecs
dhcp_coarse_tmr()
I (4634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (5634) WIFI: wait to get IP
I (5674) BLUFI_EXAMPLE: set rssi threshold
dhcp_coarse_tmr()
I (6504) BLUFI_EXAMPLE: rssi:-44
I (6504) Protocol: 0x3fca42a8   fa 00 00 00 00 02 00 11  8c e7 04 1f              |............|
I (6504) BLUFI_EXAMPLE: mac:MAC6055f92888c4
I (6634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (7634) WIFI: wait to get IP
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(42694118)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
udp_send: added header in given pbuf 0x3fc9d2f8
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x0af6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        4      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba99     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 8000 msecs
dhcp_coarse_tmr()
I (8634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (9634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (10634) WIFI: wait to get IP
I (10674) BLUFI_EXAMPLE: set rssi threshold
I (11004) BLUFI_EXAMPLE: rssi:-43
I (11004) Protocol: 0x3fca42a8   fa 00 00 00 00 02 00 11  8c e7 04 1f
|............|
I (11004) BLUFI_EXAMPLE: mac:MAC6055f92888c4
dhcp_coarse_tmr()
I (11634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (12634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (13634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (14634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (15634) WIFI: wait to get IP
I (15674) BLUFI_EXAMPLE: set rssi threshold
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(42694118)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)     
udp_send: added header in given pbuf 0x3fc9d2f8
udp_send: sending datagram of length 316
udp_send: UDP packet length 316
udp_send: UDP checksum 0x0af6
udp_send: ip_output_if (,,,,0x11,)
ip4_output_if: st1
IP header:
+-------------------------------+
| 4 | 5 |  0x00 |       336     | (v, hl, tos, len)
+-------------------------------+
|        5      |000|       0   | (id, flags, offset)
+-------------------------------+
|  255  |   17  |    0xba98     | (ttl, proto, chksum)
+-------------------------------+
|    0  |    0  |    0  |    0  | (src)
+-------------------------------+
|  255  |  255  |  255  |  255  | (dest)
+-------------------------------+
ip4_output_if: call netif->output()
dhcp_discover: deleting()ing
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 15000 msecs
dhcp_coarse_tmr()
I (16634) WIFI: wait to get IP
I (16634) BLUFI_EXAMPLE: rssi:-41
I (16634) Protocol: 0x3fca42a8   fa 00 00 00 00 02 00 11  8c e7 04 1f
|............|
I (16644) BLUFI_EXAMPLE: mac:MAC6055f92888c4
dhcp_coarse_tmr()
I (17634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (18634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (19634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (20634) WIFI: wait to get IP
I (20674) BLUFI_EXAMPLE: set rssi threshold
I (21144) BLUFI_EXAMPLE: rssi:-36
I (21144) Protocol: 0x3fca42a8   fa 00 00 00 00 02 00 11  8c e7 04 1f
|............|
I (21144) BLUFI_EXAMPLE: mac:MAC6055f92888c4
dhcp_coarse_tmr()
I (21634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (22634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (23634) WIFI: wait to get IP
dhcp_coarse_tmr()
I (24634) WIFI: wait to get IP
注释了蓝牙的初始化也不行

liutao
Posts: 24
Joined: Fri Feb 25, 2022 3:11 am

Re: ESP32 DHCP 获取不到IP

Postby liutao » Tue Mar 01, 2022 4:55 am

ESP_YJM wrote:
Tue Mar 01, 2022 3:31 am
看起 LWIP 模块没有收到底层上来的包,不确定是不是共存导致 WIFI RX 没收到路由器的 DHCP offer。你如果把蓝牙关了,能不能获取到 IP。
AT固件.png
AT固件.png (72.87 KiB) Viewed 8211 times
下载了ESP32-C3-MINI-1-V2.3.0.0的固件,也是获取不到IP

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

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Tue Mar 01, 2022 6:16 am

使用 IDF wifi station 示例(examples/wifi/getting_started/station)也拿不到 IP?是只有这个路由器拿不到 IP 还是都拿不到 IP?换个模组能否拿到 IP?

liutao
Posts: 24
Joined: Fri Feb 25, 2022 3:11 am

Re: ESP32 DHCP 获取不到IP

Postby liutao » Tue Mar 01, 2022 6:33 am

ESP_YJM wrote:
Tue Mar 01, 2022 6:16 am
使用 IDF wifi station 示例(examples/wifi/getting_started/station)也拿不到 IP?是只有这个路由器拿不到 IP 还是都拿不到 IP?换个模组能否拿到 IP?
模组.jpg
模组.jpg (201.31 KiB) Viewed 8096 times
尝试了这3个模块,下载了examples/wifi/getting_started/station例程都不能获取到IP。
DHCP-station.png
DHCP-station.png (72 KiB) Viewed 8096 times
还有比较奇怪的是,能抓到手机的discover和request,抓不到模块的

liutao
Posts: 24
Joined: Fri Feb 25, 2022 3:11 am

Re: ESP32 DHCP 获取不到IP

Postby liutao » Tue Mar 01, 2022 6:35 am

ESP_YJM wrote:
Tue Mar 01, 2022 6:16 am
使用 IDF wifi station 示例(examples/wifi/getting_started/station)也拿不到 IP?是只有这个路由器拿不到 IP 还是都拿不到 IP?换个模组能否拿到 IP?
只要esp32c3连这个路由器都很难获取到IP,手机电脑都有很多连这个wifi正常使用。
esp32c3连接其他wifi都能获取到IP。

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

Re: ESP32 DHCP 获取不到IP

Postby ESP_YJM » Tue Mar 01, 2022 6:36 am

换个路由器能获取到吗?

Who is online

Users browsing this forum: No registered users and 110 guests