Architecture
1279
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Multimedia Card (MMC)/Secure Digital (SD) Card Controller
26.2.9 Initialization
26.2.9.1 MMC/SD Controller Initialization
The general procedure for initializing the MMC/SD controller is given in the following steps. Details about
the registers or register bit fields to be configured in the MMC/SD mode are in the subsequent
subsections.
1. Place the MMC/SD controller in its reset state by setting the CMDRST bit and DATRST bit in the MMC
control register (MMCCTL). You can set other bits in MMCCTL after reset.
2. Write the required values to other registers to complete the MMC/SD controller configuration.
3. Clear the CMDRST bit and the DATRST bit in MMCCTL to release the MMC/SD controller from its
reset state. It is recommended not to rewrite the values that are written to the other bits of MMCCTL
in .
4. Enable the MMCSD_CLK pin so that the memory clock is sent to the memory card by setting the
CLKEN bit in the MMC memory clock control register (MMCCLK).
NOTE:
The MMC/SD cards require a clock frequency of 400 kHz or less for the card initialization
procedure. Make sure that the memory clock confirms this requirement. Once card
initialization completes, you can adjust the memory clock up to the lower of the card
capabilities or the maximum frequency that is supported.
26.2.9.2 Initializing the MMC Control Register (MMCCTL)
The bits in the MMC control register (MMCCTL) affect the operation of the MMC/SD controller. The
subsections that follow help you decide how to initialize each of control register bits.
In the MMC/SD mode, the MMC/SD controller must know how wide the data bus must be for the memory
card that is connected. If an MMC card is connected, specify a 1-bit data bus (WIDTH = 0 in MMCCTL); if
an SD card is connected, specify a 4-bit data bus (WIDTH = 1 in MMCCTL).
To place the MMC/SD controller in its reset state and disable it, set the CMDRST bit and DATRST bit in
MMCCTL. The first step of the MMC/SD controller initialization process is to disable both sets of logic.
When initialization is complete, but before you enable the MMCSD_CLK pin, clear the CMDRST bit and
DATRST bit in MMCCTL to enable the MMC/SD controller.
26.2.9.3 Initializing the Clock Controller Registers (MMCCLK)
A clock divider in the MMC/SD controller divides-down the function clock to produce the memory clock.
Load the divide-down value into the CLKRT bits in the MMC memory clock control register (MMCCLK).
The divide-down value is determined by the following equation:
memory clock frequency = function clock frequency/(2 × (CLKRT + 1))
, when DIV4 = 0 in MMCCLK
memory clock frequency = function clock frequency/(4 × (CLKRT + 1))
, when DIV4 = 1 in MMCCLK
The CLKEN bit in MMCCLK determines whether the memory clock appears on the MMCSD_CLK pin. If
you clear the CLKEN to 0, the memory clock is not provided except when required.
26.2.9.4 Initialize the Interrupt Mask Register (MMCIM)
The bits in the MMC interrupt mask register (MMCIM) individually enable or disable the interrupt requests.
To enable the associated interrupt request, set the corresponding bit in MMCIM. To disable the associated
interrupt request, clear the corresponding bit. Load zeros into the bits that are not used in the MMC/SD
mode.