FAT16/32 Full File System Driver

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 3
Request group membership
By: Kwabena W. Agyeman, created: 2013-03-27 | updated: 2013-05-07

A FAT16/32 full file system driver that runs on one cog.  The code has been fully optimized with a super simple spin interface for maximum speed and is also fully commented.

Provides full support for:

Mounting and unmounting FAT16 or FAT32 partitions on Secure Digital Cards (SD Cards) and Multi-Media Cards (MMC Cards).

Any mounted FAT16 or FAT32 partition can be queried for its count of clusters, total sectors, sectors per cluster, bytes per sector, used sector count, free sector count, file system type, volume label, volume identification number, and disk signature number.

All files and folders on the mounted FAT16 or FAT32 parition can be queried for their name, size, creation day, creation month, creation year, creation second, creation minute, creation hour, last access day, last access month, last access year, last modification day, last modification month, last modification year, last modification second, last modification minute, last modification hour, read only status, hidden status, system status, directory status, and archive status.

Additionally, there is support for changing directories, changing file or directory attributes, moving and renaming files or directories, deleting file or directories, making new files, and making new directories. By default all functions accept file system paths as arguments.

All files on the partition can be opened in read, write, or append mode. Byte/short/long reading/writing are supported on any open file. Additionally string reading/writing and block reading/writing are supported on any open file. File seek, file tell, and file size are also supported for any open file.

Ontop of that, formating any parition on the SD card is supported and rebooting from any valid .bin or .eeprom file on the SD card is supported.

Finally, card detect and write protect logic is built into the file system. A time stamp system using a real time clock is also supported.

This driver supports the FAT file system specification to the letter. The file system is locked by individual cogs per access and supports multiple files open by including multiple copies of the object.

  • File Byte Reading Speed - 3KBs
  • File Byte Writing Speed - 3KBs
  • File Short/Word Reading Speed - 6KBs
  • File Short/Word Writing Speed - 6KBs
  • File Long Reading Speed - 13KBs
  • File Long Writing Speed - 12KBs
  • File Sector (512 Bytes at time) Reading Speed - 241KBs
  • File Sector (512 Bytes at time) Writing Speed - 110KBs

This list of features is not comprehensive. Please download the source code and run the included demo to gain a better understanding of this driver.

Please vist http://www.parallaxsemiconductor.com/an006 for more info.

 

Original File Upload
AttachmentSize
Package icon Full_File_System_Driver_3.zip934.45 KB

Comments

[originally posted by Anonymous on 2010-09-27 18:23:32] I am having trouble getting the code to mount the micro sd card. It is formatted as FAT is that a problem? If so how do I reformat it? XP only has HEX when I try to format it. Thank you Jim Cullins

[originally posted by Anonymous on 2010-10-14 17:35:44] Great job !! works a treat! Jim Cullins
 
[originally posted by Anonymous on 2010-12-24 22:45:09] Works perfectly, thank you! /Benjamin
 
[originally posted by Anonymous on 2011-02-04 22:37:54] This is a lot better than what I was writing :) thank you!!!
 
[originally posted by Anonymous on 2011-04-04 07:22:18] Not working with 2GB card (SanDisk) - ok with 1GB cards ... Am using PropCMD which works ok with 2GB cards ... When I run it on the SD3.0 I get "unsupported file system" - no format or mount works even if I format it on the pc ....
 
[originally posted by Kwabena W. Agyeman on 2011-04-20 11:31:43] This is a problem with how data is laid out on the SD card. You will need to reformat the MBR of the SD card. This can't be done easily with Windows. If you force the MBR of the card to be corrupted Windows will preform a low level fix of it making the card work with the driver. Otherwise use a different card.
 
[originally posted by Anonymous on 2012-02-02 13:32:11] Your stuff is always wonderful!!
 
[originally posted by Anonymous on 2013-01-31 00:14:05] Have just started with this object, code is readable and seems to work very well with an assortment of SD cards. One spot in the comments that threw me off a bit was the comment on the partitionError method. It says "Returns true if the file system errored and false if not." I believe it should say "Returns error number (ie 1-18) if the file system errored and false if not." But then again I have just started working with this object and may not really know what I am talking about... Nate
 

Greetings,

I'm really new to Parallax, I just order a couple chips. Thanks for your code, but I have a question, does it support LFN format?

 

Thanks in advance