I'm writing here because i can't seem to get the W5100 shield (which has ETHERNET and microSD connectivity) to work with microSD card.
I successfully used the ETHERNET part (on which i'm actually doing another project : a WebServer with lots of functionality and lightful for RAM) and i have problems to have the microSD slot working.
Even if i try to use the microSD examples in the Arduino 0022 IDE.
I formated the microSD card (w/o quick format ; for being sure that all bytes on SD card are "0") with file-system FAT16 and created a file on it named "test.txt" which contains some characters to test the output on serial port.
I then opened the "Dumpfile" examples from SD in IDE and uploaded it to my arduino MEGA2560 board.
Opened terminal and ... "Initializing SD card...Card failed, or not present"
I'm going to try with FAT32 ... but i think it will not help at all because if i unplug the microSD card from the slot, the time laps between "Initializing SD card..." and "Card failed, or not present" appearing, is the same !
I just had to replace; in the demo sketch of SD library :
pinMode(10, OUTPUT)
by
pinMode(53, OUTPUT)
... strange !
By the way, i'm confused now because i can't seem to see nowhere in the sketch the initialization on the SPI bus, does the SD library emulates it on software ?
Will i be able to use both Ethernet & SD at the same time ?
SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI communication using the SPI library. The SPI pins are also broken out on the ICSP header, which is physically compatible with the Uno, Duemilanove and Diecimila.
and for the Uno :
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library.
This is the reason why you had to change the pin10 to 53 as output.
The w5100 and the microSD reader use the SPI interface with the Arduino in master mode. The Arduino default SPI slave select pin (10 on the Uno, 53 on the Mega) must be set as an OUTPUT, or the Arduino SPI will revert to slave mode if the SS pin is set to LOW.
Pin 10 is set as an OUTPUT on both Arduino models. That is the w5100 SS pin.
Pin 4 is the microSD reader SS pin.