![ARTERY AT32F435 Series Reference Manual Download Page 551](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592551.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 551
Rev 2.03
Data blocks will keep transferring until the host sends CMD12(STOP_TRANSMISSION). The stop
command has an execution delay due to the serial command transmission and the data transfers stops
after the end bit of the stop command.
Data block write
During block write (CMD24-27), one or more blocks of data are transferred from the host to the card with
a CRC appended to the end of each block. If the CRC failed, the card indicates a failure on the SDIO_D
signal line and the transferred data are discarded and not written, and all transmitted data blocks are
ignored.
If the host uses partial blocks with accumulated length is not block aligned, and block misalignment is
not allowed (CSD parameter WRITE_BLK_MISALIGN is not set), the card will detect the block
misalignment error before the beginning of the first misaligned block. The card sets the
ADDRESS_ERROR bit in the SDIO_STS register and waits the stop command in a receive state while
ignoring all further data transfer. If the host attempts to perform write operation on a write-protected area,
the write operation will be aborted. In this case, however, the card should set the WP_VIOLATION bit.
Programming of the CID and CSD registers does not require a block length setting in advance. The
transferred data is also CRC protected. If a part of the CSD or CID register is stored in the ROM, then
the unchangeable part must match the corresponding part of the receive buffer. If this match failed, then
the card will report an error and does not change any register contents. Some cards may require long
and unpredictable times to write a block of data. After receiving a block of data and completing the CRC
check, the card begins writing and holds the SDIO_D signal line low if its write buffer is full and unable
to accept new data from a new WRITE_BLOCK command. The host can check the status of the card
with SEND_STATUS command (CMD13) at any time, and the card will respond with its status.
The READY_FOR_DATA status bit indicates whether the car can accept new data or whether the write
process in still in progress. The host can deselect the card by issuing CMD7 (select another card), which
will place the card in the disconnect state and release the SDIO_D line without interrupting the write
operation. When reselecting the card, it will reactivate busy indication by pulling SDIO_D line to low if
the programming is still in progress and the write buffer is unavailable.
25.3.1.3 Erase
The erasable unit of the MultiMedia card and SD card is the erase group. The erase group is calculated
in write blocks, which are the basic writable units of the card. The size of the erase group is a parameter
specific to the card and defined in the CSD.
The host can erase a contiguous range of erase groups. There are three steps to start the erase process,
but the commands sent by the MultiMedia card and SD card are different.
1.
The host defines the start address of the range using the following command:
―
SD card: issue CMD32 (ERASE_WR_BLK_START)
―
MMC car: issue CMD35 ( ERASE_GROUP_START)
2.
The host defines the end address of the rang using the following command:
―
SD card: issue CMD33 (ERASE_WR_BLK_END)
―
MMD car: issue CMD36 (ERASE_GROUP_END)
3.
The host starts the erase process by sending CMD38 (ERASE)
25.3.1.4 Protection management
Three write protection methods are supported in the SDIO card host module to ensure that the protected
data is not erased or changed.
Mechanical write protect switch
There is a mechanical sliding switch on the side of the card to allow the user to set/clear the write
protection on the card. When the sliding switch is positioned with the window open, the card is write-
protected, and when the window is closed, the card is not write-protected.
Internal card write protection
Card data can be protected against write and erase. The entire card can be permanently write-protected
by the manufacturer or the content provider by setting the permanent or temporary write-protect bits in
the CSD. For cards that support write protection of groups of sectors by setting the WP_GRP_ENABLE