Hello,
i'm using multiple Arduino Nano BLE 33 to log data to a SD Card. At first, everything works fine, until I take a closer look to the logged timestamps: The log stuck recurrently in a same time pattern! In my case, I'm logging data every 6ms, but every 60ms the log stuck for 15ms.
That's why I created a bare example of the SD-Card logging:
#include <SPI.h>
#include <SD.h>
const int chipSelect = 10;
File myFile;
void setup() {
Serial.begin(9600);
while (!Serial) {
;
}
Serial.print("Initializing SD card...");
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
while (1);
}
Serial.println("card initialized.");
}
void loop() {
myFile = SD.open("test.csv", O_CREAT | O_APPEND | O_WRITE);
if(myFile){
for( int i = 0; i < 10000; i++ ){
myFile.println(millis());
}
}
myFile.close();
}
The Pin connection (MISO, MOSI, CLK) is as usual (I connected CS to Pin 10).
After running the bare example and evaluate the milliseconds I received a similar output: The logging stuck for 13ms every 15ms!
Output extract:
7884
7884
7884
7884
7884
7884
7884
7897 <<< stuck 13ms
7897
7897
7897
7897
7897
7897
7897
7897
7897
7897
7897
7897
7897
7897
7897
7897
7897
7897
7897
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7898
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7899
7912 <<< stuck again 13ms after 15ms
7912
7912
7912
7912
7912
7912
7913
7913
What is happening here? I could really need some help Should I use the mbed-SD libraries (SDFileSystem / SDBlockDevice) instead of the Arduino-SD.h? Sadly, I didn't get this lib to work...
Thanks a lot!
Klaus