TinkerIt Ethernet SD won't connect

Hello,

I am trying to get my Arduino Duemilanove to read/write to an SD card. I have a TinkerIt ethernet board, with solderpads for an SD slot. Since I assumed those pads had to be connected to something, I've soldered an SD slot to the ethernet shield. Plugged in an SD card, turned on the power.. LEDs turned on and no smoke escaped XD

To actualy read or write to the card, I've at first used the default 1.01 SD library. My code:

#include <SD.h>

File file;

void setup()
{
  Serial.begin(9600);


  Serial.print("Initializing SD card...");
   pinMode(10, OUTPUT);
   
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
  
  myFile = SD.open("test.txt", FILE_WRITE);
  
  // if the file opened okay, write to it:
  if (myFile) {
    Serial.print("Writing to test.txt...");
    myFile.println("testing 1, 2, 3.");
	// close the file:
    myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
  
  // re-open the file for reading:
  myFile = SD.open("test.txt");
  if (myFile) {
    Serial.println("test.txt:");
    
    // read from the file until there's nothing else in it:
    while (myFile.available()) {
    	Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
  } else {
  	// if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
}

void loop()
{
	// nothing happens after setup
}

Yes, this is the ReadWrite example provided with the SD library :wink: When I run this code, it say "Initialization failed!". Hence SD.begin(4) failed. I also tried ports 8 and 10, but since this is an ethernet port I believe 4 is the correct port.

Next I tried the SDFat library:

#include <SdFat.h>

SdFat sd;


void setup(){
  Serial.begin(9600);  
  digitalWrite(10,OUTPUT);
  
  if (!sd.init(SPI_FULL_SPEED, 4)) sd.initErrorHalt();
  
  ifstream file("HELLO.TXT");
  if (!file.is_open()) Serial.println("open failed");
  
  
  
}

void loop(){}

Not a lot of code, but it still fails at the initialization. Again, I tried ports 8 and 10 as wel.

Finally I tried the Quickstart example provided with SDFat. Manualy entered different port numbers, and yet again, failed.

I have tripple checked AND resoldered the SD slot. I have tested the setup with a 8GB formatted at FAT32 and a 2GB SD card formatted at FAT16 , both formatted at FAT32. I am aware FAT16 is prefered, but it should still work with FAT32.
Unfortunatly I can not find any decent information about the Tinker It ethernet shield, but it is based on a Wiznet W5100.

Using the SD slot does make the W5100 chip warm up, but it does not become hot. I can still use the ethernet module, so the chip is still alive and well.

Also, I do notice a lot of ethernet shields have Micro-SD slots, leaving a couple of solderpads unused. Since I am using a regular SD card, does this make a difference?

Does anyone know where to look for as to why the SD card can not be read?
Thanks :grin:

edit: 2GB card was formatted at FAT16, not FAT32

You should disable the w5100 SPI before setting up the SD card. Note pin 10 HIGH.

  // disable w5100 SPI
   pinMode(10, OUTPUT);
   digitalWrite(10,HIGH);
   
  Serial.print("Initializing SD card...");
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

Thanks for your reply.

I have set pin 10 to high, while using the default SD library and the SdFat library. I have tried this with both my SD cards.

#include <SdFat.h>

SdFat sd;

void setup(){
  Serial.begin(9600);  
  digitalWrite(10,OUTPUT);
  digitalWrite(10,HIGH);
  
  if (!sd.init(SPI_FULL_SPEED, 4)) sd.initErrorHalt();
  ifstream file("HELLO.TXT");
  if (!file.is_open()) Serial.println("open failed");
}

void loop(){}
#include <SD.h>

void setup()
{
  Serial.begin(9600);

   // disable w5100 SPI
   pinMode(10, OUTPUT);
   digitalWrite(10,HIGH);
   
  Serial.print("Initializing SD card...");
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
  
}

void loop(){}

No luck so far. Both still fail while initializing.

Well, this explains a lot..
I have measured all SD slot pins. Normally the DataIn, DataOut and Clock pins should be connected to the SPI ports of the Arduino (11,12,13). Instead they are wired to the following Arduino pins.
CS, pin 6
DataIn, pin 8
DataOut, pin 3
Clk, pin 9

This corresponds exactly with the data here http://arduino.cc/playground/Main/EthernetShieldSDHardwareSPIMod.
So I hardwired the ethernet board like said, and I was able to connect to the SD card XD