Specifications

©Copyright 2001-2013 SD Group (Panasonic, SanDisk, Toshiba) and SD Card Association
Physical Layer Simplified Specification Version 4.10
40
The following paragraphs define the various lock/unlock command sequences:
Setting the Password
Select a card (CMD7), if not previously selected.
Define the block length (CMD16), given by the 8-bit card lock/unlock mode, the 8-bits password
size (in bytes), and the number of bytes of the new password. In the case that a password
replacement is done, then the block size shall consider that both passwords-the old and the new
one-are sent with the command.
Send the Card Lock/Unlock command with the appropriate data block size on the data line
including the 16-bit CRC. The data block shall indicate the mode (SET_PWD), the length
(PWDS_LEN) and the password itself. In the case that a password replacement is done, then
the length value (PWDS_LEN) shall include both passwords (the old and the new one) and the
password data field shall include the old password (currently used) followed by the new pass-
word. Note that the card shall handle the calculation of the new password length internally by
subtracting the old password length from PWDS_LEN field.
In the case that the sent old password is not correct (not equal in size and content), then the
LOCK_UNLOCK_FAILED error bit will be set in the status register and the old password does
not change. In the case that the sent old password is correct (equal in size and content), then
the given new password and its size will be saved in the PWD and PWD_LEN registers,
respectively.
Note that the password length register (PWD_LEN) indicates if a password is currently set. When it
equals 0, there is no password set. If the value of PWD_LEN is not equal to zero, the card will lock itself
after power up. It is possible to lock the card immediately in the current power session by setting the
LOCK/UNLOCK bit (while setting the password) or sending an additional command for card lock.
Reset the Password:
Select a card (CMD7), if not previously selected.
Define the block length (CMD16), given by the 8-bit card lock/unlock mode, the 8-bit password
size (in bytes), and the number of bytes of the currently used password.
Send the card lock/unlock command with the appropriate data block size on the data line
including the 16-bit CRC. The data block shall indicate the mode CLR_PWD, the length
(PWDS_LEN), and the password itself. If the PWD and PWD_LEN content match the sent
password and its size, then the content of the PWD register is cleared and PWD_LEN is set to
0. If the password is not correct, then the LOCK_UNLOCK_FAILED error bit will be set in the
status register.
Locking the Card:
Select a card (CMD7), if not previously selected.
Define the block length (CMD16), given by the 8-bit card lock/unlock mode, the 8-bit password
size (in bytes), and the number of bytes of the currently used password.
Send the card lock/unlock command with the appropriate data block size on the data line
including the 16-bit CRC. The data block shall indicate the mode LOCK, the length
(PWDS_LEN) and the password itself.
If the PWD content is equal to the sent password, then the card will be locked and the card-locked
status bit will be set in the status register. If the password is not correct, then the
LOCK_UNLOCK_FAILED error bit will be set in the status register.
Note that it is possible to set the password and to lock the card in the same sequence. In such a case,
the host shall perform all the required steps for setting the password (as described above) including the
bit LOCK set while the new password command is sent.
If the password was previously set (PWD_LEN is not 0), then the card will be locked automatically after