GD32W51x User Manual
800
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 (class 7). Thus, the host is allowed to reset,
initialize, select, query for status, 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.).
describes the structure of the command data block.
Table 23-31. Lock card data structure
Byte
Bit 7 Bit 6 Bit 5 Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
0
Reserved(all set to 0)
ERASE
LOCK_UNLOCK
CLR_PWD
SET_PWD
1
PWDS_LEN
2
Passw ord data(PWD)
……
P1
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 length 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.
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-bit
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