16. General purpose direct memory access controller (GPDMA)

16.1 GPDMA introduction

The general purpose direct memory access (GPDMA) controller is a bus master and system peripheral.

The GPDMA is used to perform programmable data transfers between memory-mapped peripherals and/or memories via linked-lists, upon the control of an off-loaded CPU.

16.2 GPDMA main features

16.3 GPDMA implementation

16.3.1 GPDMA instances

There are two instances of the GPDMA in the devices, named as GPDMA1 and GPDMA2.

Each GPDMA instance has the same channel-based implementation and is connected to the same requests and triggers, as detailed in the following sub-sections.

16.3.2 GPDMA channels

A given GPDMA channel x is implemented with the following features and intended usage. To make the best use of the GPDMA performances, the table below lists some general recommendations, allowing the user to select and allocate a channel, given its implemented FIFO size and the requested GPDMA transfer.

Table 126. GPDMA1/2 channel implementation

Channel xHardware parametersFeatures
dma_fifo_size[x]dma_addressing[x]
x = 0 to 720Channel x (x = 0 to 7) is implemented with:
– a FIFO of 8 bytes, 2 words
– fixed/contiguously incremented addressing
These channels must be typically allocated for GPDMA transfers between an APB or AHB peripheral and SRAM.
x = 8 to 940Channel x (x = 8 to 9) is implemented with:
– a FIFO of 32 bytes, 8 words
– fixed/contiguously incremented addressing
– These channels may be used for GPDMA transfers between a demanding AHB peripheral and SRAM, or for transfers from/to external memories.
x = 10 to 1141Channel x (x = 10 to 11) is implemented with:
– a FIFO of 32 bytes, 8 words
– 2D addressing
These channels may be used for GPDMA transfers between a demanding AHB peripheral and SRAM, or for transfers from/to external memories.

16.3.3 GPDMA in low-power modes

The GPDMA wake-up feature is implemented in the device low-power modes as per the table below.

Table 127. GPDMA1/2 wake-up in low-power modes

FeatureLow-power modes
Wake-upGPDMA1/2 in Sleep mode

16.3.4 GPDMA requests

A GPDMA request from a peripheral can be assigned to a GPDMA channel x, via REQSEL[7:0] in GPDMA_CxTR2, provided that SWREQ = 0.

The GPDMA requests mapping is specified in the table below.

Table 128. Programmed GPDMA1/2 request

GPDMA_CxTR2.REQSEL[7:0]Selected GPDMA request
0adc1_dma
1adc2_dma
2dac1_ch1_dma
3dac1_ch2_dma
4tim6_upd_dma

Table 128. Programmed GPDMA1/2 request (continued)

GPDMA_CxTR2.REQSEL[7:0]Selected GPDMA request
5tim7_upd_dma
6spi1_rx_dma
7spi1_tx_dma
8spi2_rx_dma
9spi2_tx_dma
10spi3_rx_dma
11spi3_tx_dma
12i2c1_rx_dma
13i2c1_tx_dma
14Reserved
15i2c2_rx_dma
16i2c2_tx_dma
17Reserved
18i2c3_rx_dma
19i2c3_tx_dma
20Reserved
21usart1_rx_dma
22usart1_tx_dma
23usart2_rx_dma
24usart2_tx_dma
25usart3_rx_dma
26usart3_tx_dma
27uart4_rx_dma
28uart4_tx_dma
29uart5_rx_dma
30uart5_tx_dma
31usart6_rx_dma
32usart6_tx_dma
33uart7_rx_dma
34uart7_tx_dma
35uart8_rx_dma
36uart8_tx_dma
37uart9_rx_dma
38uart9_tx_dma
39uart10_rx_dma

Table 128. Programmed GPDMA1/2 request (continued)

GPDMA_CxTR2.REQSEL[7:0]Selected GPDMA request
40uart10_tx_dma
41uart11_rx_dma
42uart11_tx_dma
43uart12_rx_dma
44uart12_tx_dma
45lpuart1_rx_dma
46lpuart1_tx_dma
47spi4_rx_dma
48spi4_tx_dma
49spi5_rx_dma
50spi5_tx_dma
51spi6_rx_dma
52spi6_tx_dma
53sai1_a_dma
54sai1_b_dma
55sai2_a_dma
56sai2_b_dma
57ospi1_dma
58tim1_cc1_dma
59tim1_cc2_dma
60tim1_cc3_dma
61tim1_cc4_dma
62tim1_upd_dma
63tim1_trg_dma
64tim1_com_dma
65tim8_cc1_dma
66tim8_cc2_dma
67tim8_cc3_dma
68tim8_cc4_dma
69tim8_upd_dma
70tim8_tig_dma
71tim8_com_dma
72tim2_cc1_dma
73tim2_cc2_dma
74tim2_cc3_dma

Table 128. Programmed GPDMA1/2 request (continued)

GPDMA_CxTR2.REQSEL[7:0]Selected GPDMA request
75tim2_cc4_dma
76tim2_upd_dma
77tim3_cc1_dma
78tim3_cc2_dma
79tim3_cc3_dma
80tim3_cc4_dma
81tim3_upd_dma
82tim3_trg_dma
83tim4_cc1_dma
84tim4_cc2_dma
85tim4_cc3_dma
86tim4_cc4_dma
87tim4_upd_dma
88tim5_cc1_dma
89tim5_cc2_dma
90tim5_cc3_dma
91tim5_cc4_dma
92tim5_upd_dma
93tim5_trg_dma
94tim15_cc1_dma
95tim15_upd_dma
96tim15_trg_dma
97tim15_com_dma
98tim16_cc1_dma
99tim16_upd_dma
100tim17_cc1_dma
101tim17_upd_dma
102lptim1_ic1_dma
103lptim1_ic2_dma
104lptim1_ue_dma
105lptim2_ic1_dma
106lptim2_ic2_dma
107lptim2_ue_dma
108dcmi_dma or pssi_dma(1)
109aes_out_dma

Table 128. Programmed GPDMA1/2 request (continued)

GPDMA_CxTR2.REQSEL[7:0]Selected GPDMA request
110aes_in_dma
111hash_in_dma
112ucpd1_rx_dma
113ucpd1_tx_dma
114cordic_read_dma
115cordic_write_dma
116fmac_read_dma
117fmac_write_dma
118saes_out_dma
119saes_in_dma
120i3c1_rx_dma
121i3c1_tx_dma
122i3c1_tc_dma
123i3c1_rs_dma
124i2c4_rx_dma
125i2c4_tx_dma
126Reserved
127lptim3_ic1_dma
128lptim3_ic2_dma
129lptim3_ue_dma
130lptim5_ic1_dma
131lptim5_ic2_dma
132lptim5_ue_dma
133lptim6_ic1_dma
134lptim6_ic2_dma
135lptim6_ue_dma
136i3c2_rx_dma
137i3c2_tx_dma
138i3c2_tc_dma
139i3c2_rs_dma
140jpeg_rx_dma
141jpeg_tx_dma
142adc3_dma
143ospi2_dma
144mdf1_flt0_dma
Table 128. Programmed GPDMA1/2 request (continued)
GPDMA_CxTR2.REQSEL[7:0]Selected GPDMA request
145mdf1_flt1_dma
146mdf1_flt2_dma
147mdf1_flt3_dma
148mdf1_flt4_dma
149mdf1_flt5_dma
150adf1_flt0_dma

1. Depends on which exclusive function is used.

16.3.5 GPDMA block requests

Some GPDMA requests must be programmed as a block request, and not as a burst request. Then BREQ in GPDMA_CxTR2 must be set for a correct GPDMA execution of the requested peripheral transfer at the hardware level.

Table 129. Programmed GPDMA1/2 request as a block request
GPDMA block requests
lptim1_ue_dma
lptim2_ue_dma
lptim3_ue_dma
lptim5_ue_dma
lptim6_ue_dma

16.3.6 GPDMA channels with peripheral early termination

A GPDMA channel, if implemented with this feature, can support the early termination of the data transfer from the peripheral which does also support this feature.

Table 130. GPDMA1/2 channel with peripheral early termination
GPDMA channel x with peripheral early termination
x = 0, x = 1 and x = 11

This GPDMA support is activated when the channel x is programmed with GPDMA_CxTR2.PFREQ = 1. Then, the peripheral itself can initiate and request a data transfer completion, before the GPDMA has transferred the whole block (see Section 16.4.14 for more details).

Table 131. Programmed GPDMA1/2 request with peripheral early termination
Programmed GPDMA channel x request with peripheral early termination
i3c1_rx_dma

Table 131. Programmed GPDMA1/2 request with peripheral early termination

Programmed GPDMA channel x request with peripheral early termination
i3c2_rx_dma
jpeg_tx_dma

16.3.7 GPDMA triggers

A GPDMA trigger can be assigned to a GPDMA channel x, via TRIGSEL[6:0] in GPDMA_CxTR2, provided that TRIGPOL[1:0] defines a rising or a falling edge of the selected trigger (TRIGPOL[1:0] = 01 or TRIGPOL[1:0] = 10).

Table 132. Programmed GPDMA1/2 trigger

GPDMA_CxTR2.TRIGSEL[5:0]Selected GPDMA trigger
0exti0
1exti1
2exti2
3exti3
4exti4
5exti5
6exti6
7exti7
8tamp_trg1
9tamp_trg2
10tamp_trg3
11lptim1_ch1
12lptim1_ch2
13lptim2_ch1
14lptim2_ch2
15rtc_alra_trg
16rtc_alrb_trg
17rtc_wut_trg
18gpdma1_ch0_tc
19gpdma1_ch1_tc
20gpdma1_ch2_tc
21gpdma1_ch3_tc
22gpdma1_ch4_tc
23gpdma1_ch5_tc
24gpdma1_ch6_tc
25gpdma1_ch7_tc

Table 132. Programmed GPDMA1/2 trigger (continued)

GPDMA_CxTR2.TRIGSEL[5:0]Selected GPDMA trigger
26gpdma2_ch0_tc
27gpdma2_ch1_tc
28gpdma2_ch2_tc
29gpdma2_ch3_tc
30gpdma2_ch4_tc
31gpdma2_ch5_tc
32gpdma2_ch6_tc
33gpdma2_ch7_tc
34tim2_trgo
35tim15_trgo
36tim12_trgo
37lptim3_ch1
38lptim3_ch2
39lptim4_ait
40lptim5_ch1
41lptim5_ch2
42lptim6_ch1
43lptim6_ch2
44comp1_out
45eventout
46comp2_out
47dma2d_tc
48dma2d_ctc
49dma2d_tw
50dma2d_gpflags0
51dma2d_gpflags1
52dma2d_gpflags2
53dma2d_gpflags3
54jpeg_ift_trg
55jpeg_ifnf_trg
56jpeg_ofn_trg
57jpeg_ofne_trg
58jpeg_eoc_trg
59gfxtim_ev1
60gfxtim_ev2

Table 132. Programmed GPDMA1/2 trigger (continued)

GPDMA_CxTR2.TRIGSEL[5:0]Selected GPDMA trigger
61gfxtim_ev3
62gfxtim_ev4
63lcd_ctrl_scanline
64gpdma1_ch8_tc
65gpdma1_ch9_tc
66gpdma1_ch10_tc
67gpdma1_ch11_tc
68gpdma2_ch8_tc
69gpdma2_ch9_tc
70gpdma2_ch10_tc
71gpdma2_ch11_tc
72play1_out15

16.4 GPDMA functional description

16.4.1 GPDMA block diagram

Figure 70. GPDMA block diagram Figure 70: GPDMA block diagram. The diagram shows the internal architecture of the GPDMA controller. On the left, inputs include DMA requests, DMA triggers, DMA clock, and Stop DMA channel in debug mode. The main GPDMA block contains: 1) Channel datapath and transfer input control with channels 0, 1, ..., x^(1); 2) Arbitration; 3) Transfer output control with Data transfer generation and Link transfer generation; 4) AHB master port 0 and 1 interfaces connecting to 32-bit AHB buses; 5) DMA channel registers and DMA global registers under the AHB slave interface; 6) Control blocks for Interrupt generation, Events generation, Channel state management, Security and privilege management, and Clock management. On the right, outputs include DMA channel interrupt, DMA channel transfer complete (gpdma_chx_tc), DMA channel state (vs privilege and security), DMA illegal event (vs security), and DMA clock request. A 32-bit AHB bus is at the bottom. A note (1) refers to the device implementation table for the number of channels. The version number MSv63644V2 is at the bottom right.
Figure 70: GPDMA block diagram. The diagram shows the internal architecture of the GPDMA controller. On the left, inputs include DMA requests, DMA triggers, DMA clock, and Stop DMA channel in debug mode. The main GPDMA block contains: 1) Channel datapath and transfer input control with channels 0, 1, ..., x^(1); 2) Arbitration; 3) Transfer output control with Data transfer generation and Link transfer generation; 4) AHB master port 0 and 1 interfaces connecting to 32-bit AHB buses; 5) DMA channel registers and DMA global registers under the AHB slave interface; 6) Control blocks for Interrupt generation, Events generation, Channel state management, Security and privilege management, and Clock management. On the right, outputs include DMA channel interrupt, DMA channel transfer complete (gpdma_chx_tc), DMA channel state (vs privilege and security), DMA illegal event (vs security), and DMA clock request. A 32-bit AHB bus is at the bottom. A note (1) refers to the device implementation table for the number of channels. The version number MSv63644V2 is at the bottom right.

16.4.2 GPDMA channel state and direct programming without any linked-list

After a GPDMA reset, a GPDMA channel x is in idle state. When the software writes 1 in GPDMA_CxCR.EN, the channel takes into account the value of the different channel configuration registers (GPDMA_CxXXX), switches to the active/non-idle state and starts to execute the corresponding requested data transfers.

After enabling/starting a GPDMA channel transfer by writing 1 in GPDMA_CxCR.EN, a GPDMA channel interrupt on a complete transfer notifies the software that the GPDMA channel is back in idle state (EN is then deasserted by hardware) and that the channel is ready to be reconfigured then enabled again.

Figure 71 illustrates this GPDMA direct programming without any linked-list (GPDMA_CxLLR = 0).

Figure 71. GPDMA channel direct programming without linked-list (GPDMA_CxLLR = 0)

Flowchart of GPDMA channel direct programming without linked-list (GPDMA_CxLLR = 0).
graph TD
    subgraph IdleState [Channel state = Idle]
        Init[Initialize DMA channel
(keeping DMA_CxLLR[31:0] = 0)] Reconfig[Reconfigure DMA channel
(keeping DMA_CxLLR[31:0] = 0)] Enable[Enable DMA channel] end subgraph ActiveState [Channel state = Active] ValidUser{Valid user
setting ?} Execute[Executing the data transfer
from the register file] NoError{No transfer
error ?} SetTCF[Setting TCF = 1
Disabling DMA channel] SetDTEF[Setting DTEF = 1
Disabling DMA channel] SetUSEF[Setting USEF = 1
Disabling DMA channel] end End{End} Init --> Enable Reconfig --> Enable Enable --> ActiveState ActiveState --> ValidUser ValidUser -- Y --> Execute Execute --> NoError NoError -- Y --> SetTCF NoError -- N --> SetDTEF ValidUser -- N --> SetUSEF SetTCF --> End SetDTEF --> End SetUSEF --> End

The flowchart illustrates the GPDMA channel direct programming process when GPDMA_CxLLR = 0. It starts in the 'Channel state = Idle' state, where the channel is initialized or reconfigured (keeping DMA_CxLLR[31:0] = 0) and then enabled. Once enabled, the channel enters the 'Channel state = Active' state. In this state, the system checks for a valid user setting. If the setting is invalid (N), it sets USEF = 1 and disables the channel. If valid (Y), it executes the data transfer from the register file. After execution, it checks for transfer errors. If an error occurs (N), it sets DTEF = 1 and disables the channel. If no error (Y), it sets TCF = 1 and disables the channel. All paths from the active state lead to the 'End' state.

MSv62626V1

Flowchart of GPDMA channel direct programming without linked-list (GPDMA_CxLLR = 0).

16.4.3 GPDMA channel suspend and resume

The software can suspend on its own a channel still active, with the following sequence:

  1. 1. The software writes 1 into the GPDMA_CxCR.SUSP bit.
  2. 2. The software polls the suspended flag GPDMA_CxSR.SUSPF until SUSPF = 1, or waits for an interrupt previously enabled by writing 1 to GPDMA_CxCR.SUSPIE. Wait for the channel to be effectively in suspended state means wait for the completion of any ongoing GPDMA transfer over its master ports. Then the software can observe, in a steady state, any read register or register field that is hardware modifiable.

Note: An ongoing GPDMA transfer can be a data transfer (a source/destination burst transfer) or a link transfer for the internal update of the linked-list register file from the next linked-list item.

  1. The software safely resumes the suspended channel by writing 0 to GPDMA_CxCR.SUSP.

Figure 72. GPDMA channel suspend and resume sequence

Flowchart showing the GPDMA channel suspend and resume sequence. It starts with 'Channel state = Active', followed by 'Suspend the DMA channel (write 1 to CxCR.SUSP)'. An 'or' branch leads to a decision 'SUSPF=1?'. If 'N', it loops back to the suspend step. If 'Y', it proceeds to 'Channel state = Suspended and Idle', then 'Receiving suspended interrupt', and finally 'Resume the DMA channel (write 0 to CxCR.SUSP)', leading back to 'Channel state = Active'. The diagram is labeled MSv62627V1.
graph TD
    Start(( )) --> Active1[Channel state = Active]
    Active1 --> Suspend[Suspend the DMA channel
(write 1 to CxCR.SUSP)] Suspend -- or --> Decision{SUSPF=1?} Decision -- N --> Suspend Decision -- Y --> Suspended[Channel state = Suspended and Idle] Suspended --> Interrupt[Receiving suspended interrupt] Interrupt --> Resume[Resume the DMA channel
(write 0 to CxCR.SUSP)] Resume --> Active2[Channel state = Active] Active2 --> End(( ))

MSv62627V1

Flowchart showing the GPDMA channel suspend and resume sequence. It starts with 'Channel state = Active', followed by 'Suspend the DMA channel (write 1 to CxCR.SUSP)'. An 'or' branch leads to a decision 'SUSPF=1?'. If 'N', it loops back to the suspend step. If 'Y', it proceeds to 'Channel state = Suspended and Idle', then 'Receiving suspended interrupt', and finally 'Resume the DMA channel (write 0 to CxCR.SUSP)', leading back to 'Channel state = Active'. The diagram is labeled MSv62627V1.

Note: A suspend and resume sequence does not impact the GPDMA_CxCR.EN bit. Suspending a channel (transfer) does not suspend a started trigger detection.

16.4.4 GPDMA channel abort and restart

Alternatively, like for aborting a continuous GPDMA transfer with a circular buffering or a double buffering, the software can abort, on its own, a still active channel with the following sequence:

  1. The software writes 1 into the GPDMA_CxCR.SUSP bit.
  2. The software polls suspended flag GPDMA_CxSR.SUSPF until SUSPF = 1, or waits for an interrupt previously enabled by writing 1 to GPDMA_CxCR.SUSPIE. Wait for the channel to be effectively in suspended state means wait for the completion of any ongoing GPDMA transfer over its master port.
  3. The software resets the channel by writing 1 to GPDMA_CxCR.RESET. This causes the reset of the FIFO, the reset of the channel internal state, the reset of the GPDMA_CxCR.EN bit, and the reset of the GPDMA_CxCR.SUSP bit.
  4. The software safely reconfigures the channel. The software must reprogram the hardware-modified GPDMA_CxBR1, GPDMA_CxSAR, and GPDMA_CxDAR registers.
  5. In order to restart the aborted then reprogrammed channel, the software enables it again by writing 1 to the GPDMA_CxCR.EN bit.

Figure 73. GPDMA channel abort and restart sequence

Flowchart of GPDMA channel abort and restart sequence. The process starts with 'Channel state = Active'. It branches into two paths: 'Suspend the DMA channel (write 1 to CxCR.SUSP)' or a decision 'SUSPF=1?'. If 'SUSPF=1?' is 'N', it loops back to the suspension step. If 'Y', it proceeds to 'Channel state = Suspended (and Idle)', which includes 'Receiving suspended interrupt'. From there, it goes to 'Reset the DMA channel (write 1 to CxCR.RESET)', then 'Channel state = Idle', followed by 'Reconfigure the DMA channel' and 'Enable the DMA channel', finally returning to 'Channel state = Active'.
graph TD
    Start(( )) --> Active1[Channel state = Active]
    Active1 --> Suspend[Suspend the DMA channel
(write 1 to CxCR.SUSP)] Suspend -- or --> Decision{SUSPF=1 ?} Decision -- N --> Suspend Decision -- Y --> Suspended[Channel state = Suspended
(and Idle)] Suspended --> Interrupt[Receiving suspended
interrupt] Interrupt --> Reset[Reset the DMA channel
(write 1 to CxCR.RESET)] Reset --> Idle[Channel state = Idle] Idle --> Reconfigure[Reconfigure the DMA channel] Reconfigure --> Enable[Enable the DMA channel] Enable --> Active2[Channel state = Active] Active2 --> End(( ))

MSv62628V1

Flowchart of GPDMA channel abort and restart sequence. The process starts with 'Channel state = Active'. It branches into two paths: 'Suspend the DMA channel (write 1 to CxCR.SUSP)' or a decision 'SUSPF=1?'. If 'SUSPF=1?' is 'N', it loops back to the suspension step. If 'Y', it proceeds to 'Channel state = Suspended (and Idle)', which includes 'Receiving suspended interrupt'. From there, it goes to 'Reset the DMA channel (write 1 to CxCR.RESET)', then 'Channel state = Idle', followed by 'Reconfigure the DMA channel' and 'Enable the DMA channel', finally returning to 'Channel state = Active'.

16.4.5 GPDMA linked-list data structure

Alternatively to the direct programming mode, a channel can be programmed by a list of transfers, known as a list of linked-list items (LLI). Each LLI is defined by its data structure.

The base address in memory of the data structure of a next \(LLI_{n+1}\) of a channel x is the sum of the following:

The data structure for each LLI may be specific.

A linked-list data structure is addressed following the value of the following UT1, UT2, UB1, USA, UDA, UT3 and UB2 if present, and ULL bits in GPDMA_CxLLR.

In linked-list mode, each GPDMA linked-list register (GPDMA_CxTR1, GPDMA_CxTR2, GPDMA_CxBR1, GPDMA_CxSAR, GPDMA_CxDAR, GPDMA_CxTR3 and GPDMA_CxBR2 if present, and GPDMA_CxLLR) is conditionally and automatically updated from the next linked-list data structure in the memory, following the current value of the

GPDMA_CxLLR register that was conditionally updated from the linked-list data structure of the previous LLI.

Caution: The user must program the pointer to the next linked-list data structure (GPDMA_CxLLR[15:0]) not to exceed the 64-Kbyte addressable space defined by the link base address register (GPDMA_CxLBAR). The complete linked-list data structure must be included in the 64-Kbyte addressable space.

Static linked-list data structure

For example, when the update bits (UT1, UT2, UB1, USA, UDA, plus UB2 and UT3 if present, and ULL) in GPDMA_CxLLR are all asserted, the linked-list data structure in the memory is maximal with:

Figure 74. Static linked-list data structure (all Uxx = 1)
of a linear addressing channel x

Diagram showing the static linked-list data structure of a linear addressing channel x where all Uxx=1. On the left is the DMA register file with Channel x linked-list register file (LLI0), Channel x other registers, Other channels registers, and Global registers. On the right is Memory from link base address DMA_CxLBAR showing LLI1 and LLI2 blocks.
Diagram showing the static linked-list data structure of a linear addressing channel x where all Uxx=1. On the left is the DMA register file with Channel x linked-list register file (LLI0), Channel x other registers, Other channels registers, and Global registers. On the right is Memory from link base address DMA_CxLBAR showing LLI1 and LLI2 blocks.

MSv62629V1

Figure 75. Static linked-list data structure (all Uxx = 1)
of a 2D addressing channel x

Diagram of static linked-list data structure for a 2D addressing channel x. It shows the DMA register file containing the Channel x linked-list register file (LLI0) with registers DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, DMA_CxTR3, DMA_CxBR2, and DMA_CxLLR. The DMA_CxLLR register points to the first LLI in memory (LLI1) via the DMA_CxLLR register. The memory structure shows LLI1 and LLI2, each containing the same set of registers. Arrows labeled 'All Uxx=1' indicate the link from DMA_CxLLR to LLI1 and from DMA_CxLLR in LLI1 to LLI2.

The diagram illustrates the static linked-list data structure for a 2D addressing channel x. It consists of two main parts: the DMA register file and the memory structure from the link base address (DMA_CxLBAR).

DMA register file: This block contains the Channel x linked-list register file (LLI0), which includes the following registers: DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, DMA_CxTR3, DMA_CxBR2, and DMA_CxLLR. Below this are blocks for Channel x other registers, Other channels registers, and Global registers.

Memory from link base address DMA_CxLBAR: This block contains the linked list of LLI structures. LLI1 and LLI2 are shown, each containing the same set of registers: DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, DMA_CxTR3, DMA_CxBR2, and DMA_CxLLR. An arrow labeled "All Uxx=1" points from the DMA_CxLLR register in the DMA register file to the start of LLI1. Another arrow labeled "All Uxx=1" points from the DMA_CxLLR register in LLI1 to the start of LLI2. A dashed arrow points from the DMA_CxLLR register in LLI2 to the right, indicating the continuation of the list.

MSv63645V1

Diagram of static linked-list data structure for a 2D addressing channel x. It shows the DMA register file containing the Channel x linked-list register file (LLI0) with registers DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, DMA_CxTR3, DMA_CxBR2, and DMA_CxLLR. The DMA_CxLLR register points to the first LLI in memory (LLI1) via the DMA_CxLLR register. The memory structure shows LLI1 and LLI2, each containing the same set of registers. Arrows labeled 'All Uxx=1' indicate the link from DMA_CxLLR to LLI1 and from DMA_CxLLR in LLI1 to LLI2.

Dynamic linked-list data structure

Alternatively, the memory organization for the full list of LLIs can be compacted with specific data structure for each LLI.

If UT1 = 0 and UT2 = 1, the link address offset of the register GPDMA_CxLLR is pointing to the updated value of the GPDMA_CxTR2 instead of the GPDMA_CxTR1 which is not to be modified (see Figure 76).

Example: if UT1 = UB1 = USA = 0 and if UT3 = UB2 = 0, when channel x is with 2D addressing, and if UT2 = UDA = ULL = 1, the next LLI does not contain an (updated) value for GPDMA_CxTR1, nor GPDMA_CxBR1, nor GPDMA_CxSAR, nor GPDMA_CxTR3, nor GPDMA_CxBR2 when channel x is with 2D addressing. The next LLI contains an updated value for GPDMA_CxTR2, GPDMA_CxDAR, and GPDMA_CxLLR, as shown in Figure 77.

Figure 76. GPDMA dynamic linked-list data structure
of a linear addressing channel x

Diagram of Figure 76: GPDMA dynamic linked-list data structure of a linear addressing channel x. Shows LLIn consisting of DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, and DMA_CxLLR. An arrow with text 'All Uxx = 1' points to the first element DMA_CxTR1. From DMA_CxLLR, an arrow points to LLIn+1, labeled with 'UT1 = UB1 = USA = 0' and 'UT2 = UDA = ULL = 1'. LLIn+1 contains DMA_CxTR2, DMA_CxDAR, and DMA_CxLLR. A dashed arrow points from LLIn+1 to subsequent list items. Diagram reference MSv62630V1 is at bottom right.
Diagram of Figure 76: GPDMA dynamic linked-list data structure of a linear addressing channel x. Shows LLIn consisting of DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, and DMA_CxLLR. An arrow with text 'All Uxx = 1' points to the first element DMA_CxTR1. From DMA_CxLLR, an arrow points to LLIn+1, labeled with 'UT1 = UB1 = USA = 0' and 'UT2 = UDA = ULL = 1'. LLIn+1 contains DMA_CxTR2, DMA_CxDAR, and DMA_CxLLR. A dashed arrow points from LLIn+1 to subsequent list items. Diagram reference MSv62630V1 is at bottom right.

MSv62630V1

Figure 77. GPDMA dynamic linked-list data structure
of a 2D addressing channel x

Diagram of Figure 77: GPDMA dynamic linked-list data structure of a 2D addressing channel x. Shows LLIn consisting of DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, DMA_CxTR3, DMA_CxBR2, and DMA_CxLLR. An arrow with text 'All Uxx = 1' points to DMA_CxTR1. From DMA_CxLLR, an arrow points to LLIn+1, labeled with 'UT1 = UB1 = USA = 0', 'UT3 = UB2 = 0', and 'UT2 = UDA = ULL = 1'. LLIn+1 contains DMA_CxTR2, DMA_CxDAR, and DMA_CxLLR. A dashed arrow points from LLIn+1 to subsequent list items. Diagram reference MSv63646V1 is at bottom right.
Diagram of Figure 77: GPDMA dynamic linked-list data structure of a 2D addressing channel x. Shows LLIn consisting of DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, DMA_CxTR3, DMA_CxBR2, and DMA_CxLLR. An arrow with text 'All Uxx = 1' points to DMA_CxTR1. From DMA_CxLLR, an arrow points to LLIn+1, labeled with 'UT1 = UB1 = USA = 0', 'UT3 = UB2 = 0', and 'UT2 = UDA = ULL = 1'. LLIn+1 contains DMA_CxTR2, DMA_CxDAR, and DMA_CxLLR. A dashed arrow points from LLIn+1 to subsequent list items. Diagram reference MSv63646V1 is at bottom right.

MSv63646V1

16.4.6 Linked-list item transfer execution

A LLIn transfer is the sequence of:

  1. 1. a data transfer: GPDMA executes the data transfer as described by the GPDMA internal register file (this data transfer can be void/null for LLI0)
  2. 2. a conditional link transfer: GPDMA automatically and conditionally updates its internal register file by the data structure of the next LLIn+1, as defined by the GPDMA_CxLLR value of the LLIn.

Note: The initial data transfer as defined by the internal register file (LLI0) can be null (GPDMA_CxBR1.BNDT[15:0] = 0 and GPDMA_CxTR2.PFREQ = 0) provided that the conditional update bit UB1 in GPDMA_CxLLR is set (meaning there is a non-null data transfer described by the next LLI1 in the memory to be executed).

Depending on the intended GPDMA usage, a GPDMA channel x can be executed as described by the full linked-list (run-to-completion mode, GPDMA_CxCR.LSM = 0) or a GPDMA channel x can be programmed for a single execution of a LLI (link step mode, GPDMA_CxCR.LSM = 1), as described in the next sections.

16.4.7 GPDMA channel state and linked-list programming
in run-to-completion mode

When GPDMA_CxCR.LSM = 0 (in full list execution mode, execution of the full sequence of LLIs, named run-to-completion mode), a GPDMA channel x is initially programmed, started

by writing 1 to GPDMA_CxCR.EN, and after completed at channel level. The channel transfer is:

GPDMA_CxLLR[31:0] = 0 is the condition of a linked-list based channel completion and means the following:

The channel may never be completed when GPDMA_CxLLR.LSM = 0:

In the regular data transfer completion at a block level, GPDMA_CxBR1.BNDT[15:0] = 0 and GPDMA_CxBR1.BRC[10:0] = 0 (if present). Alternatively, a block transfer may be early completed by a peripheral (such as an I3C in Rx mode), and then BNDT[15:0] is not null (see Section 16.4.14 for more details).

In the typical run-to-completion mode, the allocation of a GPDMA channel, including its fine programming, is done once during the GPDMA initialization. In order to have a reserved data communication link and GPDMA service during run-time, for continuously repeated transfers (from/to a peripheral respectively to/from memory or for memory-to-memory transfers). This reserved data communication link can consist of a channel, or the channel can be shared and a repeated transfer consists of a sequence of LLIs.

Figure 78 depicts the GPDMA channel execution and its registers programming in run-to-completion mode.

Note: Figure 78 is not intended to illustrate how often a TCEF can be raised, depending on the programmed value of TCEM[1:0] in GPDMA_CxTR2. It can be raised at (each) block completion, at (each) 2D block completion, at (each) LLI completion, or only at channel completion. In run-to-completion mode, whatever is the value of TCEM[1:0], at the channel completion, the hardware always set TCEF = 1 and disables the channel.

In Figure 78, BNDT ≠ 0 is the typical condition for starting the first data transfer in this figure. This condition becomes (BNDT ≠ 0 and PFREQ = 1) if the peripheral requests a data transfer with early termination (see Section 16.3.6).

Figure 78. GPDMA channel execution and linked-list programming in run-to-completion mode (GPDMA_CxCR.LSM = 0)

Flowchart showing GPDMA channel execution and linked-list programming in run-to-completion mode. It details the states (Idle, Active) and decision points for user settings, BNDT, LLR, and transfer errors, leading to actions like 'Executing once the data transfer', 'Loading next LLI', and various 'Setting XEF = 1 Disabling DMA channel' steps.
graph TD; subgraph IdleState [Channel state = Idle]; Init[Initialize DMA channel] --> Enable[Enable DMA channel]; Enable --> ActiveState; Reconfig[Reconfigure DMA channel] --> Enable; end; subgraph ActiveState [Channel state = Active]; Valid1{Valid user setting?}; BNDT{BNDT ≠ 0?}; Exec[Executing once the data transfer from the register file]; Error1{No transfer error?}; LLR{LLR ≠ 0?}; LoadLLI[Loading next LLI into the register file]; Error2{No transfer error?}; Valid2{Valid user setting?}; TCF[Setting TCF = 1
Disabling DMA channel]; USEF1[Setting USEF = 1
Disabling DMA channel]; DTEF[Setting DTEF = 1
Disabling DMA channel]; ULEF[Setting ULEF = 1
Disabling DMA channel]; End((End)); Valid1 -- Y --> BNDT; Valid1 -- N --> USEF1; BNDT -- Y --> Exec; BNDT -- N --> TCF; Exec --> Error1; Error1 -- Y --> LLR; Error1 -- N --> DTEF; LLR -- Y --> LoadLLI; LLR -- N --> TCF; LoadLLI --> Error2; Error2 -- Y --> Valid2; Error2 -- N --> ULEF; Valid2 -- Y --> TCF; Valid2 -- N --> USEF1; TCF --> End; USEF1 --> End; DTEF --> End; ULEF --> End; end;
Flowchart showing GPDMA channel execution and linked-list programming in run-to-completion mode. It details the states (Idle, Active) and decision points for user settings, BNDT, LLR, and transfer errors, leading to actions like 'Executing once the data transfer', 'Loading next LLI', and various 'Setting XEF = 1 Disabling DMA channel' steps.

MSv62631V1

Run-time inserting a LLIn via an auxiliary channel, in run-to-completion mode

The start of the link transfer of the LLIn-1 (start of the LLIn loading) can be conditioned by the occurrence of a trigger, when programming the following fields of the GPDMA_CxTR2 in the data structure of the LLIn-1:

Another auxiliary channel y can be used to store the channel x LLIn in the memory and to generate a transfer complete event gpdma_chy_tc. By selecting this event as the input trigger of the link transfer of the LLIn-1 of the channel x, the software can pause the primary channel x after its LLIn-1 data transfer, until it is indeed written the LLIn.

Figure 79 depicts such a dynamic elaboration of a linked-list of a primary channel x, via another auxiliary channel y.

Caution: This use case is restricted to an application with a LLIn-1 data transfer that does not need a trigger. The triggering mode of this LLIn-1 is used to load the next LLIn.

Figure 79. Inserting a LLIn with an auxiliary GPDMA channel y Sequence diagram showing the insertion of a new LLI (LLI_n) into a linked list of DMA transfers. It involves three entities: DMA primary channel x, DMA auxiliary channel y, and the CPU. The process starts with channel x executing LLI_{n-2}, then loading LLI_{n-1} with specific register settings (TRIGM[1:0]=10, TRIGPOL[1:0]=01, TRIGSEL=dma_chy_tc, TCEM[1:0]=01). Channel x then executes LLI_{n-1}. Upon completion, a 'Transfer complete interrupt' is sent to the CPU. The CPU then builds a new LLI_n and configures channel y. Channel y then executes a data transfer (Memcopy of new LLI_n) and signals 'dma_chy_tc' back to channel x. Channel x then loads the new LLI_n and proceeds to execute it, followed by loading LLI_{n+1}.
sequenceDiagram
    participant DMAx as DMA primary channel x
    participant DMAy as DMA auxiliary channel y
    participant CPU as CPU

    Note left of DMAx: LLI_{n-1} transfer
    DMAx->>DMAx: Executing LLI_{n-2} data transfer
    DMAx->>DMAx: Loading LLI_{n-1}
(with DMA_CxTR2: TRIGM[1:0] = 10
TRIGPOL[1:0] = 01
TRIGSEL= dma_chy_tc
and TCEM[1:0] = 01) DMAx->>DMAx: Executing LLI_{n-1} data transfer DMAx-->>CPU: Transfer complete interrupt Note left of DMAx: LLI_n transfer CPU->>CPU: Build new LLI_n
Configure channel Y DMAy->>DMAy: Executing data transfer
(Memcopy of new LLI_n) DMAy-->>DMAx: dma_chy_tc DMAx->>DMAx: Loading new LLI_n Note left of DMAx: LLI_{n+1} transfer DMAx->>DMAx: Executing LLI_n data transfer DMAx->>DMAx: Loading LLI_{n+1}

MSv62632V2

Sequence diagram showing the insertion of a new LLI (LLI_n) into a linked list of DMA transfers. It involves three entities: DMA primary channel x, DMA auxiliary channel y, and the CPU. The process starts with channel x executing LLI_{n-2}, then loading LLI_{n-1} with specific register settings (TRIGM[1:0]=10, TRIGPOL[1:0]=01, TRIGSEL=dma_chy_tc, TCEM[1:0]=01). Channel x then executes LLI_{n-1}. Upon completion, a 'Transfer complete interrupt' is sent to the CPU. The CPU then builds a new LLI_n and configures channel y. Channel y then executes a data transfer (Memcopy of new LLI_n) and signals 'dma_chy_tc' back to channel x. Channel x then loads the new LLI_n and proceeds to execute it, followed by loading LLI_{n+1}.

16.4.8 GPDMA channel state and linked-list programming in link step mode

When GPDMA_CxCR.LSM = 1 (in link step execution mode, single execution of one LLI), a channel transfer is executed and completed after each single execution of a LLI, including its (conditional) data transfer and its (conditional) link transfer.

A GPDMA channel transfer can be programmed at LLI level, started by writing 1 into GPDMA_CxCR.EN, and after completed at LLI level:

Note: If a LLI is recursive (pointing to itself as a next LLI, either GPDMA_CxLLR.ULL = 1 and GPDMA_CxLLR.LA[15:2] is updated with the same value, or GPDMA_CxLLR.ULL = 0), a channel in link step mode is completed after each repeated single execution of this LLI.

In the regular data transfer completion at a block level, GPDMA_CxBR1.BNDT[15:0] = 0 and GPDMA_CxBR1.BRC[10:0] = 0. Alternatively, a block transfer may be early completed by a peripheral (such as an I3C in Rx mode), and then BNDT[15:0] is not null (see Section 16.4.14 for more details).

The link step mode can be used to elaborate dynamically LLIs in memory during run-time. The software can be facilitated by using a static data structure for any LLIn (all update bits of GPDMA_CxLLR have a static value, LLIn.LLR.LA = LLIn-1.LLR.LA + constant).

Figure 80 depicts the GPDMA channel execution mode, and its programming in link step mode.

Note: Figure 80 is not intended to illustrate how often a TCEF can be raised, depending on the programmed value of TCEM[1:0] in GPDMA_CxTR2. It can be raised at (each) block completion, at (each) 2D block completion, at (each) LLI completion, or only at the last LLI data transfer completion. In link step mode, the channel is disabled after each single execution of a LLI, and depending on the value of TCEM[1:0] a TCEF is raised or not.

In Figure 80, BNDT ≠ 0 is the typical condition for starting the first data transfer. This condition becomes (BNDT ≠ 0 and PFREQ = 1) if the peripheral requests a data transfer with early termination (see Section 16.3.6).

Figure 80. GPDMA channel execution and linked-list programming in link step mode (GPDMA_CxCR.LSM = 1)

Flowchart showing GPDMA channel execution and linked-list programming in link step mode. It details the states (Idle, Active) and decision points for user settings, BNDT, data transfer errors, LLR, and LLI loading, leading to actions like disabling the channel or reconfiguring it.
graph TD
    subgraph IdleState [Channel state = Idle]
        Init[Initialize DMA channel]
        Enable[Enable DMA channel]
        Reconfig[Reconfigure DMA channel]
        Enable --> ActiveState
        Reconfig --> Enable
    end

    subgraph ActiveState [Channel state = Active]
        Valid1{Valid user setting?}
        BNDT{BNDT ≠ 0?}
        Exec[Executing once the data transfer from the register file]
        Error1{No transfer error?}
        LLR{LLR ≠ 0?}
        LoadLLI[Loading next LLI into the register file]
        Error2{No transfer error?}
        Valid2{Valid user setting?}
        SetTCF[Setting TCF = 1
Disabling DMA channel] SetUSEF1[Setting USEF = 1
Disabling DMA channel] SetDTEF[Setting DTEF = 1
Disabling DMA channel] SetULEF[Setting ULEF = 1
Disabling DMA channel] Valid1 -- Y --> BNDT Valid1 -- N --> SetUSEF1 BNDT -- Y --> Exec BNDT -- N --> SetDTEF Exec --> Error1 Error1 -- Y --> LLR Error1 -- N --> SetDTEF LLR -- Y --> LoadLLI LLR -- N --> SetTCF LoadLLI --> Error2 Error2 -- Y --> Valid2 Error2 -- N --> SetULEF Valid2 -- Y --> SetTCF Valid2 -- N --> SetUSEF1 end SetTCF --> End{End} SetUSEF1 --> End SetDTEF --> End SetULEF --> End

MSv62633V1

Flowchart showing GPDMA channel execution and linked-list programming in link step mode. It details the states (Idle, Active) and decision points for user settings, BNDT, data transfer errors, LLR, and LLI loading, leading to actions like disabling the channel or reconfiguring it.

During run-time, the software can defer the elaboration of the LLIn+1 (and next LLIs), until/after GPDMA executed the transfer from the LLIn-1 and loaded the LLIn from the memory, as shown in Figure 81.

Figure 81. Building LLIn+1: GPDMA dynamic linked-lists in link step mode

Flowchart showing the interaction between DMA Channel and CPU for building dynamic linked-lists in link step mode. It details the sequence of transfers (LLI<sub>n-2</sub>, LLI<sub>n-1</sub>, LLI<sub>n</sub>) and the CPU's role in enabling channels and building/storing subsequent LLI entries.

The diagram illustrates the process of building dynamic linked-lists in link step mode, where LSM = 1 with 2-stage linked-list programming. The DMA Channel executes LLIn-2 transfer, which triggers a 'Transfer complete interrupt' to the CPU. The CPU then enables the DMA channel and builds/stores LLIn+1. Simultaneously, the DMA Channel proceeds to LLIn-1 transfer, which includes executing data transfer and loading LLIn from memory. This second transfer also triggers a 'Transfer complete interrupt' to the CPU, which again enables the DMA channel for the final LLIn transfer.

graph TD
    subgraph " "
        direction TB
        Note["LSM = 1 with 2-stage linked-list programming:
DMA executes LLIn-1 and loads LLIn while CPU builds LLIn+1"] end subgraph DMA_Channel ["DMA Channel"] LLI_n2["LLIn-2 transfer"] LLI_n1["LLIn-1 transfer"] LLI_n["LLIn transfer"] LLI_n1_Exec["Executing LLIn-1 data transfer"] LLI_n_Load["Loading LLIn"] end subgraph CPU ["CPU"] Enable1["Enable DMA channel"] Build["Build and store LLIn+1"] Enable2["Enable DMA channel"] end LLI_n2 --> Note LLI_n2 -- "Transfer complete interrupt" --> Enable1 Enable1 --> Build Build --> LLI_n1 LLI_n1 --> LLI_n1_Exec LLI_n1_Exec --> LLI_n_Load LLI_n_Load -- "Transfer complete interrupt" --> Enable2 Enable2 --> LLI_n LLI_n -.-> End[ ]

MSv62634V1

Flowchart showing the interaction between DMA Channel and CPU for building dynamic linked-lists in link step mode. It details the sequence of transfers (LLIn-2, LLIn-1, LLIn) and the CPU's role in enabling channels and building/storing subsequent LLI entries.

In this link step mode, during run-time, the software can build and insert a new LLIn' , after GPDMA executed the transfer from the LLIn-1 and loaded a formerly elaborated LLIn from the memory by overwriting directly the linked-list register file with the new LLIn' , as shown in Figure 82.

Figure 82. Replace with a new LLIn' in register file in link step mode

Flowchart showing the process of replacing an LLI in the register file in link step mode. It details the interaction between the DMA channel and the CPU across three stages: LLI_{n-1} transfer, LLI_{n'} transfer, and LLI_{n+1''} transfer. Each stage involves data transfer, loading the next LLI, and a transfer complete interrupt that triggers the CPU to build and overwrite the linked-list register file before enabling the next DMA channel.

LSM = 1 with 1-stage linked-list programming:
Overwriting the (pre)loaded LLIn linked-list register file with
a new LLIn' directly in linked-list register file.
DMA executes LLIn-1 and load LLIn, then CPU builds and overwrites LLIn'

DMA channel

LLIn-1 transfer

Executing LLIn-1 data transfer

Loading LLIn

Transfer complete interrupt

CPU

Build LLIn' and overwrite linked-list register file

Enable DMA channel

LLIn' transfer

Executing LLIn' data transfer

Loading LLIn+1'

Transfer complete interrupt

Build LLIn+1'' and overwrite linked-list register file

Enable DMA channel

LLIn+1'' transfer

Transfer complete interrupt

MSv62635V1

Flowchart showing the process of replacing an LLI in the register file in link step mode. It details the interaction between the DMA channel and the CPU across three stages: LLI_{n-1} transfer, LLI_{n'} transfer, and LLI_{n+1''} transfer. Each stage involves data transfer, loading the next LLI, and a transfer complete interrupt that triggers the CPU to build and overwrite the linked-list register file before enabling the next DMA channel.

The software can build and insert a new LLIn' and LLIn+1' in the memory, after GPDMA executed the transfer from the LLIn-1 and loaded a formerly elaborated LLIn from the memory, by overwriting partly the linked-list register file (GPDMA_CxBR1.BNDT[15:0] to be null and GPDMA_CxLLR to point to new LLIn') as shown in Figure 83.

Figure 83. Replace with a new LLIn' and LLIn+1' in memory in link step mode (option 1)

Interaction flowchart between DMA Channel and CPU for updating linked list items LLI_n' and LLI_n+1'

LSM = 1 with 1-stage linked-list programming:
Overwriting the (pre)loaded LLIn linked-list register file with a new LLIn' and LLIn+1' in memory and
overwrite partly linked-list register file
(DMA_CxBR1.BNDT = 0 and DMA_CxLLR to point to new LLIn')
DMA executes LLIn-1 and load LLIn then CPU builds (LLIn' and LLIn+1') and overwrite (BR1 and LLR)

sequenceDiagram
    participant DMA as DMA Channel
    participant CPU as CPU
    Note over DMA: LLI_{n-1} transfer
Executing LLI_{n-1} data transfer
Loading LLI_n DMA->>CPU: Transfer complete interrupt Note over CPU: Build LLI_n' and LLI_{n+1'} in memory Note over CPU: Write DMA_CxBR1.BNDT = 0
Write DMA_CxLLR to point to new LLI_n' Note over CPU: Enable DMA channel CPU->>DMA: Note over DMA: LLI_n' transfer
Loading LLI_n' DMA->>CPU: Transfer complete interrupt Note over CPU: Enable DMA channel CPU->>DMA: Note over DMA: LLI_{n+1'} transfer
Executing LLI_{n+1'} data transfer
Loading LLI_{n+1'} DMA-->>CPU: Transfer complete interrupt

MSv62636V1

Interaction flowchart between DMA Channel and CPU for updating linked list items LLI_n' and LLI_n+1'

Other software implementations exist. Meanwhile GPDMA executes the transfer from the \(LLI_{n-1}\) and loads a formerly elaborated \(LLI_n\) from the memory (or even earlier), the software can do the following:

  1. 1. Disable the NVIC for not being interrupted by the interrupt handling.
  2. 2. Build a new \(LLI_{n'}\) and a new \(LLI_{n+1'}\).
  3. 3. Enable again the NVIC for the channel interrupt (transfer complete) notification.

The software in the interrupt handler for \(LLI_{n-1}\) is then restricted to overwrite GPDMA_CxBR1.BNDT[15:0] to be null and GPDMA_CxLLR to point to new \(LLI_{n'}\), as shown in Figure 84.

Figure 84. Replace with a new \(LLI_{n'}\) and \(LLI_{n+1'}\) in memory in link step mode (option 2)

Flowchart showing the interaction between DMA channel and CPU for replacing LLI entries in link step mode. The DMA channel executes LLI_{n-1} data transfer, then loads LLI_n. A transfer complete interrupt triggers the CPU to disable the NVIC, build new LLI_{n'} and LLI_{n+1'} in memory, and enable the NVIC. The CPU then writes DMA_CxBR1.BNDT = 0 and DMA_CxLLR to point to the new LLI_{n'}, and enables the DMA channel. The DMA channel then loads LLI_{n'}, and a transfer complete interrupt triggers the CPU to enable the DMA channel again. Finally, the DMA channel executes LLI_{n+1'} data transfer and loads LLI_{n+1'}.

LSM = 1 with 1-stage linked-list programming:
Overwriting the (pre)loaded \(LLI_n\) linked-list register file by building new \(LLI_{n'}\) and \(LLI_{n+1'}\) in memory while disabling (temporary) channel interrupt at NVIC level, and overwriting DMA_CxBR1.BNDT = 0 and DMA_CxLLR to point to new \(LLI_{n'}\),
DMA executes \(LLI_{n-1}\) and loading \(LLI_n\) while CPU builds (\(LLI_{n'}\) and \(LLI_{n+1'}\)), then CPU overwrites (BR1 and LLR)

graph TD
    subgraph DMA_channel [DMA channel]
        D1[Executing LLI_{n-1} data transfer] --> D2[Loading LLI_n]
        D2 --> D3[Loading LLI_{n'}]
        D3 --> D4[Executing LLI_{n+1'} data transfer]
        D4 --> D5[Loading LLI_{n+1'}]
    end

    subgraph CPU [CPU]
        C1[Disable NVIC DMA irq channel] --> C2[Build LLI_{n'} & LLI_{n+1'} in memory]
        C2 --> C3[Enable NVIC DMA irq channel]
        C3 --> C4[Write DMA_CxBR1.BNDT = 0
Write DMA_CxLLR to point to new LLI_{n'}] C4 --> C5[Enable DMA channel] C5 --> C6[Enable DMA channel] end D2 -- "Transfer complete interrupt" --> C1 D3 -- "Transfer complete interrupt" --> C6

MSv62637V1

Flowchart showing the interaction between DMA channel and CPU for replacing LLI entries in link step mode. The DMA channel executes LLI_{n-1} data transfer, then loads LLI_n. A transfer complete interrupt triggers the CPU to disable the NVIC, build new LLI_{n'} and LLI_{n+1'} in memory, and enable the NVIC. The CPU then writes DMA_CxBR1.BNDT = 0 and DMA_CxLLR to point to the new LLI_{n'}, and enables the DMA channel. The DMA channel then loads LLI_{n'}, and a transfer complete interrupt triggers the CPU to enable the DMA channel again. Finally, the DMA channel executes LLI_{n+1'} data transfer and loads LLI_{n+1'}.

16.4.9 GPDMA channel state and linked-list programming

The software can reconfigure a channel when the channel is disabled (GPDMA_CxCR.EN = 0) and update the execution mode (GPDMA_CxCR.LSM) to change from/to run-to-completion mode to/from link step mode.

In any execution mode, the software can:

In link step mode, the software can clear LSM after each a single execution of any LLI, during \(LLI_{n-1}\).

Figure 85 shows the overall and unified GPDMA linked-list programming, whatever is the execution mode.

Note: Figure 85 is not intended to illustrate how often a TCEF can be raised, depending on the programmed value of TCEM[1:0] in GPDMA_CxTR2. It can be raised at (each) block completion, at (each) 2D block completion, at (each) LLI completion, or only at the last LLI data transfer completion. In run-to-completion mode, whatever is the value of TCEM[1:0], at the channel completion the hardware always set TCEF = 1 and disables the channel. In link step mode, the channel is disabled after each single execution of a LLI, and depending on the value of TCEM[1:0] a TCEF is raised or not.

In Figure 85, BNDT ≠ 0 is the typical condition for starting the first data transfer. This condition becomes (BNDT ≠ 0 and PFREQ = 1) if the peripheral requests a data transfer with early termination (see Section 16.3.6).

Figure 85. GPDMA channel execution and linked-list programming

Flowchart of GPDMA channel execution and linked-list programming. It shows the transition from an Idle state to an Active state, where data transfers are executed and linked lists are loaded until the Last Segment (LSM) is reached, leading to the channel being disabled.
graph TD; subgraph IdleState [Channel state = Idle]; Init[Initialize DMA channel]; Enable[Enable DMA channel]; Reconfig[Reconfigure DMA channel]; Init --> Enable; Enable --> ActiveState; Reconfig --> Enable; end; subgraph ActiveState [Channel state = Active]; ValidUser1{Valid user setting?}; BNDT{BNDT ≠ 0?}; Execute[Executing once the data transfer from the register file]; NoError1{No transfer error?}; LLR{LLR ≠ 0?}; LoadLLI[Loading next LLI into the register file]; NoError2{No transfer error?}; ValidUser2{Valid user setting?}; LSM{LSM = 1?}; Disable1[Setting USEF = 1
Disabling DMA channel]; Disable2[Setting DTEF = 1
Disabling DMA channel]; Disable3[Setting ULEF = 1
Disabling DMA channel]; Disable4[Setting USEF = 1
Disabling DMA channel]; Disable5[Setting TCF = 1
Disabling DMA channel]; End((End)); ValidUser1 -- Y --> BNDT; ValidUser1 -- N --> Disable1; BNDT -- Y --> Execute; BNDT -- N --> Disable2; Execute --> NoError1; NoError1 -- Y --> LLR; NoError1 -- N --> Disable2; LLR -- Y --> LoadLLI; LLR -- N --> Disable3; LoadLLI --> NoError2; NoError2 -- Y --> ValidUser2; NoError2 -- N --> Disable3; ValidUser2 -- Y --> LSM; ValidUser2 -- N --> Disable4; LSM -- Y --> Disable5; LSM -- N --> Execute; Disable5 --> End; end;

The flowchart illustrates the GPDMA channel execution and linked-list programming process. It begins in the 'Channel state = Idle' state, where the DMA channel is initialized and enabled. If reconfiguration is needed, it loops back to the enable step. Upon entering the 'Channel state = Active' state, the system checks for a valid user setting. If invalid, it disables the channel by setting USEF = 1. If valid, it checks if BNDT ≠ 0. If not, it disables the channel by setting DTEF = 1. If BNDT ≠ 0, it executes a data transfer from the register file. After execution, it checks for transfer errors. If an error occurs, it disables the channel by setting DTEF = 1. If no error, it checks if LLR ≠ 0. If not, it disables the channel by setting ULEF = 1. If LLR ≠ 0, it loads the next LLI into the register file and loops back to execute the data transfer. After loading the next LLI, it again checks for transfer errors. If an error occurs, it disables the channel by setting ULEF = 1. If no error, it checks for a valid user setting. If invalid, it disables the channel by setting USEF = 1. If valid, it checks if LSM = 1. If LSM = 1, it disables the channel by setting TCF = 1 and reaches the 'End' state. If LSM ≠ 1, it loops back to execute the data transfer.

Flowchart of GPDMA channel execution and linked-list programming. It shows the transition from an Idle state to an Active state, where data transfers are executed and linked lists are loaded until the Last Segment (LSM) is reached, leading to the channel being disabled.

MSv62638V1

16.4.10 GPDMA FIFO-based transfers

There is a single transfer operation mode: the FIFO mode. There are FIFO-based transfers. Any channel x is implemented with a dedicated FIFO whose size is defined by dma_fifo_size[x](see Section 16.3.2 for more details).

GPDMA burst

A programmed transfer at the lowest level is a GPDMA burst.

A GPDMA burst is a burst of data received from the source, or a burst of data sent to the destination. A source (and destination) burst is programmed with a burst length by the field SBL_1[5:0](respectively DBL_1[5:0]), and with a data width defined by the field SDW_LOG2[1:0](respectively DDW_LOG2[1:0]) in the GPDMA_CxTR1 register.

The addressing mode after each data (named beat) of a GPDMA burst is defined by SINC and DINC in GPDMA_CxTR1, for source and destination respectively: either a fixed addressing or an incremented addressing with contiguous data.

The start and next addresses of a GPDMA source/destination burst (defined by GPDMA_CxSAR and GPDMA_CxDAR) must be aligned with the respective data width.

The table below lists the main characteristics of a GPDMA burst.

Table 133. Programmed GPDMA source/destination burst

SDW_LOG2[1:0]
DDW_LOG2[1:0]
Data width
(bytes)
SINC/DINCSBL_1[5:0]
DBL_1[5:0]
Burst length
(data/beats)
Next data/
beat address
Next burst addressBurst address alignment
0010 (fixed)n = 0 to 63(1)n+1+ 0+ 01
0122
1044
0011
(contiguously incremented)
+ 1+ (n + 1)1
012+ 2+ 2 * (n + 1)2
104+ 4+ 4 * (n + 1)4
11forbidden user setting, causing USEF generation and none burst to be issued.

1. When S/DBL_1[5:0]= 0, burst is of length 1. Then burst can be also named as single.

The next burst address in the above table is the next source/destination default address pointed by GPDMA_CxSAR or GPDMA_CxDAR, once the programmed source/destination burst is completed. This default value refers to the fixed/contiguously incremented address.

GPDMA burst with 2D addressing (channel x = 10 to 11)

When the channel has additional 2D addressing feature, this default value refers to the value without taking into account the two programmed incremented or decremented offsets. These two additional offsets (with a null default value) are applied:

Then, a 2D/repeated block can be addressed with a first programmed address jump after each completed burst, and with a second programmed address jump after each block, as depicted by Figure 86 with a 2D destination buffer.

Figure 86. Programmed 2D addressing

Diagram of Programmed 2D addressing showing memory access bursts, blocks, and address jumps.

The diagram illustrates the programmed 2D addressing mechanism of the GPDMA. On the left, a Memory-mapped Peripheral with a 32b Data Register is accessed via Cx_SAR (fixed addressing, SINC=0). A curved arrow indicates data transfer to Memory (32b wide). Memory addressing is structured into Bursts (Burst0, Burst1, ..., BurstJ-1) comprising data elements (Data0, Data1, ..., DataI-1), which are grouped into Blocks (Block0, ..., Blockk, ..., BlockK-1) forming a 2D/repeated block LLIL. Address increments between bursts use + DAO, and between blocks use + BRDAO. A curved line indicates 'Restore Cx_DAR' to jump/reset the destination address register. A bottom-left text box provides: 'Programmable address jumps 1) after burst and 2) after block. Example: burst: I * words (DBL_1=I-1; DDW_LOG2='b10) block: J * bursts (BNDT=J*I*4) LLI: K * blocks (BRC=K-1)'. Document tag: MSv63674V1.

Diagram of Programmed 2D addressing showing memory access bursts, blocks, and address jumps.

GPDMA FIFO-based burst

In FIFO-mode, a transfer generally consists of two pipelined and separated burst transfers:

GPDMA source burst

The requested source burst transfer to the FIFO can be scheduled as early as possible over the allocated port, depending on the current FIFO level versus the programmed burst size (when the FIFO is ready to get one new burst from the source):

when FIFO level \(\leq 2^{\text{dma\_fifo\_size}[x]} - (\text{SBL\_1}[5:0]+1) * 2^{\text{SDW\_LOG2}[1:0]}\)

where:

Based on the channel priority (GPDMA_CxCR.PRIO[1:0]), this ready FIFO-based source transfer is internally arbitrated versus the other requested and active channels.

GPDMA destination burst

The requested destination burst transfer from the FIFO can be scheduled as early as possible over the allocated port, depending on the current FIFO level versus the programmed burst size (when the FIFO is ready to push one new burst to the destination):

when FIFO level \(\geq (\text{DBL\_1}[5:0]+1) * 2^{\text{DDW\_LOG2}[1:0]}\)

where:

Based on the channel priority, this ready FIFO-based destination transfer is internally arbitrated versus the other requested and active channels.

GPDMA burst vs source block size, 1-Kbyte address boundary and FIFO size

The programmed source/destination GPDMA burst is implemented with an AHB burst as is, unless one of the following conditions is met:

In any case, the GPDMA keeps ensuring source/destination data (and address) integrity without any user constraint. The current FIFO level (software readable in GPDMA_CxSR) is compared to and updated with the effective transfer size, and the GPDMA re-arbitrates between each AHB single or burst transfer, possibly modified.

Based on the channel priority, each single or burst of a lower burst size versus the programmed burst, is internally arbitrated versus the other requested and active channels.

Note: In linked-list mode, the GPDMA read transfers related to the update of the linked-list parameters from the memory to the internal GPDMA registers, are scheduled over the link allocated port, as programmed by GPDMA_CxCR.LAP.

GPDMA data handling: byte-based reordering, packing/unpacking, padding/truncation, sign extension and left/right alignment

The data handling is controlled by GPDMA_CxTR1. The source/destination data width of the programmed burst is byte, half-word or word, as per the SDW_LOG2[1:0] and DDW_LOG2[1:0] fields (see Table 134).

The user can configure the data handling between transferred data from the source and transfer to the destination. More specifically, programmed data handling is orderly performed with:

  1. 1. Byte-based source reordering
    • – If SBX = 1 and if source data width is a word, the two bytes of the unaligned half-word at the middle of each source data word are exchanged.
  2. 2. Data width conversion by packing, unpacking, padding or truncation, if destination data width is different than the source data width, depending on PAM[1:0]:
    • – If destination data width > source data width, the post SBX source data is either right-aligned and padded with 0 s, or sign extended up to the destination data width, or is FIFO queued and packed up to the destination data width.
    • – If destination data width < source data width, the post SBX data is either right-aligned and left-truncated down to the destination data width, or is FIFO queued and unpacked and streamed down to the destination data width.
  3. 3. Byte-based destination re-ordering:
    • – If DBX = 1 and if the destination data width is not a byte, the two bytes are exchanged within the aligned post PAM[1:0] half-words.
    • – If DHX = 1 and if the destination data width is neither a byte nor a half-word, the two aligned half-words are exchanged within the aligned post PAM[1:0] words.

Note: Left-alignment with 0s-padding can be achieved by programming both a right-alignment with a 0s-padding and a destination byte-based re-ordering.

The table below lists the possible data handling from the source to the destination.

Table 134. Programmed data handling

SDW_LOG2 [1:0]Source dataSource data stream(1)SB XDDW_LOG2 [1:0]Destination dataPAM[1:0](2)DB XDH XDestination data stream(1)
00ByteB7,B6,B5,
B4,B3,B2,
B1,B0
x00BytexxxB7,B6,B5,B4,B3,B2,B1,B0
01Half-word00 (RA, 0P)0x0B3,0B2,0B1,0B0
1B30,B20,B10,B00
01 (RA, SE)0SB3,SB2,SB1,SB0
1B3S,B2S,B1S,B0S
1x (PACK)0B7B6,B5B4,B3B2,B1B0
1B6B7,B4B5,B2B3,B0B1
10Word00 (RA, 0P)00000B1,000B0
100B10,00B00
010B100,0B000
1B1000,B0000
01 (RA, SE)00SSSB1,SSSB0
1SSB1S,SSB0S
01SB1SS,SB0SS
1B1SSS,B0SSS
1x (PACK)00B7B6B5B4,B3B2B1B0
1B6B7B4B5,B2B3B0B1
01B5B4B7B6,B1B0B3B2
1B4B5B6B7,B0B1B2B3
01Half-wordB7B6,B5B4
,B3B2,
B1B0
00Byte00 (RA, LT)xxB6,B4,B2,B0
01 (LA, RT)B7,B5,B3,B1
1x (UNPACK)B7,B6,B5,B4,B3,B2,B1,B0
Table 134. Programmed data handling (continued)
SDW_
LOG2
[1:0]
Source
data
Source
data
stream(1)
SB
X
DDW_
LOG2
[1:0]
Destination
data
PAM[1:0](2)DB
X
DH
X
Destination data
stream(1)
01Half-wordB7B6,B5B4
,B3B2,
B1B0
x01Half-wordxx0xB7B6,B5B4,B3B2,B1B0
1B6B7,B4B5,B2B3,B0B1
10Word00 (RA, 0P)0000B3B2,00B1B0
100B2B3,00B0B1
01B3B200,B1B000
1B2B300,B0B100
01 (RA, SE)00SSB3B2,SSB1B0
1SSB2B3,SSB0B1
01B3B2SS,B1B0SS
1B2B3SS,B0B1SS
1x (PACK)00B7B6B5B4,B3B2B1B0
1B6B7B4B5,B2B3B0B1
01B5B4B7B6,B1B0B3B2
1B4B5B6B7,B0B1B2B3
10WordB7B6B5B4,
B3B2B1B0
000Byte00 (RA, LT)xxB12,B8,B4,B0
01 (LA, RT)B15,B11,B7,B3
10 (UNPACK)B7,B6,B5,B4,B3,B2,B1,B0
01Half-word00 (RA, LT)0B5B4,B1B0
1B4B5,B0B1
01 (LA, RT)0B7B6,B3B2
1B6B7,B2B3
1x (UNPACK)0B7B6,B5B4,B3B2,B1B0
1B6B7,B4B5,B2B3,B0B1

Table 134. Programmed data handling (continued)

SDW_LOG2 [1:0]Source dataSource data stream(1)SB XDDW_LOG2 [1:0]Destination dataPAM[1:0](2)DB XDH XDestination data stream(1)
10WordB7B6B5B4,
B3B2B1B0
010Wordxx00B7B6B5B4, B3B2B1B0
1B6B7B4B5, B2B3B0B1
01B5B4B7B6, B1B0B3B2
1B4B5B6B7, B0B1B2B3
100Byte00 (RA, LT)xxB12, B8, B4, B0
01 (LA, RT)B15, B11, B7, B3
1x (UNPACK)B7, B5, B6, B4, B3, B1, B2, B0
01Half-word00 (RA, LT)0B6B4, B2B0
01 (LA, RT)1B4B6, B0B2
01 (LA, RT)0B7B5, B3B1
1x (UNPACK)1B5B7, B1B3
1x (UNPACK)0B7B5, B6B4, B3B1, B2B0
1x (UNPACK)1B5B7, B4B6, B1B3, B0B2
10Wordxx00B7B5B6B4, B3B1B2B0
1B5B7B4B6, B1B3B0B2
01B6B4B7B5, B2B0B3B1
1B4B6B5B7, B0B2B1B3
  1. 1. Data stream is timely ordered starting from the byte with the lowest index (B0).
  2. 2. RA= right aligned, LA = left aligned, RT = right truncated, LT = left truncated, 0P = zero bit padding up to the destination data width, SE = sign bit extended up to the destination data width.

16.4.11 GPDMA transfer request and arbitration

GPDMA transfer request

As defined by GPDMA_CxTR2, a programmed GPDMA data transfer is requested with one of the following:

Caution: The user must not assign a same input hardware peripheral GPDMA request via GPDMA_CxTR.REQSEL[7:0] to two different channels, if at a given time this request is asserted by the peripheral and each channel is ready to execute this requested data transfer. There is no user setting error reporting.

GPDMA transfer request for arbitration

A ready FIFO-based GPDMA source single/burst transfer (from the source address to the FIFO) to be scheduled over the allocated master port (GPDMA_CxTR1.SAP) is arbitrated based on the channel priority (GPDMA_CxCR.PRIO[1:0]) versus the other simultaneous requested GPDMA transfers to the same master port.

A ready FIFO-based GPDMA destination single/burst transfer (from the FIFO to the destination address) to be scheduled over the allocated master port (GPDMA_CxTR1.DAP) is arbitrated based on the channel priority (GPDMA_CxCR.PRIO[1:0]) versus the other simultaneous requested GPDMA transfers to the same master port.

An arbitrated GPDMA requested link transfer consists of one 32-bit read from the linked-list data structure in memory to one of the linked-list registers (GPDMA_CxTR1, GPDMA_CxTR2, GPDMA_CxBR1, GPDMA_CxSAR, GPDMA_CxDAR or GPDMA_CxLLR, plus GPDMA_CxTR3, GPDMA_CxBR2). Each 32-bit read from memory is arbitrated with the same channel priority as for data transfers, in order to be scheduled over the allocated master port (GPDMA_CxCR.LAP).

Whatever the requested data transfer is programmed with a software request for a memory-to-memory transfer (GPDMA_CxTR2.SWREQ = 1), or with a hardware request (GPDMA_CxTR2.SWREQ = 0) for a memory-to-peripheral transfer or a peripheral-to-memory transfer and whatever is the hardware request type, re-arbitration occurs after each granted single/burst transfer.

When an hardware request is programmed from a destination peripheral (GPDMA_CxTR2.SWREQ = 0 and GPDMA_CxTR2.DREQ = 1), the first memory read of a (possibly 2D/repeated) block (the first ready FIFO-based source burst request), is gated by the occurrence of the corresponding and selected hardware request. This first read request to memory is not taken into account earlier by the arbiter (not as soon as the block transfer is enabled and executable).

GPDMA arbitration

The GPDMA arbitration is directed from the 4-grade assigned channel priority (GPDMA_CxCR.PRIO[1:0]). The arbitration policy, as illustrated in Figure 87, is defined by:

Figure 87. GPDMA arbitration policy

Block diagram of GPDMA arbitration policy. Requests from channels x with priorities 0, 1, 2, and 3 are routed to Queue 0, Queue 1, Queue 2, and Queue 3 respectively with round-robin arbitration (RRA). Queues 0, 1, and 2 feed into an RRA arbiter, labeled as Low priority, going into a fixed-priority arbitration (FPA) unit along with the High priority Queue 3 to output the Granted request.
Block diagram of GPDMA arbitration policy. Requests from channels x with priorities 0, 1, 2, and 3 are routed to Queue 0, Queue 1, Queue 2, and Queue 3 respectively with round-robin arbitration (RRA). Queues 0, 1, and 2 feed into an RRA arbiter, labeled as Low priority, going into a fixed-priority arbitration (FPA) unit along with the High priority Queue 3 to output the Granted request.

GPDMA arbitration and bandwidth

With this arbitration policy, the following is guaranteed:

The two following examples highlight that the weighted round-robin arbitration is driven by the programmed priorities:

The above computed bandwidth calculation is based on a theoretical input request, always active for any GPDMA clock cycle. This computed bandwidth from the arbiter must be weighted by the frequency of the request given by the application, that cannot be always active and may be quite much variable from one GPDMA client (example I2C at 400 kHz) to another one (PWM at 1 kHz) than the above x3 and x5 ratios.

In this example, when the master port bus bandwidth is not totally consumed by the time-sensitive queue 3, the residual bandwidth is such that 2.5 times less bandwidth is allocated to any request of priority 0 versus priority 1, and 5.5 times less bandwidth is allocated to any request of priority 0 versus priority 2.

More generally, assume that the following requests are present:

As \(B_{Q3}\) is the reserved bandwidth to time-sensitive requests, the bandwidth for each request L with priority 3 is:

The bandwidth for each non-time sensitive queue is:

The bandwidth for the set of requests with priority 0 is:

The bandwidth for each request i with priority 0 is:

The bandwidth for the set of requests with priority 1 and routed to queue 0 is:

The bandwidth for the set of requests with priority 1 and routed to queue 1 is:

The total bandwidth for the set of requests with priority 1 is:

The bandwidth for each request j with priority 1 is:

The bandwidth for the set of requests with priority 2 and routed to queue 0 is:

The bandwidth for the set of requests with priority 2 and routed to queue 1 is:

The bandwidth for the set of requests with priority 2 and routed to queue 2 is:

The total bandwidth for the set of requests with priority 2 is:

The bandwidth for each request k with priority 2 is:

Thus finally the maximum allocated residual bandwidths for any i, j, k non-time sensitive request are:

Consequently, the GPDMA arbiter can be used as a programmable weighted bandwidth limiter, for each queue and more generally for each request/channel. The different weights are monotonically resulting from the programmed channel priorities.

16.4.12 GPDMA triggered transfer

A programmed GPDMA transfer can be triggered by a rising/falling edge of a selected input trigger event, as defined by GPDMA_CxTR2.TRIGPOL[1:0] and GPDMA_CxTR2.TRIGSEL[6:0] (see Section 16.3.7 for the trigger selection).

The triggered transfer, as defined by the trigger mode in GPDMA_CxTR2.TRIGM[1:0], can be at LLI data transfer level, to condition the first burst read of a block, the first burst read of a 2D/repeated block for channel x (x = 10 to 11), or each programmed single read. The trigger mode can also be programmed to condition the LLI link transfer (see TRIGM[1:0] in GPDMA_CxTR2 for more details).

Trigger hit memorization and trigger overrun flag generation

The GPDMA monitoring of a trigger for a channel x is started when the channel is enabled/loaded with a new active trigger configuration: rising or falling edge on a selected trigger (respectively TRIGPOL[1:0] = 01 or TRIGPOL[1:0] = 10).

The monitoring of this trigger is kept active during the triggered and uncompleted (data or link) transfer. If a new trigger is detected, this hit is internally memorized to grant the next transfer, as long as the defined rising/falling edge and TRIGSEL[6:0] are not modified, and the channel is enabled.

Transferring a next LLIn+1, that updates the GPDMA_CxTR2 with a new value for any of TRIGSEL[6:0] or TRIGPOL[1:0], resets the monitoring, trashing the possible memorized hit of the formerly defined LLIn trigger.

Caution: After a first new trigger hitn+1 is memorized, if another trigger hitn+2 is detected and if the hitn triggered transfer is still not completed, hitn+2 is lost and not memorized. A trigger overrun flag is reported (GPDMA_CxSR.TOF = 1) and an interrupt is generated if enabled (if GPDMA_CxCR.TOIE = 1). The channel is not automatically disabled by hardware due to a trigger overrun.

Figure 88 illustrates the trigger hit, memorization and overrun in the configuration example with a block-level trigger mode and a rising edge trigger polarity.

Figure 88. Trigger hit, memorization, and overrun waveform

Timing diagram showing Channel state (IDLE to ACTIVE), Trigger signals, Peripheral request, DMA transfer (block transfer), Trigger monitoring state (Idle to Active), Trigger monitoring action (Hit and fire, Hit and memorize, Fire, Hit and trash), and Trigger overrun. A legend at the bottom defines the colors for hit actions: pink for Hit and trash, green for Hit and fire, and yellow for Hit and memorize.

The diagram illustrates the interaction between various signals over time. The 'Channel state' transitions from IDLE to ACTIVE. The 'Trigger' signal shows several rising edges. The 'Peripheral request' signal is active during data transfers. 'DMA transfer' is shown as three 'block transfer' periods. The 'Trigger monitoring state' shows the channel in 'Idle' before the first trigger hit, then in 'Active (monitoring)' during the first block transfer, and then in 'Active' during subsequent transfers. 'Trigger monitoring action' shows specific events: 'Hit and fire' (green) at the start of the first block transfer, 'Hit and memorize' (yellow) at the start of the second, 'Fire' (green) at the start of the third, 'Hit and trash' (pink) at the start of the fourth, and 'Fire' (green) at the start of the fifth. A 'Trigger overrun' pulse occurs when a trigger hit is detected while the channel is still monitoring the previous one.

Timing diagram showing Channel state (IDLE to ACTIVE), Trigger signals, Peripheral request, DMA transfer (block transfer), Trigger monitoring state (Idle to Active), Trigger monitoring action (Hit and fire, Hit and memorize, Fire, Hit and trash), and Trigger overrun. A legend at the bottom defines the colors for hit actions: pink for Hit and trash, green for Hit and fire, and yellow for Hit and memorize.

Note: The user can assign the same input trigger event to different channels. This can be used to trigger different channels on a broadcast trigger event.

16.4.13 GPDMA circular buffering with linked-list programming

GPDMA circular buffering for memory-to-peripheral and peripheral-to-memory transfers, with a linear addressing channel

For a circular buffering, with a continuous memory-to-peripheral (or peripheral-to-memory) transfer, the software must set up a channel with half-transfer and complete transfer

events/interrupts generation (GPDMA_CxCR.HTIE = 1 and GPDMA_CxCR.TCIE = 1), in order to enable a concurrent buffer software processing.

LLI0 is configured for the first block transfer with the linear addressing channel. A continuously-executed LLI1 is needed to restore the memory source (or destination) start address, for the memory-to-peripheral transfer (respectively the peripheral-to-memory transfer). GPDMA automatically reloads the initially programmed GPDMA_CxBR1.BNDT[15:0] when a block transfer is completed, and there is no need to restore GPDMA_CxBR1.

Figure 89 illustrates this programming with a linear addressing GPDMA channel and a source circular buffer.

Figure 89. GPDMA circular buffer programming: update of the memory start address with a linear addressing channel

Diagram illustrating GPDMA circular buffer programming with a linear addressing channel. The diagram shows a flow from a Reset input to an Init/LLI0 block, which then leads to a Restore SAR/LLI1 block. Both blocks are associated with Channel x. Two Req=PERIPH_TX signals are shown entering the flow. Below the flow, a Linked-list register file is shown containing LLI0 with fields DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, and DMA_CxLLR. A Memory block contains LLI1 with a DMA_CxSAR field. A connection from the DMA_CxLLR field in LLI0 points to the Memory block, with conditions CxLBA (LA = 0), USA = 1, and others Uxx = 0. The diagram is labeled MSv62640V1.
Diagram illustrating GPDMA circular buffer programming with a linear addressing channel. The diagram shows a flow from a Reset input to an Init/LLI0 block, which then leads to a Restore SAR/LLI1 block. Both blocks are associated with Channel x. Two Req=PERIPH_TX signals are shown entering the flow. Below the flow, a Linked-list register file is shown containing LLI0 with fields DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, and DMA_CxLLR. A Memory block contains LLI1 with a DMA_CxSAR field. A connection from the DMA_CxLLR field in LLI0 points to the Memory block, with conditions CxLBA (LA = 0), USA = 1, and others Uxx = 0. The diagram is labeled MSv62640V1.

Note: With a 2D addressing channel, the user may use a single LLI with GPDMA_CxBR1.BRC[10:0] = 1, and program a negative memory block address offset with GPDMA_CxBR2 and GPDMA_CxBR1, in order to jump back to the memory source or the destination start address.

If circular buffering must be executed after some other transfers over the shared GPDMA channel x, the before-last LLIN-1 in memory is needed to configure the first block transfer. And the last LLIN restores the memory source (or destination) start address in memory-to-peripheral transfer (respectively in peripheral-to-memory transfer).

Figure 90 illustrates this programming with a linear addressing shared GPDMA channel, and a source circular buffer.

Figure 90. Shared GPDMA channel with circular buffering: update of the memory start address with a linear addressing channel

Diagram of a shared GPDMA channel with circular buffering. The top part shows a sequence of LLI (Link List Item) blocks: Init/LLI0, LLI1, ..., LLIN-1, LLIN. A 'Reset' input points to the start. Yellow arrows labeled 'Req=PERIPH_TX' point to LLIN-1 and LLIN. Pink arrows labeled 'Ht+ tcf' point away from LLIN-1 and LLIN. The bottom part shows 'Memory' containing two LLI blocks, LLIN-2 and LLIN-1. LLIN-2 contains DMA_Cx... and DMA_CxLLR. LLIN-1 contains DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, and DMA_CxLLR. A line labeled 'All Uxx=1' connects the DMA_CxLLR of LLIN-2 to the DMA_CxSAR of LLIN-1. A line labeled 'LLIN' points to the DMA_CxLLR of LLIN-1. At the bottom right, text reads 'USA = 1, others Uxx = 0 LA+ = 0xC' and 'MSv62641V1'.
Diagram of a shared GPDMA channel with circular buffering. The top part shows a sequence of LLI (Link List Item) blocks: Init/LLI0, LLI1, ..., LLIN-1, LLIN. A 'Reset' input points to the start. Yellow arrows labeled 'Req=PERIPH_TX' point to LLIN-1 and LLIN. Pink arrows labeled 'Ht+ tcf' point away from LLIN-1 and LLIN. The bottom part shows 'Memory' containing two LLI blocks, LLIN-2 and LLIN-1. LLIN-2 contains DMA_Cx... and DMA_CxLLR. LLIN-1 contains DMA_CxTR1, DMA_CxTR2, DMA_CxBR1, DMA_CxSAR, DMA_CxDAR, and DMA_CxLLR. A line labeled 'All Uxx=1' connects the DMA_CxLLR of LLIN-2 to the DMA_CxSAR of LLIN-1. A line labeled 'LLIN' points to the DMA_CxLLR of LLIN-1. At the bottom right, text reads 'USA = 1, others Uxx = 0 LA+ = 0xC' and 'MSv62641V1'.

16.4.14 GPDMA transfer in peripheral flow-control mode

A peripheral with the peripheral flow-control mode feature can decide to early terminate a GPDMA block transfer, provided that the allocated channel is implemented with this feature (see Section 16.3.6).

If the related GPDMA channel x is also programmed in peripheral flow-control mode (GPDMA_CxTR2.PFREQ = 1):

In peripheral flow-control mode:

16.4.15 GPDMA secure/nonsecure channel

The GPDMA controller is compliant with the TrustZone hardware architecture at channel level, partitioning all its resources so that they exist in one of the secure and nonsecure worlds at any given time.

Any channel x is a secure or a nonsecure hardware resource, as configured by GPDMA_SECCFGR.SECx.

When a channel x is configured in secure state by a secure and privileged agent, the following access control rules are applied:

When a channel x is configured in secure state, a secure agent can configure separately as secure or nonsecure the GPDMA data transfer from the source (GPDMA_CxTR1.SSEC) and the GPDMA data transfer to the destination (GPDMA_CxTR1.DSEC).

When a channel x is configured in secure state and in linked-list mode, the loading of the next linked-list data structure from the GPDMA memory into its register file, is automatically performed with secure transfers via the GPDMA_CxCR.LAP allocated master port.

The GPDMA generates a secure bus that reflects GPDMA_SECCFGR, to keep the other peripherals informed of the secure/nonsecure state of each GPDMA channel x.

The GPDMA also generates a security illegal access pulse signal on an illegal nonsecure access to a secure GPDMA register. This signal is routed to the TrustZone interrupt controller.

When the secure software must switch a channel from a secure state to a nonsecure state, the secure software must abort the channel or wait until the secure channel is completed before switching. This is needed to dynamically re-allocate a channel to a next nonsecure transfer as a nonsecure software is not allowed to do so and must have GPDMA_CxCR.EN = 0 before the nonsecure software can reprogram the GPDMA_CxCR for a next transfer. The secure software may reset not only the channel x (GPDMA_CxCR.RESET = 1) but also the full channel x register file to its reset value.

16.4.16 GPDMA privileged/unprivileged channel

Any channel x is a privileged or unprivileged hardware resource, as configured by a privileged agent via GPDMA_PRIVCFGR.PRIVx.

When a channel x is configured in a privileged state by a privileged agent, the following access control rules are applied:

When a channel is configured in a privileged (or unprivileged) state, the source and destination data transfers are privileged (respectively unprivileged) transfers over the AHB master port.

When a channel is configured in a privileged (or unprivileged) state and in linked-list mode, the loading of the next linked-list data structure from the GPDMA memory into its register file, is automatically performed with privileged (respectively unprivileged) transfers, via the GPDMA_CxCR.LAP allocated master port.

The GPDMA generates a privileged bus that reflects GPDMA_PRIVCFGR, to keep the other peripherals informed of the privileged/unprivileged state of each GPDMA channel x.

When the privileged software must switch a channel from a privileged state to an unprivileged state, the privileged software must abort the channel or wait until that the privileged channel is completed before switching. This is needed to dynamically re-allocate a channel to a next unprivileged transfer as an unprivileged software is not allowed to do so, and must have GPDMA_CxCR.EN = 0 before the unprivileged software can reprogram the GPDMA_CxCR for a next transfer. The privileged software may reset not only the channel x (GPDMA_CxCR.RESET = 1) but also the full channel x register file to its reset value.

16.4.17 GPDMA error management

The GPDMA is able to manage and report to the user a transfer error, as follows, depending on the root cause.

Data transfer error

On a bus access (as a AHB single or a burst) to the source or the destination:

On a tentative update of a GPDMA channel register from the programmed LLI in the memory:

User setting error

On a tentative execution of a GPDMA transfer with an unauthorized user setting:

16.5 GPDMA in debug mode

When the microcontroller enters debug mode (core halted), any channel x can be individually either continued (default) or suspended, depending on the programmable control bit in the DBGMCU module.

Note: In debug mode, GPDMA_CxSR.SUSPF is not altered by a suspension from the programmable control bit in the DBGMCU module. In this case, GPDMA_CxSR.IDLEF can be checked to know the completion status of the channel suspension.

16.6 GPDMA in low-power modes

Table 135. Effect of low-power modes on GPDMA

ModeDescription
SleepNo effect. GPDMA interrupts cause the device to exit Sleep mode.
Stop(1)The content of the GPDMA registers is kept when entering Stop mode.
StandbyThe GPDMA is powered down and must be reinitialized after exiting Standby mode.

1. Refer to Section 16.3.3 to know if any Stop mode is supported.

16.7 GPDMA interrupts

There is one GPDMA interrupt line for each channel, and separately for each CPU (if several ones in the devices).

Table 136. GPDMA interrupt requests

Interrupt acronymInterrupt eventInterrupt enableEvent flagEvent clear method
GPDMA_CHxTransfer completeGPDMA_CxCR.TCIEGPDMA_CxSR.TCFWrite 1 to GPDMA_CxFCR.TCF
Half transferGPDMA_CxCR.HTIEGPDMA_CxSR.HTFWrite 1 to GPDMA_CxFCR.HTF
Data transfer errorGPDMA_CxCR.DTEIEGPDMA_CxSR.DTEFWrite 1 to GPDMA_CxFCR.DTEF
Update link errorGPDMA_CxCR.ULEIEGPDMA_CxSR.ULEFWrite 1 to GPDMA_CxFCR.ULEF
User setting errorGPDMA_CxCR.USEIEGPDMA_CxSR.USEFWrite 1 to GPDMA_CxFCR.USEF
SuspendedGPDMA_CxCR.SUSPIEGPDMA_CxSR.SUSPFWrite 1 to GPDMA_CxFCR.SUSPF
Trigger overrunGPDMA_CxCR.TOFIEGPDMA_CxSR.TOFWrite 1 to GPDMA_CxFCR.TOF

A GPDMA channel x event may be:

Note: When a channel x transfer complete event occurs, the output signal gpdma_chx_tc is generated as a high pulse of one clock cycle.

An interrupt is generated following any xx event, provided that both:

TCF (transfer complete) and HTF (half transfer) events generation is controlled by GPDMA_CxTR2.TCEM[1:0] as follows:

See GPDMA channel x transfer register 2 (GPDMA_CxTR2) for more details.

A transfer error rises in one of the following situations:

A trigger overrun is described in Trigger hit memorization and trigger overrun flag generation.

16.8 GPDMA registers

The GPDMA registers must be accessed with an aligned 32-bit word data access.

16.8.1 GPDMA secure configuration register (GPDMA_SECCFGR)

Address offset: 0x00

Reset value: 0x0000 0000

A write access to this register must be secure and privileged. A read access is secure or nonsecure, privileged or unprivileged.

A write access is ignored at bit level if the corresponding channel x is locked (GPDMA_RCFGLOCKR.LOCKx = 1).

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1.

This register must be programmed at a bit level, at the initialization/closure of a GPDMA channel (when GPDMA_CxCR.EN = 0), to securely allocate individually any channel x to the secure or nonsecure world.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.SEC11SEC10SEC9SEC8SEC7SEC6SEC5SEC4SEC3SEC2SEC1SEC0
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:12 Reserved, must be kept at reset value.

Bits 11:0 SECx: secure state of channel x (x = 11 to 0)
0: Nonsecure
1: Secure

16.8.2 GPDMA privileged configuration register (GPDMA_PRIVCFGR)

Address offset: 0x04

Reset value: 0x0000 0000

A write access to this register must be privileged. A read access can be privileged or unprivileged, secure or nonsecure.

This register can mix secure and nonsecure information. If a channel x is configured as secure (GPDMA_SECCFGR.SECx = 1), the PRIVx bit can be written only by a secure (and privileged) agent.

A write access is ignored at bit level if the corresponding channel x is locked (GPDMA_RCFGLOCKR.LOCKx = 1).

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1.

This register must be programmed at a bit level, at the initialization/closure of a GPDMA channel (GPDMA_CxCR.EN = 0), to individually allocate any channel x to the privileged or unprivileged world.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.PRIV11PRIV10PRIV9PRIV8PRIV7PRIV6PRIV5PRIV4PRIV3PRIV2PRIV1PRIV0
rwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:12 Reserved, must be kept at reset value.

Bits 11:0 PRIVx: privileged state of channel x (x = 11 to 0)
0: unprivileged
1: privileged

16.8.3 GPDMA configuration lock register (GPDMA_RCFGLOCKR)

Address offset: 0x08

Reset value: 0x0000 0000

This register can be written by a software agent with secure privileged attributes in order to individually lock, for example at boot time, the secure privileged attributes of any GPDMA

channel/resource (to lock the setting of GPDMA_CxSECCFGR, GPDMA_CxPRIVCFGR for any channel x, for example at boot time).

A read access may be privileged or unprivileged, secure or nonsecure.

Note: If TZEN = 0, this register cannot be written.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.LOCK1
1
LOCK1
0
LOCK9LOCK8LOCK7LOCK6LOCK5LOCK4LOCK3LOCK2LOCK1LOCK0
rsrsrsrsrsrsrsrsrsrsrsrs

Bits 31:12 Reserved, must be kept at reset value.

Bits 11:0 LOCKx: lock the configuration of GPDMA_SECCFGR.SECx, GPDMA_PRIVCFGR.PRIVx until a global GPDMA reset (x = 11 to 0)

This bit is cleared after reset and, once set, it cannot be reset until a global GPDMA reset.

0: secure privilege configuration of the channel x is writable.

1: secure privilege configuration of the channel x is not writable.

16.8.4 GPDMA nonsecure masked interrupt status register (GPDMA_MISR)

Address offset: 0x0C

Reset value: 0x0000 0000

This register is a read register.

This is a nonsecure register, containing the masked interrupt status bit MISx for each nonsecure channel x (channel x configured with GPDMA_SECCFGR.SECx = 0). It is a logical OR of all the flags of GPDMA_CxSR, each source flag being enabled by the corresponding interrupt enable bit of GPDMA_CxCR.

Every bit is deasserted by hardware when writing 1 to the corresponding flag clear bit in GPDMA_CxFCR.

If a channel x is in secure state (GPDMA_SECCFGR.SECx = 1), a read access to the masked interrupt status bit MISx of this channel x returns zero.

This register may mix privileged and unprivileged information, depending on the privileged state of each channel GPDMA_PRIVCFGR.PRIVx. A privileged software can read the full nonsecure interrupt status. An unprivileged software is restricted to read the status of unprivileged (and nonsecure) channels, other privileged bit fields returning zero.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.MIS11MIS10MIS9MIS8MIS7MIS6MIS5MIS4MIS3MIS2MIS1MIS0
rrrrrrrrrrrr

Bits 31:12 Reserved, must be kept at reset value.

Bits 11:0 MISx: masked interrupt status of channel x (x = 11 to 0)
0: no interrupt occurred on channel x
1: an interrupt occurred on channel x

16.8.5 GPDMA secure masked interrupt status register (GPDMA_SMISR)

Address offset: 0x10

Reset value: 0x0000 0000

This is a secure read register, containing the masked interrupt status bit MISx for each secure channel x (GPDMA_SECCFGR.SECx = 1). It is a logical OR of all the GPDMA_CxSR flags, each source flag being enabled by the corresponding GPDMA_CxCR interrupt enable bit.

Every bit is deasserted by hardware when securely writing 1 to the corresponding GPDMA_CxCR flag clear bit.

This register does not contain any information about a nonsecure channel.

This register can mix privileged and unprivileged information, depending on the privileged state of each channel GPDMA_PRIVCFGR.PRIVx. A privileged software can read the full secure interrupt status. An unprivileged software is restricted to read the status of unprivileged and secure channels, other privileged bit fields returning zero.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.MIS11MIS10MIS9MIS8MIS7MIS6MIS5MIS4MIS3MIS2MIS1MIS0
rrrrrrrrrrrr

Bits 31:12 Reserved, must be kept at reset value.

Bits 11:0 MISx: masked interrupt status of the secure channel x (x = 11 to 0)
0: no interrupt occurred on the secure channel x
1: an interrupt occurred on the secure channel x

16.8.6 GPDMA channel x linked-list base address register (GPDMA_CxLBAR)

Address offset: 0x50 + 0x80 * x (x = 0 to 11)

Reset value: 0x0000 0000

This register must be written by a privileged software. It is either privileged readable or not, depending on the privileged state of the channel x GPDMA_PRIVCFGR.PRIVx.

This register is either secure or nonsecure depending on the secure state of the channel x (GPDMA_SECCFGR.SECx).

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1.

This channel-based register is the linked-list base address of the memory region, for a given channel x, from which the LLIs describing the programmed sequence of the GPDMA transfers, are conditionally and automatically updated.

This 64-Kbyte aligned channel x linked-list base address is offset by the 16-bit GPDMA_CxLLR register that defines the word-aligned address offset for each LLI.

31302928272625242322212019181716
LBA[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.

Bits 31:16 LBA[31:16]: linked-list base address of GPDMA channel x

Bits 15:0 Reserved, must be kept at reset value.

16.8.7 GPDMA channel x flag clear register (GPDMA_CxFCR)

Address offset: 0x5C+ 0x80 * x (x = 0 to 11)

Reset value: 0x0000 0000

This is a write register, secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx) and privileged or unprivileged, depending on the privileged state of the channel x (GPDMA_PRIVCFGR.PRIVx).

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.TOFSUSPFUSEFULEFDTEFHTFTCFRes.Res.Res.Res.Res.Res.Res.Res.
wwwwwww

Bits 31:15 Reserved, must be kept at reset value.

Bit 14 TOF: trigger overrun flag clear

0: no effect

1: corresponding TOF flag cleared

Bit 13 SUSPF: completed suspension flag clear

0: no effect

1: corresponding SUSPF flag cleared

Bit 12 USEF: user setting error flag clear

0: no effect

1: corresponding USEF flag cleared

Bit 11 ULEF: update link transfer error flag clear

0: no effect

1: corresponding ULEF flag cleared

Bit 10 DTEF: data transfer error flag clear
0: no effect
1: corresponding DTEF flag cleared

Bit 9 HTF: half-transfer flag clear
0: no effect
1: corresponding HTF flag cleared

Bit 8 TCF: transfer complete flag clear
0: no effect
1: corresponding TCF flag cleared

Bits 7:0 Reserved, must be kept at reset value.

16.8.8 GPDMA channel x status register (GPDMA_CxSR)

Address offset: 0x60+0x80*x (x = 0 to 11)

Reset value: 0x0000 0001

This is a read register, reporting the channel status.

This register is secure or nonsecure, depending on the secure state of channel x (GPDMA_SECCFGR.SECx), and privileged or unprivileged, depending on the privileged state of the channel (GPDMA_PRIVCFGR.PRIVx).

16.8.8column_2Bit 10 Bit 9 Bit 8DTEF HTF TCF0: no effect 0: no effect 0: no effectcolumn_6column_7column_8column_9column_10column_11column_12column_13column_14column_15RM0517
31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.FIFOL[7:0]
rrrrrrrr
1514131211109876543210
Res.TOF SUSPF USEF ULEF DTEFHTFTCFRes.Res.Res.Res.Res.Res.Res.IDLEF
rrrrrrrr
Bits 23:16FIFOL[7:0]: monitored FIFO level
Bit 14TOF : trigger overrun flag
Bit 13SUSPF: completed suspension flag
Bit 12USEF : user setting error flag

Bits 31:24 Reserved, must be kept at reset value.

Bits 23:16 FIFOL[7:0]: monitored FIFO level

Number of available write beats in the FIFO, in units of the programmed destination data width (see GPDMA_CxTR1.DDW_LOG2[1:0], in units of bytes, half-words, or words).

Note: After having suspended an active transfer, the user may need to read FIFOL[7:0], additionally to GPDMA_CxBR1.BDNT[15:0] and GPDMA_CxBR1.BRC[10:0], to know how many data have been transferred to the destination. Before reading, the user may wait for the transfer to be suspended (GPDMA_CxSR.SUSPF = 1).

Bit 15 Reserved, must be kept at reset value.

Bit 14 TOF: trigger overrun flag
0: no trigger overrun event
1: a trigger overrun event occurred

Bit 13 SUSPF: completed suspension flag
0: no completed suspension event
1: a completed suspension event occurred

Bit 12 USEF: user setting error flag
0: no user setting error event
1: a user setting error event occurred

16.8.9 GPDMA channel x control register (GPDMA_CxCR)

Address offset: 0x64 + 0x80 * x (x = 0 to 11)

Reset value: 0x0000 0000

This register is secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx), and privileged or unprivileged, depending on the privileged state of the channel x (GPDMA_PRIVCFGR.PRIVx).

This register is used to control a channel (activate, suspend, abort or disable it).

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.PRIO[1:0]Res.Res.Res.Res.LAPLSM
rwrwrwrw
1514131211109876543210
Res.TOIESUSPIEUSEIEULEIEDTEIEHTIETCIERes.Res.Res.Res.Res.SUSPRESETEN
rwrwrwrwrwrwrwrwwrw

Bits 31:24 Reserved, must be kept at reset value.

Bits 23:22 PRIO[1:0]: priority level of the channel x GPDMA transfer versus others

Note: This bit must be written when EN = 0. This bit is read-only when EN = 1.

Bits 21:18 Reserved, must be kept at reset value.

Bit 17 LAP: linked-list allocated port

This bit is used to allocate the master port for the update of the GPDMA linked-list registers from the memory.

Note: This bit must be written when EN = 0. This bit is read-only when EN = 1.

Bit 16 LSM: Link step mode

First the (possible 1D/repeated) block transfer is executed as defined by the current internal register file until GPDMA_CxBR1.BNDT[15:0] = 0 and GPDMA_CxBR1.BRC[10:0] = 0. Secondly the next linked-list data structure is conditionally uploaded from memory as defined by GPDMA_CxLLR. Then channel execution is completed.

Note: This bit must be written when EN = 0. This bit is read-only when EN = 1.

Bit 15 Reserved, must be kept at reset value.

Bit 14 TOIE: trigger overrun interrupt enable

Bit 13 SUSPIE: completed suspension interrupt enable

Bit 12 USEIE: user setting error interrupt enable

Bit 11 ULEIE: update link transfer error interrupt enable

Bit 10 DTEIE: data transfer error interrupt enable

Bit 9 HTIE: half-transfer complete interrupt enable

Bit 8 TCIE: transfer complete interrupt enable

Bits 7:3 Reserved, must be kept at reset value.

Bit 2 SUSP: suspend

Writing 1 into the field RESET (bit 1) causes the hardware to de-assert this bit, whatever is written into this bit 2. Else:

Software must write 1 in order to suspend an active channel (channel with an ongoing GPDMA transfer over its master ports).

The software must write 0 in order to resume a suspended channel, following the programming sequence detailed in Figure 72.

Bit 1 RESET: reset

This bit is write only. Writing 0 has no impact. Writing 1 implies the reset of the following: the FIFO, the channel internal state, SUSP and EN bits (whatever is written receptively in bit 2 and bit 0).

The reset is effective when the channel is in steady state, meaning one of the following:

After writing a RESET, to continue using this channel, the user must explicitly reconfigure the channel including the hardware-modified configuration registers (GPDMA_CxBR1, GPDMA_CxSAR, and GPDMA_CxDAR) before enabling again the channel (see the programming sequence in Figure 73).

Bit 0 EN: enable

Writing 1 into the field RESET (bit 1) causes the hardware to de-assert this bit, whatever is written into this bit 0. Else:

this bit is deasserted by hardware when there is a transfer error (master bus error or user setting error) or when there is a channel transfer complete (channel ready to be configured, for example if LSM = 1 at the end of a single execution of the LLI).

Else, this bit can be asserted by software.

Writing 0 into this EN bit is ignored.

16.8.10 GPDMA channel x transfer register 1 (GPDMA_CxTR1)

Address offset: 0x90+0x80*x (x = 0 to 11)

Reset value: 0x0000 0000

This register is secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx) except for secure DSEC and SSEC, privileged or unprivileged, depending on the privileged state of the channel x in GPDMA_PRIVCFGR.PRIVx.

This register controls the transfer of a channel x.

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1.

This register must be written when the channel is completed. Then the hardware has deasserted GPDMA_CxCR.EN). A channel transfer can be completed and programmed at different levels: block, 2D/repeated block, LLI or full linked-list.

In linked-list mode, during the link transfer, this register is automatically updated by GPDMA from the memory if GPDMA_CxLLR.UT1 = 1.

31302928272625242322212019181716
DSECDAPRes.Res.DHXDBXDBL_1[5:0]DINCRes.DDW_LOG2[1:0]
rwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
SSECSAPSBXPAM[1:0]Res.SBL_1[5:0]SINCRes.SDW_LOG2[1:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 DSEC: security attribute of the GPDMA transfer to the destination

If GPDMA_SECCFGR.SECx = 1 and the access is secure:

0: GPDMA transfer nonsecure

1: GPDMA transfer secure

This is a secure register bit. This bit can only be read by a secure software. This bit must be written by a secure software when GPDMA_SECCFGR.SECx = 1. A secure write is ignored when GPDMA_SECCFGR.SECx = 0.

When GPDMA_SECCFGR.SECx is deasserted, this DSEC bit is also deasserted by hardware (on a secure reconfiguration of the channel as nonsecure), and the GPDMA transfer to the destination is nonsecure.

Bit 30 DAP: destination allocated port

This bit is used to allocate the master port for the destination transfer

0: port 0 (AHB) allocated

1: port 1 (AHB) allocated

Note: This bit must be written when EN = 0. This bit is read-only when EN = 1.

Bits 29:28 Reserved, must be kept at reset value.

Bit 27 DHX: destination half-word exchange

If the destination data size is shorter than a word, this bit is ignored.

If the destination data size is a word:

0: no halfword-based exchanged within word

1: the two consecutive (post PAM) half-words are exchanged in each destination word.

Bit 26 DBX: destination byte exchange

If the destination data size is a byte, this bit is ignored.

If the destination data size is not a byte:

0: no byte-based exchange within half-word

1: the two consecutive (post PAM) bytes are exchanged in each destination half-word.

Bits 25:20 DBL_1[5:0]: destination burst length minus 1, between 0 and 63

The burst length unit is one data named beat within a burst. If DBL_1[5:0] = 0, the burst can be named as single. Each data/beat has a width defined by the destination data width DDW_LOG2[1:0].

Note: If a burst transfer crossed a 1-Kbyte address boundary on a AHB transfer, the GPDMA modifies and shortens the programmed burst into singles or bursts of lower length, to be compliant with the AHB protocol.

If a burst transfer is of length greater than the FIFO size of the channel x, the GPDMA modifies and shortens the programmed burst into singles or bursts of lower length, to be compliant with the FIFO size. Transfer performance is lower, with GPDMA re-arbitration between effective and lower singles/bursts, but the data integrity is guaranteed.

Bit 19 DINC: destination incrementing burst

0: fixed burst

1: contiguously incremented burst

The destination address, pointed by GPDMA_CxDAR, is kept constant after a burst beat/single transfer, or is incremented by the offset value corresponding to a contiguous data after a burst beat/single transfer.

Bit 18 Reserved, must be kept at reset value.

Bits 17:16 DDW_LOG2[1:0]: binary logarithm of the destination data width of a burst, in bytes

00: byte

01: half-word (2 bytes)

10: word (4 bytes)

11: user setting error reported and no transfer issued

Note: A destination burst transfer must have an aligned address with its data width (start address GPDMA_CxDAR[2:0] and if present address offset GPDMA_CxTR3.DAO[2:0], versus DDW_LOG2[1:0]). Otherwise a user setting error is reported and no transfer is issued.

When configured in packing mode (PAM[1] = 1 and destination data width different from source data width), a source block size must be a multiple of the destination data width (see GPDMA_CxBR1.BNDT[2:0] versus DDW_LOG2[1:0]). Else a user setting error is reported and none transfer is issued.

Setting a 8-byte data width causes a user setting error to be reported and none transfer is issued.

Bit 15 SSEC: security attribute of the GPDMA transfer from the source

If GPDMA_SECCFGR.SECx = 1 and the access is secure:

0: GPDMA transfer nonsecure

1: GPDMA transfer secure

This is a secure register bit. This bit can only be read by a secure software. This bit must be written by a secure software when GPDMA_SECCFGR.SECx = 1. A secure write is ignored when GPDMA_SECCFGR.SECx = 0.

When GPDMA_SECCFGR.SECx is deasserted, this SSEC bit is also deasserted by hardware (on a secure reconfiguration of the channel as nonsecure), and the GPDMA transfer from the source is nonsecure.

Bit 14 SAP: source allocated port

This bit is used to allocate the master port for the source transfer

0: port 0 (AHB) allocated

1: port 1 (AHB) allocated

Note: This bit must be written when EN = 0. This bit is read-only when EN = 1.

Bits 1:0 SDW_LOG2[1:0]: binary logarithm of the source data width of a burst in bytes

00: byte

01: half-word (2 bytes)

10: word (4 bytes)

11: user setting error reported and no transfer issued

Note: A source block size must be a multiple of the source data width

(GPDMA_CxBR1.BNDT[2:0] versus SDW_LOG2[1:0]). Otherwise, a user setting error is reported and no transfer is issued.

A source burst transfer must have an aligned address with its data width (start address GPDMA_CxSAR[2:0] versus SDW_LOG2[1:0]). Otherwise, a user setting error is reported and none transfer is issued.

Setting a 8-byte data width causes a user setting error to be reported and no transfer is issued.

16.8.11 GPDMA channel x transfer register 2 (GPDMA_CxTR2)

Address offset: 0x94+0x80*x (x = 0 to 11)

Reset value: 0x0000 0000

This register is secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx), and privileged or unprivileged, depending on the privileged state of channel x (GPDMA_PRIVCFGR.PRIVx).

This register controls the transfer of a channel x. This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1.

This register must be written when the channel is completed (the hardware deasserted GPDMA_CxCR.EN). A channel transfer can be completed and programmed at different levels: block or LLI or full linked-list.

In linked-list mode, during the link transfer, this register is automatically updated by GPDMA from the memory, if GPDMA_CxLLR.UT2 = 1.

31302928272625242322212019181716
TCEM[1:0]Res.Res.Res.Res.TRIGPOL[1:0]Res.TRIGSEL[6:0]
rwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
TRIGM[1:0]Res.PFREQBREQDREQSWREQRes.REQSEL[7:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:30 TCEM[1:0]: transfer complete event mode

These bits define the transfer granularity for the transfer complete and half-transfer complete events generation.

00: at block level (when GPDMA_CxBR1.BNDT[15:0] = 0): the complete (and the half) transfer event is generated at the (respectively half of the) end of a block.

Note: If the initial LLI0 data transfer is null/void (directly programmed by the internal register file with GPDMA_CxBR1.BNDT[15:0] = 0), then neither the complete transfer event nor the half-transfer event is generated.

01: channel x (x = 0 to 9), same as 00, channel x (x = 10 to 11), at 2D/repeated block level (when GPDMA_CxBR1.BRC[10:0] = 0 and GPDMA_CxBR1.BNDT[15:0] = 0). The complete (and the half) transfer event is generated at the end (respectively half of the end) of the 2D/repeated block.

Note: If the initial LLI0 data transfer is null/void (directly programmed by the internal register file with GPDMA_CxBR1.BNDT[15:0] = 0), then neither the complete transfer event nor the half-transfer event is generated.

10: at LLI level: the complete transfer event is generated at the end of the LLI transfer, including the update of the LLI if any. The half-transfer event is generated at the half of the LLI data transfer. The LLI data transfer is a block transfer or a 2D/repeated block transfer for channel x (x = 10 to 11), if any data transfer.

Note: If the initial LLI0 data transfer is null/void (directly programmed by the internal register file with GPDMA_CxBR1.BNDT[15:0] = 0), then the half-transfer event is not generated, and the transfer complete event is generated when is completed the loading of the LLI1.

11: at channel level: the complete transfer event is generated at the end of the last LLI transfer. The half-transfer event is generated at the half of the data transfer of the last LLI. The last LLI updates the link address GPDMA_CxLLR.LA[15:2] to zero and clears all the GPDMA_CxLLR update bits (UT1, UT2, UB1, USA, UDA and ULL, plus UT3 and UB2). If the channel transfer is continuous/infinite, no event is generated.

Bits 29:26 Reserved, must be kept at reset value.

Bits 25:24 TRIGPOL[1:0]: trigger event polarity

These bits define the polarity of the selected trigger event input defined by TRIGSEL[6:0].

00: no trigger (masked trigger event)

01: trigger on the rising edge

10: trigger on the falling edge

11: same as 00

Bit 23 Reserved, must be kept at reset value.

Bits 22:16 TRIGSEL[6:0]: trigger event input selection

These bits select the trigger event input of the GPDMA transfer (as per Section 16.3.7), with an active trigger event if TRIGPOL[1:0] ≠ 00.

Bits 15:14 TRIGM[1:0]: trigger mode

These bits define the transfer granularity for its conditioning by the trigger.

If the channel x is enabled (GPDMA_CxCR.EN asserted) with TRIGPOL[1:0] = 00 or 11, these TRIGM[1:0] bits are ignored.

Else, a GPDMA transfer is conditioned by one trigger hit:

00: at block level: the first burst read of each block transfer is conditioned by one hit trigger (channel x (x = 10 to 11): same, each block also if a 2D/repeated block is configured with GPDMA_CxBR1.BRC[10:0] ≠ 0).

01: channel x (x = 0 to 9): same as 00; channel x (x = 10 to 11): at 2D/repeated block level: the first burst read of the 2D/repeated block transfer is conditioned by one hit trigger.

10: at link level: a LLI link transfer is conditioned by one hit trigger. LLI data transfer is not conditioned.

11: at programmed burst level: If SWREQ = 1, each programmed burst read is conditioned by one hit trigger. If SWREQ = 0, each programmed burst that is requested by the selected peripheral, is conditioned by one hit trigger:

– If the peripheral is the source (DREQ = 0) of the LLI data transfer, each programmed burst read is conditioned.

– If the peripheral is the destination (DREQ = 1) of the LLI data transfer, each programmed burst write is conditioned. The first memory burst read of a (possibly 2D/repeated) block, also named as the first ready FIFO-based source burst, is gated by the occurrence of both the hardware request and one trigger hit.

As shown in Figure 88: Trigger hit, memorization, and overrun waveform, the GPDMA monitoring of a trigger for channel x is started when the channel is enabled/loaded with a new active trigger configuration: rising or falling edge on a selected trigger (TRIGPOL[1:0] = 01 or respectively TRIGPOL[1:0] = 10). The monitoring of this trigger is kept active during the triggered and uncompleted (data or link) transfer; and if a new trigger is detected then, this hit is internally memorized to grant the next transfer, as long as the defined rising or falling edge is not modified, and the TRIGSEL[6:0] is not modified, and the channel is enabled. After a first new trigger hitn+1 is memorized, if another second trigger hitn+2 is detected and if the hitn triggered transfer is still not completed, hitn+2 is lost and not memorized. A trigger overrun flag is reported (GPDMA_CxSR.TOF = 1), and an interrupt is generated if enabled (GPDMA_CxCR.TOIE = 1). The channel is not automatically disabled by hardware due to a trigger overrun.

Transferring a next LLIn+1 that updates the GPDMA_CxTR2 with a new value for any of TRIGSEL[6:0] or TRIGPOL[1:0], resets the monitoring, trashing the memorized hit of the formerly defined LLIn trigger.

Note: When the source block size is not a multiple of the source burst size and is a multiple of the source data width, then the last programmed source burst is not completed and is internally shorten to match the block size. In this case, if TRIGM[1:0] = 11 and (SWREQ = 1 or (SWREQ = 0 and DREQ = 0)), the shortened burst transfer (by singles or/and by bursts of lower length) is conditioned once by the trigger.

When the programmed destination burst is internally shortened by singles or/and by bursts of lower length (versus FIFO size, versus block size, 1-Kbyte boundary address crossing): if the trigger is conditioning the programmed destination burst (if TRIGM[1:0] = 11 and SWREQ = 0 and DREQ = 1), this shortened destination burst transfer is conditioned once by the trigger.

Bit 13 Reserved, must be kept at reset value.

Bit 12 PFREQ: Hardware request in peripheral flow control mode

Important: If a given channel x is not implemented with this feature, this bit is reserved and PFREQ is not present (see Section 16.3.2 for the list of the implemented channels with this feature).

If the channel x is activated (GPDMA_CxCR.EN asserted) with SWREQ = 1 (software request for a memory-to-memory transfer), this bit is ignored. Else:

0: the selected hardware request is driven by a peripheral with a hardware request/acknowledge protocol in GPDMA control mode. The GPDMA is programmed with GPDMA_CxTR1.BNDT[15:0] and this is internally used by the hardware for the block transfer completion.

1: the selected hardware request is driven by a peripheral with a hardware request/acknowledge protocol in peripheral control mode. The GPDMA block transfer can be early completed by the peripheral itself (see Section 16.3.6 for more details).

Note: In peripheral flow control mode, there are the following restrictions:

Bit 11 BREQ: Block hardware request

If the channel x is activated (GPDMA_CxCR.EN asserted) with SWREQ = 1 (software request for a memory-to-memory transfer), this bit is ignored. Else:

0: the selected hardware request is driven by a peripheral with a hardware request/acknowledge protocol at a burst level.

1: the selected hardware request is driven by a peripheral with a hardware request/acknowledge protocol at a block level (see Section 16.3.4).

Bit 10 DREQ: destination hardware request

This bit is ignored if channel x is activated (GPDMA_CxCR.EN asserted) with SWREQ = 1 (software request for a memory-to-memory transfer). Else:

0: selected hardware request driven by a source peripheral (request signal taken into account by the GPDMA transfer scheduler over the source/read port)

1: selected hardware request driven by a destination peripheral (request signal taken into account by the GPDMA transfer scheduler over the destination/write port)

Note: If the channel x is activated (GPDMA_CxCR.EN is asserted) with SWREQ = 0 and PFREQ = 1 (peripheral hardware request with peripheral flow-control mode), any software assertion to this DREQ bit is ignored: in peripheral flow-control mode, only a peripheral-to-memory transfer is supported.

Bit 9 SWREQ: software request

This bit is internally taken into account when GPDMA_CxCR.EN is asserted.

0: no software request. The selected hardware request REQSEL[7:0] is taken into account.

1: software request for a memory-to-memory transfer. The default selected hardware request as per REQSEL[7:0] is ignored.

Bit 8 Reserved, must be kept at reset value.

Bits 7:0 REQSEL[7:0]: GPDMA hardware request selection

These bits are ignored if channel x is activated (GPDMA_CxCR.EN asserted) with SWREQ = 1 (software request for a memory-to-memory transfer). Else, the selected hardware request is internally taken into account as per Section 16.3.4.

Caution: The user must not assign a same input hardware request (same REQSEL[7:0] value) to different active GPDMA channels (GPDMA_CxCR.EN = 1 and GPDMA_CxTR2.SWREQ = 0 for these channels). GPDMA is not intended to hardware support the case of simultaneous enabled channels incorrectly configured with a same hardware peripheral request signal, and there is no user setting error reporting.

16.8.12 GPDMA channel x block register 1 (GPDMA_CxBR1)

Address offset: 0x98 + 0x80 * x (x = 0 to 9)

Reset value: 0x0000 0000

This register is secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx), and privileged or unprivileged, depending on the privileged state of channel x (GPDMA_PRIVCFGR.PRIVx).

This register controls the transfer of a channel x at a block level.

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1.

This register must be written when channel x is completed (then the hardware has deasserted GPDMA_CxCR.EN). A channel transfer can be completed and programmed at different levels: block, or LLI or full linked-list.

In linked-list mode, during the link transfer:

31302928272625242322212019181716
ResResResResResResResResResResResResResResResRes
1514131211109876543210
BNDT[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:16 Reserved, must be kept at reset value.

ST logo
ST logo

Bits 15:0 BNDT[15:0]: block number of data bytes to transfer from the source

Block size transferred from the source. When the channel is enabled, this field becomes read-only and is decremented, indicating the remaining number of data items in the current source block to be transferred. BNDT[15:0] is programmed in number of bytes, maximum source block size is 64 Kbytes -1.

Once the last data transfer is completed (BNDT[15:0] = 0):

Note: A non-null source block size must be a multiple of the source data width (BNDT[2:0] versus GPDMA_CxTR1.SDW_LOG2[1:0]). Else a user setting error is reported and no transfer is issued.

When configured in packing mode (GPDMA_CxTR1.PAM[1] = 1 and destination data width different from source data width), a non-null source block size must be a multiple of the destination data width (BNDT[2:0] versus GPDMA_CxTR1.DDW_LOG2[1:0]). Else a user setting error is reported and no transfer is issued.

16.8.13 GPDMA channel x alternate block register 1 (GPDMA_CxBR1)

Address offset: 0x98 + 0x80 * x (x = 10 to 11)

Reset value: 0x0000 0000

This register is secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx), and privileged or unprivileged, depending on the privileged state of channel x (GPDMA_PRIVCFGR.PRIVx).

This register controls the transfer of a channel x at a block level.

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1.

This register must be written when channel x is completed (then the hardware has deasserted GPDMA_CxCR.EN). A channel transfer can be completed and programmed at different levels: block, or LLI or full linked-list.

In linked-list mode, during the link transfer:

automatically and internally restored with the programmed value for the fields BNDT[15:0] and BRC[10:0] after each execution of this final LLI

31302928272625242322212019181716
BRDDECBRSDECDDECSDECRes.BRC[10:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
BNDT[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bit 31 BRDDEC: Block repeat destination address decrement

0: at the end of a block transfer, the GPDMA_CxDAR register is updated by adding the programmed offset GPDMA_CxBR2.BRDAO to the current GPDMA_CxDAR value (current destination address)

1: at the end of a block transfer, the GPDMA_CxDAR register is updated by subtracting the programmed offset GPDMA_CxBR2.BRDAO from the current GPDMA_CxDAR value (current destination address)

Note: On top of this increment/decrement (depending on BRDDEC), GPDMA_CxDAR is in the same time also updated by the increment/decrement (depending on DDEC) of the GPDMA_CxTR3.DAO value, as it is usually done at the end of each programmed burst transfer.

Bit 30 BRSDEC: Block repeat source address decrement

0: at the end of a block transfer, the GPDMA_CxSAR register is updated by adding the programmed offset GPDMA_CxBR2.BRSAO to the current GPDMA_CxSAR value (current source address)

1: at the end of a block transfer, the GPDMA_CxSAR register is updated by subtracting the programmed offset GPDMA_CxBR2.BRSAO from the current GPDMA_CxSAR value (current source address)

Note: On top of this increment/decrement (depending on BRSDEC), GPDMA_CxSAR is in the same time also updated by the increment/decrement (depending on SDEC) of the GPDMA_CxTR3.SAO value, as it is done after any programmed burst transfer.

Bit 29 DDEC: destination address decrement

0: At the end of a programmed burst transfer to the destination, the GPDMA_CxDAR register is updated by adding the programmed offset GPDMA_CxTR3.DAO to the current GPDMA_CxDAR value (current destination address)

1: At the end of a programmed burst transfer to the destination, the GPDMA_CxDAR register is updated by subtracting the programmed offset GPDMA_CxTR3.DAO to the current GPDMA_CxDAR value (current destination address)

Bit 28 SDEC: source address decrement

0: At the end of a programmed burst transfer from the source, the GPDMA_CxSAR register is updated by adding the programmed offset GPDMA_CxTR3.SAO to the current GPDMA_CxSAR value (current source address)

1: At the end of a programmed burst transfer from the source, the GPDMA_CxSAR register is updated by subtracting the programmed offset GPDMA_CxTR3.SAO to the current GPDMA_CxSAR value (current source address)

Bit 27 Reserved, must be kept at reset value.

Bits 26:16 BRC[10:0]: Block repeat counter

This field contains the number of repetitions of the current block (0 to 2047).

When the channel is enabled, this field becomes read-only. After decrements, this field indicates the remaining number of blocks, excluding the current one. This counter is hardware decremented for each completed block transfer.

Once the last block transfer is completed (BRC[10:0] = BNDT[15:0] = 0):

Bits 15:0 BNDT[15:0]: block number of data bytes to transfer from the source

Block size transferred from the source. When the channel is enabled, this field becomes read-only and is decremented, indicating the remaining number of data items in the current source block to be transferred. BNDT[15:0] is programmed in number of bytes, maximum source block size is 64 Kbytes -1.

Once the last data transfer is completed (BNDT[15:0] = 0):

Note: A non-null source block size must be a multiple of the source data width (BNDT[2:0] versus GPDMA_CxTR1.SDW_LOG2[1:0]). Else a user setting error is reported and no transfer is issued.

When configured in packing mode (GPDMA_CxTR1.PAM[1] = 1 and destination data width different from source data width), a non-null source block size must be a multiple of the destination data width (BNDT[2:0] versus GPDMA_CxTR1.DDW_LOG2[1:0]). Else a user setting error is reported and no transfer is issued.

16.8.14 GPDMA channel x source address register (GPDMA_CxSAR)

Address offset: 0x9C+0x80*x (x = 0 to 11)

Reset value: 0x0000 0000

This register is secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx), and privileged or unprivileged, depending on the privileged state of channel x (GPDMA_PRIVCFGR.PRIVx).

This register configures the source start address of a transfer.

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1, and continuously updated by hardware, in order to reflect the address of the next burst transfer from the source.

This register must be written when the channel is completed (then the hardware has deasserted GPDMA_CxCR.EN). A channel transfer can be completed and programmed at different levels: block, 2D/repeated block, LLI or full linked-list.

In linked-list mode, during the link transfer, this register is automatically updated by the GPDMA from the memory if GPDMA_CxLLR.USA = 1.

31302928272625242322212019181716
SA[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
SA[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 SA[31:0]: source address

This field is the pointer to the address from which the next data is read.

During the channel activity, depending on the source addressing mode

(GPDMA_CxTR1.SINC), this field is kept fixed or incremented by the data width (GPDMA_CxTR1.SDW_LOG2[1:0]) after each burst source data, reflecting the next address from which data is read.

During the channel activity, this address is updated after each completed source burst, consequently to:

In linked-list mode, after a LLI data transfer is completed, this register is automatically updated by GPDMA from the memory, provided the LLI is set with GPDMA_CxLLR.USA = 1.

Note: A source address must be aligned with the programmed data width of a source burst (SA[2:0] versus GPDMA_CxTR1.SDW_LOG2[1:0]). Else, a user setting error is reported and no transfer is issued.

When the source block size is not a multiple of the source burst size and is a multiple of the source data width, the last programmed source burst is not completed and is internally shorten to match the block size. In this case, the additional GPDMA_CxTR3.SAO[12:0] is not applied.

16.8.15 GPDMA channel x destination address register (GPDMA_CxDAR)

Address offset: 0xA0+0x80*x (x = 0 to 11)

Reset value: 0x0000 0000

This register is secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx), and privileged or unprivileged, depending on the privileged state of channel x (GPDMA_PRIVCFGR.PRIVx).

This register configures the destination start address of a transfer.

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1, and continuously updated by hardware, in order to reflect the address of the next burst transfer to the destination.

This register must be written when the channel is completed (then the hardware has deasserted GPDMA_CxCR.EN). A channel transfer can be completed and programmed at different levels: block, 2D/repeated block, LLI or full linked-list.

In linked-list mode, during the link transfer, this register is automatically updated by GPDMA from the memory if GPDMA_CxLLR.UDA = 1.

31302928272625242322212019181716
DA[31:16]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
DA[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 DA[31:0]: destination address

This field is the pointer to the address from which the next data is written.

During the channel activity, depending on the destination addressing mode (GPDMA_CxTR1.DINC), this field is kept fixed or incremented by the data width (GPDMA_CxTR1.DDW_LOG2[1:0]) after each burst destination data, reflecting the next address from which data is written.

During the channel activity, this address is updated after each completed destination burst, consequently to:

In linked-list mode, after a LLI data transfer is completed, this register is automatically updated by the GPDMA from the memory, provided the LLI is set with GPDMA_CxLLR.UDA = 1.

Note: A destination address must be aligned with the programmed data width of a destination burst (DA[2:0] versus GPDMA_CxTR1.DDW_LOG2[1:0]). Else, a user setting error is reported and no transfer is issued.

16.8.16 GPDMA channel x transfer register 3 (GPDMA_CxTR3)

Address offset: 0xA4 + 0x80 * x (x = 10 to 11)

Reset value: 0x0000 0000

This register is secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx), and privileged or unprivileged, depending on the privileged state of channel x (GPDMA_PRIVCFGR.PRIVx).

This register controls the transfer of a channel x.

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1.

This register must be written when the channel is completed (then the hardware has deasserted GPDMA_CxCR.EN). A channel transfer can be completed and programmed at different levels: block or LLI or full linked-list.

In linked-list mode, during the link transfer, this register is automatically updated by the GPDMA from the memory if GPDMA_CxLLR.UT3 = 1.

31302928272625242322212019181716
Res.Res.Res.DAO[12:0]
rwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
Res.Res.Res.SAO[12:0]
rwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:29 Reserved, must be kept at reset value.

Bits 28:16 DAO[12:0]: destination address offset increment

The destination address, pointed by GPDMA_CxDAR, is incremented or decremented (depending on GPDMA_CxBR1.DDEC) by this offset DAO[12:0] for each programmed destination burst. This offset is not including and is added to the programmed burst size when the completed burst is addressed in incremented mode (GPDMA_CxTR1.DINC = 1).

Note: A destination address offset must be aligned with the programmed data width of a destination burst (DAO[2:0] versus GPDMA_CxTR1.DDW_LOG2[1:0]). Else, a user setting error is reported and no transfer is issued.

Bits 15:13 Reserved, must be kept at reset value.

Bits 12:0 SAO[12:0]: source address offset increment

The source address, pointed by GPDMA_CxSAR, is incremented or decremented (depending on GPDMA_CxBR1.SDEC) by this offset SAO[12:0] for each programmed source burst. This offset is not including and is added to the programmed burst size when the completed burst is addressed in incremented mode (GPDMA_CxTR1.SINC = 1).

Note: A source address offset must be aligned with the programmed data width of a source burst (SAO[2:0] versus GPDMA_CxTR1.SDW_LOG2[1:0]). Else a user setting error is reported and none transfer is issued.

When the source block size is not a multiple of the destination burst size, and is a multiple of the source data width, then the last programmed source burst is not completed and is internally shorten to match the block size. In this case, the additional GPDMA_CxTR3.SAO[12:0] is not applied.

16.8.17 GPDMA channel x block register 2 (GPDMA_CxBR2)

Address offset: 0xA8 + 0x80 * x (x = 10 to 11)

Reset value: 0x0000 0000

This register is secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx), and privileged or unprivileged, depending on the privileged state of channel x (GPDMA_PRIVCFGR.PRIVx).

This register controls the transfer of a channel x at a 2D/repeated block level.

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1.

This register must be written when the channel is completed (then the hardware has deasserted GPDMA_CxCR.EN). A channel transfer can be completed and programmed at different levels: block, 2D/repeated block, LLI or full linked-list.

In linked-list mode, during the link transfer, this register is automatically updated by the GPDMA from the memory if GPDMA_CxLLR.UB2 = 1.

31302928272625242322212019181716
BRDAO[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
BRSOA[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:16 BRDAO[15:0]: Block repeated destination address offset

For a channel with 2D addressing capability, this field is used to update (by addition or subtraction depending on GPDMA_CxBR1.BRDDEC) the current destination address (GPDMA_CxDAR) at the end of a block transfer.

Note: A block repeated destination address offset must be aligned with the programmed data width of a destination burst (BRDAO[2:0] versus GPDMA_CxTR1.DDW_LOG2[1:0]). Else a user setting error is reported and no transfer is issued. BRDAO[15:0] must be set to 0 in peripheral flow-control mode (if GPDMA_CxTR2.PFREQ = 1).

Bits 15:0 BRSOA[15:0]: Block repeated source address offset

For a channel with 2D addressing capability, this field is used to update (by addition or subtraction depending on GPDMA_CxBR1.BRSDEC) the current source address (GPDMA_CxSAR) at the end of a block transfer.

Note: A block repeated source address offset must be aligned with the programmed data width of a source burst (BRSOA[2:0] versus GPDMA_CxTR1.SDW_LOG2[1:0]). Else a user setting error is reported and no transfer is issued. BRSOA[15:0] must be set to 0 in peripheral flow-control mode (if GPDMA_CxTR2.PFREQ = 1).

16.8.18 GPDMA channel x linked-list address register (GPDMA_CxLLR)

Address offset: 0xCC+0x80*x (x = 0 to 9)

Reset value: 0x0000 0000

This register is secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx), and privileged or unprivileged, depending on the privileged state of channel x (GPDMA_PRIVCFGR.PRIVx).

This register configures the data structure of the next LLI in the memory and its address pointer. A channel transfer is completed when this register is null.

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1.

This register must be written when the channel is completed (then the hardware has deasserted GPDMA_CxCR.EN). A channel transfer can be completed and programmed at different levels: block or LLI or full linked-list.

In linked-list mode, during the link transfer, this register is automatically updated by the GPDMA from the memory if GPDMA_CxLLR.ULL = 1.

RM0517column_2column_3column_4column_5column_6column_7column_8column_9column_10column_11column_12column_13column_14column_15column_16
31302928272625242322212019181716
UT1UT2UB1USAUDARes.Res.Res.Res.Res.Res.Res.Res.Res.Res.ULL
rwrwrwrwrwrw
1514131211109876543210
LA[15:2]Res.Res.
rwrwrwrwrwrwrwrwrwrwrwrwrwrw
Bit 31UT1 : Update GPDMA_CxTR1 from memory
Bit 30UT2 : Update GPDMA_CxTR2 from memory
Bit 29UB1 : Update GPDMA_CxBR1 from memory
If UB1 = 0 and if GPDMA_CxLLR≠ 0, the linked-list is not completed.
Bit 28USA : update GPDMA_CxSAR from memory
RM0517 Rev 1755/3945

Bit 31 UT1: Update GPDMA_CxTR1 from memory

This bit controls the update of GPDMA_CxTR1 from the memory during the link transfer.

0: no GPDMA_CxTR1 update

1: GPDMA_CxTR1 update

Bit 30 UT2: Update GPDMA_CxTR2 from memory

This bit controls the update of GPDMA_CxTR2 from the memory during the link transfer.

0: no GPDMA_CxTR2 update

1: GPDMA_CxTR2 update

Bit 29 UB1: Update GPDMA_CxBR1 from memory

This bit controls the update of GPDMA_CxBR1 from the memory during the link transfer.

If UB1 = 0 and if GPDMA_CxLLR ≠ 0, the linked-list is not completed.

GPDMA_CxBR1.BNDT[15:0] is then restored to the programmed value after data transfer is completed and before the link transfer.

0: no GPDMA_CxBR1 update from memory (GPDMA_CxBR1.BNDT[15:0] restored if any link transfer)

1: GPDMA_CxBR1 update

Bit 28 USA: update GPDMA_CxSAR from memory

This bit controls the update of GPDMA_CxSAR from the memory during the link transfer.

0: no GPDMA_CxSAR update

1: GPDMA_CxSAR update

16.8.19 GPDMA channel x alternate linked-list address register (GPDMA_CxLLR)

Address offset: 0xCC+0x80*x (x = 10 to 11)

Reset value: 0x0000 0000

This register is secure or nonsecure depending on the secure state of channel x (GPDMA_SECCFGR.SECx), and privileged or unprivileged, depending on the privileged state of channel x (GPDMA_PRIVCFGR.PRIVx).

This register configures the data structure of the next LLI in the memory and its address pointer. A channel transfer is completed when this register is null.

This register must be written when GPDMA_CxCR.EN = 0.

This register is read-only when GPDMA_CxCR.EN = 1.

This register must be written when the channel is completed (then the hardware has deasserted GPDMA_CxCR.EN). A channel transfer can be completed and programmed at different levels: block or LLI or full linked-list.

In linked-list mode, during the link transfer, this register is automatically updated by the GPDMA from the memory if GPDMA_CxLLR.ULL = 1.

RM0517column_2column_3column_4column_5column_6column_7column_8column_9column_10column_11column_12column_13column_14column_15column_16
31302928272625242322212019181716
UT1UT2UB1USAUDAUT3UB2Res.Res.Res.Res.Res.Res.Res.Res.ULL
rwrwrwrwrwrwrwrw
1514131211109876543210
LA[15:2]Res.Res.
rwrwrwrwrwrwrwrwrwrwrwrwrwrw
Bit 31UT1 : Update GPDMA_CxTR1 from memory
Bit 30UT2 : Update GPDMA_CxTR2 from memory
Bit 29UB1 : Update GPDMA_CxBR1 from memory
If UB1 = 0 and if GPDMA_CxLLR≠ 0, the linked-list is not completed.
Bit 28USA : update GPDMA_CxSAR from memory
RM0517 Rev 1757/3945

Bit 31 UT1: Update GPDMA_CxTR1 from memory

This bit controls the update of GPDMA_CxTR1 from the memory during the link transfer.

0: no GPDMA_CxTR1 update

1: GPDMA_CxTR1 update

Bit 30 UT2: Update GPDMA_CxTR2 from memory

This bit controls the update of GPDMA_CxTR2 from the memory during the link transfer.

0: no GPDMA_CxTR2 update

1: GPDMA_CxTR2 update

Bit 29 UB1: Update GPDMA_CxBR1 from memory

This bit controls the update of GPDMA_CxBR1 from the memory during the link transfer.

If UB1 = 0 and if GPDMA_CxLLR ≠ 0, the linked-list is not completed.

GPDMA_CxBR1.BNDT[15:0] is then restored to the programmed value after data transfer is completed and before the link transfer.

0: no GPDMA_CxBR1 update from memory (GPDMA_CxBR1.BNDT[15:0] restored if any link transfer)

1: GPDMA_CxBR1 update

Bit 28 USA: update GPDMA_CxSAR from memory

This bit controls the update of GPDMA_CxSAR from the memory during the link transfer.

0: no GPDMA_CxSAR update

1: GPDMA_CxSAR update

16.8.20 GPDMA register map

Table 137. GPDMA register map and reset values

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x00GPDMA_SECCFGRResResResResResResResResResResResResResResResResResResResResSEC11SEC10SEC9SEC8SEC7SEC6SEC5SEC4SEC3SEC2SEC1SEC0
Reset value000000000000
0x04GPDMA_PRIVCFGRResResResResResResResResResResResResResResResResResResResResPRIV11PRIV10PRIV9PRIV8PRIV7PRIV6PRIV5PRIV4PRIV3PRIV2PRIV1PRIV0
Reset value000000000000

Table 137. GPDMA register map and reset values (continued)

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x08GPDMA_RCFGLOCKRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.LOCK11LOCK10LOCK9LOCK8LOCK7LOCK6LOCK5LOCK4LOCK3LOCK2LOCK1LOCK0
Reset value000000000000
0x0CGPDMA_MISRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.MIS11MIS10MIS9MIS8MIS7MIS6MIS5MIS4MIS3MIS2MIS1MIS0
Reset value000000000000
0x10GPDMA_SMISRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.MIS11MIS10MIS9MIS8MIS7MIS6MIS5MIS4MIS3MIS2MIS1MIS0
Reset value000000000000
0x14 - 0x4CReservedReserved
0x50+0x80 * x
(x = 0 to 11)
GPDMA_CxLBARLBA[31:16]Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value0000000000000000
0x5C+0x80 * x
(x = 0 to 11)
GPDMA_CxFCRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.TOFSUSPFUSEFULEFDTEFHTFTCFRes.Res.Res.Res.Res.Res.Res.Res.
Reset value0000000
0x60+0x80 * x
(x = 0 to 11)
GPDMA_CxSRRes.Res.Res.Res.Res.Res.Res.Res.FIFOL[7:0]Res.TOFSUSPFUSEFULEFDTEFHTFTCFRes.Res.Res.Res.Res.Res.Res.IDLEF
Reset value0000000000000001
0x64+0x80 * x
(x = 0 to 11)
GPDMA_CxCRRes.Res.Res.Res.Res.Res.Res.Res.PRIO[1:0]Res.Res.Res.Res.Res.LAPLSMTOIESUSPIEUSEIEULEIEDTEIEHTIETCIERes.Res.Res.Res.Res.SUSPRESETEN
Reset value00000000000000
0x90+0x80 * x
(x = 0 to 11)
GPDMA_CxTR1DSECDAPRes.Res.DHXDBXDBL_1[5:0]DINCRes.Res.DDW_LOG2[1:0]SSECSAPSBXPAM[1:0]Res.SBL_1[5:0]SINCSDW_LOG2[1:0]
Reset value000000000000000000000000000
0x94+0x80 * x
(x = 0 to 11)
GPDMA_CxTR2TCEM[1:0]Res.Res.Res.Res.TRIGPOL[1:0]Res.TRIGSEL[6:0]TRIGM[1:0]Res.PFREQBREQDREQSWREQRes.REQSEL[7:0]
Reset value0000000000000000000000000
0x98+0x80 * x
(x = 0 to 9)
GPDMA_CxBR1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.BNDT[15:0]
Reset value0000000000000000
0x98+0x80 * x
(x = 10 to 11)
GPDMA_CxBR1BRDDECBRSDECDDECSDECRes.BRC[10:0]BNDT[15:0]
Reset value0000000000000000000000000000000
0x9C+0x80 * x
(x = 0 to 11)
GPDMA_CxSARSA[31:0]
Reset value00000000000000000000000000000000
0xA0+0x80 * x
(x = 0 to 11)
GPDMA_CxDARDA[31:0]
Reset value00000000000000000000000000000000
0xA4+0x80 * x
(x = 10 to 11)
GPDMA_CxTR3Res.Res.Res.DAO[12:0]Res.Res.Res.SAO[12:0]
Reset value00000000000000000000000000
0xA8+0x80 * x
(x = 10 to 11)
GPDMA_CxBR2BRDAO[15:0]BRSAO[15:0]
Reset value00000000000000000000000000000000
0xCC+0x80 * x
(x = 0 to 9)
GPDMA_CxLLRUT1UT2UB1USAUDARes.Res.Res.Res.Res.Res.Res.Res.Res.Res.ULLLA[15:2]Res.Res.
Reset value00000000000000000000
0xCC+0x80 * x
(x = 10 to 11)
GPDMA_CxLLRUT1UT2UB1USAUDAUT3UB2Res.Res.Res.Res.Res.Res.Res.Res.ULLLA[15:2]Res.Res.
Reset value0000000000000000000000

Refer to Section 2.3: Memory organization for the register boundary addresses.