Original Ethernet Shield (full size SD) and Mega 1280 - latest Arduino libs

I have an old Ethernet shield (Wiznet 5100, full size SD card) and a Mega 1280. It is connected as follows,

MEGA pin 50 (MISO) to Arduino Ethernet Shield pin 12. MEGA pin 51 (MOSI) to Arduino Ethernet Shield pin 11. MEGA pin 52 (SCK) to Arduino Ethernet Shield pin 13.

MEGA pin 53, set as OUTPUT and HIGH.

This used to work with an old version (years ago) of the Arduino libs but now with the latest it doesn't. I did used to have to change these defines,

define SPI0_SS_BIT BIT2

define SPI0_SCLK_BIT BIT5

define SPI0_MOSI_BIT BIT3

define SPI0_MISO_BIT BIT4

define IINCHIP_CS_BIT BIT2

but now they don't seem to exist. Are they set automatically from setting the board type?

When I try and query the IP address from the shield I get 0.0.0.0, even though I've set it manually. I've not looked too much into the code but I assume setting the IP writes it over SPI and reading it retrieves it over SPI?

Anything obvious I'm missing / can try ?

Thanks

It is all version R3 now and using the ICSP header and has automatic voltage detection for the Due.

How old is your Ethernet Shield ? Does it use the ICSP header ? If not, you have to bend the pins.
Pin 53 as output is okay.
Connecting 11,12,13 to the SPI bus is okay.

Now only pin 4 and 10 for the chip selects should work. I think they work as they are.

Can you try the Arduino IDE 1.5.8 BETA. Don’t change the libraries. Try the Ethernet and SD card. If one of them works, you are one step in the right direction.

It is old enough to not be using the ICSP header, I've removed the 'offending' pins so it sits tightly to the Mega.

Just tried 1.5.8 BETA and same happens, tried the ChatServer sketch. I haven't got an SD card or anything else SPI to test if SPI is working.

I'll try a really old version of libs just to make sure the hardware is OK.

Thanks.

You might have to check the libraries. I think that pin 10 is used for chip select of Ethernet, but if 'SS' is used it will be pin 53 insstead of pin 10 for a Mega.

Just as a quick check, I've tested the Ethernet shield on an Uno, no lib modifications, pins connected directly (10->10, 11->11..etc..) and it works perfectly.

So something has changed in the libs between 0015 and 1.5.8. Arghghgh =(

Have you tried IDE v1.0.6 instead of v1.5.8?

Try this sketch. My Mega 2560 had trouble with this using v1.5.8, but did fine using v1.0.6. Does it show the pins you expect?

void setup() {
  Serial.begin(9600);
  Serial.print("MISO = ");
  Serial.println(MISO);
  Serial.print("MOSI = ");
  Serial.println(MOSI);
  Serial.print("SCK = ");
  Serial.println(SCK);
  Serial.print("SS = ");
  Serial.println(SS);
}

void loop() {
 }

edit: I had the serial speed set to 115200 in my test with v1.5.8, and that had the problem. If I ran that at 9600, it worked ok. With v1.0.6, it worked ok at both baud rates. ??

MISO = 50
MOSI = 51
SCK = 52
SS = 53

Looks good, I'll have another go on the weekend.

Cheers

That is what it should display. Insure the pins are jumpered to the correct pins. Those are not in the same order on the Mega as they are on the Uno. MISO and MOSI are "backwards".