![ARTERY AT32F435 Series Скачать руководство пользователя страница 565](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592565.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 565
Rev 2.03
Busy: The DCSM waits for the CRC flag. If the DCSM receives a correct CRC status and is not
busy, it will enter the Wait_S state. If it does not receive a correct CRC status or a timeout occurs
while the DCSM is in the busy state, a CRC fail flag or timeout flag is generated.
Wait_R: The start bit of the Wait_R. If a timeout occurs before it detects a start bit, the DCSM
moves to the idle state and generates a timeout flag.
Receive: Data is received from a card and written to the BUF. The data transfer mode can be
either block or stream, depending on the SDIO_DTCTRL _TFRMODE bit. If an overflow error occurs,
it then returns to Wait_R state.
Table 25-23
Data token formats
Description
Start bit
Data
CRC16
End bit
Block data
0
-
Y
1
Stream data
0
-
N
1
25.3.3.2 Data BUF
The data BUF contains a transmit and receive unit. It is a 32-bit wide and 32-word deep data buffer.
Because the data BUF operates in the AHB clock domain (HCLK), all signals connected to the SDIO
clock domain (SDIOCLK) are resynchronized.
Transmit BUF: Data can be written to the transmit BUF via the AHB interface when the SDIO
transmission feature is enabled.
The transmit BUF has 32 sequential addresses. It contains a data output register that holds the data
word pointed by the read pointer. When the data path has loaded its shift register, it moves its read
pointer to the next data and outputs data.
If the transmit BUF is disabled, all status flags are inactive. The data path sets the DOTX when it
transmits data.
Receive BUF: When the data path receives a data word, it will write the data to the BUF. The
write pointer is incremented automatically after the end of the write operation. On the other side, a
read pointer always points to the current data in the BUF. If the receive BUF is disabled, all status
flags are cleared, and the read and write pointers are reset as well. The data path sets the DORX
when it receives data.
25.3.3.3 SDIO AHB interface
The AHB interface generates the interrupt and DMA requests, and access the SDIO interface registers
and the data BUF.
SDIO interrupts
The interrupt logic generates an interrupt request when one of the selected status flags is high. The
SDIO_INTEN register is used to select the conditions that will generate an interrupt.
SDIO/DMA interface: data transfer process between the SDIO and memory
In the following examples, data is transferred from the host to the card. The SDIO BUF is filled with data
stored in a memory through the DMA controller.
1.
Card identification process
2.
Increase the SDIO_CK frequency
3.
Select a card by sending CMD7
4.
Enable the DMA2 controller and clear all interrupt flag bits, configure the DMA2 channel4
source address register as the memory buffer’s base address, and the DMA2 channel4
destination address register as the SDIO_BUF register address. Then configure the DMA2
channel4 control register (memory increment, non-peripheral increment, and peripheral and
source data width is word width). Finally enable DMA2 channel4.
5.
Send CMD24 (WRITE_BLOCK) as follows:
Program the SDIO data length register (SDIO_DTLEN), the BLKSIZE bit in the SDIO data
control register (SDIO_DTCTRL), and the SDIO parameter register (SDIO_ARG) with the
address of the card where data is to be transferred, and program the SDIO command register
(SDIO_CMD), enable the CCSMEN bit, wait for SDIO_STS [6]=CMDRSPCMPL interrupt,