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.
Yes the ?? makes it stick out more..... thanks for asking
Joe
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.
/*
Web Server
A simple web server that shows the value of the analog input pins.
using an Arduino Wiznet Ethernet shield.
Circuit:
* 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);
server.begin();
}
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");
client.println();
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(analogRead(analogChannel));
client.println("
");
}
break;
}
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
delay(1);
// close the connection:
client.stop();
}
}
Compiles - my code perfectly
W5200 - is communicating - good responses
W5100 ETHERNET SHIELD: NOT GOOD
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.
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.
#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.
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..
I submitted the change to the Arduino crew, and another user pointed out some changes required to other files. I attached Ethernet.h and Ethernet.cpp to this with the changes required to use the w5200. These are from the IDE v1.0.1-rc1 ethernet library.
When i try to compile with the new files, i get this:
C:\ARDUINO\arduino-1.0\libraries\Ethernet\Ethernet.cpp: In member function 'int EthernetClass::maintain()':
C:\ARDUINO\arduino-1.0\libraries\Ethernet\Ethernet.cpp:88: error: 'DHCP_CHECK_NONE' was not declared in this scope
C:\ARDUINO\arduino-1.0\libraries\Ethernet\Ethernet.cpp:91: error: 'class DhcpClass' has no member named 'checkLease'
C:\ARDUINO\arduino-1.0\libraries\Ethernet\Ethernet.cpp:93: error: 'DHCP_CHECK_NONE' cannot appear in a constant-expression
C:\ARDUINO\arduino-1.0\libraries\Ethernet\Ethernet.cpp:96: error: 'DHCP_CHECK_RENEW_OK' was not declared in this scope
C:\ARDUINO\arduino-1.0\libraries\Ethernet\Ethernet.cpp:97:
Had to put back my original back ethernet to compile.
Sorry, Joe. You will need to stay with the older version. IDE v1.0 does not support checkLease(). That is new for IDE v1.0.1, according to my source code.
But that should not be a problem. If/When this change is implemented, that version will support it.
I just grab'd a copy of your updated files, thanks. I am trying to get UDP multicast working with the W5200. The W5100 works great. I get no packets using the W5200. If I send Unicast to the IP address, it works fine. Same code, except for the two w5100.cpp and w5100.h. Using the WIZ820io module from Wiznet.
Goal is to get E1.31 multicast working with the newer W5200 chip.