Skip to main content
Peko
Associate III
September 4, 2020
Question

How to find out the status of the eth line?

  • September 4, 2020
  • 2 replies
  • 1206 views

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

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
September 4, 2020

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

Peko
PekoAuthor
Associate III
September 16, 2020

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