Pages: [1] 2   Go Down
Author Topic: Official Ethernet Shield crashes  (Read 2522 times)
0 Members and 1 Guest are viewing this topic.
Montemarciano, Ancona, Italia
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi to all, i'm experiencing with Arduino UNO R2 and the official Ethernet shield R2. When I upload a sketch that uses the ethernet shield, this shield crashes and the LED at pin 13 emits a faint light. I've tried to use the Arduino IDE v1.0, 0023, 0022, 0021 on both windows and linux but without any result.

Maybe this shield hardware is corrupted, and i should buy another shield?
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49023
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
When I upload a sketch that uses the ethernet shield, this shield crashes and the LED at pin 13 emits a faint light.
Quote
Maybe this shield hardware is corrupted
That or the code is bad. I'd vote for a code problem. Much cheaper to fix.
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9541
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
and the LED at pin 13 emits a faint light

That is the on/off timing signal that is used by the shield on pin 13.
Logged

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

Montemarciano, Ancona, Italia
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
That or the code is bad. I'd vote for a code problem. Much cheaper to fix.
Well, all the sketches i've uploaded are examples where i've changed only the MAC address to suit with the MAC printed in the WizNet, and them crashes. So i don't think that the problem is the code.

Quote
That is the on/off timing signal that is used by the shield on pin 13.
I can't understand this. Can you explain me this more in detail?
« Last Edit: February 24, 2012, 03:14:59 pm by elQuero » Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49023
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I can't understand this. Can you explain me this more in detail?
It means that pin 13 is used by the ethernet shield. Any attempt to use pin 13 for anything else will screw up the communications with the ethernet shield.

Regardless of where you got the code, post it. We don't want to guess what you are doing.
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9541
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Below is some simple client test code you can try. Don't change the mac address. "and them crashes" doesn't indicate much hope of getting more technical detail of your setup.

Code:
//zoomkat 12-08-11
//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, subnet, gateway);
  Serial.begin(9600);
  Serial.println("Better client test 12/01/11"); // 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

Montemarciano, Ancona, Italia
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Now i'm at school, so I'll test this code this afternoon.
Quote
"and them crashes" doesn't indicate much hope of getting more technical detail of your setup
If you are referring to the few technical details that i've provided, i'm sorry but i can't understand the problem because the same sketches were ok two months ago. I've also tryed with another ethernet shield and i get the same results.
Logged

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

Did you try zoomkat's code? Did you see the note in the code about the bug fix? That will cause the Arduino to stay in a "while(client.available())" loop forever.
http://code.google.com/p/arduino/issues/detail?id=605

Logged

Montemarciano, Ancona, Italia
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, i've tryed the zoomkat code and it is ok, the output is regular. So i've tryed first to change the MAC address whit my Ethernet Shield address and there isn't any issue. Then i've tryed to start the DHCP procedure by sobstituting
Quote
Ethernet.begin(mac, ip);
with
Quote
Ethernet.begin(mac);
and the shield crashes. So i think that the problem is the DHCP library.

I've also experienced a loop in receiving data, because i use the linux compiler (i use lubuntu) for avr. But the ethernet shield begins correctly, that was my problem.

So how can I fix this DHCP issue? Maybe i sould review the DHCP library code, or there is an updated version?
Logged

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

Is there a dhcp server on the localnet? If the dhcp part is failing, it is not getting an ip from a dhcp server. It may take around a minute to timeout.

Code:
if(Ethernet.begin(mac) == 0)
{
   Serial.println("No dhcp");
}
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9541
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

More test code similar to the first I posted.

Code:
//zoomkat 2-13-12
//DNS and DHCP-based web client test code
//for use with IDE 1.0
//open serial monitor and send an e to test
//and to see test result
//for use with W5100 based ethernet shields
//browser equivelant URL:
//http://web.comporium.net/~shb/arduino.txt
//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
char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;

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

void setup(){
  Serial.begin(9600);
  Serial.println("DNS and DHCP-based web client test 2/13/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
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // print your local IP address:
  Serial.print("Arduino IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print(".");
  }
  Serial.println();
  Serial.println();
}

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(serverName, 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

Montemarciano, Ancona, Italia
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, i think that this image will explain what i meen for "faint light"


By elquero93 at 2012-02-26

In this photo you can see the led at pin13 light emitted when i try to run the last zoomkat sketch. This light is emitted all times that I try to call the DHCP procedure, and is continously emitted up to I unplug the Arduino, so I think that the problem is the DHCP library.
Logged

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

And what did the serial monitor say?
Failed to configure Ethernet using DHCP
or
Arduino IP address: 192.168.0.22
Logged

Montemarciano, Ancona, Italia
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ohw, I forgot to say that the serial monitor doesn't say nothing, i can only see serial output before
Code:
Ethernet.begin(mac);
Logged

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

And how long do you wait for the response? I usually do not quote myself, but...

Quote
Is there a dhcp server on the localnet? If the dhcp part is failing, it is not getting an ip from a dhcp server. It may take around a minute to timeout.
Logged

Pages: [1] 2   Go Up
Jump to: