GD32W51x User Manual
766
SDIO_FIFO register address. Configure DMA1 _Channel3 or DMA1 _Channel6 Peripheral4
control register (memory with increment transfer, peripheral with not increment transfer,
peripheral and memory data size is word size). Program the incremental burst transfer to 4
on peripheral side in DMA1 _Channel 3 or DMA1 _Channel 6 Peripheral4.
5. Write block to card as follows:
Write the data size in bytes in the SDIO_DATALEN register. Write the block size in bytes
(BLKSZ) in the SDIO_DATACTL register; the host sends data in blocks of size BLKSZ each.
Program SDIO_CMDAGMT register with the data address, where data should be written.
Program the SDIO command control register (SDIO_CMDCTL): CMDIDX with 24, CMDRESP
with 1 (SDIO card host waits for a short response); CSMEN with
‘
1
’
(enable to send a
command). Other fields are their reset value.
When the CMDRECV flag is set, program the SDIO data control register (SDIO_DATACTL):
DATAEN with 1 (enable to send data); DATADIR with 0 (from controller to card); TRANSMOD
with 0 (block data transfer); DMAEN with 1 (DMA enabled); BLKSZ with 0x9 (512 bytes).
Other bits don
’
t care.
Wait for DTBLKEND flag is set. Check that no channels are still enabled by polling the DMA
Interrupt Flag register.
It consists the following subunits:
Register unit
The register unit which contains all system registers generates the signals to control the
communication between the controller and card.
Data FIFO
The data FIFO unit has a data buffer, uses as transmit and receive FIFO. The FIFO contains
a 32-bit wide, 32-word deep data buffer. The transmit FIFO is used when write data to card
and TXRUN in SDIO_STAT register is 1. The data to be transferred is written to transmit FIFO
by APB2 bus, the data unit in SDIO adapter read data from transmit FIFO, and then send the
data to card. The receive FIFO is used when read data from card and RXRUN in SDIO_STAT
register is 1. The data to be transferred is read from the card and then write to receive FIFO.
The data in receive FIFO is read to APB2 bus when needed. This unit also generates FIFO
flags in SDIO_STAT registers.
23.5.
Card functional description
23.5.1.
Card registers
Within the card interface registers are defined: OCR, CID, CSD, EXT_CSD, RCA, DSR and
SCR. These can be accessed only by corresponding commands. The OCR, CID, CSD and