I'm using a SD-CARD with an arduino nano and uno to send images for an e-ink display.
I have to change images with high rate, and I saw that for differents images, I have differents rate of open an image from SD-CARD.
I saw that if the file is in the root of SD, I get one rate, if was in some folder I have another rate (sometimes better others worst)
The name of file is something that changes a lot the rate of function SD.open().
I tried to debug and understand why the rate changes so much. sometimes takes 100ms and others 1200ms.
Anyone can help me how to increase that rate ? the amount of files is about 600, and is a xbm image (2kb).
That is something that I can change on functions of SD librarys to change that ? ( I already set FULL_SPEEDY for the SPI)
The time to open a file is hard to predict. FAT directories are not ordered so open must do a linear search. Unused directory entries are scattered in the directory.
There is no simple way with SD.h to open files fast when you have 600 or more in a directory.
I would create a large contiguous file and place all the images in this file with each image in a fixed size record. I would then read the records using the raw SD read functions in SD fat.
Create and open a new contiguous file of a specified size.
Parameters:
[in] dirFile The directory where the file will be created.
[in] path A path with a valid DOS 8.3 file name.
[in] size The desired file size.
There is also a function to find the location to the file.