MPC5748G: Checking the status of the ENET1 network port 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. 回复: MPC5748G 检测 ENET1 网口的状态 Hi,
No, you do not need to add another ENET instance only for MDIO access. You should use the MDIO interface of the ENET instance connected to the PHY. Only if the PHY SMI (MDC/MDIO) is routed to a different ENET instance then that ENET instance must be used for MDIO access.
In the SDK lwip_mpc5748g demo (done for DEVKIT-MPC5748G), the PHY is connected to ENET0, and the lwIP port is configured to use ENET0. Therefore, PHY status should be read via the ENET0 MDIO interface. In this case, no additional ENET initialization is required for MDIO — the ENET0 driver and pins are already initialized by the lwIP example, and you can directly call ENET_DRV_MDIORead() or ENET_DRV_MDIOReadMMD when needed.
BR, Petr
回复: MPC5748G 检测 ENET1 网口的状态 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? Re: MPC5748G 检测 ENET1 网口的状态 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 回复: MPC5748G 检测 ENET1 网口的状态 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
記事全体を表示