Home9260 QuickStart GuideApplication Notes9260 SD Connection

Snapper 9260 includes two MCI peripherals, allowing for connectivity to MMC, SD and SDIO devices. In this application note we discuss connecting an SD header to the MCI slot B, and then using this to access an SD storage card.

Note: This application note deals only with the core SD signals, and does not cover the write-protect, Vcc-enable, or card detect signals that are also commonly used.

SD Standard

SD storage cards can operate in two modes, SD or SPI. SPI mode is typically used for microcontrollers with fewer resources, as it is an easier bus to implement. It is however limited in speed, and unsuitable for SDIO devices. Snapper 9260 can operate SD cards in either mode, and as such full SD mode is generally preferred. This document discusses full SD mode.

SD cards have the following standard pin-out

SD_Card_Pinout
SD Card Pinout
Pin SD Mode SPI Mode
Name Type Description Name Type Description
1 CD/DAT3 I/O/PP Card detection / Data Line 3 CS I Chip select
2 CMD PP Command/Response line DI I Data input
3 GND S Ground GND S Ground
4 Vcc S Power Supply Vcc S Power Supply
5 CLK I Clock SCLK I Clock
6 GND S Ground GND S Ground
7 DAT0 I/O/PP Data Line 0 DO O/PP Data output
8 DAT1 I/O/PP Data Line 1 - - -
9 DAT2 I/O/PP Data Line 2 - - -

QSK Connection

To attach an SD socket to the Snapper 9260 QuickStart Kit, use the following connections

SD Pin Name QSK Pin GPIO Snapper 9260 Pin
1 CD/DAT3 53 PA3 69
2 CMD 45 PA1 61
3 GND 57 - -
4 Vcc 58 - -
5 CLK 43 PA8 59
6 GND 59 - -
7 DAT0 47 PA0 63
8 DAT1 49 PA5 65
9 DAT2 51 PA4 67

Linux Software

Once the hardware has been correctly attached, the Linux kernel must be rebuilt to include support for SD cards.

  • Make the following changes to arch/arm/mach-at91rm9200/board-snapper9260.c
    • Add an mmc_data structure definition:
/*
 * MCI (SD/MMC)
 */
static struct at91_mmc_data __initdata mmc_data = {
        .slot_b         = 1,
        .wire4          = 1,
};
    • Initialise the MMC subsystem (inside sn9260_board_init)
at91_add_device_mmc(&mmc_data);
  • Rebuild kernel with the following config options enabled
CONFIG_MMC=y
CONFIG_MMC_BLOCK=y
CONFIG_MMC_AT91=y
  • Update the kernel on the Snapper 9260, either in the on-board NAND flash, or by booting the unit over the network.
  • When the SD device is detected, output similar to the following will be displayed on the serial console:
mmcblk0: mmc0:0001 SD 1964544KiB 
 mmcblk0: p1
  • Once detected, the SD card can be mounted and used as a standard Linux block device
root@snapper:~$ mount /dev/mmcblk0p1 /mnt/
root@snapper:~$ cp my_file /mnt
root@snapper:~$ ls /mnt
my_file
root@snapper:~$ umount /mnt/

Snapper 9260 includes two MCI peripherals, allowing for connectivity to MMC, SD and SDIO devices. In this application note we discuss connecting an SD header to the MCI slot B, and then using this to access an SD storage card.

Note: This application note deals only with the core SD signals, and does not cover the write-protect, Vcc-enable, or card detect signals that are also commonly used.


 

Applications

rs1

rs_2

rs_3

rs_4