May 12, 2015

Microcontroller Libraries for SD Card and FAT File System


If you want read a SD/MMC card with a 8 bit or even 16 bit Microchip PIC or dsPIC microcontroller, you need use some of the available libraries, but they have a high Flash and Ram usage! Here you can see an overview about the available libraries and how much memory they demand.

The Microchip Libraries for Applications (MLA) is the 'oficial' and free library from the vendor that provides SD/MMC card and FAT file system support, but there are others libraries, paid and free, like the MikroC and Petit FatFs. But how can you know if these libraries will fit in your microcontroller memory? below you can see a table with some tests and have an idea:

Library
Compiler
Compiler Version
Flash
RAM
Microcontroller
File System
MLA
XC16
Free (without optimization)
37k
1,2k
dsPIC33EP512MU810
FAT32
MLA*
Microchip C30
Free (without optimization)
42k
1,5k
24FJ128GA010
FAT32
MikroC
MikroC PRO for PIC
PRO (Full)
19,8k
1,15k
P18F45K22
FAT16
MikroC
MikroC PRO for dsPIC
PRO (Full)
10k
1,4k
dsPIC30F4013
FAT16
Petit FAT File System v0.03
Microchip C30
Free (without optimization)
15k
0,4k
24FJ64GA002
FAT16/32
*Old MLA library (note the C30, the newer uses XC16)

As we can see no one can fit in the cheap and widely used 16F628A, 16F877A or even the cheapest dsPIC like the 33FJ12GP201. But attention to the Petit FatFs that allows on its configuration file enable/disable some features, so for example, if you just enable the SD card read and FAT32, the flash needed will be about 10k (Microchip C30 compiler with optimization level 3), fitting in the dsPIC33FJ12GP201 that has 12k of flash memory.

Now you can choose the proper microcontroller before your project gets stucked due the memory limitations!

0 comentários :

Post a Comment