LwIP not entering callback when ethernet cable (dis)connected
NUCLEO-F767ZI
I'm trying to use the LwIP middleware which I have enabled in MX.
First I'm trying to check if an ethernet cable is attached or not. I have setup UART3 to use printf (which works as expected)
I've set the callback in lwip.c to print when the cable is removed or plugged in or so I thought but I get no message when I connect or disconnect the cable. The LEDs on the socket light up when the cable is connected, so the board at some level does see the cable. What am I missing here?
EDIT:: LWIP_NETIF_LINK_CALLBACK was enabled in MX
// In main.c
MX_LWIP_Init();
/* USER CODE BEGIN WHILE */
while (1)
{
MX_LWIP_Process();
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
// In lwip.c the callback function that is registered in MX_LWIP_Init()
static void ethernet_link_status_updated(struct netif *netif)
{
if (netif_is_up(netif))
{
/* USER CODE BEGIN 5 */
printf("Cable connected\r\n");
/* USER CODE END 5 */
}
else /* netif is down */
{
/* USER CODE BEGIN 6 */
printf("Cable NOT connected\r\n");
/* USER CODE END 6 */
}
}
