SD card and fat16

Hi to everybody. I’m new in this “world” and I hope somebody can help me. I’ve bought a Seeeduino mega11 and a Sd card reader, I downloaded the code for writing and reading in fat16, but I haven’t had any success: I get always the same error:
error: card.init
SD error: 1

I get this error with the sd reader connected or disconnected and with the sd card inserted or not inserted. I’m using a 1Gb Sd card, formatted as fat16…
If it can be helpful, here you can see a photo of the hardware I have: … t=&d=13,50

Does anybody have an idea? Thanks!

Hi, the SD card shield is not compatible with seeeduino/arduino mega. So try the arduino or seeeduino 328.

Hello. Thanks a lot for your answer.
Are you sure? At the link I posted in my first message, there’s a picture of a Seeeduino mega11 with the Sd card reader.
And I checked the pin labels on the Seeeduindo Mega11 and on the Sd card reader and they correspond: +3,3V is in the same position, the same for +5V, Gnd and D9.

The SPI port on mega is not the pin 10,11,12,13, so it can not control the sd card through these pins.

The SPI pin on mega is as follows:

You are an expert and I’m so ignorant that I can’t understand you…
Can you please tell me what’s PB1, PB2, PB4?

If I understood correctly, I have to drive 4 wires from the pins on the SD reader to the Seeeduino board.
So, the corrispondence could be:
10 -> PB4
11 -> PB2
12 -> PB2
13 -> PB1
Is that right or is it in another order? If it’s correct, I just have to understand what PB1, PB2, PB4 are…

There’s a mistake in my previous reply, and I had edited it.

These pins on seeeduino mega are as follows:

BTW, what library are you using to control the SD card?

please take a look at the figure below.
PB0,PB2 are the pin names of atemga 1280 microcontroller which mega board uses.

use pin50,51,52,53,should be ok.

Thanks a lot everybody.
I’ll try to connect the pins of the sd reader to the pins you suggested me.

Are they correct also for my Seeeduino Mega11 Board?

I downloaded the libraries from:
I hope this answers to your question…

I don’t want to doubt of your words, but I’d like to understand.

If I connect my SD reader to an Arduino board, the pins used would be the ones indicated in the picture.
How can I understand which pins are they on Arduino and which pins correspond on mine Mega? If I’m right, the reader uses digital 9, 10, 11, 12, 13 pins. How can you know from your table that they correspond to PB0, PB1, PB2, PB3?arduino.jpg

Hi dave,

I’ll give you a table about the relation between the pin number and the real pin on arduino board.
You can test them using multimeter.
To the details you can refer to the datasheet of ATMega168 and 1280.


arduino pin map.jpg

Hello. I couldn’t get any result, even with your kind explanation. Now I found this program:

In the library spi.h there are these instructions:
#define SCK_PIN 13
#define MISO_PIN 12
#define MOSI_PIN 11
#define SS_PIN 10

Do you think I can modify them to match the pins connected to the sd card? Or SCK, MISO, MOSI, SS are fixed and I can’t change them?

Hi dave,

If you use mega to control the sd card, spi pins should be changed in the spi.h:
you may try this:

#define SCK_PIN 52
#define MISO_PIN 50
#define MOSI_PIN 51
#define SS_PIN 53



Hi, Icing.
You are very nice and I hope you will forgive my ignorance. If I apply the modification you suggested, then can I connect the sd reader directly to the fisical pins of my board as in the attached picture? Or must I anyway modify it with some wires?
Thanks a lot for you help

Hi dave,

The spi pins of mega is not in the same position as 168/328, which you can find them on the pic of last page you submitted. So you need to modify it with some wires. May be like this:

SD card shield arduino mega
VCC -> +5v
SCK -> pin52
MISO -> pin50
MOSI -> pin51
SS -> pin53

All the best, and feel free to ask any question.


Hi guys,
This has been an informative thread! I’m also quite new to this and I’ve just bought the SD card shield v2.1 for an Arduino Duemilanove, ATMega328, hoping it would be compatible.

The pin configuration seems perfectly compatible, is there anything else y’all think I should know when connecting them?

One question. The libraries and demo sketch I downloaded from this site for the FileLogger define pin 8 as what powers the SD card, where it seems like on the Seeeduino, Duemilanove and written on the shield itself, that digital pin 9 is used…
What do ppl think? Change the code to reflect this?
here’s the page I got the libraries and sketch from - … th=104_109

Thanks in advance,


Yes, the example in the library uses pin8 to control the power of SD card(soft reset). However, we use pin9 in the SD card shield. So you need to do a small change on the example by replacing “#define MEM_PW 8” with “#define MEM_PW 9”.
However, if you do not want to use the soft reset function, you can move the switch to the 3.3v side.