Comments (7)
I did further research and found some examples using the new framework with the W5500
adapter which is used in the Lilygo: https://github.com/espressif/arduino-esp32/tree/master/libraries/Ethernet/examples
I tested both the version with the Arduino API (SPI.h) and the ISP-IDF and they both work fine.
from lilygo-t-eth-series.
I was able to find a solution, that is implemented in my MycilaESPConnect library (Network manager). I need to support several ETH cards including WT32-ETH1, Lilygo, etc.
Here is what I have in my header:
#if defined(ESPCONNECT_ETH_SUPPORT)
#if defined(ETH_PHY_SPI_SCK) && defined(ETH_PHY_SPI_MISO) && defined(ETH_PHY_SPI_MOSI) && defined(ETH_PHY_CS) && defined(ETH_PHY_IRQ) && defined(ETH_PHY_RST)
#define ESPCONNECT_ETH_SPI_SUPPORT 1
#if ESP_IDF_VERSION_MAJOR >= 5
#include <ETH.h>
#include <SPI.h>
#else
#include <ETHClass.h>
#endif
#else
#include <ETH.h>
#endif
#endif
#ifdef ESPCONNECT_ETH_SUPPORT
void ESPConnectClass::_startEthernet() {
_setState(ESPConnectState::NETWORK_CONNECTING);
#if defined(ETH_PHY_POWER) && ETH_PHY_POWER > -1
pinMode(ETH_PHY_POWER, OUTPUT);
#ifdef ESPCONNECT_ETH_RESET_ON_START
ESP_LOGD(TAG, "Resetting ETH_PHY_POWER Pin %d", ETH_PHY_POWER);
digitalWrite(ETH_PHY_POWER, LOW);
delay(350);
#endif
ESP_LOGD(TAG, "Activating ETH_PHY_POWER Pin %d", ETH_PHY_POWER);
digitalWrite(ETH_PHY_POWER, HIGH);
#endif
ESP_LOGI(TAG, "Starting Ethernet...");
#if defined(ESPCONNECT_ETH_SPI_SUPPORT)
#if ESP_IDF_VERSION_MAJOR >= 5
// https://github.com/espressif/arduino-esp32/tree/master/libraries/Ethernet/examples
SPI.begin(ETH_PHY_SPI_SCK, ETH_PHY_SPI_MISO, ETH_PHY_SPI_MOSI);
if (!ETH.begin(ETH_PHY_TYPE, ETH_PHY_ADDR, ETH_PHY_CS, ETH_PHY_IRQ, ETH_PHY_RST, SPI)) {
ESP_LOGE(TAG, "ETH failed to start!");
}
#else
if (!ETH.beginSPI(ETH_PHY_SPI_MISO, ETH_PHY_SPI_MOSI, ETH_PHY_SPI_SCK, ETH_PHY_CS, ETH_PHY_RST, ETH_PHY_IRQ)) {
ESP_LOGE(TAG, "ETH failed to start!");
}
#endif
#else
if (!ETH.begin()) {
ESP_LOGE(TAG, "ETH failed to start!");
}
#endif
_lastTime = esp_timer_get_time();
ESP_LOGD(TAG, "ETH started.");
}
#endif
Flags for wt32-eth01:
-D ESPCONNECT_ETH_SUPPORT
-D ETH_PHY_ADDR=1
-D ETH_PHY_POWER=16
Flags for T-ETH-Lite ESP32 S3:
-D ESPCONNECT_ETH_SUPPORT
-D ETH_PHY_ADDR=1
-D ETH_PHY_CS=9
-D ETH_PHY_IRQ=13
-D ETH_PHY_RST=14
-D ETH_PHY_SPI_MISO=11
-D ETH_PHY_SPI_MOSI=12
-D ETH_PHY_SPI_SCK=10
; can only be activated with ESP-IDF >= 5
; -D ETH_PHY_TYPE=ETH_PHY_W5500
from lilygo-t-eth-series.
Oh! And I had to add this hack into ETHClass
in order to avoid it to be part of the compilation:
#include "esp_system.h"
#if defined(ETH_PHY_SPI_SCK) && defined(ETH_PHY_SPI_MISO) && defined(ETH_PHY_SPI_MOSI) && defined(ETH_PHY_CS) && defined(ETH_PHY_IRQ) && defined(ETH_PHY_RST) && ESP_IDF_VERSION_MAJOR < 5
from lilygo-t-eth-series.
Currently, the latest platformio is still 4.4.x. I will not update it for the time being. I will do a comprehensive update after platformio is synchronized to 5.x.
from lilygo-t-eth-series.
Yes makes sense.
I was in the process of preparing my librairies to be compatible.
And like described in this issue it works.
Someone in a normal project won't have to go over all the cases like I had to.
from lilygo-t-eth-series.
This issue is stale because it has been open for 30 days with no activity.
from lilygo-t-eth-series.
I am closing since it is fixed
from lilygo-t-eth-series.
Related Issues (20)
- T-ETH-Lite-S3 all examples fail HOT 3
- Can't use pin as digital output HOT 4
- SPI bus error with Lilygo T-ETH-Lite HOT 1
- T-POE Pro pinout HOT 8
- Using GPIO13/14/15 to connect UART2 caused kernel panic on T-ETH-Lite-ESP32 HOT 5
- Issue Trying to Run HelloServer Example on T-POE-Pro HOT 1
- T-ETH-Pro ModBus issues HOT 11
- T-ETH-Lite ESP32-S3: Second SPI for other device than TF Card? HOT 6
- T-ETH-Lite-POE-Shield : Isolation? HOT 5
- T-ETH-Lite S3: LED intensity HOT 7
- T-ETH Lite : how much current can I draw? HOT 8
- No serial data received HOT 2
- T-ETH-LITE - S3 Running tcpclient example for rosserial over ethernet with the esp32-s3 HOT 3
- T-ETH-Lite-S3 W5500 - Can it go faster? HOT 4
- Can T-ETH ELite [H744] be used in an environment without POE ? HOT 2
- T-POE-PRO - signal RS485 ground and shield ground (MGND or DGND) HOT 3
- T-ETH-Lite-S3 W5500 - can I accress USB d+ and USB d- as I would be able to on a typical ESP32-S3 board? HOT 3
- Network connection HOT 3
- Example: CameraShield.ino it does not compile HOT 18
- Need esp-idf example! HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lilygo-t-eth-series.