Wiznet makers

ronpang

Published March 20, 2026 ©

170 UCC

90 WCC

34 VAR

0 Contests

1 Followers

0 Following

Original Link

How to Build a MicroPython Ethernet Firmware Flow with W5500 on ESP32?

This article presents an ESP32 + W5500 design aimed at MicroPython-based Ethernet access, with emphasis on board-level wiring,

COMPONENTS
PROJECT DESCRIPTION

How to Build a MicroPython Ethernet Firmware Flow with W5500 on ESP32?

Summary

This article presents an ESP32 + W5500 design aimed at MicroPython-based Ethernet access, with emphasis on board-level wiring, low-level SPI transaction control, and the firmware changes needed to make W5500 register access reliable under an interpreted runtime. In this architecture, the ESP32 runs the MicroPython environment and application logic, while the W5500 provides the wired Ethernet controller and hardware TCP/IP offload over SPI.

What the Project Does

The source is an education-oriented integration note for using W5500 with ESP32 under MicroPython. It covers three practical layers: the physical ESP32-to-W5500 wiring, the hardware constraints around power, crystal, and RJ45 magnetics, and a custom register-access path for MicroPython because the stock firmware does not natively include W5500 support. The article explicitly states that MicroPython official firmware does not support W5500 out of the box and frames the work as a bare-metal driver port built around the W5500 register map.

Architecturally, this is not a full high-level Ethernet library tutorial. It is closer to a firmware-porting guide: wire the chip correctly, stabilize the PHY and SPI path, then implement a register access layer that MicroPython can call without breaking W5500’s transaction rules. That makes it useful for education because it shows where Python-level convenience ends and hardware-specific transport control begins.

One important limitation: the article content appears to become mixed with unrelated material later in the page, so only the visible W5500/ESP32/MicroPython sections are safe to rely on. I am not treating the entire page as a coherent single project beyond those verified sections.

Where WIZnet Fits

The exact WIZnet product here is the W5500. In this project, it is the external Ethernet controller attached to ESP32 over SPI. WIZnet documents describe the W5500 as a hardwired TCP/IP Ethernet controller with integrated MAC and PHY, support for multiple hardware sockets, and SPI as the host interface. That matches the article’s design focus on using ESP32 as the host processor while offloading Ethernet protocol handling to the W5500.

For educational use, this is a strong example of hardware/software partitioning. The ESP32 is responsible for MicroPython runtime behavior, pin control, interrupt configuration, and custom transaction code, while the W5500 is responsible for Ethernet link handling and socket-capable network transport. That split matters because interpreted environments are convenient for application development, but they still need deterministic low-level access when talking to SPI Ethernet hardware.

On performance, the article’s argument is mostly architectural rather than benchmark-driven. It emphasizes deterministic wired behavior, lower EMI sensitivity than Wi-Fi, and the need for precise SPI timing under MicroPython. It does not provide rigorous measured throughput or latency tables, so the safe conclusion is that the design can be more predictable than Wi-Fi for embedded education and maker work, but actual performance will still depend on SPI implementation quality and firmware integration.

Implementation Notes

This project does use WIZnet products, and the article includes visible code snippets, but it does not provide a public repository with file paths or line-addressable source files. I therefore cannot verify a repository-backed codebase. The implementation details below are limited to what is directly visible in the article.

The first verified part is the hardware mapping between ESP32 and W5500. The article recommends SCLK on GPIO18, MOSI on GPIO23, MISO on GPIO19, SS on GPIO5, INT on GPIO4, and RST on GPIO16. It also states that INT should be configured as a falling-edge external interrupt and that RST must be held low for at least 2 microseconds after power-up before being released. Why this matters: the firmware flow begins with stable electrical ownership of clock, data, interrupt, and reset. Without that, no Python-side driver design will be reliable.

The second verified part is the register-layer definition shown inline:

MR = const(0x0000)
GAR = const(0x0001)
SUBR = const(0x0005)
SHAR = const(0x0009)
SIPR = const(0x000F)
IR = const(0x0015)
IMR = const(0x0016)

Why it matters: this is the start of a real W5500 driver abstraction, not a generic networking sketch. It shows that the MicroPython port is being built around direct register addressing, which is consistent with W5500’s host-access model.

The third verified part is the article’s central firmware claim: MicroPython’s machine.SPI.write_readinto() may not preserve the contiguous multi-byte transaction behavior required by W5500, so the author proposes bypassing the higher-level API and directly invoking lower-level SPI handling through from esp import spi_transaction. The visible snippet begins:

from esp import spi_transaction
def w5500_write(addr, data):
cmd = bytearray([0x00, (addr >> 8) & 0xFF, addr & 0xFF])

Why it matters: this is the real firmware-flow lesson in the article. The challenge is not just “use SPI.” It is that an interpreted API may break transaction continuity in ways that matter to W5500 register and data access. So the project’s programming value lies in pushing the critical path down below the usual MicroPython abstraction.

Practical Tips / Pitfalls

Keep INT on a dedicated GPIO and use falling-edge interrupt mode, because the article treats it as a real event path for data-ready and connection-state changes.

Do not assume standard MicroPython SPI helpers are sufficient for W5500 burst-style access. The article explicitly warns about transaction fragmentation in write_readinto().

Treat the power design seriously. The article recommends separating digital and analog supply treatment and adding local decoupling around W5500 and its crystal path.

Keep the 25 MHz crystal network and PHY-side routing tight. The article calls out crystal tolerance, load capacitors, and differential routing constraints around the Ethernet side.

Start with register reads and writes before attempting full socket behavior under MicroPython. The visible implementation is clearly built from the register layer upward.

Be cautious with performance claims in interpreted firmware. The article argues for timing precision, but it does not publish controlled benchmarks for the MicroPython path.

FAQ

Why use the W5500 in a MicroPython ESP32 project?
Because it gives ESP32 a wired Ethernet path with hardware TCP/IP offload, which reduces the amount of full network-stack work the host must do directly. In educational projects, that lets students focus on register access, SPI control, and socket-oriented integration rather than building Ethernet support from scratch.

How does it connect to the platform?
The article recommends SPI wiring between ESP32 and W5500 with GPIO18/23/19 for clock and data, GPIO5 for chip select, GPIO4 for interrupt, and GPIO16 for reset, plus external RJ45 magnetics and a 25 MHz crystal network on the W5500 side.

What role does W5500 play in this specific project?
It is the Ethernet transport device under a custom MicroPython-accessible driver layer. The ESP32 runs the scripting environment and low-level transaction hooks, while the W5500 provides wired network connectivity and the register model the driver talks to.

Can beginners follow this project?
Yes, but it is better suited to learners who already know basic ESP32 pin mapping, SPI, and MicroPython module usage. The educational value is high, but this is still a driver-porting exercise rather than a plug-and-play scripting example.

How does this compare with Wi-Fi on ESP32?
The article positions wired Ethernet as less sensitive to EMI and more deterministic in latency than Wi-Fi in industrial or interference-heavy environments. That is a reasonable architecture-level comparison, though the article does not provide side-by-side measured benchmarks.

Source

Original article: CSDN post, “ESP32+W5500以太网硬件设计与MicroPython驱动实现,” published February 25, 2026. The page states CC 4.0 BY-SA. Because the later part of the page appears to include unrelated content, only the clearly visible ESP32 + W5500 + MicroPython sections were used here. Product facts were checked against WIZnet’s official W5500 documentation, and MicroPython platform status was checked against the official MicroPython site.

Tags

W5500, WIZnet, ESP32, MicroPython, SPI, Embedded Ethernet, Firmware Porting, Register Access, Education, Wired Networking, Hardware TCP/IP, Ethernet Controller

ESP32에서 W5500으로 MicroPython 이더넷 펌웨어 흐름을 어떻게 구축할 수 있을까?

Summary

이 글은 MicroPython 기반 이더넷 접근을 목표로 한 ESP32 + W5500 설계를 설명하며, 보드 수준 배선, 저수준 SPI 트랜잭션 제어, 그리고 인터프리터 런타임 환경에서 W5500 레지스터 접근을 안정적으로 만들기 위한 펌웨어 변경에 초점을 맞춘다. 이 구조에서 ESP32는 MicroPython 실행 환경과 애플리케이션 로직을 담당하고, W5500은 SPI를 통해 연결되는 유선 이더넷 컨트롤러이자 하드웨어 TCP/IP 오프로딩 엔진 역할을 맡는다.

What the Project Does

이 소스는 ESP32에서 MicroPython과 함께 W5500을 사용하는 방법을 설명하는 교육용 통합 노트다. 내용은 크게 세 가지 실용 계층으로 나뉜다. 첫째, ESP32와 W5500 사이의 물리적 배선, 둘째, 전원, 크리스털, RJ45 마그네틱스와 같은 하드웨어 제약, 셋째, 기본 MicroPython 펌웨어가 W5500을 기본 지원하지 않기 때문에 필요한 사용자 정의 레지스터 접근 경로다. 글은 공식 MicroPython 펌웨어가 W5500을 바로 지원하지 않는다고 분명히 밝히며, W5500 레지스터 맵을 중심으로 한 드라이버 포팅 작업으로 이 문제를 접근한다.

아키텍처 관점에서 보면, 이것은 완성형 고수준 이더넷 라이브러리 튜토리얼이 아니다. 오히려 펌웨어 포팅 가이드에 가깝다. 먼저 칩을 올바르게 배선하고, PHY와 SPI 경로를 안정화한 뒤, MicroPython이 호출할 수 있는 레지스터 접근 계층을 구현해야 한다. 교육용으로 의미가 있는 이유는, Python 수준의 편의성과 하드웨어별 전송 제어가 실제로 어디에서 갈리는지를 보여주기 때문이다.

한 가지 중요한 제한도 있다. 페이지 후반부는 W5500과 직접 관련 없는 내용이 섞여 들어간 것으로 보이므로, 여기서는 ESP32 + W5500 + MicroPython과 명확히 연결되는 가시 구간만 신뢰 가능한 근거로 사용했다. 따라서 페이지 전체를 하나의 일관된 단일 프로젝트로 보지는 않았다.

Where WIZnet Fits

여기서 사용된 정확한 WIZnet 제품은 W5500이다. 이 프로젝트에서 W5500은 ESP32에 SPI로 연결되는 외부 이더넷 컨트롤러다. WIZnet 공식 문서에 따르면 W5500은 하드와이어드 TCP/IP 이더넷 컨트롤러이며, 통합 MAC/PHY, 여러 개의 하드웨어 소켓, SPI 호스트 인터페이스를 제공한다. 이는 글이 설명하는 구조와 정확히 맞아떨어진다. 즉, ESP32가 호스트 프로세서 역할을 맡고, W5500이 이더넷 프로토콜 처리를 오프로딩하는 형태다.

교육 관점에서 이 프로젝트는 하드웨어/소프트웨어 분리를 보여주는 좋은 예다. ESP32는 MicroPython 런타임, 핀 제어, 인터럽트 설정, 사용자 정의 SPI 트랜잭션 코드를 담당하고, W5500은 이더넷 링크 처리와 소켓 기반 네트워크 전송을 담당한다. 이런 분리가 중요한 이유는, 인터프리터 기반 환경이 애플리케이션 개발에는 편리하지만 SPI 이더넷 하드웨어와 통신할 때는 여전히 결정적인 저수준 접근이 필요하기 때문이다.

성능 측면에서 글의 주장은 주로 벤치마크가 아니라 아키텍처 수준에 머문다. 글은 Wi-Fi보다 더 예측 가능한 유선 동작, EMI에 대한 낮은 민감도, 그리고 MicroPython 환경에서 정확한 SPI 타이밍의 필요성을 강조한다. 하지만 처리량이나 지연 시간을 체계적으로 측정한 표는 제공하지 않는다. 따라서 방어 가능한 결론은 이 정도다. 이 설계는 메이커와 교육용 임베디드 환경에서 Wi-Fi보다 더 예측 가능한 동작을 제공할 수 있지만, 실제 성능은 SPI 구현 품질과 펌웨어 통합 수준에 따라 달라진다.

Implementation Notes

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

첫 번째로 확인되는 구현 요소는 ESP32와 W5500 사이의 하드웨어 매핑이다. 글은 SCLK를 GPIO18, MOSI를 GPIO23, MISO를 GPIO19, SS를 GPIO5, INT를 GPIO4, RST를 GPIO16으로 연결할 것을 권장한다. 또한 INT는 falling-edge 외부 인터럽트로 설정해야 하며, RST는 전원 인가 후 최소 2마이크로초 동안 Low를 유지한 뒤 해제해야 한다고 설명한다. 이것이 중요한 이유는 펌웨어 흐름의 출발점이 바로 안정적인 전기적 연결이기 때문이다. 클록, 데이터, 인터럽트, 리셋이 제대로 잡히지 않으면 Python 쪽 드라이버 설계가 아무리 좋아도 동작하지 않는다.

두 번째로 확인되는 구현 요소는 레지스터 계층 정의다.

MR = const(0x0000)
GAR = const(0x0001)
SUBR = const(0x0005)
SHAR = const(0x0009)
SIPR = const(0x000F)
IR = const(0x0015)
IMR = const(0x0016)

이 코드가 중요한 이유는 이것이 단순한 네트워킹 스케치가 아니라 실제 W5500 드라이버 추상화의 시작점이기 때문이다. 즉, MicroPython 포팅이 W5500의 호스트 접근 모델에 맞춰 직접 레지스터 주소를 다루는 방식으로 구성된다는 점을 보여준다.

세 번째로 확인되는 구현 요소는 글의 핵심 펌웨어 주장이다. MicroPython의 machine.SPI.write_readinto()가 W5500이 요구하는 연속적인 멀티바이트 트랜잭션 동작을 보장하지 못할 수 있으므로, 저자는 상위 API를 우회하고 from esp import spi_transaction 같은 더 저수준 SPI 처리 경로를 사용해야 한다고 설명한다. 보이는 코드는 다음처럼 시작된다.

from esp import spi_transaction
def w5500_write(addr, data):
cmd = bytearray([0x00, (addr >> 8) & 0xFF, addr & 0xFF])

이 코드가 중요한 이유는 이 글의 진짜 펌웨어 흐름 교훈이 여기에 있기 때문이다. 문제는 단순히 “SPI를 쓴다”가 아니다. 인터프리터 환경의 일반적인 API가 W5500의 레지스터 및 데이터 접근에서 중요한 트랜잭션 연속성을 깨뜨릴 수 있다는 점이다. 그래서 이 프로젝트의 프로그래밍 가치는, 핵심 경로를 일반적인 MicroPython 추상화 아래로 내려서 직접 제어해야 한다는 데 있다.

Practical Tips / Pitfalls

INT 핀은 전용 GPIO에 연결하고 falling-edge 인터럽트 모드로 설정하는 편이 좋다. 글은 이를 데이터 준비 상태나 연결 상태 변화를 처리하는 실제 이벤트 경로로 다룬다.

일반적인 MicroPython SPI 헬퍼가 W5500의 버스트 접근에 충분하다고 가정하면 안 된다. 글은 write_readinto()에서 트랜잭션 단절 문제가 생길 수 있다고 명시적으로 경고한다.

전원 설계를 가볍게 보면 안 된다. 글은 디지털 전원과 아날로그 전원 처리를 구분하고, W5500 및 크리스털 주변에 로컬 디커플링을 둘 것을 권장한다.

25 MHz 크리스털 네트워크와 PHY 쪽 배선은 최대한 짧고 안정적으로 유지해야 한다. 글은 크리스털 허용오차, 로드 커패시터, 이더넷 측 차동 배선 제약도 함께 언급한다.

MicroPython에서 곧바로 소켓 기능부터 구현하려 하기보다, 먼저 레지스터 읽기/쓰기부터 검증하는 편이 좋다. 글의 구현 흐름도 분명히 레지스터 계층부터 시작한다.

인터프리터 기반 펌웨어의 성능 주장은 조심해서 해석해야 한다. 글은 타이밍 정밀도의 중요성을 강조하지만, MicroPython 경로에 대한 통제된 벤치마크 수치는 제공하지 않는다.

FAQ

왜 MicroPython ESP32 프로젝트에서 W5500을 사용하는가?
ESP32에 유선 이더넷 경로와 하드웨어 TCP/IP 오프로딩을 제공하기 때문이다. 교육용 프로젝트에서는 전체 네트워크 스택을 처음부터 구현하는 대신, 레지스터 접근, SPI 제어, 소켓 중심 통합에 집중할 수 있다는 점이 장점이다.

플랫폼과는 어떻게 연결되는가?
글은 ESP32와 W5500 사이를 SPI로 연결할 것을 권장한다. 클록과 데이터에는 GPIO18, GPIO23, GPIO19를 사용하고, 칩 셀렉트는 GPIO5, 인터럽트는 GPIO4, 리셋은 GPIO16을 사용한다. 이와 함께 W5500 측에는 외부 RJ45 마그네틱스와 25 MHz 크리스털 회로도 필요하다.

이 프로젝트에서 W5500의 역할은 무엇인가?
사용자 정의 MicroPython 접근 계층 아래에 위치한 이더넷 전송 장치다. ESP32는 스크립트 환경과 저수준 SPI 훅을 제공하고, W5500은 유선 네트워크 연결과 드라이버가 접근하는 레지스터 모델을 제공한다.

초보자도 따라갈 수 있는가?
가능하다. 다만 ESP32 핀 매핑, SPI, MicroPython 모듈 사용법을 어느 정도 알고 있는 학습자에게 더 적합하다. 교육적 가치는 높지만, 이것은 플러그앤플레이 스크립팅 예제가 아니라 드라이버 포팅에 가까운 작업이다.

ESP32의 Wi-Fi와 비교하면 어떤 차이가 있는가?
글은 유선 이더넷이 Wi-Fi보다 EMI에 덜 민감하고, 산업 환경이나 간섭이 심한 환경에서 지연 특성이 더 예측 가능하다고 설명한다. 다만 이를 직접 비교한 정량적 벤치마크는 제공하지 않는다.

Source

원문 출처: CSDN 글 “ESP32+W5500以太网硬件设计与MicroPython驱动实现”, 2026년 2월 25일 게시.
페이지에는 CC 4.0 BY-SA가 표시되어 있다. 다만 후반부에는 관련 없는 내용이 섞여 있어, 여기서는 명확하게 확인 가능한 ESP32 + W5500 + MicroPython 구간만 근거로 사용했다.

Tags

W5500, WIZnet, ESP32, MicroPython, SPI, Embedded Ethernet, Firmware Porting, Register Access, Education, Wired Networking, Hardware TCP/IP, Ethernet Controller

 
 
Documents
Comments Write