SD Card Module Fat formatting issue

I’m trying to setup this SD Card module (SD Card Module | Core Electronics Australia) with an arduino UNO and SanDisk SDHC 32GB card.

I connect the SD Card module as shown in the diagram with the chip select connected to the default pin 4 (I have also tried setting the chip select to pin 10). I’m using the 3.3V supply from the UNO to power the SD Card module.

I’m using version 1.2.4 of the SD library and running the CardInfo example on the Arduino IDE and I get the following error message.

Initializing SD card...Wiring is correct and a card is present.

Card type:         SDHC
Could not find FAT16/FAT32 partition.
Make sure you've formatted the card

I’ve formatted the card and after reading some posts online, ensured that the card is FAT32 with an MBR partition table. I’ve tried formatting using different applications including the primary suggested one by SD Association (SD Memory Card Formatter | SD Association). This shows the SD card properties after formatting with the SD Association program.

I’ve also tried to create a smaller 4GB partition on the SD card but it returns the same error as above.

A few other posts have suggested some other ideas which I have tried without success:

  • Setting the SPI to quarter speed instead of half speed in the CardInfo sketch (same error)
  • Instead using the sdFat lib, this returns a similar error indicating the formatting is incorrect

Hi Scott,

Sorry to hear that SD adapter is giving you trouble. I found the code in the library that generates that warning:

Have you checked the cluster size? The guide for that example suggests this guide on calculating the right values to use during formatting, but I’m not sure how that relates to the SD library. Try 512 bytes and let us know how that goes.

Thanks James, I was using the default cluster size which for my 32GB SD card was 16KB.

I changed to 512 bytes (see image below) but I still get the exact same error. I had to use GNU parted to create the partition given the cluster size, the SD card association didn’t allow me to specify the cluster size.

I did some further digging into the error and found that it comes from the SPI communication. I’ve put some pictures of the execution sequence below. The return from the cardCommand function is what causes the error.


1 Like

Another update:

I’ve found a temporary solution. In the SD library as shown below I added a small delay which must be greater than or equal to 6ms and then I get the expected output of the CardInfo example.


I don’t understand why though, it seems that the SPI is busy and waiting for 6ms is enough to wait this out. But this should be taken care of the waitNotBusy function.

1 Like

Hi Scott,

Thanks for sharing your fixes! Having one set up on your end does mean you can get to the solution faster than we can.

We’ll keep this in mind if anyone asks about this in future.