
ESP32-S3: Ethernet over SPI
The ESP32-S3 has no Ethernet MAC, so a whole controller hangs on its SPI bus. With a W5500 the TCP/IP stack can run on the ESP32 as lwIP or inside the chip as its own sockets, and the library decides which.
No MAC inside
The ESP32-S3 has no Ethernet MAC. Nothing inside it builds or checks frames for a cable, so a PHY on its own is no use to it: there is no MAC for the PHY to talk to. On the S3, ESP-IDF supports Ethernet only through an external SPI module.
A whole controller on the bus
An SPI Ethernet chip holds both halves of the interface, the MAC and the PHY. It is a complete Ethernet controller, not a PHY, with the transformer and the jack beyond it as on any wired board. The S3 reaches it over an SPI bus, a chip select and usually an interrupt line, on pins you choose.
ESP-IDF 5.3 has drivers for three of these controllers: the W5500, the DM9051 and the KSZ8851SNL.
Whose stack runs
The W5500 carries more than a MAC and a PHY. It has a hardwired TCP/IP stack of its own, with eight sockets and 32 KB of buffer memory. That gives the same chip two ways to be used.
ESP-IDF's W5500 driver enables only MAC raw mode. The chip passes whole Ethernet frames over SPI, and lwIP on the ESP32 does all of IP, as it would above a built-in MAC. The Arduino-ESP32 core's own ETH library takes the same road, through Espressif's driver.
The classic Arduino Ethernet library does the opposite. It drives the chip's own sockets, the chip does the TCP/IP work, and lwIP is not involved. Nothing on the board differs between the two; the library decides. Read a W5500 example without checking which library it uses and you may be reading about the other stack.
The DM9051 and the KSZ8851SNL have no engine of their own, so with them lwIP on the S3 always runs the stack.
The older chip
The ENC28J60 also holds a MAC and a PHY on SPI, but it runs at 10 Mbit/s only. Its driver lives in Espressif's esp-eth-drivers repository rather than in ESP-IDF itself, and Espressif does not recommend it for new designs.
For a real board's wiring and code, see Ethernet instead of Wi-Fi in the ESP32 book. Lesson 11 puts the MAC back inside the chip.
Common mistakes
- Wiring a bare PHY to an S3. A PHY needs a MAC on the other side, and the S3 has none. It needs a whole controller on SPI.
- Assuming the W5500 runs its own stack whatever the code. With Espressif's driver it runs in MAC raw mode and lwIP on the ESP32 does IP; only the classic Arduino Ethernet library uses its sockets.
- Starting a new design on the ENC28J60. It runs at 10 Mbit/s only, and Espressif does not recommend it for new designs.
Edit this page — content/fundamentals/ethernet/esp32-s3-ethernet-over-spi.mdx
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.