Pages: [1]   Go Down
Author Topic: SD Card Initialization Help  (Read 1780 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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"
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  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.
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5833
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does it have a formatted microSD card in the slot?
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 138
Posts: 5833
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Offline Offline
Jr. Member
**
Karma: 1
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

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

0
Offline Offline
Sr. Member
****
Karma: 7
Posts: 476
what?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Sheffield, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: