NXP Semiconductors MC9328MX1, MC9328MXL, MC9328MX21 Setup And Use

© Freescale Semiconductor, Inc., 2005. All rights reserved.
Freescale Semiconductor
Application Note
Document Number: AN3049
Rev. 0, 10/2005
1Abstract
This document applies to the following devices, collectively called i.MX throughout:
MC9328MX1
MC9328MXL
MC9328MX21
Setup and Use of the Multimedia Card/Secure Digital Host Controller
MC9328MX1, MC9328MXL, and MC9328MX21
by: Jason Castillo
Contents
1 Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
2 MMC/SD Module Overview . . . . . . . . . . . . . . . . .2
3 MMC/SD Module Configuration . . . . . . . . . . . . . .2
4 Interfacing with the MMC/SD Module . . . . . . . . .5
5 Special Considerations . . . . . . . . . . . . . . . . . . .10
6 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
MMC/SD Module Overview
Setup and Use of the Multimedia Card/Secure Digital Host Controller Application Note, Rev. 0
2 Freescale Semiconductor
2 MMC/SD Module Overview
This section provides an overview of both the Multimedia Card (MMC) and Secure Digital Card (SD) modules. The MMC/SD module includes the following features:
Supports up to 10 cards (including one SD card)
Password protection for cards
Built-in programmable frequency counter for MMC/SD bus
Maskable hardware interrupt for card detection (insertion/removal), SD I/O interrupt, internal status, and FIFO status
Contains an integrated 32 × 16-bit FIFO
Supports plug-and-play (Pop)
Supports many SD functions including multiple I/O and combined I/O and memory
Supports up to seven I/O functions plus one memory on a single SD I/O card
Card can interrupt MMC/SD module
Support single or multiple block access, or stream access to the card for read, write, or erase operations
Supports SD I/O ReadWait and interrupt detection during 1- or 4-bit access
2.1 Multimedia Card (MMC) Protocol
The MMC is low cost data storage and communication medium implemented as a hardware card with a simple control unit and a compact, easy-to-implement interface that is designed to cover a wide variety of applications. It is based on an advanced 7-pin serial bus designed to operate over a voltage range of 2.0 to
3.6 V. Note that the maximum operating voltage range for the i.MX is 3.3 V. Therefore the i.MX-based design is limited to a supply range of 2.0 to 3.3 V.
2.2 Secure Digital Card (SD) Protocol
The SD is an extended version of the MMC with two additional pins. The additional pins are designed to meet the security, capacity, performance, and environmental requirements inherent in new audio and video consumer electronic devices. The physical form factor and data transfer protocol are compatible with the MMC. The SD is composed of a memory card and an I/O card.
3 MMC/SD Module Configuration
The MMC card has 7 pins and the SD card has 9 pins. The pins are used to communicate with other functions within the card. The pin assignment and form factor are shown in Tabl e 1.
MMC/SD Module Configuration
Setup and Use of the Multimedia Card/Secure Digital Host Controller Application Note, Rev. 0
Freescale Semiconductor 3
Table 1. MMC/SD Card Pin Assignment
Each card has a set of information registers that hold the operating parameters and other card conditions. See the description in Tabl e 2. Details of each register can be found in card registers chapter in both the MultiMediaCard System Specification and the SD Memory Card Specification.
Table 2. MMC/SD Card Registers
MMC or SD Identifier Register Name Description Size
(Bits)
Both CID Card Identification Number Each card has a unique CID. 128
1
1
There can be fewer bits for the SD I/O Card, depending on implementation.
Both RCA Relative Card Address Assigned by the MMC/SD module during initialization. 16
Both DSR Driver Stage Configures the card’s output drivers. Use is optional, not
required.
16
Both CSD Card Specific Data Contains information on the card’s operating conditions. 128
1
Both OCR Operation Conditions Indicates the card’s operating voltage range. Detects restricted
cards and indicates whether power-up is complete. Use is optional, not required.
32
Both CSR Card Status Register Contains card’s error and status information. Sent to the
MMC/SD module in response format R1.
32
SD only SCS SD Card Status Contains status information proprietary to the SD card (such as
protection, card type, and bus width).
512
SD only SCR SD Configuration Register Contains additional configuration information only applicable to
the SD card.
64
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
Interfacing with the MMC/SD Module
Setup and Use of the Multimedia Card/Secure Digital Host Controller Application Note, Rev. 0
Freescale Semiconductor 5
// GPCR |= 0x00000400; // DS_SLOW = 26 MHz / 30 pF // GPCR |= 0x00000800; // DS_SLOW = 26 MHz / 45 pF // GPCR |= 0x00000C00; // DS_SLOW = 26 MHz / greater than 45 pF
/*****************************************/ /* Include the AIPI Module Configuration */ /*****************************************/ PSR0_2 &= ~0x00000010; PSR1_2 |= 0x00000010; PAR_2 |= 0x00000010; }
Notice in the code sample that the last five registers are included within the pin configuration. The DDIR register for the i.MX1/L is set to 0x00003F00 to enable the SDHC ports to output. Because the i.MX21 can have two SDHC ports, set both PTB_DDIR and PTE_DDIR registers to 0x000003F0 and 0x00FC0000 respectively. The GPCR is the peripheral control register which is used to control the driving strength. When using the MMC/SD module the driving strength must be set to 15 pF; otherwise overshoot and ringing problems can occur on the SD_CLK. Setting the driving strength on the i.MX21 is explained in the driving strength section of reference [6]. The next three registers (PSR0_2, PSR1_2, and PAR_2) are used to allow the IP bus peripheral to send 32 bits and whether it can be accessed in user mode.
4 Interfacing with the MMC/SD Module
This section describes the different functional aspects of the MMC/SD module.
4.1 Card Identification Modes
The MMC/SD module is in identification mode after reset and during the search for new cards on the bus. During the identification mode, the MMC/SD module performs the following steps which are explained in more detail in the next sections:
1. Detects the cards
2. Resets all cards that are in the card identification state
3. Validates operation voltage range
4. Identifies the cards
5. Asks each card (separately, on its own SD_CMD line) to publish its relative card address (RCA)
4.1.1 Card Detect
Card detection occurs automatically through the SD_DAT [3] pin. Only the SD card has this feature because the MMC does not have the SD_DAT [3] pin. The detection circuitry is sampled by the i.MX system clock (HCLK) so the state of the MMC/SD module does not matter. After the card is detected, the user must mask the card detection interrupt (INT_MASK |= 0x40) to avoid misleading interrupt generation during card access as the SD_DAT lines change.
Loading...
+ 9 hidden pages