fat16lib:
For three years I have been trying to find an easy way to correctly format SD cards for optimal use on the Arduino.I decided to write SdFormatter.pde since the only program I know that complies with the SD File System Specification is here:
Please let me know how it works.
This sketch can erase and/or format SD/SDHC cards.
Erase uses the card's fast flash erase command.
Flash erase sets all data to 0X00 for most cards
and 0XFF for a few vendor's cards.
Cards larger than 2 GB will be formatted FAT32 and
smaller cards will be formatted FAT16.
Warning, all data on the card will erased.
Enter 'Y' to continue: Y
Options are:
E - erase the card and skip formatting.
F - erase and then format the card. (recommended)
Q - quick format the card without erase.
Enter option: F
Card Size: 3782 MB, (MB = 1,048,576 bytes)
Erasing
..............................
All data set to 0x00
Erase done
Formatting
Blocks/Cluster: 64
FAT32
........
Format done
I ran the following tests on the formatted card moved to the computer.....to analyse the file system, hope it helps.....
kalum@d:~$ sudo fdisk /dev/mmcblk0
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p
Disk /dev/mmcblk0: 3965 MB, 3965190144 bytes
49 heads, 48 sectors/track, 3292 cylinders
Units = cylinders of 2352 * 512 = 1204224 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 4 3293 3868160 b W95 FAT32
kalum@d:~$ sudo fsck.vfat /dev/mmcblk0p1
dosfsck 3.0.7, 24 Dec 2009, FAT32, LFN
/dev/mmcblk0p1: 0 files, 1/120752 clusters