Georg Ritter wrote:
Hello,
I'm aware of the wearing problem of FAT and I don't think it's very
suitable format at all nor for data logging - that is what I want to do.
not sure if my other mail reached the list. my email client claims it
sent it but i dont have received from the mailinglist. however i have
tought over that problem again...
idea: prepare the card with a big, empty file. the file format for the
logger must have at least one bit nonzero in each record/chunk so that
you can later find out how much data was realy written, but that should
be easy.
that way, you can continuosly write the data to the preallocated blocks,
you don't need to write the FAT table or directory entries.
you can read the card on every PC, but you need to write a custom
program to decode the file format and find out how much data was realy
written, you would have done that anyway, probably, to decode the logged
data... the device itself can do the same thing and search the end of
the written data, that way it can append after a reboot.
what would be needed on the mcu is the ability to read FAT and directory
entry as well as erase and write 512 byte blocks.
the advatage of this method would be, that you can also put a "ini" file
on the card with settings for the logger.
if you dont need the feature that you can put a settings file on the
disk, then there is also an other way...
let the device format the card. it can write a default FAT table and
directory entry, it just needs to patch a few values, so that the file
uses the entire disk e.g. file size depending on disk size, and maybe
some other values in the volume boot record (cluster size) and master
boot record (partition end, size).
so basicaly, you're using the card as a set of following 512 byte
blocks, just the first few blocks are initialized with the data for a
DOS disk.
in both cases, the data loss in the worst case (power loss, removed
card) is a 512 byte block, which isnt too bad.
i think the first solution with a preallocated file would work very well
and is a bit easier than formating the card in the device, and i'll
consider it when we make our logging device :-)
chris
But I also must assume that not everybody is running linux
and is capable of mounting a MMC card or access it bytewise.
you can access devices byte wise on windows too under win nt/2k/xp. but
i would still prefer something that does not require me to write low
level io software on that OS ;-)
chris