Chapter 4 – SD Card Protocol Description
Revision 2.2
SanDisk SD Card Product Manual
© 2004 SanDisk Corporation
4-12
12/08/04
Mechanical Write Protect Switch
A mechanical sliding tablet on the side of the card (refer to the mechanical description),
controlled by the user, indicates whether or not a given card is write-protected. If the
sliding tablet is in the position of the window open, it means the card is write-protected. If
the window is closed, the card is not write-protected.
A proper, matched, switch on the socket side will indicate to the host that the card is write-
protected or not. It is the responsibility of the host to protect the card. The position of the
write-protect switch is unknown to the internal circuitry of the card.
Card’s Internal Write Protection (Optional)
Card data may be protected against either erase or write. The entire card may be
permanently write-protected by the manufacturer or content provider by setting the
permanent or temporary write protect bits in the CSD Register.
4.4.7
Card Lock/Unlock Operation
The password-protection feature enables the host to lock a card while providing a password
that will be used later for unlocking the card. The password and its size are kept in 128-bit
PWD and 8-bit PWD_LEN registers, respectively. These registers are non-volatile which
protects a power cycle erase.
Locked cards respond to (and execute) all commands in the "basic" command class (class
0), ACMD41, CMD16 and “lock card” command class. Thus the host is allowed to reset,
initialize, select, query for status, etc., but not to access data on the card. If the password
was previously set (the value of PWD_LEN is not ‘0’), it will be locked automatically after
power on.
Similar to the existing CSD Register write commands the lock/unlock command is
available in "transfer state" only. This means that it does not include an address argument
and the card has to be selected before using it.
The card lock/unlock command has the structure and bus transaction type of a regular
single block write command. The transferred data block includes all the required
information of the command (password setting mode, PWD itself, card lock/unlock etc.).
The following table describes the structure of the command data block.
Table 4-3
Lock Card Data Structure
Byte Bit
7
Bit
6
Bit
5
Bit
4
Bit 3
Bit 2
Bit 1
Bit 0
0
Reserved
ERASE LOCK_UNLOCK CLR_PWD SET_PWD
1 PWDS_LEN
2
…
PWDS_LEN
+ 1
Password Data