The Commands

24 Mar

The Commands
A MultiMediaCard host with an SPI interface can use most of the commands defined in the MultiMediaCard specification.

The specification defines ten classes of commands (Table 5-3). A single command can be in multiple classes. For example, both the block-read and block-write classes include the SET_BLOCK_LEN command, which sets the length of a data block. SPI mode doesn’t support commands in the stream-read and stream-write classes, where transmitted data isn’t in blocks of a defined size, or commands in the I/O-mode class, which supports non-storage functions. SPI mode supports everything a mass-storage device requires, however.

Table 5-3: The MultiMediaCard protocol includes ten classes of commands.

All MultiMediaCards support all of the commands in the basic class. These commands carry out basic status and control functions. MultiMediaCards using SPI also support commands in the block-read, block-write, erase, write-protection, lock-card, and application-specific classes.

A host needs to support only the commands required to carry out its purpose. Some commands are required to initialize the card. USB mass-storage communications read and write blocks of data, so a MultiMediaCard host in a USB mass-storage device uses block-read and block-write commands to access the MultiMediaCard’s storage media.

The descriptions that follow apply to a MultiMediaCard host using the SPI bus. A host using the MultiMediaCard bus can accomplish the same things, but the command and response formats and protocols vary as described in the MultiMediaCard specification.

Commands Used by Mass-storage Devices
Table 5-4 shows basic-class commands that flash-memory MultiMediaCard hosts typically support in USB mass-storage devices.

Table 5-5 shows commands used in reading and writing blocks of data. The commands that read or write data require a starting address to read or write.

Table 5-4: Mandatory basic-class commands for a MultiMediaCard.

This value is the offset of the byte within the media, with the bytes numbered sequentially from zero. To convert a logical block address (LBA) to a
byte address, multiply the LBA by the media’s block, or sector, size (typically 512).

Some commands read or write to registers in the MultiMediaCard. Table 5-6 shows the three MultiMediaCard registers used in SPI communications. The MultiMediaCard bus supports two additional registers for storing a card address and providing data to improve bus performance. These registers are unneeded and unavailable in SPI mode.

Random Posts

No comments yet

Leave a Reply

You must be logged in to post a comment.