FreeRTOS+FAT minimal disk size.

swichu91 wrote on Thursday, February 01, 2018:


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.

heinbali01 wrote on Thursday, February 01, 2018:


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

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 */ );


swichu91 wrote on Friday, February 02, 2018:


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).

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.