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 <callto:%2831%29%203395-1180>/
/gustavo.co...@tapeletro.com <mailto:gustavo.co...@tapeletro.com>/
2017-10-12 12:24 GMT-03:00 Jens Nielsen <d...@telia.com
<mailto:d...@telia.com>>:
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
lwip-users@nongnu.org <mailto:lwip-users@nongnu.org>
https://lists.nongnu.org/mailman/listinfo/lwip-users
<https://lists.nongnu.org/mailman/listinfo/lwip-users>
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users