Card Access; Block Access—Block Write And Block Read; Block Write - Motorola DragonBall MC9328MX1 Reference Manual

Integrated portable system processor
Table of Contents

Advertisement

card_registry()
{
while(ResponseTO from STATUS)
{
if(card==combo or sdio)
{
send_cmd_wait_resp(SET_RELATIVE_ADDR, 0x00, 0x00, 0x01,0x40);
rca = SDIO_RCA = address from response FIFO;
}
else if(card==sd)
{
send_cmd_wait_resp(ALL_SEND_CID, 0x00, 0x00, 0x02, 0x40);
send_cmd_wait_resp(SET_RELATIVE_ADDR, 0x00, 0x00, 0x01,0x40);
rca = SD_RCA = address from response FIFO;
}
else if(card==mmc)
{
send_cmd_wait_resp(ALL_SEND_CID, 0x00, 0x00, 0x02, 0x40);
rca = MMC_RCA = 0x1;
send_cmd_wait_resp(SET_RELATIVE_ADDR, MMC_RCA, 0x00, 0x01, 0x40);
}
else
exit due to card not identified;
}
send_cmd_wait_resp(SELECT_CARD, rca, 0x00, 0x41, 0x40);
}

20.7.3 Card Access

This section discusses the MMC/SD card access with block write and read, stream write and read, erase
and wide bus selection and deselection.
20.7.3.1 Block Access—Block Write and Block Read
The module supports both block write and block read operation to the card. Block Mode data transfers are
grouped as 512 byte package/block and they are protected by CRC.

20.7.3.1.1 Block Write

During the block write commands (CMD24–CMD27), one or more blocks of data are transferred from the
MMC/SD module to the card with a CRC appended to the end of each block by the MMC/SD module.
When the CRC fails, the card indicates the failure on the SD_DAT line, the transferred data is discarded
and not written, and all further transmitted blocks (in multiple block write mode) are ignored. A card
supporting block write is always able to accept a block of data of the size defined by WRITE_BL_LEN.
When the MMC/SD module uses partial blocks with accumulated lengths that are not block aligned and
block misalignment is not allowed (CSD parameter WRITE_BLK_MISALIGN is not set), the card detects
the block alignment error and aborts programming before the beginning of the first misaligned block. The
card sets the ADDRESS_ERROR bit in the Card Status Register, ignores all further data transfers, and
waits in the receive state for a stop command. The write operation is aborted when the MMC/SD module
tries to write over a write protected area. In this case, the card sets the WP_VIOLATION bit in the Card
Status Register.
Block write commands are used to program the CID and CSD registers which do not require a previous
block length setting. The transferred data is CRC protected.
When a part of the CSD or CID register is stored in ROM, this unchangeable part must match the
corresponding part of the receive buffer or the card reports an error and does not change any register
contents.
MOTOROLA
Multimedia Card/Secure Digital Host Controller Module (MMC/SD)
Code Example 20-6. Card_Registry
Functional Example for the MMC/SD Module
20-37

Advertisement

Table of Contents
loading

Table of Contents