SD Card Logger - Writing Speed Demos
Good day all,
I am working on SD card loggers that need to write chunks of data in sizes of roughly 3100 bytes to 3500 bytes. With this in mind, I am using the "USB Mass Storage - SD Card Logger" demo from the Microchip Application Library, and can read/write files in my application and in Windows/linux as a mass storage device, using block sizes of 4096 bytes. Write speeds in my application however, write at very low speeds (ie: roughly 10K-bytes/s at best), using simple loops to have FSFwrite write a large array of size 10*4096 bytes at a time (would this constitute a true multiblock write?)
I have found posts on these forums where other people have achieved throughput of 400K-bytes/s with the Microchip FAT library and/or the Elm-Chan FatFS library.
My main concern is just simple, fast, SD card logging in my application (the USB functionality can be removed, but I still need a FAT/FAT32 library so I can remove the card and read it on a PC later). One insightful post (<http://www.microchip.com/...mp;mpage=1#523755>)
noted I should use:
- DMA +
- SPI 16-bit mode instead of SPI 8-bit mode
- Multi-block writes instead of single byte writes using FSFwrite
Does anyone have any working demos for PIC32mx695/PIC32mx795 (ie: written in C32, uses the newer plib funcitons, such as SPIChnOpen instead of OPENSPI, etc) or any resources on getting high read/write speeds using a PIC32 and an SD card for fast data logging? With the number of people posting comparative results between file systems, I figured at least a few other people have managed SD + Fat/Fat32 + PIC32 for decent write speeds.
Thank you all in advance!
PS: I've tried the FatFS demo from Microchip <http://www.microchip.com/...p;appnote=en539236>
and can detect the SD card, yet I can't mount the filesystem or write files to it, and had to make a lot of modifications for using SPI channel 2A instead of channel 1.