Trouble getting 0022 and the Ethernet and EthernetDHCP to play nicely

Hello Folks,

I am sure that there is a simple solution to this problem but searching the forums has not helped me much. I have a windows XP SP3 installation with the Arduino 0022 package installed. I am also using the VIsual Studio 2008 plug-in (visual micro) to write and compile my sketches with.

Most of the time everything goes well but when I include the Ethernet and DHCPEthernet libs with SPI it all goes wrong when compiling. If I move it all back to 0017 and compile it through the Arduino IDE everything seems to compile OK the trouble I have is that I have some libs that I need to include in my sketch that are only for 0022, and a few of the standard libs seem to only exist in 0022 like the string class lib.

So my question is ... Am I alone here of if someone else has had the same issues, did they resolve them and if so how ?

Cheers Pete.

As far as I know, the latest IDE that supports DHCP is 018. Simply compile your code using an older IDE

Thanks for the reply. i have rolled back my version of arduino IDE to 0018 however i am not getting the following errors.

I am sure this is an IDE/compiler issue but i cant figure it out.

1>.\_vsAddIn\_build\core.a(EthernetDHCP.cpp.o): In function `EthernetDHCPClass::_processDhcpReply()':
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:338: undefined reference to `ethutil_htonl'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:340: undefined reference to `ethernet_compat_read_SnRX_RSR(int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:351: undefined reference to `ethernet_compat_read_SnRX_RD(int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:355: undefined reference to `ethernet_compat_read_data(int, unsigned char*, unsigned char*, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:359: undefined reference to `ethutil_ntohs'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:360: undefined reference to `ethutil_ntohs'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:362: undefined reference to `ethernet_compat_read_data(int, unsigned char*, unsigned char*, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:364: undefined reference to `ethutil_ntohl'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:371: undefined reference to `ethernet_compat_read_data(int, unsigned char*, unsigned char*, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:382: undefined reference to `ethernet_compat_read_data(int, unsigned char*, unsigned char*, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:412: undefined reference to `ethutil_ntohl'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:415: undefined reference to `ethutil_ntohl'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:418: undefined reference to `ethutil_ntohl'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:439: undefined reference to `ethernet_compat_write_SnRX_RD(int, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:440: undefined reference to `ECSnCrSockRecv'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:440: undefined reference to `ethernet_compat_write_SnCR(int, unsigned char)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:442: undefined reference to `ethernet_compat_read_SnCR(int)'
1>.\_vsAddIn\_build\core.a(EthernetDHCP.cpp.o): In function `EthernetDHCPClass::_sendDhcpMessage(_DhcpMessageType_t)':
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:195: undefined reference to `ethernet_compat_read_SnTX_WR(int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:210: undefined reference to `ethutil_htonl'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:212: undefined reference to `ethutil_htons'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:213: undefined reference to `ethutil_htons'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:220: undefined reference to `ethernet_compat_write_data(int, unsigned char*, unsigned char*, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:228: undefined reference to `ethernet_compat_write_data(int, unsigned char*, unsigned char*, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:236: undefined reference to `ethutil_htonl'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:237: undefined reference to `ethernet_compat_write_data(int, unsigned char*, unsigned char*, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:244: undefined reference to `ethernet_compat_write_data(int, unsigned char*, unsigned char*, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:251: undefined reference to `ethernet_compat_write_data(int, unsigned char*, unsigned char*, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:253: undefined reference to `ethernet_compat_write_data(int, unsigned char*, unsigned char*, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:262: undefined reference to `ethernet_compat_write_data(int, unsigned char*, unsigned char*, unsigned int)'
1>.\_vsAddIn\_build\core.a(EthernetDHCP.cpp.o):c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:264: more undefined references to `ethernet_compat_write_data(int, unsigned char*, unsigned char*, unsigned int)' follow
1>.\_vsAddIn\_build\core.a(EthernetDHCP.cpp.o): In function `EthernetDHCPClass::_sendDhcpMessage(_DhcpMessageType_t)':
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:313: undefined reference to `ethernet_compat_write_SnTX_WR(int, unsigned int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:314: undefined reference to `ECSnCrSockSend'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:314: undefined reference to `ethernet_compat_write_SnCR(int, unsigned char)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:316: undefined reference to `ethernet_compat_read_SnCR(int)'
1>.\_vsAddIn\_build\core.a(EthernetDHCP.cpp.o): In function `EthernetDHCPClass::_closeDHCPSession()':
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:170: undefined reference to `ethernet_compat_close(int)'
1>.\_vsAddIn\_build\core.a(EthernetDHCP.cpp.o): In function `EthernetDHCPClass::_startDHCPSession()':
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:138: undefined reference to `ECSockClosed'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:139: undefined reference to `ECSnMrUDP'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:138: undefined reference to `ethernet_compat_read_SnSr(int)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:139: undefined reference to `ethernet_compat_socket(int, unsigned char, unsigned int, unsigned char)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:154: undefined reference to `ethernet_compat_write_SnDIPR(int, unsigned char*)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:157: undefined reference to `ethernet_compat_write_SnDPORT(int, unsigned int)'
1>.\_vsAddIn\_build\core.a(EthernetDHCP.cpp.o): In function `EthernetDHCPClass::poll()':
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:544: undefined reference to `ethernet_compat_write_SIPR(unsigned char*)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:545: undefined reference to `ethernet_compat_write_GAR(unsigned char*)'
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:546: undefined reference to `ethernet_compat_write_SUBR(unsigned char*)'
1>.\_vsAddIn\_build\core.a(EthernetDHCP.cpp.o): In function `EthernetDHCPClass::begin(unsigned char*, int)':
1>c:\Arduino\libraries\EthernetDHCP/EthernetDHCP.cpp:112: undefined reference to `ethernet_compat_init(unsigned char*, unsigned char*, unsigned int)'
1>.\_vsAddIn\_build\core.a(EthernetDNS.cpp.o): In function `EthernetDNSClass::_closeDNSSession()':
1>c:\Arduino\libraries\EthernetDNS/EthernetDNS.cpp:126: undefined reference to `ethernet_compat_close(int)

Cheers Pete.

Here is what I did for Arduino version 22:

I downloaded Ethernet-DHCP-DNS.tar.gz from http://www.mcqn.com/weblog/dhcp_and_dns_arduino

I moved it into my arduino-0022 libraries folder and unzipped it from there. It writes some new files into the Arduino Ethernet directory and examples subdirectories. See Footnote.

For Windows, if you don't have the GNU tar and gzip utilities you might want get Ethernet-DHCP-DNS.zip from that site.

Anyhow...

I have seen no problems running the examples or using DHCP and DNS for various things on my systems (Arduino Uno, Arduino Duemilanove, Arduino Mega1280). I have done stuff like getting NTP time from pool.ntp.org to synchronize my RTC, for example. (That's the gentleperson's way of doing it rather than using---and propagating---code with a fixed IP address for the time server.)

Regards,

Dave

Footnote:
If you are squeamish about overwriting files in the Arduino distribution Ethernet library, simply copy the original Ethernet (and subdirectory) files somewhere else so that you can restore them if the new stuff "doesn't work out." Or, worst case, just re-install arduino-0022.