SD card not detected with Arduino IDE 1.6.4 on arduino pro micro 3.3v/8mhz

Greetings all,

I am trying to get an 8GB microSD card working with a 3.3v/8mhz arduino pro micro, under Arduino IDE 1.6.4, which previously worked with IDE 1.0.6.

I have this wiring:
SD SS/CS: pro micro pin 10
SD MISO: pro micro pin 14
SD CLK: pro micro pin 15
SD MOSI: pro micro pin 16
SD GND: pro micro GND pin
SD VCC: pro micro Vcc pin

The example code "CardInfo" under 1.6.4 reports*:
Initializing SD card...Wiring is correct and a card is present.

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

*=I think this might be a lie.

I also tried the example code "ReadWrite" which gave a DIFFERENT error:
Initializing SD card...initialization failed!

(I note that these two examples initialize the card differently)

I had this setup working previously with Arduino IDE 1.0.6. I had some issues there, which were PEBKAC issues, documented here, and were resolved, but it might be good background:

http://forum.arduino.cc/index.php?topic=284664.5

In that setup, I used the same arduino pro micro, but I used an SD->microSD adapter in that setup, which I had used as a microSD slot. I have replaced this ad-hoc experimental setup with a smaller version, this one:
http://linksprite.com/wiki/index.php5?title=Raspberry_Pi_microSD_Card_Adaptor

I have triple-checked the wiring to this new adapter.

The only things that have changed since the setup was working are:

  1. Arduino IDE 1.0.6 to Arduino IDE 1.6.4
  2. Different microSD adapter

I have verified:

  1. The previous setup worked fine, both with cardinfo and the readwrite demo
  2. Triple-checked the wiring to the SD card adapter
  3. The card is formatted properly, with a valid VFAT

Any thoughts? Wild supposition: Arduino 1.6.4 doesn't know about the odd SPI pin assignments for the arduino pro micro, but I have no way to test or verify this (the variants tree is present and looks correct, has an entry for 'promicro' etc).

The card is formatted properly, with a valid VFAT

Try using the SD formatter.

The standard format for an SD card is a very special case of VFAT. It is very unlikely you card has the standard format if you used an OS utility from Linux, OS X, or Windows.

The SD library will not work with all nonstandard formatted VFAT cards.

CardInfo separates hardware card initialization from format checking so it is a better test.

The ReadWrite example calls begin() which does not determine the error type.

Here is the begin code:

boolean SDClass::begin(uint8_t csPin) {
  /*

    Performs the initialisation required by the sdfatlib library.

    Return true if initialization succeeds, false otherwise.

   */
  return card.init(SPI_HALF_SPEED, csPin) &&
         volume.init(card) &&
         root.openRoot(volume);
}

card.init() is pure SPI card initialization.

volume.init() reads format data.

root.openRoot() find and opens the root directory.

Greetings all,
I found the problem. Turns out the SD spec calls for two grounds - the original adapter I used must have connected them internally, but the new one did not. After connecting both grounds, it works as expected.
Thanks,
Josh

I am trying to get an 8GB microSD card working with a 3.3v/8mhz arduino pro micro, under Arduino IDE 1.6.4, which previously worked with IDE 1.0.6.

A microSD has only one ground pin. Full size SD cards have two. Pinout

Strange.

Edit: I would expect both ground pins on your adapter to be connected to the single MicroSD ground pin.

So, I think it is the adapter, and not the microSD card - the adapter "provides" a standard SD interface to the host, which should include two grounds, but in the case of at least this new adapter, does not. The old one either had both grounds connected to the single micro ground, or the "magic one" which I had connected on that one. And clearly the new one only has one.

This begs another question - clearly this SD card was not wired properly - there was no ground! The ReadWrite demo caught this . It uses SD.begin() which is apparently smarter than Sd2Card.init() [which returned true despite no ground], so maybe that's a defect in Sd2Card.init()?

Thanks

The moral of the story of course is: when using a SD->microSD adapter as an interface shield, be sure to connect both SD grounds to arduino ground :stuck_out_tongue:

It uses SD.begin() which is apparently smarter than Sd2Card.init() [which returned true despite no ground], so maybe that's a defect in Sd2Card.init()?

I don't believe card.init() will return success with no ground. It correctly discovered your card is type SD2 and that means a number of commands with check bytes completed correctly.

Please check to see if the ground pins on your adapter are connected.

Here is the code that determines card type. The card must return the 0XAA byte correctly plus the correct status for CMD8. There are many other tests.

  // check SD version
  if ((cardCommand(CMD8, 0x1AA) & R1_ILLEGAL_COMMAND)) {
    type(SD_CARD_TYPE_SD1);
  } else {
    // only need last byte of r7 response
    for (uint8_t i = 0; i < 4; i++) status_ = spiRec();
    if (status_ != 0XAA) {
      error(SD_CARD_ERROR_CMD8);
      goto fail;
    }
    type(SD_CARD_TYPE_SD2);
  }

The ReadWrite demo caught this . It uses SD.begin() which is apparently smarter than Sd2Card.init() [which returned true despite no ground], so maybe that's a defect in Sd2Card.init()?

You can say this since both examples failed. You can't tell how begin() failed. begin() calls card.init().

volume.init() may have failed in both examples.