29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

RM0008<br />

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

the card must be selected before using it. The card lock/unlock comm<strong>and</strong>s have the<br />

structure <strong>and</strong> bus transaction types of a regular single-block write comm<strong>and</strong>. The<br />

transferred data block includes all of the required information for the comm<strong>and</strong> (the<br />

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

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

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

The bit settings are as follows:<br />

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

comm<strong>and</strong> 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 />

●<br />

●<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 comm<strong>and</strong>)<br />

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

card, <strong>and</strong> 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, <strong>and</strong> 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 <strong>and</strong> the new passwords are sent with the comm<strong>and</strong>.<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), <strong>and</strong> the password (PWD) itself. When a password replacement is<br />

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

the new one, <strong>and</strong> 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 <strong>and</strong> its size are saved into the PWD<br />

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

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

bit is set in the card status register, <strong>and</strong> 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 <strong>and</strong> 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 comm<strong>and</strong> for card<br />

locking.<br />

Doc ID 13902 Rev 9 477/995

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

Saved successfully!

Ooh no, something went wrong!