How to do link loss detection with Nucleus NET

Discussion created by dan_schiro on Aug 6, 2012

Nucleus NET does not have any link detection nor do most of the Ethernet  drivers.  Depending on the Ethernet hardware, it may generate  an interrupt that signals link loss or a bit may be set in the PHY or a  communications processor register.  If a bit is set, a polling routine  could check for it or if an interrupt is generated, a LISR/HISR could be  created for it.  When link loss is detected, NU_Detach_IP_From_Device  could be called.  This will take care of marking the device as down,  cleanup any associated routes, and resuming any waiting tasks.  When the  link is re-established, NU_Attach_IP_To_Device could be called to  reattach the IP address, mark the device as up, and add the necessary  routes for the device.  By detaching and attaching the IP address, NET  will check if any other device has started using the specified IP in its  absence.  If NET detects this an error will be returned.  Based on the  error, a new IP address could be specified or a new DHCP lease request  could be made by the application.


Please note that some of the newer Ethernet drivers for Nucleus NET have link detection and all ReadyStart Ethernet driver have link detection.