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.
0
Project description
📚 Context: 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

| 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

| 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

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

| 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? — 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? — the W55RP20 on its hardware sockets through ioLibrary, with no lwIP in the build.
- 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, W6300-EVB-Pico2 basics (Japanese)

