[Solved] Arduino Ethernet with Arduino 1.0 - Malfunction

Hi,

i’ve bought an Arduino Ethernet (not shield) a couple of month ago.
I played a bit around with it and everything worked fine (just used the examples with little modifications, version was 0022)
Now i’ve installed 1.0 on my Debian machine and want to play again.
I can load the example (WebServer), set correct IP and MAC and upload it to the board.
But if i want to load the webpage,i get the response, that the host is unreachable!?
I also tryed the UDP send receive example. When i upload this , the board is continously sending this kind of output to the serial termnal:

Received packet of size 1272
From 36.53.17.232, port 33449
Contents:
È?î¾£Eì{e?@-?BIÞpÿà¥0L
Received packet of size 1240
From 18.170.176.81, port 10506
Contents:
|?b@õJ©PESMd¹=,b92SaL
Received packet of size 1208
From 25.141.30.56, port 9693
Contents:
c®#
qY?:Ö«?/aë$P4-E?	L

The serial line works fine. I’ve tried one of the basic examples.
Has anybody hint for me where the problem can come from?

Bouni

There seems to be something fishy in 1.0 - my ethernet is broken too after updating to 1.0. It seems to read garbage from the network;(

This bug has not been corrected in V1.0. It has been known to cause corrupted data. http://code.google.com/p/arduino/issues/detail?id=605&start=200

Edit: And if there is a microSD card reader, insure to disable the SPI interface. That also causes corrupted data output.

void setup()
{
   pinMode(4,OUTPUT);
   digitalWrite(4,HIGH);
   Ethernet.begin(mac,ip);
   // rest of setup stuff
}

Yes, this patch helped, thanks.

Btw did you mean that you can not use SD card with Ethernet together? The whole point of having SD card there is to store static pages for webserver, right?

You can use them together. You need to pay close attention to the Slave Select lines for each. Disable the SD SPI, and enable the w5100 SPI for ethernet access. Disable the ethernet SPI and enable the SD for SD card access.

Disabled is HIGH, enabled is LOW.

Does this apply to all boards with ethernet+SD or only yo certain combinations of board+shield?

awe_cz:
Does this apply to all boards with ethernet+SD or only yo certain combinations of board+shield?

This applies to all boards that use the ethernet shield with the microSD card reader, whether there is a microSD card in it or not.

Hi,

thanks for the solution :slight_smile:
Will try this now.

EDIT:
The solution for me was to replace a few lines of code in libraries/Ethernet/utility/w5100.h

from line 266 (line 254 in version 0023) replace:

#define __SOCKET_REGISTER16(name, address)                   \
  static void write##name(SOCKET _s, uint16_t _data) {       \
    writeSn(_s, address,   _data >> 8);                      \
    writeSn(_s, address+1, _data & 0xFF);                    \
  }                                                          \
  static uint16_t read##name(SOCKET _s) {                    \
    uint16_t res = readSn(_s, address);                      \
    res = (res << 8) + readSn(_s, address + 1);              \
    return res;                                              \
  }

with:

#define __SOCKET_REGISTER16(name, address)                   \
  static void write##name(SOCKET _s, uint16_t _data) {       \
    writeSn(_s, address,   _data >> 8);                      \
    writeSn(_s, address+1, _data & 0xFF);                    \
  }                                                          \
  static uint16_t read##name(SOCKET _s) {                    \
    uint16_t res = readSn(_s, address);                      \
    uint16_t res2 = readSn(_s,address + 1); 			\
    res = res << 8;						\
    res2 = res2 & 0xFF;						\
    res = res | res2;						\
    return res;                                              \
  }

Bouni