Go Down

Topic: Arduino Due SD card write speed unpredictable (Read 1 time) previous topic - next topic

TerenceEB

I have been trying to log data to an SD card using arduino due,is it normal that the write speed is not constant(or at least close to being constant) from what i have seen it can take 1400us to write a certain piece of data then later 40000us to write the same piece of data,it looks like its random,its not predictable at all compared to just writing to the serial monitor. I have attached files of both logging to SD and writing to the serial monitor,writing to the serial monitor takes about 6750us and its fairly constant as seen from the graph but logging to the SD card takes 1400us on average but it varies a lot,as you can see with a lot of spikes from the graph

is this normal for an SD Card or not,or is it my hardware or even software...i was able to run the bench test and other sketch examples it worked well so i doubt the software.
I need write speeds that dont vary a lot as timing is important for my project,i am doing a quadcopter and i want to log data,been trying to search but i couldn't find anything useful

fat16lib

The time to write an SD is random and unpredictable.  This has been covered many time in this forum.

The SD spec allows write times to be as great as 250 ms:
Quote
In case of High Capacity SD Memory Card, maximum length of busy is defined as 250ms for all write operations.

While the card should try to maintain that busy indication of write operation does not exceed 250ms in the case of SDXC card, if the card is not possible to maintain operations with 250ms busy, the card can indicate write busy up to 500ms including single and multiple block write in the following scenarios:
a)The last busy in any write operation up to 500ms including single and multiple block write.
b)When multiple block write is stopped by CMD12, the busy from the response of CMD12 is up to 500ms.
c)When multiple block write is stopped by CMD23, the busy after the last data block is up to 500ms.
SD cards are specified to achieve high average data rates for very large multi-block transfers of many MB.

The SD card goes busy while moving data for wear leveling,  erasing large blocks of flash, or other housekeeping activities.  There is no way to control this.

VioletGiraffe

There are now "Application" SD card classes - A1 and A3, these classes specify the minimum required read and write IOPS values. Although these values are very low, I assume traditional cards for photos and videos were even slower than that.

Has anyone tested an A1 or A3 card in the SDFat benhcmark?

Go Up