Pages: [1]   Go Down
Author Topic: Problems with Ethernet Shield on Mega  (Read 483 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey everybody,

I have problems with the Mega and the new Ethernet Shield (both from DFRobot). If I plug on the Shield and try to run the sample code, it seems like the shield establish a connection, but it doesn't.

My Serial Monitor only keeps repeating the following lines:
Code:
connecting...
connected
Verbindung hergestellt
 request.  <ins>That’s all we know.</ins>
!location.hostname.match(/(^|\.)(google|blogger|orkut|youtube)\.com$/)){var purePath=location.pathname.replace(/\/[^\/]*$/,"");var cookieSet=document.cookie.split(";");for(var cookieNum=0;cookieNum<cookieSet.leng request.  <ins>That’s all we know.</ins>
!location.hostname.match(/(^|\.)(google|blogger|orkut|youtube)\.com$/)){var purePath=location.pathname.replace(/\/[^\/]*$/,"");var cookieSet=document.cookie.split(";");for(var cookieNum=0;cookieNum<cookieSet.leng request.  <ins>That’s all we know.</ins>
!location.hostname.match(/(^|\.)(google|blogger|orkut|youtube)\.com$/)){var purePath=location.pathname.replace(/\/[^\/]*$/,"");var cookieSet=document.cookie.split(";");for(var cookieNum=0;cookieNum<cookieSet.leng request.  <ins>That’s all we know.</ins>
!location.hostname.match(/(^|\.)(google|blogger|orkut|youtube)\.com$/)){var purePath=location.pathname.replace(/\/[^\/]*$/,"");var cookieSet=document.cookie.split(";");for(var cookieNum=0;cookieNum<cookieSet.leng request.  <ins>That’s all we know.</ins>

I tried it with the basic code to connect to google, tried it in my LAN... Nothing works.

Has anyone an idea of what I can try or what I have to do?

Thanks!

Greetings,
Dennis
Logged

Miramar Beach, Florida
Online Online
Faraday Member
**
Karma: 152
Posts: 6174
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is difficult to tell which sample code you are running. Is it from the Arduino IDE ethernet library?

Have you tried another site?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm running the WebClient sample from Arduino IDE 1.0.

But with setting an IP. Without I get no Output on Serial. Then it seems to hang on the connection codeline.

I've not tried another sample. Did you have one?
Logged

Miramar Beach, Florida
Online Online
Faraday Member
**
Karma: 152
Posts: 6174
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What OS are you using? Linux?

I had problems with a bug in the ethernet library from v0022 through v1.0. In v1.0, if you try to use dhcp, it will not return from
Code:
Ethernet.begin(mac);

If you use a static ip, it will never come out of a loop like this:
Code:
while(client.available())
{
   client.read();
}

Is that about right?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 9
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, this is exactly the Problem!

OS is Ubuntu (Linux).

Did you solved it?
Logged

Miramar Beach, Florida
Online Online
Faraday Member
**
Karma: 152
Posts: 6174
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, this is exactly the Problem!

OS is Ubuntu (Linux).

Did you solved it?

Ubuntu v11.04 here.  smiley

I used this patch for IDE v1.0 and earlier.
http://code.google.com/p/arduino/issues/detail?id=605

If you want to download IDE v1.0.1 (has that patch already installed), here is a link to the downloads.
http://arduino.cc/forum/index.php/topic,72232.msg727530.html#msg727530

Unpack it in a local directory, then navigate to that directory and run the arduino shell script there.

I'm running v1.0 and v1.0.1.
Logged

0
Offline Offline
Tesla Member
***
Karma: 147
Posts: 9741
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Simple client test code that "usually" works. You need to make the assigned arduino ip address compatable with your router lan ip address.

Code:
//zoomkat 4-04-12
//simple client test
//for use with IDE 1.0
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields
//note that the below bug fix may be required
// http://code.google.com/p/arduino/issues/detail?id=605

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan assigned to arduino
//byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
//byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
byte myserver[] = { 208, 104, 2, 86 }; // zoomkat web page server IP address
EthernetClient client;
//////////////////////

void setup(){

  Ethernet.begin(mac, ip);
  //Ethernet.begin(mac, ip, gateway, subnet);
  Serial.begin(9600);
  Serial.println("Better client test 4/04/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  } 
}

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(myserver, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println(); //end of get request
  }
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}


Logged

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

Pages: [1]   Go Up
Jump to: