I can't consistently initialize SD card in my application. It randomly succeeds and fails.
I use Arduino Uno and SunFounder SD card reader.
SD card - 32G formatted as MS-DOS FAT
Here is the code
#include <Arduino.h>
#include <SD.h>
void setup() {
Serial.begin(9600);
if (!SD.begin(SPI_QUARTER_SPEED, 19)) {
Serial.println("cannot initialize card");
} else {
Serial.println("looks good");
}
}
void loop() {
}
I use analog pin as CS.
I don't have any capacitors, resistors etc in the schema. How can I investigate what is going on there? How to fix it?