09.12.2012 Views

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

RM0090: Reference manual - STMicroelectronics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Secure digital input/output interface (SDIO) <strong>RM0090</strong><br />

password setting mode, the PWD itself, and card lock/unlock). The command data block<br />

size is defined by the SDIO card host module before it sends the card lock/unlock command,<br />

and has the structure shown in Table 147.<br />

The bit settings are as follows:<br />

● ERASE: setting it forces an erase operation. All other bits must be zero, and only the<br />

command byte is sent<br />

● LOCK_UNLOCK: setting it locks the card. LOCK_UNLOCK can be set simultaneously<br />

with SET_PWD, however not with CLR_PWD<br />

● CLR_PWD: setting it clears the password data<br />

● SET_PWD: setting it saves the password data to memory<br />

● PWD_LEN: it defines the length of the password in bytes<br />

● PWD: the password (new or currently used, depending on the command)<br />

The following sections list the command sequences to set/reset a password, lock/unlock the<br />

card, and force an erase.<br />

Setting the password<br />

1. Select a card (SELECT/DESELECT_CARD, CMD7), if none is already selected.<br />

2. Define the block length (SET_BLOCKLEN, CMD16) to send, given by the 8-bit card<br />

lock/unlock mode, the 8-bit PWD_LEN, and the number of bytes of the new password.<br />

When a password replacement is done, the block size must take into account that both<br />

the old and the new passwords are sent with the command.<br />

3. Send LOCK/UNLOCK (CMD42) with the appropriate data block size on the data line<br />

including the 16-bit CRC. The data block indicates the mode (SET_PWD = 1), the<br />

length (PWD_LEN), and the password (PWD) itself. When a password replacement is<br />

done, the length value (PWD_LEN) includes the length of both passwords, the old and<br />

the new one, and the PWD field includes the old password (currently used) followed by<br />

the new password.<br />

4. When the password is matched, the new password and its size are saved into the PWD<br />

and PWD_LEN fields, respectively. When the old password sent does not correspond<br />

(in size and/or content) to the expected password, the LOCK_UNLOCK_FAILED error<br />

bit is set in the card status register, and the password is not changed.<br />

The password length field (PWD_LEN) indicates whether a password is currently set. When<br />

this field is nonzero, there is a password set and the card locks itself after power-up. It is<br />

possible to lock the card immediately in the current power session by setting the<br />

LOCK_UNLOCK bit (while setting the password) or sending an additional command for card<br />

locking.<br />

Resetting the password<br />

1. Select a card (SELECT/DESELECT_CARD, CMD7), if none is already selected.<br />

2. Define the block length (SET_BLOCKLEN, CMD16) to send, given by the 8-bit card<br />

lock/unlock mode, the 8-bit PWD_LEN, and the number of bytes in the currently used<br />

password.<br />

3. Send LOCK/UNLOCK (CMD42) with the appropriate data block size on the data line<br />

including the 16-bit CRC. The data block indicates the mode (CLR_PWD = 1), the<br />

length (PWD_LEN) and the password (PWD) itself. The LOCK_UNLOCK bit is ignored.<br />

4. When the password is matched, the PWD field is cleared and PWD_LEN is set to 0.<br />

When the password sent does not correspond (in size and/or content) to the expected<br />

863/1416 Doc ID 018909 Rev 3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!