May
2006, Issue 190
ARM-Based
Modern Answering Machine
Philips
ARM Design Contest 2005 First Prize
FAT
The
article “Portable FAT Library for MCU Applications,”
by Ivan Sham, William Hue, and Pete Rizun (Circuit Cellar
176, March 2005), is a great starting point for learning
how to implement the FAT16 on an SD/MMC card. Their
implementation is a perfect match for this project because
the goal here is to allow the TAM-TAM and a PC to exchange
files. Therefore, the files and the way they’re stored
must be compatible. The FAT16 file system is almost
obsolete (at least from Microsoft’s point of view),
but it’s still supported in Windows XP.
The
code was designed for a different microcontroller family,
but it was relatively easy to update for this project.
I modified the hardware-dependent library to account
for the LPC2138 SPI. An initial implementation on the
Keil development boards was successful, and I was quickly
able to read and write files.
I
added a few functions to the original code, which doesn’t
have an option for reading, modifying, or writing files.
The original code enables you to read or write only.
This is a problem when recording WAV files because information
about the file length is located in the header at the
beginning of the file. But this information isn’t available
until the end of the recording. I addressed this problem
by allowing the file to be open in Write Only mode to
write the incoming WAV data. Then, it’s rewound to the
beginning of the file to write the header information.
I
also added a function to delete existing files. Without
the delete function, there’s no way to remove an existing
file from the file system. Lastly, I created a file
rename function.