Ethernet link update

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ethernet link update

972 Views
pietrodicastri
Senior Contributor II

Good morning

I am using the ethernet driver for the K64. The physical device is the DP83848 and it is working.

The initialisation in the SDK 1.1.0 as is,  detects the identity of the link and use the function ENET_HAL_SetRMIIMode

for applying the information detected with the physical device. 

In my understanding there is no way to update the change of link, is the communication is lost, just unplugging the cable. 

Also if the cable is not connected at start up no way to use. 

I think the interrupt of the physical needs to be used for updating the configuration of the MAC every time it is necessary calling again the ENET_HAL_SetRMIIMode... Is there a problem in calling this function repeatedly?

Suggestions??

Thank You

Labels (1)
3 Replies

633 Views
isaacavila
NXP Employee
NXP Employee

Hello Pietro,

There is an API from PHY that can be used instead. The API: PHY_DRV_GetLinkStatus is used to get the link status and for newer KSDK versions, it is used to wait until cable is connected:

    while ((count < ENET_PHY_TIMEOUT) && (!link))
    {
        PHY_GetLinkStatus(ENET, phyAddr, &link);
        if (link)
        {
            /* Get the actual PHY link speed. */
            PHY_GetLinkSpeedDuplex(ENET, phyAddr, &speed, &duplex);
            /* Change the MII speed and duplex for actual link status. */
            config.miiSpeed = (enet_mii_speed_t)speed;
            config.miiDuplex = (enet_mii_duplex_t)duplex;
            config.interrupt = kENET_RxFrameInterrupt;
        }

        count++;
    }

    if (count == ENET_PHY_TIMEOUT)
    {
        LWIP_ASSERT("\r\nPHY Link down, please check the cable connection.\r\n", 0);
    }

You can try to use the same method for your phy and check if this can solve the cable connection event.

I hope this can help you!

Regards,
Isaac

633 Views
pietrodicastri
Senior Contributor II

Thank you Isaac

I see in the version 2 there is a timeout before giving up. 

The problem is what happens if the link is down during the session, and the link is os different type.

Do you think it is safe to reconfigure the MAC run time without any problem??

Thank You

0 Kudos
Reply

633 Views
isaacavila
NXP Employee
NXP Employee

Hello Piertro,

I would prefer to run another function/task that will be checking the status connection as previous snipped. This way, on every iteration you can check if cable is still connected and in case that it won't, then you can omit the section where ethernet communication is performed.

I hope this helps!

Regards,
Isaac