Closed huexpub closed 3 years ago
esp32 lan8720 default define works RJ45
#ifdef ETH_CLK_MODE #undef ETH_CLK_MODE #endif #define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT #define ETH_POWER_PIN -1 #define ETH_TYPE ETH_PHY_LAN8720 #define ETH_ADDR 0 #define ETH_MDC_PIN 2 #define ETH_MDIO_PIN 18
lan8720 clock sync with esp32 gpio17 output then add wifiEvent() void.
void WiFiEvent(WiFiEvent_t event) { switch (event) { case SYSTEM_EVENT_ETH_START: Serial.println("ETH Started"); //set eth hostname here ETH.setHostname("esp32-ethernet"); break; case SYSTEM_EVENT_ETH_CONNECTED: Serial.println("ETH Connected"); break; case SYSTEM_EVENT_ETH_GOT_IP: Serial.print("ETH MAC: "); Serial.print(ETH.macAddress()); Serial.print(", IPv4: "); Serial.print(ETH.localIP()); if (ETH.fullDuplex()) { Serial.print(", FULL_DUPLEX"); } Serial.print(", "); Serial.print(ETH.linkSpeed()); Serial.println("Mbps"); eth_connected = true; break; case SYSTEM_EVENT_ETH_DISCONNECTED: Serial.println("ETH Disconnected"); eth_connected = false; break; case SYSTEM_EVENT_ETH_STOP: Serial.println("ETH Stopped"); eth_connected = false; break; default: break; } }
setup with
WiFi.onEvent(WiFiEvent); ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK_MODE);
eth base with wifi function ,thanks !
Ethernet connection with lan8720 it's not problem. I tested done yet. But some used library work only with wifi connection.
esp32 lan8720 default define works RJ45
lan8720 clock sync with esp32 gpio17 output
then add wifiEvent() void.
setup with
eth base with wifi function ,thanks !