ESP32-POE: esp_eth_driver_install failed

Started by aguglie, January 27, 2024, 11:06:10 AM

Previous topic - Next topic

aguglie

Hello everyone,

I'm testing out my brand new ESP32-POE, but I cannot get it to work, neither with the standard example code or with any other example, I always get the following error:

E (123) lan87xx: lan87xx_pwrctl(409): power up timeout
E (124) lan87xx: lan87xx_init(491): power control failed
E (124) esp_eth: esp_eth_driver_install(215): init phy failed
[   144][E][ETH.cpp:320] begin(): esp_eth_driver_install failed

Do you have any idea? Maybe is the board broken?

I attach the code, which essentially is the 'Simple Ethernet and SD card demo for Arduino' example with the SD card part stripped.

#include <ETH.h>

void WiFiEvent(WiFiEvent_t event)
{
  switch (event) {
    case ARDUINO_EVENT_ETH_START:
      Serial.println("ETH Started");
      //set eth hostname here
      ETH.setHostname("esp32-ethernet");
      break;
    case ARDUINO_EVENT_ETH_CONNECTED:
      Serial.println("ETH Connected");
      break;
    case ARDUINO_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");
      break;
    case ARDUINO_EVENT_ETH_DISCONNECTED:
      Serial.println("ETH Disconnected");
      break;
    case ARDUINO_EVENT_ETH_STOP:
      Serial.println("ETH Stopped");
      break;
    default:
      break;
  }
}

void setup()
{
    Serial.begin(115200);
    WiFi.onEvent(WiFiEvent);
    ETH.begin();
}



void loop()
{
}

Thank you :)

LubOlimex

What board did you select in the board selector, is it ESP32-POE?
Technical support and documentation manager at Olimex

Stanimir5F

Hello aguglie!

Which version of the ESP32 package are you using?

If it is "3.0.0-alpha3" keep in mind in their "ETH_LAN8720" example they have added at the start of the code a section which involves few macros whose values needs to be specified depending on the board (lines 6-13). In the case of ESP32-POE it has to look like this:
// Important to be defined BEFORE including ETH.h for ETH.begin() to work.
// Example RMII LAN8720 (Olimex, etc.)
#define ETH_PHY_TYPE        ETH_PHY_LAN8720
#define ETH_PHY_ADDR         0
#define ETH_PHY_MDC         23
#define ETH_PHY_MDIO        18
#define ETH_PHY_POWER       12
#define ETH_CLK_MODE        ETH_CLOCK_GPIO17_OUT
So if this is the case you might as well have to added them too before the include of the <ETH.h> file.


In the 2.x.x versions these were not part of the code and the values were taken either from the variants/pins_arduino.h file or with default one.

With 2.0.14 the default " ETH_LAN8720" example should work without any modifications since the values are defined in the pins_arduino.h file (lines 6-7) for ESP32-POE:
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
#define ETH_PHY_POWER 12


Stan, Olimex
May the Source be with You!

DirkB19

I just received my OLIMEX ESP32-POE2 board ...
and I have the same problem as mentioned in this post.
20:04:23.112 -> E (4121) lan87xx: lan87xx_pwrctl(409): power up timeout
20:04:23.112 -> E (4121) lan87xx: lan87xx_init(491): power control failed
20:04:23.112 -> E (4121) esp_eth: esp_eth_driver_install(215): init phy failed
Tried different board revisions in Arduino:  2.0.14, 2.0.16, 3.0.0
Tried with and without #defines

What could be wrong ?
Thx

LubOlimex

2.0.14 and  2.0.16 should require nothing extra. If it doesn't work out-of-the-box with  2.0.14 and  2.0.16 then the problem is with the Arduino package installation (it sometimes bugs out when you switch between newer and older versions of packages), this might require full reinstall or manual deletion.
Technical support and documentation manager at Olimex

DirkB19

Quote from: LubOlimex on May 07, 2024, 08:25:22 AM2.0.14 and  2.0.16 should require nothing extra. If it doesn't work out-of-the-box with  2.0.14 and  2.0.16 then the problem is with the Arduino package installation (it sometimes bugs out when you switch between newer and older versions of packages), this might require full reinstall or manual deletion.

I removed the ESP32 from the boardmanager, then removed ARDUINO IDE app from my PC. Then reinstalled ARDUINO IDE 2.3.2, then added the ESP32 2.0.14 board, then closed Arduino IDE, then re-opened Arduino IDE. THen selected the ETH_LAN8720 example, compile and download ==> same problem. Added delay of 4s in right after Serial.begin(115200) ==> same problem.
New board is quite useless for now as Ethernet connection is the only reason I bought it.

LubOlimex

#6
I will test it again later today and if it works here I will give you instructions on what I use and what I did.

It is important to notice each ESP32-POE2 is tested empirically and the Ethernet is part of the test. Even if there is a problem it is not related to the hardware.

Edit: I found the issue - the board comes with ESP32-WROVER-E module. The information everywhere says it comes with WROOM but upon checking empirically the product it comes with ESP32-WROVER-E-N4R8. This causes two pin difference since WROVER module has PSRAM (and the PSRAM requires two pins extra). This is visible in the schematic top left corner of Ethernet box - now eMAC clock is GPIO0, not GPIO17.
Technical support and documentation manager at Olimex

LubOlimex

I use latest ESP32 package which appears to be version 3.0.0-rc1. Changed the defines of default example at start to:

// Important to be defined BEFORE including ETH.h for ETH.begin() to work.
// Example RMII LAN8720 (Olimex, etc.)
#ifndef ETH_PHY_TYPE
#define ETH_PHY_TYPE        ETH_PHY_LAN8720
#define ETH_PHY_ADDR        0
#define ETH_PHY_MDC        23
#define ETH_PHY_MDIO        18
#define ETH_PHY_POWER      12
#define ETH_CLK_MODE        ETH_CLOCK_GPIO0_OUT
#endif

Also reduced delay at end to 1000:

void loop()
{
  if (eth_connected) {
    testClient("google.com", 80);
  }
  delay(1000);
}

The board I selected is "Olimex ESP32-POE" and then changed PSRAM to enabled. Uploaded and it seems to work fine.
Technical support and documentation manager at Olimex

DirkB19

@LubOlimex,

Thanks for the support, now it works.
I was getting a little desperate  ;D
Because first I overlooked your tip to enable PSRAM ... this is definitely needed to make it work.
I would document this in Wiki or Documentation for other noobs like me who will encounter this.
Thanks,
DirkB19

LubOlimex

I've updated the manual and the web-pages, thanks again for the report.
Technical support and documentation manager at Olimex