Skip to main content

Crate eth_phy_lan87xx

Crate eth_phy_lan87xx 

Source
Expand description

#![no_std] MDIO driver for the Microchip LAN87xx family of 10/100 Ethernet PHYs:

  • LAN8710A
  • LAN8720A
  • LAN8740A
  • LAN8741A
  • LAN8742A

Implements eth_mdio_phy::PhyDriver, so any MAC that exposes eth_mdio_phy::MdioBus can drive the chip — typical case is the ESP32 built-in EMAC SMI controller via esp_emac::mdio::EspMdio.

See the crate-level README (rendered on docs.rs and shipped via Cargo.toml’s readme field) for installation, the full embassy-net example via esp-emac, and a troubleshooting checklist covering the cold-boot ANAR quirk, MDIO bus failures, and strap-pin pitfalls.

§Quick start

use eth_mdio_phy::{MdioBus, PhyDriver};
use eth_phy_lan87xx::PhyLan87xx;

let mut phy = PhyLan87xx::new(/* PHY MDIO address */ 1);
phy.init(mdio)?;
loop {
    if let Some(status) = phy.poll_link(mdio)? {
        // status.speed, status.duplex
        break;
    }
}

§Crate features

FeatureDefaultWhen to enable
defmtoffAdds defmt::Format derives via eth-mdio-phy/defmt.

§Cold-boot ANAR quirk

On a cold boot, BMCR.RESET does NOT restore ANAR to 0x01E1 on the LAN87xx family. The driver writes ANAR = 0x01E1 explicitly before kicking auto-negotiation; if you reimplement this elsewhere, do the same — see the crate README’s troubleshooting section.

Structs§

PhyLan87xx
LAN87xx PHY driver (software-only, no reset pin).
PhyLan87xxWithReset
LAN87xx PHY driver with a hardware reset pin.