Has anyone managed to use ethernet shield with SD?

I have the w5100 ethershield with the sd card adaptor on it...
I use the arduino MEGA device
so far i have managed to use both but separately...
For the SD i use the fat16lib code and for the ethershield the spiMEGA.h hack having moved 11, 12 and 13 pins as advised...
i have changed the code so that pin 10 of the ethernet shield (SS) move to another pin.(L port)
I also connect the corresponding pins of the SD card adaptor (3, 8, 9) to 50, 51, 52 pins of the arduino Mega
Also changed the SS pin of the SD to another pin...
When the arduino is programmed with the webserver example it works perfect no matter of ths SD connected or not...The SD doesn't initialize as no 74 cycles code is implemented so there is no conflict..
When i try the SD log example on the arduino with the w5100 miso pin disconnected the SD works perfectly too...
On the contrary when the miso pin of W5100 is connected, the system goes nuts...
the card never inits...even if i set both pin53 to OUTPUT/HIGH and w5100 SS to OUTPUT/HIGH...
I need to use them both simultaneously in order to log some analog data and show them online while showing a graph of the data during time on a web page...
Anyone managed to do this?
any ideas?
:o

For anyone who cares... I just found out that the w5100 isbuggy when used with other spi devices as the miso pin doesn't go to hi-z state and brakes the bus...

i suppose this is the reason th SD card is not officialy supported by the shield...
any aother ideas on solving the problem?

i FINALLY DID IT..
In the sdcard.h file i defined a new pin4 as WD

// define SPI pins
#if defined(AVR_ATmega1280) //SPI pins
// pins for Arduino Mega
#define SS 49
#define SE 53
#define MOSI 51
#define MISO 50
#define SCK 52
#define WD 4

then in the sdcard.cpp, i made this code modification

// set Slave Select HIGH
STATIC_NOINLINE void spiSSHigh(void)
{
digitalWrite(SS, HIGH);
pinMode(SE,OUTPUT);
digitalWrite(SE, HIGH);
pinMode(WD,OUTPUT);
digitalWrite(WD, HIGH);

}
// set Slave Select LOW
STATIC_NOINLINE void spiSSLow(void)
{
digitalWrite(SS, LOW);
pinMode(WD,OUTPUT);
digitalWrite(WD, LOW);

When the 4 pin is connected to the PROG jumper of the ethernet shield, it drives the wiznet off when the sd's spi initializes and then on when it goes low...

this way it works perfectly for me as i can log data and see the analog read on a web page...

Congratulatoins :slight_smile: You must be very happy :slight_smile: I'm sure a few other people will too :slight_smile:

Nice one, I was looking into this but the isolated nature of the library development stopped me getting as far as you did.

Well done. Now I just have to get the LCD/GPS/flux capacitor to work ;+)

Matt B

Hi! I need some urgent help please...I bought this ethernet shield liquidware.com/shop/show/ETH/Ethernet+Shield and I followed the instructions at the end but it did not work with my arduino mega....it was difficult to find the spi.h in the mac os but then i did it and replaced it with the spi file provided in the web page...I have tried the examples on the arduino ide but they didnt work, I changed the IP the gateway, etc...but nothing...it was that the connection was not stablished at all.....I need to turn in a project based on this in less than 2 weeks

The standard ethernet shield does not work with the Mega, most reputable places selling the board tell you this. Its because the Mega uses different pins for SPI. There are some fudges around to get around the problem, usually involves soldering and jumpering pins. Use google and do a search for "Arduino Mega ethernet shield". The page you posted does offers a software only solution but it may be specific to a partular build of the IDE. Most solutions are hardware.

Yes you are right...yesterday I followed other solutions available by wiring and using a different SPI file and it worked! =)...thanks for you help anyway

I'm trying this out, but I don't quiet understand this sentence :

When the 4 pin is connected to the PROG jumper of the ethernet shield,

How do I connect a pin to a jumper ?