Hello.
When I start the MCU and the ethernet cable is not plugged in, the MCU hangs outputting "PHY Auto-negotiation failed. Please check the cable connection and link partner setting." roughly every 10 seconds.
I'm running FreeRTOS and lwip on an LPC54628, both from SDK 2.9.0. I use a LAN8720a, so I have components/phylan8720a/fsl_phy.c from the SDK added to my project.
The stall is in a thread that initialises ethernet (UDP works fine when the cable is plugged in on MCU startup).
Threading is started when calling netifapi_netif_add(), but the threading is stopped again because LOCK_TCPIP_CORE() is executed by tcpip_api_call() along the way.
Further down the call stack (attached) in ethernetif_phy_init() you have the loop that causes the 10 seconds delay which is enclosed in another loop that repeats 0x1ffff times.
10 seconds of delay would be okay, but 10*0x1ffff means 364 hours delay. - Definitely not what I want.The device needs to be responsive to other interfaces, not to ethernet only.
I have tried to use PHY_GetLinkStatus() before netifapi_netif_add() to prevent this hangup but I just get a HardFault. I assume this is due to MDIO/PHY not being fully initialised before the netifapi_netif_add() call.
So: How can I check if the cable is plugged in before calling netifapi_netif_add()?
Thank you.
Garry