Wiznet makers

irina

Published May 07, 2026 ©

167 UCC

5 WCC

104 VAR

0 Contests

0 Followers

0 Following

Original Link

Custom W5500 SPI Ethernet Driver for ESP-IDF — Full esp_netif / LwIP Integration

Custom W5500 SPI Ethernet driver for ESP-IDF fully integrated with esp_eth, esp_netif, and LwIP. 2025. Low-level driver layer for production ESP32 Ethernet proj

COMPONENTS
PROJECT DESCRIPTION

Overview

This project provides a custom W5500 SPI Ethernet driver for ESP-IDF that is fully integrated with ESP32's native esp_eth, esp_netif, and LwIP networking stack. Written in Embedded C, it fills a gap in the ESP-IDF ecosystem: while the official ESP-IDF supports SPI Ethernet via esp_eth, the documentation and example code for W5500-specific driver customization is sparse. This driver provides a clean, production-ready implementation of the W5500 SPI interface at the esp_eth driver layer, enabling all LwIP-based protocols (TCP, UDP, MQTT, HTTP, etc.) to work transparently over W5500 Ethernet.

What This Project Does

  • Implements the W5500 SPI Ethernet driver at the esp_eth abstraction layer
  • Integrates with esp_netif for network interface management (IP assignment, DHCP client)
  • Connects to the LwIP TCP/IP stack — enabling all standard ESP-IDF network APIs over Ethernet
  • Handles W5500 SPI initialization, MAC/PHY configuration, interrupt handling, and frame TX/RX
  • 2025 implementation targeting ESP-IDF v5.x

Why a Custom Driver? The official ESP-IDF includes some W5500 support, but custom driver implementations are needed when:

  • Specific SPI pin configurations differ from the default
  • Fine-tuned interrupt vs. polling mode is required
  • Additional W5500 socket management features are needed
  • Integration with custom esp_netif network interfaces is required

Architecture

Application (TCP/UDP/MQTT/HTTP via LwIP APIs)
    ↓
LwIP TCP/IP Stack
    ↓
esp_netif (network interface abstraction)
    ↓
esp_eth (Ethernet driver framework)
    ↓
W5500 SPI Driver (this project)
    ↓
SPI bus → W5500 hardware

Hardware

  • MCU: ESP32 (ESP-IDF v5.x)
  • Ethernet: WIZnet W5500 (SPI)
  • Language: Embedded C
  • Framework: ESP-IDF (native, not Arduino)

How to Build

  1. Clone: git clone https://github.com/Teja-Tatimatla/esp32-w5500-driver
  2. Set up ESP-IDF v5.x environment: . $IDF_PATH/export.sh
  3. Configure SPI pins in menuconfig or sdkconfig
  4. Build: idf.py build
  5. Flash: idf.py -p /dev/ttyUSB0 flash monitor

FAQ

Q1. What is the difference between this and the Arduino ETH.h approach? Arduino ETH.h abstracts away all driver details. This project works at the ESP-IDF native layer — lower level, more control, and directly integrated with LwIP. This is the right choice for production firmware using ESP-IDF rather than Arduino.

Q2. Does this support DHCP? Yes. Integration with esp_netif means DHCP client is handled automatically by the LwIP stack, just as it would be for built-in Ethernet PHYs (LAN8720, IP101, etc.).

Q3. Can I use MQTT, HTTP, or WebSockets over this driver? Yes. Once the W5500 driver is registered with esp_netif and LwIP, all standard ESP-IDF network libraries (esp-mqtt, esp_http_client, esp_websocket_client) work transparently over Ethernet exactly as they would over WiFi.

Q4. What SPI speed is supported? W5500 supports SPI up to 80 MHz. ESP-IDF SPI master typically runs at 20–40 MHz for reliable operation with typical PCB traces. Configure via spi_device_interface_config_t.clock_speed_hz.

Key Takeaway

A production-quality ESP-IDF W5500 SPI Ethernet driver that integrates fully with esp_netif and LwIP. This is the foundation layer needed for any serious ESP32 + W5500 project using ESP-IDF — enabling all standard LwIP-based protocols (TCP, UDP, MQTT, HTTP, WebSocket) over wired Ethernet with a clean, maintainable driver architecture.

Source Code: https://github.com/Teja-Tatimatla/esp32-w5500-driver

Documents
Comments Write