How to Wire and Access Ethernet with WIZnet W5500 on MCU Platforms?
This education-focused project explains how WIZnet W5500 connects to an external MCU through hardware pins and SPI frames.
How to Wire and Access Ethernet with WIZnet W5500 on MCU Platforms?
Summary
This education-focused project explains how WIZnet W5500 connects to an external MCU through hardware pins and SPI frames. The article covers W5500 Ethernet differential pins, SPI signals, reset, interrupt, PHY mode pins, LED pins, register blocks, socket buffers, and SPI frame format. W5500’s role is to provide the Ethernet MAC/PHY, hardwired TCP/IP stack, sockets, and packet buffers while the MCU accesses registers and socket memory through SPI.
What the Project Does
The project is not an application demo such as HTTP, FTP, or MQTT. It is a low-level W5500 hardware and frame-format walkthrough. It explains how the W5500 is physically connected, how SPI access is structured, and how the chip’s internal register and memory areas are selected.
The hardware side covers TXP/TXN and RXP/RXN Ethernet differential pairs, external reference components, crystal pins, LED output pins, SPI pins, interrupt output, reset input, PHY mode selection pins, analog ground, digital ground, analog 3.3 V, and digital 3.3 V. The SPI side explains that W5500 frames contain a 16-bit address field, an 8-bit control field, and a data field. The control byte selects the common register block, socket register block, socket TX buffer, or socket RX buffer, and also selects read/write and VDM/FDM transfer mode.
For education, the value is that students can connect hardware wiring to the register model. The article shows that the W5500 exposes 25 logical areas: one common register block, eight socket register blocks, eight socket transmit-buffer blocks, and eight socket receive-buffer blocks. This gives a direct path from schematic-level wiring to firmware-level SPI transactions.
Where WIZnet Fits
The exact WIZnet product is W5500. W5500 is the Ethernet controller between the MCU and the wired network. It integrates a 10/100 Ethernet MAC and PHY, supports hardwired TCP/IP protocols such as TCP, UDP, ICMP, IPv4, ARP, IGMP, and PPPoE, and provides 8 independent sockets plus 32 KB of internal Tx/Rx buffer memory. WIZnet’s documentation also states that W5500 connects to an external MCU over SPI up to 80 MHz.
In this architecture, the MCU is responsible for board initialization, SPI transfers, reset control, interrupt handling, network configuration, and application logic. W5500 is responsible for the Ethernet physical link, MAC/PHY behavior, hardware socket state, protocol offload, and packet buffering.
This division is useful in an educational lab because the network stack is visible at several layers. Students can observe the PHY link through LED pins and PHY configuration registers, verify SPI framing with address/control/data bytes, read the VERSIONR chip-version register at offset 0x0039, and then move into socket registers such as Sn_MR, Sn_CR, Sn_SR, Sn_TX_FSR, and Sn_RX_RSR.
Implementation Notes
File: w5500.c
What it configures: SPI control-byte read/write direction.
Why it matters: Every W5500 SPI transaction uses the third byte as the control field. Bit 2 selects read or write access, so these macros encode the direction used by register and buffer access.
#define _W5500_SPI_READ_ (0x00 << 2)
#define _W5500_SPI_WRITE_ (0x01 << 2)The article explains that RWB=0 means read access and RWB=1 means write access. Since RWB is bit 2 of the control byte, the firmware shifts the value left by 2.
File: w5500.c
What it configures: W5500 block selection for common registers, socket registers, socket TX buffers, and socket RX buffers.
Why it matters: The same 16-bit offset can point to different internal areas depending on the BSB field in the control byte. These macros help firmware select the correct W5500 region before reading or writing data.
#define WIZCHIP_CREG_BLOCK 0x00
#define WIZCHIP_SREG_BLOCK(N) (1 + 4 * N)
#define WIZCHIP_TXBUF_BLOCK(N) (2 + 4 * N)
#define WIZCHIP_RXBUF_BLOCK(N) (3 + 4 * N)The article maps BSB values so socket 0 register, TX buffer, and RX buffer blocks are selected by 0x01, 0x02, and 0x03, while socket 1 uses 0x05, 0x06, and 0x07, and the pattern continues through socket 7.
Practical Tips / Pitfalls
- Keep
DNCpins unconnected. The article explicitly identifies DNC as “Do Not Connect.” - Place the TOCAP capacitor close to the pin. The article states that TOCAP should use a 4.7 µF capacitor to analog ground and should be routed as short as possible.
- Use a 25 MHz crystal path correctly.
XI/CLKINis the external 25 MHz crystal input, andXOis the crystal output; if an active oscillator is used,XOshould be left floating. - Do not ignore reset timing.
RSTnmust be held low for at least 500 µs to trigger a W5500 hardware reset. - Prefer VDM for normal firmware access. The article notes that FDM requires
SCSnto stay low and prevents sharing the SPI bus with other devices, while VDM lets the MCU control frame start and stop with chip select. - Allocate socket buffers deliberately. W5500 transmit memory and receive memory are each 16 KB across 8 sockets; valid per-socket sizes include 1 KB, 2 KB, 4 KB, 8 KB, and 16 KB.
FAQ
Q: Why use WIZnet W5500 for an MCU Ethernet hardware lesson?
A: W5500 exposes both hardware wiring and network-stack concepts clearly. Students can study Ethernet differential pairs, SPI framing, PHY link indication, register addressing, socket blocks, and buffer memory while still using a chip that includes a hardwired TCP/IP stack and 8 sockets.
Q: How does W5500 connect to an MCU platform?
A: The MCU connects to W5500 through SPI signals SCSn, SCLK, MISO, and MOSI. A practical design should also route RSTn for hardware reset and INTn for interrupt output. On the Ethernet side, W5500 uses TXP/TXN and RXP/RXN differential pairs through the Ethernet front-end.
Q: What role does W5500 play in this project?
A: W5500 is the hardware Ethernet and socket engine being studied. The article focuses on how the MCU reaches W5500’s common registers, socket registers, transmit buffers, and receive buffers using SPI frames made of address, control, and data fields.
Q: Can beginners follow this education project?
A: Yes, but it is best for learners who already understand basic SPI, digital I/O, 3.3 V hardware design, and IPv4 concepts. The topic is lower-level than a socket demo because it explains the W5500 pinout, SPI control byte, block selection, and register map before application protocols are introduced.
Q: How does this compare with an LwIP-based Ethernet lesson?
A: With W5500, students learn a hardware-socket model where the Ethernet MAC/PHY, TCP/IP engine, socket buffers, and socket states are inside the controller. With LwIP, students usually study a software TCP/IP stack running on the MCU, including network-interface drivers, packet buffers, timers, and protocol memory management. W5500 is therefore better for showing hardware offload and SPI register access, while LwIP is better for studying software stack internals.
Source
Original article: CSDN, “W5500的引脚和W5500帧,” first published on 2025-08-05 and marked as CC 4.0 BY-SA.
WIZnet product reference: W5500 documentation.
Tags
#W5500 #WIZnet #Ethernet #SPI #HardwareWiring #MCU #Education #TCPIP #Socket #RegisterMap #VDM #PHY #NetworkStack
MCU 플랫폼에서 WIZnet W5500으로 이더넷을 배선하고 접근하는 방법은?
요약
이 교육용 프로젝트는 WIZnet W5500이 외부 MCU와 하드웨어 핀 및 SPI 프레임을 통해 어떻게 연결되는지 설명합니다. 원문은 W5500의 이더넷 차동 신호 핀, SPI 신호, reset, interrupt, PHY mode 핀, LED 핀, register block, socket buffer, SPI frame format을 다룹니다. W5500은 Ethernet MAC/PHY, 하드웨어 TCP/IP 스택, socket, packet buffer를 제공하고, MCU는 SPI를 통해 register와 socket memory에 접근합니다.
프로젝트가 하는 일
이 프로젝트는 HTTP, FTP, MQTT 같은 애플리케이션 데모가 아닙니다. W5500의 하드웨어 연결과 SPI frame format을 낮은 계층에서 설명하는 자료입니다. W5500을 물리적으로 어떻게 연결하는지, SPI 접근 구조가 어떻게 구성되는지, 칩 내부 register와 memory 영역을 어떻게 선택하는지를 설명합니다.
하드웨어 측면에서는 TXP/TXN 및 RXP/RXN 이더넷 차동 pair, 외부 기준 부품, crystal pin, LED output pin, SPI pin, interrupt output, reset input, PHY mode selection pin, analog ground, digital ground, analog 3.3 V, digital 3.3 V를 다룹니다. SPI 측면에서는 W5500 frame이 16-bit address field, 8-bit control field, data field로 구성된다고 설명합니다. control byte는 common register block, socket register block, socket TX buffer, socket RX buffer 중 어느 영역에 접근할지 선택하고, read/write 및 VDM/FDM transfer mode도 선택합니다.
교육 관점에서 중요한 점은 학생들이 하드웨어 배선과 register model을 연결해서 이해할 수 있다는 것입니다. 원문은 W5500이 하나의 common register block, 8개의 socket register block, 8개의 socket transmit-buffer block, 8개의 socket receive-buffer block, 총 25개의 논리 영역을 제공한다고 설명합니다. 이 구조는 schematic 수준의 배선에서 firmware 수준의 SPI transaction까지 이어지는 직접적인 학습 경로를 제공합니다.
WIZnet이 들어가는 위치
이 프로젝트에서 사용되는 WIZnet 제품은 W5500입니다. W5500은 MCU와 유선 네트워크 사이에 위치하는 이더넷 컨트롤러입니다. W5500은 10/100 Ethernet MAC 및 PHY를 통합하고, TCP, UDP, ICMP, IPv4, ARP, IGMP, PPPoE 같은 하드웨어 TCP/IP 프로토콜을 지원하며, 8개 독립 socket과 32 KB 내부 Tx/Rx buffer memory를 제공합니다. WIZnet 문서 기준으로 W5500은 외부 MCU와 최대 80 MHz SPI로 연결됩니다.
이 구조에서 MCU는 board initialization, SPI transfer, reset control, interrupt handling, network configuration, application logic을 담당합니다. W5500은 Ethernet physical link, MAC/PHY 동작, hardware socket state, protocol offload, packet buffering을 담당합니다.
교육 실습에서는 이런 분업이 유용합니다. 학생들은 PHY link를 LED pin과 PHY configuration register를 통해 관찰하고, address/control/data byte로 구성된 SPI framing을 검증할 수 있습니다. 또한 offset 0x0039의 VERSIONR chip-version register를 읽은 뒤, Sn_MR, Sn_CR, Sn_SR, Sn_TX_FSR, Sn_RX_RSR 같은 socket register로 확장해 학습할 수 있습니다.
구현 참고 사항
파일: w5500.c
설정 내용: SPI control byte의 read/write 방향
중요한 이유: 모든 W5500 SPI transaction은 세 번째 byte를 control field로 사용합니다. bit 2는 read 또는 write 접근을 선택하므로, 아래 macro는 register 및 buffer access에 사용되는 방향 값을 정의합니다.
#define _W5500_SPI_READ_ (0x00 << 2)
#define _W5500_SPI_WRITE_ (0x01 << 2)원문은 RWB=0이 read access, RWB=1이 write access라고 설명합니다. RWB는 control byte의 bit 2이므로 firmware에서는 값을 왼쪽으로 2 bit shift합니다.
파일: w5500.c
설정 내용: common register, socket register, socket TX buffer, socket RX buffer를 위한 W5500 block selection
중요한 이유: 같은 16-bit offset이라도 control byte의 BSB field 값에 따라 서로 다른 내부 영역을 가리킬 수 있습니다. 아래 macro는 firmware가 데이터를 읽거나 쓰기 전에 올바른 W5500 영역을 선택하도록 돕습니다.
#define WIZCHIP_CREG_BLOCK 0x00
#define WIZCHIP_SREG_BLOCK(N) (1 + 4 * N)
#define WIZCHIP_TXBUF_BLOCK(N) (2 + 4 * N)
#define WIZCHIP_RXBUF_BLOCK(N) (3 + 4 * N)원문은 BSB 값을 기준으로 socket 0의 register, TX buffer, RX buffer block이 각각 0x01, 0x02, 0x03으로 선택된다고 설명합니다. socket 1은 0x05, 0x06, 0x07을 사용하며, 이 패턴이 socket 7까지 이어집니다.
실무 팁 / 주의점
DNCpin은 연결하지 않아야 합니다. 원문은 DNC를 “Do Not Connect”로 명확히 설명합니다.- TOCAP capacitor는 해당 pin에 가깝게 배치해야 합니다. 원문은 TOCAP에 4.7 µF capacitor를 analog ground로 연결하고, 가능한 짧게 routing해야 한다고 설명합니다.
- 25 MHz crystal 경로를 정확히 구성해야 합니다.
XI/CLKIN은 외부 25 MHz crystal input이고,XO는 crystal output입니다. active oscillator를 사용할 경우XO는 floating 상태로 둡니다. - reset timing을 무시하면 안 됩니다.
RSTn은 W5500 hardware reset을 발생시키기 위해 최소 500 µs 이상 low 상태를 유지해야 합니다. - 일반 firmware 접근에는 VDM을 우선 사용하는 것이 좋습니다. 원문은 FDM에서
SCSn을 low로 유지해야 하므로 SPI bus를 다른 장치와 공유하기 어렵고, VDM은 chip select로 frame의 시작과 끝을 제어할 수 있다고 설명합니다. - socket buffer는 의도적으로 할당해야 합니다. W5500의 transmit memory와 receive memory는 각각 16 KB이고, 8개 socket에 분배됩니다. socket별 유효 크기는 1 KB, 2 KB, 4 KB, 8 KB, 16 KB입니다.
FAQ
Q: MCU 이더넷 하드웨어 수업에서 왜 WIZnet W5500을 사용하나요?
A: W5500은 하드웨어 배선과 네트워크 스택 개념을 동시에 명확하게 보여줍니다. 학생들은 Ethernet differential pair, SPI framing, PHY link indication, register addressing, socket block, buffer memory를 학습하면서도 하드웨어 TCP/IP 스택과 8개 socket을 포함한 실제 이더넷 컨트롤러를 사용할 수 있습니다.
Q: W5500은 MCU 플랫폼에 어떻게 연결하나요?
A: MCU는 SCSn, SCLK, MISO, MOSI SPI 신호로 W5500에 연결합니다. 실제 설계에서는 hardware reset을 위한 RSTn과 interrupt output을 위한 INTn도 MCU에 연결하는 것이 좋습니다. 이더넷 쪽에서는 W5500의 TXP/TXN 및 RXP/RXN 차동 pair가 Ethernet front-end로 연결됩니다.
Q: 이 프로젝트에서 W5500은 어떤 역할을 하나요?
A: W5500은 학습 대상이 되는 하드웨어 이더넷 및 socket engine입니다. 원문은 MCU가 address, control, data field로 구성된 SPI frame을 사용해 W5500의 common register, socket register, transmit buffer, receive buffer에 접근하는 방식을 설명합니다.
Q: 초보자도 이 교육용 프로젝트를 따라갈 수 있나요?
A: 가능합니다. 다만 기본 SPI, digital I/O, 3.3 V hardware design, IPv4 개념을 이미 알고 있는 학습자에게 더 적합합니다. 이 주제는 socket demo보다 낮은 계층을 다루며, 애플리케이션 프로토콜로 넘어가기 전에 W5500 pinout, SPI control byte, block selection, register map을 설명합니다.
Q: 이 방식은 LwIP 기반 이더넷 수업과 어떻게 다른가요?
A: W5500을 사용하면 Ethernet MAC/PHY, TCP/IP engine, socket buffer, socket state가 controller 내부에 있는 hardware-socket model을 학습합니다. LwIP를 사용하면 MCU에서 실행되는 software TCP/IP stack을 학습하며, network-interface driver, packet buffer, timer, protocol memory management를 더 많이 다룹니다. 따라서 W5500은 hardware offload와 SPI register access를 보여주기에 적합하고, LwIP는 software stack 내부 구조를 공부하는 데 적합합니다.
출처
Original article: CSDN, “W5500的引脚和W5500帧,” 2025-08-05 게시, CC 4.0 BY-SA로 표시됨.
https://blog.csdn.net/weixin_42550185/article/details/149936813?spm=1001.2014.3001.5502
WIZnet product reference: W5500 documentation.
https://docs.wiznet.io/Product/Chip/Ethernet/W5500
태그
#W5500 #WIZnet #Ethernet #SPI #HardwareWiring #MCU #Education #TCPIP #Socket #RegisterMap #VDM #PHY #NetworkStack
