Author Topic: FAT Emulation  (Read 5415 times)

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
FAT Emulation
« on: October 30, 2015, 04:36:15 AM »
Hi All

There are many appliations where a processor is used to collect data and save it to memory. Sometimes it will be saving to an SD card but often to a robust linear memory such as internal Flash or a Flash device connected via SPI.

FAT emulation is a very interesting and pratical method of using an available USB interface to allow this memory to appear as an external drive to the host (USB-MSD). It doesn't require the data to be stored in a FAT (linear storage is often much faster and more pratical for the Flash involved and also the storage algorithms when FAT is avoided) and it can be stored as raw sampled data but still be viewed/retrieved in formatted form.

I have just completed a document explaining this in more detail and also a reference allowing a Kinetis part with USB to be used to access raw sampled data as formatted .csv file for direct import to a calculator program (like Excel).
The document is at http://www.utasker.com/docs/uTasker/uTaskerEmulatedFAT.pdf

There is a binary file that can be tested at http://www.utasker.com/kinetis/FRDM-K64F.html#MSD4

When connected to the PC host it will display some files that are in fact 'just' data in the internal Flash (that have been primed) as shown in the document.

The data from the internal Flash is visible as either raw sample data (eg. "RawData File 1.bin") which can be copied from the emulated FAT virtual disk, or as comma separated value format (the data is not stored like this but instead the emulated FAT converts it on demand) such as "Formatted Data File 1.cvs" so that it can directly be opened in Excel (for example) - see the document for an image.

This is a great technique for adding such professional data retrieval/formatting with little overhead (aso to existing applications that are based on linear storage and not FAT).

For example: this application with emulated FAT requires less that 3k more code that a USB-CDC class. The USB-MSD part (including USB device driver, FAT emulation and application) requires just 11.5k in total and so saves FAT overhead and easily fits into smallest data sampling devices with USB.

uTasker users can now add/use this technique in their projects by just enabling a single new define (FAT_EMULATION) to their existing project.

Regards

Mark

« Last Edit: October 30, 2015, 04:39:54 AM by mark »