From 89a537b9a89db57df35ba02e93ecf510577b7379 Mon Sep 17 00:00:00 2001 From: jeromecoutant Date: Fri, 14 Feb 2020 15:27:00 +0100 Subject: [PATCH] STM32 EMAC : check PHY_BSR value before connect status --- features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp b/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp index ba9715c9cd..608cc3e186 100755 --- a/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp +++ b/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp @@ -677,7 +677,7 @@ void STM32_EMAC::phy_task() uint32_t status; if (HAL_ETH_ReadPHYRegister(&EthHandle, PHY_BSR, &status) == HAL_OK) { - if (emac_link_state_cb) { + if ((emac_link_state_cb) && (status != 0xFFFF)) { if ((status & PHY_LINKED_STATUS) && !(phy_status & PHY_LINKED_STATUS)) { emac_link_state_cb(true); } else if (!(status & PHY_LINKED_STATUS) && (phy_status & PHY_LINKED_STATUS)) {