Pages: [1] 2   Go Down
Author Topic: W5200 ETHERNET SHIELD compatibily problems  (Read 3788 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Brattain Member
*****
Karma: 549
Posts: 46107
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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 Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Code:
/*
  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 Offline
Faraday Member
**
Karma: 115
Posts: 5380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SurferTim,

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

Thanks
Joe

* Arduino_library.zip (18.79 KB - downloaded 14 times.)
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 115
Posts: 5380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SurferTim,

Sorry about that...

New files attached

Joe


* w5100.cpp (5.06 KB - downloaded 16 times.)
* w5100.h (13.6 KB - downloaded 23 times.)
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 115
Posts: 5380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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=605

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

* w5100.h (14.29 KB - downloaded 21 times.)
* w5100.cpp (5.36 KB - downloaded 22 times.)
« Last Edit: April 21, 2012, 12:32:25 pm by SurferTim » Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Faraday Member
**
Karma: 115
Posts: 5380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

* w5100.h.new (14.73 KB - downloaded 17 times.)
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Faraday Member
**
Karma: 115
Posts: 5380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I like your thinking!  smiley
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 115
Posts: 5380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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.

* w5100.h (14.48 KB - downloaded 26 times.)
* w5100.cpp (5.36 KB - downloaded 32 times.)
« Last Edit: April 24, 2012, 08:33:28 am by SurferTim » Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SurferTim,


Will give it a try and get back to you

Thanks for the update

Joe
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 58
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1] 2   Go Up
Jump to: