ETH_ERR_AUTONEG_TIMEOUT embedded communication_error ai_generated true

ETH:PHY自协商超时,持续5000毫秒后失败

ETH: PHY autonegotiation timeout after 5000ms

ID: embedded/eth-phy-autonegotiation-timeout

其他格式: JSON · Markdown 中文 · English
75%修复率
88%置信度
1证据数
2024-01-10首次发现

版本兼容性

版本状态引入弃用备注
STM32H7 ETH driver v2.0.1 active
LWIP v2.1.3 active
PHY LAN8742A active

根因分析

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

English

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

generic

官方文档

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

解决方案

  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);`

无效尝试

常见但无效的做法:

  1. 60% 失败

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

  2. 90% 失败

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