ESP32 + LAN8720: Ethernet fails at 240 MHz CPU frequency (IDF v5.3.1)
Posted: Mon Sep 01, 2025 6:08 pm
Hi all,
I’m using an ESP32-WROVER Dev Board together with a LAN8720 (Wireshark module) for Ethernet over RMII. At 160 MHz CPU frequency everything works fine:
DHCP assigns an IP address
Static IP also works, ping is possible
I can send and receive packets without issues
But when I change the CPU frequency to 240 MHz (via menuconfig), Ethernet completely stops working:
No DHCP lease is obtained
Static IP cannot be pinged
No packets are transmitted
Ethernet init code
Setup
Board: ESP32-WROVER Dev Board
PHY: LAN8720 (RMII mode, 50 MHz crystal on the module)
Clock: external 50 MHz ref_clk on GPIO0
ESP-IDF version: v5.3.1
Question
Has anyone experienced this problem?
Is there a known issue with ESP32 Ethernet when running at 240 MHz on IDF 5.3.1?
Do I need a different clock setup for the LAN8720 at higher CPU frequency?
Any workarounds or known fixes?
Thanks a lot for any hints!
I’m using an ESP32-WROVER Dev Board together with a LAN8720 (Wireshark module) for Ethernet over RMII. At 160 MHz CPU frequency everything works fine:
DHCP assigns an IP address
Static IP also works, ping is possible
I can send and receive packets without issues
But when I change the CPU frequency to 240 MHz (via menuconfig), Ethernet completely stops working:
No DHCP lease is obtained
Static IP cannot be pinged
No packets are transmitted
Code: Select all
RMII pin configuration
GPIO21 -> TX_EN (EMAC_TX_EN)
GPIO19 -> TX0 (EMAC_TXD0)
GPIO22 -> TX1 (EMAC_TXD1)
GPIO25 -> RX0 (EMAC_RXD0)
GPIO26 -> RX1 (EMAC_RXD1)
GPIO27 -> CRS_DV (EMAC_RX_DRV)
SMI (Serial Management Interface):
GPIO23 -> MDC (Output to PHY)
GPIO18 -> MDIO (Bidirectional)
Clock: GPIO0 as external clock input (LAN8720 provides 50 MHz ref_clk)
Code: Select all
void network_ethernet_init(network_conf_t *conf) {
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
esp_netif_t *eth_netif = esp_netif_new(&cfg);
ESP_ERROR_CHECK(esp_netif_set_hostname(eth_netif, "ESP32-ETH"));
eth_mac_config_t mac_cfg = ETH_MAC_DEFAULT_CONFIG();
eth_esp32_emac_config_t esp32_mac_cfg = ETH_ESP32_EMAC_DEFAULT_CONFIG();
esp32_mac_cfg.smi_gpio.mdc_num = ETH_MDC_GPIO;
esp32_mac_cfg.smi_gpio.mdio_num = ETH_MDIO_GPIO;
esp32_mac_cfg.interface = EMAC_DATA_INTERFACE_RMII;
esp32_mac_cfg.clock_config.rmii.clock_mode = EMAC_CLK_EXT_IN;
esp32_mac_cfg.clock_config.rmii.clock_gpio = 0; // GPIO0 as ext clock in
esp32_mac_cfg.dma_burst_len = ETH_DMA_BURST_LEN_16;
esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_mac_cfg, &mac_cfg);
eth_phy_config_t phy_cfg = ETH_PHY_DEFAULT_CONFIG();
phy_cfg.phy_addr = 1;
phy_cfg.reset_gpio_num = -1;
esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_cfg);
esp_eth_config_t eth_cfg = ETH_DEFAULT_CONFIG(mac, phy);
esp_eth_handle_t eth_handle = NULL;
ESP_ERROR_CHECK(esp_eth_driver_install(ð_cfg, ð_handle));
ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle)));
ESP_ERROR_CHECK(esp_netif_dhcpc_start(eth_netif));
ESP_ERROR_CHECK(esp_eth_start(eth_handle));
uint8_t mac_addr[6];
ESP_ERROR_CHECK(esp_eth_ioctl(eth_handle, ETH_CMD_G_MAC_ADDR, mac_addr));
ESP_LOGI(TAG, "MAC: %02x:%02x:%02x:%02x:%02x:%02x",
mac_addr[0], mac_addr[1], mac_addr[2],
mac_addr[3], mac_addr[4], mac_addr[5]);
ESP_LOGI(TAG, "Ethernet started (EMAC_CLK_EXT_IN, CPU 240MHz)");
}
Board: ESP32-WROVER Dev Board
PHY: LAN8720 (RMII mode, 50 MHz crystal on the module)
Clock: external 50 MHz ref_clk on GPIO0
ESP-IDF version: v5.3.1
Question
Has anyone experienced this problem?
Is there a known issue with ESP32 Ethernet when running at 240 MHz on IDF 5.3.1?
Do I need a different clock setup for the LAN8720 at higher CPU frequency?
Any workarounds or known fixes?
Thanks a lot for any hints!