# Cable detection

**URL:** <https://forums.digi.com/t/cable-detection/5721>\
**Category:** NET+OS\
**Created:** [June 17, 2004, 8:35pm UTC](https://forums.digi.com/t/cable-detection/5721 "2004-06-17T20:35:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gburte](https://avatars.discourse-cdn.com/v4/letter/g/8e7dd6/32.png) [@gburte](https://forums.digi.com/u/gburte)\
**Post date:** [June 17, 2004, 8:35pm UTC](https://forums.digi.com/t/cable-detection/5721/1 "2004-06-17T20:35:08Z")

</div>

How is it possible to detect if the ethernet cable is connected ? I try to use NAIfconfigIsDeviceUp, but this functions always returns TRUE. Thanks Gregory

---

<div class="post-metadata">

**Author:** ![uniton](https://avatars.discourse-cdn.com/v4/letter/u/5daacb/32.png) [@uniton](https://forums.digi.com/u/uniton)\
**Post date:** [June 23, 2004, 9:09am UTC](https://forums.digi.com/t/cable-detection/5721/2 "2004-06-23T09:09:33Z")

</div>

The easiest way would be to connect the “link detect LED”-signal of the PHY to a GPIO of the NetARM.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/digi/original/1X/11da31a6a1fbcd03ef21d3f785c317c824009ae2.png) [@system](https://forums.digi.com/u/system)\
**Post date:** [January 3, 2005, 7:36pm UTC](https://forums.digi.com/t/cable-detection/5721/3 "2005-01-03T19:36:28Z")

</div>

It looks like you could call customizeMiiCheckLink().

---

<div class="post-metadata">

**Author:** ![felczak](https://avatars.discourse-cdn.com/v4/letter/f/34f0e0/32.png) [@felczak](https://forums.digi.com/u/felczak)\
**Post date:** [October 5, 2004, 9:01am UTC](https://forums.digi.com/t/cable-detection/5721/4 "2004-10-05T09:01:25Z")

</div>

You can read out the current setting over the phyter. See code example below: /\* check which phyter present _/ if (mii\_identify\_phy() == ENABLE\_PHY) { /_ LUCENT _/ /_ get interrupt status register of phyter _/ mii\_reg\_status = mii\_phy\_get\_reg(0x1e); /_ save interrupt status register _/ fixdata\_interrupt\_stat\_reg = mii\_reg\_status; /_ save content of control & status register _/ fixdata\_contr\_stat\_reg = mii\_phy\_get\_reg(0x17); /_ autonegotiation complete ? _/ if((mii\_reg\_status & 0x0800 ) != 0) { /_ autonegotiation is completed _/ fixdata\_autonegotiation\_completed = 1; } /_ endif _/ /_ link has gone down _/ if((mii\_reg\_status & 0x0200 ) != 0) { /__/ /_ link transient handling _/ link\_act = 0x00; zioledco\_link\_down(); /_ 2004-04-16 FA change _/ ziointph\_link\_change(SAT\_NOK); } /_ endif _/ /_ link has gone up _/ if((mii\_reg\_status & 0x0400 ) != 0) { /__/ /_ link transient handling _/ link\_act = 0x01; zioledco\_link\_up(); /_ 2004-04-16 FA change _/ ziointph\_link\_change(SAT\_OK); } /_ endif _/ } else { /_ INTEL _/ /_ get interrupt status register of phyter _/ mii\_int\_status\_reg = mii\_phy\_get\_reg(0x13); /_ get content of phyter status register #2 _/ mii\_reg\_status = mii\_phy\_get\_reg(0x11); /_ save interrupt status register _/ fixdata\_interrupt\_stat\_reg = mii\_int\_status\_reg; /_ save content of control & status register _/ fixdata\_contr\_stat\_reg = mii\_reg\_status; /_ autonegotiation complete ? 2004-04-16 FA mask was incorrect, changed from 0800 to 0080 _/ if((mii\_reg\_status & 0x0080 ) != 0) { /_ autonegotiation is completed _/ fixdata\_autonegotiation\_completed = 1; } /_ endif _/ /_ check link status _/ if ((mii\_reg\_status & 0x0400) != 0) { /_ link is up _/ /_ link transient handling _/ link\_act = 0x01; zioledco\_link\_up(); /_ 2004-04-16 FA change _/ ziointph\_link\_change(SAT\_OK); } else { /_ link is down _/ /_ link transient handling _/ link\_act = 0x00; zioledco\_link\_down(); /_ 2004-04-16 FA change _/ ziointph\_link\_change(SAT\_NOK); } /_ endif check link status _/ /_ 2004-04-16 FA check duplex _/ if ((mii\_reg\_status & 0x0200) != 0) { /_ full duplex _/ zioledco\_duplex\_full(); } else { /_ half duplex _/ zioledco\_duplex\_half(); } /_ endif check duplex _/ /_ 2004-04-16 FA check speed _/ if ((mii\_reg\_status & 0x4000) != 0) { /_ 100 MBit _/ zioledco\_speed\_100(); } else { /_ 10 Mbit _/ zioledco\_speed\_10(); } /_ endif check speed _/ } /_ endif check which phyter present \*/
