Pages: [1]   Go Down
Author Topic: Ethernet shield link wont stay active with Netgear router  (Read 1048 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey,

I have a new ethernet shield for my Arduino Duemilanove [Atmega 328 version] and it does not appear to work when plugged in to my router.
I have been trying to get the sample Ethernet sketches to run, all of which work perfectly when I plug the ethernet shield directly into a computer. However when I plug it into my router, the link doesn't appear to stay active. The 100M light flashes on and off periodically with the port connection light on the router. Some times it stays on for a few minutes, and the rx light remains on for this entire time. But normally it flashes every few seconds and wont maintain the link.

Below is the code I am running, which runs perfectly when connected directly to a computer.

Is there something weird going on in how my router identifies devices?

Any help would be greatly appreciated, as I will be needing internet access which will of course require me to connect it to the router.

Cheers,
Ed

***EDIT*** Will also add that the router is a netgear DG834G v4. And the mac address in the code there I have taken from the sticker which was on the bottom of my ethernet shield

Code:
/*
 Chat  Server
 
 A simple server that distributes any incoming messages to all
 connected clients.  To use telnet to  your device's IP address and type.
 You can see the client's input in the serial monitor as well.
 Using an Arduino Wiznet Ethernet shield.
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)
 
 created 18 Dec 2009
 by David A. Mellis
 modified 10 August 2010
 by Tom Igoe
 
 */

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x88, 0x06 };
byte ip[] = { 192,168,1, 17 };
byte gateway[] = { 192,168,1, 1 };
byte subnet[] = { 255, 255, 255, 0 };

// telnet defaults to port 23
Server server(23);
boolean gotAMessage = false; // whether or not you got a message from the client yet

void setup() {
  // initialize the ethernet device
  Ethernet.begin(mac, ip, gateway, subnet);
  // start listening for clients
  server.begin();
  // open the serial port
  Serial.begin(9600);
  Serial.print("Arduino Chat Server \n\nInitialised...\n\n");
}

void loop() {
  // wait for a new client:
  Client client = server.available();
  
  // when the client sends the first byte, say hello:
  if (client) {
    if (!gotAMessage) {
      Serial.println("We have a new client");
      client.println("Hello, client!");
      gotAMessage = true;
    }
    
    // read the bytes incoming from the client:
    char thisChar = client.read();
    // echo the bytes back to the client:
    server.write(thisChar);
    // echo the bytes to the server as well:
    Serial.print(thisChar);
  }
}
« Last Edit: November 12, 2011, 07:00:19 am by edenist » Logged

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

Maybe the CAT5 cable? Normally, a cable that goes from the ethernet shield directly to a computer is a crossover type cable. Some routers do not have automatic crossover on all ports. They need a straight through type cable. Try another cable.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe the CAT5 cable? Normally, a cable that goes from the ethernet shield directly to a computer is a crossover type cable. Some routers do not have automatic crossover on all ports. They need a straight through type cable. Try another cable.



Thanks for the reply,

I am using a standard non-crossover cat5 cable. Have tried several cables [all of which work with other devices around the house on the router] and still the same issue.

Cheers.
Logged

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

Check your network settings in the router. Normal localnet ip gateway on that router is 192.168.0.1. You are using 192.168.1.1.

Insure the router dhcp server is set to issue an ip range that allows static ips. I allow a few ips at the bottom. My dhcp server issues 192.168.0.8 to 192.168.0.250 so I can use the rest for static ip devices.


Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Check your network settings in the router. Normal localnet ip gateway on that router is 192.168.0.1. You are using 192.168.1.1.

Insure the router dhcp server is set to issue an ip range that allows static ips. I allow a few ips at the bottom. My dhcp server issues 192.168.0.8 to 192.168.0.250 so I can use the rest for static ip devices.




Doesn't appear to be the problem either. Most of my IP's are assigned statically on my network, the router has an area where you can reserve IPs so they wont be assigned over dhcp. I have entered the shield's ip and mac there just to be sure but still no go.
Logged

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

Just to insure I understand, you did change the localnet address on the router to 192.168.1.1? And all the other static ips are 192.168.1.x?

Add: And no other device assigned 192.168.1.17? Just checking everything I can think of.
« Last Edit: November 12, 2011, 08:12:22 am by SurferTim » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes my network is on a 192.168.1.x subnet.

So I dug up an old switch I use sometimes if I need more ports on my router, this is just a "dumb" switched hub which plugs into my router which then takes care of addressing.

Plugging the shield into this switch, it now works perfectly and appears on the router, and can be accessed on my network.
It seems there is something very low level in the router in how it deals with the physical connection.....

Though I guess it's not really "problem solved" on my end, I guess it certainly is as far as the ethernet shield goes. Probably just going to have to accept the quirk of the router...... Have been wanting upgrade to gigabit anyway, guess now I have yet another reason to, lol :p

Thanks very much for your assistance though SurferTim, very much appreciated!
Logged

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

To be honest, I have not had very good luck with Netgear stuff. I do this for a living, so I use more professional stuff.
Mikrotik/RouterBoard is my current favorite, and they have no problem with the ethernet shield. But they have no cable/DSL modem capability for your application. And most models they offer are not for the beginner.

No problem on the help.  smiley

Edit: So I am not misunderstood, the Mikrotik routers have no problem using a DSL/cablemodem connection. They have no integral equipment. The modem must be external.
« Last Edit: November 12, 2011, 08:39:48 am by SurferTim » Logged

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

I've exactly the same behaviour with a Netgear DGN 2200 :-(
What is the version of your ethernet shield? V3?
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8919
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yoy can try the below which works with my 614 netgear router.

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

#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

Pages: [1]   Go Up
Jump to: