ESP32-Gateway - cannot run sample code

Started by leodashevskiy, December 22, 2021, 09:52:18 AM

Previous topic - Next topic

leodashevskiy

I got ESP32-Gateway board (revision G) and when I try to run sample code (found here: https://github.com/espressif/arduino-esp32/tree/2.0.1/libraries/Ethernet/examples/ETH_LAN8720 ) I got following error:
E (1012) esp.emac: emac_esp32_init(354): reset timeout
E (1012) esp_eth: esp_eth_driver_install(222): init mac failed

I tried to reassign some values which I found here on forum like this:
#define ETH_CLK_MODE    ETH_CLOCK_GPIO17_OUT
// Pin# of the enable signal for the external crystal oscillator (-1 to disable for internal APLL source)
#define ETH_POWER_PIN   -1
// Type of the Ethernet PHY (LAN8720 or TLK110)
#define ETH_TYPE        ETH_PHY_LAN8720
// I²C-address of Ethernet PHY (0 or 1 for LAN8720, 31 for TLK110)
#define ETH_ADDR        0
// Pin# of the I²C clock signal for the Ethernet PHY
#define ETH_MDC_PIN     23
// Pin# of the I²C IO signal for the Ethernet PHY
#define ETH_MDIO_PIN    18

and I got same result.
I am using USB only as a power source, no POE.
Please help!

leodashevskiy

Forgot to mention: I added 2 seconds delay before initializing Ethernet.
here is a code:

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


olimex


leodashevskiy

I run code found here: https://github.com/espressif/arduino-esp32/blob/master/libraries/Ethernet/examples/ETH_LAN8720/ETH_LAN8720.ino
I added 5 seconds delay like this:

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

and it still gives me same error:
E (6012) esp.emac: emac_esp32_init(354): reset timeout
E (6012) esp_eth: esp_eth_driver_install(222): init mac failed

Please help!

leodashevskiy


JohnS

The developer release has changed so maybe that's a clue.

John

leodashevskiy

John, could be but unfortunately, it does not help me.. I still have no clue what to do. :(

leodashevskiy

Problem solved - by accident I choose ESP32-PoE board in board manager, recompiled code and all the sudden ESP32-Gateway board started working! Interesting!

LubOlimex

It is probably because older hardware revisions of ESP32-GATEWAY had different way of handling Ethernet clock and start up, the design was closer to ESP32-EVB. In newer revisions of ESP32-GATEWAY, tho, this part of the design is similar to ESP32-POE.

Also if you are using latest versions of everything, then you can select what revision of ESP32-GATEWAY you are using and such problem should not appear.
Technical support and documentation manager at Olimex

babos

#9
Same problem:
Arduino ESP32 Library board :  2.0.2
OLIMEX B08NWMWSG9 REV.G
Example Test: ETH_LAN8270.ino

solved by selecting ESP-POE board.

is it possible to normalize?

The device now is detected on the network but events and more are not working. The debug messages do not appear on the serial.

McAleerElk

Quote from: LubOlimex on January 11, 2022, 12:51:22 PMIt is probably because older hardware revisions of ESP32-GATEWAY had different way of handling Ethernet clock and start up, the design was closer to ESP32-EVB. In newer revisions of ESP32-GATEWAY, tho, this part of the design is similar to ESP32-POE.

Also if you are using latest versions of everything, then you can select what revision of ESP32-GATEWAY you are using and such problem should not appear.


Hi. I've spend 48 hours in this exact same problem. Not only have I had problem with the eth examples (All examples I've tried and messed around with (EVEN ESP-IDF, which I'm quite unfamiliar with)), I have also not managed to have any functioning code using the SD-card.

I have not yet tried the "change board to ESP32-POE"-solution. I will do that right away, and perhaps I will let my tears out if it actually works!

You say: "Also if you are using latest versions of everything..."

Please be elaborate when you say "EVERYTHING"... Cause it's hard enough getting into this...
I've seen you mention that in board selectors, you should be able to see ESP32-Gateway revisions. Even though I went through:

1 Updating [ESP32 version] in arduino Boards manager
2 Update the link in Board Manager URL to https://dl.espressif.com/dl/package_esp32_dev_index.json  as per https://www.olimex.com/Products/IoT/ESP32/_resources/Arudino-ESP32.txt

Then I can still not see and select such revisions. What am I missing? Updating my Arduino IDE?

Actually I prefer a lot PlatformIO. I may have subsequent questions on doing this in PlatformIO in Visual Studio.

LubOlimex

1. Install the Arduino package as per these instructions:

https://espressif-docs.readthedocs-hosted.com/projects/arduino-esp32/en/latest/installing.html


2. Select Olimex ESP32-GATWAY with proper revision settings.

3. Load the demo Ethernet example from File -> Examples -> Ethernet -> ETH_LAN8720 compile, upload and test.
Technical support and documentation manager at Olimex

mirzaon

For those who struggled to bring up ESP32-PoE on ESP-IDF v5.0, here is what worked for me

void ethernet_initialize(void)
{
    ESP_ERROR_CHECK(esp_netif_init());
    ESP_ERROR_CHECK(esp_event_loop_create_default());

    /* Create new default instance of esp-netif for Ethernet */
    esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
    esp_netif_t *eth_netif = esp_netif_new(&cfg);

    /* Init MAC and PHY configs to default */
    eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
    eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();

    phy_config.phy_addr = ETHERNET_PHY_ADDRESS;
    phy_config.reset_gpio_num = ETHERNET_GPIO_PHY_POWER;
    phy_config.reset_timeout_ms = 1000;
    eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG();
    esp32_emac_config.smi_mdc_gpio_num = ETHERNET_GPIO_MDC;
    esp32_emac_config.smi_mdio_gpio_num = ETHERNET_GPIO_MDIO;
    esp32_emac_config.clock_config.rmii.clock_mode = EMAC_CLK_OUT;
    esp32_emac_config.clock_config.rmii.clock_gpio = EMAC_CLK_OUT_180_GPIO;
    mac_config.sw_reset_timeout_ms = 1000;
    esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config);
    esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config);
    esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy);
    esp_eth_handle_t eth_handle = NULL;
    ESP_ERROR_CHECK(esp_eth_driver_install(&config, &eth_handle));
    /* attach Ethernet driver to TCP/IP stack */
    ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle)));

    /* Register callbacks */
    ESP_ERROR_CHECK(esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, &eth_event_handler, NULL));
    ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, &got_ip_event_handler, NULL));

    /* Start Ethernet driver state machine */
    ESP_ERROR_CHECK(esp_eth_start(eth_handle));

}

relaisstation.net

Hello all,

I have the same problem as the previous speakers.
With the Arduino IDE 2.1.0

The board manager URL:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

I also get the error messages with the OLIMEX Gateway:
E (1012) esp.emac: emac_esp32_init(354): reset timeout
E (1012) esp_eth: esp_eth_driver_install(222): init mac failed

Quote from: LubOlimex on November 28, 2022, 09:37:56 AM3.

Unfortunately, there is currently only version F to choose from, but I have revision G here.

If I use the ESP32-PoE as board the Ethernet Example works.


Best regards!

Quote from: LubOlimex on November 28, 2022, 09:37:56 AM3.

LubOlimex

QuoteUnfortunately, there is currently only version F to choose from, but I have revision G here.

That is fine, selecting revision F is suitable for newer revisions too. So you get the error when you select ESP32-GATEWAY and revision F?
Technical support and documentation manager at Olimex