Ethernet link-on-status on a Zynq not recognized

Hello, when testing exceptional conditions with the Ethernet communication on a Zynq I found out a small inconvenience. The tested condition is: Pull the cable during an existing connection and plug it in after a while. In ‘NetworkInterface.c’ inside prvEMACHandlerTask() it is recognized after 15 seconds, that the cable is pulled. The debug-message “prvEMACHandlerTask: PHY LS now 0” is written and the check-timeout is set to a short time, 1 second. When the cable is plugged in again and a packet is received before the ulPHYLinkStatus is read, the timeout will be set to 15 seconds. And if then within 15 seconds a new packet is received, the link-status will never be reset again to the correct value. So I added a small piece of code at the place where a packet was received to solve this nasty situation: if( xResult > 0 ) { /* A packet was received. No need to check for the PHY status now, but set a timer to check it later on. / vTaskSetTimeOutState( &xPhyTime ); xPhyRemTime = pdMS_TO_TICKS( PHY_LS_HIGH_CHECK_TIME_MS ); xResult = 0; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// / If ulPHYLinkStatus was set to off previously, the status has to be checked again. * Otherwise ulPHYLinkStatus would never be set to on, if a packet is received during timeout. */ if( ( ulPHYLinkStatus & BMSR_LINK_STATUS ) == 0 ) { xStatus = ulReadMDIO( PHY_REG_01_BMSR );
            if( ( ulPHYLinkStatus & BMSR_LINK_STATUS ) != ( xStatus & BMSR_LINK_STATUS ) )
            {
                ulPHYLinkStatus = xStatus;
                FreeRTOS_printf( ( "prvEMACHandlerTask: PHY LS now %dn", ( ulPHYLinkStatus & BMSR_LINK_STATUS ) != 0 ) );
            }
        }
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    }
Maybe that this problem occurs only under special conditions, which I have, and maybe that a better code could be used, but as a fast change the addition helped. The link off is seen after 15 seconds, and the link on is recognized immediately. Greetings, Johannes

Ethernet link-on-status on a Zynq not recognized

Hi Johannes, I’m sorry to discover that the current release of portable/NetworkInterface/Zynq/NetworkInterface.c still have this problem. Here you find an alternative solution for the problem that you encountered.

Ethernet link-on-status on a Zynq not recognized

Hi Hein, Thanks for your reply, and sorry, that I didn’t remember your advice regarding the patch given one year before. 🙂 From: Hein Tibosch [mailto:heinbali01@users.sourceforge.net] Sent: Monday, January 28, 2019 5:24 PM To: [freertos:discussion] 382005@discussion.freertos.p.re.sourceforge.net Subject: [freertos:discussion] Ethernet link-on-status on a Zynq not recognized Hi Johannes, I’m sorry to discover that the current release of portable/NetworkInterface/Zynq/NetworkInterface.c still have this problem. Here <https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.netpfree rtosdiscussion382005threada3d9f566-3Flimit-3D250-233ebe&d=DwMCAg&c=VlVW iTf6NLcRnQ6UE9A3gtZd8K8tBQlazTgpkF1UI&r=I8W7X9UdiYUoP79S5qYphNd5HgskbTn2C nU21oOZiE&m=SxdnWzQz41RCaUsUsPraD75CATB1MXw3pD3Qe0jq50&s=yiNF8KswoFUli2Pgzf n2ZV5WGzMxS6ydj4CT3pfa5A&e=> you find an alternative solution for the problem that you encountered.
Ethernet link-on-status on a Zynq not recognized <https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.netpfree rtosdiscussion382005thread318174e2c3-3Flimit-3D250-235ca1&d=DwMCAg&c=Vl VWiTf6NLcRnQ6UE9A3gtZd8K8tBQlazTgpkF1UI&r=I8W7X9UdiYUoP79S5qYphNd5HgskbTn 2CnU21oOZiE&m=SxdnWzQz41RCaUsUsPraD75CATB1MXw3pD3Qe0jq50&s=rPpzsZDdRmVr1qR1 144sYekfSMYW5CwwFYYtUptsTU&e=>
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/freertos/discussion/382005/ <https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.netpfree rtosdiscussion382005&d=DwMCAg&c=VlVWiTf6NLcRnQ6UE9A3gtZd8K8tBQlazTgpkF1 UI&r=I8W7X9UdiYUoP79S5qYphNd5HgskbTn2CnU21oOZiE&m=SxdnWzQz41RCaUsUsPraD75CA TB1MXw3pD3Qe0jq50&s=4PiizdO7488QFmJdefGXMbaAyWnQ2KmaAn8EndJb98&e=> To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/ <https://urldefense.proofpoint.com/v2/url?u=https-3A__sourceforge.netauths ubscriptions&d=DwMCAg&c=VlVWiTf6NLcRnQ6UE9A3gtZd8K8tBQlazTgpkF1UI&r=I8W7X 9UdiYUoP79S5qYphNd5HgskbTn2CnU21oOZiE&m=SxdnWzQz41RCaUsUsPraD75CATB1MXw3_pD 3Qe0jq50&s=zMXmNww2kXjVOBal8bwJ4r-L0hlooAShiEGzCMeG8vY&e=>