We use LWIP l.4.l with RAW (no OS). I had to query my PHY's
control/status register to determine the link status... I did this from
main loop (non-interrupt) time. There is also a protocol for requesting
direct PHY access, depending on the uP's interface. Huge PITA, but
entirely necessary for our application. Nothing about LWIP was
involved. If you're using OS you'll have to suspend the LWIP thread(s)
to do this.
--
Stephen Cowell
Project Manager/Engineer
Plasmability LLC
www.plasmability.com
On 10/13/2017 6:48 AM, 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