I have the Sparkfun CAN Bus shield with integrated SD card writer attached to an Arduino Mega 2560. I can delete a logged file from the SD card using Windows, log more data using the SD library, then look at the logged data in, say, Excel. The new log file will include the logged data from the old, deleted file.
The card is formatted in Windows in FAT32 and the logged file has the same name as the original. It seems like the SD card reader/SD library is able to 'recover' the deleted file by name, open it for writing having read its uncorrupted contents, and continue logging to it, despite it having been 'deleted' in Windows. I know a deleted file doesn't get rid of the data unless it is overwritten, but there seems to be some bug/oversight in how the SD library in card reader or how it interrogates the SD card or FAT32 volume for the existence of the file.
Has anyone come across this before? Is it a bug or am I doing something wrong?
cacheClear()
function which flushes the block-level cache and invalidates all the cache entries. You don't normally have access to thevolume
entry of theSDClass
, so you would have to break it down into card/volume/root in your sketch instead so you can access all the individual parts (or modify theSDClass
to allow access).SD.h
because it's horrendously slow and badly written. I use (various implementations of) FatFS.