Can I write ETH.config before ETH.begin ?

GeorgeFlorian1
Posts: 160
Joined: Thu Jan 31, 2019 2:32 pm

Can I write ETH.config before ETH.begin ?

Postby GeorgeFlorian1 » Sun Nov 24, 2019 4:00 pm

Board: ESP32-EVB
OS: Windows 10 / Linux Mint

I am using an ESP32-EVB exclusively with an Ethernet cable. I have a webserver on the device so I will need it's IP to access it. In order to do that I boot up the ESP and I look for it's IP into my AP's DHCP list. I find it and I type it in my browser. And it doesn't work. I then open up a Serial Monitor and reboot the thing only to see that ETH.begin() gets a DHCP IP and then ETH.config() changes that IP to a previously stored IP.

Code: Select all

ETH Connected
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 25 - MAX
[D][WiFiGeneric.cpp:417] _eventCallback(): ETH IP: 192.168.1.194, MASK: 255.255.255.0, GW: 192.168.1.1
24:0A:C4:24:9F:A7, IPv4: 192.168.1.194, FULL_DUPLEX, 100Mbps
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 25 - MAX
[D][WiFiGeneric.cpp:417] _eventCallback(): ETH IP: 192.168.1.150, MASK: 255.255.255.0, GW: 192.168.1.1
, IPv4: 192.168.1.150, FULL_DUPLEX, 100Mbps
192.168.1.194 is obtained from the DHCP Server and as such it appears on the AP's DHCP List.
192.168.1.150 is obtained from a config file stored inside the ESP32 and as such it doesn't appear in the DHCP List.

I don't want the ESP to get a DHCP lease, because it is confusing for any user. It even managed to confuse me. I would like for it to never get a DHCP lease if it was previously configured with a Static IP, like in this case.

A logical answer would be to switch ETH.begin() and ETH.config() around, but from what I remember this can't be done, right ? Or am I wrong and this is just a parasite thought ?

Thank you.

GeorgeFlorian1
Posts: 160
Joined: Thu Jan 31, 2019 2:32 pm

Re: Can I write ETH.config before ETH.begin ?

Postby GeorgeFlorian1 » Mon Nov 25, 2019 12:06 pm

I can't write ETH.config() before ETH.begin() because I get the following error and the ESP keeps crushing:

Code: Select all

E (1384) tcpip_adapter: tcpip_adapter is not initialized!
abort() was called at PC 0x4011615b on core 1

Backtrace: 0x4008c618:0x3ffb1c20 0x4008c849:0x3ffb1c40 0x4011615b:0x3ffb1c60 0x400d8047:0x3ffb1ca0 0x400d2ae1:0x3ffb1cf0 0x400d34e2:0x3ffb1d70 0x400e2c93:0x3ffb1fb0 0x40088d05:0x3ffb1fd0

Decoding stack results
0x400d8047: esp_task_wdt_init at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/task_wdt.c line 206
0x400d2ae1: setCpuFrequencyMhz at /home/george/Arduino/hardware/espressif/esp32/cores/esp32/esp32-hal-cpu.c line 133
0x400d34e2: uw_update_context_1 at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libgcc/config/xtensa/unwind-dw2-xtensa.c line 394
0x400e2c93: _svfprintf_r at ../../../.././newlib/libc/stdio/vfprintf.c line 1536
0x40088d05: vTaskPlaceOnEventList at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/tasks.c line 2923
How can I get rid of the DHCP IP ? I don't want the lease because it is confusing. What is the point of ETH.config() if it works after ETH.begin() got a DHCP IP ?

Who is online

Users browsing this forum: No registered users and 99 guests