![ARTERY AT32F435 Series Reference Manual Download Page 681](http://html1.mh-extra.com/html/artery/at32f435-series/at32f435-series_reference-manual_2977592681.webp)
AT32F435/437
Series Reference Manual
2022.11.11
Page 681
Rev 2.03
29.3.8 2D transfer mechanism
The 2-dimensional (2D) transfer mechanism makes it easier to block data like images. The DMA
controller offers four types of configurations for 2D transfers.
XCOUNT bit in DMA_Sx2DCNT: Data count to be transmitted before jumping to the next stride
YCOUTNT bit in DMA_Sx2DCNT: Iteration count
SRCSTD bit in DMA_Sx2DSTRIDE: Source stride value. This value should be added or
subtracted before source iteration
DSTSTD bit in DMA_Sx2DSTRIDE: Destination stride value. This value should be added or
subtracted before destination iteration.
Example of a 2D transfer:
Source stride
(byte address)
Destination stride
(byte address)
XCNT
YCNT
0x20
0x10
0x4
0x8
As shown in Figure 29-9, the user can read 2D-block data from the source memory. The XCOUNT is a
4-beat data (4 beat means four words=16 bytes) that is read by DMA before iteration. After reading data
from the word address 0x0 to 0x3 (byte address from 0x0 to 0xF), the next read address is the source
address plus source stride (0x0 + 0x20 = 0x20 byte address=0x8 word address). Therefore, the DMA
can perform the second iteration and read four data beats from the slave word address 0x8, 0x9, 0xA
and 0xB (byte address ranging from 0x20 to 0x2F). The YCOUTNT bit has up to 8 iterations, which is
equal to 0x8. When both the YCOUTNT and XCOUNT bits become 0, it indicates that a total of 32-word
data (8 iterations *4 beats) have been read from the source memory.
Figure 29-9 Example of a 2D transfer (source side is managed by a peripheral controller)
0
1
2
3
8
9
A
B
10
11
12
13
18
19
1A
1B
20
21
22
23
28
29
2A
2B
30
31
32
33
38
39
3A
3B
4
5
6
7
C
D
E
F
14
15
16
17
1C
1D
1E
1F
24
25
26
27
2C
2D
2E
2F
34
35
36
37
3C
3D
3E
3F
data
no data
XCOUNT = 4 beats
YCOUNT =
iterate 8 times
Source Stride
= +20 bytes
= +8 words
+8
+8
+8
+8
+8
word address
Figure 29-10 shows how to load data in source memory to destination memory. The only difference
between them is the stride value. After the DMA writes 4-word data from 0x0 to 0x3, the next write address
is the destination address plus the destination stride (0x0 + 0x10= 0x10 byte address = 0x4 word address).
Then the DMA controller can continue a second iteration to write four beats in the word address ranging
from 0x4 to 0x7 (byte address from 0x10 to 0x1F). When both the YCOTNT and XCOUTNT become zero,
it indicates that all 32-word data (8 iterations*4 beats) have been written to the destination memory.