FAT File System
Local Menu
IXXAT Platinum Partner
You are here: ".$breadcrumb->show_breadcrumb().""; ?>

FAT File System

FAT is a high-performance, full-featured, FAT12/16/32-based, DOS-compatible file system designed for embedded applications that require the attachment of PC-compatible media, such as flash card memory devices. The FAT product, as distributed, includes pre-tested sample drivers and applications. The API is standard and easy to use. A full test suite is provided in source code form to assist quick integration. Hardware reference designs are also available.

Key features

  • FAT12, FAT16 and FAT32
  • Long Filenames
  • Robust
  • Multiple Volumes
  • Mix of media types
  • Unicode16 support
  • Media Error Handling
  • Fully PC compatible
  • Multiple files open for reading/writing
  • ANSI C compliant C source
  • Standard API (fopen, fclose, fwrite, etc.)
  • Efficient zero-copy read/write
  • Caching Options
  • CheckDisk Utility
  • Detailed Implementation Guide

without tabs >>>
  • Media Types
  • Porting
  • Standard API
  • Unified API
  • CheckDisk
  • Sample Drivers

Media Types

FAT is designed to interface to any standard DOS file system compatible device through standard interface routines (read_sector(), write_sector() etc.). Provided with FAT is a set of reference drivers for quick and risk free integration.

MultiMediaCard, Secure Digital and SDHC Cards

This is probably the simplest method to add a DOS compatible file media to your embedded device. HCC provide a range of drivers for interfacing to SD, SDHC and MMC cards including standard SPI implemented in either hardware or software. HCC provide hardware referecnce designs for implementing this.

Compact Flash Cards

Compact Flash cards require a more complex communication with a PC compatible media but offers performance advantages because of the wider data bus thus generally a higher throughput is achieved and in many cases a reduced CPU load. HCC also provide hardware design information and CPLD logic where appropriate.

Hard Disk Drives

Sample Driver and reference designs have been created for interfacing an IDE HDD to a FAT file system. Also provided in the file system are caching options which are essential when using a HDD. The caching mechanisms combined with the efficiency of FAT and its mainly zero-copy reads and writes gives the best possible performance when implementing a HDD on an embedded system.

Atmel DataFlash

Two types of driver are provided for use with all types of Atmel DataFlash.

A simple driver which does a direct mapping of Dataflash pages to the logical disk is provided as standard.

A more complex driver (DFML) which handles the DataFlash in a more reliable way may be ordered separately.

NAND Flash

HCC have a complete Flash Translation Layer product (FTL) which may be ordered with FAT and which provides a complete, reliable interface for NAND flash.

RAM Drive

A RAM drive is provided as standard and is partuicularly useful in getting a system up and running without any hardware dependencies.

Other Devices

HCC are always adding to their list of supported devices and will also develop specific drivers upon request - contact Nohau to discuss your requirements. HCC also provide bespoke development services


EFFS-FAT is designed to be easily portable - it has very few host system dependencies. It is tested on several commercial RTOSs and also in a stand-alone system with no RTOS. We are not aware of any RTOS it cannot be easily ported to.

All the code is supplied in ANSI compliant 'C', is built on 4 different development environments and run through a syntax checker to ensure the highest level of compatibility.

Also supplied with the system is sample application code (HTTP server and and FTP server) for easy exercise of the system - and sample drivers for different media types with clear reference to their hardware dependencies.

The Developer's Guide gives detailed information on all aspects of porting and indicates clearly the areas which may need to be modified for a particular host system. In particular, the host system may provide:

  • real time clock for time/date information - necessary if time/date information is to be stored with files written.
  • random number - serial number generation during format - recommended only if formatting of media is required.
  • semaphores for mutual exclusion - only required in a pre-emptive system.

HCC is also experienced to provide customised design and development work for your specific project.

Standard File API

General File System Functions
f_getversion Get File System Version Number
f_initvolume Initialise a Volume
f_delvolume Removes a Volume from the System
f_get_volume_count Gets Number of Active Volumes
f_get_volume_list List the Active Volumes

Drive Functions
f_mountdrive Mount a Drive
f_format Format a Drive
f_hardformat Hard Format a Drive
f_getfreespace Get Usage Information From a Drive
f_getdrive Get Current Drive Number
f_chdrive Change Current Drive
f_setlabel Set the Label on a Volume
f_getlabel Get the Label on a Volume

Directory Functions
f_getcwd Get Current Working Directory
f_getdcwd Get a Drives' Current Working Directory
f_mkdir Make a Directory
f_chdir Change Directory
f_rmdir Remove a Directory

File Access Functions
f_open Open a File
f_close Close a File
f_write Write ro a File
f_read Read from a File
f_seek Set Position in a File
f_tell Get Current File Position
f_eof Check if at End of File
f_rewind Move to Start of File
f_putc Put a Character to a File
f_getc Get a Character from a File
f_truncate Truncates a File

File Control Functions
f_rename Rename a File of Directory
f_delete Delete a File or Directory
f_filelength get the Current Length of a File
f_findfirst Find a File or Directory in the Specified Path
f_findnext Find Next File or Directory in the Specified Path
f_settimedate Set the Time and Date on a File or Directory
f_gettimedate Get the Time and Date from a File or Directory
f_setattr Set the Attributes on a File or Directory
f_getattr Get the Attributes from a File or Directory

Note: Although these functions have standard call formats, their names have been prefixed differently to the standard file function definitions to avoid compiler warnings and conflicts when working on systems with another standard API installed. The developer can change these names using defines.

Unified API

Unified API for EFFS-STD and EFFS-FAT

For developers who require failsafe access to their NOR and NAND targeted filesystems (EFFS-STD) and access to their PC compatible devices (EFFS-FAT) we provide a Unified API.

The Unified API allows both file systems to be accessed through a single interface - seemlessly giving all the advantages of the failsafe system and the PC compatible system. The two systems work entirely independently and a wrapper layer is provided to manage all file system calls. This ensures that neither system's performance is influenced by the alternate system.

The Unified API is provided free of charge to customers using bothe EFFS-FAT and EFFS-STD on a product.


FAT file systems were not designed to be completely failsafe. Unexpected power-loss can cause a variety of errors including lost directories, lost chains, or damaged files.

To overcome these limitations HCC also provide a checkdisk utility for use on your target system which may be used to fix/recover from conditions which may occur. The checkdisk utility ensures that the drive is returned to a usable state and allows the recovery of lost data.

Some of the errors the checkdisk utility can handle include lost-chains, cross-linked chains, invalid file lengths, damaged directory entries, damaged FAT entries. It will also give the user the option of recovering lost files.

A standard PC based checkdisk utility would use considerable resources on an embedded system. This utility has been specifically engineered to use minimal resources and resolve all issues that may occur when using EFFS-FAT.

Sample Drivers

  • Compact Flash Cards
  • MultiMediaCards
  • SD, SDv2 and SDHC Cards
  • Hard disk drive
  • RAM drive
  • USB mass storage
  • USB MTP (Media Transfer Protocol)
  • NAND flash
  • Atmel DataFlash