W5100 Problem - DIY Arduino Mega 2560 + DIY Ethernet Shield

Hi everyone!

I am having troubles accessing a custom Atmega2560+W5100 board from the network and would appreciate any tips on what could be wrong and how to proceed on getting it to work properly.

I am currently trying to combine the Arduino Mega 2560 and Arduino Ethernet Shield (+ some other circuits connected to the analog and digital pins of the Atmega2560) onto one single PCB.

I started with the schematics of the Arduino Mega 2560 and the Ethernet Shield, combined them into one (in EAGLE) and connected the MISO, MOSI, SCK, SS and Digital Pin 10 nets just as the ICSP header of the Shield usually does. The MISO, MOSI and SCK lines between the Atmega2560 and the W5100 are not directly connected but can be connected with jumpers. You can find the schematic (without the other circuits I mentioned which should not matter anyway) attached to this post.

The Arduino Mega 2560 part of the board works fine. I bought the PCB from Oshpark, populated it and can program the Atmega2560 (see attached picture). It responds and executes programs as desired.
However, the Ethernet Shield part does not work as I hoped.

In more detail: I think the W5100 chip is running correctly. It lights up the LINK and 100M LEDs when I plug in an Ethernet cable to the RJ45 port. I can also call the Ethernet.begin(mac, ip) function and get back the correct IP when calling the Ethernet.localIP() function. I assume that means the communication between the Atmega2560 and the W5100 is working?
However, I cannot ping or somehow else address the board from the network. (I’ve tried the router with a normal Mega+Ethernet Shield setup and it works.) I am using only the very basic code from the Ethernet library examples and have quite some experience with using the original Ethernet Shield already.

The one thing I am suspicious about is the RJ45 connector. I used one without magnetics, since I could not get one with magnetics. Does anyone have any experience, if this might result in the board not being addressable over the network?

I know one should use an RJ45 connector with magnetics, but could not find one anywhere. Anyone has some experience with these connectors and can point me to somewhere, where I can buy them (I am based in Austria)? It seems impossible to get one equivalent to the one used in the Arduino Ethernet Shield…

It would be great if someone can share some experience with building a W5100 Ethernet Shield and give me some tips on how to check if everything is working. After trying for days, I am getting rather frustrated with the chip and would really appreciate any input on how to check what is working and what could be the cause of the problem of not being able to reach the chip from the network.

Thanks!

board.png

In case the schematic was not attached properly…

Schematic.png.zip (203 KB)

The one thing I am suspicious about is the RJ45 connector. I used one without magnetics, since I could not get one with magnetics. Does anyone have any experience, if this might result in the board not being addressable over the network?

The RJ45 connector needs a transformer.

edit: Here is a link to another thread where OP had the same problem.

SurferTim: The RJ45 connector needs a transformer.

Thanks for the prompt response! So that might cause the problem of the chip registering a LINK (and lighting up the LINK and 100M LEDs) and not being addressable from the network? Any idea where to get a connector, which is compatible - Farnell possibly? I could not find any that matches the one of the Ethernet Shield.

Digi-Key has them. Modular connectors - Jacks with magnetics.

I had a look at the ones Digi-Key is selling but do not really understand what transformer setup I have to look for... Is is enough to have a connector that has 1:1 transformers for the 1+2 and the 3+6 lines of the cable?

I would guess that is correct. They have a part made by Wiznet, the same company that makes the w5100. I would try this one.

The Hanrun HR911105A as found on ENC28J60 boards also has magnetics LEDs built in. I just finished making an Eagle symbol for it over the weekend to use on a custom board. http://www.kosmodrom.com.ua/pdf/HR911105A.pdf MrsCrossroads found a non-ebay source for them as neither digikey or mouser carries them, example: http://www.newegg.com/Product/Product.aspx?Item=9SIA35C19N6174 and more broadly http://www.aliexpress.com/price/hanrun-hr911105a_price.html

HR911105A library. Haven’t tried it out yet, no parts on hand.
Rename to .lbr to use it.

HR911105A_RJ45LEDS.pdf (27 KB)

Thanks for the tips and the links to the RJ45 connectors! I have ordered one with magnetics that I believe has the correct setup of integrated transformers. I’ll try it as soon as it arrives and let you know how it works.

When you get it, post the connector you ordered and if it works.

So I bought this connector from Farnell: 1901301

It looks like it has all the necessary transformers. I attached it and it is still not working. What’s weird is the bahavior of the LINK and 100M LEDs. When no cable is connected, they are off. That’s fine. But when I connect a cable to the connector and a router, they start blinking. Both of them go on and off about every second or so. In some cases, after a while, they stay on. But I still cannot ping the device.

Any ideas what might cause this kind of behavior or problem?

Is the Mega IC communicating with the w5100? Have you tested that part?

As far as I can tell the Atmega2560 is communicating with the W5100. I have tested it by uploading the WebServer sample code, setting an IP to the W5100 by Ethernet.begin(mac, ip) and then reading Ethernet.localIP(). From looking at the library, Ethernet.localIP() actually asks the W5100 for its IP. The IP address is coming back correctly so I assume the µC and the W5100 are communicating correctly. Still, the W5100 is not accessible from the network. My router does not see anything connected and ping does not work...

That is the way to test it. How long does it take from the time you boot up the board until the leds on the RJ45 connector start to blink? Maybe you have a power problem?

Otherwise, it seems you have a problem on the RJ45 side of your w5100.

A power problem might be possible. When I power the board through USB, I get the described behaviour: The LEDs start blinking almost immediately, I'd say within 2-3s of connecting the power. However, when I power the board through ICSP (5V from another Arduino, which in turn is powered by USB), the LEDs stay off (I have not tested if Ethernet.localIP() returns the correct address in that case)...

However, when I power the board through ICSP (5V from another Arduino, which in turn is powered by USB), the LEDs stay off (I have not tested if Ethernet.localIP() returns the correct address in that case)...

That is what I would try. You might want to put the Serial.println(Ethernet.localIP()) call in a for loop and call it a couple (or few) times a second to insure you get the same output every time.

Thanks for the suggestion, I'll try that. Right now, I do not yet have the possibility to debug via the Serial monitor. I will try to get a FTDI module connected and working soon but right now the way I am trying to debug is just setting digital outputs HIGH or LOW depending on the return value of Ethernet.localIP() and measuring the voltage. Not ideal - I know - but better than nothing

You can use the digital outputs. Call the localIP() function every second in the loop function and have it set the digital outputs depending on the return value. If the w5100 loses power, it should reset the internal IP setting to 0.0.0.0, and that would show on the digital outputs.

edit: The serial output would really help with troubleshooting later on when you get it working tho.

Yep, that's what I was planning on doing today - use the digital outputs. Just for further debugging I'd really like to have the possibility of watching the Serial output.

I have a Atmega16U2 setup just like on the original board but cannot get it to be recognized by a computer. I can program its fuses and upload hex files through ICSP but when I connect the USB cable and power it though USB it gets hot. The original plan was to use it to use it as in the original Arduino Mega but since it never gets recognized I'm without Serial monitor for now