STM32 EMAC : check PHY_BSR value before connect status

pull/12464/head
jeromecoutant 2020-02-14 15:27:00 +01:00
parent c3653c6813
commit 89a537b9a8
1 changed files with 1 additions and 1 deletions

View File

@ -677,7 +677,7 @@ void STM32_EMAC::phy_task()
uint32_t status; uint32_t status;
if (HAL_ETH_ReadPHYRegister(&EthHandle, PHY_BSR, &status) == HAL_OK) { 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)) { if ((status & PHY_LINKED_STATUS) && !(phy_status & PHY_LINKED_STATUS)) {
emac_link_state_cb(true); emac_link_state_cb(true);
} else if (!(status & PHY_LINKED_STATUS) && (phy_status & PHY_LINKED_STATUS)) { } else if (!(status & PHY_LINKED_STATUS) && (phy_status & PHY_LINKED_STATUS)) {