"Could not find FAT16/FAT32 partition" - after attempt to format by SD-formatter

I try to format a microSD 16 GB Kingston (SDHC), using Formatter software from SD Association
:

I am on Win7 64, a USB thumb card reader (checked: it is labeled "SD/SDHC/MMC").

I use both options of the Formatter (on and off). The Formatter only runs in Quick format mode (others said "not supported).

The formatting action ends successfully stating "FAT32"

I took out the microSD and put it in the Arduino module . This one:

I mounted the module on Arduino UNO R3, along with a temperature sensor and put the SD in. The SD card is supposed to serve as data logger for the temperature sensor.

I run the test scketch bellow (CS is on pin 8 on my board).

The result is:

"Initialization SD card...wiring is correct and a card is present
Cardtype SD2
Could not find FAT16/FAT32 partition
Make sure you've formatted the card"

I run the Windows 7 format command. Same result.

The card is new, not used in any other device.

I do not post schematics because the SD test said it is correct.

===

Question:

My hypothesis is that the format program formats the SD as an SD, and not as a SDHC, for unknown reasons. Then, when the Arduino attempts reading it it turns to a conflictual situation: it is declared an SD, but physically is an SDHC.

I did a google search but it returns a bunch of SD cards basic formatting operation - not useful in my case.

What could be wrong in my routine above to format the SD?

Thank you very much!

/*
  SD card test 
   
 This example shows how use the utility libraries on which the'
 SD library is based in order to get info about your SD card.
 Very useful for testing a card when you're not sure whether its working or not.
    
 The circuit:
  * SD card attached to SPI bus as follows:
 ** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila
 ** MISO - pin 12 on Arduino Uno/Duemilanove/Diecimila
 ** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila
 ** CS - depends on your SD card shield or module. 
       Pin 4 used here for consistency with other Arduino examples

 
 created  28 Mar 2011
 by Limor Fried 
 modified 9 Apr 2012
 by Tom Igoe

 2015: included SPI.h and made SPI bus idle.
 */

#include <SPI.h>

// include the SD library:
#include <SD.h>

// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;

// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
const int chipSelect = 8;    

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  Serial.println("\nCardInfo sketch");
  
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  
  // Disable all slave selects on the SPI bus, and set 'SS' to output.
  // The Ethernet Shield uses pin 4 and 10.
  // The 'SS' is pin 10 for Uno and pin 53 for Mega.
  // But disable them all, even if SS is also pin 10.
  // The 'SS' needs to be output, for the internal SPI hardware to work properly.
  // Disable a SPI device means setting the chip select high.
  pinMode ( SS, OUTPUT);    // pin 10 on Uno, pin 53 on Mega
  digitalWrite( SS, HIGH);

  pinMode( 8, OUTPUT);       // SD chip select at pin 4
  digitalWrite( 8, HIGH);

  pinMode( 10, OUTPUT);     // W5100 chip select at pin 10
  digitalWrite( 10, HIGH);

  // SPI bus is now idle and ready to be used.
  delay(1);    


  Serial.print("\nInitializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin 
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output 
  // or the SD library functions will not work. 
  pinMode(10, OUTPUT);     // change this to 53 on a mega


  // we'll use the initialization code from the utility libraries
  // since we're just testing if the card is working!
  if (!card.init(SPI_HALF_SPEED, chipSelect)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card is inserted?");
    Serial.println("* Is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
    return;
  } else {
    Serial.println("Wiring is correct and a card is present."); 
  }

  // print the type of card
  Serial.print("\nCard type: ");
  switch(card.type()) {
    case SD_CARD_TYPE_SD1:
      Serial.println("SD1");
      break;
    case SD_CARD_TYPE_SD2:
      Serial.println("SD2");
      break;
    case SD_CARD_TYPE_SDHC:
      Serial.println("SDHC");
      break;
    default:
      Serial.println("Unknown");
  }

  // Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
  if (!volume.init(card)) {
    Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
    return;
  }


  // print the type and size of the first FAT-type volume
  uint32_t volumesize;
  Serial.print("\nVolume type is FAT");
  Serial.println(volume.fatType(), DEC);
  Serial.println();
  
  volumesize = volume.blocksPerCluster();    // clusters are collections of blocks
  volumesize *= volume.clusterCount();       // we'll have a lot of clusters
  volumesize *= 512;                            // SD card blocks are always 512 bytes
  Serial.print("Volume size (bytes): ");
  Serial.println(volumesize);
  Serial.print("Volume size (Kbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);
  Serial.print("Volume size (Mbytes): ");
  volumesize /= 1024;
  Serial.println(volumesize);

  
  Serial.println("\nFiles found on the card (name, date and size in bytes): ");
  root.openRoot(volume);
  
  // list all files in the card with date and size
  root.ls(LS_R | LS_DATE | LS_SIZE);
}

void loop(void) { 
}

I spend 3 hours more on searching this issue (internet and forum).

No conclusive answer.

The only interesting point I found was that somebody solved this error by changing the SPI speed to 1/4 (10 MHz?). Still, the card was FAT16 in his case and up to 4 GB.

Another idea I came across is that no matter how large is the SD, ARDUINO modules can only recognize up to 4GB and therefore any SD larger than that shall be "reduced" - I do not trust to much this opinion.

Some other said there is a problem with the wires of the SD module connected to the UNO itself (not supported setup. Strange.

Some other claimed that there is a bug in the library itself. I do not know.

There are people who apparently never solved this error.

===

Would you please guys tell me whether there is a solution to this error or not?

I spent to much time on this issue of SD formatting (encountered by other people as well with no solution reported).

If there is no solution, I guess it is time for me to give up SD entirely and look for EEPROM or FRAM instead.

Thank you!

You could try the SDfat.h library also instead of SD.h.
It is better maintained.

Check your 3.3V supply, many Arduinos cannot supply enough current at 3.3V for an uSD/SD card.

It is a 5V SD module (I guess it has a sort of internal converter).

I will try the SDfat - thanks!

Thanks @Crossroads!

No chance. SFFat requires at least IDE 1.6.0.

I am running IDE 1.0.6. I cant install newer versions, because they need Java 8. That I cannt install because of... and the story goes on.

The breakout would be to write my own code to manage the SD, but I guess it is to complicated for a beginner.

I rather try EEPROM (I only need to log GPS data).

I changed the microSd 32 GB by a 2 GB Standard SD.

The test confirmed access and reads all files from the SD card. It is an FAT16 (SD2- according to the notation in the test above).

It then turns that there is a problem in reading SDHC cards. My hypothesis:
a) the library is to old to work with SDHC and/or the IDE can not handle this (IDE 1.0.6 - very old)
b) the clock frequency should be reduced to deal with SD HC
c) there is a supplementary command to declare some sort of partitions on SDHC.

Next, I am going to test the hypothesis a) by using another computer, running IDE 1.8.0 and Adafruit SD library.

The hyphothesis b) and c) I cannot test. If you guys have some ideas about these 2 hyphotesis I will highely appreciate.

And I guess a lot of other people encountering the similar problem.

1 Like

Try the SDFat.h library that member fat16lib maintains instead.

Thanks CrossRoads!

SDFatlib requires at least IDE 1.6.0. which I cant install on my PC because it needs Java 8. Which I cant install.

I will test SDFatlib when I will go to another PC.

SD card Adapter need 5V supply.

Change your supply from 3.3 to 5. It works for me!

1 Like