Offline
Jr. Member
Karma: 0
Posts: 58
|
 |
« on: April 20, 2012, 10:10:06 pm » |
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??
Thanks Joe
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #1 on: April 21, 2012, 08:29:07 am » |
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??
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 58
|
 |
« Reply #2 on: April 21, 2012, 09:02:58 am » |
PaulS, 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("<br />"); } 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(); } }
|
|
|
|
« Last Edit: April 21, 2012, 09:20:43 am by joeman »
|
Logged
|
|
|
|
|
Miramar Beach, Florida
Offline
Faraday Member
Karma: 50
Posts: 3448
|
 |
« Reply #3 on: April 21, 2012, 09:59:57 am » |
Can you post a link to the w5200.cpp and w5200.h files? I'll take a look if I have time.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 58
|
 |
« Reply #4 on: April 21, 2012, 10:33:33 am » |
SurferTim,
See attachment - the 2 files were supplied with the w5200.
Thanks Joe
|
|
|
|
|
Logged
|
|
|
|
|
Miramar Beach, Florida
Offline
Faraday Member
Karma: 50
Posts: 3448
|
 |
« Reply #5 on: April 21, 2012, 10:45:12 am » |
That is not the w5200 files. That is a LiquidCrystal_I2C something-or-other. Try it again.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 58
|
 |
« Reply #6 on: April 21, 2012, 11:15:21 am » |
SurferTim,
Sorry about that...
New files attached
Joe
|
|
|
|
|
Logged
|
|
|
|
|
Miramar Beach, Florida
Offline
Faraday Member
Karma: 50
Posts: 3448
|
 |
« Reply #7 on: April 21, 2012, 11:55:05 am » |
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. http://code.google.com/p/arduino/issues/detail?id=605I might apply that patch to this code to solve that problem.
|
|
|
|
« Last Edit: April 21, 2012, 12:32:25 pm by SurferTim »
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 58
|
 |
« Reply #8 on: April 21, 2012, 12:36:16 pm » |
SurferTim,
W5200 ETHERNET SHIELD: GOOD!
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.
It is almost there.....
Thanks Joe
|
|
|
|
|
Logged
|
|
|
|
|
Miramar Beach, Florida
Offline
Faraday Member
Karma: 50
Posts: 3448
|
 |
« Reply #9 on: April 21, 2012, 12:40:08 pm » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 58
|
 |
« Reply #10 on: April 21, 2012, 12:58:22 pm » |
SurferTim,
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!!
Joe
|
|
|
|
|
Logged
|
|
|
|
|
Miramar Beach, Florida
Offline
Faraday Member
Karma: 50
Posts: 3448
|
 |
« Reply #11 on: April 21, 2012, 12:59:24 pm » |
I like your thinking! 
|
|
|
|
|
Logged
|
|
|
|
|
Miramar Beach, Florida
Offline
Faraday Member
Karma: 50
Posts: 3448
|
 |
« Reply #12 on: April 24, 2012, 08:15:59 am » |
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.
|
|
|
|
« Last Edit: April 24, 2012, 08:33:28 am by SurferTim »
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 58
|
 |
« Reply #13 on: April 24, 2012, 02:04:53 pm » |
SurferTim,
Will give it a try and get back to you
Thanks for the update
Joe
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 58
|
 |
« Reply #14 on: April 24, 2012, 05:59:12 pm » |
SurferTim,
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..
Thanks Joe
|
|
|
|
|
Logged
|
|
|
|
|
|