lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] board hangs using dhcp


From: address@hidden
Subject: Re: [lwip-users] board hangs using dhcp
Date: Thu, 04 Mar 2010 16:13:52 +0100
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

It seems you are violating threading requirements: calling the netif_* and dhcp_* functions from any other thread than the tcpip_thread is not allowed! And if the code below *would* run in that thread context, it would block RX-packets: the tcpip_thread must process incoming packets from its mbox.

If you are running multithreaded, you have to use tcpip_callback to get into the tcpip_thread and call dhcp_start from there. Also, the timer functions will get called automatically by the tcpip_thread, so there's no need to call them on your own.

Simon


Andrea Visinoni wrote:
Hi,
i have a simple webserver task on my custom board (at91sam7x256) using
freertos and lwip 1.2.0.
Using static ip i have no problems, but using dhcp my board hangs after
the very first send (using socket api or netconn_write...same problem).
The port is open, the connection is accepted, but when i start sending
data to client in several sends, only the first one succeed.

this is my dhcp start code:

IP4_ADDR(&xIpAddr,0,0,0,0);
IP4_ADDR(&xNetMast,0,0,0,0);
IP4_ADDR(&xGateway,0,0,0,0);

netif_add(&EMAC_if,&xIpAddr,&xNetMast,&xGateway, NULL,
ethernetif_init, tcpip_input);

// make it the default interface
netif_set_default(&EMAC_if);

// Avvio DHCP
dhcp_start(&EMAC_if);

// DHCP negotiation
int mscnt = 0;
while (EMAC_if.ip_addr.addr == 0)
{
      sys_msleep(DHCP_FINE_TIMER_MSECS);
      dhcp_fine_tmr();
      mscnt += DHCP_FINE_TIMER_MSECS;
      if (mscnt>= DHCP_COARSE_TIMER_SECS * 1000)
      {
          dhcp_coarse_tmr();
          mscnt = 0;
      }
}

Any hints?

Best regards
Andrea


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users






reply via email to

[Prev in Thread] Current Thread [Next in Thread]