problem(s) with ethernet shield

Hello,

I have a sketch that sends me some data to an server.
With the shield i have several issues.

first:
When i start the shield, sometimes it doesn’t connect to the network (DHCP)

second:
After an reset (short or long) the ethernet shield stuck on the DHCP

third:
When there is an connection, after several transmisions i get an connection failed.

it is possible to ping my board when it is connected, bellow is a listing of the ping

arnold:~ ageurtse$ ping 192.168.1.233
PING 192.168.1.233 (192.168.1.233): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
64 bytes from 192.168.1.233: icmp_seq=2 ttl=128 time=3.367 ms
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
64 bytes from 192.168.1.233: icmp_seq=5 ttl=128 time=3.220 ms
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
64 bytes from 192.168.1.233: icmp_seq=8 ttl=128 time=1.155 ms
64 bytes from 192.168.1.233: icmp_seq=9 ttl=128 time=3.601 ms
64 bytes from 192.168.1.233: icmp_seq=10 ttl=128 time=3.271 ms
64 bytes from 192.168.1.233: icmp_seq=11 ttl=128 time=3.234 ms
^C
--- 192.168.1.233 ping statistics ---
12 packets transmitted, 6 packets received, 50.0% packet loss
round-trip min/avg/max/stddev = 1.155/2.975/3.601/0.824 ms

and of course the sketch i use.

in this sketch i want to use sd, tft, ethernetshield and some one wire sensors.
it all is assambled on a mega2560 rev3. board.

and of course the sketch

mega_ethernet_glcd_SDCard_v1.0.zip (4.36 KB)

Part of it I can correct. The first thing in your setup function should be disable the SD SPI. That should prevent the dhcp fail.

void setup() {
   pinMode(4,OUTPUT);
   digitalWrite(4,HIGH);
   // rest of your setup

Thanks, i go try this.

Next problem is why is my connection somethimes lost. Is there a way to monitor it where it goes wrong ?

When there is an connection, after several transmissions i get an connection failed.

Does the connection fail all the time after this? Or just now and then?

I have no trouble with my client code, but that does not eliminate failed connections completely. Sometimes servers get busy and don't respond. http://playground.arduino.cc/Code/WebClient

a small update, it looks that this solved most of my problem's the board is sending his data for more then 14 houres.

i hope it will keep sending it, but what happens after 49 days, when there is an overflow in the millis. will it still run.

ageurtse: a small update, it looks that this solved most of my problem's the board is sending his data for more then 14 houres.

i hope it will keep sending it, but what happens after 49 days, when there is an overflow in the millis. will it still run.

If you are using my code, It should do fine. It uses Nick Gammon's millis rollover code. http://www.gammon.com.au/forum/?id=12127

thanks, it looks that i implemented this solution already.

thanks for the hint.

now lets see it it keeps running for a long periode.