---
title: "Why Does Ping Reach 34 ms via lwIP but Stay Under 1 ms on W6300 Hardware Sockets?"
url: "https://maker.wiznet.io/Grace_Koo/projects/why-does-ping-reach-34-ms-via-lwip-but-stay-under-1-ms-on-w6300-hardware-sockets/"
markdown_url: "https://maker.wiznet.io/Grace_Koo/projects/why-does-ping-reach-34-ms-via-lwip-but-stay-under-1-ms-on-w6300-hardware-sockets/md"
type: "UCC: User Created Content"
author: "ramtuc"
author_url: "https://github.com/ramtuc/wiznet-pico-basics"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "ramtuc"
original_url: "https://github.com/ramtuc/wiznet-pico-basics"
license: "MIT license (MIT)"
published: "2026-11-20"
language: "en"
tags: ["W55RP20", "W6300", "rp2350", "arduino-pico", "TOE"]
hardware: ["WIZnet W55RP20-EVB-Pico", "WIZnet W6300-EVB-Pico2"]
likes: 0
views: 3
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Why Does Ping Reach 34 ms via lwIP but Stay Under 1 ms on W6300 Hardware Sockets?

> Arduino sketches bring up W55RP20-EVB-Pico and W6300-EVB-Pico2 over MACRAW and lwIP; the author's tests compare polling-driven RTT with hardware sockets.

Original author: ramtuc (source: https://github.com/ramtuc/wiznet-pico-basics)

## Components

- **WIZnet W55RP20-EVB-Pico** x 1 ([docs](https://wiznet.io/products/powered-by-raspberry-pi/w55rp20-evb-pico))
- **WIZnet W6300-EVB-Pico2** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W6300/w6300-evb-pico2))

## Documents and links

- [Arduino sketches and PowerShell echo client](https://github.com/ramtuc/wiznet-pico-basics) (code)

## Article

> 📚 **Context**: [ramtuc/wiznet-pico-basics](https://github.com/ramtuc/wiznet-pico-basics) — first-step code for the W55RP20-EVB-Pico and the W6300-EVB-Pico2, written for two electwork.net articles: DHCP, ping and a TCP echo, plus IPv6 link-local on the W6300. Each board is brought up twice, once with Arduino sketches on arduino-pico 6.3.1 and once with WIZnet's official C examples, and ping and echo times are measured on both.

---

## 01 — Two boards, one first step

![W55RP20-EVB-Pico: the W55RP20 next to the RJ45 jack, BOOTSEL and RUN buttons by the USB-C connector. Photo: electwork.net, by the repository author](https://maker.wiznet.io/upload/ckeditor5/c5dcd155ae564c4d8ff7a5b753ea8322.jpg)

*W55RP20-EVB-Pico: the W55RP20 next to the RJ45 jack, BOOTSEL and RUN buttons by the USB-C connector. Photo: electwork.net, by the repository author*

| Item | W55RP20-EVB-Pico | W6300-EVB-Pico2 |
| --- | --- | --- |
| MCU | RP2040 inside the W55RP20 package | RP2350, separate chip |
| Ethernet | W5500 inside the W55RP20 package | W6300, separate chip |
| Link to the chip | SPI: CS 20, SCK 21, MISO 22, MOSI 23, INT 24, RST 25 | QSPI: INT 15, CS 16, SCLK 17, IO0–IO3 18–21, RST 22 |
| Bus clock in the C examples | 50 MHz PIO SPI, system clock 200 MHz | 37.5 MHz PIO QSPI in Quad mode, system clock 150 MHz |
| Free GPIO | GP0–15 and GP26–28, 19 pins | GP0–14 and GP26–28, 18 pins |
| IP handled by the chip | IPv4 | IPv4 and IPv6 |
| Socket buffers | 32 KB over 8 sockets | 64 KB over 8 sockets |

The repository holds the two Arduino sketches and a PowerShell client. Each sketch takes an address by DHCP, prints the MAC and IP, and echoes TCP port 5000; the W6300 sketch also lists its IPv6 addresses. The hardware-socket runs use WIZnet-PICO-C's `dhcp_dns` and `loopback` examples as shipped, with only the loopback's static IP changed to fit the LAN.

---

## 02 — Why both buses come from PIO

Neither board can use the RP2040 or RP2350 hardware SPI for its chip:

| Board | Why hardware SPI does not fit |
| --- | --- |
| W55RP20-EVB-Pico | GPIO20–23 reach only SPI0, which expects MISO on 20 and SCK on 22; the package wires SCK to 21 and MISO to 22 |
| W6300-EVB-Pico2 | The RP2350 QSPI block (QMI) drives only the dedicated flash pins, which carry the 2 MB flash; the PL022 SPI blocks have one data line each; even Single mode does not match SPI0's pin map on GPIO15–22 |

So a PIO state machine generates the bus. In WIZnet-PICO-C, `wizchip_qspi_pio.pio` holds Single, Dual and Quad programs that differ in one line, `out pins, 1`, `2` or `4`.

---

## 03 — Same board, two network paths

![The official C examples talk to the chip's hardware sockets and the chip runs TCP/IP; the Arduino path runs lwIP on the RP2040 or RP2350, polled every 20 ms, and moves raw frames to a chip used as MAC and PHY](https://maker.wiznet.io/upload/ckeditor5/420750f531a3479cb7356dd7bcc5a263.jpg)

*The official C examples talk to the chip's hardware sockets and the chip runs TCP/IP; the Arduino path runs lwIP on the RP2040 or RP2350, polled every 20 ms, and moves raw frames to a chip used as MAC and PHY*

|  | Arduino, arduino-pico 6.3.1 | Official C examples, WIZnet-PICO-C |
| --- | --- | --- |
| Chip mode | MACRAW, raw Ethernet frames | Hardware sockets (TOE) |
| TCP/IP runs in | lwIP on the RP2040 or RP2350 | The W5500 or W6300 |
| API | WiFiClient, WiFiServer | socket(), listen(), send(), recv() |
| Connections | set by the lwIP configuration | 8 sockets |

arduino-pico's `lwIP_w55rp20` opens socket 0 in MACRAW mode and gives it the whole 16 KB TX and RX buffers. The author treats the two as choices, not a ranking: the Arduino path keeps the Pico W Wi-Fi API, and the socket path keeps TCP/IP off the MCU's CPU and RAM.

---

## 04 — The ping that shows who answered

![ping RTT: on the W55RP20-EVB-Pico lwIP replies in 2 to 21 ms with an average of 13, on the W6300-EVB-Pico2 in 2 to 34 ms with an average of 12, both at TTL 255; through the chips' hardware sockets every reply is under 1 ms at TTL 128](https://maker.wiznet.io/upload/ckeditor5/3f710691952d4317a7f32d72cd7447c4.jpg)

*ping RTT: on the W55RP20-EVB-Pico lwIP replies in 2 to 21 ms with an average of 13, on the W6300-EVB-Pico2 in 2 to 34 ms with an average of 12, both at TTL 255; through the chips' hardware sockets every reply is under 1 ms at TTL 128*

| Board and path | ping RTT, min / avg / max | TTL | TCP echo, first and second run |
| --- | --- | --- | --- |
| W55RP20, Arduino (lwIP) | 2 / 13 / 21 ms | 255 | 21 ms, 41 ms |
| W55RP20, C loopback (chip) | all under 1 ms | 128 | 12 ms, 1 ms |
| W6300, Arduino (lwIP) | 2 / 12 / 34 ms | 255 | 19 ms, 22 ms |
| W6300, C loopback (chip) | all under 1 ms | 128 | about 10 ms |

Each case is 10 pings with no loss. arduino-pico runs lwIP from a 20 ms poll, so a ping that reaches the chip waits until the next poll before lwIP builds the reply; the author attributes the RTT spread to that 0–20 ms wait. Through hardware sockets the chip answers ICMP by itself. The TTL tells the two apart: 255 is lwIP's `IP_DEFAULT_TTL`, 128 comes from the chip, and Windows ping prints it on every line.

---

## 05 — Why the sketch needs delay(50)

```cpp
while (client.connected()) {
  int n = client.available();
  if (n > 0) {
    uint8_t buf[128];
    n = client.read(buf, min(n, (int)sizeof(buf)));
    client.write(buf, n);   // send back what arrived, in one write
  }
  delay(50);                // leave room for the 20 ms lwIP poll
}
```

| Loop on the W55RP20-EVB-Pico | Result |
| --- | --- |
| Echo byte by byte with no pause | Only the first byte returns, closed never prints, ARP and ping stop until the loop exits |
| delay(1) per pass | Still stalls |
| delay(50) per pass, one write per chunk | Echo, disconnect and ping all work |
| One line per connection, then stop() | Works, but carries one line per connection |

A comment in arduino-pico's `LwipEthernet.cpp` notes that frequent lwIP calls from user code postpone the poll, and `client.connected()` and `client.available()` are such calls. Writing byte by byte also meets Nagle, which `WiFiClient` enables by default, and the PC's delayed ACK. `lwipPollingPeriod(ms)` changes the period, though the arduino-pico docs warn that too short a period can lock up Ethernet.

---

## 06 — What the W6300 adds

![W6300-EVB-Pico2: the RP2350 and the W6300 as two chips between the UDE RJ45 jack and USB-C. Photo: electwork.net, by the repository author](https://maker.wiznet.io/upload/ckeditor5/2799dd369e4546388157719f9d064adf.jpg)

*W6300-EVB-Pico2: the RP2350 and the W6300 as two chips between the UDE RJ45 jack and USB-C. Photo: electwork.net, by the repository author*

| Item | W5500 | W6300 |
| --- | --- | --- |
| IP | IPv4 | IPv4 and IPv6 dual stack |
| Offloaded protocols | TCP, UDP, ICMP, IPv4, ARP, IGMP, PPPoE | Same plus IPv6, ICMPv6, MLDv1 |
| Host bus | SPI | QSPI (Single, Dual, Quad) or 8-bit parallel |
| Buffers | 16 KB TX + 16 KB RX, 2 KB per socket by default | 32 KB TX + 32 KB RX, 4 KB per socket by default |
| Commands without a socket | none | ARP, PING, ICMPv6 (DAD, NS, RS, NA) |
| IP fragmentation | not supported | not supported |

TCP and UDP sockets also get dual modes that accept IPv4 and IPv6 on one socket. On the Arduino path lwIP builds the link-local address from the MAC (EUI-64) and runs DAD; the sketch printed `FE80::D4C7:62FF:FE4C:A0A5 (preferred)` inside its 3 s wait, and a ULA from the router's advertisement appeared about two minutes later. The C examples write a fixed address, `fe80::208:dcff:fe57:5725`, into the chip's LLAR register, so two boards running the same example on one LAN need their MAC and LLA changed.

---

## 07 — Where it stands

- The articles cover the first step only. Throughput, CPU load and the QSPI mode comparison are left for the author's follow-up articles.

- The repository holds the Arduino sketches and the PowerShell client; the hardware-socket numbers come from the WIZnet-PICO-C examples.

- MIT license.

**Two boards, two paths, and one TTL value that tells you which side answered the ping.**

---

## 08 — Similar Projects on WIZnet Makers

- [**How Much Does W5500 Hardware Offload Save Over MACRAW on the Same Board?**](https://maker.wiznet.io/Grace_Koo/projects/nucleo-h723zg-udp-echo/) — the same question on a NUCLEO-H723ZG: UDP echo builds measured for an hour each, hardware offload against MACRAW and the STM32's own MAC.

- [**How Does a Wires-First UART Combiner Move Four Serial Streams Over W55RP20 Ethernet?**](https://maker.wiznet.io/Alan/projects/how-does-a-wires-first-uart-combiner-move-four-serial-streams-over-w55rp20-ethernet-1/) — the W55RP20 on its hardware sockets through ioLibrary, with no lwIP in the build.

- [**hkdt_pico**](https://maker.wiznet.io/TheoIm/projects/hkdt-pico/) — the W6300-EVB-Pico2 in a robot library with a non-blocking W6300 UDP socket API.

---

## Q&A

**Q. In what mode is the WIZnet chip used?** Both. The Arduino sketches run it in MACRAW under lwIP; the C examples use its hardware sockets (TOE).

**Q. Does the RTT gap mean lwIP is slow?** The author attributes the spread to the 20 ms poll in arduino-pico rather than to lwIP itself. Throughput and CPU load are left for follow-up articles.

**Q. How do I build the sketches?** arduino-pico 6.3.1 with the board `rp2040:rp2040:wiznet_55rp20_evb_pico` or `rp2040:rp2040:wiznet_6300_evb_pico2`. For IPv6 on the W6300, set Tools > IP/Bluetooth Stack to IPv4 + IPv6.

**Q. Can it be reused?** Yes, under the MIT license.

---

**Original Link**: https://github.com/ramtuc/wiznet-pico-basics

**Sketches**: `arduino/w55rp20-evb-pico/dhcp_tcp_echo/`, `arduino/w6300-evb-pico2/dhcp_tcp_echo_ipv6/` · **Client**: `tools/tcp_echo_client.ps1` · **Articles**: [W55RP20-EVB-Pico basics](https://electwork.net/posts/w55rp20-evb-pico-basics-rp2040-w5500-ethernet/), [W6300-EVB-Pico2 basics](https://electwork.net/posts/w6300-evb-pico2-basics-rp2350-w6300-qspi-ethernet-ipv6/) (Japanese)

---

Source: https://maker.wiznet.io/Grace_Koo/projects/why-does-ping-reach-34-ms-via-lwip-but-stay-under-1-ms-on-w6300-hardware-sockets/
