GD32W51x User Manual
794
23.6.2.
No data commands
To send any non-data command, the software needs to program the SDIO_CMDCTL register
and the SDIO_CMDAGMT register with appropriate parameters. Using these two registers,
the host forms the command and sends it to the command bus. The host reflects the errors
in the command response through the error bits of the SDIO_STAT register.
When a response is received the host sets the CMDRECV (CRC check passed) or
CCRCERR(CRC check error) bit in the SDIO_STAT register. A short response is copied in
SDIO_RESP0, while a long response is copied to all four response registers. The
SDIO_RESP3 bit 31 represents the MSB, and the SDIO_RESP0 bit 0 represents the LSB of
a long response.
23.6.3.
Single block or multiple block write
During block write (CMD24 - 27) one or more blocks of data are transferred from the host to
the card. The block consists of start bits(1 or 4 bits LOW), data block, CRC and end bits(1 or
4 bits HIGH). If the CRC fails, the card indicates the failure on the SDIO_D line and the
transferred data are discarded and not written, and all further transmitted blocks are ignored.
If the host uses partial blocks whose accumulated length is not block aligned, 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 shall set the ADDRESS_ERROR error bit in the status register, and while ignoring all
further data transfer. The write operation will also be aborted if the host tries to write data on
a write protected area. In this case, however, the card will set the WP_VIOLATION bit (in the
status register).
Programming of the CID and CSD registers does not require a previous block length setting.
The transferred data is also CRC protected. If a part of the CSD or CID register is stored in
ROM, then this unchangeable part must match the corresponding part of the receive buffer.
If this match fails, then the card reports an error and does not change any register contents.
Some cards may require long and unpredictable time to write a block of data. After receiving
a block of data and completing the CRC check, the card will begin writing and hold t he D0
line low if its write buffer is full and unable to accept new data from a new WRITE_BLOCK
command. The host may poll the status of the card with a SEND_STATUS command (CMD13)
at any time, and the card will respond with its status. The status bit READY_FOR_DATA
indicates whether the card can accept new data or whether the write process is still in
progress). The host may deselect the card by issuing CMD7 (to select a different card) which
will displace the card into the Disconnect State and release the D line without interrupting the
write operation. When reselecting the card, it will reactivate busy indication by pulling D to low
if programming is still in progress and the write buffer is unavailable.
For SD card. Setting a number of write blocks to be pre-erased (ACMD23) will make a
following Multiple Block Write operation faster compared to the same operation without