[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Cable unplugged
From: |
Stephen Cowell |
Subject: |
Re: [lwip-users] Cable unplugged |
Date: |
Wed, 11 Dec 2019 18:57:16 -0600 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 |
Top posting is a crime!
Here's how I do it in Atmel-ese... no OS, in the main while(1) loop:
<>
modCount++;
...
if (!(modCount%0x00080000))// check Ethernet PHY once in a
while to make sure we're connected
{
if (ethernetOK != ERR_OK)// only worried about initial try
for connection here.
{
// test for Ethernet OK
ethernetOK = init_ethernet();// put skips in place for
second time through
}
else // this handles unplug notification... replug should
be automatic after first successful init_ethernet()
{
static bool alarmLamps = false;
gmac_enable_management(GMAC, true); // this is
necessary for direct access
gmac_phy_read(GMAC, BOARD_GMAC_PHY_ADDR, GMII_BMSR,
&ul_stat1);// get status from PHY
gmac_enable_management(GMAC, false); // give PHY back
to GMAC
if ((ul_stat1 & GMII_LINK_STATUS) == 0)// We are
unplugged, or something
{// do something! blink lamps etc
</>
On 12/11/2019 5:07 PM, Trampas Stern wrote:
Thanks I was wondering about the "Link Status" but was not sure if you
had to try and auto negotiate first.
Thanks again
Trampas
On Wed, Dec 11, 2019 at 5:14 PM Sergey A. Borshch via Mailing list for
lwIP users <address@hidden <mailto:address@hidden>> wrote:
On 11.12.2019 23:55, Trampas Stern wrote:
> This is not directly LWIP related but I was wondering if there
was a way to
> detect when cable is unplugged through a GMII/RMII interface?
basic status register (index 1), bit 2.
>
> Specifically my hardware does not have the carrier sense pin
connected to
> microcontroller and I was wondering if there was a way to poll
the GMII/RMII
> registers to see when a cable is connected or not?
>
> I did not see anything in the documentation right off but
thought I would ask,
> as maybe I am not looking at the correct registers.
>
> Thanks
> Trampas
>
> _______________________________________________
> lwip-users mailing list
> address@hidden <mailto:address@hidden>
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
---
Regards, Sergey
_______________________________________________
lwip-users mailing list
address@hidden <mailto:address@hidden>
https://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users