ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites


Embedded Systems

Link to Circuit Cellar

Applications

MegaMicro Card

by Tom Cantrel

In the world of data flash cards, Tom compares MultiMedia Card to CompactFlash and Nexcom. His result bodes well for the smaller, faster, and more versatile MMC in a variety of handheld products.

No place is Moore’s Law more rigidly enforced than in the memory market. The name of the game: make it denser, smaller, faster, and cheaper—or go home.

Hope, at least from the supplier’s perspective, can be found in the historic fact that ever-lower priced bits are quickly consumed. Program bloat gets much of the blame since it’s easy to point the finger at some faceless programmer who couldn’t resist filling another meg with frivolous features. But, exploding data is equally to blame, and nobody’s forcing you to stockpile all those TIFs, GIFs, JPGs, and PDFs.

With the recent unveiling of the MultiMedia Card (MMC, shown in Photo 1) by SanDisk and Siemens, it’s a good time to check out the flash data-card niche. But first, a bit of history.

e018pic1.gif (26959 bytes)

Photo 1Memory marches on, and the MultiMediaCard, which crams many megabytes into its minuscule package, proves it.

Back in November ’96, I described the battle between SanDisk CompactFlash (CF) and the Intel-backed Miniature Card ("Flash Fight Flares," INK 76). Since then, it’s safe to say that CompactFlash is clearly winning.

In particular, widespread adoption of CF in the emerging digital camera market bodes well for the future. CF is designed into dozens of models, and SanDisk shipped more than a million CF cards in ’97.

Until now, acceptance of these cameras has been held back by limited resolution. However, the emergence of mega-pixel models under $1000, not to mention low-cost, photo-grade, inkjet printers are harbingers of big biz down the road.

Then, in August ’97, I covered the serial flash module from a startup called Nexcom ("Serial Flash Busts Bit Barrier," INK 85). Checking up, I find that late last year the company, product line, and single-transistor memory technology were acquired by Integrated Silicon Solutions Inc. (ISSI).

These two articles set the stage for MMC, which can aptly be described as a hybrid that fills the gap between CF and the Nexcom-now-ISSI module. Simply put, MMC combines multi-megabyte aspirations with minimalist form factor, power consumption, and interface.

BIG & SMALL

At only 32 mm ? 24 mm (and 1.4 mm thick), the MMC footprint is barely 1 in.2, which is about half the size of CF. In fact, the MMC occupies about the same area as the Nexcom module, although the aspect ratio is a bit more squarish.

However, where the Nexcom module topped out at a megabyte or so, MMC starts at 2 MB and goes all the way to 10 MB, with talk of 15- and 20-MB units in 1999 being bandied about. Meanwhile, CF is at 40 MB and headed to 80 MB. That is, MMC seems to be tracking at about a quarter of the capacity of CF.

Besides obvious data-storage applications like digital photos or voice recording, new ideas are emerging to take advantage of flash-card technology. For instance, a museum in Japan provides a hand-held audio player with a card storing the equivalent of a tour guide. A change in exhibits simply calls for updating the flash cards with the new info.

A subtle, but I suspect profound, difference for MMC is the prospect of read-only versions (i.e., ROM). Siemens has announced 2- and 8-MB units with plans for 32 MB in 1999 and a whopping 128 MB by 2001.

This announcement opens the door for MMC as a medium for distributing software of all kinds, including programs and reference data such as maps, phone books, and even music. Siemens uses the analogy that flash MMC is like a hard drive, while ROM MMC is like a CD-ROM.

The portable apps best served by the small size of the card are also likely to be finicky about battery life. To that end, the MMC adopts a number of power-saving features.

To start, there’s no 5-V option like the one offered with CF. Instead, the MMC operates at a somewhat lower voltage.

Actually, the card is required to be able to establish basic communication with the host over a wide 2.0–3.6-V range. This communication enables the host to interrogate the card’s Operating Condition Register (OCR), which defines the allowed voltage range (typically greater than 2.7 V) for memory access.

The amount of power consumed during memory access isn’t trivial (e.g., 35 mA at 3.3 V). However, the MMC has a low-power standby mode that cuts power by a factor of almost 1000 (e.g., 50 ?A at 3.3 V).

The host can overtly issue a command that causes the card to go into standby. However, it may not be necessary because the MMC automatically puts itself to sleep after 5 ms of inactivity.

There’s no need to reset the card or otherwise go through hoops to get going again. Even in standby mode, the card remains conscious enough to detect a subsequent command and wake itself up. Only a 1-ms delay is required before the card is ready for the next read or write, as opposed to the 50-ms delay that is required after powerup.

TWINTERFACE

One factor that really differentiates the MMC from CF is the interface. CF, reflecting its PCMCIA roots, requires a whopping 50 pins to support its 8-/16-bit IDE-disk-drive–compatible bus. Needless to say, the size and cost goals of MMC demand something more streamlined, as in just seven signals.

As opposed to the expensive and mechanically precise pin-and-socket–style connector of PCMCIA and CF, the MMC uses the surface-contact slide-in approach like the Nexcom module.

A close look at Photo 1 shows that the socket power and ground contacts are offset to connect first on insertion and disconnect last on removal—a basic requirement for hot swap.

Taking power and dual grounds may leave only four pins to get the job done, but SanDisk manages to provide two rather different ways of doing so (see Table 1).

Pin # MMC Usage SPI Usage SPI Description
1 RSV CS Chip select (active low)
2 CMD DataIn Host-to-card commands and data
3 VSS1 VSS1 Supply voltage ground
4 VDD VDD Supply voltage
5 CLK CLK Clock
6 VSS2 VSS2 Supply voltage ground
7 DAT[0] DataOut Card-to-host data and status
Table 1The MMC offers two interfaces (SPI and MMC) to enable a price/performance tradeoff that covers a broad range of applications.

I can imagine how the arguments went. On one side, the purists arguing for an elegant new interface offering high speed and lots of neat capabilities. On the other, pragmatists willing to dispense with the bells and whistles in favor of something quick and easy to hook up to any micro. Tastes great or less filling? Why not do both?

The purists get what they want with the so-called MMC interface, which is the default when the card powers up. Pragmatists can choose a simple SPI (i.e., clocked serial) interface that, at best, directly connects to the ever-growing list of so-equipped micros or, at worst, calls for a few lines of bit-banging code.

How does the MMC know which interface to use? In MMC mode, pin 1 is a reserved No Connect, but it’s defined as Chip Select (CS) for SPI mode. At powerup, the MMC card checks the CS pin and, if it’s asserted, switches the interface from MMC to SPI mode.

In both modes, pin 5 is the clock input generated by the host to time data transfers. Data is referenced to the falling edge of the clock.

The difference between the modes largely boils down to the last two pins. For MMC mode, they function as bidirectional command (CMD) and data (DAT) lines, while for SPI they are unidirectional data lines (DIN and DOUT). Also, the MMC CMD line switches between open-collector and push-pull output configuration, while SPI is push-pull only. Table 2 sums up the functional differences between the modes.

MMC SPI
Three-wire serial data bus (clock, command, and data) Three-wire serial data bus (clock, data in, and data out) and card-specific CS signal
Variable clock rate 0–20 MHz Variable clock rate 0–5 MHz
Up to 64k cards addressable by the bus protocol Card selection via a hardware CS signal
Up to 30 cards stackable on a Up to 10 cards stackable on a single physical bus single physical bus Up to 10 cards stackable on a Up to 10 cards stackable on a single physical bus single physical bus
Easy card identification Not available
Error-protected data transfer is available Optional. A nonprotected data-transfer mode.
Sequential and single/multiple block-oriented data transfer Single block read/write
Table 2Using the simpler SPI mode sacrifices some functionality related to addressing and multiblock data transfers. But, the difference between the modes is an issue for designers, not users, because the card uses whichever interface is requested by the host it is currently plugged into.

While SPI requires a CS line for each card, MMC mode uses an addressing scheme that supports, logically at least, up to 64K cards in a stack. Here’s how.

Each card has a unique 128-bit card ID (CID) register. In response to an ALL_SEND_CID broadcast from the host, all attached MMC cards try to drive their own CID on the CMD line (open-collector mode), and each simultaneously monitors the line for comparison. Any time a card outputs a 1 but sees a 0, it backs off (i.e., quits sending its CID).

By the time the host clocks in the last bit of CID, only one card is left standing. The host proceeds to assign that card a 16-bit relative card address (RCA) that is used for the duration of the session.

The host keeps issuing ALL_SEND_ CID commands. Cards that have gotten their RCA remain quiet. Eventually, all cards have an RCA and the last issued command times out, signaling completion of the ID phase.

Another major difference is that MMC mode, thanks to the ability to overlap commands and data, offers terminate-at-will multiblock and streaming transfer modes. SPI handles everything as a single-block transfer with predetermined length.

Finally, the MMC mode offers faster raw transfer (20 MHz vs. 5 MHz for SPI). However, the advantage of the higher speed is mainly found with the multiblock and streaming modes. The actual throughput is ultimately limited by memory bandwidth: 1 MBps for reads and 200 kBps for writes.

The fact that the MMC doesn’t have a 5-V option is evidence of the trend toward lower operating voltages to reduce power consumption and extend battery life. In situations where the MMC must connect to a 5-V device, level shifters are required. Figure 1, taken from a SanDisk app note, shows transistor pairs configured to step up and step down a 5-V SPI interface.

SMARTS ONBOARD

SanDisk sticks with the strategy of using an onboard intelligent controller in front of the memory chip. Their success in the marketplace is the best argument for adding a controller which, despite the cost penalty, is more than offset by various benefits.

The controller goes out of its way to help preserve data integrity, incorporating functions like internal ECC, CRC, bad sector mapping, and wear-dependent write algorithms (write endurance is 300k cycles). Because the card handles these important functions, you don’t have to fuss with them.

Perhaps the most important benefit of the separate-controller approach is that it decouples the host-system hardware and software design from the particulars of the underlying memory technology.

The host issues high-level commands like read, write, erase, and so forth, and the controller handles the details. This means today’s design will work with tomorrow’s MMC cards, no matter what kind of esoteric memory technology finds its way under the hood.

Along with the IDE-disk drive pretensions, the rigid adherence to disk nomenclature (cylinder, head, etc.) that characterized the earlier card’s interface is fading. Other than the fact that the basic building blocks are 512-byte sectors, the organization isn’t really much like a disk at all.

Instead, the memory is partitioned as shown in Figure 2. The smallest amount that can be erased defines a sector. An erase group comprises 16 sequential sectors.

A single erase command can zap an arbitrary selection of the sectors (i.e., any or all of the 16) within an erase group or an arbitrary selection of erase groups. The process involves tagging the start and end of a sequence of sectors or erase groups, untagging those (up to 16) that aren’t to be erased, and then issuing the erase command.

A write-protect group, the smallest individually protectable unit, is composed of 32 erase groups. Plus, two card-level write-protect bits—one temporary and one permanent—offer global protection.

There’s a permanent copy bit that is presumably intended to combat piracy. However, protection seems to depend on trusted software on the host or programmer, because the copy-bit setting doesn’t otherwise affect card operation.

The global write- and copy-protection bits are found in the CSD (card-specific data) register which, like the previously mentioned CID and OCR (voltage profile) registers, defines various card-unique parameters such as speed, power requirements, and partitioning (i.e., block, sector, group, device sizes).

Table 3 summarizes the commands that are handled by the MMC. The subset of commands related to multiblock transfer and software addressing aren’t available in SPI mode, as I described earlier. All of the commands are six bytes in length, while responses vary from 1 to 16 bytes, depending on the command as well as on which interface is being used.

SPI Index Cmd Mode? Abbreviation Description
CMD0 Y GO_IDLE_STATE Resets all cards to idle state
CMD1 Y SEND_OP_COND Request and confirm operating conditions
CMD2 N ALL_SEND_CID Request all cards send their ID number
CMD3 N SET_RELATIVE_ADDR Assign 16-bit relative card address (RCA)
CMD4 N SET_DSR Select output driver configuration
CMD7 N SELECT/DESELECT_CARD Select addressed (RCA) card
CMD9 Y SEND_CSD Request addressed card to send CSD data
CMD10 Y SEND_CID Request addressed card send ID number
CMD11 N READ_DAT_UNTIL_STOP Stream read
CMD12 N STOP_TRANSMISSION Stop stream read
CMD13 Y SEND_STATUS Request addressed card send its status
CMD15 N GO_INACTIVE_STATE Set addressed card to inactive
CMD16 Y SET_BLOCKLEN Set block length for block commands
CMD17 Y READ_SINGLE_BLOCK Read a single block
CMD18 N READ_MULTIPLE_BLOCK Read multiple blocks
CMD20 N WRITE_DAT_UNTIL_STOP Stream write
CMD24 Y WRITE_BLOCK Write a single block
CMD25 N WRITE_MULTIPLE_BLOCK Write multiple blocks
CMD26 N PROGRAM_CID Program card ID (factory use only)
CMD27 Y PROGRAM_CSD Protection writable bits of CSD register
CMD28 Y SET_WRITE_PROT Protection on for addressed group
CMD29 Y CLR_WRITE_PROT Protection off for addressed group
CMD30 Y SEND_WRITE_PROT Request card protection status
CMD32 Y TAG_SECTOR_START First sector in erase list
CMD33 Y TAG_SECTOR_END Last sector in erase list
CMD34 Y UNTAG_SECTOR Remove sector from erase list
CMD35 Y TAG_ERASE_GROUP_START First group in erase list
CMD36 Y TAG_ERASE_GROUP_END Last group in erase list
CMD37 Y UNTAG_ERASE_GROUP Remove group from erase list
CMD38 Y ERASE Erase all previously selected sectors
CMD39 Y FAST_IO Access app-specific (non-MMC) registers
CMD40 N GO_IRQ_STATE Enter interrupt mode
CMD59 Y CRC_ON_OFF Enable/Disable CRC (SPI mode only)
Table 3The MMC command set offers dozens of high-level commands dealing initialization and configuration, data transfer (block, multiblock, and stream), and erasure and write1 protection

STACK THE DECK

If you think the MMC is an ace, a good place to see more is the recently formed MultiMedia Card Association. You’ll find late-breaking info and links to members like SanDisk, Siemens, Hitachi, Motorola, Nokia, and others.

A $340 evaluation kit from SanDisk comes with a 20-MB MMC card, PC parallel port MMC drive, extender card, and the requisite software utilities and documentation.

The MMC is less PC-centric than earlier cards, and it targets many nonPC-related apps. But, there’s no denying the PC is often at least one, if not the ultimate, destination for just about all data.

Unlike earlier disk cards, MMC can’t piggyback on the PC’s built-in IDE support. To make MMC look like a disk, you need flash-file system software. SanDisk offers a $2545 host developers toolkit containing the C source for a FAT (file allocation table) file system.

Porting the driver to a design starts with writing a minimal set of low-level hardware-specific drivers that establish physical communication with the MMC. A configuration file specifies a variety of options, such as buffer sizes, whether to preerase when a file is deleted or extended (speeds subsequent writes), MMC or SPI interface, and so on.

Put it all together, and you end up with an API (see Table 4) that knows about disks, files and their attributes, directories, and so forth.

pc_cluster_size Return cluster size
pc_diskabort Abort operation
pc_dskclose Flush FAT and files and free buffers
pc_diskflush Flush FAT and files
pc_format Format card
pc_free Return bytes free on card
pc_fstat Return statistics on open file
pc_gdone Free pc_gfirst and pc_gnext resources
pc_get_attributes Get file attributes
pc_gfirst Return first entry in a directory
pc_gnext Return next entry in a directory
pc_isdir Test if path is a directory
pc_mv Rename a file or directory
pc_pwd Return the current working directory
pc_rmdir Delete a directory
pc_set_attributes Set file attributes
pc_set_cwd Set current working directory
pc_set_default_drive Set default drive specifier
pc_stat Get file or directory statistics
pc_unlink Delete a file
po_close Close a file
po_extend_file Extend a file
po_flush Write a file directory entry and flush FAT
po_lseek Move the file pointer
po_open Open a file
po_read Read from a file
po_truncate Truncate a file
po_write Write to a file
Table 4The SanDisk host-developers toolkit software provides a FAT file system–compatible Application Programmers Interface (API)

GIGANANOCARD?

Compared to older cards, MMC is a better fit with the form-factor, power-consumption, and cost requirements of anything that purports to be handheld or fit in a pocket.

I especially like the simple, versatile interface. It’s nicer to deal with a few pins rather than the 50+ of earlier cards. Thanks to SPI mode, the card is easily managed by the lowliest processors, yet designs requiring performance can exploit the faster MMC mode.

SanDisk offers 2-, 4-, and 8-MB cards at $26, $32, and $43 in volume (for now, it looks like the formula is $3 per MB + $20). As of today, capacity, price, or both may hold back some applications. But thanks to Moore’s Law, both concerns will diminish over time, broadening MMC acceptance and design-in.

The interesting question is, what happens next? History would predict that another downsizing lies around the corner. The only problem is that while silicon may shrink, people won’t.

The wizards may get a zillion bits on the head of a pin, but that doesn’t mean it’s wise. Make the thing much tinier, and you’ll need a magnifying glass and tweezers to boot up.

Tom Cantrell has been working on chip, board, and systems design and marketing in Silicon Valley for more than ten years. You may reach him by E-mail at tom.cantrell@circuitcellar.com , by telephone at (510) 657-0264, or by fax at (510) 657-5441.


SOURCES

MultiMedia Card
SanDisk Corp.
(408) 542-0500
Fax: (408) 542-0503
www.sandisk.com

Serial flash module
Integrated Silicon Solutions, Inc.
(408) 588-0800
(408) 588-0805
www.issiusa.com

MultiMedia Card Assn.
(408) 253-0441
Fax: (408) 253-8811
www.mmca.org

Circuit Cellar INK provides up to date information for engineers, www.circuitcellar.com for more information and additional articles.
ęCircuit Cellar INK, the Computer Applications Journal.
Posted with permission.
For subscription information, call (860) 875-2199 or subscribe@circuitcellar.com
DESIGN FORUM—bonus online articles, hints,  and applications for subscribers only!

Feedback

Embedded Systems Home | Back to Applications menu
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ