lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] LWIP v2.0.0 hangs without Phy


From: Jens Nielsen
Subject: Re: [lwip-users] LWIP v2.0.0 hangs without Phy
Date: Fri, 13 Oct 2017 16:20:42 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Hi Gustavo

You're missing one very important point, that is below lwip is a part that you are responsible for, this is the "driver" and it is not a part of lwip. This part handles among other things the link status and should notify lwip if it changes. Your callbacks are probably not called because your driver doesn't notify lwip of the link status.

All your issues are in the driver part and there is nothing anyone here can do about it, unless maybe if you share your driver or at least let us know which one you're using you can get a kind soul to have a look at it. I'm guessing though that you got your driver packaged together with lwip from a third party, that would be a better place to ask for help.

Best regards
Jens

On 2017-10-13 13:48, Gustavo Costa TAP wrote:
Hi Jens,

thank you for your colaboration. Is it possible that you share if me your fix? I am trying not to reinvent the wheel. 

As I said to Simon, I am trying to use the LWIP_NETIF_LINK_CALLBACK and LWIP_NETIF_STATUS_CALLBACK functions to keep track of the Phy Link, but these functions never gets called, even if I disconnect the cable.

My demicode is as below:

#if LWIP_NETIF_STATUS_CALLBACK
void status_callback(void) {
LED_BLUE_TOGGLE();
}
#endif /* LWIP_NETIF_STATUS_CALLBACK */
#if LWIP_NETIF_LINK_CALLBACK
void link_callback(void) {
if (netif_is_link_up(&fsl_netif0)) {  //DES link up blink fast
LED_GREEN_ON();
dhcp_start(&fsl_netif0);
netif_set_up(&fsl_netif0);
} else {
LED_GREEN_OFF();
dhcp_stop(&fsl_netif0);
netif_set_down(&fsl_netif0);
}
}
#endif /* LWIP_NETIF_LINK_CALLBACK */

-------------------------------------------------------------------

        PRINTF("TCP/IP initializing...\r\n");
tcpip_init(NULL, NULL);
PRINTF("TCP/IP initialized.\r\n");

xSemaphoreENET = xSemaphoreCreateBinary();

while (netif_add(&fsl_netif0, &fsl_netif0_ipaddr, &fsl_netif0_netmask,
&fsl_netif0_gw,
NULL, ethernetif_init, tcpip_input) == NULL) {

netif_remove(&fsl_netif0);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}

WDOG_Refresh(WDOG);

netif_set_default(&fsl_netif0);
netif_set_up(&fsl_netif0);

#if LWIP_NETIF_STATUS_CALLBACK
netif_set_status_callback(&fsl_netif0, status_callback);
#endif /* LWIP_NETIF_STATUS_CALLBACK */
#if LWIP_NETIF_LINK_CALLBACK
netif_set_link_callback(&fsl_netif0, link_callback);
#endif /* LWIP_NETIF_LINK_CALLBACK */

err = dhcp_start(&fsl_netif0);

---------------------------------------------------------------------------------------

Thank you very much.

Best Regards,


 


Gustavo Costa
Engenheiro Eletricista

Departamento de P&D

Tap Eletro Sistemas Ltda.

(31) 3395-1180/9 8769-8593

address@hidden







2017-10-12 12:24 GMT-03:00 Jens Nielsen <address@hidden>:
Yes I fixed this particular problem in a driver recently, it was waiting for autonegotiation to complete. 6th parameter to netif_add is a function pointer to an init function in your code, that's where you'll find your bug.

On 2017-10-12 10:33, Simon Goldschmidt wrote:
When the "netif_add" api is called without the cable being actually plugged the function just hangs and my wdog barks.
Now this can't be an lwIP bug: lwIP knows nothing of phys. That is part of your netif driver, which probably needs fixing.



_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]