SD card writing corrupt files

Hi,
Im trying to complete this project (https://randomnerdtutorials.com/arduino-time-attendance-system-with-rfid/) where a SD card collects information from a RFID reader and a RTC module. So far both the RFID and the RTC are working perfectly.

I am using an Arduino Uno and a 256MB SD card. The SD module is from core (https://core-electronics.com.au/sd-card-module.html) and I can get it to initialise at the start of the program. I have also run it with the built in example SD programs on the Arduino IDE. I have success with the cardInfo sketch, and limited success with the readWrite program. The readWrite program along with the program from the tutorial often creates corrupt files, ones named with random symbols, are around 4GB in size and that cannot be opened or deleted (only by reformatting the SD card will they delete).

Thanks, all help would be greatly appreciated.

Hey Martin,

Sorry to hear you’re running into a few issues with that one. In cases where an SD card is a potential culprit, we have found quite often that this will be the thing causing the issue.

Firstly, when formatting the SD card, what allocation method are you using (FAT16 or FAT32)? You said you had a 256Mb micro SD card, if you had tried to use FAT32 it won’t work and this likely explains why it’s creating random files around 4GB.

If that doesn’t solve the issue, I’d suggest trying another SD card if you have one available, as it could just be that the card itself is damaged.

Hi Owen thanks for responding,

When formatting the card I have tried both, FAT16 (by reformatting through file explorer), as well as FAT32 (formatted through SD card format program). Neither have worked for me. I also tried an alternate SD (1GB) card, with both formats again and I’m still getting corrupt files.

So far I have been using standard sized SD cards, some tutorials and modules use micro SD cards. I have tried a micro SD with an adapter, however with no success. Could it be anything else that could be causing the problem.

Thanks again