SD issue on EthernetShield + MEGA2560

Hi,
I try to use th SD feature, but that failed.
My config :
Mega 2560 + EthernetShield (W5100)
I user the Arduino 1.0 to prepare and upload my sketches.

I’ve already used this config and all works well for I/O, I2C, Ethernet (server and client)…
I try now to test the SD feature. So I’ve loaded the “CardInfo” example provided with the SD library.
Here is my sketch :

// include the SD library:
#include <SD.h>

// set up variables using the SD utility library functions:
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()
{
Serial.begin(115200);

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 boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
pinMode(53, OUTPUT); // change this to 53 on a mega

// 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.”);
}

With that sketch I get always the “initialization failed…” message.
Of course I’ve a SD card pluged into the slot (microSD 4Gb, FAT32). No problem with the card on a PC (I’ve created a simple “test.txt” file on it from my PC).

I’ve no idea on the reason of the problem.
Someone has an idea ?

Try disabling the w5100 SPI interface. That will sometimes interfere with the SD reader functions. I would stick to the library code for initializing the SD reader also.

pinMode(10,OUTPUT);
digitalWrite(10,HIGH);
if(SD.begin(4) == 0)
{
   Serial.println("SD init fail");
};

edit: Added error checking on the SD.begin() call.

I believe I've found the problem...

My SD card is a new one. It's FAT32 formated, but the volume name was empty.
I've simply reformated it to add a name and it works now on the Arduino slot.

Strange !