← all lessons
Differential Buses · CAN & Ethernet · #31 of 48

Ethernet PHY, Magnetics & Auto-Negotiation

Why a Link Light Is Not Good Data

You wire Ethernet into the robot hand’s wrist controller for the first time, plug the cable into your laptop, and the green link LED comes on. You exhale. The hardware works. Then you start streaming joint telemetry and it crawls: a stutter here, a two-second stall there, throughput that should be a hundred megabits limping along at barely one. You blame the firmware, the driver, the cable, the phase of the moon. The link light, meanwhile, glows steadily the entire time, serenely lying to your face.

A link light only proves a carrier exists. It says nothing about whether your data is any good.

Ethernet feels like a solved problem because the connector clicks and the light turns green, but underneath that connector sits a small stack of physical machinery that has to negotiate, isolate, code, and frame your bits before any of them reach the processor. The whole chapter rests on one ordering idea: carrier comes first, then a correctly negotiated link, then good data, and the link light only tells you about the first step. Skip past the middle and you get exactly the silent, crippling failure above.

By the end, you can

  1. Name the layers of an Ethernet port (magnetics, PHY, MAC) and say what each one does
  2. Explain why the magnetics provide galvanic isolation and common-mode rejection, and why a port needs them
  3. Describe what auto-negotiation and Auto-MDIX settle, and what happens when negotiation goes wrong
  4. Justify why a link LED is not proof of good data, and read the negotiated speed and duplex from the PHY over MDIO
  5. Diagnose a duplex mismatch from its symptoms and explain why it passes the link light but cripples throughput

Intuition first

Picture two people meeting to talk, but neither has agreed on a language, a speaking speed, or whether they will take turns or both talk at once. The first thing that happens, before a single useful word, is a quick handshake: “I speak English, French, and Spanish; I can talk fast or slow; I am happy to talk over you or wait my turn.” The other person answers with their own list. The two of them silently pick the best language and pace they both know, and only then does the real conversation start.

That handshake is auto-negotiation. The robot hand’s Ethernet port and the switch it plugs into each shout out a little list of what they can do (10, 100, or 1000 megabits per second; take-turns half-duplex or talk-at-once full-duplex) and agree on the fastest mode they share. The handshake happens in the first fraction of a second after you plug the cable in, long before any of your data flows.

Here is the failure that makes the whole lesson worth learning. Imagine one person agrees to take turns but the other decides to just talk continuously. Both still “have a connection.” Both can exchange a quick hello. But the moment real conversation starts, they keep stepping on each other, backing off, and repeating themselves. That is a duplex mismatch: the handshake half-failed, the link light is green, the hello (a ping) succeeds, and yet throughput collapses. The light is telling you a carrier exists. It is not telling you the handshake actually worked.

The three layers behind the connector

An Ethernet port is not one chip, it is a short assembly line. From the cable inward, your bits pass through three distinct stages, and knowing which one is which is the difference between a five-minute fix and a five-hour guess.

Magnetics: the little transformer that buys you safety

Right behind the 8-pin jack sits a small block of transformers and chokes, usually called the magnetics (or, when they are built into the jack, a “MagJack”). Every Ethernet pair passes through one. They look like a passive afterthought and they are quietly doing two essential jobs.

First, galvanic isolation. The transformer couples the signal across an air-and- core gap with no direct copper path, so the robot hand’s ground and the switch’s ground are never wired together through the cable. That matters enormously on a robot, where the wrist board, the elbow board, and the rack switch may each sit on a slightly different ground potential. Without isolation, those differences drive ground-loop currents down the cable shield and through your circuits. With it, each end floats relative to the other, and a few hundred volts of difference (or a static zap) is held off rather than dumped into your PHY.

Second, common-mode rejection. You met this idea on the CAN bus: noise that lands equally on both wires of a pair is common-mode, and a balanced, differential interface throws it away while keeping the difference that carries the data. The magnetics are wound so that common-mode noise (the kind a nearby motor inductor sprays onto the whole cable) sees a high impedance and is rejected, while the differential signal passes cleanly. This is the same hum-cancelling discipline that balanced telephone lines used a century ago, packaged into a part the size of a fingernail.

PHY: the part that turns bits into a waveform

Behind the magnetics sits the PHY (short for physical layer device). Its job is everything to do with the actual signal on the wire. In standards language the PHY implements two sublayers: the PCS (physical coding sublayer), which turns your clean digital bits into the line code that survives a real cable, and the PMA (physical medium attachment), which drives that code onto the copper and recovers it on the way back. The PHY is also where auto-negotiation lives, where Auto-MDIX decides the wiring, and where a small bank of status registers reports what actually got negotiated.

The PHY is the layer that knows the truth about your link. It is the only part that can tell you “we agreed on 100 megabits, full duplex” versus “we fell back to 100 megabits, half duplex.” Your processor reaches into the PHY’s registers over a tiny two-wire management bus called MDIO (clock plus data, defined as part of the standard) to read that truth. Remember MDIO. It is how you make the link light stop lying to you.

MAC: the part that builds frames

Closest to the processor sits the MAC (media access controller). The MAC does not care about voltages or magnetics. It works in frames: it wraps your payload with source and destination addresses and an error-checking trailer, hands whole frames down to the PHY to transmit, and reassembles incoming frames to pass up to software. On the ESP32 and most microcontrollers the MAC is built into the chip and the PHY is a separate part on the board, connected by a standard parallel bus (the media- independent interface, or MII, and its reduced cousin RMII).

So the assembly line, cable to CPU, is: magnetics (isolate and reject noise), PHY (code the bits, negotiate, drive the wire), MAC (frame the data). The link light hangs off the PHY and means “the PHY sees a carrier.” It is the first domino, not the last.

Portrait of Robert Metcalfe
Robert Metcalfe · 1946- Co-invented Ethernet at Xerox PARC in 1973 and pushed to make it an open standard, the lineage that runs straight through the PHY and magnetics on your robot's board.

When you plug the cable in, two things get settled automatically before any of your data moves. Understanding both is what lets you trust (or distrust) the green light.

Auto-negotiation picks speed and duplex

The two PHYs exchange a burst of pulses that encodes a little list of capabilities (a link code word: which speeds each supports, half or full duplex, flow control). Each side reads the other’s list and both independently pick the highest mode they share, by a fixed priority order: faster always beats slower, and at the same speed full duplex beats half. So two gigabit-capable ports settle on 1000 megabits full duplex; a gigabit port talking to an old 100-megabit port settles on 100 full duplex; and so on down the list. Auto-negotiation is optional and backward-compatible for the older speeds but mandatory for 1000BASE-T and faster, which is one reason gigabit links are far less prone to the duplex trap.

The dangerous case is parallel detection. If one side has auto-negotiation turned off and runs a fixed speed, the other (negotiating) side can still detect the speed by the kind of signal arriving, but it cannot detect duplex, so it safely assumes half duplex. If the fixed side was actually set to full duplex, you now have one end half and one end full: a duplex mismatch, born the instant the cable was plugged in.

Auto-MDIX picks the wiring

Older Ethernet split the four wires into a transmit pair and a receive pair, and you had to match a transmit on one end to a receive on the other. Devices came in two pinouts, “MDI” (PCs, routers) and “MDI-X” (hubs, switches), and connecting two of the same kind needed a special crossover cable that swapped the pairs. Forget the crossover and you got no link at all.

Auto-MDIX ends that headache: the PHY detects which pinout the other end is using and flips its own transmit and receive internally to match, so any cable works. (There is a tiny built-in randomness so that if both ends try to flip at once they do not chase each other forever.) For auto-MDIX to work, the port must be left in auto speed and duplex mode, which is one more reason to leave auto-negotiation on. On gigabit, the question evaporates entirely: 1000BASE-T uses all four pairs in both directions at once, so there is no fixed transmit pair to cross, and a crossover cable is never needed.

Now the payoff. A duplex mismatch is the textbook reason a link light is not proof of good data, so it is worth seeing exactly why it cripples throughput while leaving the light green.

Say your wrist controller’s port ended up at full duplex (it transmits and receives at the same time, assuming no collisions) while the switch ended up at half duplex (it expects strict take-turns, and treats any overlap as a collision). The carrier is fine, so the LED is green and a ping sails through, because a single small packet in each direction never overlaps. But under real traffic:

The fingerprint, then, is asymmetric: late collisions counted on the half-duplex end, CRC/FCS errors counted on the full-duplex end. And the only way to see the mismatch directly is to ask each PHY what it actually negotiated. That is what MDIO is for: you read the PHY’s status registers (over the management bus, or via your OS tools) and they tell you the negotiated speed and duplex in plain numbers. If one end says “100/full” and the other says “100/half,” you have found your bug. The light never could have told you that.

   cable          MAGNETICS         PHY                     MAC        CPU
  ===8P8C=====[ transformers ]==[ PCS + PMA + auto-neg ]==[ frames ]==[ app ]
                  isolation        codes bits, drives wire   builds
                  + CM reject      + link/speed registers    + checks
                                          |
                                      MDIO bus  <-- ask HERE for the truth
                                   "100 Mb/s, FULL duplex?"

   LINK LED  ----> hangs off the PHY's carrier detect
                   = "a carrier exists"   (NOT "the data is good")

Your robot's Ethernet link LED is solid green and a single ping replies normally, but a sustained telemetry stream runs at roughly 2% of the expected rate. Which is the most likely cause?

What is the specific job of the Ethernet magnetics (the small transformer block behind the jack)?

Lab: make the PHY tell you the truth

Bring up Ethernet on the robot hand and resist trusting the green light. First, with the cable plugged in, read the negotiated speed and duplex straight from the PHY: on a desktop OS this is ethtool <iface> (Linux) or the adapter’s status panel; on the ESP32 it is a register read over MDIO from your driver. Write down what each end claims. Now force a mismatch on purpose, on a managed switch: pin the switch port to 100/full with auto-negotiation off, leave the controller on auto, and watch the controller fall to 100/half by parallel detection. The link LED stays green the whole time. Run a sustained transfer (iperf or your telemetry stream) and watch throughput crater; pull the switch’s interface counters and you will see the asymmetric signature, late collisions on one side and CRC/FCS errors on the other. Then set both ends back to auto, confirm 100/full on both, and watch the rate jump back. You will never trust a link light again, which is the point.

The pulse handshake, the priority ladder, and why gigabit dodges the duplex trap

Auto-negotiation is older and cleverer than it looks. It piggybacks on the link integrity pulses that 10BASE-T already sent to prove a cable was connected: a single unipolar pulse about every 16 milliseconds, called a normal link pulse (NLP). Auto-negotiation replaces each lone pulse with a burst of 17 to 33 pulses, a fast link pulse (FLP) burst, and encodes a 16-bit link code word in the spacing: a pulse present between two clock pulses is a logical 1, its absence a 0. Those 16 bits advertise the selector field, the technology-ability bits (which speeds and duplex modes this end supports), remote-fault, acknowledge, and a “next page” bit for the extra pages gigabit needs. Because a non-negotiating 10BASE-T device still sends bare NLPs, the scheme is gracefully backward compatible: a negotiating port that hears only NLPs knows it is talking to a legacy partner.

Both ends apply the same priority ladder to the capabilities they share, so they always reach the same decision without a central referee. From the top: 10GBASE-T, then 5G, 2.5G, then 1000BASE-T full, 1000BASE-T half, then the 100-megabit modes (full before half), then 10BASE-T full, and finally 10BASE-T half at the bottom. The rule “faster wins, and at equal speed full beats half” falls straight out of the ladder.

This is also exactly why gigabit rarely suffers the duplex mismatch that haunts 10/100 links. Auto-negotiation is mandatory for 1000BASE-T: there is no standard way to force a gigabit link to a fixed speed and duplex with negotiation off, so the parallel-detection path that creates a half/full split on Fast Ethernet simply does not exist. The mismatch lives almost entirely in the world of hand-configured 10/100 ports, where one well-meaning admin pinned a speed and duplex “to be safe” and broke the handshake in the process. The standards advice today is blunt: leave auto-negotiation on everywhere.

One honest note where the everyday framing and the formal standard differ. People loosely say “the magnetics give you common-mode rejection,” and for measurement intuition that is the right picture: the transformer’s balanced winding does present a high impedance to common-mode and a low one to the differential signal. Formally, the rejection is a property of the whole balanced, matched interface (the twisted pair, the matched terminations, and the differential receiver inside the PHY) working together; the magnetics are the isolation-and-balance element of that system, not a standalone noise filter. The AUTHORITATIVE framing in this lesson keeps the common shorthand (magnetics provide isolation and common-mode rejection) because that is the mental model you act on at the bench, while this paragraph flags that balance and rejection are, strictly, system properties.

Grounded in Wikipedia: “Ethernet”, “Ethernet physical layer”, “Autonegotiation”, “Medium-dependent interface” (CC BY-SA).

Key takeaways

  • An Ethernet port is a three-stage assembly line: magnetics (isolate + reject common-mode), PHY (code bits, negotiate, drive the wire), MAC (build and check frames).
  • The magnetics give galvanic isolation (no copper ground path between ends) and common-mode rejection, which is why a robot can run a cable between boards on different grounds.
  • Auto-negotiation settles speed and duplex; Auto-MDIX settles the crossover wiring. Both want the port left in auto mode.
  • A link LED only means a carrier exists, not that data is good. The PHY's registers, read over MDIO, hold the negotiated speed and duplex.
  • A duplex mismatch passes the link light and a ping but cripples throughput; its fingerprint is late collisions on the half-duplex end, CRC errors on the full-duplex end.
  • 100BASE-TX uses two pairs, 1000BASE-T uses four bidirectionally (no crossover ever needed), and single-pair automotive Ethernet is 100BASE-T1 / 1000BASE-T1.
Practice 1 warm-up

Match each layer of an Ethernet port to its one-line job: magnetics, PHY, MAC. The three jobs are: builds frames with addresses and a CRC; provides isolation and common-mode rejection; codes the bits and drives the waveform onto the wire (and runs auto-negotiation).

Show worked solution

Magnetics → provides isolation and common-mode rejection (the passive transformer block right behind the jack). PHY → codes the bits and drives the waveform onto the wire, and runs auto-negotiation (it implements the PCS and PMA sublayers and holds the link/speed status registers). MAC → builds frames with addresses and a CRC (the layer closest to the processor). Cable-to-CPU order: magnetics, then PHY, then MAC.

Practice 2 core

A teammate reports: “Ethernet is fine, the link light is green and ping works.” When you push real traffic, throughput is terrible. Describe the single most useful measurement you would take to confirm or rule out a duplex mismatch, where you would take it, and what a “bad” result looks like.

Show worked solution

Read the negotiated speed and duplex from both PHYs (over MDIO, or with ethtool on a Linux host, or from the managed switch’s port status). That is the one measurement the link light cannot give you. A “bad” result is a disagreement: for example one end reports 100/full and the other reports 100/half. That asymmetry is the duplex mismatch. (Corroborating evidence: the half-duplex end’s counters show late collisions while the full-duplex end’s counters show CRC/FCS errors.) A green light and a working ping prove only that a carrier exists and that single packets pass, neither of which rules a mismatch out.

Practice 3 stretch

You are designing the robot hand’s wrist controller. To “keep things deterministic,” a colleague wants to disable auto-negotiation on the controller and hard-set it to 100 Mb/s, full duplex, while the rack switch port is left on auto-negotiation. Predict what link the switch will actually come up at, explain the mechanism, and say what you would do instead.

Show worked solution

The switch is negotiating but the controller is not, so the switch falls back to parallel detection: it can sense the speed from the type of electrical signal arriving (it correctly detects 100 Mb/s), but parallel detection cannot determine duplex, so the switch safely assumes half duplex. The controller is hard-set to full duplex. Result: the switch comes up at 100/half and the controller stays at 100/full, a classic duplex mismatch. The link light is green, a ping works, and sustained throughput collapses (collisions on the switch side, CRC errors on the controller side).

What to do instead: leave both ends on auto-negotiation. Hard-setting one side while the other negotiates is the single most common way to manufacture a mismatch; “deterministic” only works if both ends are pinned identically, and even then you lose Auto-MDIX. The modern, standard-recommended default is auto on everywhere, and on gigabit it is mandatory anyway.

The cruelest bugs are the ones with a reassuring light. A green LED feels like proof, and it is, but only that a carrier exists, not that two devices ever agreed how to talk. Learn to look past the glow to the PHY’s own account of what it negotiated, and the whole silent class of duplex mismatches and half-failed handshakes stops being witchcraft and becomes a register you can simply read. A link light is not good data. Go ask the part that actually knows.

full glossary →