Specifications
©Copyright 2001-2013 SD Group (Panasonic, SanDisk, Toshiba) and SD Card Association
Physical Layer Simplified Specification Version 4.10
39
4.3.7 Card Lock/Unlock Operation
4.3.7.1 General
The password protection feature enables the host to lock a card while providing a password, which later
will be used for unlocking the card. The password and its size are kept in a 128-bit PWD and 8-bit
PWD_LEN registers, respectively. These registers are non-volatile so that a power cycle will not erase
them.
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), the card 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 shall 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.). Table 4-6 describes the structure of the
command data block. Note that the host compliant to the Physical Specification Version 2.00 or later
shall set reserved bits (Bit7-4) to 0 when issuing CMD42.
Byte # Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
0
Reserved
(shall be set to 0)
ERASE
LOCK_
UNLOCK
CLR_
PWD
SET_
PWD
1
PWDS_LEN
2
Password data
...
PWDS_LEN + 1
Table 4-6: Lock Card Data Structure
• ERASE: 1 Defines Forced Erase Operation. In byte 0, bit 3 will be set to 1 (all other bits shall be
0). All other bytes of this command will be ignored by the card.
• LOCK/UNLOCK: 1 = Locks the card. 0 = Unlock the card (note that it is valid to set this bit
together with SET_PWD but it is not allowed to set it together with CLR_PWD).
• CLR_PWD: 1 = Clears PWD.
• SET_PWD: 1 = Set new password to PWD
• PWDS_LEN: Defines the following password(s) length (in bytes). In case of a password
change, this field includes the total password lengths of old and new passwords.
The password length is up to 16 bytes. In case of a password change, the total length of the old
password and the new password can be up to 32 bytes.
• Password data: In case of setting a new password, it contains the new password. In case of a
password change, it contains the old password followed by the new password.
The data block size shall be defined by the host before it sends the card lock/unlock command. The
block length shall be set to greater than or equal to the required data structure of the lock/unlock
command. In the following explanation, changing block size by CMD16 is not a mandatory requirement
for the lock/unlock command.
Since block length shall always be even in DDR50 mode, the block length for CMD42 shall always be
rounded up to an even size. If CMD16 is used prior to CMD42 to set the block length, it shall always
specify an even length.