5
\$\begingroup\$

I have an Arduino Duemilanove (ATmega328) and Ethernet shield (based on the WizNet W5100). My network gateway is a D-Link DSL-G604T.

Using this setup, I can contact computers on my local network fine. However, when I attempt to contact computers on the public Internet, the device times out. I traced the packets going back and forward using Wireshark and the problem appears to be that the gateway is not responding to the W5100's ARP request.

I saved the ARP packet that the W5100 is sending and the ARP packet that my computer is sending and compared them. The only thing different is that it is not a timestamp, address, length or sequence number that the W5100 is sending a trailer at the end of the Ethernet II frame.

According to RFC 1122 - Requirements for Internet Hosts - Communication Layers, section 2.3.1, a trailer may only be used if both hosts have previously agreed to use them. I suspect that my gateway is not able to handle trailers and is ignoring the packet.

Is there a way to disable trailers in the W5100?

Here are the ARP packets that are sent by a computer on my network that is able to make Internet connections and the Arduino device. I have also provided a diff of the two packets. In the case of the packet that is sent by the computer, the gateway responds, in the case of the packet sent by the Arduino, the gateway does not respond. Note that I have changed the hardware addresses, but that's all.

\$\endgroup\$
3
\$\begingroup\$

Are you sure that the trailer isn't just there to pad the packet to the appropriate size, or as some form of CRC checksum?

In fact, looking at the RFC it looks to me like a host, which wishes to use trailers, would send the trailer request during ARP, and if the other host understands trailers then it will add it to its list of hosts which understand and use trailers. Therefore in theory it wouldn't be the trailer which was causing your problem. However, I can't categorically rule it out as this is based on my memories of my networking course and a superficial reading of the RFC you linked to and Wikipedia.

\$\endgroup\$
  • \$\begingroup\$ Hi Amos, Thanks for your comments. When I started debugging this problem I ignored the trailer as I thought that it was not relevant, but when I cleared the ARP cache on my computer and took a new copy of the packets moving across the network I realized that the trailer was the only thing that I could imagine being relevant that was different between the 2 packets. I've updated the question with a copy of each packet and a visual diff. thanks Hamish \$\endgroup\$ – Hamish Currie Dec 9 '09 at 4:35
  • \$\begingroup\$ According to a thread here: edaboard.com/ftopic317401.html a user with a similar problem to yours traced it to the following: "And I found the problem!!! It seems that the MAC address is more than just an address. It actually contains information about the device and type of broadcasts. Seems that the switch didnt like multicast messages" I don't know if that helps at all. \$\endgroup\$ – Amos Dec 9 '09 at 10:28
  • \$\begingroup\$ Does your ethernet shield come with a mac address or do you have to create one yourself for it? \$\endgroup\$ – Amos Dec 9 '09 at 12:27
  • \$\begingroup\$ The ethernet shield does not come with a MAC - I use a microchip 24AA02E48 to obtain a unique MAC and initialize the networking code with that value. I have collected the MAC addresses from a couple of computers on my local network and tried setting the MAC to those values (after turning the computers off to ensure that there were no collisions) I am still getting the same problem. \$\endgroup\$ – Hamish Currie Dec 10 '09 at 11:27
1
\$\begingroup\$

Wiznet have stated that it is not possible to disable the trailers.

http://wiznet.co.kr/rg4_board/view.php?&bbs_code=en_qna&bd_num=21321

\$\endgroup\$
  • \$\begingroup\$ To me that implies that the trailers are not the problem. \$\endgroup\$ – Amos Dec 10 '09 at 11:47
  • \$\begingroup\$ As surely unless you have some bizarre setup for your gateway, lots of other people would be having this problem. \$\endgroup\$ – Amos Dec 10 '09 at 11:48
  • \$\begingroup\$ Right. Rather than trying to pin down whether there is an error in your setup or code, I suggest that you find an example of using an ethernet shield with an Arduino from the internet and see if that will work. There's one which uses the Twitter library from the arduino website: arduino.cc/playground/Code/TwitterLibrary Or there's one from the arduino forums here: arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1234028200/1 although you may need to read the whole thread to get it working. Other than that, find someone who'll let you try connecting your kit to their network. \$\endgroup\$ – Amos Dec 10 '09 at 12:26
  • \$\begingroup\$ If it works then we know it's your code, if it doesn't then we know it's your setup. If you can get it to work on someone elses network then we know that it's your network, etc. \$\endgroup\$ – Amos Dec 10 '09 at 12:56
  • 1
    \$\begingroup\$ You were right - trailers are not the problem. The problem was there there was a bug in my code which meant I was connecting to the wrong port and that I didn't realize that my computer was not receiving all of the packets on the network. (Probably because i'm using a router not a hub) I'll try to verify this by putting my computer and the arduino onto a hub together and making sure that wireshark can see all of the packets. Sorry for the mistake - I try to debug problems as much as possible before posting but I misunderstood what wireshark was showing m in this case. Hamish \$\endgroup\$ – Hamish Currie Dec 17 '09 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.