Go Down

Topic: How to connect Leonardo with SD card? (Read 2 times) previous topic - next topic

zintiger

I'm trying to use SD card by Leonardo, but failed.
I find that the pins defined in Sd2PinMap.h is different with most sample codes for UNO. I also connect the SD as follows, but fails,too.
How can I connect the both?

#elif defined(__AVR_ATmega32U4__)
// Teensy 2.0

// Two Wire (aka I2C) ports
uint8_t const SDA_PIN = 6;
uint8_t const SCL_PIN = 5;

// SPI port
uint8_t const SS_PIN = 0;
uint8_t const MOSI_PIN = 2;
uint8_t const MISO_PIN = 3;
uint8_t const SCK_PIN = 1;

Erdin

Read about SPI and the Leonardo, http://arduino.cc/en/Main/arduinoBoardLeonardo, http://arduino.cc/en/Main/arduinoBoardLeonardo
The ICSP header has the SPI signals, they are not on the normal pins.

Your SD shield should have a 6-pin socket for the ICSP header.
Which SD shield are you using ?

The pin numbers in the Sd2PinMap.h are the pin number of the ATmega32U4 chip, those number are NOT the Arduino pin numbers.
See this pin mapping, http://arduino.cc/en/Hacking/PinMapping32u4

zintiger

#2
Feb 26, 2013, 02:35 pm Last Edit: Feb 27, 2013, 09:02 am by zintiger Reason: 1
Mr.Erdin, I use SD modules,not SD shield,to cennect the Leonardo,as the following photo:

http://arduino.cc/en/Reference/SPI shows:

The Leonardo SS does not specified any pin. In my understanding, any P0-P13 can be defined as SS to connect CS of SD card.but I tried Pin0,Pin4, Pin8 adn P10, and failed again.

PaulS

I don't think either of those photos convey useful information.

zintiger

#4
Feb 27, 2013, 01:53 am Last Edit: Feb 27, 2013, 08:01 am by zintiger Reason: 1
Sorry,I find the pictures referred to the web site is wrong, I would change them when I get to my office latter.

Go Up