I am using Altera Cyclone-V and uC/OS-II OS & TCP/IP package building a Network Interface in this way:
- Call Net_Init();
- Call NetIF_Add();
- Call NetIF_Start();
- Call NetIPv4_CfgAddrAdd();
Everything works fine except if I by accident forgot to plug in the Ethernet cable. If the cable is missing, Step C NetIF_Start() will return “NET_PHY_ERR_TIMEOUT_AUTO_NET” error.This error is not recoverable even with the cable plugging back to the device.I will have to reboot the device.
Is there any way I can check the cable connection before Step C? I tried functions like NetIF_LinkStateGet(), NetIF_IO_Ctrl(), but they only report the Link status after the interface is established.BTW, the HW is done and I can’t physically check the Ethernet port status.
Another option is when function NetIF_Start() returns an error due to the missing of the cable, what is a correct procedure to re-initialize the Network interface and wait for the cable connection.