Esp32 ethernet basic not accepting DHCP offer from DNSMasq

InterBilly
Posts: 13
Joined: Mon Jul 31, 2023 4:53 pm

Esp32 ethernet basic not accepting DHCP offer from DNSMasq

Postby InterBilly » Mon Jul 31, 2023 5:13 pm

Hi,

I am trying to get the ESP32 ethernet basic example working. The ESP is connected via LAN8720 to an Odroid SBC running Ubuntu and DNSMasq.

When I run the application the output from the ESP is:

I (417) app_start: Starting scheduler on CPU0
I (421) app_start: Starting scheduler on CPU1
I (421) main_task: Started on CPU0
I (431) main_task: Calling app_main()
I (451) eth_example: Eth ports(s) detected: 1
I (451) esp_eth.netif.netif_glue: 3c:71:bf:6b:c6:37
I (451) esp_eth.netif.netif_glue: ethernet attached to netif
I (2151) eth_example: Ethernet Started
I (2151) eth_example: Ethernet Link Up
I (2151) eth_example: Ethernet HW Addr 3c:71:bf:6b:c6:37


DNSMasq:

Jul 31 19:09:05 dev-ODROID-H2 dnsmasq-dhcp[809]: DHCPDISCOVER(enp3s0) 3c:71:bf:6b:c6:37
Jul 31 19:09:05 dev-ODROID-H2 dnsmasq-dhcp[809]: DHCPOFFER(enp3s0) 10.0.64.74 3c:71:bf:6b:c6:37

It seems there is a connection and an IP address is offered, why won't the ESP accept it?

Any advice is greatly appreciated.
Thank you.

ESP_ondrej
Posts: 211
Joined: Fri May 07, 2021 10:35 am

Re: Esp32 ethernet basic not accepting DHCP offer from DNSMasq

Postby ESP_ondrej » Thu Aug 03, 2023 2:48 pm

Hi, what board do you use? Enable log level in `esp_eth_mac_esp.c` to see if any frame is received (https://github.com/espressif/esp-idf/bl ... esp.c#L295).

InterBilly
Posts: 13
Joined: Mon Jul 31, 2023 4:53 pm

Re: Esp32 ethernet basic not accepting DHCP offer from DNSMasq

Postby InterBilly » Fri Aug 04, 2023 10:54 am

Hi,

Thank you for for helping out!
I tried changing it to ESP_LOGV but this did not result in any additional logging.
Adding a few printf's in the function I noticed that the function never gets past

Code: Select all

ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
on line 278.

The comment says: "block indefinitely until got notification from underlay event"
It seems to me it is stuck here but I don't know what "underlay event" is and I can't find anything about it.

The board I'm using is a Esp32 Nodemcu Module like this one:
Image

ESP_ondrej
Posts: 211
Joined: Fri May 07, 2021 10:35 am

Re: Esp32 ethernet basic not accepting DHCP offer from DNSMasq

Postby ESP_ondrej » Sat Aug 05, 2023 7:14 pm

Does it mean you connected some LAN8720 devboard to ESP32 Nodemcu via wires? If so, please check if the wiring is correct. It seems you are able to transmit but there is some issue at Rx side. See viewtopic.php?f=13&t=34644, user had similar issue with their custom board. Also check that the wires are short as much as possible and they are matched length. RMII is high speed bus so the signal integrity matters. We have experience that using wires to connect PHY usually works but it is not ideal...

Regarding "block indefinitely until got notification from underlay event", the driver waits for the Rx interrupt to process the data from EMAC. The interrupt is fired only when valid Ethernet frame is received by internal EMAC.

InterBilly
Posts: 13
Joined: Mon Jul 31, 2023 4:53 pm

Re: Esp32 ethernet basic not accepting DHCP offer from DNSMasq

Postby InterBilly » Tue Sep 12, 2023 6:38 pm

Thank you for your last reply and sorry for the late reaction, I bought a WT32-ETH01 (https://files.seeedstudio.com/products/ ... -%20en.pdf) to rule out wiring problems.
After some struggling I managed to get where I was with the previous setup (freezing after "eth_example: Ethernet HW Addr 3c:71:bf:6b:c6:37")

Trying things I changed:

Code: Select all

ESP_LOGD(TAG, "receive len= %d", recv_len);
to

Code: Select all

ESP_LOGE(TAG, "receive len= %d", recv_len);
and instead of connecting via a switch to an ODROID running DNSmasq I connected it to my home network, now I get a different output:

Code: Select all

I (376) app_start: Starting scheduler on CPU0
I (381) app_start: Starting scheduler on CPU1
I (381) main_task: Started on CPU0
I (391) main_task: Calling app_main()
I (421) esp_eth.netif.netif_glue: 80:64:6f:e9:ed:57
I (421) esp_eth.netif.netif_glue: ethernet attached to netif
I (1921) main_task: Returned from app_main()
I (1921) eth_example: Ethernet Started
I (1921) eth_example: Ethernet Link Up
I (1921) eth_example: Ethernet HW Addr 80:64:6f:e9:ed:57
E (2911) esp.emac: receive len= 60
E (3151) esp.emac: receive len= 86
E (4271) esp.emac: receive len= 234
E (4271) esp.emac: receive len= 276
E (4911) esp.emac: receive len= 60
E (6891) esp.emac: receive len= 369
E (6911) esp.emac: receive len= 60
E (7001) esp.emac: receive len= 369
E (7111) esp.emac: receive len= 378
etc...

It looks like its reading my home network data but I'm not sure. And still no IP received.
I've looked all over for a WT32-ETH01 specific guide (non arduino) but could not find anything.
I tried to include my SDKconfig but it was pages long so I used pastebin https://pastebin.com/n0jzdTji

ESP_ondrej
Posts: 211
Joined: Fri May 07, 2021 10:35 am

Re: Esp32 ethernet basic not accepting DHCP offer from DNSMasq

Postby ESP_ondrej » Mon Sep 18, 2023 6:38 am

Do other devices on your local network get assigned IP addresses from DHCP server? It's strange since your device receives Ethernet frames as indicated by the log you provided.

If I were you, I would connect the device directly to a PC with DHCP server running and capture traffic to see what's going on.

InterBilly
Posts: 13
Joined: Mon Jul 31, 2023 4:53 pm

Re: Esp32 ethernet basic not accepting DHCP offer from DNSMasq

Postby InterBilly » Mon Sep 25, 2023 4:45 pm

Thank you for your reply!

I used a laptop, disabled wifi, set a static ip on the network interface, ran tftpd64 DHCP server on the interface and connected a second laptop.

The second laptop is detected by the DHCP server and is given an ip address.

When I connect the WT32_ETH01 the laptop running tftpd64 does not detect anything.
I also ran wireshark to see the the traffic but there is only 3 ARP's from the DHCP host to see (I assume) if there is no conflict with the static ip, after that there are numerous messages from that static address and nothing else.

I also enabled the LWIP debug options in the SDK config resulting in A LOT more information:

Code: Select all

I (31) boot: ESP-IDF v5.1.1-dirty 2nd stage bootloader
I (31) boot: compile time Sep 25 2023 17:17:25
I (31) boot: Multicore bootloader
I (36) boot: chip revision: v1.1
I (39) boot.esp32: SPI Speed      : 40MHz
I (44) boot.esp32: SPI Mode       : DIO
I (49) boot.esp32: SPI Flash Size : 2MB
I (53) boot: Enabling RNG early entropy source...
I (59) boot: Partition Table:
I (62) boot: ## Label            Usage          Type ST Offset   Length
I (69) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (77) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (84) boot:  2 factory          factory app      00 00 00010000 00100000
I (92) boot: End of partition table
I (96) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=15728h ( 87848) map  
I (136) esp_image: segment 1: paddr=00025750 vaddr=3ffb0000 size=021d8h (  8664) load
I (140) esp_image: segment 2: paddr=00027930 vaddr=40080000 size=086e8h ( 34536) load
I (156) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=30634h (198196) map 
I (228) esp_image: segment 4: paddr=0006065c vaddr=400886e8 size=04238h ( 16952) load
I (242) boot: Loaded app from partition at offset 0x10000     
I (242) boot: Disabling RNG early entropy source...
I (254) cpu_start: Multicore app
I (254) cpu_start: Pro cpu up.
I (254) cpu_start: Starting app cpu, entry point is 0x40081204
0x40081204: call_start_cpu1 at C:/Espressif/frameworks/esp-idf-v5.1.1/components/esp_system/port/cpu_start.c:154

I (0) cpu_start: App cpu up.
I (272) cpu_start: Pro cpu start user code
I (272) cpu_start: cpu freq: 160000000 Hz
I (272) cpu_start: Application information:
I (277) cpu_start: Project name:     ethernet_basic
I (282) cpu_start: App version:      1
I (287) cpu_start: Compile time:     Sep 25 2023 17:28:30
I (293) cpu_start: ELF file SHA256:  395d184e46fae6a5...
I (299) cpu_start: ESP-IDF:          v5.1.1-dirty
I (304) cpu_start: Min chip rev:     v0.0
I (309) cpu_start: Max chip rev:     v3.99 
I (314) cpu_start: Chip rev:         v1.1
I (319) heap_init: Initializing. RAM available for dynamic allocation:
I (326) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (332) heap_init: At 3FFB3460 len 0002CBA0 (178 KiB): DRAM
I (338) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (344) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (351) heap_init: At 4008C920 len 000136E0 (77 KiB): IRAM
I (358) spi_flash: detected chip: generic
I (361) spi_flash: flash io: dio
W (365) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (379) app_start: Starting scheduler on CPU0
I (384) app_start: Starting scheduler on CPU1
I (384) main_task: Started on CPU0
I (394) main_task: Calling app_main()
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 (434) esp_eth.netif.netif_glue: 80:64:6f:e9:ed:57
I (434) esp_eth.netif.netif_glue: ethernet attached to netif
etharp_timer
I think DHCP starts here...

Code: Select all

dhcp_coarse_tmr()
pbuf_alloc(length=16)
pbuf_alloc(length=16) == 0x3ffbc090
pbuf_add_header: old 0x3ffbc0d8 new 0x3ffbc0b0 (40)
ip6_output_if: lo0
IPv6 header:
+-------------------------------+
|  6 |    0  |            0     | (ver, class, flow)
+-------------------------------+
|        16     |   58  |  255  | (plen, nexth, hopl)
+-------------------------------+
|     0 |     0 |     0 |     0 | (src)
|     0 |     0 |     0 |     1 |
+-------------------------------+
|  ff02 |     0 |     0 |     0 | (dest)
|     0 |     0 |     0 |     2 |
+-------------------------------+
netif->output_ip6()
pbuf_alloc(length=56)
pbuf_alloc(length=56) == 0x3ffbc0ec
pbuf_copy(0x3ffbc0ec, 0x3ffbc090)
pbuf_copy_partial_pbuf(0x3ffbc0ec, 0x3ffbc090, 56, 0)
pbuf_copy_partial_pbuf: copy complete.
pbuf_free(0x3ffbc090)
pbuf_free: deallocating 0x3ffbc090
ip6_input: packet not for us.
pbuf_free(0x3ffbc0ec)
pbuf_free: deallocating 0x3ffbc0ec
etharp_timer
dhcp_coarse_tmr()
netif: added interface en IP addr 0.0.0.0 netmask 0.0.0.0 gw 0.0.0.0
I (3294) main_task: Returned from app_main()
I (3294) eth_example: Ethernet Started
netif: setting default interface en
dhcp_start(netif=0x3ffbbd68) en1
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
pbuf_alloc(length=308)
pbuf_alloced_custom(length=60)
pbuf_alloc(length=308) == 0x3ffb4814
transaction id xid(50c7cb4c)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
pbuf_add_header: old 0x3ffb4870 new 0x3ffb4868 (8)
pbuf_add_header: old 0x3ffb4868 new 0x3ffb4854 (20)
ip4_output_if: en1
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)
+-------------------------------+
pbuf_alloced_custom(length=157)
ip4_output_if: call netif->output()
pbuf_add_header: old 0x3ffb4854 new 0x3ffb4846 (14)
pbuf_alloced_custom(length=60)
ethernet_output: sending packet 0x3ffb4814
pbuf_alloced_custom(length=78)
dhcp_discover: deleting()ing
pbuf_free(0x3ffb4814)
pbuf_free: deallocating 0x3ffb4814
dhcp_discover: SELECTING
pbuf_alloced_custom(length=62)
dhcp_discover(): set request timeout 500 msecs
pbuf_alloced_custom(length=90)
I (3424) eth_example: Ethernet Link Up
etharp_timer
I (3434) eth_example: Ethernet HW Addr 80:64:6f:e9:ed:57
dhcp_coarse_tmr()
The next line is stating it received something, the src hw address is from the laptop running tftpd64 DHCP server

Code: Select all

ethernet_input: dest:01:80:c2:00:00:0e, src:f0:de:f1:95:fa:52, type:88cc
pbuf_free(0x3ffafc34)
pbuf_free: deallocating 0x3ffafc34
ethernet_input: dest:33:33:00:01:00:02, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb49a8 new 0x3ffb49b6 (14)
ip6_input: packet not for us.
But it is dropped... DHCP discover, and DHCP timeout go in a loop from here..

Code: Select all

pbuf_free(0x3ffafc68)
pbuf_free: deallocating 0x3ffafc68
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:f0:de:f1:95:fa:52, type:806
pbuf_remove_header: old 0x3ffafc9c new 0x3ffafcaa (14)
etharp_update_arp_entry: 0.0.0.0 - f0:de:f1:95:fa:52
etharp_update_arp_entry: will not add non-unicast IP address to ARP cache
etharp_input: incoming ARP request
etharp_input: we are unconfigured, ARP request ignored.
pbuf_free(0x3ffb4a4c)
pbuf_free: deallocating 0x3ffb4a4c
ethernet_input: dest:33:33:ff:b2:62:78, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4a6c new 0x3ffb4a7a (14)
ip6_input: packet not for us.
pbuf_free(0x3ffb4ac0)
pbuf_free: deallocating 0x3ffb4ac0
ethernet_input: dest:33:33:00:00:00:02, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4828 new 0x3ffb4836 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffb486c)
pbuf_free: deallocating 0x3ffb486c
ethernet_input: dest:33:33:00:00:00:16, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb48a0 new 0x3ffb48ae (14)
ip6_input: packet not for us.
pbuf_free(0x3ffb4900)
pbuf_free: deallocating 0x3ffb4900
pbuf_alloced_custom(length=90)
ethernet_input: dest:33:33:00:00:00:16, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffafbf4 new 0x3ffafc02 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffafc54)
pbuf_free: deallocating 0x3ffafc54
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) == 0x3ffb4948
transaction id xid(50c7cb4c)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
pbuf_add_header: old 0x3ffb49a4 new 0x3ffb499c (8)
pbuf_add_header: old 0x3ffb499c new 0x3ffb4988 (20)
ip4_output_if: en1
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 0x3ffb4988 new 0x3ffb497a (14)
ethernet_output: sending packet 0x3ffb4948
dhcp_discover: deleting()ing
pbuf_free(0x3ffb4948)
pbuf_free: deallocating 0x3ffb4948
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 1000 msecs
pbuf_alloced_custom(length=60)
ethernet_input: dest:01:80:c2:00:00:0e, src:f0:de:f1:95:fa:52, type:88cc
pbuf_free(0x3ffafc48)
pbuf_free: deallocating 0x3ffafc48
pbuf_alloced_custom(length=157)
ethernet_input: dest:33:33:00:01:00:02, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffafc08 new 0x3ffafc16 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffafcac)
pbuf_free: deallocating 0x3ffafcac
pbuf_alloced_custom(length=60)
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:f0:de:f1:95:fa:52, type:806
pbuf_remove_header: old 0x3ffafc08 new 0x3ffafc16 (14)
pbuf_alloced_custom(length=86)
etharp_update_arp_entry: 0.0.0.0 - f0:de:f1:95:fa:52
etharp_update_arp_entry: will not add non-unicast IP address to ARP cache
etharp_input: incoming ARP request
etharp_input: we are unconfigured, ARP request ignored.
pbuf_free(0x3ffafc48)
pbuf_alloced_custom(length=90)
pbuf_free: deallocating 0x3ffafc48
etharp_timer
dhcp_coarse_tmr()
ethernet_input: dest:33:33:00:00:00:01, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffafc7c new 0x3ffafc8a (14)
pbuf_alloced_custom(length=60)
pbuf_remove_header: old 0x3ffafc8a new 0x3ffafcb2 (40)
pbuf_alloced_custom(length=90)
ip6_input:
pbuf_alloced_custom(length=60)
IPv6 header:
+-------------------------------+
pbuf_alloced_custom(length=81)
|  8 |  128  |        42786     | (ver, class, flow)
+-------------------------------+
|      8192     |    0  |    0  | (plen, nexth, hopl)
+-------------------------------+
pbuf_alloced_custom(length=101)
|  fe80 |     0 |     0 |     0 | (src)
|   f23 |  e28b |  96b2 |  6278 |
+-------------------------------+
pbuf_alloced_custom(length=139)
|   201 |  f0de |  f195 |  fa52 | (dest)
|  fa3f |  1c00 |     0 |     0 |
+-------------------------------+
ip6_input: p->len 32 p->tot_len 32
pbuf_alloced_custom(length=119)
pbuf_add_header: old 0x3ffafcb2 new 0x3ffafc8a (40)
pbuf_remove_header: old 0x3ffafc8a new 0x3ffafcb2 (40)
pbuf_alloced_custom(length=90)
pbuf_free(0x3ffafcd8)
pbuf_alloced_custom(length=60)
pbuf_free: deallocating 0x3ffafcd8
ethernet_input: dest:33:33:00:00:00:16, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4814 new 0x3ffb4822 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffb4874)
pbuf_free: deallocating 0x3ffb4874
ethernet_input: dest:01:00:5e:00:00:16, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb4894 new 0x3ffb48a2 (14)
ip4_input: packet not for us.
pbuf_free(0x3ffafc58)
pbuf_free: deallocating 0x3ffafc58
ethernet_input: dest:33:33:00:00:00:16, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb48d4 new 0x3ffb48e2 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffb4934)
pbuf_free: deallocating 0x3ffb4934
ethernet_input: dest:01:00:5e:00:00:16, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb4954 new 0x3ffb4962 (14)
ip4_input: packet not for us.
pbuf_free(0x3ffb4994)
pbuf_free: deallocating 0x3ffb4994
ethernet_input: dest:01:00:5e:00:00:fb, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb49c8 new 0x3ffb49d6 (14)
ip4_input: UDP packet to DHCP client port 5353
ip4_input: packet not for us.
pbuf_free(0x3ffb4a20)
pbuf_free: deallocating 0x3ffb4a20
ethernet_input: dest:33:33:00:00:00:fb, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4a54 new 0x3ffb4a62 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffb4ac0)
pbuf_free: deallocating 0x3ffb4ac0
ethernet_input: dest:33:33:00:00:00:fb, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4af4 new 0x3ffb4b02 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffb4b84)
pbuf_free: deallocating 0x3ffb4b84
ethernet_input: dest:01:00:5e:00:00:fb, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb4bb8 new 0x3ffb4bc6 (14)
ip4_input: UDP packet to DHCP client port 5353
ip4_input: packet not for us.
pbuf_free(0x3ffb4c34)
pbuf_free: deallocating 0x3ffb4c34
ethernet_input: dest:33:33:00:00:00:16, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4c68 new 0x3ffb4c76 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffb4cc8)
pbuf_free: deallocating 0x3ffb4cc8
ethernet_input: dest:01:00:5e:00:00:16, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb4cfc new 0x3ffb4d0a (14)
ip4_input: packet not for us.
pbuf_free(0x3ffb4d3c)
pbuf_free: deallocating 0x3ffb4d3c
pbuf_alloced_custom(length=70)
ethernet_input: dest:01:00:5e:00:00:16, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffafc44 new 0x3ffafc52 (14)
ip4_input: packet not for us.
pbuf_free(0x3ffafc90)
pbuf_free: deallocating 0x3ffafc90
pbuf_alloced_custom(length=130)
ethernet_input: dest:33:33:00:00:00:16, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4814 new 0x3ffb4822 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffafcc4)
pbuf_free: deallocating 0x3ffafcc4
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) == 0x3ffb4814
transaction id xid(50c7cb4c)
dhcp_discover: making request
dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, LWIP_IANA_PORT_DHCP_SERVER)
pbuf_add_header: old 0x3ffb4870 new 0x3ffb4868 (8)
pbuf_add_header: old 0x3ffb4868 new 0x3ffb4854 (20)
ip4_output_if: en1
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 0x3ffb4854 new 0x3ffb4846 (14)
ethernet_output: sending packet 0x3ffb4814
dhcp_discover: deleting()ing
pbuf_free(0x3ffb4814)
pbuf_free: deallocating 0x3ffb4814
dhcp_discover: SELECTING
dhcp_discover(): set request timeout 2000 msecs
pbuf_alloced_custom(length=60)
ethernet_input: dest:01:80:c2:00:00:0e, src:f0:de:f1:95:fa:52, type:88cc
pbuf_free(0x3ffafc84)
pbuf_free: deallocating 0x3ffafc84
pbuf_alloced_custom(length=60)
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:f0:de:f1:95:fa:52, type:806
pbuf_remove_header: old 0x3ffafc44 new 0x3ffafc52 (14)
etharp_update_arp_entry: 0.0.0.0 - f0:de:f1:95:fa:52
etharp_update_arp_entry: will not add non-unicast IP address to ARP cache
etharp_input: incoming ARP request
etharp_input: we are unconfigured, ARP request ignored.
pbuf_free(0x3ffafc84)
pbuf_free: deallocating 0x3ffafc84
etharp_timer
dhcp_coarse_tmr()
pbuf_alloc(length=16)
pbuf_alloc(length=16) == 0x3ffafc30
pbuf_add_header: old 0x3ffafc78 new 0x3ffafc50 (40)
ip6_output_if: lo0
IPv6 header:
+-------------------------------+
|  6 |    0  |            0     | (ver, class, flow)
+-------------------------------+
|        16     |   58  |  255  | (plen, nexth, hopl)
+-------------------------------+
|     0 |     0 |     0 |     0 | (src)
|     0 |     0 |     0 |     1 |
+-------------------------------+
|  ff02 |     0 |     0 |     0 | (dest)
|     0 |     0 |     0 |     2 |
+-------------------------------+
netif->output_ip6()
pbuf_alloc(length=56)
pbuf_alloc(length=56) == 0x3ffafc8c
pbuf_copy(0x3ffafc8c, 0x3ffafc30)
pbuf_copy_partial_pbuf(0x3ffafc8c, 0x3ffafc30, 56, 0)
pbuf_copy_partial_pbuf: copy complete.
pbuf_free(0x3ffafc30)
pbuf_free: deallocating 0x3ffafc30
ip6_input: packet not for us.
pbuf_free(0x3ffafc8c)
pbuf_free: deallocating 0x3ffafc8c
pbuf_alloced_custom(length=60)
ethernet_input: dest:01:80:c2:00:00:0e, src:f0:de:f1:95:fa:52, type:88cc
pbuf_free(0x3ffafc84)
pbuf_free: deallocating 0x3ffafc84
pbuf_alloced_custom(length=60)
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:f0:de:f1:95:fa:52, type:806
pbuf_remove_header: old 0x3ffafc44 new 0x3ffafc52 (14)
etharp_update_arp_entry: 10.0.0.1 - f0:de:f1:95:fa:52
pbuf_alloced_custom(length=157)
etharp_find_entry: found empty entry 0
etharp_find_entry: no empty entry found and not allowed to recycle
pbuf_alloced_custom(length=90)
etharp_input: incoming ARP request
pbuf_alloced_custom(length=60)
etharp_input: we are unconfigured, ARP request ignored.
pbuf_free(0x3ffafc84)
pbuf_alloced_custom(length=90)
pbuf_free: deallocating 0x3ffafc84
etharp_timer
dhcp_coarse_tmr()
ethernet_input: dest:33:33:00:01:00:02, src:f0:de:f1:95:fa:52, type:86dd
pbuf_alloced_custom(length=60)
pbuf_remove_header: old 0x3ffb4814 new 0x3ffb4822 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffafcb8)
pbuf_alloced_custom(length=110)
pbuf_free: deallocating 0x3ffafcb8
ethernet_input: dest:33:33:00:00:00:16, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb48b8 new 0x3ffb48c6 (14)
pbuf_alloced_custom(length=60)
ip6_input: packet not for us.
pbuf_free(0x3ffb9ce8)
pbuf_free: deallocating 0x3ffb9ce8
pbuf_alloced_custom(length=60)
ethernet_input: dest:01:00:5e:00:00:16, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb4918 new 0x3ffb4926 (14)
pbuf_alloced_custom(length=81)
ip4_input: packet not for us.
pbuf_alloced_custom(length=101)
pbuf_free(0x3ffb4958)
pbuf_alloced_custom(length=139)
pbuf_free: deallocating 0x3ffb4958
pbuf_alloced_custom(length=95)
ethernet_input: dest:33:33:00:00:00:16, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb498c new 0x3ffb499a (14)
pbuf_alloced_custom(length=75)
ip6_input: packet not for us.
pbuf_free(0x3ffb49ec)
pbuf_alloced_custom(length=119)
pbuf_free: deallocating 0x3ffb49ec
ethernet_input: dest:01:00:5e:00:00:16, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffafc58 new 0x3ffafc66 (14)
pbuf_alloced_custom(length=110)
ip4_input: packet not for us.
pbuf_free(0x3ffafc98)
pbuf_free: deallocating 0x3ffafc98
pbuf_alloced_custom(length=110)
ethernet_input: dest:33:33:00:00:00:16, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4a20 new 0x3ffb4a2e (14)
pbuf_alloced_custom(length=110)
ip6_input: packet not for us.
pbuf_free(0x3ffb4a94)
pbuf_free: deallocating 0x3ffb4a94
ethernet_input: dest:01:00:5e:00:00:16, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb4814 new 0x3ffb4822 (14)
ip4_input: packet not for us.
pbuf_free(0x3ffafccc)
pbuf_free: deallocating 0x3ffafccc
ethernet_input: dest:01:00:5e:00:00:16, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb4868 new 0x3ffb4876 (14)
ip4_input: packet not for us.
pbuf_free(0x3ffb4ab4)
pbuf_free: deallocating 0x3ffb4ab4
ethernet_input: dest:01:00:5e:00:00:fb, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb48a8 new 0x3ffb48b6 (14)
ip4_input: UDP packet to DHCP client port 5353
ip4_input: packet not for us.
pbuf_free(0x3ffb9cfc)
pbuf_free: deallocating 0x3ffb9cfc
ethernet_input: dest:33:33:00:00:00:fb, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4ad4 new 0x3ffb4ae2 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffb4b40)
pbuf_free: deallocating 0x3ffb4b40
ethernet_input: dest:33:33:00:00:00:fb, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4b74 new 0x3ffb4b82 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffb4c04)
pbuf_free: deallocating 0x3ffb4c04
ethernet_input: dest:33:33:00:01:00:03, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4c38 new 0x3ffb4c46 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffb4c9c)
pbuf_free: deallocating 0x3ffb4c9c
ethernet_input: dest:01:00:5e:00:00:fc, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb492c new 0x3ffb493a (14)
ip4_input: UDP packet to DHCP client port 5355
ip4_input: packet not for us.
pbuf_free(0x3ffb4cbc)
pbuf_free: deallocating 0x3ffb4cbc
ethernet_input: dest:01:00:5e:00:00:fb, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb4cf0 new 0x3ffb4cfe (14)
ip4_input: UDP packet to DHCP client port 5353
ip4_input: packet not for us.
pbuf_free(0x3ffb4d6c)
pbuf_free: deallocating 0x3ffb4d6c
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb497c new 0x3ffb498a (14)
ip_input: iphdr->dest 0xff00000a netif->ip_addr 0x0 (0x0, 0x0, 0xff00000a)
ip_input: iphdr->dest 0xff00000a netif->ip_addr 0x100007f (0xa, 0x7f, 0xff000000)
ip4_input: UDP packet to DHCP client port 137
ip4_input: packet not for us.
pbuf_free(0x3ffb4d8c)
pbuf_free: deallocating 0x3ffb4d8c
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb4dac new 0x3ffb4dba (14)
ip_input: iphdr->dest 0xff00000a netif->ip_addr 0x0 (0x0, 0x0, 0xff00000a)
ip_input: iphdr->dest 0xff00000a netif->ip_addr 0x100007f (0xa, 0x7f, 0xff000000)
ip4_input: UDP packet to DHCP client port 137
ip4_input: packet not for us.
pbuf_free(0x3ffb4e20)
pbuf_free: deallocating 0x3ffb4e20
ethernet_input: dest:ff:ff:ff:ff:ff:ff, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffb4e40 new 0x3ffb4e4e (14)
ip_input: iphdr->dest 0xff00000a netif->ip_addr 0x0 (0x0, 0x0, 0xff00000a)
ip_input: iphdr->dest 0xff00000a netif->ip_addr 0x100007f (0xa, 0x7f, 0xff000000)
ip4_input: UDP packet to DHCP client port 137
ip4_input: packet not for us.
pbuf_free(0x3ffafc6c)
pbuf_free: deallocating 0x3ffafc6c
pbuf_alloced_custom(length=62)
ethernet_input: dest:01:00:5e:00:00:16, src:f0:de:f1:95:fa:52, type:800
pbuf_remove_header: old 0x3ffafc44 new 0x3ffafc52 (14)
ip4_input: packet not for us.
pbuf_free(0x3ffafc88)
pbuf_free: deallocating 0x3ffafc88
pbuf_alloced_custom(length=110)
ethernet_input: dest:33:33:00:00:00:16, src:f0:de:f1:95:fa:52, type:86dd
pbuf_remove_header: old 0x3ffb4814 new 0x3ffb4822 (14)
ip6_input: packet not for us.
pbuf_free(0x3ffafcbc)
pbuf_free: deallocating 0x3ffafcbc

InterBilly
Posts: 13
Joined: Mon Jul 31, 2023 4:53 pm

Re: Esp32 ethernet basic not accepting DHCP offer from DNSMasq

Postby InterBilly » Thu Jan 04, 2024 9:26 am

After it went stale I asked this question on SO, and forgot to also post answer here after I found the solution:
Even tho it looked like there was an issue in lwip, the issue was the RMII clock mode which I had set to internal via GPIO0. After setting it to external it works. The basic ethernet example connects and gets an IP without any adjustments to the example.

For the next one who is having trouble running this example on an WT32-ETH01:

Internal EMAC: true
RMII clock mode: external
Ethernet PHY device: LAN87xx
smi mdc: 23
smi mdio: 18
PHY reset: 16
PHY addr: 1

I turned off SPI ethernet and IPv6 stuff, not sure if important.

trustmiao
Posts: 43
Joined: Mon Aug 06, 2018 5:16 am

Re: Esp32 ethernet basic not accepting DHCP offer from DNSMasq

Postby trustmiao » Thu Jun 27, 2024 12:26 pm

it's working. very appreciate it.

Who is online

Users browsing this forum: justenyonyer, username and 105 guests