Hello, I am trying to build a flight data recorder for my airplane using an SD card module and Arduino Mega but I am getting the error initialization failed!
I couldn't find the name of the module but here is where I bought it:
Mikro SD Kart Modülü en uygun fiyatla Robotistan'da! 17:00'a kadar aynı gün kargo, 250TL üzeri alışverişlerde bedava kargo, taksit seçenekleri ve kapıda ödeme avantajlarıyla 5000'den fazla maker ürününü Robotistan güvencesiyle şimdi satın alın.
This module has level shifter on board so it is tolerant to 5V ardunio boards.
I used the following sketch:
https://create.arduino.cc/projecthub/electropeak/sd-card-module-with-arduino-how-to-read-write-data-37f390
I triple checked the wiring and here it is:
MOSI => 51, MISO => 50, SCK => 52 , SS => 53
I tried using the module on Ardunio UNO and it worked great.
I checked if the cables or ardunio pins are faulty using a multimeter. They worked great. Ardunio SPI pins are connected to atmega chip (checked).
I am not sure if I am doing something wrong. All input is appriciated
SOLVED! Guys even though it says initialization failed it actually is not failing. I dont understand why but when you change the part
Serial.print("Initializing SD card...");
if (!SD.begin(10)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");
to
SD.begin();
it starts to work marvelously !!
But It would be still helpful if someone can explain why did it say failed in the first place
srnet
July 13, 2020, 4:09pm
3
SD.begin(10) means use pin 10 for the SS on the SD card.
SD.begin() means use the default pin which is 53 on a Mega.
Well, it explains everything. Thanks