How to log into SD card without waiting for aknowledge?

Dear all,

I use SDFat library and calatex sd card module for Arduino Due.
the command for logging data into the card is dataFile.print().

Since SD card works with SPI protocol, I'm wonderig why arduino waits to receive aknowledgment ?
The current experience of mine is that it takes 1-3 ms to log data but sometimes it takes 0.2 seconds!!
This I don't understand. If it is SPI-based, why it should wait for SD card to acknowledge

The current experience of mine is that it takes 1-3 ms to log data but sometimes it takes 0.2 seconds!!

When you call File::print(), the print() method checks to see if there is room in the buffer for the data to be printed. If there is, the data is added to the buffer, and print() returns, nearly immediately.

If there is NOT room, then the contents of the buffer need to be copied to the hardware. THAT takes a lot longer.

This I don't understand. If it is SPI-based, why it should wait for SD card to acknowledge

Why do you assume that such a thing IS happening?

Thanks for the explanation. so how can we reduce that latency of copying?
In other words, isn't there any method so that one could log data at the rate of, lets say, 100Hz reliably ?

my data format includes different variable types, i.e. int16_t, int32_t.

so how can we reduce that latency of copying?

Use a faster Arduino.

Like what? I"m using Due