I am currently using the lwip_example project from SDK RTM 3.0.0 and want to check the status of the ENET1 network interface, but after initialization, netif_is_link_up keeps returning 1.
Hi,
So I need to add another ENET0 module by myself, configure the MDC and MDIO pins, and then use ENET_DRV_MDIORRead to obtain the status of the phy register.
Thomas_Bao_0-1781510403854.png
Thomas_Bao_1-1781510426970.png
Thomas_Bao_2-1781510595373.png
are there any other configurations that need to be made?
Hi,
netif_is_link_up() only returns the state of the lwIP NETIF_FLAG_LINK_UP flag. In the SDK lwip_example, this flag can be set during ENET/netif initialization and it is not necessarily updated automatically according to the real PHY link status after initialization.
So, if netif_is_link_up() always returns 1, it usually means that the lwIP netif link flag remains set, not that ENET1 physical link is continuously detected as active.
To detect the real ENET1 port status, please check the PHY link status via MDIO/MII, typically by reading the PHY status register, for example:
- PHY Basic Status Register, BMSR
- check the Link Status bit
Then update the lwIP netif state manually:
if (phy_link_is_up)
{
netif_set_link_up(&netif);
}
else
{
netif_set_link_down(&netif);
}
This can be done either periodically by polling the PHY link status, or in a PHY interrupt handler, if the PHY interrupt pin is connected and configured.
In short, netif_is_link_up() is not a direct hardware link detection function. It only reports the current lwIP netif link flag, so the application/driver must update this flag based on the actual PHY link status.
BR, Petr
Thank you for your reply.
Currently, I am using the ENET1 of MPC5748G-GW-RDB. After following your method for testing, the function was successful and the data was all zeros. However, the link has been established.
Is it because I set the PHY address incorrectly? I noticed in the schematic diagram that the address of dp83848 is 1. Are there any other possible reasons?
Thomas_Bao_0-1782110487981.png