Wiznet makers

ronpang

Published March 20, 2026 ©

175 UCC

90 WCC

34 VAR

0 Contests

1 Followers

0 Following

Original Link

How to Build a Static-IP Ethernet Stack with W5500 on ESP32-S3?

This project shows how to integrate a W5500 with ESP32-S3 under ESP-IDF, with emphasis on SPI stability,

COMPONENTS
PROJECT DESCRIPTION

How to Build a Static-IP Ethernet Stack with W5500 on ESP32-S3?

Summary

This project shows how to integrate a W5500 with ESP32-S3 under ESP-IDF, with emphasis on SPI stability, MAC address handling, and static IP configuration order. In this design, the ESP32-S3 runs the application and ESP-IDF Ethernet framework, while the W5500 provides the external wired Ethernet interface over SPI for a stable, teachable network stack on an MCU platform.

What the Project Does

The article is an ESP32-S3 + W5500 integration guide rather than a finished product repo. It walks through three concrete areas: recommended pin mapping between ESP32-S3 and W5500, SPI bus/device configuration in ESP-IDF, and Ethernet identity setup through MAC address management and static IP configuration. The stated goal is to move from basic SPI bring-up to a stable wired deployment with a fixed network identity.

From a network-stack perspective, this is not a raw register-only W5500 example. The article uses ESP-IDF’s Ethernet driver model, creating a W5500 MAC/PHY pair with esp_eth_mac_new_w5500() and esp_eth_phy_new_w5500(), installing the driver with esp_eth_driver_install(), then applying MAC configuration through esp_eth_ioctl(). That makes the architecture educationally useful because it shows where ESP-IDF owns the system integration and where the W5500 remains the actual Ethernet endpoint.

The guide also focuses on static IP behavior, which is often where ESP32 Ethernet newcomers get stuck. The visible portion of the article explicitly says that static IP can fail if configured in the wrong order, and shows the correct sequence starting with esp_netif_dhcpc_stop() before applying manual IP information. That turns the project into a practical lesson in network-stack sequencing, not just hardware hookup.

Where WIZnet Fits

The exact WIZnet product here is the W5500. In this ESP32-S3 design, its role is the external SPI Ethernet controller that gives the MCU a wired network path while fitting into ESP-IDF’s Ethernet abstraction. The article builds around W5500-specific driver creation and SPI tuning, which makes its place in the architecture explicit rather than implied.

For education, this is a good W5500 use case because it exposes the full chain from board wiring to network identity. Students can see the physical SPI connection, the bus/device configuration, the Ethernet driver install step, MAC assignment timing, and finally static IPv4 setup. That is a better teaching path than jumping directly into application protocols, because it explains why a wired endpoint works before asking it to do more.

Implementation Notes

This project does use WIZnet products, and the article shows real code snippets inline, but it does not provide a public repository with file paths or line-addressable source files. I therefore cannot verify a repo-backed codebase and am limiting code references to what is visible in the article itself.

One visible implementation block is the SPI setup for ESP32-S3:

spi_bus_config_t bus_config = { .miso_io_num = GPIO_NUM_13, .mosi_io_num = GPIO_NUM_11, .sclk_io_num = GPIO_NUM_12, ... .max_transfer_sz = 4096, ... };
spi_bus_initialize(SPI2_HOST, &bus_config, SPI_DMA_CH_AUTO);

Why it matters: this is the physical transport boundary to the W5500. The article treats max_transfer_sz = 4096 as a practical balance for DMA and memory use, and it anchors the project in ESP-IDF’s SPI host model rather than ad hoc bit-banging.

A second visible implementation block is the W5500 device attachment:

spi_device_interface_config_t dev_config = { .mode = 0, .clock_speed_hz = 20 * 1000 * 1000, .spics_io_num = GPIO_NUM_10, .queue_size = 10, ... };
spi_bus_add_device(SPI2_HOST, &dev_config, &spi_handle);

Why it matters: this shows that the article is not claiming maximum-speed operation blindly. It explicitly recommends starting lower and tuning upward, with 20 MHz shown as the concrete baseline configuration. That is a realistic educational choice for stable bring-up.

The network-side integration is also concrete:

esp_eth_mac_t *mac = esp_eth_mac_new_w5500(&w5500_config, &mac_config);
esp_eth_phy_t *phy = esp_eth_phy_new_w5500(&phy_config);
ESP_ERROR_CHECK(esp_eth_driver_install(&eth_config, &eth_handle));
ESP_ERROR_CHECK(esp_eth_ioctl(eth_handle, ETH_CMD_S_MAC_ADDR, custom_mac));
ESP_ERROR_CHECK(esp_eth_start(eth_handle));

Why it matters: this is the architectural center of the project. It shows that W5500 is integrated through ESP-IDF’s Ethernet stack, and it also shows the critical ordering rule the article emphasizes: install the driver first, set the MAC address next, and only then start Ethernet.

Practical Tips / Pitfalls

Start SPI debugging with a simple version-register read before trying full Ethernet bring-up; the article shows a version read and notes that 0x04 is the expected W5500 value.

Do not assume the highest SPI clock is best. The article explicitly says 40 MHz may lose packets on some layouts and that 20 MHz was stable in real use.

Set the MAC address after esp_eth_driver_install() but before esp_eth_start(). The article calls this out as a critical ordering requirement.

Stop DHCP before applying static IP. The visible static-IP flow begins with esp_netif_dhcpc_stop(), which is the key step many beginners miss.

Keep INT connected if possible. The article marks it optional, but also recommends it because it can reduce CPU load.

Use the ESP32-S3 factory MAC when available. The guide recommends esp_efuse_mac_get_default() as the primary source of a unique address.

FAQ

Why use the W5500 with ESP32-S3 for this project?
Because it gives ESP32-S3 a wired Ethernet path through a well-understood SPI-attached controller, while still fitting cleanly into ESP-IDF’s Ethernet framework. For education, that makes the stack easier to explain than a larger custom networking path.

How does the W5500 connect to the platform?
The article recommends SPI wiring with SCS on GPIO10, SCLK on GPIO12, MOSI on GPIO11, MISO on GPIO13, plus optional INT on GPIO9 and RST on GPIO8. It also recommends using SPI2/HSPI-style mapping for best results.

What role does the W5500 play in this specific project?
It is the external Ethernet interface under ESP-IDF’s driver model. ESP32-S3 runs the application and driver orchestration, but the W5500 is the hardware Ethernet endpoint used for MAC/PHY access and wired network connectivity.

Can beginners follow this project?
Yes, if they already know basic ESP-IDF, SPI pin mapping, and IPv4 basics. The guide is especially suitable for education because it focuses on setup order and common failure points rather than hiding everything behind a ready-made example.

How does this compare with Wi-Fi on ESP32?
Wi-Fi is more convenient for deployment, but this article is aimed at cases where wired stability and fixed network identity matter more. The source explicitly frames W5500 Ethernet as preferable in scenarios like control, data collection, and edge systems that need more predictable connectivity.

Source

Original article: CSDN post, “ESP32-S3 + W5500以太网实战:从SPI配置到静态IP设置的完整流程,” published March 6, 2026. The visible content shows inline ESP-IDF code for SPI configuration, W5500 Ethernet driver installation, MAC setup, and static IP sequencing.

Tags

W5500, WIZnet, ESP32-S3, ESP-IDF, Ethernet, SPI, Static IP, MAC Address, Network Stack, Education, Wired Networking, Embedded Ethernet

ESP32-S3에서 W5500으로 고정 IP 이더넷 스택을 어떻게 구축할 수 있을까?

Summary

이 프로젝트는 ESP-IDF 환경에서 ESP32-S3와 W5500을 통합하는 과정을 다루며, 특히 SPI 안정성, MAC 주소 처리, 고정 IP 설정 순서에 초점을 맞춘다. 이 구조에서 ESP32-S3는 애플리케이션과 ESP-IDF 이더넷 프레임워크를 실행하고, W5500은 SPI를 통해 연결되는 외부 유선 이더넷 인터페이스 역할을 맡아 MCU 플랫폼에서 안정적이고 교육용으로 적합한 네트워크 스택을 구성한다.

What the Project Does

이 글은 완성된 제품 저장소가 아니라 ESP32-S3 + W5500 통합 가이드에 가깝다. 내용은 크게 세 부분으로 구성된다. 첫째, ESP32-S3와 W5500 사이의 권장 핀 매핑, 둘째, ESP-IDF에서의 SPI 버스 및 장치 설정, 셋째, MAC 주소 관리와 고정 IP 설정을 통한 이더넷 식별 정보 구성이다. 목표는 단순한 SPI 구동을 넘어서, 고정된 네트워크 정체성을 가진 안정적인 유선 배포 환경으로 이어지는 흐름을 만드는 데 있다.

네트워크 스택 관점에서 보면, 이것은 W5500 레지스터만 직접 다루는 예제가 아니다. 글은 ESP-IDF의 이더넷 드라이버 모델을 사용해 esp_eth_mac_new_w5500()esp_eth_phy_new_w5500()로 W5500용 MAC/PHY 객체를 만들고, esp_eth_driver_install()로 드라이버를 설치한 뒤, esp_eth_ioctl()을 통해 MAC 설정을 적용한다. 교육용으로 유용한 이유는 ESP-IDF가 시스템 통합을 어떻게 담당하는지, 그리고 실제 이더넷 엔드포인트로서 W5500이 어디에 위치하는지를 함께 보여주기 때문이다.

이 가이드는 특히 고정 IP 동작 순서에 많은 비중을 둔다. 초보자가 ESP32 이더넷에서 자주 막히는 부분이 바로 이 지점인데, 글은 잘못된 순서로 설정하면 고정 IP가 동작하지 않을 수 있다고 분명히 언급한다. 그리고 esp_netif_dhcpc_stop()을 먼저 호출한 뒤 수동 IP 정보를 적용하는 올바른 절차를 보여준다. 그래서 이 프로젝트는 단순한 하드웨어 연결 설명이 아니라, 실제 네트워크 스택 구성 순서를 배우는 실습 가이드라고 볼 수 있다.

Where WIZnet Fits

여기서 사용된 정확한 WIZnet 제품은 W5500이다. 이 ESP32-S3 설계에서 W5500의 역할은 외부 SPI 이더넷 컨트롤러다. 즉, ESP-IDF의 이더넷 추상화 계층에 맞춰 MCU에 유선 네트워크 경로를 제공한다. 글은 W5500 전용 드라이버 생성 과정과 SPI 튜닝을 중심으로 설명하므로, 이 칩의 위치는 암시적이 아니라 명확하게 드러난다.

교육 관점에서 이 프로젝트가 좋은 이유는 보드 배선부터 네트워크 식별 정보까지 전체 체인을 보여주기 때문이다. 학습자는 물리적인 SPI 연결, 버스/장치 설정, 이더넷 드라이버 설치, MAC 주소 설정 시점, 마지막으로 고정 IPv4 적용까지 모두 확인할 수 있다. 애플리케이션 프로토콜로 바로 넘어가기 전에 유선 엔드포인트가 왜, 어떻게 동작하는지 설명해 준다는 점에서 교육 가치가 높다.

Implementation Notes

이 프로젝트는 실제로 WIZnet 제품을 사용하며, 글 안에 실제 코드 조각도 포함되어 있다. 다만 공개 저장소나 파일 경로, 줄 번호를 확인할 수 있는 소스는 제공되지 않는다. 따라서 저장소 기반 코드 검증은 할 수 없고, 아래 구현 설명은 글 안에서 확인 가능한 내용만 기준으로 한다.

먼저 보이는 구현 블록은 ESP32-S3용 SPI 설정이다.

spi_bus_config_t bus_config = { .miso_io_num = GPIO_NUM_13, .mosi_io_num = GPIO_NUM_11, .sclk_io_num = GPIO_NUM_12, ... .max_transfer_sz = 4096, ... };
spi_bus_initialize(SPI2_HOST, &bus_config, SPI_DMA_CH_AUTO);

이 코드가 중요한 이유는 W5500으로 가는 물리적 전송 경계를 보여주기 때문이다. 글은 max_transfer_sz = 4096을 DMA와 메모리 사용량 사이의 실용적인 균형점으로 다루고 있으며, 프로젝트가 임의의 비트뱅잉 방식이 아니라 ESP-IDF의 SPI 호스트 모델 위에 구축된다는 점을 분명히 한다.

두 번째 구현 블록은 W5500 장치 등록 부분이다.

spi_device_interface_config_t dev_config = { .mode = 0, .clock_speed_hz = 20 * 1000 * 1000, .spics_io_num = GPIO_NUM_10, .queue_size = 10, ... };
spi_bus_add_device(SPI2_HOST, &dev_config, &spi_handle);

이 코드가 중요한 이유는 이 글이 무작정 최고 속도를 권장하지 않는다는 점을 보여주기 때문이다. 실제 설정 예로 20 MHz를 제시하고, 먼저 낮은 속도에서 안정성을 확보한 뒤 점진적으로 조정하라고 안내한다. 교육용 구동 관점에서 현실적인 접근이다.

네트워크 측 통합도 구체적이다.

esp_eth_mac_t *mac = esp_eth_mac_new_w5500(&w5500_config, &mac_config);
esp_eth_phy_t *phy = esp_eth_phy_new_w5500(&phy_config);
ESP_ERROR_CHECK(esp_eth_driver_install(&eth_config, &eth_handle));
ESP_ERROR_CHECK(esp_eth_ioctl(eth_handle, ETH_CMD_S_MAC_ADDR, custom_mac));
ESP_ERROR_CHECK(esp_eth_start(eth_handle));

이 코드가 중요한 이유는 프로젝트의 아키텍처 중심을 보여주기 때문이다. W5500이 ESP-IDF 이더넷 스택 안에서 어떻게 통합되는지가 드러나고, 동시에 글이 강조하는 핵심 순서도 확인된다. 즉, 드라이버를 먼저 설치하고, 그다음 MAC 주소를 설정한 뒤, 마지막으로 이더넷을 시작해야 한다는 점이다.

Practical Tips / Pitfalls

전체 이더넷 구동 전에 단순한 버전 레지스터 읽기부터 확인하는 편이 좋다. 글은 버전 읽기 예제를 보여주며, W5500의 기대값이 0x04라고 설명한다.

가장 높은 SPI 클록이 항상 최선은 아니다. 글은 40 MHz에서 일부 보드 레이아웃에서는 패킷 손실이 발생할 수 있었고, 실제 사용에서는 20 MHz가 안정적이었다고 설명한다.

MAC 주소는 esp_eth_driver_install() 이후, esp_eth_start() 이전에 설정해야 한다. 글은 이 순서를 중요한 요구사항으로 강조한다.

고정 IP를 적용하기 전에 DHCP를 먼저 중지해야 한다. 글에서 보이는 고정 IP 설정 흐름은 esp_netif_dhcpc_stop()으로 시작하며, 많은 초보자가 이 단계를 놓친다.

가능하면 INT 핀을 연결하는 편이 좋다. 글은 선택 사항으로 표시하지만, CPU 부하를 줄이는 데 도움이 된다고 권장한다.

가능하면 ESP32-S3의 공장 출하 MAC 주소를 사용하는 편이 좋다. 가이드는 고유 주소 확보를 위해 esp_efuse_mac_get_default()를 우선적으로 권장한다.

FAQ

왜 이 프로젝트에서 ESP32-S3와 함께 W5500을 사용하는가?
ESP32-S3에 SPI 기반의 유선 이더넷 경로를 안정적으로 추가할 수 있고, 동시에 ESP-IDF의 이더넷 프레임워크 안에 자연스럽게 통합되기 때문이다. 교육용 관점에서는 더 복잡한 사용자 정의 네트워크 경로보다 설명하기 쉽다.

W5500은 플랫폼과 어떻게 연결되는가?
글은 SCS를 GPIO10, SCLK를 GPIO12, MOSI를 GPIO11, MISO를 GPIO13으로 연결하고, 선택적으로 INT는 GPIO9, RST는 GPIO8에 연결하는 구성을 권장한다. 또한 안정적인 동작을 위해 SPI2/HSPI 계열 매핑을 사용하는 편이 좋다고 설명한다.

이 프로젝트에서 W5500의 구체적인 역할은 무엇인가?
ESP-IDF 드라이버 모델 아래에서 동작하는 외부 이더넷 인터페이스다. ESP32-S3가 애플리케이션과 드라이버 오케스트레이션을 담당하고, W5500은 실제 MAC/PHY 접근과 유선 네트워크 연결을 담당하는 하드웨어 이더넷 엔드포인트다.

초보자도 이 프로젝트를 따라갈 수 있는가?
가능하다. 다만 기본적인 ESP-IDF 사용법, SPI 핀 매핑, IPv4 개념은 이해하고 있는 편이 좋다. 이 가이드는 모든 것을 готов한 예제로 숨기지 않고, 설정 순서와 자주 발생하는 실패 지점을 중심으로 설명하기 때문에 교육용으로 적합하다.

ESP32의 Wi-Fi와 비교하면 어떤 차이가 있는가?
Wi-Fi는 배포가 더 편리하지만, 이 글은 유선의 안정성과 고정된 네트워크 정체성이 더 중요한 경우를 대상으로 한다. 제어, 데이터 수집, 엣지 시스템처럼 더 예측 가능한 연결이 필요한 환경에서는 W5500 기반 이더넷이 더 적합하다고 설명한다.

Source

원문 출처: CSDN 글 “ESP32-S3 + W5500以太网实战:从SPI配置到静态IP设置的完整流程”, 2026년 3월 6일 게시.
글에는 SPI 설정, W5500 이더넷 드라이버 설치, MAC 설정, 고정 IP 순서와 관련된 ESP-IDF 코드가 포함되어 있다.

Tags

W5500, WIZnet, ESP32-S3, ESP-IDF, Ethernet, SPI, Static IP, MAC Address, Network Stack, Education, Wired Networking, Embedded Ethernet

 

Documents
Comments Write