ESP32-POE-ISO ESPHome: wrong chip ID

Started by arcimus, September 20, 2023, 12:51:51 AM

Previous topic - Next topic

arcimus

Hello,

ESP32-POE-ISO powers on and accepts flashing, but ethernet does not connect.  Wifi works fine.  Logging shows:
[D][esp-idf:000]: E (368) lan87xx: lan87xx_init(499): wrong chip ID
[D][esp-idf:000]: E (369) esp_eth: esp_eth_driver_install(215): init phy failed

I read that this may be related to: https://github.com/espressif/arduino-esp32/issues/6142

However, it's my understanding that ESPHome uses espressif and therefore the delay should be in place.

I also attempted with ESPHome set to use the latest espressif and platform.  The error is now slightly different:
[V][esp-idf:000]: E (991) lan87xx: lan87xx_init(299): wrong chip OUI
[V][esp-idf:000]: E (992) esp_eth: esp_eth_driver_install(229): init phy failed

ESPHome yaml:
esphome:
  name: esphome-web-6fb690
  friendly_name: ESPHome Web 6fb690

esp32:
  board: esp32-poe-iso
  framework:
    type: esp-idf
    version: latest
    platform_version: 6.4.0

# Enable logging
logger:
  level: VERBOSE

# Enable Home Assistant API
api:
  encryption:
    key: "donaldduck="

ota:

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  power_pin: GPIO12

LubOlimex

Which version of ESP32-POE-ISO do you have? If you use WROVER version change "clk_mode: GPIO17_OUT" to  "clk_mode: GPIO0_OUT" so it looks like that:

ethernet:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO0_OUT
phy_addr: 0
power_pin: GPIO12

Let me know how it goes.
Technical support and documentation manager at Olimex

arcimus

Thanks for your reply.  I do not have the WROVER version.  I have the ESP32-PoE-ISO Rev.L.  I tried the different ethernet settings anyway, same error.

LubOlimex

Then you initial config was alright:
type: LAN8720
mdc_pin: GPIO23
mdio_pin: GPIO18
clk_mode: GPIO17_OUT
phy_addr: 0
power_pin: GPIO12

Notice that just a few days ago a customer reported success with ESPHome and same chip (despite that he used WROVER version board uses same Ethernet chip): https://github.com/OLIMEX/ESP32-POE-ISO/issues/13

If the issue remains:

- report to esphome team or community with all details about the software you used

- test with different version of esphome (latest, older) depending on what you used so far

- try some other environment and demo to confirm the issue is not with the ethernet of the board, maybe use Arduino IDE for ESP32, which has a config for Olimex ESP32-PoE-ISO in the board selector, then download the demo ETH_LAN8720 from File -> Examples -> Ethernet.

- double check your cabling and network, sometimes networking problems come for the network settings themselves

Technical support and documentation manager at Olimex

arcimus

I decided to keep it simple and try the ETH_LAN8720.ino example in Arduino IDE.  I followed the instructions here, but each time I attempt an upload, I get:
esptool.py v4.5.1
Serial port COM4
Connecting......................................

A fatal error occurred: Failed to connect to ESP32: No serial data received.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
Failed uploading: uploading error: exit status 2

Once, I received:
A fatal error occurred: Failed to connect to ESP32: Download mode successfully detected, but getting no sync reply: The serial TX path seems to be down.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
Failed uploading: uploading error: exit status 2

I had no problems flashing ESPHome through the same setup.

Not sure if it's related, but when I view the Serial Monitor in Arduino IDE and press the RST1 button, sometimes I get:
rst:0x1 (POWERON_RESET),boot:0x2 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_FEO_V2))
waiting for download
... but most of the time I see it boot ESPHome, ending with the wrong chip OUI error.

LubOlimex

That is not good, can be caused by a lot of things. You can search online for that error "A fatal error occurred: Failed to connect to ESP32: Download mode successfully detected, but getting no sync reply: The serial TX path seems to be down.". I'd recommend first testing with another cable and USB port.

Technical support and documentation manager at Olimex

John_L

I have the same problem, working with ESP-IDF.

E (1002) lan87xx: lan87xx_init(499): wrong chip ID
E (1002) esp_eth: esp_eth_driver_install(215): init phy failed

My code for LAN Networking is working perfectly fine on ESP32-Gateway boards, but fails on ESP32-PoE.
The menuconfig settings are all exactly the same, using RMII and the right pinning and so on.
Comparing the schematics for both boards, i cannot see any difference at all concering the Ethernet circuitry.

Here is my Ethernet initialization code:
   // MAC config
   eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
   mac_config.smi_mdc_gpio_num = CONFIG_MYDEVICE_ETH_MDC_GPIO;
   mac_config.smi_mdio_gpio_num = CONFIG_MYDEVICE_ETH_MDIO_GPIO;

   // PHY config
   eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
   phy_config.phy_addr = CONFIG_MYDEVICE_ETH_PHY_ADDR;
   phy_config.reset_gpio_num = CONFIG_MYDEVICE_ETH_PHY_RST_GPIO;

   esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config);
   esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config);

   esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy);
   eth_handle = NULL;
  
   ESP_ERROR_CHECK(esp_eth_driver_install(&config, &eth_handle));
   ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle)));
   ESP_ERROR_CHECK(esp_eth_start(eth_handle));

As already mentioned, this code is working on ESP32-Gateway boards which leaves me bewildered what is going on.

Thanks a lot for help.

LubOlimex

This doesn't seem like the same problem.

1. What are the exact names and variants of the ESP32 boards that you got? Neither ESP32-POE nor ESP32-GATEWAY has WROVER module, correct?

2. What is the hardware revision letter of ESP32-GATEWAY and what is the hardware revision of ESP32-POE? This should be printed at the bottom of the board under the name of the board.

3. What are the pin definitions in your code when it comes to the Ethernet? I mean what exactly are mdc_pin, mdio_pin, clk_mode, power_pin ?
Technical support and documentation manager at Olimex

John_L

1. Both boards have ESP32-WROOM module
-----------------------------------
2. ESP32-POE: REV. L / ESP32-GATEWAY: REV. G
-----------------------------------
3. mdc_pin 23
   mdio_pin 18
   clk_mode 'Output RMII clock from internal' Pin 17
   power_pin ?? What do you mean by that? Cannot find anything like that in the menuconfig

LubOlimex

It was somewhere around the power options, I believe it had to be enabled and GPIO assigned. But exact location varies depending on the ESP-IDF version used. It should be GPIO12. In the code it is "#define PIN_PHY_POWER 12" see here:

https://github.com/OLIMEX/ESP32-POE/blob/master/SOFTWARE/ESP-IDF/ESP32_PoE_Ethernet_IDFv4.4/main/ethernet_example_main.c

If you are using ESP-IDF, then try our Ethernet examples for ESP32-POE (use the folder depending on the ESP-IDF version that you use):

https://github.com/OLIMEX/ESP32-POE/tree/master/SOFTWARE/ESP-IDF

Maybe use the examples as basis or inspiration in your code.
Technical support and documentation manager at Olimex

John_L

The example works, think i can go on from there.
I did not use the gpio_pad_selection, maybe that was the error...

tahnk you very much  :D