Robust FAT12/FAT16/FAT32/VFAT FAT File System for small scale embedded systems

44 views
Skip to first unread message

Thomas Roell

unread,
Nov 15, 2014, 12:00:37 PM11/15/14
to diyr...@googlegroups.com
(Nice tile ;-) One day I'll make it into the marketing department ...)

As we all know that I am easily distracted, so here some quick source to share solving a minor problem.


With my rover I do log a lot of data. And I ran into toooooooo many issues using the usual suspects of file systems out there.

Part of the problem is really the SDCARD one can buy, the other one is the file system implementation.


First off the quick link to the source:



And then the short explanation (there is more on github):

Most FAT implementations are going either for the smallest possible size, or are simply based on a floppy disk model. RFAT supports only one thing, and that is SDCARD (and microSD, and microSDHC ...). 

In order to do reasonable low latency logging, one has to consider a lot of things. If for example FAT updates happen during logging, an SDCARD can go busy for 750ms. That means one either needs to buffer data for that time-period, or the log will contain gaps (which was my biggest issue). There are also bazillion technical details of how you send data to the SDCARD. The simple way is of course not the most efficient way, and there are quite a few non-obvious details to consider.

But since I like to play around I thought I'd look into some other areas that I always felt missing:

RFAT does have complete CRC checking implemented. It checks for errors on the SPI MOSI/MISO/SCLK lines, retires commands and data. So if there a minor glitches somewhere the file system will recover from that, and/or at the very least signal back an error.

RFAT implements a power fail safe mode. If power is suddenly lost (lose battery connection as a result of crashing the rover into a bright orange drum comes to mind) RFAT will not corrupt the file system, ever.

RFAT implements UTF8 file name encoding, so that I finally can get the proper german umlauts into file names !!! 



There is a rather simple porting layer at the SPI port level, so that the system is rather easy to port. The source includes a demo for the platform I use on my rovers, a EK-TM4C123GXL Launchpad (http://www.ti.com/tool/ek-tm4c123gxl) along with a Color LCD BoosterPack ( https://www.tindie.com/products/RobG/color-lcd-booster-pack-320x240-with-microsd-card-socket/). Using writes with 512 bytes each gives me a throughput of about 2MB/sec on a 20MHz SPI bus, that is with CRC checking enabled and such.


- Thomas





Reply all
Reply to author
Forward
0 new messages