SD Card: Most stable file system and library

Hello

I have some flaky issues with the sd card. For unknown reason from time to time (for me randomly) i can't mount the card anymore. The computer can and after putting back (Without even formatting, just reading on the computer) everything is fine again.

Question:

  • Any ideas in general on the issue?
  • What is the most stable file system? FAT12/16/32 or ExFAT?
  • Which is the recommended most stable lib?

Info: Stuff in use: Board: MKR, SD Card reader on the back of a Adafruit Display, #include "SdFat.h",


06:14:51.729 -> Card type: SDHC
06:14:51.729 -> sdSpecVer: 3.00
06:14:51.729 -> HighSpeedMode: true
06:14:51.729 -> 
06:14:51.729 -> Manufacturer ID: 0XFF
06:14:51.729 -> OEM ID: 
06:14:51.729 -> Product: SMI  
06:14:51.729 -> Revision: 0.0
06:14:51.729 -> Serial number: 0X0
06:14:51.767 -> Manufacturing date: 5/2022
06:14:51.767 -> 
06:14:51.767 -> cardSize: 4027.58 MB (MB = 1,000,000 bytes)
06:14:51.767 -> flashEraseSize: 128 blocks
06:14:51.767 -> eraseSingleBlock: true
06:14:51.767 -> dataAfterErase: zeros
06:14:51.767 -> 
06:14:51.767 -> OCR: 0XC0FF8000
06:14:51.767 -> 
06:14:51.767 -> SD Partition Table
06:14:51.767 -> part,boot,bgnCHS[3],type,endCHS[3],start,length
06:14:51.767 -> 1,0X0,0X2,0X3,0X1,0XB,0X3E,0XFE,0XCF,8192,7858176
06:14:51.767 -> 2,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
06:14:51.767 -> 3,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
06:14:51.767 -> 4,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
06:14:51.767 -> 
06:14:51.767 -> Scanning FAT, please wait.
06:14:52.909 -> 
06:14:52.909 -> Volume is FAT32
06:14:52.909 -> sectorsPerCluster: 64
06:14:52.909 -> fatStartSector:    14466
06:14:52.909 -> dataStartSector:   16384
06:14:52.909 -> clusterCount:      122656
06:14:52.909 -> freeClusterCount:  122559

My observations would be that, in general, the SD card interfaces in Arduinos are not in the high reliability class. Fine for hobby use perhaps, but I have my doubts for use in high reliability commercial applications.

I have found reliability varies across the various platforms whilst doing a fair bit of work using SD cards for (fast) over air file transfers. The DUE seems fairly reliable, ESP32 etc less so, especially when there is more than one device on the SPI bus. For ESP32 MMC seems more reliable.

The most common show stopper I have seen is that the SD card, for whatever reason, locks up and the only way to get it working again is to power the Arduino down and restart or removing and replacing the SD card.

Indeed, but I would put Arduino SD interfaces in the very low reliability class. Compared to Raspberry Pi implementations, where microSD cards run for years, 24/7 without noticeable errors, the difference is absolutely stunning.

I would not dissagree.

Some of the platform implementations seem to be fairly reliable. As I mentioned, some of my transfer code that uses the SD works quite well on the DUE.

But the exact same code has an issue on the ESP32S3 core. Sometimes when the SD read crosses a 4096 byte boundary in the file being read an extra byte (0xFF) appears in the transferred byte stream. This happens in about 1 in 25 transfers for a 'good' SD card and more often for a 'bad' SD card, but only found (so far) on the ESP32.

This problem does not seem to be an SPI bus or other hardware problem but something specific to the code that is reading bytes from the SD card.

So not too much encouragement at all...
My observation is that the mounting/initialisation process accidently doesn't work for a idontknowwhy reason out of a sudden. Once mounted, it works fine. Power off/on doesn't help. Smaller cards (4 GB) seems to work better.
Any experiences with the ExFat file system?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.