Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
FatFS Example

Purpose

The FatFS example will help you to get familiar with filesystem and the ctrl access modules provided by the asf. It provides sample code of common operations of a filesystem through the abstraction memory based on ctrl access services. It can also help you to configure the filesystem according to your own needs, which can be used for fast implementation of your own filesystem and other applications related. FatFs is a generic file system module to implement the FAT file system to small embedded systems.

Requirements

This package can be used with all MCU boards with Memory Control Access support. The conf_access.h used in the ctrl access module will determine the actually used memory device, e.g., the file system can be created in the internal RAM, NAND Flash and DataFlash (an AT45DBX needs to be connected) on SAM3X-EK/SAM3N-EK/ SAM3S-EK/SAM3U-EK/SAM4E-EK/SAM4S-EK/SAM4S-Xplained/ATxmega128A1-Xplained/ ATxmegaA3BU-Xplained/SAM4N-Xplained-Pro/SAM4CMP16C-SAM4CMP-DB/ SAM4CMS16C-SAM4CMS-DB/SAMV71-Xplained-Ultra/SAME70-Xplained. The file system is created in the Micro SD/MMC on IO1 extension board connected to SAM D/R/L Xplained Pro.

Description

When launched, this program will check the existing file system on the abstraction layer of memory through the ctrl access service. The abstraction layer of memory can be configured by the conf_access.h. There are 2 cases:

  • The memory is not yet formatted. The program formats it with FAT file system.
  • The memory is already formatted. The program will read the content of the memory and re-format the memory with FAT file system.

Then a Basic.bin file will be created, written with a special pattern and closed. Finally the file will be reopened and its data will be verified.

Usage

-# Build the program and download it into the evaluation board.
-# On the computer, open and configure a terminal application
   (e.g., HyperTerminal on Microsoft Windows) with these settings:
  - 115200 bauds (or 38400 bauds on SAM D/R/L Xplained Pro)
  - 8 bits of data
  - No parity
  - 1 stop bit
  - No flow control
-# In the terminal window, the
   following text should appear (values depend on the board and the chip

used):

-- FatFS Example --
-- xxxxxx-xx
-- Compiled: xxx xx xxxx xx:xx:xx --
-I- Mount disk 0
-I- xxxxxx
  1. The application will output the converted value to hyperterminal and display a menu for users to set different modes.