|
From: | Noam Weissman |
Subject: | Re: [lwip-users] DHCP fails ? |
Date: | Tue, 9 May 2017 21:32:17 +0000 |
Hi,
I will try to explain it better.
The base code was taken from an ST example. I basically took their DHCP client code and modified it
to suit my needs.
So in that respect I was not aware that I am doing something wrong 😞
The DHCP client is basically a task that calls dhcp_start, dhcp_stop etc..
After calling dhcp_start the task delays for some time, checks DHCP state etc...
If DHCP gets an address in a predefined time frame the task goes address assigned state and then to idle state. If DHCP address is not received it about 10 seconds the DHCP task declares timeout...
The link task is a separate task that checks the ETH PHY link status. If the link task finds a change in
link state it does the following.
If link state changes from up to down it forces the DHCP task to go to idle. If link is up again, it forces the DHCP task to check for new address again.
I did find a bug in the original ST code. The bug was that once DHCP got an address the original
code issued a call to dhcp_stop... This caused LwIP own code to fail to renew its address once 1/2 T happened.
----------------------------------------------------
The above worked with several devices with LwIP 1.41
For some reason the same code fails to work the same with LwIP 2.02
I hope now it is clear.
BR, Noam.
From: lwip-users <lwip-users-bounces+address@hidden> on behalf of address@hidden <address@hidden>
Sent: Tuesday, May 9, 2017 10:11 PM To: Mailing list for lwIP users Subject: Re: [lwip-users] DHCP fails ? Noam Weissman wrote:
> I have a simple link task that checks the PHY for link, reads it. If > link is up it starts the DHCP task and wait for address. > > If link is down the DHCP task is put into an idle state and waits for > link to come back… > > [..] > > When board is reset, link is established and at the DHCP task this > code returns with NULL ? > > dhcp = (struct dhcp > *)netif_get_client_data(pDHCP_TaskParams->netif, > LWIP_NETIF_CLIENT_DATA_INDEX_DHCP); > Honestly, from how you write it, that sounds like a threading issue. You must not use that function (as many others) from any other context than tcpip_thread! > Just to point out that this setup works for several years on several > devices and never had any problems The fact that it works on 1.4.1 (what's 1.41?) does *NOT* mean anything. The code could be wrong and just work by chance... Maybe I haven't understood your setup correctly. In that case, please try to describe it better :-) Simon _______________________________________________ lwip-users mailing list address@hidden https://lists.nongnu.org/mailman/listinfo/lwip-users
|
[Prev in Thread] | Current Thread | [Next in Thread] |