EE Primers · Communication interfaces · Ethernet

MAC–PHY interfaces: MII, RMII, GMII, RGMII and SGMII

Between every Ethernet MAC and its PHY runs one of a small family of interfaces, all descended from the original MII. They carry the same thing (frame bytes plus "frame valid" and "error" flags in each direction) and differ in how many pins they spend, who supplies the clock, and whether the clock is a wire or is recovered from a serial stream. Choosing between them is a pin-count, speed and layout decision; getting them wrong usually shows up as a link that comes up but drops frames. This page draws each one, MAC on the left and PHY on the right, with its timing.

Standards: IEEE 802.3-2022 Clause 22 (MII), Clause 35 (GMII), Clauses 36–37 (1000BASE-X PCS, 8b/10b); RMII Consortium specification 1.2; RGMII v2.0; Cisco SGMII specification 1.8 [1–4].

01 · Where it sits

The interface between layer 2 and layer 1

Inside the MAC, a reconciliation sublayer (RS) maps the MAC's serial-bit view onto the parallel interface signals. The PHY's PCS sits on the other side. Every member of the family carries, per direction, data plus an enable/valid and an error flag; they trade width against clock rate, and later members trade parallel wires for a serial lane. Management (MDC/MDIO) is a separate two-wire bus that every variant keeps.

MAC (in SoC / MCU / switch)PHY MAC coreRSPCSPMAPMD / AFE TX: data, TX_EN, TX_ER (+clock)RX: data, RX_DV, RX_ER (+clock) frames, FCS,addressesmaps MAC bits toxMII signals;speed selects mode line codingsymbolsanalog MDC / MDIO (management, all variants) MII · RMII · GMII · RGMII · SGMII (also QSGMII, USXGMII for multi-port and multi-gig)
The xMII sits where the reconciliation sublayer meets the PCS. For SGMII, part of a 1000BASE-X PCS (8b/10b) and a SerDes are added on both sides of the board link.
InterfaceData per directionClockClock sourceEdgesSpeedsSignal pins (excl. MDIO)
MII4 bits25 / 2.5 MHzPHY drives TX_CLK and RX_CLKRising10/10016
RMII2 bits50 MHzOne shared REF_CLK (osc, PHY or MAC)Rising10/1007 (+RX_ER)
GMII8 bits125 MHzMAC drives GTX_CLK; PHY drives RX_CLKRising10/100/100024–25
RGMII4 bits125 / 25 / 2.5 MHzMAC drives TXC; PHY drives RXCBoth (DDR at 1000)10/100/100012
SGMII1 serial lane1.25 GbaudEmbedded; each receiver recovers it—10/100/10004 (2 diff pairs)
02 · MII (Clause 22)

MII: the original, 4 bits at 25 MHz

The Media Independent Interface carries a nibble per clock in each direction: 25 MHz × 4 = 100 Mbit/s, or 2.5 MHz × 4 = 10 Mbit/s. Both clocks come from the PHY, including the transmit clock, so the MAC launches TXD on a clock it receives. Timing is relaxed: the MAC must drive TXD, TX_EN and TX_ER 0–25 ns after the rising edge of TX_CLK, and the PHY samples on the next rising edge (40 ns period). On receive the PHY provides at least 10 ns setup and hold around the RX_CLK rising edge. CRS and COL are asynchronous status lines used in half duplex.

Teal: MAC → PHY. Amber: PHY → MAC. Blue: bidirectional. Bus widths marked with a slash.
MII transmit of the end of a preamble (55h 55h), the SFD (D5h) and the first destination byte (FFh). Each byte is two nibbles, low nibble first. The MAC changes TXD shortly after each TX_CLK rising edge; the PHY samples on the next rising edge (dashed lines), almost a full period later.
MAC-to-MAC and RevMIIBecause MII expects the PHY to drive both clocks, connecting two MACs (an MCU to a switch port with no PHY in between) needs one side in "reverse MII" (PHY mode), which outputs the clocks. Many switches offer this per port.
03 · RMII (RMII Consortium 1.2)

RMII: half the pins, one 50 MHz clock

Reduced MII halves the data width to 2 bits and doubles the clock to 50 MHz, so 100 Mbit/s still fits; for 10 Mbit/s each dibit is simply held for 10 clocks. There is only one clock, REF_CLK, shared by MAC and PHY for both directions; CRS and RX_DV are merged into CRS_DV; COL is dropped (derived from CRS_DV and TX_EN in half duplex). That gets the interface down to 7 pins, which is why small MCUs and multi-port switches use it.

  • Timing: receivers need 4 ns setup and 2 ns hold around the REF_CLK rising edge; the 20 ns period leaves the rest for driver output delay and flight time.
  • The catch is the clock. Both chips sample on the same REF_CLK, so the skew between the clock arriving at the MAC and at the PHY eats directly into that budget. REF_CLK must be clean, 50 MHz ±50 ppm, and routed as a point-to-point clock with series termination.
  • CRS_DV toggles at the end of a received frame when carrier has gone but the PHY's FIFO still has data: the MAC must treat it as RX_DV on alternate cycles. A MAC that doesn't can truncate frames.
REF_CLK goes to both chips; its source varies (below). RX_ER is optional on the MAC side.
Left: an external oscillator fans out to both (best skew control if trace lengths match). Middle: many PHYs take a 25 MHz crystal and output 50 MHz REF_CLK to the MAC. Right: the MAC outputs 50 MHz to the PHY's clock input. In the middle and right cases the source chip often has to sample on its own output, so check whether it uses the internal clock or a loopback of the pin.
RMII transmit of 55h then D5h at 100 Mbit/s. Each byte is four dibits, least significant pair first: 55h → 01 01 01 01, D5h → 01 01 01 11 (TXD1 TXD0).
04 · GMII (Clause 35)

GMII: a byte per clock at 125 MHz

Gigabit MII widens the data path to 8 bits at 125 MHz. Unlike MII, the transmit clock now comes from the MAC (GTX_CLK), so TX is source-synchronous: clock and data travel together. The PHY still drives RX_CLK. For 10/100 it falls back to MII signalling on the low nibble, with the PHY again supplying TX_CLK, so a GMII port has both clocks. At 24–25 pins it is rarely routed across a board today; it lives inside SoCs and switches, and RGMII or SGMII carries it off-chip.

GMII. TX_CLK (from the PHY) is used only at 10/100; GTX_CLK (from the MAC) at 1000.
05 · RGMII (v2.0)

RGMII: GMII on 12 pins, both clock edges

Reduced GMII squeezes GMII's 8 data bits onto 4 wires by using both clock edges at 125 MHz: the low nibble on the rising edge, the high nibble on the falling edge. TX_EN and TX_ER share one wire, TX_CTL, the same way (TX_EN on the rising edge, TX_EN ⊕ TX_ER on the falling edge), and likewise RX_CTL. CRS and COL are dropped. Both directions are source-synchronous: the MAC drives TXC with TXD, the PHY drives RXC with RXD. At 100 and 10 Mbit/s the clocks drop to 25 and 2.5 MHz and one nibble per clock is used.

  • The 2 ns rule. Transmitters launch clock and data edge-aligned. The receiver needs the clock edge in the middle of the 4 ns data window, so the clock must be delayed by about 2 ns (1.5–2.0 ns in v2.0) somewhere on its way, once per direction: inside the transmitter ("internal delay"), inside the receiver, or by extra PCB trace (≈ 300 mm of it, so in practice never).
  • Optional in-band status: between frames the PHY can send link, speed and duplex on RXD, saving MDIO polling. Few designs rely on it.
RGMII. Six signals per direction; each direction has its own clock from its transmitter.
Three places for the TX clock delay; the RX direction has the same three choices independently. The Linux device-tree phy-mode names describe which delays the PHY should add: rgmii (none, MAC or PCB provides), rgmii-id (PHY adds both), rgmii-txid (PHY adds TX only), rgmii-rxid (PHY adds RX only).

RGMII timing explorer

Bytes 55h 55h D5h FFh FFh at 1000 Mbit/s. Each byte takes one 8 ns clock period: low nibble on the rising edge, high nibble on the falling edge. Vertical lines: the instants at which the receiver's flops sample, after the clock delay.
06 · SGMII (Cisco spec 1.8)

SGMII: one serial lane each way at 1.25 Gbaud

Serial GMII replaces the parallel bus with a SerDes. Each GMII byte is 8b/10b encoded, exactly as in 1000BASE-X, and sent as a 1.25 Gbaud differential stream: one pair MAC → PHY, one pair PHY → MAC. There is no clock wire; each receiver recovers the clock from the data (8b/10b guarantees enough transitions and DC balance). Four pins, no skew budget between data bits, and the link tolerates tens of centimetres of trace or a connector, which is why SoCs, switches and automotive PHYs with gigabit links favour it.

  • 10/100 by replication. The lane always runs at 1.25 Gbaud. At 100 Mbit/s each byte is repeated 10 times, at 10 Mbit/s 100 times; the receiver keeps one copy.
  • Auto-negotiation, SGMII style. The PHY sends a 16-bit configuration word inside /C/ ordered sets telling the MAC the copper link's state: link up/down, duplex, and speed (bits 11:10 = 00 for 10, 01 for 100, 10 for 1000). The MAC acknowledges. This replaces MDIO polling for speed changes. 1000BASE-X uses the same mechanism with a different word, so both ends must agree which mode they are in.
  • Electrical: 100 Ω differential, AC-coupled (typically 100 nF in each line near the receiver), CML or LVDS-like swings. Many SerDes can invert polarity per lane, which rescues P/N swaps.
MAC sidePHY side MACGMIIinternal PCS8b/10bSGMII ANrate adapt SerDesserialiserCDRCML driver SerDesCDRserialiser PCS8b/10bsends AN wordrate adapt PHY corecopper orT1 PCS/PMA→ MDI TX+ / TX− (MAC SDO → PHY SDI), 1.25 Gbaud RX+ / RX− (PHY SDO → MAC SDI), 1.25 Gbaud AC caps atreceiverAC caps optional 625 MHz clock pairs: defined, almost never used
SGMII. 100 Ω differential pairs, AC-coupled. Each side has a PCS and SerDes; the PHY's PCS reports the copper link's speed and duplex to the MAC through SGMII auto-negotiation.

Signaling: 8b/10b on the lane

The serial stream at the start of a frame, bit a of each code group first. /I2/ idle (K28.5 + D16.2), then /S/ start-of-packet (K27.7, which replaces the first preamble byte), preamble 55h (D21.2, five more not drawn) and SFD D5h (D21.6). K28.5 carries the "comma" (0011111) the receiver uses to find code-group boundaries. Running disparity starts negative. Each bit is 0.8 ns.
Relatives2500BASE-X (sometimes called HSGMII) runs the same scheme at 3.125 Gbaud for 2.5 Gbit/s. QSGMII multiplexes four SGMII ports on one 5 Gbaud lane for switches. USXGMII carries 10M–10G over one 10.3125 Gbaud lane with 64b/66b coding, and is the usual interface to multi-gig automotive PHYs.
07 · Choosing

Which one, when

MII
  • 10/100 with the most relaxed timing.
  • Microcontrollers, legacy, half-duplex 10BASE-T1S PHYs.
  • Costs 16 pins.
RMII
  • 10/100 in 7 pins: MCUs, multi-port switches.
  • Shared 50 MHz clock: design its source and skew deliberately.
RGMII
  • Gigabit in 12 pins over short (< ~10 cm) traces on the same board.
  • Get the 2 ns delay right in both directions.
  • I/O voltage matters: 1.8, 2.5 or 3.3 V, match MAC and PHY.
SGMII
  • Gigabit (and 10/100) in 4 pins, longer traces, connectors, or board-to-board.
  • Needs SerDes on both chips; mode (SGMII vs 1000BASE-X) and AN must match.
08 · Board design

Layout and signal integrity

MII / RMII
  • 50 Ω single-ended, series 22–33 Ω at each driver; route clocks as clocks (no stubs, no daisy chain).
  • RMII: match REF_CLK lengths to MAC and PHY when fed from one oscillator; keep data within a few cm of the clock.
  • Strap pins often share these nets: check pull-ups/downs against the MAC's reset state.
RGMII
  • Match each data/CTL group to its own clock (TXD/TX_CTL to TXC, RXD/RX_CTL to RXC), typically within ±2.5 mm.
  • Series termination at every driver; clean, monotonic clock edges matter most (DDR samples on both).
  • Keep runs short (under about 100 mm); no need to match TX to RX.
SGMII
  • 100 Ω differential, tight intra-pair skew, AC caps (0201/0402) placed per the SerDes guide, minimal vias.
  • Loss budget is generous at 625 MHz Nyquist, but stubs and connector discontinuities still close the eye.
  • Polarity inversion and lane swap options in the SerDes can fix routing, but document them.
09 · When it breaks

Failure modes and debug signatures

SymptomLikely causeCheck / fix
RGMII: link up, CRC errors or no traffic in one directionClock delay missing or applied twice in that directionReview MAC delay registers, PHY RGMII-ID straps/registers and the device-tree phy-mode, per direction.
Works at 100, fails at 1000 (RGMII)Marginal delay or length matching; 4 ns window vs 40 nsScope TXC vs TXD at the PHY pin with a high-bandwidth probe; tune delay registers if the PHY has fine steps.
Link up at 1000, nothing at 10/100MAC not reprogrammed to the new speed (RGMII clock rate) or SGMII AN disabledMake sure the PHY driver's link-change handler sets MAC speed; enable SGMII AN or force both ends.
SGMII: PHY link up, MAC sees no linkOne side in 1000BASE-X mode, the other in SGMII; AN mismatchSet both to SGMII (or both to 1000BASE-X); check the PCS AN status register on each side.
SGMII: no lock at allMissing AC caps, P/N swapped, TX wired to TXCheck the schematic; enable polarity inversion; read SerDes signal-detect / CDR lock status.
RMII: occasional dropped or truncated framesREF_CLK skew or jitter; CRS_DV toggle at frame end not handledMeasure REF_CLK at both pins; check MAC's RMII mode handles CRS_DV toggling.
MII: nothing transmittedBoth sides expect the other to drive TX_CLK (MAC-to-MAC)Put one side in RevMII / PHY mode.
10 · Self-check

Questions

Who drives TX_CLK in MII, and who drives TXC in RGMII?

MII: the PHY drives both TX_CLK and RX_CLK. RGMII (and GMII's GTX_CLK): the MAC drives the transmit clock, so TX is source-synchronous from the MAC.

How does RMII carry 100 Mbit/s on 2 data bits?

50 MHz × 2 bits = 100 Mbit/s. At 10 Mbit/s each dibit is held for 10 REF_CLK cycles.

A board uses rgmii-id in device tree and the MAC also enables its TX delay. What fails?

TX gets 4 ns of delay (MAC + PHY), a full nibble, so the PHY samples on data transitions: transmit frames are corrupted while receive works.

Why can SGMII run 10 Mbit/s on a 1.25 Gbaud lane?

The PCS repeats each byte 100 times; the lane rate never changes, only how often new data appears on it.

Why does SGMII need no length matching between bits, while RGMII does?

SGMII is one serial lane per direction with an embedded clock: the receiver recovers timing from the data itself. RGMII sends 4 data bits and a clock on separate wires, so their relative delay is the timing budget.

11 · Further reading

References

  1. IEEE 802.3-2022, Clauses 22 (MII, MDIO), 35 (GMII), 36 (1000BASE-X PCS, 8b/10b), 37 (1000BASE-X auto-negotiation).
  2. RMII Consortium, Reduced Media Independent Interface Specification, rev. 1.2.
  3. HP / Broadcom, Reduced Gigabit Media Independent Interface (RGMII), version 2.0.
  4. Cisco Systems, Serial-GMII Specification, revision 1.8.
  5. PHY data sheets for delay, strap and SerDes options, e.g. TI DP83867 / DP83TG720, Microchip KSZ9031 / LAN8742, NXP TJA1103; Linux kernel Documentation/networking/phy.rst for phy-mode semantics.
How Ethernet works (PHY, 100BASE-T1, 10BASE-T1S) →Automotive Ethernet: MDIO, MDI network →CML drivers →LVDS drivers →