DFRobot SD module conflict with WIZnet W5100 Ethernet Module SPI Ethernet module

Well,i'm really having some trouble when dealing with the SD and Ethernet module i'm using the DFROBOT SD module(http://www.dfrobot.com/wiki/index.php?title=SD_Module_(SKU:_DFR0071) and The WIZnet W5100 Ethernet Module SPI Ethernet module (http://www.aliexpress.com/item/free-shipping-WIZnet-W5100-Ethernet-Module-SPI-Ethernet-module/577271872.html) and the mega2560 board

I know that both of these device have to use the SPI Mode,so if I want to use one of them,I have to disable the other one, What I want to do is to use the internet to read the image that i saved in my sd card. (http://www.ladyada.net/learn/arduino/ethfiles.html) like this website. Before I try the code above,I try to use the example from the arduino.cc I try the cardinfo and other example for SD,without ethernet module,everything works find,but if I connect my ethernet module, I'm using pin10 to connect the NSS of the ethernet module,my SD module will initiate failed,I can't find out the reason..(I check the pin I use and change other board but the result is the same),following is the code that I only change a little (the pinmode and high signal)from the cardinfo example :

Sd2Card card; SdVolume volume; SdFile root;

// change this to match your SD shield or module; // Arduino Ethernet shield: pin 4 // Adafruit SD shields and modules: pin 10 // Sparkfun SD shield: pin 8 const int chipSelect = 4;

void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only }

Serial.print("\nInitializing SD card..."); // On the Ethernet Shield, CS is pin 4. It's set as an output by default. // Note that even if it's not used as the CS pin, the hardware SS pin // (10 on most Arduino boa rds, 53 on the Mega) must be left as an output // or the SD library functions will not work. pinMode(53, OUTPUT); pinMode(10, OUTPUT); digitalWrite(10, HIGH); //I think this will disable my ethernet module delay(1000); // we'll use the initialization code from the utility libraries // since we're just testing if the card is working! if (!card.init(SPI_HALF_SPEED, chipSelect)) { Serial.println("initialization failed. Things to check:"); Serial.println("* is a card is inserted?"); Serial.println("* Is your wiring correct?"); Serial.println("* did you change the chipSelect pin to match your shield or module?"); return; } else { Serial.println("Wiring is correct and a card is present."); }

// print the type of card Serial.print("\nCard type: "); switch(card.type()) { case SD_CARD_TYPE_SD1: Serial.println("SD1"); break; case SD_CARD_TYPE_SD2: Serial.println("SD2"); break; case SD_CARD_TYPE_SDHC: Serial.println("SDHC"); break; default: Serial.println("Unknown"); }

// Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32 if (!volume.init(card)) { Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card"); return; }

// print the type and size of the first FAT-type volume uint32_t volumesize; Serial.print("\nVolume type is FAT"); Serial.println(volume.fatType(), DEC); Serial.println();

volumesize = volume.blocksPerCluster(); // clusters are collections of blocks volumesize *= volume.clusterCount(); // we'll have a lot of clusters volumesize *= 512; // SD card blocks are always 512 bytes Serial.print("Volume size (bytes): "); Serial.println(volumesize); Serial.print("Volume size (Kbytes): "); volumesize /= 1024; Serial.println(volumesize); Serial.print("Volume size (Mbytes): "); volumesize /= 1024; Serial.println(volumesize);

Serial.println("\nFiles found on the card (name, date and size in bytes): "); root.openRoot(volume);

// list all files in the card with date and size root.ls(LS_R | LS_DATE | LS_SIZE); }

void loop(void) {


Can anyone tell me the reason why I always get failed when connect both of these devices I use pin 50 for MISO for SD and ethernet pin 51 for MOSI for SD and ethernet pin 52 for SCK for SD and ethernet Pin4 for SD module SS Pin10 for ethernet NSS

thx a lot!!