Ethernet link status for the K64F

Dependents:   JRO_CR2 K64F_EthLink_HelloWorld frdm_test JRO_DDSv2

Simple K64F technique to determine if the Ethernet PHY link is up or down. The routine utilizes the Ethernet MII interface to gain access to the Ethernet PHY which contains the actual link status.

I wrote this because the mbed Ethernet function does not recognize its own "int link();" function with the K64F.

Files at this revision

API Documentation at this revision

Comitter:
loopsva
Date:
Wed Oct 01 00:23:48 2014 +0000
Parent:
0:a447869e1046
Child:
2:59166b94dfd0
Commit message:
Changed MDIO timeout from 200mS to 300mS

Changed in this revision

k64f_EthLink.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/k64f_EthLink.cpp	Tue Sep 30 21:48:34 2014 +0000
+++ b/k64f_EthLink.cpp	Wed Oct 01 00:23:48 2014 +0000
@@ -19,8 +19,8 @@
         k64f_mdio_reg = ENET_EIR;
         Thread::wait(1);            //release RTOS to do other functions
         mdio_timer++;
-    } while(((k64f_mdio_reg & MDIO_MII_READY_BIT) == 0) && (mdio_timer < 200));
-    if(mdio_timer > 198) {          //average is about 122mS
+    } while(((k64f_mdio_reg & MDIO_MII_READY_BIT) == 0) && (mdio_timer < 300));
+    if(mdio_timer > 298) {          //average is about 122mS
         return(MDIO_TIMEOUT);       //timeout error
     }