WIZnet W5500 Getting Started: SPI Wiring & Socket Initialization
From the hardwired TCP/IP concept and SPI wiring to ioLibrary initialization and opening your first socket — a step-by-step guide to getting W5500 online with Arduino / STM32.
Published: 2025-01-15
Why hardwired TCP/IP?
The W5500 implements the entire TCP/IP stack inside the chip, so your MCU does not run a software stack or need an RTOS — saving a large amount of Flash/RAM and CPU cycles.
It embeds a 32KB TX/RX buffer, supports up to 8 independent sockets, and integrates the PHY, so the external circuit only needs an RJ45 with magnetics. That makes it ideal for resource-constrained MCUs and for industrial links that must stay up.
SPI wiring
The W5500 talks to the host MCU over SPI: connect the four basic signals SCSn (chip select), SCLK, MOSI, MISO, plus RSTn (reset) and an optional INTn (interrupt).
Three things to watch: the W5500 SPI supports Mode 0 and Mode 3; its I/O is 3.3V (a 5V MCU needs level shifting or tolerance confirmation); and the MCU and W5500 must share ground. While bringing it up, keep SCLK at 1–8 MHz for stability, then increase the speed later.
Initialize with ioLibrary
WIZnet provides the open-source ioLibrary driver. The flow is: register your SPI read/write-byte and chip-select callbacks, call wizchip_init() with the per-socket TX/RX buffer sizes (each total ≤ 16KB), then set MAC / IP / Gateway / Subnet with wizchip_setnetinfo().
After init, always check the PHY link status (link up) and read back the version register to confirm SPI communication works — that is the most common place to start debugging.
Open your first socket
For a TCP client: open a socket as Sn_MR_TCP with socket(), call connect() to the target IP and port, then use send() and recv() to move data, and close() when done. For a TCP server, use listen() to wait for connections instead.
Protocols like Modbus/TCP and MQTT are just packets over a TCP socket, so the W5500 only handles transport while the MCU handles the packet format — which makes porting very simple.
Products mentioned
W5500 Hardwired TCP/IP Ethernet Controller
W5500 is WIZnet's flagship Ethernet controller with a unique hardwired TCP/IP stack, enabling direct network connectivity without software TCP/IP implementation. Connects to the host MCU via SPI, features 32KB TX/RX buffer, supports up to 8 sockets — the most widely adopted Ethernet chip in the Arduino/Raspberry Pi ecosystem.
W5100S Hardwired TCP/IP Ethernet Controller (Multi-Interface)
W5100S is an enhanced version of W5100, supporting both SPI and parallel interfaces with 16KB TX/RX buffer and 4 sockets. Adds SOCKET-less commands, Wake on LAN (WOL), and PHY power-down mode compared to W5100 — ideal for embedded systems requiring a parallel bus interface.
Need these components or design help?
JLink Technology provides parts, datasheets, and engineering support.
Request a Quote