Electronic – Buffer management for SD card in SPI mode

bufferramsd

I'm looking into implementing storage of large audio files onto an SD card. I'll be using SPI to access the card to avoid any patents by the SD card mafia. I'll be generating a lot of data, about 150 kbyte/s per second and that needs to be read from an ADC and written to a DAC + stored on the card.

I need to use some buffer in external memory (I don't know if I'll have enough RAM on any small MCU, so I'll use something with an external bus). I have no experience doing this, so I'll appreciate any pointers to what strategy to use here.

Best Answer

Don't fear the FAT. It makes your job a lot easy.

The only thing you have to do is, before you start reading values at ADC, create the FAT 16 system and a text file. Then once you start reading, simply send the data to that text as simple byte.

I have done similar thing with PIC18F458 at a clock rate of 1Kb per second. Here is a link with sample code for same controller with generation of FAT system. This helped me a lot. I hope it would help you too.

This method was best for me as all the values were written in a text file and was easy to convert it in any other format or readable for other software as MATLAB.