
SD/SDIO/MMC card host interface (SDMMC)
RM0351
1534/1830
DocID024597 Rev 5
Example of write procedure using DMA
Send CMD24 (WRITE_BLOCK) as follows:
a) Program the SDMMC data length register (SDMMC data timer register should be
already programmed before the card identification process)
b) Program DMA channel (refer to
DMA configuration for SDMMC controller
c) Program the SDMMC argument register with the address location of the card from
where data is to be transferred
d) Program the SDMMC command register: CmdIndex with 24(WRITE_BLOCK);
WaitResp with ‘1’ (SDMMC card host waits for a response); CPSMEN with ‘1’
(SDMMC card host enabled to send a command). Other fields are at their reset
value.
e) Wait for SDMMC_STA[6] = CMDREND interrupt, then Program the SDMMC data
control register: DTEN with ‘1’ (SDMMC card host enabled to send data); DTDIR
with ‘0’ (from controller to card); DTMODE with ‘0’ (block data transfer); DMAEN
with ‘1’ (DMA enabled); DBLOCKSIZE with 0x9 (512 bytes). Other fields are don’t
care.
f)
Wait for SDMMC_STA[10] = DBCKEND, (DBCKEND is set in case of no errors)
DMA configuration for SDMMC controller
a) Enable DMA2 controller and clear any pending interrupts
b) Program the DMA2_Channel4 (or DMA2_Channel5) source address register with
the memory location base address and DMA2_Channel4 (or DMA2_Channel5)
destination address register with the SDMMC_FIFO register address
c) Program DMA2_Channel4 (or DMA2_Channel5) control register (memory
increment, not peripheral increment, peripheral and source width is word size)
d) Enable DMA2_Channel4 (or DMA2_Channel5)
45.4
Card functional description
45.4.1 Card
identification
mode
While in card identification mode the host resets all cards, validates the operation voltage
range, identifies cards and sets a relative card address (RCA) for each card on the bus. All
data communications in the card identification mode use the command line (CMD) only.
45.4.2 Card
reset
The GO_IDLE_STATE command (CMD0) is the software reset command and it puts the
MultiMediaCard and SD memory in the Idle state. The IO_RW_DIRECT command (CMD52)
resets the SD I/O card. After power-up or CMD0, all cards output bus drivers are in the high-
impedance state and the cards are initialized with a default relative card address
(RCA=0x0001) and with a default driver stage register setting (lowest speed, highest driving
current capability).