Go Down

Topic: W5200 ETHERNET SHIELD compatibily problems (Read 7912 times) previous topic - next topic


I purchased a w5200 Ethernet shield by ekitszone    - i am using an UNO ver R3 and ide.10

They indicated it is 100 percent compatible with current W5100 shield Ethernet library

When i compile with the current original ethernet library using the w5100 shield - all works fine - compiles and Ethernet allows a connection.
When i install the W5200,it compiles but Ethernet does not work.

I was told to replace the 2 files in the arduino Ethernet library utility dir with 2 new files w5100.h and w5100.cpp - when i do this my pgm no longer compiles.

Anyone have any ideas to a solution??



Anyone have any ideas to a solution??

Strangely enough,, yes..

Post the new code,, and the error messages.. Then,, we'll have some idea what you are talking about..

Does the double punctuation help,, in any way??
The art of getting good answers lies in asking good questions.


Apr 21, 2012, 04:02 pm Last Edit: Apr 21, 2012, 04:20 pm by joeman Reason: 1

Yes the ?? makes it stick out more..... thanks for asking

These are the Compile errors i get when i put in the new 5100.cpp and 5100.h files in the dir utility

C:\ARDUINO\arduino-1.0\libraries\Ethernet\utility\socket.cpp: In function 'uint16_t bufferData(SOCKET, uint16_t, const uint8_t*, uint16_t)':
C:\ARDUINO\arduino-1.0\libraries\Ethernet\utility\socket.cpp:357: error: 'class W5100Class' has no member named 'send_data_processing_offset'

The errors occur on my code or any other of several example sketches.
As soon as I put back the original 5100.cpp and 5100.h files -  it compiles but w5200 will not communicate

Below is one of the example codes which produces the compile errors indicated above.

Code: [Select]
 Web Server

A simple web server that shows the value of the analog input pins.
using an Arduino Wiznet Ethernet shield.

* Ethernet shield attached to pins 10, 11, 12, 13
* Analog inputs attached to pins A0 through A5 (optional)

created 18 Dec 2009
by David A. Mellis
modified 4 Sep 2010
by Tom Igoe


#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 139);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(90);

void setup()
 // start the Ethernet connection and the server:
 Ethernet.begin(mac, ip);

void loop()
 // listen for incoming clients
 EthernetClient client = server.available();
 if (client) {
   // an http request ends with a blank line
   boolean currentLineIsBlank = true;
   while (client.connected()) {
     if (client.available()) {
       char c = client.read();
       // if you've gotten to the end of the line (received a newline
       // character) and the line is blank, the http request has ended,
       // so you can send a reply
       if (c == '\n' && currentLineIsBlank) {
         // send a standard http response header
         client.println("HTTP/1.1 200 OK");
         client.println("Content-Type: text/html");

         // output the value of each analog input pin
         for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
           client.print("analog input ");
           client.print(" is ");
           client.println("<br />");
       if (c == '\n') {
         // you're starting a new line
         currentLineIsBlank = true;
       else if (c != '\r') {
         // you've gotten a character on the current line
         currentLineIsBlank = false;
   // give the web browser time to receive the data
   // close the connection:


Can you post a link to the w5200.cpp and w5200.h files? I'll take a look if I have time.



See attachment - the 2 files were supplied with the w5200.



That is not the w5200 files. That is a LiquidCrystal_I2C something-or-other. Try it again.



Sorry about that...

New files attached



Apr 21, 2012, 06:55 pm Last Edit: Apr 21, 2012, 07:32 pm by SurferTim Reason: 1
I modified your code to compile, but I have no w5200 to check it with. Let me know if it works. The modified code is attached.

edit: The new code has an old bug. There is a bug in the 16 bit read function. Here is the bug and patch.

I might apply that patch to this code to solve that problem.




Compiles  - my code perfectly
W5200 - is communicating  - good responses


When i now put my W5100 Ethernet shield on, it compiles but does not communicate
If i put the original 5100 libs back then it complies and communicates.

It is almost there.....



That is good, but is the nature of the beast. By changing your C++ code to the w5200, it will not work with the w5100.

Also, for those that were affected by the "605 bug", this new code has it. I attached the new w5100.h (for the w5200) with the "605 bug" removed.



Ah, ok  - So seems that i could make a copy of the current original complete ethernet lib and rename the directory to ethernet5200

that way my libraries would  both show --- ethernet (original) and ethernet5200 which i would select when working with a 5200)

Thanks very much for your inputs /effort!!




Apr 24, 2012, 03:15 pm Last Edit: Apr 24, 2012, 03:33 pm by SurferTim Reason: 1
I dug a little into the new w5200 files, and I was partly incorrect. The new w5100.cpp and w5100.h files will work with either the w5100 or w5200 depending on the define in w5100.h. If you comment out this line, it will compile for a w5100.
Code: [Select]
#define W5200

I tried to compile for a w5200 by adding that define to the sketch code, but it had no effect on the library code.

edit: Attached is the w5100.cpp and w5100.h files I am using. It has the 605 bug removed. and the w5200 define commented out.



Will give it a try and get back to you

Thanks for the update




All working well - your files for the 5100 work fine and your files for the 5200 also work.

I found i had to copy over the files, depending if i am using a w5100 or w5200.

The idea of creating a new full complete copy of the Ethernet library dir ,adding your new 5200 files to it  and then renaming it to ethernet5200 did not work.
Ethernet         - original
Ethernet5200  - a copy of the original but with your modified files for the w5200
Odd, as I was sure it was an easy work around.

A bit of a pain to copy the 5200 and 5100 files back and forth, and trying to remember which one is installed........ but at least i can use either ethernetshield

After searching around the net, yours still are the only ones that worked for me!
Not even the ones sent by the company worked..


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131