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 );
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.
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.net_p_free
rtos_discussion_382005_thread_a3d9f566_-3Flimit-3D250-233ebe&d=DwMCAg&c=VlVW
iTf6NLcRnQ6UE9A3gtZ_d8K8tB_QlazTgpkF1UI&r=I8W7X9UdiYUoP79S5qYphNd5H_gskbTn2C
nU21oOZiE&m=SxdnWzQz41RCaUsUsPraD75CATB1MXw3_pD3Qe0jq50&s=yiNF8KswoFUli2Pgzf
n2ZV5WGzMxS6yd_j4CT3pfa5A&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.net_p_free
rtos_discussion_382005_thread_318174e2c3_-3Flimit-3D250-235ca1&d=DwMCAg&c=Vl
VWiTf6NLcRnQ6UE9A3gtZ_d8K8tB_QlazTgpkF1UI&r=I8W7X9UdiYUoP79S5qYphNd5H_gskbTn
2CnU21oOZiE&m=SxdnWzQz41RCaUsUsPraD75CATB1MXw3_pD3Qe0jq50&s=rPpzsZDdRmVr1qR1
144sYekfSMYW_5CwwFYYtUptsTU&e=>