Chapter 4 – SD Card Protocol Description
Revision 2.2
SanDisk SD Card Product Manual
© 2004 SanDisk Corporation
4-10
12/08/04
Block Write
Block write
(CMD24-27, 42, 56(w)) means that one or more blocks of data are transferred
from the host to the card with a 1-bit or 4-bit CRC appended to the end of each block by
the host. SanDisk SD cards that support block-write are require the block length, set by
CMD16, to be 512 bytes regardless of whether WRITE_BL_LEN is set to 1k or 2kBytes.
The following table defines the card behavior when partial-block access is disabled
(WRITE_BL_PARTIAL = 0).
Table 4-2
Write Command Block Length
CSD Value
Max block size
WRITE_BL_LEN
Misalign Partial
Current
Blocklen
6
Write CMD Start Address
7
512-Bytes
0 (disable)
0 (disable)
512 bytes
n * 512 bytes (n : Integer)
1-kBytes
0 (disable)
0 (disable)
512 bytes
n * 512 bytes (n : Integer)
2-kBytes
0 (disable)
0 (disable)
512 bytes
n * 512 bytes (n : Integer)
In Table 4-2, the size in the “Current Blocklen” field is set or changed by CMD16. If the
value is less than 512 bytes (there are no relations with misalign and partial option), it is set
with no error. Then the size of the current block length is tested when the write command
is executed.
If WRITE_BL_PARTIAL is allowed (=1) then smaller blocks, up to resolution of one byte,
can be used as well. If the CRC fails, the card shall indicate the failure on the DAT line (see
below); the transferred data will be discarded and not written, and all further transmitted
blocks (in multiple block write mode) will be ignored.
Multiple block-write command shall be used rather than continuous single write command
to make faster write operation.
If the host uses partial blocks whose accumulated length is not block aligned and block
misalignment is not allowed (CSD parameter WRITE_BLK_MISALIGN is not set), the
card shall detect the block misalignment error and abort programming before the beginning
of the first misaligned block.
The card shall set the ADDRESS_ERROR error bit in the status register, and while
ignoring all further data transfer, wait in the Receive-data-State for a stop command.
The write operation shall also be aborted if the host tries to write over a write-protected
area. In this case, however, the card will set the WP_VIOLATION bit. Programming of the
CSD register does not require a previous block length setting. The transferred data is also
CRC protected. If a part of the CSD register is stored in ROM, then this unchangeable part
must match the corresponding part of the receive buffer. If this match fails, then the card
will report an error and not change any register contents.
Some cards may require long and unpredictable times to write a block of data. After
receiving a block of data and completing the CRC check, the card will begin writing and
hold the DAT0 line low if its write buffer is full and unable to accept new data from a new
WRITE_BLOCK command. The host may poll the status of the card with a
SEND_STATUS command (CMD13) at any time, and the card will respond with its status.
The status bit READY_FOR_DATA indicates whether the card can accept new data or
6
If the current block length is other than the values in the column, the SD Card indicates BLOCK_LEN_ERROR”
on the write-command response.
7
If the start address is different than the values in the column, the card will send “ADDRESS_ERROR” on the
Write command response.