Camila_99$$
Camila_99$$
DIIDevHeads IoT Integration Server
Created by Camila_99$$ on 7/19/2024 in #firmware-and-baremetal
working on a program using STM32F103C8T6 where I encounter a problem reading files from an SD card
Good evening guys , I'm working on a program using an STM32F103C8T6 microcontroller where I encounter a problem reading files from an SD card. Here's the relevant part of my program:
if (!SD.begin(CHIP_SELECT)) {
affErreur("CARTE SD");
}
initSeqFP();
dataFile = SD.open("ProgFP.txt"); // Programming file
if (dataFile) {
uint8_t i = 0;
while (dataFile.available()) {
FP[i] = dataFile.readStringUntil('\r\n');
i++;
}
dataFile.close();
litSeqFP();
}
dataFile = SD.open("MaJDate.txt"); // Date update file
if (dataFile) {
Serial.println("MaJDate.txt file opened");
uint16_t v[4];
uint8_t i = 0;
while (dataFile.available()) {
v[i] = dataFile.readStringUntil('\r\n').toInt();
i++;
}
dataFile.close();
// rtc.setDate(v[0], v[1], v[2], v[3]);
SD.remove("MaJDate.txt");
}
if (!SD.begin(CHIP_SELECT)) {
affErreur("CARTE SD");
}
initSeqFP();
dataFile = SD.open("ProgFP.txt"); // Programming file
if (dataFile) {
uint8_t i = 0;
while (dataFile.available()) {
FP[i] = dataFile.readStringUntil('\r\n');
i++;
}
dataFile.close();
litSeqFP();
}
dataFile = SD.open("MaJDate.txt"); // Date update file
if (dataFile) {
Serial.println("MaJDate.txt file opened");
uint16_t v[4];
uint8_t i = 0;
while (dataFile.available()) {
v[i] = dataFile.readStringUntil('\r\n').toInt();
i++;
}
dataFile.close();
// rtc.setDate(v[0], v[1], v[2], v[3]);
SD.remove("MaJDate.txt");
}
8 replies