Go Down

Topic: Ethernet Shield (W5100) recieves weird data (Read 1 time) previous topic - next topic

chrisbc

Hi,

i tried the Webclient example with the Ethernet Shield v2 and sometimes I get readable data but most of the time not:
Code: [Select]
connecting...
connected
Y©FIªx?ä«Å(û ü_Fv8t?î´!S?ùùòÃ6éK??c
disconnecting.
connecting...
connected
Y©FIªx?ä«Å(û ü_Fv8t?î´!S?ùùòÃ6éK??c
[ìe.timers={};window.google.startTick=function(a,b){i[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!i[a])google.startTick(a);i[a].t[b]=c||(new Date).getTime()};google.sta{}};
window.google.sn="webhp";var i=window.google.timers={};window.google.startTick=function(a,b){i[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!i[a])google.startTick(a);i[a].t[b]=c||(new Date).getTime()};google.sta{}};
window.google.sn="webhp";var i=window.google.timers={};window.google.startTick=function(a,b){i[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!i[a])google.startTick(a);i[a].t[b]=c||(new Date).getTime()};google.sta{}};
window.google.sn="webhp";var i=window.google.timers={};window.google.startTick=function(a,b){i[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!i[a])google.startTick(a);i[a].t[b]=c||(new Date).getTime()};google.sta{}};
window.google.sn="webhp";var i=window.google.timers={};window.google.startTick=function(a,b){i[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!i[a])google.startTick(a);i[a].t[b]=c||(new Date).getTime()};google.sta{}};
window.google.sn="webhp";var i=window.google.timers={};window.google.startTick=function(a,b){i[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!i[a])google.startTick(a);i[a].t[b]=c||(new Date).getTime()};google.sta{}};
window.google.sn="webhp";var i=window.google.timers={};window.google.startTick=function(a,b){i[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!i[a])google.startTick(a);i[a].t[b]=c||(new Date).getTime()};google.sta{}};
window.google.sn="webhp";var i=window.google.timers={};window.google.startTick=function(a,b){i[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!i[a])google.startTick(a);i[a].t[b]=c||(new Date).getTime()};google.sta{}};
window.google.sn="webhp";var i=window.google.timers={};window.google.startTick=function(a,b){i[a]={t:{start:(new Date).getTime()},bfr:!(!b)}};window.google.tick=function(a,b,c){if(!i[a])google.startTick(a);i[a].t[b]=c||(new Date).getTime()};google.sta{}};
window.google.sn="webhp";var i=window.go
disconnecting.
connecting...
connected
ȁ×,|øXW ¦?ÉéHQ­ü?q×fæ¡ùÍíe\@Ð öË?ß
FP¢
disconnecting.
connecting...
connected
[¨a
</PRE>
zu verarbeiten, trat der folgende F
disconnecting.
connecting...
connected
STRONG>Ung&uuml;ltige Anfrage</STRONG>
</UL>
disconnecting.


Here's the code:
Code: [Select]
/*
 Web client

This sketch connects to a website (http://www.google.com)
using an Arduino Wiznet Ethernet shield.

Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13

created 18 Dec 2009
by David A. Mellis

*/

#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 };
byte ip[] = { 192,168,2,177 };
byte server[] = { 74,125,39,147 }; // Google
byte gateway[] = { 192,168,2, 1 };
byte subnet[] = { 255, 255, 255, 0 };


Client client(server, 80);

void setup() {
 // start the Ethernet connection:
 Ethernet.begin(mac, ip, gateway, subnet);
 // start the serial library:
 Serial.begin(9600);
 // give the Ethernet shield a second to initialize:
 delay(1000);
 Serial.println("connecting...");

 // if you get a connection, report back via serial:
 if (client.connect()) {
   Serial.println("connected");
   // Make a HTTP request:
   client.println("GET / HTTP/1.0");
   client.println();
 }
 else {
   // kf you didn't get a connection to the server:
   Serial.println("connection failed");
 }
}

void loop()
{
 // if there are incoming bytes available
 // from the server, read them and print them:
 if (client.available()) {
   char c = client.read();
   Serial.print(c);
 }

 // if the server's disconnected, stop the client:
 if (!client.connected()) {
   Serial.println();
   Serial.println("disconnecting.");
   client.stop();

   // do nothing forevermore:
   for(;;)
     ;
 }
}


Could someone try the code and tell me if the results are the same?

zoomkat

Try the below code to see if you get something readable.

Code: [Select]

//zoomkat 11-13-10
//simple ethernet client test code
//for use with IDE 0021 and W5100 ethernet shield
//modify the arduino lan ip address as needed
//open serial monitor to see what the arduino receives
//push the shield reset button to run client again

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 102 }; // Arduino IP address
byte server[] = { 208, 104, 2, 86 }; // zoomkat's web site

Client client(server, 80);

void setup()
{
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
  Serial.println("starting simple arduino client test");
  Serial.println();

  delay(1000);

  Serial.println("connecting...");

  if (client.connect()) {
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0");
    client.println();
  } else {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    Serial.println("==================================");
    Serial.println("");
    client.stop();
    for(;;);
  }
}

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

chrisbc

Thanks for your reply. I tried your code but I'm still getting no right output:

Code: [Select]
starting simple arduino client test

connecting...
connected
ÎF]f:
<UL>
<
disconnecting.
==================================

starting simple arduino client test

connecting...
connected
r au, trat de
disconnecting.
==================================

starting simple arduino client test

connecting...
connected
iten:
<UL>
<L
disconnecting.
==================================

starting simple arduino client test

connecting...
connected
auf´ ÉH2yÏ4P
disconnecting.
==================================

zoomkat

Just as a point of reference, below is what ia returned to my serial monitor when I run the code I posted.

starting simple arduino client test

connecting...
connected
HTTP/1.1 200 OK
Date: Sun, 31 Jul 2011 17:16:48 GMT
Server: Apache
Last-Modified: Sat, 13 Nov 2010 16:31:40 GMT
Accept-Ranges: bytes
Content-Length: 51
Connection: close
Content-Type: text/plain; charset=UTF-8

Woohoo! Your arduino ethernet client works!
zoomkat
disconnecting.
==================================

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

chrisbc

Today I tried the same on my windows machine and everythink just works fine ... Seems to be a Fedora issue, maybe the compiler or a bug in the ethernet library.
Any idea where I can report this or how to explore the issue to get it fixed?

zoomkat

Quote
Seems to be a Fedora issue, maybe the compiler or a bug in the ethernet library.
Any idea where I can report this or how to explore the issue to get it fixed?


Fedora forum?
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name:
Email:

shortcuts: alt+s submit/post or alt+p preview