ESP32 ethernet no ETH.end / disable

doyoon.kim
Posts: 4
Joined: Thu Jan 20, 2022 11:57 am

ESP32 ethernet no ETH.end / disable

Postby doyoon.kim » Wed Jun 15, 2022 10:53 am

I'm working on a project based on ethernet communication via ESP32 + LAN8720 module

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)
  1. esp_netif_t *g_eth_netif = NULL;
  2.  
  3. bool ETHClass::end()
  4. {
  5.    esp_err_t err;
  6.    eth_link = ETH_LINK_DOWN;
  7.  
  8.    if(eth_handle != NULL)
  9.    {
  10.       err = esp_eth_stop(eth_handle);
  11.  
  12.       if (err)
  13.       {
  14.          log_e("esp_eth_stop error: %d", err);
  15.          return false;
  16.       }
  17.    }
  18.  
  19.    if(g_eth_netif != NULL)
  20.    {
  21.       /* These default interfaces must not be created multiple times, unless the created handle is deleted using esp_netif_destroy().*/
  22.       esp_netif_destroy(g_eth_netif);
  23.       g_eth_netif = NULL;
  24.    }
  25.  
  26.    started = false;
  27.  
  28.    return true;
  29. }

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

Who is online

Users browsing this forum: Baidu [Spider] and 39 guests