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.

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

RM0008<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, <strong>and</strong> 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) <strong>and</strong> the password (PWD) itself. The LOCK_UNLOCK bit is ignored.<br />

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

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

password, the LOCK_UNLOCK_FAILED error bit is set in the card status register, <strong>and</strong><br />

the password is not changed.<br />

Locking a card<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 (byte 0 in Table 141), the 8-bit PWD_LEN, <strong>and</strong> the number of bytes of<br />

the current 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 (LOCK_UNLOCK = 1), the<br />

length (PWD_LEN), <strong>and</strong> the password (PWD) itself.<br />

4. When the password is matched, the card is locked <strong>and</strong> the CARD_IS_LOCKED status<br />

bit is set in the card status register. When the password sent does not correspond (in<br />

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

is set in the card status register, <strong>and</strong> the lock fails.<br />

It is possible to set the password <strong>and</strong> to lock the card in the same sequence. In this case,<br />

the SDIO card host module performs all the required steps for setting the password (see<br />

Setting the password on page 477), however it is necessary to set the LOCK_UNLOCK bit<br />

in Step 3 when the new password comm<strong>and</strong> is sent.<br />

When the password is previously set (PWD_LEN is not 0), the card is locked automatically<br />

after power on reset. An attempt to lock a locked card or to lock a card that does not have a<br />

password fails <strong>and</strong> the LOCK_UNLOCK_FAILED error bit is set in the card status register.<br />

Unlocking the card<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<br />

cardlock/unlock mode (byte 0 in Table 141), the 8-bit PWD_LEN, <strong>and</strong> the number of<br />

bytes of the current 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 (LOCK_UNLOCK = 0), the<br />

length (PWD_LEN), <strong>and</strong> the password (PWD) itself.<br />

4. When the password is matched, the card is unlocked <strong>and</strong> the CARD_IS_LOCKED<br />

status bit is cleared in the card status register. When the password sent is not correct in<br />

size <strong>and</strong>/or content <strong>and</strong> does not correspond to the expected password, the<br />

LOCK_UNLOCK_FAILED error bit is set in the card status register, <strong>and</strong> the card<br />

remains locked.<br />

478/995 Doc ID 13902 Rev 9

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

Saved successfully!

Ooh no, something went wrong!