[En-Nut-Discussion] DHCP

Michael Hellwig farwest at gmx.de
Fri Dec 2 00:26:36 CET 2011

Harald Kipp schrieb:
> Hi Ulrich,
> On 28.11.2011 23:39, Ulrich Prinz wrote:
>> Could be that it is related to the same problem as connection
>> recognition is. The stack doesn't see if the connection is broken and so
>> it cannot take any measurements to restart.
> DHCP is connection-less.
>> Am 28.11.2011 21:15, schrieb Michael Hellwig:
>>> updated my program accordingly and found that the lease I got is not
>>> renewed. After 8hrs the ethernuts are not responding anymore and I have
>>> to restart them. There is no hardcoded IP-address in the eeprom and I
>>> tried several example codes to no avail.
> Quite some time ago that we've tested the lease time renewal. But there
> hadn't been many changes in this area, so it should still work.
>>> Is anybody out there using DHCP with NutOS successfully?
>>> Im using Nut/OS
> We prefer to use DHCP and it works very well. Umhh... almost, except...
> Depending on the compiler/linker version, the stack space that is
> allocated for the DHCP client may be too small.
> Change to ethernut-x.y/nutbld, add
> to UserConf.mk and run
>  make clean all install
> I assume, that your toolchain binaries are reachable from the PATH
> environment.
> Regards,
> Harald
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion


just to be sure, I tested today with a clean install of the toolchain, 
only enabled NUTDEBUG in pro/dhcpc.c and started the webdemo from 
basemon. Im working under Ubuntu with avr-gcc (GCC) 4.3.4.
Here's the output that I get:

BaseMon 4.2.0
Compiled by AVRGCC for ATmega128
Baudrate select = 95
External RAM Test... 28416 bytes
Banked RAM Test...   none
Serial FLASH...      0 bytes
Detecting NIC...     RTL8019AS
Testing NIC...       OK
I/O Port Test...     OK

Press any of the following keys:
     B - Send broadcasts
     E - Ethernet controller read/write
     J - Jump to bootloader
     S - SRAM read/write
     X - Exit BaseMon, configure network and start WebServer

MAC address (00069801101A):
Host name (nn18004):
IP address (
Using DHCP or ARP method (Y):

[1.DHCP-REBOOTING][DHCP-Send to][DHCP-Recv Timeout 4000]
[2.DHCP-REBOOTING][DHCP-Send to][DHCP-Recv Timeout 8000]
[3.DHCP-REBOOTING][DHCP-Send to][DHCP-Recv from 
[4.DHCP-BOUND 12][DHCP-Config]MAC  00-06-98-01-10-1A
HTTP server running. URL

[1.DHCP-BOUND 640]

After 640 seconds the dhcpc-thread reaches line 1476 and doesn't
recover from the idle state anymore.

             if (dhcpApiTimeout <= tt) {
                 dhcpError = DHCPERR_TIMEOUT;
                 dhcpState = DHCPST_IDLE;

The lease is still valid for about 8hrs, but it is not renewed.

In earlier tests I already increased NUT_THREAD_DHCPSTACK to 512, but it 
didn't help. Though I have a little relief now, because our network guys 
made an exception for the ethernuts, it would be cool to have dhcp 
working. Next I will setup an own dhcp-server with a short lease-time 
for testing and see if the problem persists.


More information about the En-Nut-Discussion mailing list