Skip to main content
Visitor II
March 6, 2021
Solved

UDP Server not receiving when connecting cable after power-on

  • March 6, 2021
  • 1 reply
  • 1634 views

Hi,

I have an UDP Server on a STM32F407Disc1. It works very good, but when the ethernet cable is already connected when I power on the board.

However, if I connect the cable after powering on the board, UDP Server does not receive any message.

My UDP Server is initiated before the while(1) loop, and I have MX_LWIP_Process() inside this while.

I have also added LWIP_NETIF_LINK_CALLBACK 1 to lwipopts.h and ethernetif_set_link(&gnetif) inside my MX_LWIP_Process function.

Where's the problem? The link status (if connected or not) is detected.

Thanks a lot!

Kind regards.

    This topic has been closed for replies.
    Best answer by Vangelis Fortounas

    Hello

    Define this function that is already weak..

    if DHCP is used add also     dhcp_start(netif); and dhcp_release_and_stop(netif); accordingly

    void ethernetif_notify_conn_changed(struct netif *netif)

    {

     if(netif_is_link_up(netif))

      netif_set_up(netif);

     else

       netif_set_down(netif);

    }

    1 reply

    Visitor II
    March 6, 2021

    Hello

    Define this function that is already weak..

    if DHCP is used add also     dhcp_start(netif); and dhcp_release_and_stop(netif); accordingly

    void ethernetif_notify_conn_changed(struct netif *netif)

    {

     if(netif_is_link_up(netif))

      netif_set_up(netif);

     else

       netif_set_down(netif);

    }

    JCOrtizAuthor
    Visitor II
    March 7, 2021

    I don't use DHCP. I have fixed IP.

    However, that function is the solution. Thanks!