Help getting the Ada Fruit SD Breakout board working with a Arduino Mega ADK

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
celer
 
Posts: 7
Joined: Tue Apr 17, 2012 1:40 am

Help getting the Ada Fruit SD Breakout board working with a Arduino Mega ADK

Post by celer »

Hi,

I'm having some issues getting the SD breakout board working consistently with an Arduino Mega ADK, the CardInfo example works on occasion (one of every 30 times or so).

Here's what I've got, that appears to work on occasion:

1. I have what I'm pretty certain is an authentic Arduino Mega ADK board
2. I'm using the latest version of the Arduino IDE /w the /libraries/SD replaced by the Adafruit github version
3. I've formatted the SD card to be Fat 16 using windows, following the directions in the Adafruit tutorial
4. I changed MEGA_SOFT_SPI from 0 to 1 in /SD/Utilities/Sd2Card.h
5. I've updated the pin assignments in that file as well to be:

#else // SOFTWARE_SPI
// define software SPI pins so Mega can use unmodified GPS Shield
/** SPI chip select pin */
uint8_t const SD_CHIP_SELECT_PIN = 53;
/** SPI Master Out Slave In pin */
uint8_t const SPI_MOSI_PIN = 51;
/** SPI Master In Slave Out pin */
uint8_t const SPI_MISO_PIN = 50;
/** SPI Clock pin */
uint8_t const SPI_SCK_PIN = 52;
#endif // SOFTWARE_SPI

And I've followed the wiring instructions on the Adafruit SD card tutorial for a MEGA card as well, and tried re-wiring it a few times to eliminate a connectivity problem.

One out of about every 30 times I try it CardInfo works, and I can hit the reset button on the Arduino and it will work again, I even had the Datalogger example working one time. But it appears random if it will work or not and usually it says it can't initialize the card.

Any ideas?

Thanks,

celer


celer
 
Posts: 7
Joined: Tue Apr 17, 2012 1:40 am

Re: Help getting the Ada Fruit SD Breakout board working with a Arduino Mega ADK

Post by celer »

Thanks, that resolved it!

celer
 
Posts: 7
Joined: Tue Apr 17, 2012 1:40 am

Re: Help getting the Ada Fruit SD Breakout board working with a Arduino Mega ADK

Post by celer »

Thanks for all your help!

I do have another question, so for the most part my sketch works now, but sometimes it fails to initialize the SD card even when using 1/16th speed. And I was curious if you had any hints to help debug it.

Here is what I can do to assure the app works each time:
1 - Disconnect Power (via USB from the ) Arduino Board (I'm using an Mega ADK) and let it sit for a about 10 seconds.
2 - Install a very basic sketch on the board that looks like so:

setup(){}
loop(){}

3 - Install my sketch, it will work now.

And it will work each time there after until the power is unplugged from the board. And it may or may not work after that, but it will likely fail to initialize the card.

The function call that fails is:

Sd2Card::init(uint8_t skRateID, uint8_t chipSelectPin)
(using any speed, and CS 10)

Any hints for debugging this?

Thanks,

celer

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: Help getting the Ada Fruit SD Breakout board working with a Arduino Mega ADK

Post by adafruit_support_bill »

Make sure all your connections are solid & any jumper wires are not too long.
If you post photos showing your soldering and connections we'll take a look for any potential problems.

Also, some cards work better than others. If you have a different card, try it.

celer
 
Posts: 7
Joined: Tue Apr 17, 2012 1:40 am

Re: Help getting the Ada Fruit SD Breakout board working with a Arduino Mega ADK

Post by celer »

Hi,

Thanks again for the feedback, here is a picture of the current setup:

Image

I got both the SD Card breakout board and the SD card from you guys, so it is the SD card which is recommended by Adafruit.

I was planning on soldering up a prototype board so I can take this thing on the road, but given this my question for you is, if I solder up a prototype board, what should I consider to make sure that it will be more robust?

Thanks,

celer

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: Help getting the Ada Fruit SD Breakout board working with a Arduino Mega ADK

Post by adafruit_support_bill »

Are all those header pins soldered on the SD breakout?

celer
 
Posts: 7
Joined: Tue Apr 17, 2012 1:40 am

Re: Help getting the Ada Fruit SD Breakout board working with a Arduino Mega ADK

Post by celer »

Yes

User avatar
adafruit_support_bill
 
Posts: 88136
Joined: Sat Feb 07, 2009 10:11 am

Re: Help getting the Ada Fruit SD Breakout board working with a Arduino Mega ADK

Post by adafruit_support_bill »

About the only thing I can suggest is shorter jumpers. Breadboard layouts are never ideal. It will be easier to keep signals short and separated when you move it to a proto-board.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”