Go Down

Topic: Mega 2560 with ethernet shield (Read 5703 times) previous topic - next topic

schafon

Aug 15, 2016, 10:04 am Last Edit: Aug 15, 2016, 10:19 am by schafon
Hello!
Im having difficulty connect the shield to the arduino mega.
I've searched the forum for 2 hours and decided to post new topic.
I bought this shield.


And in the arduino org website i've noticed that its not compatible with the mega:
http://www.arduino.org/product/boards/comparative-table

when i searched the forum i saw that many peoples using the 2560 with this shield.

You can see in the picture that i tried to connect the shield SPI (10 , 11 , 12 , 13) pins to the mega SPI pins by this guide :
http://mcukits.com/2009/04/06/arduino-ethernet-shield-mega-hack/

but it doesn't work:


When i upload a simple sketch i get 255.255.255.255 for ip.
In the guide above he wants to change the SPI.h file of the Ethernet library , in my case the SPI.h file doesn't exist in the directory he mentioned.

Id also like to notice that i've connected another version of the Ethernet shield and its working (without any hardware/software hacking).
this is the old shield:



Thank a lot!

pert

And in the arduino org website i've noticed that its not compatible with the mega:
http://www.arduino.org/product/boards/comparative-table
Those charts don't say anything like that. In fact if you hover your mouse pointer over the picture of the shield on the products page a compatibility chart pops up that specifically states it's compatible with Mega.

You can see in the picture that i tried to connect the shield SPI (10 , 11 , 12 , 13) pins to the mega SPI pins by this guide :
http://mcukits.com/2009/04/06/arduino-ethernet-shield-mega-hack/

but it doesn't work:

You're following a tutorial from 7 years ago for a completely different shield. These shields connect via the ICSP header so they are compatible with the Uno and Mega pinout. Just plug the thing in like any other shield, you're making this way more complicated than it needs to be.

In the guide above he wants to change the SPI.h file
Again, tutorial from 7 years ago, that information is completely obsolete.

When i upload a simple sketch i get 255.255.255.255 for ip.
...
the Ethernet library
And there's your problem.

The Ethernet Shield 2 uses the W5500 Ethernet controller chip instead of the W5100 chip on the Ethernet Shield. The Ethernet library is not compatible with the W5500. If you're using the arduino.org IDE then you can just change the line:
Code: [Select]
#include <Ethernet.h>
 to:
Code: [Select]
#include <Ethernet2.h>
If you're using the arduino.cc (this website) IDE, which I would highly recommend, then you only need to install an Ethernet library that supports the W5500. There are a few choices:

Ethernet2 library - this is the same library included with the arduino.org IDE

EthernetMod W5x00 branch - This supports W5100, W5200, and W5500 without needing any modifications
https://github.com/per1234/EthernetMod/tree/W5x00 follow the installation instructions on that page, you don't need to make any changes to your current sketch.

Wiznet Ethernet Library - https://github.com/Wiznet/WIZ_Ethernet_Library this is already set up to support the W5500 but unlike the other two libraries you need to do a manual installation so let me know if you want to use that one and need help with installation.

schafon

Hi again.
I tried Ethernet2 library before posting and it wasn't working.

Now i installed the seconed library that you gave me(didnt try the others) and its F***ing working!!!!
thank you so much!
your answer is full and covered everything.
BTW im using arduino ide from this website :)

Thanks again!

pert

Glad to hear it's working! Thanks for reporting what worked for you. I also use the 2nd library, it's nice to be able to switch between the two shield versions without needing to change the sketch.. I've only done a quick test with the Ethernet2 library a long time ago so I'm not sure what's going on with that one.

Thanks for reporting on what worked for you. That's helpful for anyone else who finds your post while encountering the same issue.

japa

Thanx's pert, know this is an older post but this assisted me with R3 boards.

Go Up