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 />

1. The bus is activated.<br />

2. The SDIO card host sends IO_SEND_OP_COND (CMD5).<br />

3. The cards respond with the contents of their operation condition registers.<br />

4. The incompatible cards are set to the inactive state.<br />

5. The SDIO card host issues SET_RELATIVE_ADDR (CMD3) to an active card with an<br />

address. This new address is called the relative card address (RCA); it is shorter than<br />

the CID <strong>and</strong> addresses the card. The assigned card changes to the St<strong>and</strong>by state. The<br />

SDIO card host can reissue this comm<strong>and</strong> to change the RCA. The RCA of the card is<br />

the last assigned value.<br />

20.4.5 Block write<br />

During block write (CMD24 - 27) one or more blocks of data are transferred from the host to<br />

the card with a CRC appended to the end of each block by the host. A card supporting block<br />

write is always able to accept a block of data defined by WRITE_BL_LEN. If the CRC fails,<br />

the card indicates the failure on the SDIO_D line <strong>and</strong> the transferred data are discarded <strong>and</strong><br />

not written, <strong>and</strong> all further transmitted blocks (in multiple block write mode) are ignored.<br />

If the host uses partial blocks whose accumulated length is not block aligned <strong>and</strong>, block<br />

misalignment is not allowed (CSD parameter WRITE_BLK_MISALIGN is not set), the card<br />

will detect the block misalignment error before the beginning of the first misaligned block.<br />

(ADDRESS_ERROR error bit is set in the status register). The write operation will also be<br />

aborted if the host tries to write over a write-protected area. In this case, however, the card<br />

will set the WP_VIOLATION bit.<br />

Programming of the CID <strong>and</strong> CSD registers does not require a previous block length setting.<br />

The transferred data is also CRC protected. If a part of the CSD or CID register is stored in<br />

ROM, then this unchangeable part must match the corresponding part of the receive buffer.<br />

If this match fails, then the card reports an error <strong>and</strong> does not change any register contents.<br />

Some cards may require long <strong>and</strong> unpredictable times to write a block of data. After<br />

receiving a block of data <strong>and</strong> completing the CRC check, the card begins writing <strong>and</strong> holds<br />

the SDIO_D line low if its write buffer is full <strong>and</strong> unable to accept new data from a new<br />

WRITE_BLOCK comm<strong>and</strong>. The host may poll the status of the card with a SEND_STATUS<br />

comm<strong>and</strong> (CMD13) at any time, <strong>and</strong> the card will respond with its status. The<br />

READY_FOR_DATA status bit indicates whether the card can accept new data or whether<br />

the write process is still in progress. The host may deselect the card by issuing CMD7 (to<br />

select a different card), which will place the card in the Disconnect state <strong>and</strong> release the<br />

SDIO_D line(s) without interrupting the write operation. When reselecting the card, it will<br />

reactivate busy indication by pulling SDIO_D to low if programming is still in progress <strong>and</strong><br />

the write buffer is unavailable.<br />

20.4.6 Block read<br />

In Block read mode the basic unit of data transfer is a block whose maximum size is defined<br />

in the CSD (READ_BL_LEN). If READ_BL_PARTIAL is set, smaller blocks whose start <strong>and</strong><br />

end addresses are entirely contained within one physical block (as defined by<br />

READ_BL_LEN) may also be transmitted. A CRC is appended to the end of each block,<br />

ensuring data transfer integrity. CMD17 (READ_SINGLE_BLOCK) initiates a block read <strong>and</strong><br />

after completing the transfer, the card returns to the Transfer state.<br />

CMD18 (READ_MULTIPLE_BLOCK) starts a transfer of several consecutive blocks.<br />

Doc ID 13902 Rev 9 473/995

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

Saved successfully!

Ooh no, something went wrong!