I recently purchased an SD card shield (Order # 281996). I tried to run the SD card read/write example from the Arduino SD library on an Adruino. The program is as it is in the library. When I attempt to run it with a 32 GB SD card I get the message “Initializing SD card…initialization failed!”. My computer recognizes the SD card OK, and I can save and delete files on it OK using Windows Explorer, so I think the card is OK. Can anyone help me get this shield to work?
I thought I was out of the woods, but it turns out that I am not. I set chip select to 10. The SD Card Shield then works OK with the SD ReadWrite example when I use an Arduino. However, I run into problems when I attempt to run it on an Botboardruino. I get a Windows (7 Professional) message saying “USB device not recognized”. It goes on to say that the device has malfunctioned. If I remove the SD Card Shield from the Botboarduino, the SD ReadWrite example runs on the Botboarduino, but with a message that the SD card initialization failed, as it should with the SD not installed.
Can the SD card be used with a Botboarduino? If so, what am I missing?
Don’t have enough details to know what is happening… Like which card are you using. Not sure what IO pins that card may or may not use.
First thing I might try to do, is to remove some of the special functionality of the Botboarduino. If you look at the guide: lynxmotion.com/images/html/build185.htm
Try disabling the speaker and the PS2 jumpers. (#4 and #5 in the diagram). The jumpers effect pins 5-9 on the Arduino.
All those jumpers are removed. The board is a ITEAR Studio SD Shield 2.0. Trying again I got error message: “USB Device Not Recognized. One of the USB devices attached to this computer has malfunctioned, and Windows does not recognize it.” Now I can’t get it to work even on an Arduino.
This shield cost only $3.95, a lot less that the shipping cost. Can you recommend an SD Shield that will work with the Botboarduino and has documentation available for it? I wouldn’t mind getting another shield if it would work.
I’ve been doing some research regarding SD shields, and see that on the Duemilanove the interface uses SPI and the ICSP pins. My SD Card Shield does not seem to have any connectors for that interface. I am a real babe in the woods here, so help from those in the know is much desired. Do I, for example, need to employ an additional breakout shield to interface with my SD Cad Shield?
The Robotshop/Lynxmotion people can probably answer better than I can, but today is a Holiday (Victoria Day), so until they are back, I will give you my take.
I have not done much with SD cards on Arduinos. My first time I started to play some with them is with the Teensy 3.1, with my Teensy breakout board with Arduino headers… I do not have a simple SDCard shield, but instead have a couple of display shields from Adafruit (1.8" tft with joystick and SD, 2.8" tft with touch and SD). Both of these displays use the SPI interface as does the touch interface and the SD interface. As part of my testing as to get these shields to work on the Teensy (had to make some library changes…), I have learned some and have done some testing on an Arduino UNO.
What I have found, is that for the SPI interface, several shields use the standard SPI pins found on an Arduino Uno(10-13) (and all of the others that use an Atmega328 or Atmega128), however for several other boards like Arduino Megas and Arduino Leonardo, Due…, the SPI pins are not on the same IO pins.
However on all of these boards, the SPI pins are on the same ISP pins. So some of the shields will instead use these pins.
Some boards like adafruit 2.8" TFT display (adafruit.com/product/1651), default to using the Arduino UNO standard pins, but also allow you to modify the board (cut a couple of trace jumpers) and solder in some other jumpers), will allow you to instead use the SPI pins on the ISP connector.
Side note: at least with the teensy and these displays, I have had better luck using the SDFAT library (code.google.com/p/sdfatlib/) instead of the SD library.
Again hopefully someone else can give you more advice on which simple SDcard shield to try.
Thank you. It was at the site arduino.cc/en/Reference/SPI that I got the idea that I needed to use the ICSP pins on the Botboarduino, from the table in the Connections section. There for boards Uno “or” Duemilanove it says for MOSI use pins 11 “or” ICSP-4. Since things don’t work for me treating my board as an Uno I thought perhaps the “or” should be interpreted as meaning that I should use the ICSP-4 pin for the Duemilanove (Borboarduino) and the 11 pin for the Uno. That’s where I got the idea that I needed another breakout shield to make those connections. Is that right?
The Botboarduino is compatible with the Duemilanove (Atmega328), so it also has compatible IOPINS so MOSI should be on both the IO pins mentioned. I have for example tested running the 1.8" tft display I mentioned from Adafruit (adafruit.com/products/802) purchased at robotshop, which works OK on a botboarduino. Again it uses SPI using the Pins 9-12…
I think I did try that. I interpreted that switch as a means to drop voltage to the 3.3v desired by the SD shield from 5v on boards supplying that 5v. That’s just a guess; I can’t find any relevant documentation. Anyway, I think I have good news. I breadboarded a hookup between the SD shield and the Botboarduino, connecting wires from the ICSP pins on the Botboarduino to pins 11, 12 and 13 as described in arduino.cc/en/Reference/SPI, with other wires connecting 5v and gnd. It worked!
I’ve clipped off those 3 pins on the SD shield and plan to connect those points to the Botboarduino with wires to the ICSP as I did on the breadboard. Unfortunately there is a physical interference between the ICSP connector and the SD shield, but I plan to get around that by stacking a breadboard shield on the Botboarduino with a hole in the breadboard over the ICSP connector to pass wire through to the SD shield, which will sit on top of the breadboard shield. I’ll keep you posted.
??? - I looked at the Botboarduino schematic and pins 11, 12, 13 are directly connected to the ICSP, plus the Arduino Header, plus the IO pins in the 4 pins servo grouping (10-13). So should not make any difference. If you have some form of meter, it would be interesting if you could try to measure the connectivity of these pins (i.e is there any resistance?)
Sorry for the slow response. I’ve been struggling all week. I couldn’t get it to work again after reporting above that I had. Now it works again, and I’ve learned a few things. First, examining the schematics for the Uno and the Duomilanove showed that pins 11, 12 and 13 are electrically identical to ICSP pins 1, 3 and 4, respectively. I verified that by checking the electrical continuity. However, there is still something strange. I modified the code in the SD-library begin function in SD.cpp to display what was going on in it.
[code]boolean SDClass::begin(uint8_t csPin) {
/*
Performs the initialisation required by the sdfatlib library.
Return true if initialization succeeds, false otherwise.
/
boolean cardOK = card.init(SPI_HALF_SPEED, csPin); // Beginning of my modification
boolean volumeOK = volume.init(card);
boolean rootOK = root.openRoot(volume);
if (!cardOK) Serial.println(“Bad card”); else Serial.println(“card OK!”);
if (!volumeOK) Serial.println(“Bad volume”); else Serial.println(“volume OK!”);
if (!rootOK) Serial.println(“Bad root”); else Serial.println(“root OK!”); // End of my modification
/
return card.init(SPI_HALF_SPEED, csPin) &&
volume.init(card) &&
root.openRoot(volume);
*/
return cardOK && volumeOK && rootOK; // My modification replacing the above statement
}
[/code]
I added and displayed variables cardOK, volumeOK and rootOK, at first leaving the rest unchanged. The program reported they were all OK, but still reported “initialization failed!”. So I replaced the return statement as shown above, and now it runs OK! At any rate, I now seem to have a functioning SD shield. Now I’m going to try to find and strip out unnecessary code from the SD library so I can fit this into my hexapod’s code. Thank you for all your help.
I connected the SD shield to my AH3-R hexapod, and there is still a problem. The SD shield works OK if I have the Botboarduino USB-EXT jumper set to get power from USB. However, this shield does not work if I have this jumper set to draw power from the external source, a 9V battery. I checked the voltage on the battery, and it reads 6.8V when the card is running. A fresh 9V battery yielding 9V gives the same results. I replaced the Botboarduino with another one and get the same results. In summary, the SD shield works OK if the USB-EXT jumper is set to USB but not to EXT, all else being unchanged. Any thoughts?