
MMC/SD Module Configuration
Setup and Use of the Multimedia Card/Secure Digital Host Controller Application Note, Rev. 0
4
Freescale Semiconductor
3.1
Pin Configuration
The MMC/SD module uses six I/O pins to communicate with external MMC/SD cards.
•
SD_CMD
—Bidirectional command/response signal between the MMC/SD module and the card.
Open-drain for initialization state and push-pull for fast command transfers.
•
SD_Clk
—MMC/SD module to card clock signal (output).
•
SD_DAT [3:0]
—Four bidirectional data signals. When in push-pull mode, one card or the
MMC/SD module can drive each line at a time.
These six I/O pins are multiplexed with other functions on the i.MX devices and must be configured for
MMC/SD module operation. Explanation of the pin configuration can be found in the reference manual.
Example 1
is code sample of the pin configuration. The data direction register (DDIR) is not necessarily
required to initialize, however, it is highly recommended, especially when working with multiple
modules.
Example 1. Pin Configuration for MMC/SD Card on the i.MX1/L
/**************** Initialize ****************/
/* Set up GPIO for MMC/SD */
/********************************************/
void MMC_SD_Port_Initialize()
{
// SD_CMD - Primary function of GPIO Port B [13]
GIUS_B &= ~0x00002000; // CLEAR BIT 13
GPR_B &= ~0x00002000; // CLEAR BIT 13
PUEN_B |= 0x00002000; // SET BIT 13
// SD_CLK - Primary function of GPIO Port B [12]
GIUS_B &= ~0x00001000; // CLEAR BIT 12
GPR_B &= ~0x00001000; // CLEAR BIT 12
// SD_DAT[3] - Primary function of GPIO Port B [11]
GIUS_B &= ~0x00000800; // CLEAR BIT 11
GPR_B &= ~0x00000800; // CLEAR BIT 11
// SD_DAT[2] - Primary function of GPIO Port B [10]
GIUS_B &= ~0x00000400; // CLEAR BIT 10
GPR_B &= ~0x00000400; // CLEAR BIT 10
PUEN_B |= 0x00000400; // SET BIT 10
// SD_DAT[1] - Primary function of GPIO Port B [9]
GIUS_B &= ~0x00000200; // CLEAR BIT 9
GPR_B &= ~0x00000200; // CLEAR BIT 9
PUEN_B |= 0x00000200; // SET BIT 9
// SD_DAT[0] - Primary function of GPIO Port B [8]
GIUS_B &= ~0x00000100; // CLEAR BIT 8
GPR_B &= ~0x00000100; // CLEAR BIT 8
PUEN_B |= 0x00000100; // SET BIT 8
DDIR_B |= 0x00003F00;
// Initialize SDHC's port
GPCR &= 0xFFFFF3FF; // DS_SLOW = 26 MHz / 15 pF