I'm trying to add an SD card reader to a little project and I'm only able to initialize the SD card intermittently. It's acting like a hardware error but I'd like some help in tracking down what to replace.
My microcontroller is a RBBB http://moderndevice.com/product/rbbb-kit/ running at 5V, powered by a USB-BUB-II http://moderndevice.com/product/usb-bub-ii/. The RBBB presents itself as an Arduino Uno to the Arduino software.
SD card reader is the infamous board by LCSoft http://www.amazon.com/365buying-Reader-Module-Socket-Arduino/dp/B008B52QQC/. I was expecting the board to have onboard level shifting when I ordered it, but it doesn't; instead the MISO and SCK lines have 10k pull-up resistors to the 3.3V supply line. I'm converting levels on the MOSI, SCK, CS lines with 500/1000 ohm voltage dividers, which gives 3.25V high, 0.10V low at the probe points on the board. (I had tried 5k/10k dividers and the logical low on the board was nearly 0.8V, which I thought might be too high.) The 5V power on the card reader is coming from the RBBB 5V bus.
SD card itself is by Sony, capacity 2GB, works fine in other circumstances.
I'm able to read and write data to the card occasionally, and extract it afterwards to a computer. When I switch from USB-to-computer to USB power from a 5V/700mA wall adapter, the card fails to initialize. When I switch back to USB-to-computer, I'm still unable to initialize the card. Switching from my program to the SD/CardInfo example distributed with Arduino 1.0.5, I get
Initializing SD card...initialization failed. Things to check:
* is a card is inserted?
* Is your wiring correct?
* did you change the chipSelect pin to match your shield or module?
The answer to all these questions is yes, since CardInfo occasionally begins to report
Initializing SD card...Wiring is correct and a card is present.
Card type: SD2
Volume type is FAT16
Volume size (bytes): 2002452480
Volume size (Kbytes): 1955520
Volume size (Mbytes): 1909
Files found on the card (name, date and size in bytes):
(skipped)
The intermittent failure makes me think it's a hardware issue, something sneaky like not enough power or a defective board someplace. Apart from buying replacements for everything and swapping them out, how can I figure out just where the problem is?
Thanks!