Need Help Arduino Duemilanove, Sparkfun SD & Ethernet Shield

Hi,

I used a lot the microSD Shield Retail (RTL-09899) collecting some infos from analog and digital pins and writing on SD card, using the Example sketch (http://www.sparkfun.com/tutorial/microS … xample.pde) and the FAT16 Library (http://www.sparkfun.com/Code/FAT16.zip).

When I attached an Arduino Ethernet Shield (DEV-09026) and add some lines to the sketch I can´t write nothing to SD card anymore.

#include <Ethernet.h>
#include <SPI.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 2, 2 };

void setup(void)
{ 
  Serial.begin(9600);
  pinMode(10, OUTPUT);
  card.init();
  volume.init(card);
  root.openRoot(volume);
  digitalWrite(8, HIGH);  // I set HIGH and LOW but I can´t write on SD Card
  Ethernet.begin(mac, ip); // The only one line code to init Ethernet
  digitalWrite(10, HIGH);  // I set HIGH and LOW but I can´t write on SD Card

}
...... the code from  Sparkfun without any ethernet code

When I disconnect a Ethernet Shield and comment the lines:

#include <Ethernet.h>
#include <SPI.h>

  digitalWrite(8, HIGH);  // I set HIGH and LOW but I can´t write on SD Card
  Ethernet.begin(mac, ip); // The only one line code to init Ethernet
  digitalWrite(10, HIGH);  // I set HIGH and LOW but I can´t write on SD Card

the sketch wrote infos on SD Card again.

I read SPI modules don´t work simutaneously and I need to switch SD [pin 8] Xor Ethernet [pin 10] and I need to switch among then.

Is there a hint ou some code that permits to use both shields.

Hawk:
I read SPI modules don´t work simutaneously and I need to switch SD [pin 8] Xor Ethernet [pin 10] and I need to switch among then.

Is there a hint ou some code that permits to use both shields.

Because you’re asking this question I’m assuming that you have the older style Ethernet board which doesn’t have a microSD socket on it.

Unfortunately the W5100 chip on the older version of this shield has a hardware bug which prevented other devices on the SPI bus from communicating properly. The new-style Ethernet shield has a workaround included for this bug but the older style does not.

I found a reference to an [Ethernet shield hardware work-around that can be implemented for the older-style shield (see also the later comments in that thread):

If you do try to use the old Shield with an SD SPI interface (or any other SPI port device), you will have to do something about the Wiznet SPI bug. I used a single section of a CD4049 instead of the 74LVC14 shown on the new Shield schematic to invert the Ethernet SS signal and apply it to the SEN pin on the Wiznet device.

I haven’t actually implemented this workaround but the theory seems sound to me.

–Philip;](http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1281785804/4#4)