Error in FAT16 component?
Posted: Sun Nov 14, 2010 11:05 am
Hello,
I am afraid there still is an error in the FAT16 component when the total number of sektors written to the Media Card exceeds the 65536 boundary.
Awhile ago I created a datalogging system which recorded central heating data over an extended period of time on a 512 Meg SD Card. Each time the datalogger was started or the mediacard was inserted/removed, it created a new datestamped .csv logfile, wrote a fileheader and started logging at a 1 second rate. Every record starts with a Date/time log.
This went well in the beginning until I noticed that after a certain amount of newly created logfiles, the information on the mediacard became disrupted in a way that from a certain point the logger effectively created a new filename but started to overwrite the first file in the root directory instead of filling the new created logfile. The longer this situation lasted, the more logfiles became disrupted until the whole logging became unusable.
Further investigation showed me that it was not the number of created files that triggered the problem, but the total number of bytes written to the card or respectively the total number of sektors.
I tried with another mediacard of 2 gig and was able to reproduce the phenomenon.
Using WinHex noticed that the moment the number of written sektors exceeded 65536, this problem appeared.
I can send you a zipped diskmage made with WinHex of the 512 mediacard by email. ( it is 1 Mega so too big to attach ) There you can see what is goiing on.
You will notice 13 logfiles: the first beeing 081110_2.csv and the last 141110_0.csv.
The first 3 files are already overwritten by the last 3 created files. You can see that because there is no header.
The next 7 files are ok, here the header is still intact. They are not yet overwritten but that will happen if I had waiten longer.
The last 3 files are created, have the correct filesize, but are empty. The contents of these files have overwritten the first 3 files. You can see this if you look at the datestamp wich is recorded at the start of each record.
Also looking at WinHex you can see that as long the total number of sektors does not exceed 65536, there is no problem.
Once this limit is exceeded, the next created file starts overwriting the first one.
And it is reproducable.
I think there is a datatype error in the FAT 16 routine "Move to next sektor"
I hope I have submitted enough information to enable you to investigate the problem.
I haven't tried the FAT32 because of memory limits.
Best regards,
Eric
I am afraid there still is an error in the FAT16 component when the total number of sektors written to the Media Card exceeds the 65536 boundary.
Awhile ago I created a datalogging system which recorded central heating data over an extended period of time on a 512 Meg SD Card. Each time the datalogger was started or the mediacard was inserted/removed, it created a new datestamped .csv logfile, wrote a fileheader and started logging at a 1 second rate. Every record starts with a Date/time log.
This went well in the beginning until I noticed that after a certain amount of newly created logfiles, the information on the mediacard became disrupted in a way that from a certain point the logger effectively created a new filename but started to overwrite the first file in the root directory instead of filling the new created logfile. The longer this situation lasted, the more logfiles became disrupted until the whole logging became unusable.
Further investigation showed me that it was not the number of created files that triggered the problem, but the total number of bytes written to the card or respectively the total number of sektors.
I tried with another mediacard of 2 gig and was able to reproduce the phenomenon.
Using WinHex noticed that the moment the number of written sektors exceeded 65536, this problem appeared.
I can send you a zipped diskmage made with WinHex of the 512 mediacard by email. ( it is 1 Mega so too big to attach ) There you can see what is goiing on.
You will notice 13 logfiles: the first beeing 081110_2.csv and the last 141110_0.csv.
The first 3 files are already overwritten by the last 3 created files. You can see that because there is no header.
The next 7 files are ok, here the header is still intact. They are not yet overwritten but that will happen if I had waiten longer.
The last 3 files are created, have the correct filesize, but are empty. The contents of these files have overwritten the first 3 files. You can see this if you look at the datestamp wich is recorded at the start of each record.
Also looking at WinHex you can see that as long the total number of sektors does not exceed 65536, there is no problem.
Once this limit is exceeded, the next created file starts overwriting the first one.
And it is reproducable.
I think there is a datatype error in the FAT 16 routine "Move to next sektor"
I hope I have submitted enough information to enable you to investigate the problem.
I haven't tried the FAT32 because of memory limits.
Best regards,
Eric