The Fat16 class only supports access to files in the root directory and only supports short 8.3 names. Directory time and date fields for creation, access and write are not maintained.
Fat16 was designed to use the Arduino Version 12 Print class which allows files to be written with print() and println().
It should be possible to use Fat16 with storage devices other than SD flash cards. Hardware access can be through any class derived from the BlockDevice class.
It is possible to open a file with two or more instances of Fat16. A file may be corrupted if data is written to the file by more than one instance of Fat16.
Short names are limited to 8 characters followed by an optional period (.) and extension of up to 3 characters. The characters may be any combination of letters and digits. The following special characters are also allowed:
$ % ' - _ @ ~ ` ! ( ) { } ^ # &
Short names are always converted to upper case and their original case value is lost.
Fat16 uses a slightly restricted form of short names. Only printable ASCII characters are supported. No characters with code point values greater than 127 are allowed. Space is not allowed even though space was allowed in the API of early versions of DOS.
Fat16 has been optimized for The Arduino ATmega168. Minimizing RAM use is the highest priority goal followed by flash use and finally performance. Most SD cards only support 512 byte block write operations so a 512 byte cache buffer is used by Fat16. This is the main use of RAM. A small amount of RAM is used to store key volume and file information. Flash memory usage can be controlled by selecting options in Fat16Config.h.
Microsoft operating systems expect MBR formatted removable media to have only one partition. The first partition should be used.
Microsoft operating systems do not support partitioning SD flash cards. If you erase an SD card with a program like KillDisk, Most versions of Windows will format the card as a super floppy.
The best way to restore an SD card's MBR is to use SDFormatter which can be downloaded from:
http://www.sdcard.org/consumers/formatter/
SDFormatter does not have an option for FAT type so it may format small cards as FAT12 and larger cards as FAT32.
After the MBR is restored by SDFormatter you can reformat it and force the volume type to be FAT16 by selecting the FAT option on XP or specifying the "Allocation unit size" on Vista.
The FAT type, FAT12, FAT16, or FAT32, is determined by the count of clusters on the volume and nothing else.
Microsoft published the following code for determining FAT type:
if (CountOfClusters < 4085) { // Volume is FAT12 } else if (CountOfClusters < 65525) { // Volume is FAT16 } else { // Volume is FAT32 }
4084 < CountOfClusters && CountOfClusters < 65525
The volume will then be FAT16.
If you are formatting an SD card on OS X or Linux, be sure to use the first partition. Format this partition with a cluster count in above range.
For more information about FAT file systems see:
http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx
For information about using SD cards as SPI devices see:
http://www.sdcard.org/developers/tech/sdcard/pls/Simplified_Physical_Layer_Spec.pdf
The ATmega168 datasheet:
http://www.atmel.com/dyn/resources/prod_documents/doc8025.pdf