EFFS-FAT-Basic File System Example
Overview
This program demonstrates basic file system operations for SD/MMC and Compact Flash cards using the Embedded Flash File System with File Allocation Table (EFFS-FAT) library. The application provides a comprehensive example of external flash storage management on embedded systems.
- Note
- All EFFS FAT examples require that you add the Embedded Flash File System File Allocation Table (EFFS FAT) library to your project: Add a Library to a Project
Features
The application demonstrates the following file system operations:
- Drive Mounting: Initialize and mount external storage devices
- Space Management: Determine used and free file space on the storage device
- File Creation: Create new files on the external storage
- Data Writing: Write data to files on the storage device
- Data Reading: Read data from files on the storage device
- Drive Unmounting: Safely unmount the storage device
Supported Storage Types
The application supports multiple storage interfaces:
- SD/MMC Cards: Secure Digital and MultiMediaCard support
- Compact Flash Cards: CompactFlash card support
- Multi-drive configurations: For modules with onboard flash sockets
Hardware Compatibility
The application includes specific support for:
- MOD5441X modules
- SBE70LC modules
- Other NetBurner modules with MMC/SD or CFC interfaces
Program Flow
- Initialization: Network stack initialization and system diagnostics
- File System Entry: Register the current task for file system access
- External Flash Initialization: Initialize the CFC or SD/MMC drive
- Status Display: Show file space usage statistics
- Directory Listing: Display existing files and directories
- Read/Write Operations: Perform file system read and write tests
- Cleanup: Unmount the file system and release resources
Important Notes
File System Access
- The
f_enterFS()
function must be called in every task that accesses the file system
- This function should only be called once per task before any other file system operations
- Up to 10 tasks can simultaneously access the file system (can be increased)
- Tasks can be removed from file system access using
f_releaseFS()
Web Server Limitations
- For web server functionality with external storage, refer to the EFFS-HTTP example
Library Requirements
- Note
- All EFFS FAT examples require adding the Embedded Flash File System File Allocation Table (EFFS FAT) library to your project.
Output
The program displays status information through the debug serial port, including:
- Program startup messages
- File system statistics
- Directory contents
- Read/write operation results
- Program completion status
Usage
- Ensure your NetBurner module has the appropriate external flash interface (SD/MMC or CFC)
- Insert a compatible flash card into the module
- Build and deploy the application to your NetBurner module
- Monitor the debug serial output for program status and results
- Reset the device to repeat the demonstration
Build Configuration
The application uses preprocessor definitions to determine the storage type:
USE_MMC
: Enable MMC/SD card support
USE_CFC
: Enable Compact Flash card support
MULTI_MMC
: Enable multi-drive MMC support (for specific modules)
File Structure
main.cpp
: Main application code with UserMain() function
ReadMe.txt
: Original documentation
FileSystemUtils.h
: Header file for file system utility functions
Error Handling
The application includes proper error handling for:
- File system mounting/unmounting operations
- File access operations
- Network initialization timeouts
- Resource cleanup
- Note
- After completing all operations, the program enters an infinite loop and must be reset to repeat the demonstration.