
How the link comes up
Before a link light comes on, the two ends of a cable advertise what they can do and pick the best mode they share. A link light proves the cable and the PHYs, and nothing above them.
Four pairs, and who drives them
A typical Ethernet cable holds four twisted pairs. Ten and hundred megabit Ethernet use two of them, one pair for each direction. Gigabit uses all four, sending and receiving on each pair at the same time.
At each end a PHY chip drives the pairs and turns what comes back into bits. On most ports a small transformer sits between the PHY and the jack and blocks direct current between the board and the cable. Some designs couple the line another way.
Pulses on an idle cable
A ten megabit PHY with nothing to send still sends regular link pulses. The far end uses them to know the cable is alive: no pulses, no link, even though nobody has sent a frame.
Since 802.3u was approved in June 1995, those pulses can carry a message. In bursts of link pulses each end advertises the speeds and duplex modes it supports, and both pick the best mode they share. Two ends that offer everything settle on a hundred megabits, full duplex. Make one end ten megabit only and they settle on ten. Share nothing and the link never comes up.
The result is more than a speed. It says whether the link is half or full duplex, and the MAC needs that: on a full-duplex link no collision is possible, so the MAC does not use collision detection at all.
What the board sees
The PHY holds the link status in a register. On an ESP32, the ESP-IDF Ethernet driver reads it at a fixed interval and, when the link comes up, raises ETHERNET_EVENT_CONNECTED.
That event, like the light, is about the physical link only. The board has no IP address yet, and nothing has shown that the application works. Getting an address is lesson 8; above IP is the TCP and UDP course, and the board side is Ethernet instead of Wi-Fi in the ESP32 book.
Common mistakes
- Reading the link light as "the network works". It proves the cable and the two PHYs agreed on a mode. IP and the application are still unproven.
- Sending as soon as the link is up. The link-up event comes before the board has an address. Code that talks to the network waits for the address, which comes later.
- Expecting gigabit from a two-pair cable. Ten and a hundred megabits run on two pairs; gigabit needs all four.
Edit this page — content/fundamentals/ethernet/how-the-link-comes-up.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.