Go Down

Topic: my W5100 can't get IP address from router (Read 532 times) previous topic - next topic

riandanualdy

Hello guys, i have a problem. i want to connect w5100 to router to get ip address with Dhcpaddressprinter form ethernet library, but my serial monitor output is "Failed to configure Ethernet using DHCP" and i dont use a SD card. and the indicator from FULL D,100M,PWR is ON and the rx,LINK is blinking. i use straight cable and arduino uno
can you help me?

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  // this check is only needed on the Leonardo:
//  while (!Serial) {
//    ; // wait for serial port to connect. Needed for native USB port only
//  }
 pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);


  // 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:
    for (;;)
      ;
  }
  // print your local IP address:
  printIPAddress();
}

void loop() {

  switch (Ethernet.maintain())
  {
    case 1:
      //renewed fail
      Serial.println("Error: renewed fail");
      break;

    case 2:
      //renewed success
      Serial.println("Renewed success");

      //print your local IP address:
      printIPAddress();
      break;

    case 3:
      //rebind fail
      Serial.println("Error: rebind fail");
      break;

    case 4:
      //rebind success
      Serial.println("Rebind success");

      //print your local IP address:
      printIPAddress();
      break;

    default:
      //nothing happened
      break;

  }
}

void printIPAddress()
{
  Serial.print("My 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();
}

riandanualdy

and i dont have a MAC address behind the w5100 hardware, so i try MAC Address form any forum to use it. thx

SurferTim

Insure your shield is plugged into the Uno fully. Check the solder joints on the ICSP connector pins.

Some w5100 shields have a manufacturing bug. They put the wrong resistor set on the shield, and it prevents the w5100 from communicating with the network.


nsnt


pylon

i have the same problem
And did you try what SurferTim suggested? Do you have an original Arduino Ethernet Shield or a Chinese clone?

Go Up