2020-02-25 12:46 AM
I ask the question here too, maybe more people see it. Sorry for the duplicated topic!
I generated a basic LWIP project for NUCLEO-F429ZI board.
I implemented the void ethernetif_notify_conn_changed(struct netif *netif) -function in main.c.
LWIP_NETIF_STATUS_CALLBACK and LWIP_NETIF_LINK_CALLBACK are 1.
The "__weak void ethernetif_notify_conn_changed(struct netif *netif)" implementation in ethernetif.c are commented out.
When I start the project, I can ping the board. But when I disconnect and reconnect the ethernet cable, the link change not detected.
The "ethernetif_notify_conn_changed" function never executed.
Maybe I miss something important?
Can anyone help me?
Thanks!
2020-02-29 06:33 AM
You're missing the fact that almost all ST's code is a non-working bloatware. Look at this:
Your issues are the consequences of flaws described in "lwIP API related" section and probably wrong PHY link status register address/bits.
2020-02-29 03:08 PM
Check for link change should be done as a periodic task, or by interrupt from your PHY.
A periodic check once in 100..500 ms often is enough (see examples).
LwiP does not check link state periodically on its own.
ethernetif_notify_conn_changed is a callback from LwIP if some custom action is needed on interface state changed.
For example if you want to shutdown ETH when interface goes down and start ETH when interface goes up.
-- pa