Skip to content

Commit

Permalink
stm32/eth: Fix eth_link_status function to use correct BSR bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
iabdalkader authored and dpgeorge committed Jun 13, 2021
1 parent 51614ce commit 66115a3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ports/stm32/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,11 +791,10 @@ int eth_link_status(eth_t *self) {
return 2; // link no-ip;
}
} else {
int s = eth_phy_read(0) | eth_phy_read(0x10) << 16;
if (s == 0) {
return 0; // link down
if (eth_phy_read(PHY_BSR) & PHY_BSR_LINK_STATUS) {
return 1; // link up
} else {
return 1; // link join
return 0; // link down
}
}
}
Expand Down

0 comments on commit 66115a3

Please sign in to comment.