SdFat and big SD cards

Hi All…

I have been usign the latest SDFat beta quite successfully with a 256MB San Disk SD card. I just tried a 2GB card, also a blue San Disk.

When I run the bench application, i getL

Type any character to start
Free RAM: 14998
Type is FAT16
File size 5MB
Starting write test. Please wait up to a minute

I wait and wait, over 5 minutes, and finally remove the card, and i get:

error: write failed
SD errorCode: 0X15

During all this, my L LED is lit steady. The card has a file called bench.dat that is 0 bytes long.

Any ideas?


The file system on the card may be corrupt. Check it on a PC with the properties->tools tab of file explorer.

Try reformatting with either the SdFormatter sketch in examples or this utility

You should use the latest non-beta here

If you still have problems, run the SdInfo.pde example and post the output.

Okay thanks very much. It came out of my Daughter's digital camera and I can read the file system on Windows 7. I can't reformat it, it has data that the kid wants to keep.

I didn't realize you had released it, I'll upgrade. Thank you very much!


Oh the latest is 20110702, that is the one I am using.

You should backup the files on the card and check it for errors.

If the card has lots of file and is nearly full, bench.pde can take a very long time trying to find free space.

I suspect there may be lost clusters on the card so it probably needs repair.

Okay, I'll do that thanks. Can your library support cards as big as FAT16 supports?

SdFat supports standard SD cards from16 MB to 2 GB as FAT16.

SdFat supports SDHC cards from 4 GB to 32 GB as FAT32.

Great, thanks! I just got a new 4GB card, which came formatted as FAT32. In case anyone is interested, I ran bench and geot a write speed 128 Mb/s. Formatted with your formatter, re-ran bench, same result. My 256MB FAT16 card writes in excess of 260 Mb/s. Both SanDisk cards.

I sure wish I could find a source of 256MB cards, but I can't. Maybe they don't even make them anymore. Who knows.

It is not the card size. Many new cards don't perform well with the single block write commands that must be used on the Arduino for file writes.

The old style cards are no longer available.

Fast cards expect multiple block writes.

I get about 600 KB/sec on multiple block raw writes with new cards. I use these commnds in the binaryLogger program.

Sorry, I was not clear at all. The primary reason I wanted the 256MB cards is to bundle them with a board, but the faster speed is nice as well. I'll see if I can make my code work like your binary logger example, but I am pretty sure you and I discussed this and you told me that, because the user is prone to removing the card or shutting down the board at any time, I can't do it that way.

Thanks again for the help and the library!

Your right, it's not practical with the Arduino to use the binaryLogger method for most apps.

Consumer devices like cameras have lots of memory, and save to the SD before really powering down.

They know when you open the SD door and quickly save.

New 4 GB cards are cheaper than old 256 MB cards, under $10.

Wow, I just found a source for Class 2 San Disk SD cards for $1.80 each!

Most cheap places add a lot of shipping. Delivered class 2 cards should be less than $5.

Class 10 4GB cards delivered from Amazon are $7.99 total.

FWIW I have been able to pick up 256Mb cards cheap from camera repair shops, they always seem to have some in the drawer.
They are the only things that work in my message anouncer.

So, I need get file system type code with SDFat. But I'm not really good with this library. Please tell me, how to do this?

Kergon: So, I need get file system type code with SDFat. But I'm not really good with this library. Please tell me, how to do this?

I applaud you for your research. Buut this thread is about 8 years old and people might start answering to the original post.

You have a possible answer in