Offline
Jr. Member
Karma: 1
Posts: 69
|
 |
« on: March 17, 2012, 10:06:38 pm » |
I purchased this shield: http://iteadstudio.com/store/index.php?main_page=product_info&cPath=18&products_id=232Right 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: #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
Online
Brattain Member
Karma: 311
Posts: 35471
Seattle, WA USA
|
 |
« Reply #1 on: March 18, 2012, 08:34:03 am » |
This is the code I got from the arduino website OK. 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
Jr. Member
Karma: 1
Posts: 69
|
 |
« Reply #2 on: March 18, 2012, 10:03:35 am » |
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
Online
Brattain Member
Karma: 311
Posts: 35471
Seattle, WA USA
|
 |
« Reply #3 on: March 18, 2012, 05:06:50 pm » |
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
Jr. Member
Karma: 1
Posts: 69
|
 |
« Reply #4 on: March 18, 2012, 09:02:16 pm » |
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
Faraday Member
Karma: 50
Posts: 3448
|
 |
« Reply #5 on: March 18, 2012, 10:31:46 pm » |
Does it have a formatted microSD card in the slot?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 1
Posts: 69
|
 |
« Reply #6 on: March 18, 2012, 10:40:58 pm » |
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
Faraday Member
Karma: 50
Posts: 3448
|
 |
« Reply #7 on: March 18, 2012, 10:58:55 pm » |
This is mounted on an Uno, not a Mega, correct?
Other than that, I would suspect maybe it was not formatted correctly.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Jr. Member
Karma: 1
Posts: 69
|
 |
« Reply #8 on: March 18, 2012, 11:08:40 pm » |
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
Newbie
Karma: 0
Posts: 25
|
 |
« Reply #9 on: March 18, 2012, 11:13:35 pm » |
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
|
|
|
|
|
0
Offline
Sr. Member
Karma: 5
Posts: 468
what?
|
 |
« Reply #10 on: March 26, 2012, 03:54:32 am » |
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
Newbie
Karma: 0
Posts: 1
|
 |
« Reply #11 on: April 06, 2012, 05:12:31 am » |
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
|
|
|
|
|
|