---
title: "ESP32 + W5500 Ethernet Quick Start Guide"
url: "https://maker.wiznet.io/TheoIm/projects/esp32-w5500-ethernet-quick-start-guide/"
markdown_url: "https://maker.wiznet.io/TheoIm/projects/esp32-w5500-ethernet-quick-start-guide/md"
type: "UCC: User Created Content"
author: "Espressif Systems"
author_url: "https://github.com/espressif/esp-idf/tree/d930a386dae78cfab75f313af3df67921e748fc4/examples/ethernet"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Espressif Systems"
original_url: "https://github.com/espressif/esp-idf/tree/d930a386dae78cfab75f313af3df67921e748fc4/examples/ethernet"
published: "2025-05-14"
language: "en"
hardware: ["WIZnet W5500", "Espressif ESP32"]
likes: 0
views: 4332
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# ESP32 + W5500 Ethernet Quick Start Guide

> Step-by-step flow: Network Test → Speed Test → Time Sync

Original author: Espressif Systems (source: https://github.com/espressif/esp-idf/tree/d930a386dae78cfab75f313af3df67921e748fc4/examples/ethernet)

## Components

- **WIZnet W5500** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500))
- **Espressif ESP32** x 1 ([docs](https://www.espressif.com/en/products/socs/esp32))

WIZnet parts: W5500 ([Datasheet](https://docs.wiznet.io/Product/Chip/Ethernet/W5500/datasheet?utm_source=maker&utm_medium=project&utm_campaign=w5500), [product hub](https://maker.wiznet.io/products/w5500/))

## Article

Welcome, fellow makers.
You're about to unlock a rock-solid combo: **ESP32 + WIZnet W5500**, an Ethernet-capable setup that’s lightweight, deterministic, and ideal for industrial or DIY networked projects.

> This post is your armory — not just theory, but curated, field-tested **code insights** with all the “guns and swords” ready for action.

---

## 🔧 The Common Foundation: How ESP32 Talks to WIZnet W5500

All three examples below **share a core initialization sequence**.
Understand this flow, and you can build anything on top of it.

### ⚙️ Step 1 – SPI Ethernet Driver Init

```c
example_eth_init(&eth_handles, &eth_port_cnt);
```

Internally configures the SPI bus and W5500 driver

Returns `esp_eth_handle_t` for use throughout the stack

---

### 🌐 Step 2 – Attach to the TCP/IP Stack

```c
esp_netif_new(&cfg);
esp_eth_new_netif_glue(eth_handles[i]);
esp_netif_attach(...);
```

This “glue” attaches the Ethernet driver to the **esp-netif TCP/IP stack**

Essential for IP addressing, DHCP, DNS, and more

---

### 🚀 Step 3 – Start Ethernet

```c
esp_eth_start(eth_handles[i]);
```

Starts the driver state machine

At this point, DHCP or Static IP kicks in

You're now online

---

## ✨ Highlighted Use Cases: Three Scenarios, Three Purposes

---

### 1️⃣ **Basic DHCP + IP Logging (Minimal Setup)**

> Plug in and get online — verify that Ethernet is alive and working

#### 🔑 Key Code

```c
esp_event_handler_register(... eth_event_handler);
esp_event_handler_register(... got_ip_event_handler);
```

Registers handlers for `Link Up/Down` and `IP Assigned`

Optional: Multiple ports supported with `esp_netif_config` tweaks

#### 🎯 Purpose

Confirm W5500 is wired correctly

Get an IP via DHCP

Print your network status via logs

---

### 2️⃣ **Interactive Console + iperf Testing**

> Bring in the console, type commands, measure performance in real time

#### 🔑 Key Code

```c
esp_console_new_repl_uart(...);
app_register_iperf_commands();
esp_console_start_repl(repl);
```

Launches a **UART REPL console**

Lets you run commands like `iperf -u -s` and `ethernet info`

Great for network benchmarking

#### 🎯 Purpose

Real-world UDP/TCP speed test with iperf

CLI-style UX for debugging or dev boards

Scriptable interface for advanced users

---

### 3️⃣ **PTP (Precision Time Protocol) + Pulse Output**

> Use W5500 to generate nanosecond-accurate GPIO pulses — yes, really

#### 🔑 Key Code

```c
ptpd_start("ETH_0");
esp_eth_clock_register_target_cb(..., ts_callback);
gpio_set_level(...);
```

Starts PTPD (Precision Time Daemon)

Waits for clock sync

Then toggles a GPIO at precisely defined intervals (e.g. every X ns)

#### 🎯 Purpose

Industrial-grade timing sync

PTP master/slave logic handled internally

GPIO output in perfect sync with network time

---

## 🧭 Summary: Choose Your Weapon

| Scenario | Use When You Want To... |
| --- | --- |
| **① Basic** | Just get IP and check status |
| **② Console** | Benchmark speeds & test over UART |
| **③ PTP** | Generate precisely timed signals |

If you're building a system with **W5500 at the core**, this is your foundation.

> Whether you're writing a driver, building a logger, or syncing real-time events — you now have the full toolkit.

---

Source: https://maker.wiznet.io/TheoIm/projects/esp32-w5500-ethernet-quick-start-guide/
