AnsweredAssumed Answered

Determine Ethernet Link Status in TWR-MPC-5125

Question asked by Tim Hutchinson on Sep 2, 2014
Latest reply on Sep 3, 2014 by Tim Hutchinson

Hi All,

 

     I'm trying to detect the status of the network cable (plugged, un-plugged) on a TWR-MPC-5125 module. The Ethernet connection is working properly (I am using streaming sockets) but I would like to be able to detect the status of the network cable. I see there is a function in the RTCS manual that looks like it should do this "ipcfg_get_link_active()" but it seems to always return a 1 once the Ethernet system is configured. Prior to configuring the Ethernet it reports a 0 (that part makes sense). Once the Ethernet system is configured and operational, plugging or un-plugging the Ethernet cable from the TWR-MPC-5125 module seems to make no difference, the function always returns a 1. Perhaps I am using it incorrectly? I'm currently calling it from my program main loop like this:

 

 

main()
     {
     Boolean bLinkActive;

     bLinkActive = ipcfg_get_link_active(BSP_DEFAULT_ENET_DEVICE);
     if(bLinkActive == TRUE)
          {
          printf("Cable is plugged in");
          }
     else
          {
          printf("Cable is unplugged");
          }
     }

 

 

The constant BSP_DEFAULT_ENET_DEVICE is set to 0 which is the correct adapter. I'm using MQX 3.8.1 patched to RTCS 4.0.2 Any ideas?

 

Thanks!

Tim

Outcomes