From 92be70ac7619ca4c3a0d9e9649130238abab832d Mon Sep 17 00:00:00 2001 From: Stanimir-Petev Date: Tue, 25 Jan 2022 10:46:32 +0200 Subject: [PATCH] ESP32-EVB/Gateway ethernet fix Added short delay (350 ms) for ESP32-EVB at the start of the ethernet begin function (in ETH.cpp) to solve the issue with the inability to initialize the phy immediately after reset. Added values of the revision macros (in boards.txt) for ESP32-Gateway to match the #if conditions in the variant file and applying the changes for the respective revision. --- boards.txt | 8 ++++---- libraries/Ethernet/src/ETH.cpp | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/boards.txt b/boards.txt index 085c03e56d3..b8ab9dd3a63 100755 --- a/boards.txt +++ b/boards.txt @@ -5550,11 +5550,11 @@ esp32-gateway.build.core=esp32 esp32-gateway.build.variant=esp32-gateway esp32-gateway.build.board=ESP32_GATEWAY esp32-gateway.menu.Revision.RevC=Revision C or older -esp32-gateway.menu.Revision.RevC.build.board=ESP32_GATEWAY_C +esp32-gateway.menu.Revision.RevC.build.board=ESP32_GATEWAY='C' esp32-gateway.menu.Revision.RevE=Revision E -esp32-gateway.menu.Revision.RevE.build.board=ESP32_GATEWAY_E -esp32-gateway.menu.Revision.RevF=Revision F -esp32-gateway.menu.Revision.RevF.build.board=ESP32_GATEWAY_F +esp32-gateway.menu.Revision.RevE.build.board=ESP32_GATEWAY='E' +esp32-gateway.menu.Revision.RevF=Revision F or newer +esp32-gateway.menu.Revision.RevF.build.board=ESP32_GATEWAY='F' esp32-gateway.build.f_cpu=240000000L esp32-gateway.build.flash_mode=dio diff --git a/libraries/Ethernet/src/ETH.cpp b/libraries/Ethernet/src/ETH.cpp index a08cc3340d8..d99ee37ebbb 100644 --- a/libraries/Ethernet/src/ETH.cpp +++ b/libraries/Ethernet/src/ETH.cpp @@ -228,6 +228,9 @@ ETHClass::~ETHClass() bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_type_t type, eth_clock_mode_t clock_mode) { +#if defined ARDUINO_ESP32_EVB + delay (350); // Olimex board ESP32-EVB requires short delay before the phy initialization after reset +#endif #if ESP_IDF_VERSION_MAJOR > 3 eth_clock_mode = clock_mode; tcpipInit();