FlashMedia Interface
MOTOROLA
IDE and FlashMedia Interface
13-23
Figure 13-19 Read Data From Card
The read sequence reads a packet on the data line.
The DATABITCOUNT is the number of bits in the packet. This includes the CRC bits. There are 16 CRC
bits for the 1-bit bus, 64 CRC bits for the 4-bit bus. The number of bits/bytes/longwords that need to be
read from FLASHMEDIADATA1 corresponds with DATABITCOUNT. The CRC will be read from
FLASHMEDIADATA1 too. The user need not check the CRC in software. This is done in hardware. The
result can be retrieved in bit crcstatus1 in register FLASHMEDIASTATUS after packet read end. All words,
except the first word, read from FLASHMEDIADATA1 contain 32 bits of data. The first word contains the
remainder. Data in the first word is right-justified.
During this sequence, the host must look for events on SHIFT_BUSY1 and INTERRUPT1. This can be
done by polling FLASHMEDIASTATUS or FLASHMEDIAINTSTATUS, or by waiting for interrupts
SHIFTBUSY1RISE, SHIFTBUSY1FALL, INTERRUPT1RISE, INTERRUPT1FALL. To read/write data
to/from FLASHMEDIADATA1, the host can poll FLASHMEDIAINTSTAT, wait for interrupt, or use a DMA
channel. The writing of DATABITCOUNT + READDATAMASK + WIDESHIFTMASK to
FLASHMEDIACMD1 must take place after SHIFTBUSY1 has gone high. One or more read packets can
be received from the card using this timing diagram
13.4.7
COMMONLY USED COMMANDS IN SD MODE
Some pseudo-code descriptions are given in this section for sent command, read multiple block, and write
multiple block commands.
13.4.7.1
Send Command To Card (No Data)
This sequence is intended for commands that require status response from the card, but no data transfer
between host and card. There are no provision to do CRC insertion or check for command and response
packets. All need to be done in software.
/* write command to host */
CMDBITCOUNT = 46
FLASHMEDIACMD2 = 0x060000 + CMDBITCOUNT
while(CMDBITCOUNT > 0)
write
FLASHMEDIACMD1 =
0x40000 +
wideShiftMask
read one or more
times from
FLASHMEDIADATA1
ZZ
SE
dataBitCount
PP
P
Card driving bus
write
FLASHMEDIACMD1 =
dataBitCount +
readDataMask +
wideShiftMask
DATA lines
shift_busy1
Note 3: Host interface will stop SCLK_OUT clock when needed to prevent transmit underrun or receive overrun. (not shown)
Data
CRC
ounter1
Note 1: For 4-bit wide bus, wideShiftMask is 0x400000, CRC length is 64 bits
For 1-bit wide bus, wideShiftMask = 0, CRC length is 16 bits.
Note 2: If read data packet followed by another read data packet (block read), set
readDataMask = 0x40000. If only one read data packet, set readDataMask = 0.
read
FLASHMEDIASTATUS
Extract bit CRCOK1
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
..
.