Pages: 1 [2] 3 4   Go Down
Author Topic: Ethernet shield problems! Time to update library?  (Read 17785 times)
0 Members and 1 Guest are viewing this topic.
New Zealand
Offline Offline
God Member
*****
Karma: 0
Posts: 999
Arduino pebbles
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

But lose the advantage of being hardware-based SPI in the process.

--Phil.
Logged

Indiana
Offline Offline
Full Member
***
Karma: 1
Posts: 234
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've posted a completely revised Client portion of the Ethernet library. It includes many fixes and seems to resolve any connection issues or situations where a connection fails to completely close.

See here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1238640832/0#0
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Yeah, the SPI pins moving is going to be a deal breaker for the Ethernet shield, all existing Ethernet shields will have to be re-designed to work with the Mega.

Well, it sucks that I'm the one to find this out.  I think a lot of folks are going to be disappointed that the ethernet shield isn't pin compatible with the Mega.

Would it be possible to move the pins physically to resolve this?  The SPI connections on the mega are not under the ethernet shield so I would think that cutting off the header pins for 10-13 and then running wires from the headers to the SPI connection would resolve this issue.  Would that require any modification to the Ethernet library to take care of the pin assignments?
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

smiley

-j

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Smartprojects have this warning in their product description:

Quote
It has 53 IO (including 4 HW UARTs, 14 PWMs, I2C bus) and 16 Analog Input pins.
It can mount and use most of the Arduino Shields (not the ETH actual version).

http://www.smartprj.com/catalog/index.php?main_page=product_info&cPath=1&products_id=37

Perhaps this warning should be added to the Arduino Mega product page too...
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I think the relevant section is located in the spi.h file inside of the utility folder of the ethernet library directory.  I have no idea how to go about fixing it though.  Am I way off?  Could someone give me a hand in fixing this?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just wanted to let everyone know that the ethernet shield is working great and it's being used in our custom web connected RFID cardreader system:

http://www.flickr.com/photos/machinecollective/sets/72157616309400121/

Thanks again for everyone who helped finding a quick solution for the connection problems!

The 35 second time out bug still appears every now and then, but for 99% of the time it's working perfectly!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Then for those who have problems with the ethernet card wich solution you propose

Because for all of us who are newbies this talk has lots of information but no practical solution

Thanks!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm working on a write-up about this project, I'll include links, code and schematics, but there are some other things that need my attention now..

There is a problem with the current version of the ethernet library, ports aren't closed properly so it runs out of available ports quickly.. Etracer came up with a good solution, see comment #16 of this thread.. His solution can be found here:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1238640832/0#0

To get the RFID stuff up and running I used the code that Marc Boon posted last year:

http://trac.mediamatic.nl/picnic/wiki/RfiDuino
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm interested on a ethernet solution to the connection problems

I'm working on a webserver put it in the arduino. My goal is to read some digital inputs and serve them to an iPhone with the GUI

But at this point I can't connect with the server

Thanks!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The connection problems should be solved when you replaced the client.cpp file (don't forget to delete the client.o file!).

Did you follow the instructions in the thread I posted above?

Can you ping the arduino IP address from a computer in the same network?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I try this code:

#include <Ethernet.h>

// network configuration.  gateway and subnet are optional.
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 177 };
byte gateway[] = { 192, 168, 1, 1 };
byte subnet[] = { 255, 255, 255, 0 };

// telnet defaults to port 23
Server server = Server(23);

void setup()
{
  // initialize the ethernet device
  Serial.begin(19200);
  Serial.println("Serie inicializada a 19200 baudios...");
  Ethernet.begin(mac, ip, gateway, subnet);
  Serial.println("Ehternet inicializada...");
  // start listening for clients
  server.begin();
  Serial.println("Servidor inicializado...");
}

void loop()
{
  Client client = server.available();
  if (client) {
    Serial.println("Conexion establecida...");
    server.write(client.read());
  }
}


With this result:

macbook-de-garito:~ garito$ ping 192.168.1.177
PING 192.168.1.177 (192.168.1.177): 56 data bytes
64 bytes from 192.168.1.177: icmp_seq=0 ttl=128 time=105.914 ms
64 bytes from 192.168.1.177: icmp_seq=1 ttl=128 time=105.144 ms
64 bytes from 192.168.1.177: icmp_seq=2 ttl=128 time=104.166 ms
64 bytes from 192.168.1.177: icmp_seq=3 ttl=128 time=104.207 ms
64 bytes from 192.168.1.177: icmp_seq=4 ttl=128 time=103.006 ms
64 bytes from 192.168.1.177: icmp_seq=5 ttl=128 time=1.586 ms
64 bytes from 192.168.1.177: icmp_seq=6 ttl=128 time=1.519 ms
64 bytes from 192.168.1.177: icmp_seq=7 ttl=128 time=102.396 ms
64 bytes from 192.168.1.177: icmp_seq=8 ttl=128 time=102.331 ms
64 bytes from 192.168.1.177: icmp_seq=9 ttl=128 time=101.361 ms
64 bytes from 192.168.1.177: icmp_seq=10 ttl=128 time=101.467 ms
^C
--- 192.168.1.177 ping statistics ---
11 packets transmitted, 11 packets received, 0% packet loss
round-trip min/avg/max/stddev = 1.519/84.827/105.914/39.280 ms
macbook-de-garito:~ garito$ telnet 192.168.1.177
Trying 192.168.1.177...
telnet: connect to address 192.168.1.177: Operation timed out
telnet: Unable to connect to remote host

Then I try this other:

#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 177 };
byte server[] = { 64, 233, 187, 99 }; // Google

Client client(server, 80);

void setup()
{
  Ethernet.begin(mac, ip);
  Serial.begin(9600);

  delay(1000);

  Serial.println("connecting...");

  if (client.connect()) {
    Serial.println("connected");
    client.println("GET /search?q=arduino HTTP/1.0");
    client.println();
  } else {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    for(;smiley-wink
      ;
  }
}

With this result:

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 23
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you tried the code that etracer posted?

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1238640832/0#0
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It raises 50 CONNECTION FAILED!'s

But I'm interested on the server not client

I suppose that the board has any kind of problem if it can't connect with this code?

Thanks!
Logged

Indiana
Offline Offline
Full Member
***
Karma: 1
Posts: 234
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The code works as do the examples included with the library. The problem is clearly with your network configuration and your failure to specify correct IP, subnet and gateway values. I'm deducing this because you're trying to ping and connect to the same IP address included in the library examples. You can't literally use the values included in the sample sketches. You need to assign values that are appropriate to you network environment.

  • What operating system are you using on your computer?
  • What is your computer's IP address?
  • What's your subnet or netmask?
  • What's your gateway address?
  • How are you connecting your Ethernet Shield to the network? Is it connected to a hub/switch, or is the cable connecting directly to your computer?
  • Which LED's light up solidly when you plug the network cable into the Ethernet Shield?
  • Do the TX and RX LED's show any activity?



Logged

Pages: 1 [2] 3 4   Go Up
Jump to: