#include <SPI.h>
#include <SD.h>
File logfile;
void setup() {
Serial.begin(115200);
Serial.println("Starting");
}
void loop() {
Serial.println("Starting loop");
// I'm starting the SD in the loop so that I can see the serial prints in the monitor
if (!logfile) {
if (!SD.begin()) {
Serial.println("SD could not begin, do we have any error?");
} else {
logfile = SD.open("test.log", FILE_WRITE);
}
}
if (logfile) {
logfile.write('t');
logfile.flush();
Serial.println("Wrote to test.log");
}
delay(10000);
}
08:21:29.645 -> Starting loop
08:21:29.942 -> [202764][E][sd_diskio.cpp:200] sdCommand(): Card Failed! cmd: 0x00
08:21:29.942 -> [202770][E][sd_diskio.cpp:761] sdcard_mount(): f_mount failed: (3) The physical drive cannot work
08:21:30.273 -> [203079][E][sd_diskio.cpp:200] sdCommand(): Card Failed! cmd: 0x00
08:21:30.273 -> SD could not begin, do we have any error?
SD.begin(13)
, but I had the same error, and the same happened by adding the following code to esplicitely select the pins:SPI.begin(14, 2, 15, 13);
SPI.setDataMode(SPI_MODE0);
Quote from: LubOlimex on November 20, 2024, 12:04:47 PMBetter try with the ID of T2-SOM204-1Gs16Me8G-MC-I.