So, I don't understand why, but apparently hooking up SD cards to an Mbed isn't just "plug in these wires and import this library"
The official library OR something in my circuitry seems to have a bug. So that I won't forget how it all works though here is my quick write up:
First off, I'm using the new Sparkfun SD card breakout board, so I've "translated" the pinouts between SPI and SD formats:
**NEW** SparkFun SD Breakout Board MicroSD Breakout mbed D3 o-------------o 20 (DigitalOut cs) CMD o-------------o 11 (SPI mosi) VCC o-------------o VOUT CLK o-------------o 13 (SPI sclk) GND o-------------o GND D0 o-------------o 12 (SPI miso) CD o D1 o D2 o
Then, for some reason, the SD card library for mbed would never work the first time I ran it. So, I had to fork it and make it so that "if initialization fails, try one more time, just in case". It's delightfully horrible, but I'm tired of trying to find the correct solution to the problem
That forked repo is located at SDFileSystem_tryagain
After doing all this, it finally "just works"
Notes about my setup:
- The try again bit could be caused by noise. the SD card is about 2-3 inches from the mbed and requires long lines
- I'm using a 4G SDHC card produced by SanDisk
- I have no idea what I'm doing with hardware :)
Hopefully this helps some helpless soul searching on google. I know I had a ton of problems finding any reference to this problem, even though people have told me that it does happen