Go Down

Topic: Info on card initialization errors (Read 340 times) previous topic - next topic



I would like to share what I learned regarding a micro SD card initialization problem I have been fighting with for some time. Lower capacity SD cards all seemed to work fine but the SDHC cards are where I found trouble. A few brands would work but most failed initialization. I searched a lot of forums and found a lot of discussion on this topic, while I found a lot of clues I did not find the direct solution. The point of this post is to share what I did to resolve the issue. Here are some details on my setup:

-   Arduino DUE
-   Adafruit 1480 TFT display with micro SD interface
-   SD rev 1.2.1 (but I tried a lot of versions)

The failure was in the card.init function and it always timed out on the ACMD41 command waiting for a response of 0x00. The ACMD41 command would always return ready status (0x01) and caused a timeout on the driver. Again; this only happen on SDHC cards and not all of the brands but most of them.

The solution (for me anyway) was to add two lines of code to the cardCommand function in the Sd2Card.cpp file. I changed the following line at the top of the function:

  // select card


  // select card
  chipSelectHigh();  // Deselect the card
  spiRec();                // Generate 8 clock pulses

The driver now works for all the cards I have been testing. I saw this logic used on another post chasing a different problem and tried it with good luck in my case.

I hope someone finds this useful!


Go Up