Emirhan Aydın
New member
I've been working on this for weeks but still I'couldn't any solution. I'm working on a flight control board. Its purpose is to send sensor data to a computer via the LoRa module and write the data read during flight to a microSD card. This allows me to compare the accuracy of the data sent and read. However, I can't initialize the SD card module in my system. The microSD card is formatted in FAT32, I'm using the SPI pins, and the module is powered by an external 5V power supply. I've reviewed many forum threads about SD card initialization issues, but I still haven't been able to resolve the issue. I can't even run a simple SD card initialization code. I've checked the hardware and software repeatedly, but I can't find any problems. Could you review my PCB schematic and code here and help me identify the problem? I must be missing something. (I've defined the Teensy SDFat library in the software section.)
Code:
#include <BufferedPrint.h>
#include <FreeStack.h>
#include <MinimumSerial.h>
#include <RingBuf.h>
#include <SdFat.h>
#include <SdFatConfig.h>
#include <sdios.h>
#include <SPI.h>
SdFat SD;
const uint8_t SD_CS_PIN = 7;
void setup() {
Serial.begin(115200);
while (!Serial) {}
SPI.begin();
// SD kart başlat
if (!SD.begin(SD_CS_PIN, SD_SCK_MHZ(10))) {
Serial.println("SD Kart failed to initialize!");
return;
}
Serial.println("SD Kart initialized.");
// Dosya oluşturma ve yazma
FsFile file = SD.open("test.txt", O_WRITE | O_CREAT);
if (file) {
file.println("hello Teensy 4.0!");
file.close();
Serial.println("file written.");
} else {
Serial.println("file could not be opened !");
}
}
void loop() {
}