chipKIT® Development Platform

Inspired by Arduino™

New FAT File System in chipKIT-core

Posted 2016-03-07 11:07:26 by Majenko

microSD.png Did you know that a robust FAT file system is now available in chipKIT-core? Keith Vogel of Digilent recently ported the file system library by ChaN at elm-chan.org. You can use this library to create and access files on microSD cards, as shown in the photo above.

But wait... what is a FAT file system, anyway?

FAT stands for File Allocation Table. It's a method of organizing data on disk drives. Designed way back in 1977, FAT was the standard file system used on disk drives for at least two decades. While modern computers now use more sophisticated systems, FAT is still the standard for USB sticks, Flash drives and solid-state memory cards.

DSDVOL_example.png

Several chipKIT boards (such as the FubarinoSD, WF32, Wi-FIRE, and WiFi Shield) include a microSD card slot where a solid-state memory card can be inserted. The new library allows your sketch to create and access files stored on the memory card. Files can be used for serving up web pages, storing large amounts of data collected from sensors, or anything else you can think of.

chipKIT-core combines the FAT file system with improvements to the DSPI and SoftSPI libraries. (DSPI uses the hardware SPI ports, while SoftSPI uses any combination of unused I/O pins to create a virtual SPI port.) When a microSD card is inserted, your sketch can easily mount it as a disk volume to access files. An example sketch is included with chipKIT-core, and appears as DSDVOL under the File:Examples menu item. Here is a snippet of code from DSDVOL:

DSDVOL_code_snippet.png

Up to 5 volumes can be mounted and used at the same time. While most chipKIT boards have only one microSD card slot, virtual disk volumes in RAM or MCU Flash will be supported soon.