FreeRTOS+FAT minimal disk size.

swichu91 wrote on Thursday, February 01, 2018:

Hello,

Is there any info about minimal size of disk to actually mount fully working FAT file system ? I am planning to use FreeRTOS+FAT on external SDRAM(16MBytes) and wondering if FAT12 or FAT16 will fit.

Thanks in advance.
Mateusz

heinbali01 wrote on Thursday, February 01, 2018:

Mateusz,

You are not the only one asking for a small partition, please read:

https://sourceforge.net/p/freertos/discussion/382005/thread/2fa0a26d
https://sourceforge.net/p/freertos/discussion/382005/thread/59ac4be5

Microsoft invented FAT and they defined the limits (minimal cluster count) per FAT type (12, 16, or 32).
By default, FreeRTOS+FAT is following these rules. But you can override them.

I prefer to use FAT16 above FAT12, because it is more efficient. So when I need a small RAM-disk, I would define for instance the following in FreeRTOSFATConfig.h :

    /* No support for FAT12: */
    #define ffconfigFAT12_SUPPORT 0

    #define ffconfigMIN_CLUSTERS_FAT16        32
    #define ffconfigFAT16_ROOT_SECTORS        8

Call FF_Format() as follows :

    FF_Format( pxDisk, 0 /* xPart *, pdTRUE /* xPreferFAT16 */, pdTRUE /* xSmallClusters */ );

Regards.

swichu91 wrote on Friday, February 02, 2018:

Hein,

I used search bar but looks like I was typing wrongs search phrases. Anyway these are great info. I was using +FAT in past but couldn’t launch it on nothing more than SD card.

I will give it a try and report problems if any(I hope there won’t be any).

Update:
I have succesfully managed to mount 4MBytes partition on RAMDisk without any problems. One thing to notice is fact that all FAT API functions need to be invoked after kernel started i.e in task.

Mateusz