Go Down

Topic: Ethernet Shield Not taking address (Read 10 times) previous topic - next topic

sbavington

I ordered through Amazon from Powoot as it turns out. It looks like my 30 day window expired so i'll see about a new one.

Love the web...

Stephen Bavington
sbavington@mac.com

cwrose

I had a long fight getting an Arduino Ethernet to work; in the end it was both
a broken compiler and broken libraries, which are fixed in 1.0.1

The sketch below is pretty minimal, and it might be worth trying to see if the
shield will respond - it finally ran on my Arduino Ethernet, which I think is
electrically pretty much identical.

Code: [Select]

// Test of Arduino using Telnet server.

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

// Undefine this to get a working program.
#define TELNET

// the media access control (ethernet hardware) address for the Arduino:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x92, 0x34 };

// network configuration - all except mac are optional.
// If the actual values aren't supplied, the default
// is the local_ip with last octet 1.
// void EthernetClass::begin(uint8_t *mac, IPAddress local_ip,
//   IPAddress dns_server, IPAddress gateway, IPAddress subnet)

// The default Arduino board address:
byte ip[] = { 192, 168, 1, 20 };
// The DNS server address:
byte dnss[] = { 192, 168, 1, 1 };
// the gateway router address:
byte gateway[] = { 192, 168, 1, 1 };
// the subnet mask:
byte subnet[] = { 255, 255, 255, 0 };

// telnet defaults to port 23
EthernetServer server(23);

void setup()
{
  // Initialise the serial device.
  Serial.begin(9600);
  delay(2000);
  Serial.println("setup()");

  // Disable SD SPI
  // Is this needed ???
  pinMode(4, OUTPUT);
  digitalWrite(4, HIGH);

  // attempt a DHCP connection:
  Serial.println("Attempting to get an IP address using DHCP");
  // This requires the DHCP server to be x.x.x.1
  if (Ethernet.begin(mac) == 0) {
    // if DHCP fails, start with a hard-coded address:
    Serial.println("failed to get an IP address using DHCP, trying manually");
    Ethernet.begin(mac, ip); // function returns void
    //Ethernet.begin(mac, ip, gateway, gateway, subnet); // function returns void
  }
  else
    Serial.println("got an IP address using DHCP");

  // Start listening for clients.
  server.begin();
  // Say who we think we are.
  Serial.println(Ethernet.localIP());
}

void loop()
{
  Serial.println("loop()");

  // Initialise the client each pass ???
  EthernetClient client = server.available();

  // Read bytes from the incoming client and write them back
  // to any clients connected to the server.
#ifdef TELNET
  if ( client ) {
    char c = client.read();
    server.write(c);
  }
#endif

  // Can help debugging.
  delay(2000);
}

// eof


As you can see, the code is full of debugging odds and ends, but it's
what finally got my board working.

Good luck - Will

Nick Gammon


Thanks for the fast response.

I think you're right but there is only the Arduino and the Ethernet Shield as shown.


...

Quote
(3283.46 KB, 3648x2736 - viewed 6 times.)


Go easy on these 3 megabyte photos please. That takes a while to download, and then is too big to view in the web browser. A quick resize in your photo program will save everyone some effort.

I see from your photo that the shield does not appear to be plugged in properly. Those pins normally slide all the way into the sockets underneath. It looks to me like that are just touching. Maybe it has extra long pins, but you might want to check that by firmly pushing down on it.

sbavington

Sorry about the picture. No problem to shrink.

As for the pins, they bottom out, but the pins on the Adurino seem shorter.

I cut 1/8" off all the pins and guess what?

server is at 10.10.0.177
new client
GET / HTTP/1.1
Host: 10.10.0.177
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive

client disonnected
new client
GET /favicon.ico HTTP/1.1
Host: 10.10.0.177
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
Accept: */*
Referer: http://10.10.0.177/
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive

client disonnected
new client
GET / HTTP/1.1
Host: 10.10.0.177
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://10.10.0.177/
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive

client disonnected
new client
GET / HTTP/1.1
Host: 10.10.0.177
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://10.10.0.177/
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive

client disonnected
new client
GET / HTTP/1.1
Host: 10.10.0.177
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://10.10.0.177/
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive

client disonnected
Stephen Bavington
sbavington@mac.com

Nick Gammon

Are you saying it's working now?

sbavington

Yes, it appears to be working. I'm watching asa the simple web server gives me the pin states and it's logging th client in and out for 10 minutes now.

I guess the pins were too long and prevented the shorter pins on the Adruino from making.

Good catch!

Thanks so much for the help.
Stephen Bavington
sbavington@mac.com

cabral_bh

Gentlemen, I had the same problem and the solution was the same: cut the terminals.

Thanks Nick, for the solution ...

I had won so few white hairs.  :smiley-roll-sweat:


JsGarage

i have a  problem, my eth shield appears to be functioning(orange link light, and flickering green traffic light) but i cannot ping it, nor am i getting ANYTHING at all in the serial window.  my pins are the correct length(didnt have to trim them) as the shield pins bottom out on the mega2560.

i think my router may be trying to assign an IP, but i am manually setting the IP in the sketch....  how do i avoid this? is there a way to set the shield to accept an IP from the router?

Regards
Jason
one day, I'll be able to do this without help :)

SurferTim

You can use DHCP to assign the network settings.
Code: [Select]
  Serial.print("Starting ethernet...");
  if(!Ethernet.begin(mac)) Serial.println("failed");
  else Serial.println(Ethernet.localIP());

Does it print a valid IP? Or does it fail after a couple minutes? Or does it freeze forever?
Posting your code may help.

PaulS

Quote
i think my router may be trying to assign an IP, but i am manually setting the IP in the sketch....  how do i avoid this?

Configure your router properly. Tell it that the Arduino is at xxx.xxx.xxx.xxx, and that it should not assign that address to any other device.

Quote
is there a way to set the shield to accept an IP from the router?

Yes.

gilles2956

i've resolved a problem with a mega 2560 and shield W5100.
the ethernet was detected but The problem was  serial port which was returning  adress IP 0.0.0.0  .
The problem was the pins were too long and the contact between mega and shield wasn't correct for the ICSP  connector

So just cut 2 millimeters to all of the shield W5100 pins  to make sure the ICSP connection is well done
between the 2 devices . Just after, an IP adress was available on the serial port monitor .






wactor


i've resolved a problem with a mega 2560 and shield W5100.
the ethernet was detected but The problem was  serial port which was returning  adress IP 0.0.0.0  .
The problem was the pins were too long and the contact between mega and shield wasn't correct for the ICSP  connector

So just cut 2 millimeters to all of the shield W5100 pins  to make sure the ICSP connection is well done
between the 2 devices . Just after, an IP adress was available on the serial port monitor .



Hi, sorry to revive a post so old. I have a similar problem, rather than get out the ip 0.0.0.0 (which would indicate that there is a good connection on the pins ICSP), I get an ip 255.255.255.255.

Take the W5100 chip and is bought on ebay (11 €).

I have read it can be a faulty chip, but before returning to hong kong I wonder if there is any solution.

Thank you.
A greeting

zoomkat

If you are using bad code, then you might want to fix it.
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

NicoHood

hey guys ive got similar problems. I cant get anything working. Lan shows address 0.0.0.0 via debug serial as a host and the sd library gives me no information about the sd card. I am using an arduino mega an an aliexpress lan shield (the normal cheap design). Using ide 1.0.5 with its built in libraries.

The chip is also getting very hot, but as far as i read this is okay. I also tried to connect the wires on my own with jumpers. (spi header, 3.3v, reset, pin 0-4, 10, aref). no success. I also tried an extern power supply with these breadboard adapters and usb. 3.3v and 5.v.

Is there an easy way to somehow get a respond, a "hello world" from the shield? Ive no idea if my lan hub or my sd card might cause errors. I just have no feedback at all, seems the board is dead?

pylon

Quote
I am using an arduino mega an an aliexpress lan shield (the normal cheap design).


Please provide a link to that product or make at least a photo of your shield. From the description I get the impression that you own a shield with another chip than the WizNet5100 of an original Arduino Ethernet shield.

Go Up