control-mdio

CLI reference

glasgow run control-mdio

Configure Ethernet PHYs and query their status via the standard two-wire MDC/MDIO management interface. Both Clause 22 and Clause 45 operations are supported.

usage: glasgow run control-mdio [-h] [-V SPEC] [--mdc PIN] [--mdio PIN]
                                [-f FREQ]
-h, --help

show this help message and exit

-V <spec>, --voltage <spec>

configure I/O port voltage to SPEC (e.g.: ‘3.3’, ‘A=5.0,B=3.3’, ‘A=SA’)

--mdc <pin>

bind the applet I/O line ‘mdc’ to PIN (default: ‘A0’, required)

--mdio <pin>

bind the applet I/O line ‘mdio’ to PIN (default: ‘A1’, required)

-f <freq>, --frequency <freq>

set MDC frequency to FREQ kHz (default: 1000)

API reference

class glasgow.applet.control.mdio.ControlMDIOInterface(logger: Logger, assembly: AbstractAssembly, *, mdc: GlasgowPin, mdio: GlasgowPin)
property clock: ClockDivisor

MDC clock divisor.

async c22_read(phy: int, reg: int) int

Read Clause 22 (SMI/MIIM) register reg of PHY phy.

async c22_write(phy: int, reg: int, value: int)

Write value to Clause 22 (MIIM) register reg of PHY phy.

async c45_read(phy: int, dev: int, reg: int) int

Read Clause 45 (MDIO) register reg of MMD dev of PHY phy.

async c45_write(phy: int, dev: int, reg: int, value: int)

Write value to Clause 45 (MDIO) register reg of MMD dev of PHY phy.

async get_phy_id() tuple[int, int, int]

Read PHY identification.

Returns a tuple (oui24, model, rev), where oui24 is the OUI in the canonical (non-bit-reversed) representation; in it, two least significant bits are always 0.