Wiznet makers

mark

Published May 23, 2026 ©

108 UCC

8 WCC

42 VAR

0 Contests

0 Followers

0 Following

Original Link

How to Configure Common Registers with WIZnet W5500 on MCU Platforms?

This maker-focused W5500 register article explains how an MCU configures the WIZnet W5500 through its common register block

COMPONENTS
PROJECT DESCRIPTION

How to Configure Common Registers with WIZnet W5500 on MCU Platforms?

Summary

This maker-focused W5500 register article explains how an MCU configures the WIZnet W5500 through its common register block. It covers mode control, gateway, subnet, MAC address, local IP, interrupt handling, retry timing, unreachable-port diagnostics, PHY link status, and chip-version checking. W5500’s role is to provide the Ethernet MAC/PHY, hardwired TCP/IP engine, socket system, and register-addressed network control while the MCU performs SPI register access and application logic.

What the Project Does

The source article is a register-level walkthrough, not a full application such as HTTP, FTP, or MQTT. It focuses on the W5500 common register block, where the MCU configures device-wide Ethernet behavior before using socket registers. The article starts with MR at offset 0x0000, then explains network identity registers such as GAR, SUBR, SHAR, and SIPR, followed by interrupt, retry, PPPoE, unreachable-address, PHY, and version registers.

The architecture is register-driven. The MCU sends W5500 SPI frames that select the common register block, provide a register offset, choose read or write access, and transfer data. For example, the gateway address is stored in GAR0GAR3, the subnet mask in SUBR0SUBR3, the MAC address in SHAR0SHAR5, and the local IPv4 address in SIPR0SIPR3.

For makers, this is the layer that explains why higher-level examples work. Before TCP, UDP, DNS, SNTP, FTP, or MQTT can run, W5500 must know its local MAC address, IP address, gateway, subnet mask, interrupt mask, retransmission behavior, and PHY link state. The article’s register map therefore acts as a bridge between board bring-up and socket programming.

Where WIZnet Fits

The exact WIZnet product is W5500. W5500 is the wired Ethernet controller between an external MCU and the LAN. It integrates a 10/100 Ethernet MAC and PHY, supports hardwired TCP/IP protocols including TCP, UDP, ICMP, IPv4, ARP, IGMP, and PPPoE, provides 8 independent sockets, and includes 32 KB internal Tx/Rx buffer memory. It connects to the MCU over SPI up to 80 MHz.

In this register-level architecture, the MCU does not own the full TCP/IP stack. Instead, it writes common registers for global network identity and behavior, then uses socket registers and buffers for communication. W5500 owns the hardware network engine, while the MCU owns SPI access, initialization order, retry policy, interrupt service flow, and application protocol logic.

The common register block is important because it controls system-wide behavior. MR can trigger software reset, Wake-on-LAN, ping block, PPPoE mode, and force-ARP behavior. IR, _IMR_, SIR, and SIMR define device and socket interrupt handling. _RTR_ and _RCR_ define retransmission timeout and retry count. UIPR and UPORTR record unreachable IP and port diagnostics. PHYCFGR reports and configures link, speed, duplex, and PHY mode.

Implementation Notes

File: Ethernet/W5500/w5500.h in WIZnet ioLibrary
What it configures: SPI access direction and W5500 memory block selection.
Why it matters: Every register access depends on the control byte. The MCU must distinguish read vs write and select the common register block, socket register block, TX buffer block, or RX buffer block before the address offset has meaning.

 
#define _W5500_SPI_READ_   (0x00 << 2)
#define _W5500_SPI_WRITE_  (0x01 << 2)

#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 CSDN article explains the same model: W5500 frame access uses the common register block selector for global registers, and the official ioLibrary defines the block macros used by W5500 register access code.

File: Ethernet/W5500/w5500.h in WIZnet ioLibrary
What it configures: common register addresses for local network setup, interrupts, retry behavior, diagnostics, PHY status, and chip identification.
Why it matters: These definitions are the base layer used before socket code. If GAR, SUBR, SHAR, or SIPR are wrong, higher-level TCP/UDP applications may fail even when SPI access appears normal.

 
#define MR       (_W5500_IO_BASE_ + (0x0000 << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define GAR      (_W5500_IO_BASE_ + (0x0001 << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define SUBR     (_W5500_IO_BASE_ + (0x0005 << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define SHAR     (_W5500_IO_BASE_ + (0x0009 << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define SIPR     (_W5500_IO_BASE_ + (0x000F << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define PHYCFGR  (_W5500_IO_BASE_ + (0x002E << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define VERSIONR (_W5500_IO_BASE_ + (0x0039 << 8) + (WIZCHIP_CREG_BLOCK << 3))
 

The official ioLibrary groups these as common registers for basic network configuration, interrupt control, retransmission, PPPoE, ICMP diagnostics, PHY configuration, and version checking. The source article walks through the same common-register purpose from a learning perspective.

Practical Tips / Pitfalls

  • Read VERSIONR early. The official ioLibrary notes that VERSIONR should indicate the W5500 version value, so it is a simple SPI and chip-select sanity check before debugging networking. 
  • Configure GAR, SUBR, SHAR, and SIPR before opening sockets. These registers define the gateway, subnet, MAC address, and local IP used by later TCP/UDP communication.
  • Treat IR and SIR differently. IR reports global conditions such as IP conflict and destination unreachable, while SIR summarizes which socket has an interrupt pending. 
  • Clear interrupt bits deliberately. The article explains that interrupt status remains asserted until the host clears the relevant register bits. 
  • Tune _RTR_ and _RCR_ for the application. The article gives the default-style example 0x07D0 = 2000, which equals 200 ms because the unit is 100 µs; retry count then affects when timeout interrupts appear. 
  • Use PHYCFGR during bring-up. Its link, speed, and duplex bits distinguish a firmware problem from a physical Ethernet problem. 

FAQ

Q: Why use WIZnet W5500 for a register-level maker project?
A: W5500 exposes a clear hardware-socket model. Makers can learn how gateway, subnet, MAC, IP, interrupt, retry, PHY, and version registers map directly to Ethernet behavior, while still using a controller that includes a hardwired TCP/IP stack, 8 sockets, and internal packet buffers.

Q: How does W5500 connect to the MCU platform?
A: W5500 connects through SPI. The MCU sends W5500 frames containing an address phase, control phase, and data phase; the control field selects the register or buffer block and the read/write direction. In a practical board, reset and interrupt pins should also be connected so firmware can recover the chip and handle events without constant polling.

Q: What role does W5500 play in this register article?
A: W5500 is the network engine being configured. The article focuses on its common register block: mode control, local network identity, interrupt status and masks, retry timing, unreachable-address reporting, PHY configuration, and chip-version confirmation.

Q: Can beginners follow this maker project?
A: Yes, if they already understand basic SPI, hexadecimal register offsets, IPv4 addressing, and MCU GPIO control. It is lower-level than an HTTP or TCP demo, but it is a good bridge from “the module works” to “I know which register controls the network behavior.”

Q: How does W5500 compare with an LwIP-based approach?
A: With W5500, the MCU talks to a hardware TCP/IP controller through registers, sockets, and internal buffers. With LwIP, the MCU runs a software TCP/IP stack; LwIP is a small independent TCP/IP implementation designed to reduce RAM usage while still providing a full-scale TCP stack for embedded systems. W5500 is better for learning hardware offload and SPI register control, while LwIP is better for studying software stack internals, packet buffers, timers, and network-interface integration.

Source

Original article: CSDN, “W5500通用寄存器介绍,” published on 2025-08-05 and marked as CC 4.0 BY-SA.

WIZnet product reference: W5500 documentation.

WIZnet driver reference: Wiznet/ioLibrary_Driver, MIT license.

LwIP reference: lwIP 2.1.0 overview.

Tags

#W5500 #WIZnet #Registers #CommonRegisters #SPI #MCU #Maker #Ethernet #TCPIP #PHYCFGR #ioLibrary #LwIP #NetworkStack

 

MCU 플랫폼에서 WIZnet W5500 공통 레지스터를 설정하는 방법은?

요약

이 W5500 레지스터 중심 메이커 자료는 MCU가 WIZnet W5500의 공통 레지스터 블록을 통해 칩을 설정하는 방법을 설명합니다. 원문은 mode control, gateway, subnet, MAC address, local IP, interrupt handling, retry timing, unreachable-port diagnostics, PHY link status, chip-version checking을 다룹니다. W5500은 Ethernet MAC/PHY, 하드웨어 TCP/IP 엔진, socket system, register 기반 네트워크 제어를 제공하고, MCU는 SPI register access와 application logic을 담당합니다.

프로젝트가 하는 일

이 자료는 HTTP, FTP, MQTT 같은 완성형 애플리케이션 예제가 아니라 W5500 공통 레지스터 블록을 설명하는 레지스터 수준의 walkthrough입니다. MCU가 socket register를 사용하기 전에 device-wide Ethernet behavior를 설정하는 영역을 다룹니다. 원문은 offset 0x0000MR에서 시작해 GAR, SUBR, SHAR, SIPR 같은 네트워크 식별 레지스터를 설명하고, interrupt, retry, PPPoE, unreachable-address, PHY, version register까지 이어집니다.

아키텍처는 register-driven 구조입니다. MCU는 W5500 SPI frame을 전송해 common register block을 선택하고, register offset을 지정하며, read 또는 write access를 선택한 뒤 데이터를 전송합니다. 예를 들어 gateway address는 GAR0GAR3, subnet mask는 SUBR0SUBR3, MAC address는 SHAR0SHAR5, local IPv4 address는 SIPR0SIPR3에 저장됩니다.

메이커 관점에서 이 계층은 상위 예제가 왜 동작하는지 이해하게 해줍니다. TCP, UDP, DNS, SNTP, FTP, MQTT를 실행하기 전에 W5500은 local MAC address, IP address, gateway, subnet mask, interrupt mask, retransmission behavior, PHY link state를 알아야 합니다. 따라서 이 레지스터 맵은 board bring-up과 socket programming 사이를 연결하는 기초 계층입니다.

WIZnet이 들어가는 위치

이 프로젝트에서 사용되는 WIZnet 제품은 W5500입니다. W5500은 외부 MCU와 LAN 사이에 위치하는 유선 Ethernet controller입니다. 10/100 Ethernet MAC 및 PHY를 통합하고, TCP, UDP, ICMP, IPv4, ARP, IGMP, PPPoE 같은 하드웨어 TCP/IP 프로토콜을 지원합니다. 또한 8개 독립 socket과 32 KB 내부 Tx/Rx buffer memory를 제공하며, MCU와는 최대 80 MHz SPI로 연결됩니다.

이 레지스터 수준 아키텍처에서 MCU는 전체 TCP/IP stack을 직접 소유하지 않습니다. 대신 global network identity와 behavior를 설정하기 위해 common register를 쓰고, 이후 socket register와 buffer를 사용해 통신합니다. W5500은 hardware network engine을 담당하고, MCU는 SPI access, initialization order, retry policy, interrupt service flow, application protocol logic을 담당합니다.

공통 레지스터 블록은 시스템 전체 동작을 제어하기 때문에 중요합니다. MR은 software reset, Wake-on-LAN, ping block, PPPoE mode, force-ARP behavior를 제어할 수 있습니다. IR, _IMR_, SIR, SIMR은 device 및 socket interrupt 처리를 정의합니다. _RTR__RCR_은 retransmission timeout과 retry count를 정의합니다. UIPRUPORTR는 unreachable IP 및 port 진단 정보를 기록합니다. PHYCFGR는 link, speed, duplex, PHY mode를 보고하고 설정합니다.

구현 참고 사항

파일: Ethernet/W5500/w5500.h in WIZnet ioLibrary
설정 내용: SPI access direction과 W5500 memory block selection
중요한 이유: 모든 register access는 control byte에 의존합니다. MCU는 address offset이 의미를 갖기 전에 read/write 방향과 common register block, socket register block, TX buffer block, RX buffer block 중 어느 영역에 접근할지 선택해야 합니다.

 
#define _W5500_SPI_READ_   (0x00 << 2)
#define _W5500_SPI_WRITE_  (0x01 << 2)

#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)
 

CSDN 원문은 동일한 모델을 설명합니다. W5500 frame access는 global register 접근을 위해 common register block selector를 사용하고, 공식 ioLibrary는 W5500 register access code에서 사용하는 block macro를 정의합니다.

파일: Ethernet/W5500/w5500.h in WIZnet ioLibrary
설정 내용: local network setup, interrupt, retry behavior, diagnostics, PHY status, chip identification을 위한 common register address
중요한 이유: 이 정의들은 socket code 이전에 사용하는 기본 계층입니다. GAR, SUBR, SHAR, SIPR이 잘못 설정되면 SPI 접근이 정상처럼 보여도 상위 TCP/UDP 애플리케이션이 실패할 수 있습니다.

 
#define MR       (_W5500_IO_BASE_ + (0x0000 << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define GAR      (_W5500_IO_BASE_ + (0x0001 << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define SUBR     (_W5500_IO_BASE_ + (0x0005 << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define SHAR     (_W5500_IO_BASE_ + (0x0009 << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define SIPR     (_W5500_IO_BASE_ + (0x000F << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define PHYCFGR  (_W5500_IO_BASE_ + (0x002E << 8) + (WIZCHIP_CREG_BLOCK << 3))
#define VERSIONR (_W5500_IO_BASE_ + (0x0039 << 8) + (WIZCHIP_CREG_BLOCK << 3))
 

공식 ioLibrary는 이 레지스터들을 basic network configuration, interrupt control, retransmission, PPPoE, ICMP diagnostics, PHY configuration, version checking을 위한 common register로 묶습니다. 원문은 같은 common register의 역할을 학습 관점에서 설명합니다.

실무 팁 / 주의점

  • VERSIONR를 초기 단계에서 읽어야 합니다. W5500 version value를 확인할 수 있으므로, 네트워크 디버깅 전에 SPI와 chip-select가 정상인지 빠르게 검증할 수 있습니다.
  • Socket을 열기 전에 GAR, SUBR, SHAR, SIPR를 설정해야 합니다. 이 레지스터들은 이후 TCP/UDP 통신에서 사용하는 gateway, subnet, MAC address, local IP를 정의합니다.
  • IRSIR을 구분해서 다뤄야 합니다. IR은 IP conflict, destination unreachable 같은 global condition을 보고하고, SIR은 interrupt가 pending된 socket을 요약합니다.
  • Interrupt bit는 의도적으로 clear해야 합니다. 원문은 host가 관련 register bit를 clear하기 전까지 interrupt status가 유지된다고 설명합니다.
  • _RTR__RCR_은 애플리케이션에 맞게 조정해야 합니다. 원문은 0x07D0 = 2000 예를 들며, 단위가 100 µs이므로 200 ms에 해당한다고 설명합니다. Retry count는 timeout interrupt가 발생하는 시점에 영향을 줍니다.
  • Bring-up 단계에서는 PHYCFGR를 활용해야 합니다. Link, speed, duplex bit를 보면 firmware 문제와 물리적 Ethernet 문제를 구분할 수 있습니다.

FAQ

Q: Register-level maker project에서 왜 WIZnet W5500을 사용하나요?
A: W5500은 hardware-socket model을 명확하게 보여줍니다. 메이커는 gateway, subnet, MAC, IP, interrupt, retry, PHY, version register가 Ethernet 동작에 어떻게 직접 매핑되는지 학습할 수 있습니다. 동시에 W5500은 하드웨어 TCP/IP stack, 8개 socket, 내부 packet buffer를 포함한 실제 Ethernet controller입니다.

Q: W5500은 MCU 플랫폼에 어떻게 연결하나요?
A: W5500은 SPI로 연결됩니다. MCU는 address phase, control phase, data phase로 구성된 W5500 frame을 전송합니다. Control field는 register 또는 buffer block과 read/write 방향을 선택합니다. 실제 보드에서는 firmware가 칩을 복구하고 constant polling 없이 event를 처리할 수 있도록 reset pin과 interrupt pin도 연결하는 것이 좋습니다.

Q: 이 register article에서 W5500은 어떤 역할을 하나요?
A: W5500은 설정 대상인 network engine입니다. 원문은 W5500의 common register block에 집중하며, mode control, local network identity, interrupt status and masks, retry timing, unreachable-address reporting, PHY configuration, chip-version confirmation을 설명합니다.

Q: 초보자도 이 maker project를 따라갈 수 있나요?
A: 가능합니다. 다만 basic SPI, hexadecimal register offset, IPv4 addressing, MCU GPIO control을 이미 이해하고 있는 학습자에게 더 적합합니다. HTTP나 TCP demo보다 낮은 계층이지만, “module이 동작한다”에서 “어떤 register가 네트워크 동작을 제어하는지 안다”로 넘어가는 좋은 중간 단계입니다.

Q: W5500 방식은 LwIP 기반 접근과 어떻게 다른가요?
A: W5500을 사용하면 MCU가 register, socket, internal buffer를 통해 hardware TCP/IP controller와 통신합니다. LwIP를 사용하면 MCU가 software TCP/IP stack을 직접 실행합니다. LwIP는 임베디드 시스템에서 RAM 사용량을 줄이면서 full-scale TCP stack을 제공하도록 설계된 작은 독립 TCP/IP 구현입니다. W5500은 hardware offload와 SPI register control을 학습하는 데 적합하고, LwIP는 software stack internals, packet buffer, timer, network-interface integration을 공부하는 데 적합합니다.

출처

Original article: CSDN, “W5500通用寄存器介绍,” 2025-08-05 게시, CC 4.0 BY-SA로 표시됨.
https://blog.csdn.net/weixin_42550185/article/details/149936994?spm=1001.2014.3001.5502

WIZnet product reference: W5500 documentation.
https://docs.wiznet.io/Product/Chip/Ethernet/W5500

WIZnet driver reference: Wiznet/ioLibrary_Driver, MIT license.
https://github.com/Wiznet/ioLibrary_Driver

LwIP reference: lwIP 2.1.0 overview.
https://www.nongnu.org/lwip/2_1_x/index.html

태그

#W5500 #WIZnet #Registers #CommonRegisters #SPI #MCU #Maker #Ethernet #TCPIP #PHYCFGR #ioLibrary #LwIP #NetworkStack

 
 
Documents
Comments Write