Go Down

Topic: EthernetShield (without UTP cable inserted) (Read 426 times) previous topic - next topic

DieterKoblenz

Hi,

Below is my setup code:
Code: [Select]
void setup()
{
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0)
  {
    Serial.println("Failed to configure Ethernet using DHCP");

    while(true);
  }
  Udp.begin(localPort);
  Serial.flush();
  Serial.begin(9600);
  Serial1.flush();
  Serial1.begin(9600);
  RFID.flush();
  RFID.begin(9600);


  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);


  pinMode(53, OUTPUT);

  SD.begin(4);
  UpdateSaldo();


}


It works with the UTP cable connected; it connects to the DHCP server gets an IP address etc and continues with the program. However when the UTP cable is disconnected or the router is offline it will not do anything (I would figure that it then would print to the serialport "Failed to configure.." etc. Why is this not the case?

PaulS

Quote
It works with the UTP cable connected

What is a UTP cable? Connect to what and what?

Code: [Select]
  Serial.flush();
  Serial.begin(9600);

Block until all pending serial data has been sent. Then, open the serial port. Why?

Quote
Below is my setup code:

Should have posted that to http://snippets-r-us.com.

Quote
Why is this not the case?

How do you know it isn't? It can take a while to fail to get a connection.

Using DHCP requires more arguments than the mac address.

SurferTim

Quote
However when the UTP cable is disconnected or the router is offline it will not do anything (I would figure that it then would print to the serialport "Failed to configure.." etc. Why is this not the case?

It does, at least mine does. It takes over a minute for the dhcp request to time out and return the fail.

DieterKoblenz


It does, at least mine does. It takes over a minute for the dhcp request to time out and return the fail.


I've timed it and it takes well over a minute (1 min 56) before it times out. Is there a way to speed this up?

SurferTim

You can speed it up by connecting the UTP cable to a network with a dhcp server. Otherwise it will require a library modification.


Go Up