September
1999, Issue 110
Get
Smart Media(Part
1):
What's
It All About?
GETTING
AT 'EM
Having
a data path of only 8 bits requires that the large addresses
possible with SmartMedia be broken up into byte-sized
pieces, transferred, and reassembled internally. For
the SmartMedia to know whats coming through the
pipe, the user must follow the format of a small, predetermined
command set.
SmartMedia
commands consist of read (flash memory), write (to data
registers), write (data registers to flash memory),
erase (flash memory), reset, and status (see Figure
2). All commands require one (or two) bytes of command
data. Most require address data to follow.
|
Figure 2This chart shows
how the control lines are used for each of the
SmartMedia commands.
|
Command
bytes are written with the command latch enable (CLE)
high and the address latch enable (ALE) low, whereas
address bytes require the opposite states.
The
SmartMedia circuitry grabs the data presented on the
8-bit I/O bus on the rising edge of the write enable
(WE). When the first byte sent is command 90H with a
following address byte of 00H, the SmartMedia retrieves
two bytes from a special ID area. These two bytes can
be read from the SmartMedia device by lowering CLE and
ALE and bringing the read enable (RE) line low once
for each byte. The data is stable 35 ns after the falling
edge of RE.
The
first byte is a manufacturers code and the second
byte is a device code. These bytes are important because
they indicate the capacity of the storage medium. SmartMedia
devices with up to 32 MB require three address bytes.
Larger devices require four address bytes (for devices
with up to 8 GB.) You need to read the ID to determine
how many address bytes are required.
In
addition to the ID, SmartMedia has two read commands.
The read command transfers a complete page from the
flash memory to the data registers. The first address
byte (A0A7) is a pointer to within the data register.
The second, third, and potentially fourth address bytes
indicate which page to transfer into the data register
(A9Axx).
If
you were paying attention here, you noticed that A8
is mysteriously absent from the address bytes. If you
remember back when I described the page size as 528
bytes, youll see that A8 isnt needed unless
you wish to point to a starting address within the upper
256 bytes.
The
read1 command itself holds A8. Use the command 00H for
pointing to within the lower 256 bytes and 01H to point
to within the upper 256 bytes.
Prior
to obtaining the page data from the SmartMedia, you
must wait 10 µs. This can be accomplished by watching
the ready/busy output. After receiving the last address
byte, the ready/busy output goes low until the page
has been transferred from the flash memory. When the
ready/busy output goes high, you may read bytes bringing
the RE input low for each byte you wish to read.
Access
to the data registers begins at the address A0A7
+ A8 in the command byte and may continue up to the
end of the page. You can continue reading up to the
end of the block, but remember to wait for each page
to be transferred before continuing to read.