This program illustrates file system and FTP operations for SD Flash cards:
- Mounting a flash drive
- Determining amount of used and free file space
- FTP access. We recommend Filezilla or WinScp
Status messages will be sent out the debug serial port.
Modules with an onboard microSD flash socket should use the multi MMC header files and functions because the modules are capable of supporting both onboard and external flash cards (even if you application only uses one).
- 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
FTP File System Application
Overview
This application demonstrates file system and FTP operations for SD Flash cards on NetBurner embedded systems. It provides a complete example of mounting flash drives, managing file operations, and enabling FTP access for remote file management.
Features
File System Operations
- Mount and initialize external flash drive
- Display directory contents and file listings
- Read and display text files
- Format flash cards (with confirmation prompt)
- Monitor disk space usage (used/free space statistics)
- Support for both long filenames and 8.3 format
FTP Server
- Built-in FTP server running on port 21
- Remote file access via FTP clients (recommended: FileZilla or WinSCP)
- Concurrent file system access for local operations and FTP
- Task-based priority management for FTP operations
System Features
- Network initialization with DHCP support
- NTP time synchronization with manual fallback
- Timezone configuration support
- Interactive command-line interface
- System diagnostics and debug output
Supported Hardware
Flash Card Types
- SD/MMC Cards: Secure Digital and MultiMediaCard support
Module Compatibility
- MOD5441X: Onboard microSD flash socket
- SBE70LC: Onboard microSD flash socket
- Other NetBurner modules with external flash card support
Command Interface
The application provides an interactive menu system accessible via the debug serial port:
Command | Description |
D | Display Directory - Shows all files and folders on the flash card |
E | Display TestFile.txt - Shows contents of the test file |
F | Format SD Flash card - Formats the card (WARNING: destroys all data) |
S | Display Space usage - Shows used and free space statistics |
T | Display system Time - Shows current system time and date |
? | Display Menu - Shows the command menu |
Time Configuration
The application includes timezone support with examples for US time zones:
tzsetchar(
"EST5EDT4,M3.2.0/02:00:00,M11.1.0/02:00:00");
tzsetchar(
"CST6CDT5,M3.2.0/02:00:00,M11.1.0/02:00:00");
tzsetchar(
"MST7MDT6,M3.2.0/02:00:00,M11.1.0/02:00:00");
tzsetchar(
"PST8PDT7,M3.2.0/02:00:00,M11.1.0/02:00:00");
void tzsetchar(const char *tzenv)
Set the system local time.
Setup Requirements
Library Dependencies
- EFFS FAT Library: Embedded Flash File System with File Allocation Table support
FatFile
Must be added to your NetBurner Eclipse project before compilation (libFatFile.a
)
Hardware Setup
- Insert SD/MMC card into the appropriate socket
- Ensure network connection for DHCP and NTP functionality
- Connect debug serial cable for command interface
Network Configuration
- DHCP client automatically obtains IP address
- FTP server accessible on port 21
- 5-second timeout for network initialization
File System Architecture
Multi-Drive Support
Modules with onboard microSD sockets use multi-MMC drivers to support both:
- Onboard flash cards
- External flash cards
- Simultaneous access to multiple cards
Task Management
- Main application runs at
MAIN_PRIO
- FTP server runs at
FTP_PRIO
(MAIN_PRIO - 2)
- Up to 10 tasks can access the file system concurrently
- Each task must call
f_enterFS()
before file operations
Usage Examples
Basic File Operations
- Start the application
- Wait for network initialization
- Use 'D' command to view directory contents
- Use 'S' command to check available space
- Use 'E' command to view test file contents
FTP Access
- Connect FTP client to the device's IP address on port 21
- Browse and transfer files using standard FTP commands
- Simultaneous local and remote access is supported
Formatting Flash Cards
- Use 'F' command from the menu
- Confirm with 'Y' when prompted
- WARNING: This will erase all data on the card
Technical Notes
- All file system operations require prior call to
f_enterFS()
- Debug output is sent to the serial port
- System diagnostics are enabled (disable for production)
- NTP synchronization attempts before falling back to manual time setting
- Long filename support depends on compilation flags
Recommended FTP Clients
- FileZilla: Free, cross-platform FTP client
- WinSCP: Windows-based secure file transfer client
Build Configuration
Compile-time options:
USE_MMC
: Enable SD/MMC support
USE_CFC
: Enable Compact Flash support
MOD5441X
or SBE70LC
: Enable multi-drive support for onboard sockets
F_LONGFILENAME
: Enable long filename support