Skip to main content

MDIO

Overview

MDIO (Management Data Input/Output) is a two-wire serial interface defined by IEEE 802.3 for reading and writing registers inside Ethernet PHY chips. It consists of two signals:

  • MDC — the clock line, driven by FREE-WILi
  • MDIO — the bidirectional data line

FREE-WILi's MDIO feature lets you directly control PHY registers over the MDIO bus without relying on a higher-level Ethernet framework. This is useful for debugging link negotiation, configuring PHY parameters, testing network hardware, and exploring automotive or industrial Ethernet PHY behavior.

FREE-WILi supports three MDIO access modes:

ModeDescription
Clause 22Original MDIO standard. Addresses up to 32 PHYs with 32 registers each.
Clause 45Extended MDIO for 10G+ Ethernet. Adds a device (MMD) address tier and a 16-bit register space per device.
Clause 22 Access to Clause 45An indirect method that uses Clause 22 framing to reach Clause 45 registers on PHYs that support it. Useful for older controllers.

In addition, FREE-WILi can communicate with the Intrepid Control Systems 1000BASE-T1 SFP Module via an on-board I2C-to-MDIO bridge. See the 1G SFP Hardware Tour for further detail on the module.

Hardware Setup

Pin Assignment

Connect your target device to the FREE-WILi GPIO header before using any MDIO function.

SignalGPIO Header PinDirection
MDC (clock)Pin 17Output
MDIO (data)Pin 14Bidirectional
tip

Make sure Pin 4 (V PINS IN) has a voltage applied that matches your target device (e.g., jumper to Pin 6 for 3.3V or Pin 2 for 5V). GPIO will not function without this. See Pinout & Electrical Specifications for full details.

FREE-WILi MDIO Wiring Placeholder

MDIO wiring — MDC to Pin 17, MDIO to Pin 14.

Quick Start

  1. Wire your device: Connect MDC to Pin 17 and MDIO to Pin 14 on the GPIO header.
  2. Apply I/O voltage: Ensure Pin 4 (V PINS IN) has the correct voltage for your target (3.3V is most common).
  3. Open the MDIO menu: In the FREE-WILi serial console, navigate to the MDIO Functions menu.
  4. Poll for PHYs: Run PHY Address Poll (y) to discover which PHY addresses respond and which MDIO clauses they support.
  5. Read or write a register: Use a Clause 22 or Clause 45 read/write command with the address information from the poll.

Understanding MDIO Clauses

Clause 22

The original MDIO specification. Each PHY on the bus has a 5-bit address (0–31), and each PHY exposes up to 32 registers (also 5-bit addressed). All register reads and writes are 16-bit values.

Clause 45

An extension introduced for 10 Gigabit Ethernet. Clause 45 adds a third address tier called the MMD (MDIO Manageable Device) address, also 5-bit. Each MMD then exposes a full 16-bit register space (up to 65,536 registers). This is how modern high-speed PHYs expose their full configuration.

Clause 22 Access to Clause 45 (Indirect Access)

Some PHYs support Clause 22 framing but implement an indirect addressing mechanism to access their Clause 45 registers. This works by first writing the target MMD device and register address into specific Clause 22 registers, then performing the read or write through a data register. FREE-WILi handles this automatically when you use the indirect access commands. This mode is useful when your controller or test setup only supports Clause 22 transactions but the PHY has Clause 45 registers you need to reach.

MDIO Menu Commands

Navigate to MDIO Functions in the serial console (found in the Extended Functions Menu). The menu prompt will remind you to connect MDC to pin 17 and MDIO to pin 14.

FREE-WILi MDIO Wiring Placeholder

MDIO Serial Console.

PHY Discovery

KeyCommandDescription
yPHY Address PollScans all 32 PHY addresses and reports which respond, along with their Clause 22, Clause 45, and emulation compatibility.
aSFP PollProbes the Intrepid CS 1000BASE-T1 SFP Module via the I2C-to-MDIO bridge. If found, returns the PHY identifier, temperature (°C), and Signal Quality Indicator (SQI).

Clause 22 Operations

KeyCommandArgumentsDescription
gClause 22 ReadPHY Address, Register AddressReads a 16-bit value from a register on a Clause 22 PHY.
iClause 22 WritePHY Address, Register Address, Data (2 bytes)Writes a 16-bit value to a register on a Clause 22 PHY.
jClause 22 Read-Modify-WritePHY Address, Register Address, Mask (2 bytes), Data (2 bytes)Reads the current register value, applies a mask, then writes only the masked bits. 1 bits in the mask are overwritten.

Clause 45 Operations

KeyCommandArgumentsDescription
kClause 45 ReadPHY Address, MMD Address, Register AddressReads a 16-bit value from a register on a Clause 45 PHY.
lClause 45 WritePHY Address, MMD Address, Register Address, Data (2 bytes)Writes a 16-bit value to a register on a Clause 45 PHY.
mClause 45 Read-Modify-WritePHY Address, MMD Address, Register Address, Mask (2 bytes), Data (2 bytes)Reads the current register value, applies a mask, then writes only the masked bits. 1 bits in the mask are overwritten.

Clause 22 Access to Clause 45 (Indirect Access)

KeyCommandArgumentsDescription
nClause 22 Access to Clause 45 ReadPHY Address, MMD Address, Register AddressReads a Clause 45 register via Clause 22 indirect addressing.
oClause 22 Access to Clause 45 WritePHY Address, MMD Address, Register Address, Data (2 bytes)Writes a Clause 45 register via Clause 22 indirect addressing.
pClause 22 Access to Clause 45 Read-Modify-WritePHY Address, MMD Address, Register Address, Mask (2 bytes), Data (2 bytes)Read-Modify-Writes a Clause 45 register via Clause 22 indirect addressing.

SFP Bridge Operations (Intrepid CS 1000BASE-T1)

These commands communicate with the Intrepid Control Systems 1000BASE-T1 SFP Module through the on-board I2C-to-MDIO bridge.

KeyCommandArgumentsDescription
aSFP Poll(none)Probes the SFP module. If found, returns the PHY identifier, temperature (°C), and Signal Quality Indicator (SQI).
bSFP ReadDevice Address, Register Address (2 bytes)Reads a 16-bit value from a register on the specified SFP device.
cSFP WriteDevice Address, Register Address (2 bytes), Data (2 bytes)Writes a 16-bit value to a register on the specified SFP device.
eSFP Read-Modify-WriteDevice Address, Register Address (2 bytes), Mask (2 bytes), Data (2 bytes)Read-Modify-Writes a register on the specified SFP device. 1 bits in the mask are overwritten.

Argument Format

All addresses and data are entered as hexadecimal values separated by spaces.

Argument TypeFormatExampleNotes
PHY Addresshex8015-bit address, 0–31
MMD Addresshex8015-bit device address, 0–31
Register Address (Clause 22)hex8025-bit, 0–31
Register Address (Clause 45)hex16000316-bit, 0–65535
Data / MaskhexbytesFF FFTwo space-separated bytes forming a 16-bit value

Command Examples

Discover PHYs on the Bus

y

Example output:

PHY found at address 04. Compatibility: Clause 22 Clause 45.
PHY found at address 07. Compatibility: Clause 22 Clause 22 Access to Clause 45.

Read a Clause 22 Register

Read register 0x02 (PHY Identifier 1) from the PHY at address 0x04:

g 04 02

Output:

Read 0022 from address 02 on PHY 04

Write a Clause 22 Register

Write 0x1200 to register 0x00 (Control register) on PHY 0x04:

i 04 00 12 00

Output:

Wrote 1200 to address 00 on PHY 04

Read-Modify-Write a Clause 22 Register

On PHY 0x04, register 0x00, set only bit 9 (restart auto-negotiation) without touching other bits. Mask = 0x0200, Data = 0x0200:

j 04 00 02 00 02 00

Output:

Wrote 1A00 to address 00 on PHY 04

Read a Clause 45 Register

Read register 0x0003 on MMD 0x01 (PMA/PMD PHY Identifier 2) from PHY 0x04:

k 04 01 0003

Output:

Read 0141 from address 0003 on MMD 01 on PHY 04

Poll the SFP Module

a

Output (module present):

SFP ID: 58. PHY Temp: 42 C, PHY SQI: 7

Output (module not found):

SFP Module not Found

GUI Log Panel

The MDIO feature includes a GUI log panel that displays the results of read, write, and poll operations in real time. Successful results are shown in blue; failures or "not found" responses are shown in red.

Troubleshooting

SymptomLikely CauseSolution
PHY Address Poll returns "No MDIO PHYs Found"MDC/MDIO not connected, or wrong voltage levelCheck wiring to Pin 17 (MDC) and Pin 14 (MDIO). Verify Pin 4 has correct voltage.
"Failed to initialize MDIO" errorInternal initialization failureCheck that Pin 4 (V PINS IN) has voltage applied.
"Invalid Arguments: Parse Error"Incorrect argument count or formatVerify all arguments are provided as space-separated hex values in the correct order.
SFP Poll returns "SFP Module not Found"SFP module not connected or not poweredConfirm the Intrepid CS 1000BASE-T1 SFP module is seated and powered.
Read returns 0000 or FFFF for all registersNo device at that PHY addressRun PHY Address Poll (y) first to confirm the valid address.