Pages: [1]   Go Down
Author Topic: EthernetShield (without UTP cable inserted)  (Read 358 times)
0 Members and 1 Guest are viewing this topic.
Netherlands
Offline Offline
Newbie
*
Karma: 1
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Below is my setup code:
Code:
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?
Logged

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

Quote
It works with the UTP cable connected
What is a UTP cable? Connect to what and what?

Code:
  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.
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 146
Posts: 6019
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Netherlands
Offline Offline
Newbie
*
Karma: 1
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 146
Posts: 6019
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Pages: [1]   Go Up
Jump to: