![ARTERY AT32F435 Series Скачать руководство пользователя страница 553](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592553.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 553
Rev 2.03
4.
When the old password is matched, the new password and its size are saved into the PWD
and PWD_LEN fields, respectively. When the old password sent is not correct (in size and/or
content), the LOCK_UNLOCK_FAILED error bit is set in the SDIO_STS register, and the old
password is not changed. When the old password sent is correct (in size and content), the
given new password and its size will be saved in the PWD and the PWD_LEN registers,
respectively.
The password length field (PWD_LEN) indicates whether a password is currently set or not. When the
field is a zero value, it means that a password is not set currently. When the field is nonzero, it means
that a password is set and the card locks itself after power-up. It is possible to lock the card immediately
in the current power session by setting the LOCK_UNLOCK bit or sending an additional card lock
command.
Clearing the password
1.
Select a card using CMD7 (SELECT/DESELECT_CARD), if none is selected previously.
2.
Define the block length with CMD16(SET_BLOCKLEN) to send in the 8-bit card lock/unlock
mode, 8-bit PWD_LEN, and the number of bytes of the new password.
3.
Send CMD42(LOCK/UNLOCK) with the appropriate data block size on the data line including
the 16-bit CRC. The data block indicates the operation mode (SET_PWD=1), the length
(PWD_LEN) and the password (PWD). When a password is matched, the PWD field is
cleared and PWD_LEN is set to 0. If the password sent does not correspond to the expected
password (in size and/or content), the LOCK_UNLOCK_FAILED error bit is set in the
SDIO_STS register, and the password is not changed.
Locking a card
1.
Select a card using CMD7 (SELECT/DESELECT_CARD), if none is selected previously.
2.
Define the block length with CMD16(SET_BLOCKLEN) to send in the 8-bit card lock/unlock
mode, 8-bit PWD_LEN, and the number of bytes of the new password.
3.
Send CMD42(LOCK/UNLOCK) with the appropriate data block size on the data line including
the 16-bit CRC. The data block indicates the operation mode (SET_PWD=1), the length
(PWD_LEN) and the password (PWD).
4.
When a password is matched, the card is locked and CARD_IS_LOCKED is set in the
SDIO_STS register. If the password sent does not correspond to the expected password (in
size and/or content), the LOCK_UNLOCK_FAILED error bit is set in the SDIO_STS register,
and the lock fails.
If the password is previously set (PWD_LEN is not 0), the card is locked automatically after power-on
reset. An attempt to lock a locked card or to lock a card that does not have a password fails and the
LOCK_UNLOCK_FAILED error bit is set in the SDIO_STS register.
Unlocking a card
1.
Select a card using CMD7 (SELECT/DESELECT_CARD), if none is selected previously
2.
Define the block length with CMD16(SET_BLOCKLEN) to send in the 8-bit card lock/unlock
mode, 8-bit PWD_LEN, and the number of bytes of the new password.
3.
Send CMD42(LOCK/UNLOCK) with the appropriate data block size on the data line including
the 16-bit CRC. The data block indicates the operation mode (SET_PWD=1), the length
(PWD_LEN) and the password (PWD).
4.
When a password is matched, the card is unlocked and CARD_IS_LOCKED is cleared in
the SDIO_STS register. If the password sent does not correspond to the expected password
(in size and/or content), the LOCK_UNLOCK_FAILED error bit is set in the SDIO_STS
register, and the lock remains locked.
The unlocking function is valid only for the current power session. The card is locked automatically on
the next power-up as long as the PWD field is not cleared.
An attempt to unlock an unlocked card fails and the LOCK_UNLOCK_FAILED error bit is set in the
SDIO_STS register.