9 years, 9 months ago.

File Size Limitations?

Hi, thanks for the great library!

It seems to be working well on my custom board modeled after the Nucleo F401, with a uSD card slot. I tested a Transcend 64GB SDXC and a Kingston 4GB SDHC.

I want to data log lots of sensor points, is there a file size where the performance will start to degrade at which point I should create a new file to log to?

I'm not familiar with how mbed handles files, do they buffer the whole file in ram if you open it?

Thanks

Kevin

Question relating to:

A re-written SDFileSystem library with improved compatibility, CRC support, and card removal/replacement support. fatfilesystem, MMC, SD, SD Card, SDHC, SDXC

1 Answer

9 years, 9 months ago.

Hi Kevin, thanks for using my library! Unfortunately, I'm not sure if/when performance starts to diminish when writing to large files. My library is built on top of FATFileSystem, which in turn is built on top of ChaN FatFs. Therefore, any performance issues when dealing with large files would either come from FatFs, or from the FAT32 filesystem itself.

In regards to your other question, files are not loaded into RAM when they're opened. There may, however, be a read/write buffer hidden behind the scenes by the stdio layer, depending on your toolchain.

The mbed library contains some glue code that retargets stdio calls to the appropriate filesystem object. This is what enables calls like fopen() and fwrite() to route correctly to SDFileSystem. Unfortunately, this glue layer is (in my experience) very slow and inefficient. I would recommend you avoid it if possible, and either use the C++ API exposed by SDFileSystem (see this program for an example), or use the FatFs API directly.