ETH_ERR_AUTONEG_TIMEOUT embedded communication_error ai_generated true

ETH: PHY autonegotiation timeout after 5000ms

ID: embedded/eth-phy-autonegotiation-timeout

Also available as: JSON · Markdown · 中文
75%Fix Rate
88%Confidence
1Evidence
2024-01-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
STM32H7 ETH driver v2.0.1 active — — —
LWIP v2.1.3 active — — —
PHY LAN8742A active — — —

Root Cause

PHY device failed to complete autonegotiation within the configured timeout due to incompatible link partner or faulty cable.

generic

中文

PHY设备在配置的超时时间内未能完成自协商,原因可能是链路伙伴不兼容或网线故障。

Official Documentation

https://www.st.com/resource/en/application_note/an4606-ethernet-phy-interfacing-with-stm32-mcus-stmicroelectronics.pdf

Workarounds

  1. 80% success Force the PHY to a specific speed/duplex (e.g., 100Mbps Full Duplex) using: `phy_write(PHY_CTRL_REG, MII_CR_SPEED_100 | MII_CR_FULL_DUPLEX | MII_CR_RESTART_AUTONEG)`
    Force the PHY to a specific speed/duplex (e.g., 100Mbps Full Duplex) using: `phy_write(PHY_CTRL_REG, MII_CR_SPEED_100 | MII_CR_FULL_DUPLEX | MII_CR_RESTART_AUTONEG)`
  2. 70% success Check and replace the Ethernet cable, then reset the PHY: `phy_reset(phy_dev); HAL_Delay(100); phy_autonegotiate(phy_dev);`
    Check and replace the Ethernet cable, then reset the PHY: `phy_reset(phy_dev); HAL_Delay(100); phy_autonegotiate(phy_dev);`

中文步骤

  1. Force the PHY to a specific speed/duplex (e.g., 100Mbps Full Duplex) using: `phy_write(PHY_CTRL_REG, MII_CR_SPEED_100 | MII_CR_FULL_DUPLEX | MII_CR_RESTART_AUTONEG)`
  2. Check and replace the Ethernet cable, then reset the PHY: `phy_reset(phy_dev); HAL_Delay(100); phy_autonegotiate(phy_dev);`

Dead Ends

Common approaches that don't work:

  1. 60% fail

    If the root cause is link partner incompatibility or cable fault, increasing timeout only delays the failure; autonegotiation will still fail.

  2. 90% fail

    Looping without fixing the underlying issue can cause an infinite retry loop, blocking other tasks and consuming CPU cycles.