I'm trying to put together a system to record and playback .wav files using an SD card. 16kHz 16 bit mono. These need to be readable by a PC and also the system must be able to play .wav files produced by the PC. I'm using a third party filing system at present but this seems to suffer from large periods of waiting while it allocates new clusters, sometimes over 200ms which is a lot of data time (over 7kB worth). I'm running this on a JM60 at 24MHz so hardly slow and using a 12MHz SD clock. Does anyone know of any available FAT16/32 filing systems that I can look at, that will work on an 8 bit system?
Seems these SD cards are more complicated when used with a filing system. I thought they should easily handle a 32kB/sec recording data rate. Does anyone have any experience of this?
Are you writing 512 byte blocks? Because here is the killer. Each time you write a 512 byte logical sector, the flash card needs to completely erase and re-write a "block" (which varies in size depnding on the card size, mfg etc). Add to that internal wear leveling code and you can have very slow write times.
If you can write bigger chunks, it will seem faster. It might also help to pre-allocate a large file size so no cluster allocation needs to happen.
Yes we are writing 512 byte blocks. I can write one sector of data (512 bytes) in 6mS. The problem comes every 8 sectors when the system needs to determine the next cluster. The system I am using uses 512 byte blocks as do others I have seen.
Can you explain how the pre-allocation would work. I suppose I could check for available space on the card and allocate that for the new file. Presumably this space is freed up when the file is closed? I'm not even sure if my system will allow me to do this. I need to be able to cater for anything from a 10 second .wav file to one of an hour or more. Is there a maximum length file I can open in this manner under FAT32?