SdFat beta LowLatencyLogger stop logging by itself

Hi there,

I am currently develop a logging system to log a MPU6050. I am using a 3.3v Arduino Pro Mini to log.

I had modified the example in SdFat beta , LowLatencyLoggerMPU6050. I used a switch to start and stop logging anytime.

Attached file is my updated modified example to log MPU6050 using a switch.

Everything run smooth most of the time. It just that sometime, while logging, the system will stop logging by itself and it did not save the file, so it gave me temporary bin file instead. This can be easily solved by re-uploading the code again, and everything will run smooth again.

Even though this does not happen frequent, but I will like to know the reason behind it. Can anyone please show me a clue as why is this happening?

Thank you.

Ming Gui

LowLatencyLoggerMPU6050.zip (6.05 KB)

// Abort run on an overrun. Data before the overrun will be saved.
#define ABORT_ON_OVERRUN 1

I did not dig into the sketch, but in the description there are some warnings on sampling speed, quality of the SdCard, latencies, buffers..
An Sdcard does housekeeping, in random times. The outages could be up to 250ms. In that time the Sdcard does not accept incoming data. So you have to buffer the data till the SDcard finishes its internal housekeeping.
If your buffers are set small (again, when you write 20kB/sec onto the card then you need 20kB*0.250 large buffer), then it comes to Overruns. There is the #define above which may cause the Abort then..