I set up a static IP right after booting and proceed with certain tasks, and a sequence is needed to change the dynamic IP.
In ETH.H/CPP there is a begin method but no corressponding end method.
I am going to make ETH.END and use it in the process of changing static IP to dynamic IP.
ETH.END implementation ( ETH.CPP)
- esp_netif_t *g_eth_netif = NULL;
- bool ETHClass::end()
- {
- esp_err_t err;
- eth_link = ETH_LINK_DOWN;
- if(eth_handle != NULL)
- {
- err = esp_eth_stop(eth_handle);
- if (err)
- {
- log_e("esp_eth_stop error: %d", err);
- return false;
- }
- }
- if(g_eth_netif != NULL)
- {
- /* These default interfaces must not be created multiple times, unless the created handle is deleted using esp_netif_destroy().*/
- esp_netif_destroy(g_eth_netif);
- g_eth_netif = NULL;
- }
- started = false;
- return true;
- }
STAIC IP -> ETH.end -> Dynamic IP
I want to do this, but it is not working normally
please help me
ESP32 wrover- E + POE (AG9905M) + LAN8720
The log file is attached below.
- uStartETH(), 0, 0, 0
[ETH] pstSetEthIP_Client(ETH_PRODUCTION) : ST_IPTYE, 0
ST-IP
192.168.200.154
192.168.200.1
255.255.255.0
8.8.8.8
8.8.4.4
[ETH] Eth.end()
[ETH] pstIpConfig->u8IpType = 1
[ 7314][V][WiFiGeneric.cpp:363] _arduino_event_cb(): Ethernet Started
[ 7315][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 18 - ETH_START
[ 7317][V][WiFiGeneric.cpp:355] _arduino_event_cb(): Ethernet Link Up
[ 7323][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 20 - ETH_CONNECTED
[ETH] Eth.begin()
[ETH] Connecting to ETH(1)
[ 7381][V][WiFiGeneric.cpp:370] _arduino_event_cb(): Ethernet got newip:192.168.200.154
[ 7382][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 22 - ETH_GOT_IP
[ 7385][D][WiFiGeneric.cpp:950] _eventCallback(): ETH IP: 192.168.200.154, MASK: 255.255.255.0, GW: 192.168.200.1
[ETH] Eth.config() : ST-IP
esp_task_wdt_reset(Task_Network) : 0
..[ 9325][V][WiFiGeneric.cpp:360] _arduino_event_cb(): Ethernet Link Down
[ 9325][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 21 - ETH_DISCONNECTED
..........[ 17325][V][WiFiGeneric.cpp:355] _arduino_event_cb(): Ethernet Link Up
[ 17325][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 20 - ETH_CONNECTED
[ 17325][V][WiFiGeneric.cpp:370] _arduino_event_cb(): Ethernet got ip:192.168.200.154
[ 17335][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 22 - ETH_GOT_IP
[ 17342][D][WiFiGeneric.cpp:950] _eventCallback(): ETH IP: 192.168.200.154, MASK: 255.255.255.0, GW: 192.168.200.1
...[ 19325][V][WiFiGeneric.cpp:360] _arduino_event_cb(): Ethernet Link Down
[ 19325][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 21 - ETH_DISCONNECTED
.............[ 29325][V][WiFiGeneric.cpp:355] _arduino_event_cb(): Ethernet Link Up
[ 29325][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 20 - ETH_CONNECTED
[ 29325][V][WiFiGeneric.cpp:370] _arduino_event_cb(): Ethernet got ip:192.168.200.154
[ 29335][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 22 - ETH_GOT_IP
[ 29342][D][WiFiGeneric.cpp:950] _eventCallback(): ETH IP: 192.168.200.154, MASK: 255.255.255.0, GW: 192.168.200.1
...
OP_RETRY : g_u8TryConnectMode = 0
ETH_END_CONNECT---
uStartETH(), 1, 0, 0
[ETH] pstSetEthIP_Client(ETH_NORMAL_DYST) : DY-IP, 1
DY-IP
0,0,0,0
0,0,0,0
0,0,0,0
0,0,0,0
0,0,0,0
[ 31147][V][WiFiGeneric.cpp:366] _arduino_event_cb(): Ethernet Stopped
[ 31148][D][WiFiGeneric.cpp:852] _eventCallback(): Arduino Event: 19 - ETH_STOP
[ETH] Eth.end()
[ETH] pstIpConfig->u8IpType = 0
E (44852) esp.emac: esp_eth_mac_new_esp32(595): alloc emac interrupt failed
[ 31166][E][ETH.cpp:343] begin(): esp_eth_mac_new_esp32 failed
[ETH] Eth.begin()
[ETH] Connecting to ETH(0)
[ 31179][E][ETH.cpp:516] config(): ETHClass::config() Dynamic IP