New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
W5500 spi ethernet #1235
Comments
The possability of supporting W5500 as Ethernet option would also be relevant for people interested in using the M5 Atom series of ESP32s. They have a PoE enabled ethernet accessory ( info & specs: https://docs.m5stack.com/en/atom/atom_poe ); this would eliminate power supplies and make having a collection of these a lot easier. Perfectly willing to buy a few to use for testing. |
I was just looking at that M5 Atom POE device too. What is involved in adding support for the w5500 Ethernet chipset? |
Another nice ESP32 product with W5500: |
Also the Norvi ENET "industrial" controllers use a W5500 interface |
i think what vis needed is to make a custom component since it is supported in arduino and libaryies are there ethernet2 and spi is already supported but it seems that Otto Winter dont think there is enough interest for this i myself have used it before in arduino and hardware vise it is much easyier to work with than lan8720. specialy hardware vise i am now using lan 8720 but is is a pain in the butt to make pcb with because of the need for diferential pair routing due to 50mhz clock |
Another bunch of ESP32 PLCs with W5500 phy |
Hey, I would also hope for this to get it supported, industrial shields are amazing products |
How many GPIOs are needed minimum with W5500? Fewer than with LAN8720, right? |
Additional info: ESPHome supports RP2040 which doesn't have a network connection. W5500 could be perfect: |
Just took a look at the Ethernet component (here) and support for |
Hmm... |
w5500 works fine in arduino using ethernet or ethernet2 libary Khoi
Hoang
has made some nice webserver examples look at his github
Em qui., 30 de jun. de 2022 às 14:56, H. Árkosi Róbert <
***@***.***> escreveu:
… Hmm...
One extra step is definitely needed: #1683
<#1683>
Because with ESPHome set to type: esp-idf won't do any Ethernet at all...
—
Reply to this email directly, view it on GitHub
<#1235 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG7RHTEZFDUZRDDSSM7N66TVRWKPZANCNFSM45NPGKBQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@dyrvigk I did some research and testing. The But I stumbled over this and it seems that IDF supports SPI to ethernet boards like the W5500 using the "standard" software IP stack. But as @nagyrobi mentioned, the Ethernet component of esphome is not available when using IDF. |
Managed to get a minimal working example using the Arduino framework and the lwip stack of the WiFi library. #include <Arduino.h>
#include <WiFi.h>
#include <ETH.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include "driver/spi_master.h"
#include <SPI.h>
/*
* GPIO config for W5500:
*
* MISO: GPIO19
* MOSI: GPIO23
* SCLK: GPIO18
* SCS: GPIO5
* INT: GPIO22
*/
AsyncWebServer server(80);
bool setupW5500() {
WiFi.begin();
tcpip_adapter_set_default_eth_handlers();
// Initialize TCP/IP network interface
ESP_ERROR_CHECK(esp_netif_init());
esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
esp_netif_t *eth_netif = esp_netif_new(&cfg);
esp_eth_mac_t *eth_mac = NULL;
esp_eth_phy_t *eth_phy = NULL;
gpio_install_isr_service(0);
spi_bus_config_t buscfg = {
.mosi_io_num = 23, // MOSI
.miso_io_num = 19, // MISO
.sclk_io_num = 18, // SCLK
.quadwp_io_num = -1,
.quadhd_io_num = -1,
};
ESP_ERROR_CHECK(spi_bus_initialize(SPI3_HOST, &buscfg, 1));
spi_device_handle_t spi_handle = NULL;
spi_device_interface_config_t devcfg = {
.command_bits = 16, // Address phase in W5500 SPI frame
.address_bits = 8, // Control phase in W5500 SPI frame
.mode = 0,
.clock_speed_hz = 12 * 1000 * 1000,
.spics_io_num = 5, // SCS
.queue_size = 20
};
ESP_ERROR_CHECK(spi_bus_add_device(SPI3_HOST, &devcfg, &spi_handle));
/* W5500 ethernet driver uses spi driver */
eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(spi_handle);
w5500_config.int_gpio_num = 22; // INT
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
phy_config.reset_gpio_num = -1;
eth_mac = esp_eth_mac_new_w5500(&w5500_config, &mac_config);
if(eth_mac == NULL){
log_e("esp_eth_mac_new_esp32 failed");
return false;
}
eth_phy = esp_eth_phy_new_w5500(&phy_config);
if(eth_phy == NULL){
log_e("esp_eth_phy_new failed");
return false;
}
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(eth_mac, eth_phy);
esp_eth_handle_t eth_handle = NULL;
ESP_ERROR_CHECK(esp_eth_driver_install(ð_config, ð_handle));
uint8_t macArr[] = { 0x02, 0x00, 0x00, 0x12, 0x34, 0x56 };
ESP_ERROR_CHECK(esp_eth_ioctl(eth_handle, ETH_CMD_S_MAC_ADDR, macArr));
/* Attach Ethernet driver to TCP/IP stack */
ESP_ERROR_CHECK(esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle)));
/* Start Ethernet driver state machine */
ESP_ERROR_CHECK(esp_eth_start(eth_handle));
return true;
}
void setupWebserver() {
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(200, "text/plain", "Hello world");
});
server.onNotFound([](AsyncWebServerRequest *request){
request->send(404, "text/plain", "Not found");
});
server.begin();
}
void setup() {
Serial.begin(115200);
setupW5500();
setupWebserver();
}
void loop() {} From here, it might be manageable to integrate, right? A short assessment from @OttoWinter or maybe @jesserockz would be very helpful! |
Do you know if there is any progress of this? I have noticed that @kbx81 in esphome/esphome#3751 mentioned he may be able to prepare PR for it, but no further updates. |
Unfortunately, no |
esphome/esphome#3564 upgrades ethernet for ESPHome to include 2 more drivers and esp-idf support added in esphome/esphome#3565. This should make it possible to add further Ethernet drivers more easily. |
Since using the W5500 is so pretty easy on Arduino, I just stumbled over this FR. I'd also appreciate an integration of W5500 support in ESPHome! 😊 |
I would like to use ESP32 plus W5500 for energy monitoring via S0 counter inside a metallic switchboard. so WIFI is no option. Is any work going on in implementing the W5500 board? |
I have just made a draft PR to add support for the W5500 board. I have not been able to test this on an actual device yet, but anyone is welcome to give it a try! |
Thanks!!! Works great with some changes for the ESP32C3 with W5500 25 MHz clock.
|
Basically if this gets added we can use esp32c3 for eth-ble bridge? |
Sorry, I'm new to this but i need to know if theUSR-ES1 W5500 can be used to power a pyboard directly or is some device needed. If I need a device, can I get your recommendations? |
Another ESP32-Ethernet board variant hosting a W5500: https://github.com/yellobyte/ESP32-DevBoards-Getting-Started/tree/main/boards/YB-ESP32-S3-ETH(YelloByte) ...and waiting to get native support. |
I bought this w5500 shield and was hoping w5500 could be natively supported on esphome. https://aliexpress.com/item/1005003589665341.html |
See this PR discussion for working ethernet component on ESP32 Arduino and ESP-IDF. |
I'd love to see this extended to include the rp2040, not just ESP-IDF. The PoE Featherwing along with the RP2040-shim makes for a very compact platform for wired PoE sensors. |
Waiting eagerly for native W5500 support to use the Lilygo T-ETH-Lite S3 with ESPHome! |
I have tested this with
It works, but needs to have a slower clock speed . esphome:
name: t-relay
friendly_name: t-relay
esp32:
board: esp32dev
framework:
type: esp-idf
external_components:
- source:
type: git
url: https://github.com/JeroenVanOort/esphome/
ref: eth-w5500
components: [ ethernet,network,api,esp32]
# Enable logging
# Logger must be at least debug (default)
logger:
level: DEBUG
# Enable Home Assistant API
# Enable Home Assistant API
api:
encryption:
key: !secret grandviewcontrol_encryption_key
ota:
ethernet:
type: W5500
clk_pin: GPIO22
mosi_pin: GPIO26
miso_pin: GPIO13
cs_pin: GPIO27
interrupt_pin: GPIO36
reset_pin: GPIO23
clock_speed: 16Mhz #works
# clock_speed: 32Mhz #doesn't |
Trying to access the ESP32 connected via POE/Ethernet results now in the message:
The ESP32 (Lilygo T-ETH-S3) with W5500 still functions with this integration:
|
Have to use esphome dev version
Then it works
And no external files just with ethernet and w5500 i is in the dev core now
tirs. 12. mar. 2024 07.51 skrev pixelWAVE ***@***.***>:
… Trying to access the ESP32 connected via POE/Ethernet results now in the
message:
`
INFO ESPHome 2024.2.2
INFO Reading configuration /config/woesp32-s3-7p-eth.yaml...
ERROR Unable to import component ethernet:
Traceback (most recent call last):
File "/esphome/esphome/loader.py", line 169, in _lookup_module
module = importlib.import_module(f"esphome.components.{domain}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/*init*.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1206, in _gcd_import
File "", line 1178, in _find_and_load
File "", line 1149, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File
"/config/.esphome/external_components/2f02e929/esphome/components/ethernet/
*init*.py", line 11, in
from esphome.const import (
ImportError: cannot import name 'CONF_SPI' from 'esphome.const'
(/esphome/esphome/const.py)
Failed config
api: [source /config/woesp32-s3-7p-eth.yaml:17]
Component api requires component network.
encryption:
key: 2RUdO7HGxXxo0WOYrW6MXLJ3axAMqkLLGCSHsPjszVk=
ota: [source /config/woesp32-s3-7p-eth.yaml:21]
Component ota requires component network.
password: 0a20e03c82db327d1524d8c2b8c8d555
ethernet: [source /config/woesp32-s3-7p-eth.yaml:31]
Component not found: ethernet.
type: W5500
clk_pin: GPIO10
mosi_pin: GPIO12
miso_pin: GPIO11
cs_pin: GPIO09
interrupt_pin: GPIO13
reset_pin: GPIO14
clock_speed: 30Mhz
web_server_base: None
{}
Component web_server_base requires component network
`
—
Reply to this email directly, view it on GitHub
<#1235 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG7RHTE6DX4WXAXTR2VP4XDYX2QXPAVCNFSM45NPGKB2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJZGA4DSOJZGU2A>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Ah ok thanks for clarification! If it is already in the dev then I guess it will be soon also in the release version if testing goes well .. right? |
I think so
Kenn
tirs. 12. mar. 2024 09.40 skrev pixelWAVE ***@***.***>:
… Ah ok thanks for clarification!
If it is already in the dev then I guess it will be soon also in the
release version if testing goes well .. right?
—
Reply to this email directly, view it on GitHub
<#1235 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG7RHTFZEG6VL23XVSQHLLTYX25QBAVCNFSM45NPGKB2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJZGEYDINZWGE3Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I have an ESP32-cam board with limited GPIO ports and got the ethernet W5500 component working with 20Mhz. But I would like to get higher speed for the camera. ethernet:
domain: .fritz.box
type: w5500
clk_pin: GPIO15 # SCK
mosi_pin: GPIO14 # MO
cs_pin: GPIO13 # CS
miso_pin: GPIO12 # M
clock_speed: 20Mhz But I can't get any higher clock speed than 20Mhz. |
Yes without interupt it is very slow
fre. 22. mar. 2024 18.32 skrev Konstantin ***@***.***>:
… I got the ethernet W5500 component working with:
ethernet:
domain: .fritz.box
type: w5500
clk_pin: GPIO15 # SCK
mosi_pin: GPIO14 # MO
cs_pin: GPIO13 # CS
miso_pin: GPIO12 # M
clock_speed: 20Mhz
But I can't get any higher clock speed than 20Mhz.
Do I need the interrupt/reset pin to get anything higher?
—
Reply to this email directly, view it on GitHub
<#1235 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG7RHTHVPXFDUGQ7P2B2C7TYZRTJ7AVCNFSM45NPGKB2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBRGU2TOMRQGY3Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Describe the problem you have/What new integration you would like
Please describe your use case for this integration and alternatives you've tried:
I would like to get support for w5500 lan spi interface and using ethernet2 libary the reason is that the supported lan8720 only works with esp32 and it is hardware wise more dificult to get to work
Additional context
The text was updated successfully, but these errors were encountered: