2020-09-04 04:06 AM
Hello,
I need to find out the status of the eth line, whether the eth cable is connected or disconnected.
I created a simple project using STM32Cube MX v.1.4.2 with LwIP v. 2.1.2.
Procesor STM32F407ZET, PHY DP83848 (RMII)
#define WITH_RTOS 0
#define LWIP_NETIF_STATUS_CALLBACK 1
#define LWIP_NETIF_LINK_CALLBACK 1
DHCP disable
I added to main.c function: void ethernetif_notify_conn_changed(struct netif *netif)
I expected this function to be called when the line status changed. But it is not so.
What is wrong ?
Peter
2020-09-04 05:01 AM
Poll the PHY using SMI (MDIO/MDC), and check the Link Status bit (and if autonegotiation is on, which probably is,, then also Auto-Negotiation Complete bit) in the PHY's BMSR register (sometimes also called as BSR register, address 0x01).
I don't use Cube/MX so don't know how to achieve this purely by clicking.
JW
2020-09-15 11:40 PM
Thank you for help.
I found a solution to all my problems here:
https://community.st.com/s/question/0D50X00009XkhxBSAR/initialize-lwip-with-ethernet-disconnected
in response from Jim Kapcio
Peter