I have been trying to get the SD card work with my Uno Ethernet+SD shield, but unfortunately to no avail. When I use it with the Uno by placing it on top of it as it's supposed to, it works fine. However, when I connect it by wires to even the Uno, it doesn't work as well.
I would like to confirm that I'm doing everything correctly.
So, I use 6 wires in total for connecting the shield to the Mega:
gnd->gnd
5v->5v
4->53
11->51
12->50
13->52
I have tried both original SD library and the Adafruit one, but both didn't work.
The beginning of code, in the case of the Adafruit library, looks like this.
...
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 boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
pinMode(53, OUTPUT);
// we'll use the initialization code from the utility libraries
// since we're just testing if the card is working!
while (!card.init(SPI_HALF_SPEED, 53,51,50,52 )) {
...
Every time I open the serial monitor, it says that the initialization failed. However, if I let the Arduino function for a while and it spits out multiple failures, then occasionally it gives the following:
Card type: SD1
Could not find FAT16/FAT32 partition.
Make sure you've formatted the card
Of course, I have tried formatting the card. I feel that this partial progress might be an error in the library since it has given the same message even if the chipSelect pin assigned in the code is completely wrong.
I tried commenting out the lines about pin 10 as well. Is everything correct? Should I physically connect a wire to the pin 10 of the ethernet shield, since it's not connected to anything (I tried that as well, didn't work but suppose it doesn't hurt to ask)?