Questions & AnswersSD Card – Not working
Ken Schuman asked 8 months ago

Trying to use the Arduino SD Card Library to read/write the SD Card on DevDuino. Trying CardInfo sketch, and others, all fail.
No matter what pin I try, the sketch reports
Initializing SD card…initialization failed. Things to check:
* is a card inserted?
* is your wiring correct?
* did you change the chipSelect pin to match your shield or module?
I have verified the card is formatted FAT16 and can read it on my PC.
I have tried reseating the SD Card as well.
Furthermore, SCLK and MOSI light up when I upload sketch and start the Serial Monitor,  but MISO never lights up.
Can you please help?

3 Answers
Alex Staff answered 8 months ago

Hi Ken
First of all, I would recommend to check out the following project I did two years ago: http://www.les-electroniciens.com/videos/concevoir-un-enregistreur-donnees
There is an archive called datalogger.zip including some code and a schematics.
Try to start from there, it should be working.
Once I’ll have more spare time, I will add to the DevDuino library an example about the SD card.
If you are still convinced that something is really wrong, then have a look on the soldering U8 and P5: http://devduino.cc/getting-started/schematics/
There are number 17 and 36 on the gerbers: http://devduino.cc/getting-started/gerbers/

marcoux_a answered 8 months ago

Ken, I did some test and it looks like the SD card take comes with the kit is not working well… I was seeing the same issue, but I sometime get a conection.
I switch to another SDcard I had on hand and it works perfectly… I did notice the card that comes with the kit would be detected, but not work correctly, while probing MISO/MOSI…

grychowski.bg answered 7 months ago

I cannot make it work also. What is CS pin with devduino ?  
Does the SD Card exemple should work if I only change pin number ?
Thanks  

marcoux_a replied 7 months ago

Yes the default example (like cardinfo) will work (for me…)
const int chipSelect = SS; seem to help on the card provided, but then putting anything with a good card looks to works…

grychowski.bg replied 7 months ago

Thanks for your answer.
With const int chipSelect = 9 in cardinfo, I get random results :

-with sd card from devduino kit : either
— Initializing SD card…initialization failed. Things to check:
* is a card inserted?
* is your wiring correct?
* did you change the chipSelect pin to match your shield or module?

— or that it cannot find valid fat16/fat32 partition (I format card on PC with fat ot fat 32 and put a file in it)

-with a Samsung sd card either :

— same initialization error as before

— or it works correctly

I cannot reproduce what happens. It seems random.

grychowski.bg replied 7 months ago

I cannot have consistent result. I wrote the following program, inspired by cardinfo to display message on the OLED screen of Devduino :

#include
#include
// set up variables using the SD utility library functions:
Sd2Card card;

const int chipSelect = 9;

void setup() {

devduino.begin();

console.println(“Init”);

// we’ll use the initialization code from the utility libraries
// since we’re just testing if the card is working!
if (!card.init(SPI_HALF_SPEED, chipSelect)) {
console.println(“failed”);

while (1);
} else {
console.println(“OK”);
}
}

void loop(void) {
}

I tried 10 times I got 7 OK and 3 failed (with a 32 gb Samsung Card. I did not touch the card. I use devduino switch to shut down and restart)
Another try : 9 OK 1 failed (7th time)

grychowski.bg replied 7 months ago

Sorry 2 first lines are :

#include
#include

grychowski.bg replied 7 months ago

It does not write correctly.

I Include :
SD.h
devduino.h