SD.begin() causes SD card to continuously pull 20mA

Hi there,

I'm going to give a comprehensive rundown of the issue I'm experiencing with an SD card I'm using. I'm hoping to get some clarification and direction of what else to look into. I've also stumbled across multiple threads regarding a similar sounding issue (http://forum.arduino.cc/index.php?topic=149504.0), however, the solution to that problem is not working for me.

Background: I'm working on a custom PCB that uses an Atmega328P as the primary controller. I am using the Arduino libraries to help program this device. This device also features an SD card for reading and writing data.

Problem: I'm using the library SD.h and it seems to be functionally correct. I am able to communicate via SPI and can read/write data. However, when I initialize the SD card with "SD.begin()", the SD card begins pulling a continuous 20mA while not performing any read/writes. Because the card isn't doing anything, I would expect it to operate in an idle mode drawing very little current. In the end, this is too much continuous current being drawn for my battery.

After banging my head against the wall for several hours, I'm convinced there are not any wiring issues. I am using 'pin 8' (per Arduinos definition, PB0 per Atmega328p's definition) as the chip select.

I also realize that SD.begin() configures the hardware SS (pin 10 per Arduino definition) as an output. I don't have anything connected to this pin in my design, soit's floating. Thus I'm sure I'm not accidentally short circuiting anything when I call SD.begin().

I am using this Panasonic microSD card in my design (https://www.digikey.com/product-detail/en/panasonic-electronic-components/RP-SMLF08DA1/P17033-ND/5119440).

Given all this information, I believe the issue lies in the SD.h library. Essentially it is initializing the SD card and not placing it into sleep mode. I had stumbled across this thread (http://forum.arduino.cc/index.php?topic=149504.0) which outlines a similar problem to the one I'm experiencing. The solution to that problem was to switch to the "SdFat" library. However, the 20mA problem still exists when I attempt that solution.

I have the most barebone sketch that replicates this problem below:

#include "SdFat.h"
SdFat sd;

void setup() {
 sd.begin(8);
}

void loop() {

}

Calling "sd.begin(8)" results in 20-25 mA being pulled from the SD card. When I eject the SD card, that number drops to 6mA.

When I replace the pin number to something that isn't being used (e.g. sd.begin(10)), nothing happens and only 6mA is drawn as expected.

I've also tested different SD cards (of the same model) and they all experience the same issue. I've ordered a couple different types of SD card for further testing.

So my question: What is going on? I know that an SD card in sleep mode shouldn't be pulling 20mA. I'm looking for any insight into further troubleshooting.

Thanks!
-Izzo