![Texas Instruments AM1808 Technical Reference Manual Download Page 1291](http://html.mh-extra.com/html/texas-instruments/am1808/am1808_technical-reference-manual_10945581291.webp)
Procedures for Common Operations
1291
SPRUH82C – April 2013 – Revised September 2016
Copyright © 2013–2016, Texas Instruments Incorporated
Multimedia Card (MMC)/Secure Digital (SD) Card Controller
26.3.5 MMC/SD Mode Single-Block Read Operation Using EDMA
To perform a single-block read, the same block length needs to be set in both the MMC/SD controller and
the card. The procedure for this operation is:
1. Write the card’s relative address to the MMC argument registers (MMCARGH and MMCARGL). Load
the high part of the address to MMCARGH and the low part of the address to MMCARGL.
2. Read card CSD to determine the card's maximum block length.
3. Use the MMC command register (MMCCMD) to send the SET_BLOCKLEN command (if the block
length is different than the length used in the previous operation). The block length must be a multiple
of 512 bytes and less then the maximum block length specified in the CSD.
4. Reset the FIFO (FIFORST bit in MMCFIFOCTL).
5. Set the FIFO direction to receive (FIFODIR bit in MMCFIFOCTL).
6. Set the access width (ACCWD bits in MMCFIFOCTL).
7. Set the FIFO threshold (FIFOLEV bit in MMCFIFOCTL).
8. Set up DMA (DMA size needs to be greater than or equal to FIFOLEV setting).
9. Use MMCCMD to send the READ _BLOCK command to the card.
10. Set the DMATRIG bit in MMCCMD to trigger the first data transfer.
11. Wait for DMA sequence to complete.
12. Use the MMC status register 0 (MMCST0) to check for errors.
26.3.6 MMC/SD Mode Multiple-Block Write Operation Using CPU
NOTE:
This procedure uses a STOP_TRANSMISSION command to end the block transfer. This
assumes that the value in the MMC number of blocks counter register (MMCNBLK) is 0. A
multiple-block operation terminates itself if you load MMCNBLK with the exact number of
blocks you want transferred.
To perform a multiple-block write, the same block length needs to be set in both the MMC/SD controller
and the card.
The procedure for this operation is:
1. Write the card’s relative address to the MMC argument registers (MMCARGH and MMCARGL). Load
the high part of the address to MMCARGH and the low part of the address to MMCARGL.
2. Read card CSD to determine the card's maximum block length.
3. Use the MMC command register (MMCCMD) to send the SET_BLOCKLEN command (if the block
length is different than the length used in the previous operation). The block length must be a multiple
of 512 bytes and less then the maximum block length specified in the CSD.
4. Reset the FIFO (FIFORST bit in MMCFIFOCTL).
5. Set the FIFO direction to transmit (FIFODIR bit in MMCFIFOCTL).
6. Set the access width (ACCWD bits in MMCFIFOCTL).
7. Set the FIFO threshold (FIFOLEV bit in MMCFIFOCTL).
8. Enable the MMC interrupt.
9. Enable DXRDYINT interrupt.
10. Write the first 32 bytes of the data block to the MMC data transmit register (MMCDXR).
11. Use MMCCMD to send the WRITE_MULTI_BLOCK command to the card.
12. Set the DMATRIG bit in MMCCMD to trigger the first data transfer.
13. Wait for MMC interrupt.
14. Use the MMC status register 0 (MMCST0) to check for errors and to determine the status of the FIFO.
If more bytes are to be written and the FIFO is not full, go to
. If the all of the data has been
written, go to
.