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: Andrea Visinoni
Subject: Re: [lwip-users] board hangs using dhcp
Date: Fri, 19 Mar 2010 08:44:17 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.9.1.8) Gecko/20100227 Lightning/1.0b1 Thunderbird/3.0.3

Thank you for your hints, i'll work on it!

Il 17/03/2010 19.24, address@hidden ha scritto:
Andrea Visinoni wrote:
Switching to lwip 1.3.2 solved the issue running the same code.
You're still violating threading requirements then, and can be lucky it
works. You might run into problems with that later because two threads
are active in the lwIP code at the same time, which is not supported. If
you don't want to change that, I can't make you to, I can only repeat
myself and tell you that the code below is *not* safe!

Leaving away the calls to dhcp_fine_tmr and dhcp_coarse_tmr and only
sleeping should work, too: the timer functions should be called by the
tcpip_thread already.

Simon

Il 04/03/2010 16.13, address@hidden ha scritto:
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



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


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




_______________________________________________
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]