What layers does an embedded Ethernet interface involve?
Short answer: The MAC (media access controller), usually inside the MCU or SoC, builds and checks frames (preamble, addresses, CRC) and moves them to and from memory with DMA descriptors. The PHY, often an external chip, handles the physical signalling on the cable (10/100/1000BASE-T, auto-negotiation, link detection). They connect through a data interface (MII, RMII, RGMII, SGMII) and a management bus (MDIO/MDC) that reads and writes PHY registers. A TCP/IP stack (lwIP, Zephyr's stack, FreeRTOS+TCP, or Linux) runs above the MAC driver.
| Interface | Data width / clock | Speed | Notes |
|---|---|---|---|
| MII | 4 bits, 25 MHz TX and RX clocks | 100 Mbps | 16 pins |
| RMII | 2 bits, 50 MHz reference clock | 100 Mbps | fewer pins; the 50 MHz clock must come from the PHY or MCU, not both |
| RGMII | 4 bits, DDR at 125 MHz | 1 Gbps | needs ~2 ns clock delays (in PHY, MAC or PCB) |
| SGMII | serial differential | 1 Gbps | SerDes |
Bring-up checklist and common issues
- PHY reset and strap pins: the PHY address and mode (MII/RMII) are often set by pins at reset; wrong straps → no MDIO response.
- Read PHY ID registers (2 and 3) over MDIO to confirm communication.
- Reference clock: for RMII, exactly one 50 MHz source, with the right direction configured on both sides.
- RGMII delays: no delay or double delay → CRC errors or no traffic (
phy-mode = "rgmii-id"etc. on Linux). - Check link status and auto-negotiation result (speed/duplex) and configure the MAC to match.
- DMA descriptors, buffer alignment and cache maintenance in the MAC driver.
- Magnetics, cable and LEDs; check with
ethtoolon Linux.
Above the MAC: ARP, IP, ICMP, UDP, TCP, DHCP, DNS; MCU stacks need tuning of buffer counts and sizes for RAM. Automotive Ethernet (100BASE-T1, 1000BASE-T1) uses a single twisted pair and a different PHY, with protocols such as SOME/IP and AVB/TSN on top.