
GD32F403xx User Manual
533
1. Check if the card is connected.
2. Identify the card type; SD, MMC(CE-ATA), or SD I/O.
– Send CMD5 first. If a response is received, then the card is SD I/O
– If not, send ACMD41; if a response is received, then the card is SD.
– Otherwise, the card is an MMC or CE-ATA.
3. Initialization the card according to the card type.
Use a clock source with a frequency = F
OD
(that is, 400 KHz) and use the following command
sequence:
– SD card - Send CMD0, ACMD41, CMD2, CMD3.
– SDHC card - send CMD0, CMD8, ACMD41, CMD2, CMD3.
– SD I/O - Send CMD52, CMD0, CMD5, if the card doesn’t have memory port, send CMD3;
otherwise send ACMD41, CMD11 (optional), CMD2, and CMD3.
– MMC/CE-ATA - Send CMD0, CMD1, CMD2, CMD3.
4. Identify the MMC/CE-ATA device.
– CPU should query the byte 504 (S_CMD_SET) of EXT_CSD register by sending CMD8. If
bit 4 is set to 1, then the device supports ATA mode.
– If ATA mode is supported, the CPU should select the ATA mode by setting the ATA bit (bit 4)
in the EXT_CSD register slice 191(CMD_SET) to activate the ATA command set. The CPU
selects the command set using the SWITCH (CMD6) command.
– In the presence of a CE-ATA device, the FAST_IO (CMD39) and
RW_MULTIPLE_REGISTER (CMD60) commands will succeed and the returned data will be
the CE-ATA reset signature.
20.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.