Ethernet Board Lan8720 issues with i2c slave mode
Posted: Mon Jun 16, 2025 6:42 pm
Hello everyone,
I'm currently working on a modular musical controller project and I've run into a serious compatibility issue that I hope someone here can help me resolve.
My Setup
Board: ESP32-WROOM-32 (38 pins)
Core: Arduino-ESP32 Core v3.0.0+ (using native ETH support)
Ethernet Module: LAN8720 connected via RMII (GPIO 0 CLK IN, GPIO 17 EN, GPIO 23 MDC, GPIO 18 MDIO)
Functionality: The ESP32 acts as a node that:
Receives sensor data via I²C slave
Sends this data via OSC (Open Sound Control) over Ethernet
The Problem
Whenever I initialize the I²C bus in slave mode, Ethernet immediately disconnects and never recovers.
I have verified this across multiple sketches, and the issue is reproducible 100% of the time.
What I've Confirmed
The Ethernet module works perfectly on its own
The I²C slave works fine when Ethernet is not initialized
There are no hardware issues (power, pullups, GNDs shared)
Tested I²C slave both before and after Ethernet initialization
Using the standard Wire.begin(SDA, SCL, address) method for slave setup
Minimal Reproducible Code (ETH + I2C SLAVE)
#include <ETH.h>
#include <Wire.h>
#define ETH_PHY_TYPE ETH_PHY_LAN8720
#define ETH_PHY_ADDR 1
#define ETH_PHY_POWER 17
#define ETH_PHY_MDC 23
#define ETH_PHY_MDIO 18
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
#define I2C_SDA 33
#define I2C_SCL 32
#define SLAVE_ADDR 0x08
uint8_t dummyData[18];
void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("===== MercuryOSC: ETH + I2C slave =====");
WiFi.onEvent([](WiFiEvent_t event) {
if (event == ARDUINO_EVENT_ETH_CONNECTED) Serial.println("[ETH] Connected");
if (event == ARDUINO_EVENT_ETH_DISCONNECTED) Serial.println("[ETH] Disconnected");
if (event == ARDUINO_EVENT_ETH_GOT_IP) {
Serial.print("[ETH] IP: "); Serial.println(ETH.localIP());
}
});
bool eth_ok = ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_MDC, ETH_PHY_MDIO, ETH_PHY_POWER, ETH_CLK_MODE);
if (!eth_ok) Serial.println("[ETH]
Failed to start");
delay(2000); // Wait for Ethernet to stabilize
Wire.begin(I2C_SDA, I2C_SCL, SLAVE_ADDR); // I²C SLAVE INITIATION
Wire.onRequest([]() {
Wire.write(dummyData, sizeof(dummyData));
Serial.println("[I2C] Slave sent data");
});
Serial.println("[I2C] Slave mode enabled on 0x08");
}
void loop() {
delay(1000);
}
With Wire.begin(..., SLAVE_ADDR) → Ethernet disconnects instantly
Ethernet works until I²C is initialized
Happens on both Core 2.0.7 and 3.0.0+
Happens regardless of pin configuration
I'm currently working on a modular musical controller project and I've run into a serious compatibility issue that I hope someone here can help me resolve.
Board: ESP32-WROOM-32 (38 pins)
Core: Arduino-ESP32 Core v3.0.0+ (using native ETH support)
Ethernet Module: LAN8720 connected via RMII (GPIO 0 CLK IN, GPIO 17 EN, GPIO 23 MDC, GPIO 18 MDIO)
Functionality: The ESP32 acts as a node that:
Receives sensor data via I²C slave
Sends this data via OSC (Open Sound Control) over Ethernet
Whenever I initialize the I²C bus in slave mode, Ethernet immediately disconnects and never recovers.
I have verified this across multiple sketches, and the issue is reproducible 100% of the time.
The Ethernet module works perfectly on its own
The I²C slave works fine when Ethernet is not initialized
There are no hardware issues (power, pullups, GNDs shared)
Tested I²C slave both before and after Ethernet initialization
Using the standard Wire.begin(SDA, SCL, address) method for slave setup
Minimal Reproducible Code (ETH + I2C SLAVE)
#include <ETH.h>
#include <Wire.h>
#define ETH_PHY_TYPE ETH_PHY_LAN8720
#define ETH_PHY_ADDR 1
#define ETH_PHY_POWER 17
#define ETH_PHY_MDC 23
#define ETH_PHY_MDIO 18
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
#define I2C_SDA 33
#define I2C_SCL 32
#define SLAVE_ADDR 0x08
uint8_t dummyData[18];
void setup() {
Serial.begin(115200);
delay(1000);
Serial.println("===== MercuryOSC: ETH + I2C slave =====");
WiFi.onEvent([](WiFiEvent_t event) {
if (event == ARDUINO_EVENT_ETH_CONNECTED) Serial.println("[ETH] Connected");
if (event == ARDUINO_EVENT_ETH_DISCONNECTED) Serial.println("[ETH] Disconnected");
if (event == ARDUINO_EVENT_ETH_GOT_IP) {
Serial.print("[ETH] IP: "); Serial.println(ETH.localIP());
}
});
bool eth_ok = ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_MDC, ETH_PHY_MDIO, ETH_PHY_POWER, ETH_CLK_MODE);
if (!eth_ok) Serial.println("[ETH]
delay(2000); // Wait for Ethernet to stabilize
Wire.begin(I2C_SDA, I2C_SCL, SLAVE_ADDR); // I²C SLAVE INITIATION
Wire.onRequest([]() {
Wire.write(dummyData, sizeof(dummyData));
Serial.println("[I2C] Slave sent data");
});
Serial.println("[I2C] Slave mode enabled on 0x08");
}
void loop() {
delay(1000);
}
With Wire.begin(..., SLAVE_ADDR) → Ethernet disconnects instantly
Ethernet works until I²C is initialized
Happens on both Core 2.0.7 and 3.0.0+
Happens regardless of pin configuration