I am attempting to interface a Pro Micro 3.3V with a SD card using Arduino 1.0. Since the voltage level is 3.3V I do not have a voltage level converter and have wired the SD card directly up to the SPI port with SS pin tied to the SD card CS. This setup has worked for me with other AVR processors running @ 3.3V. Before I’ve used the Arduino development platform (v22) and had no difficulties; however, with the Leonardo setup and Arduino 1.0, the application I created (which is basically the test read/write application) fails to initialize the card.
My question is has anyone been able to successfully initialize and read/write to a SD card with the Pro Micro series (32U4) of devices AND Arduino 1.0 using the included SD library? If so, any tips or suggestions would be appreciated.
I have had no problems with SD and a 3.3v arduino, but that is using the mega1280.
I had a look at the schematic diagram of the Pro Micro, and it seems someone decided to use the slave select pin as the RX led. I presume based on this that the bootloader has control of that pin. I am not sure how that will affect the SPI. As long as it is always set to an output, it should be ok.
What pin of the Pro Micro are you connecting you SS pin to? Make sure this pin is called in your program in the SD.begin(SS_Pin); call.
And also just to check, these are how the SPI pins appear on the board.
Thanks for your reply. I, too, have had no difficulties with SD & 3.3V arduinos using the 328 chips. Works flawlessly.
However, with the pro micro and the Leonardo setup, the SD card simply will not initialize when I use the SS_pin (as with all the other arduinos). I thought that the bootloader might be an issue, but I believe that it relenquishes control of that port after initial startup. Additionally, I do not call the SD.begin(SS_Pin) until after the user presses a button so it should be well beyond the timeframe that the bootloader is active (I think).
I have seen the definition of the SS pin as both pin 14 & 17 and tried both to no avail.
Thanks for the ideas. I’ll give it a try in a bit and report back.
As for the SS pin, I have it hooked directly up to the SS pin. My goal is to do the debugging on the Pro Micro card and ultimately migrating to a dedicated design.
I tried the code snippet you recommended and it worked. I received the message “test” when I ran it on the Arduino. Additionally, I used your recommendation to try out the CardInfo example. Sadly, that also returned an error that initialization had failed.
To add to the confusion, I thought I would try something radically different. I have an AVR mkII programmer and decided to try something else. I decided to try out the bootloader that is listed on Adafruit’s site which is AVRdude compatible. On her site she also has an variant of the Arduino 0021 platform modified for the Teensy device (that is also a 32U4 based setup) and runs with the aforementioned bootloader. I used sdfat with reference to the same pins (SS being Chip Select) and it worked! I was able to initialize & read from the card without difficulty. In my excitement, I tried different cards and they all worked.
What this implies is that the wiring & setup I have is correct and I can only presume that there is an issue with the bootloader or the Arduino 1.0 platform. I would prefer to stick with the Leonardo based bootloader for it seems more robust than the other bootloader and Arduino environment I tried.
Just an update. I FINALLY got it to work. It turns out there is a bug in the SD library in the Arduino 1.0 release. I downloaded the beta version of the most recent SDfat from http://code.google.com/p/beta-lib/downloads/list . There is a release http://code.google.com/p/beta-lib/downl … p&can=2&q= (version 20120327…beta), that has revised handling of the SPI pins. Though, it is listed as beta, it worked just fine!
I’m in the same situation, interfacing the Arduino Pro Micro 3.3V to the SparkFun µSD breakout.
Regnir’s solution above didn’t work for me, but here is the slightly modified version which did.
No soldered green wires, just breadboard connections to the SD breakout as follows:
CD → No connection
DO → Arduino Pin 14
GND → Ground
SCK → Arduino Pin 15
VCC → VCC (regulated by the Pro Micro)
DI → Arduino Pin 16
CS → Arduino Pin 10
That leaves you with the non-standard pin assignments of the Pro Micro to clear up. For Arduino 1.0.1 on OSX, I opened /Applications/Arduino.app/Contents/Resources/Java/libraries/SD/utility/Sd2PinMap.h and made the following substation:
jpsdr:
Just an update. I FINALLY got it to work. It turns out there is a bug in the SD library in the Arduino 1.0 release. I downloaded the beta version of the most recent SDfat from http://code.google.com/p/beta-lib/downloads/list . There is a release http://code.google.com/p/beta-lib/downl … p&can=2&q= (version 20120327…beta), that has revised handling of the SPI pins. Though, it is listed as beta, it worked just fine!
Can you elaborate on how you got it work with the SDFat library? It is not working for me. I can however get the regular SD library to work using s4i1mow6’s solution. I would like to use the SDfat library for performance gains though. Thanks in advance for the help!