Go Down

Topic: SD Card Shield configuration on Arduino mega 2560 REV3? (Read 23606 times) previous topic - next topic

FWBF

@ liudr

Thank you very much.

Method 2 works great.

growqx

I have been trying to get the SD card work with my Uno Ethernet+SD shield, but unfortunately to no avail. When I use it with the Uno by placing it on top of it as it's supposed to, it works fine. However, when I connect it by wires to even the Uno, it doesn't work as well.

I would like to confirm that I'm doing everything correctly.

So, I use 6 wires in total for connecting the shield to the Mega:
gnd->gnd
5v->5v
4->53
11->51
12->50
13->52

I have tried both original SD library and the Adafruit one, but both didn't work.
The beginning of code, in the case of the Adafruit library, looks like this.
Code: [Select]

...
const int chipSelect = 4;   

void setup()
{
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.print("\nInitializing SD card...");
  // On the Ethernet Shield, CS is pin 4. It's set as an output by default.
  // Note that even if it's not used as the CS pin, the hardware SS pin
  // (10 on most Arduino boards, 53 on the Mega) must be left as an output
  // or the SD library functions will not work.
  pinMode(10, OUTPUT);
  digitalWrite(10, HIGH);
  pinMode(53, OUTPUT);


  // we'll use the initialization code from the utility libraries
  // since we're just testing if the card is working!
  while (!card.init(SPI_HALF_SPEED, 53,51,50,52 )) {
...


Every time I open the serial monitor, it says that the initialization failed. However, if I let the Arduino function for a while and it spits out multiple failures, then occasionally it gives the following:
Code: [Select]
Card type: SD1
Could not find FAT16/FAT32 partition.
Make sure you've formatted the card

Of course, I have tried formatting the card. I feel that this partial progress might be an error in the library since it has given the same message even if the chipSelect pin assigned in the code is completely wrong.
I tried commenting out the lines about pin 10 as well. Is everything correct? Should I physically connect a wire to the pin 10 of the ethernet shield, since it's not connected to anything (I tried that as well, didn't work but suppose it doesn't hurt to ask)?

SurferTim

Which SD shield are you using? A link to the hardware might help.


I have been trying to get the SD card work with my Uno Ethernet+SD shield, but unfortunately to no avail. When I use it with the Uno by placing it on top of it as it's supposed to, it works fine. However, when I connect it by wires to even the Uno, it doesn't work as well.

So, I use 6 wires in total for connecting the shield to the Mega:

So it works on the Uno when you place it on top.  it doesn't work on the Uno when you use jumpers.  Now you're trying to use jumpers on the MEGA?

What happens when you place it on top of the MEGA and only jump pins 11-13 to their 51-53 equivalents?

Also, if you ever do need to format the card, make sure you don't use quick format.

Gilvan

Hi, I am new to Arduino and I need the library SD, SPI for ATMega2560 R3, could someone give me a link to download and tutorial where download? Thank.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy