Keil Logo

MDK MIDDLEWARE: Network: How to check the PHY link status

Information in this knowledgebase article applies to:

  • CMSIS-Driver
  • RL-TCPnet


For some reasons, when the PHY link between my target device and network router is down and reset, some certain operations have to be performed on my target device. Is it possible for the target device to check and recognize the PHY link status?


Depending on whether you are using TCPNet library in MDK-ARM v4.x or the Middleware with CMSIS-Driver in MDK-ARM v5.x, the PHY link status can be recognized and returned, as described below:

  • Using TCPNet library: For MDK v4.x projects, the PHY link status can be checked by reading the corresponding register PHY_REG_STS from the EMAC driver.

    For example, for a target device with LPC23xx, the following example code to check the link status can be found in C:\Keil\ARM\RL\TCPnet\Drivers\LPC23_EMAC.c

      /* Check the link status. */
      for (tout = 0; tout < 0x10000; tout++) {
        regv = read_PHY (PHY_REG_STS);
        if (regv & 0x0001) {
          /* Link is on. */
  • Using Middleware with CMSIS in MDK-ARM v5.x: as written in this manual Ethernet PHY Interface, the function ARM_ETH_PHY_GetLinkState retrieves the connection status of the physical Ethernet link. An example to use this function can be found in this Example Code


Last Reviewed: Tuesday, July 28, 2015

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.