our ESP32-based product can connect to the internet via either WiFi or Ethernet. We recently had the problem that the LAN8720 chip broke for a customer and this prevented the ESP32 from starting up at all. We use the following code to initialize the ethernet module:
Code: Select all
esp_err_t ret;
eth_config_t config = DEFAULT_ETHERNET_PHY_CONFIG;
config.phy_addr = PHY1;
config.gpio_config = eth_gpio_config_rmii;
config.tcpip_input = tcpip_adapter_eth_input;
config.clock_mode = ETH_CLOCK_GPIO0_IN;
config.phy_power_enable = phy_device_power_enable_via_gpio;
ret = esp_eth_init(&config);
Code: Select all
I (3385) emac: emac start !!!
I (3389) emac: emac resetting ....
I (3393) emac: emac resetting ....
I (3397) emac: emac resetting ....
I (3401) emac: emac resetting ....
I (3405) emac: emac resetting ....
I (3409) emac: emac resetting ....
I (3415) emac: emac resetting ....
I (3419) emac: emac resetting ....
[...]
I (8017) emac: emac resetting ....
I (8021) emac: emac resetting ....
I (8025) emaTask watchdog got triggered. The following tasks did not reset the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: emacT
Aborting.
abort() was called at PC 0x400d1145 on core 0
Code: Select all
void emac_reset(void)
{
REG_SET_BIT(EMAC_DMABUSMODE_REG, EMAC_SW_RST);
while (REG_GET_BIT(EMAC_DMABUSMODE_REG, EMAC_SW_RST) == 1) {
//nothing to do ,if stop here,maybe emac have not clk input.
ESP_LOGI(TAG, "emac resetting ....");
}
ESP_LOGI(TAG, "emac reset done");
}
Is there any chance that this might be fixed shortly? Is there any way to work around the issue (i.e. some way to check whether a PHY is actually connected to the ESP32 before trying to initialize it)?
Thanks a lot!
David