diff options
| author | iabdalkader <i.abdalkader@gmail.com> | 2021-06-06 21:49:40 +0200 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-06-13 12:29:11 +1000 |
| commit | 66115a37444350b166384ae8be95639aef5a5af4 (patch) | |
| tree | b8f62ca00b187fc7b03af600e001ba324bf495d2 | |
| parent | 51614ce365d4ec683560106d2af56f15d5ff38fa (diff) | |
stm32/eth: Fix eth_link_status function to use correct BSR bit.
Fixes #7346.
| -rw-r--r-- | ports/stm32/eth.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ports/stm32/eth.c b/ports/stm32/eth.c index 30f8a1014..79165e119 100644 --- a/ports/stm32/eth.c +++ b/ports/stm32/eth.c @@ -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 } } } |
