Go Down

Topic: SD Card Initialization Help (Read 1 time) previous topic - next topic

rptort

I purchased this shield:  http://iteadstudio.com/store/index.php?main_page=product_info&cPath=18&products_id=232

Right now all I'm trying to do is initialize it, and I can't seem to get it to work. I have some experience with arduino, but I am completely new to the SD stuff and reading/writing files.  This is the code I got from the arduino website:

Code: [Select]
#include <SD.h>

// SD Card Test

void setup() {
  Serial.begin(57600);
  SD.begin(10);
 
  Serial.print("Initializing SD card...");
  pinMode(10, OUTPUT);

  if (!SD.begin(10)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");
}

void loop() {
 
}


Please help me out. Thanks.

PaulS

Quote
This is the code I got from the arduino website

OK.

Quote
Please help me out.

OK. The door's over that way...

Do you have a problem that you need help with? If so, what is it?

rptort


Quote

Do you have a problem that you need help with? If so, what is it?


Yes...the card won't initialize. From what I've read, if it worked, the SD.begin() would return "true" but it's returning "false"

PaulS

Code: [Select]
  SD.begin(10);
 
  Serial.print("Initializing SD card...");
  pinMode(10, OUTPUT);

  if (!SD.begin(10)) {

Perhaps you should investigate just how often to call SD.begin(). Hint: Once. Only once. Exactly once. Not twice. Not more than once. Not less than once.

rptort

I erased the first SD.begin and just called it ONCE in the if statement, and it still returns false. Any other ideas?

SurferTim

Does it have a formatted microSD card in the slot?

rptort

Not micro...just a regular SD card. And I followed these instruction for formatting the card on OSX:  http://arduino.cc/en/Reference/SDCardNotes

SurferTim

This is mounted on an Uno, not a Mega, correct?

Other than that, I would suspect maybe it was not formatted correctly.

rptort

Yes Uno. Are the directions from that website correct?

Also, someone told me that modern SD cards cannot be used with the Arduino software...no idea why or where they got that information, but is that a possibility?

MushfiqSarker

You need to use a SD card that is less than or equal to 2GB. Next, I could not get Mac to format properly so I did it on a PC. The formatting is different on a PC.

Follow this tutorial: http://www.ladyada.net/products/microsd/

Should be roughly the same for your application.

Check out my site for DIY information: http://inventige.com

P18F4550

It's a bit hit and miss, sandisk 2gb micro sd seem to work for me but neither a sandisk 256 or 512mb work, also they should be formatted as FAT not FAT16

neilk

I had a lot of trouble getting an SD Card interface to work. There is a long series of postings about it on Element14

1. I assume the interface board includes 5v to 3.3v conversion on the SD Card signals? The documentation doesn't mention it.

2. I can't justify this, but maybe the Serial should be intitialised at 9600 and your serial monitor speed adjusted accordingly.

3. YES YES YES it matters which SD card you use..........I can't give you any very firm guidelines except that for me a San Disk Extreme III 1.0 GB works fine but a Transcend 2GB micro SD doesn't work. A whole host of other makes of cards won't work either (reported by other posters), especially some cheap unlabelled ones.

If you are confident that the hardware is good and your (corrected) program looks OK, keep trying different SD cards.

Go Up