Hello all,
Trying to do a data logger, I used Greiman's "TeensySdioDemo.ino" to test File writing with a teensy 3.6 on a 8GB SanDisk Ultra and a 8GB low cost one (I do not remember where it comes from).
I dont need high average speed but continuous writing speed, and therefor I whished to estimate the duration of the busy wait state / write time of the SD, which can induce data lost...
So I modified a litle bit "TeensySdioDemo.ino" to plot the write time for each 32kB block along the file write.
"run test" writes N files of N blocks of N Bytes , each "N" being choosen by the user.
In summary :
- the type of SD card is very very important... (not new)
On the SanDisk busy periods where more frequent but shorter than on the "low cost" card.
- A 10 milli-second pause between block write, improves the write speed of the blocks (not of the file) or decrease busy states occurence/duration.
- I do not find any improvement using pre-allocating/erasing. This said I am not sure to have correctly used the code of "tni" to pre-allocate, pre-erase the file space. "my" durty code is there under attached. If lines 62..78 are wrong, please help me...
View attachment K66-TeensySdioDemo.ino
A few fig of my trials : ( Milli-Seconds in ordinate / 32kBytes Block Number in abscissa. )
I am interested in any Ref of good SD cards...
Thank's in advance. y.
SanDisk not preallocated
SanDisk preallocated : a little bit cleaner at the beginning?
SanDisk not preallocated but a 10mS pause between 32kB block write : Small busy states disappeared...
LowCost not preallocated
LowCost preallocated : I could not allocate more than 4096 blocks on this card, anyway no clear improvment... ( X scale changed )
LowCost not preallocated but a 10mS pause between 32kB block write : the big spike disappeared ( Y scale changed )
Trying to do a data logger, I used Greiman's "TeensySdioDemo.ino" to test File writing with a teensy 3.6 on a 8GB SanDisk Ultra and a 8GB low cost one (I do not remember where it comes from).
I dont need high average speed but continuous writing speed, and therefor I whished to estimate the duration of the busy wait state / write time of the SD, which can induce data lost...
So I modified a litle bit "TeensySdioDemo.ino" to plot the write time for each 32kB block along the file write.
"run test" writes N files of N blocks of N Bytes , each "N" being choosen by the user.
In summary :
- the type of SD card is very very important... (not new)
On the SanDisk busy periods where more frequent but shorter than on the "low cost" card.
- A 10 milli-second pause between block write, improves the write speed of the blocks (not of the file) or decrease busy states occurence/duration.
- I do not find any improvement using pre-allocating/erasing. This said I am not sure to have correctly used the code of "tni" to pre-allocate, pre-erase the file space. "my" durty code is there under attached. If lines 62..78 are wrong, please help me...
View attachment K66-TeensySdioDemo.ino
A few fig of my trials : ( Milli-Seconds in ordinate / 32kBytes Block Number in abscissa. )
I am interested in any Ref of good SD cards...
Thank's in advance. y.
SanDisk not preallocated
SanDisk preallocated : a little bit cleaner at the beginning?
SanDisk not preallocated but a 10mS pause between 32kB block write : Small busy states disappeared...
LowCost not preallocated
LowCost preallocated : I could not allocate more than 4096 blocks on this card, anyway no clear improvment... ( X scale changed )
LowCost not preallocated but a 10mS pause between 32kB block write : the big spike disappeared ( Y scale changed )