PHY

From SEGGER Wiki
Jump to: navigation, search

PHY in short for physical and often used for an Ethernet physical transceiver is an IC that connects to a MAC unit to convert binary data into signals on the line. As PHYs do not exist for Ethernet and cable based networks alone, a PHY can also mean a transceiver for WiFi or other medium.

emNet support for PHYs

emNet supports supports virtually any single port PHY on the market as long as the PHY is compatible to the IEEE 802.3u standard. The emNet Generic PHY driver expects the first six PHY registers to be the following registers with their standardized bits according to IEEE 802.3u:

SMI register address Register short name Register full name
0x0 BMCR Basic Mode Control Register
0x1 BMSR Basic Mode Status Register
0x2 PHYIDR1 PHY ID Identifier Register #1
0x3 PHYIDR2 PHY ID Identifier Register #2
0x4 ANAR Auto-Negotiation Advertisement Register
0x5 ANLPAR Auto-Negotiation Link Partner Ability register

Other PHYs with different register layouts, requirements for special treatment or interfaces other than SMI are supported as well via the emNet PHY drivers interface API.

Link Up detection

A link up is detected by the PHY by either actively receiving data or by listening for idle data bits sent by each host on a network. The type of idle data sent differs based on the medium used and varies from sending link pulses (also called NLP for Normal Link Pulses) up to depending on the auto-negotiation advertisement being used as link up detection.

emNet polls the link status once directly after the NI driver init and from there on relies on a one second periodic poll executed by the IP_Task(). Apart from this periodic polling mechanism to make the stack aware of the link status, the link detection time depends entirely on the PHY itself. This can be tested by pausing the program execution after IP_Init() for a couple of seconds and when continuing the program the link gets immediately (in respect to the periodic timer) detected. If the execution is paused before the very first link check during the NI driver init it is even possible to get a link up immediately (of course this does not apply to a real application and is only mentioned for testing purposes).