SD Card LOW LEVEL read/write with Arduino Mega8

After reading many solutions to interface SD cards, I have found libraries that tend to suggest Mega16 or higher flash space to make them run. Most of this libraries work with FAT16 or FAT32 filesystems, and use a big part of their code space to manage this filesystems. But why to work with FAT filesystem if you have low level access to the SD card ? If a SD card can store 1024 Mb and can be buyed just for 5$, why not to use its full partition space TO STORE JUST A SINGLE FILE ? A library JUST to read and write that big single file could have a reduced size and could be used in the Mega8 leaving at least 2 Kbytes for other purposes. This would allow the use of an Arduino Mega8 as a data Station to store info from many purposes (as a wind meter point for future wind generators, ...). My idea is, start simple, start cheap, make it work, and ONLY THEN complicate. If anyone thinks my idea is possible do not hesitate to contact me.

why not to use its full partition space TO STORE JUST A SINGLE FILE ?

Because without a filesystem, you cannot put the SD card into a computer and read the data. A unix system would be able to yank raw data off the card using the dd utility, but windows users would be out of luck.

If the SD card is strictly for Arduino use (and the data will never be shared) you can easily do this - you are treating the SD card like a large flash chip.


Thanks for your helpfull answer.
Yes, the idea is to think in a SD card as a HUGE I2C memory. In a 24C32 you do not think you have files inside. You just think you have ONLY 32000 bit (4000 bytes), and you have to do best use of this limited memory.
Why not to think in a 1Gb SD card that you JUST have bytes ?
My idea is to use the SD card JUST for Arduino data store or data recover. The SD card would loose all his previous content and could not be readed by any windows or linux explorer, but this situation would be fully reversible , bacause formating the SD card the user could use it again in future for typical file storing.

Dear kg4wsv:

After reading your first paragraph I have better news for you and for windows users.

Belive me if I tell you that in this matter I am much more expertice than in Arduino. I have created a program to read, save and restore partitions in Windows Xp. With my program you can read the full content of a disquete, hard disk partition, cd, dvd or even usb flash drive, and save it in a big file (the partition file).

I have not probed this yet with an SD card, but as soon as I receive in October an USB SD reader device and a 2 GB SD card, I promise to test.

I want to use the Arduino Mega 8 as a wind data measurer, to use the data for wind generator choosing and positioning.

The board should measure wind speed in 10 bit and wind direction in 4 bit, this is 16 bit measure length

Doing a measure every second would be 86400*16 = 1382400 bit per day (172.800 bytes per day)

172.800 * 365 = 63.072.000 (ONLY 63 MB PER YEAR).

As an outline you can store the full measurement data of a FULL year in JUST 63 MB of the SD. (a cheap old fashioned 128 Mb SD can be used)

I found this usefull link where I think can be found the code for LOW LEVEL PARTITION SD INTERFACING (read and write):

Surprisingly the author resolved the SD low level partition interfacing with a Mega8 in less than 3 kbytes of flash code, AND THEN in future program evolutions added FAT16 FILESYSTEM interfacing. But this new feature made Mega8 go out of memory and Mega16 was neccessary.

As I am only interested in the low level interfacing, I will try to use only this part of his code with my Arduino Mega8.

Finally if I success and can get the full year of wind data measuring I think that if I take out of the Arduino board, the SD with the 1 year data , AND PUT THE CARD in the PC usb SD card reader, I belive my Xp program will allow me to save the full sd partion to a big pc file.

Once in my hard disk, using visual basic the file will allow me to make graphic representations of average wind speed per day. month...

I know that are many purposes, but for me the hardest was the SD card interfacing, and I think the solution is close.

I hope this can be of help for other Arduino Mega 8 users.