13. Direct memory access controller (DMA)

13.1 Introduction

The direct memory access (DMA) controller is a bus master and system peripheral.

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

The DMA controller features a single AHB master architecture.

There are two instances of DMA, DMA1 and DMA2.

Each channel is dedicated to managing memory access requests from one or more peripherals. Each DMA includes an arbiter for handling the priority between DMA requests.

13.2 DMA main features

13.3 DMA implementation

13.3.1 DMA1 and DMA2

DMA1 and DMA2 are implemented with the hardware configuration parameters shown in Table 77 .

Table 77. DMA1 and DMA2 implementation

FeatureDMA1DMA2
Number of channels77
Security1 (supported)1 (supported)

13.3.2 DMA request mapping

The DMA controller is connected to DMA requests from the AHB/APB peripherals through the DMAMUX peripheral.

For the mapping of the different requests, refer to the Section 14.3: DMAMUX implementation .

13.4 DMA functional description

13.4.1 DMA block diagram

The DMA block diagram is shown in Figure 49 .

Figure 49. DMA block diagram

DMA block diagram showing DMA1 and DMA2 internal structures, including channels, arbiters, interrupt interfaces, and AHB master/slave interfaces connected to 32-bit AHB buses. It also shows external signal connections like dma1_req, dma1_ack, dma1_secm, and dma1_priv.

The diagram illustrates the internal architecture of two DMA controllers, DMA1 and DMA2. Each controller contains seven channels (Ch 1, Ch 2, ..., Ch 7) connected to a multiplexer. The multiplexer output is connected to an AHB master interface, which in turn connects to a 32-bit AHB bus. Each controller also includes an Arbiter and an Interrupt interface. The Arbiter receives requests from the channels and sends acknowledgments (dma1_ack [1..7] or dma2_ack [1..7]) to the DMAMUX1 block. The Interrupt interface generates interrupt signals (dma1_it[1..7] or dma2_it[1..7]) and priority/privilege signals (dma1_priv[1..7] or dma2_priv[1..7]) to the DMAMUX1 block. The DMAMUX1 block sends request signals (dma1_req [1..7] or dma2_req [1..7]) to the channels. Each controller has an AHB slave interface connected to another 32-bit AHB bus, which generates interrupt acknowledge signals (dma1_ilac or dma2_ilac). The diagram is labeled with MSV61533V1 at the bottom right.

DMA block diagram showing DMA1 and DMA2 internal structures, including channels, arbiters, interrupt interfaces, and AHB master/slave interfaces connected to 32-bit AHB buses. It also shows external signal connections like dma1_req, dma1_ack, dma1_secm, and dma1_priv.

The DMA controller performs direct memory transfer by sharing the AHB system bus with other system masters. The bus matrix implements round-robin scheduling. DMA requests may stop the CPU access to the system bus for a number of bus cycles, when CPU and DMA target the same destination (memory or peripheral).

According to its configuration through the AHB slave interface, the DMA controller arbitrates between the DMA channels and their associated received requests. The DMA controller also schedules the DMA data transfers over the single AHB port master.

The DMA controller generates a secure bus and a privileged bus, to keep the DMAMUX peripheral informed of the secure or non-secure state, and the privileged or unprivileged state of each channel x.

The DMA controller generates an interrupt per channel to the interrupt controller.

The DMA controller also generates an illegal access event, as a pulse, to the secure interrupt controller, when a non-secure software attempts to access a secure DMA register or register field.

13.4.2 DMA pins and internal signals

Table 78. DMA internal input/output signals

Signal nameSignal typeDescription
dma_req[x]InputDMA channel x request
dma_ack[x]OutputDMA channel x acknowledge
dma_it[x]OutputDMA channel x interrupt
dma_secm[x]OutputDMA channel x secure state
dma_priv[x]OutputDMA channel x privileged state
dma_ilacOutputDMA global secure/privileged illegal access event

13.4.3 DMA transfers

The secure software configures the DMA controller at channel level, in order to perform a block transfer, composed of a sequence of AHB secure or non-secure, privileged or unprivileged bus transfers.

A DMA block transfer may be requested from a peripheral, or triggered by the software in case of memory-to-memory transfer.

After an event, the following steps of a single DMA transfer occur:

  1. 1. The peripheral sends a single DMA request signal to the DMA controller.
  2. 2. The DMA controller serves the request, depending on the priority of the channel associated to this peripheral request.
  3. 3. As soon as the DMA controller grants the peripheral, an acknowledge is sent to the peripheral by the DMA controller.
  4. 4. The peripheral releases its request as soon as it gets the acknowledge from the DMA controller.
  5. 5. Once the request is de-asserted by the peripheral, the DMA controller releases the acknowledge.

The peripheral may order a further single request and initiate another single DMA transfer.

The request/acknowledge protocol is used when a peripheral is either the source or the destination of the transfer. For example, in case of memory-to-peripheral transfer, the peripheral initiates the transfer by driving its single request signal to the DMA controller. The DMA controller reads then a single data in the memory and writes this data to the peripheral.

For a given channel x, a DMA block transfer consists of a repeated sequence of:

This sequence is repeated until DMA_CNDTRx is null.

Note: The AHB master bus source/destination address must be aligned with the programmed size of the transferred single data to the source/destination.

13.4.4 DMA arbitration

The DMA arbiter manages the priority between the different channels.

When an active channel x is granted by the arbiter (hardware requested or software triggered), a single DMA transfer is issued (such as a AHB 'read followed by write' transfer of a single data). Then, the arbiter considers again the set of active channels and selects the one with the highest priority.

The priorities are managed in two stages:

When a channel x is programmed for a block transfer in memory-to-memory mode, re arbitration is considered between each single DMA transfer of this channel x. Whenever there is another concurrent active requested channel, the DMA arbiter automatically alternates and grants the other highest-priority requested channel, which may be of lower priority than the memory-to-memory channel.

13.4.5 DMA channels

Each channel may handle a DMA transfer between a peripheral register located at a fixed address, and a memory address. The amount of data items to transfer is programmable. The register that contains the amount of data items to transfer is decremented after each transfer.

Each channel is either secure or non-secure.

A DMA channel is programmed at block transfer level.

Programmable data sizes

The transfer sizes of a single data (byte, half-word, or word) to the peripheral and memory are programmable through, respectively, the PSIZE[1:0] and MSIZE[1:0] fields of the DMA_CCRx register.

Pointer incrementation

The peripheral and memory pointers may be automatically incremented after each transfer, depending on the PINC and MINC bits of the DMA_CCRx register.

If the incremented mode is enabled (PINC or MINC set to 1), the address of the next transfer is the address of the previous one incremented by 1, 2 or 4, depending on the data size defined in PSIZE[1:0] or MSIZE[1:0]. The first transfer address is the one programmed in the DMA_CPARx or DMA_CMARx register. During transfers, these registers keep the initially programmed value. The current transfer addresses (in the current internal peripheral/memory address register) are not accessible by software.

If the channel x is configured in non-circular mode , no DMA request is served after the last data transfer (once the number of single data to transfer reaches zero). The DMA channel must be disabled in order to reload a new number of data items into the DMA_CNDTRx register.

Note: If the channel x is disabled, the DMA registers are not reset. The DMA channel registers (DMA_CCRx, DMA_CPARx and DMA_CMARx) retain the initial values programmed during the channel configuration phase.

In circular mode , after the last data transfer, the DMA_CNDTRx register is automatically reloaded with the initially programmed value. The current internal address registers are reloaded with the base address values from the DMA_CPARx and DMA_CMARx registers.

Security

The DMA controller partitions all its resources so that they exist in one of the two worlds: the secure world and the non-secure world, at any given time.

A secure software is able to access any resource/register, whatever secure or non-secure.

A non-secure software is restricted to access any non-secure resource/register.

Any channel is in a secure or non-secure state, as securely configured by the DMA_CCRx.SECM secure register bit.

When a channel x is configured in secure mode, the following access controls rules are applied:

When a channel is configured in secure mode, a secure software can separately configure as secure or non-secure the AHB DMA master transfer from the source (by the DMA_CCRx.SSEC register bit), and as secure or non-secure the AHB DMA master transfer to the destination (by the DMA_CCRx.DSEC register bit).

The DMA controller generates a secure bus, dma_secm[7:0], reflecting the DMA_CCRx.SECM register, in order to keep the other hardware peripherals like the DMAMUX, informed of the secure/non-secure state of each DMA channel x.

The DMA controller also generates a security illegal access pulse event, dma_ilac, on an illegal non-secure software access to a secure DMA register or register field.

A security illegal access event is generated in the configurations described below:

When the software is switching from a secure state to a non-secure state (after the secure transfer is completed), the secure software must disable the channel by a 32-bit write at the DMA_CCRx address before switching. This operation is needed for the two below reasons:

Note: A trusted application may require that the secure software does not only disable the channel, but also reset the full DMA_CCRx word register to its reset value, as well as reset any other DMA register corresponding to this channel x.

Privileged / unprivileged mode

Any channel x is a privileged or unprivileged hardware resource, as configured by a privileged software via the PRIV bit of the DMA_CCRx register.

When a channel x is configured in privileged mode, the following access controls rules are applied:

When a channel is configured in a privileged (or unprivileged) mode, the AHB master transfers from the source and to the destination, are privileged (respectively unprivileged).

DMA generates a privileged bus, dma_priv[7:0] , reflecting the PRIV bit of the DMA_CCRx register, in order to keep the other hardware peripherals, like DMAMUX , informed of the privileged / unprivileged state of each DMA channel x .

The DMA controller also generates a privileged illegal access pulse event on an illegal non-privileged software access to a privileged DMA register or register field. This event is ORed with the secure illegal pulse access event in order to generate an illegal access pulse event, dma_ilac , which is routed to the secure interrupt controller.

Channel configuration procedure

The following sequence is needed to configure a DMA channel x :

  1. 1. Set a channel x to secure or non-secure, by a secure write access to the secure SECM bit of the DMA_CCRx register. Set a channel x to privileged or unprivileged, by a privileged write access to the privileged PRIV bit of the DMA_CCRx register.
  2. 2. Set the peripheral register address in the DMA_CPARx register.
    The data is moved from/to this address to/from the memory after the peripheral event, or after the channel is enabled in memory-to-memory mode.
  3. 3. Set the memory address in the DMA_CMARx register.
    The data is written to/read from the memory after the peripheral event or after the channel is enabled in memory-to-memory mode.
  4. 4. Configure the total number of data to transfer in the DMA_CNDTRx register.
    After each data transfer, this value is decremented.
  5. 5. Configure the parameters listed below in the DMA_CCRx register:
    • – the channel priority
    • – the data transfer direction
    • – the security level of the data transfers from source and to destination when the channel is secure
    • – the circular mode
    • – the peripheral and memory incremented mode
    • – the peripheral and memory data size
    • – the interrupt enable at half and/or full transfer and/or transfer error
  6. 6. Activate the channel by setting the EN bit in the DMA_CCRx register.

A channel, as soon as enabled, may serve any DMA request from the peripheral connected to this channel, or may start a memory-to-memory block transfer.

Note: The two last steps of the channel configuration procedure may be merged into a single access to the DMA_CCRx register, to configure and enable the channel.

Channel state and disabling a channel

A channel x in active state is an enabled channel (read DMA_CCRx.EN = 1 ). An active channel x is a channel that must have been enabled by the software ( DMA_CCRx.EN set to 1) and afterwards with no occurred transfer error ( DMA_ISR.TEIFx = 0 ). In case there is a transfer error, the channel is automatically disabled by hardware ( DMA_CCRx.EN = 0 ).

The three following use cases may happen:

This corresponds to the two following actions:

This case is not supported by the DMA hardware, that does not guarantee that the remaining data transfers are performed correctly.

If the application does not need any more the channel, this active channel can be disabled by software. The channel is stopped and aborted but the DMA_CNDTRx register content may not correctly reflect the remaining data transfers versus the aborted source and destination buffer/register.

This corresponds to the software sequence: disable an active channel, then reconfigure the channel and enable it again.

This is supported by the hardware if the following conditions are met:

When a channel transfer error occurs, the EN bit of the DMA_CCRx register is cleared by hardware. This EN bit can not be set again by software to re-activate the channel x, until the TEIFx bit of the DMA_ISR register is set.

Circular mode (in memory-to-peripheral/peripheral-to-memory transfers)

The circular mode is available to handle circular buffers and continuous data flows (such as ADC scan mode). This feature is enabled using the CIRC bit in the DMA_CCRx register.

Note:

The circular mode must not be used in memory-to-memory mode. Before enabling a channel in circular mode (CIRC = 1), the software must clear the MEM2MEM bit of the DMA_CCRx register. When the circular mode is activated, the amount of data to transfer is automatically reloaded with the initial value programmed during the channel configuration phase, and the DMA requests continue to be served.

In order to stop a circular transfer, the software needs to stop the peripheral from generating DMA requests (such as quit the ADC scan mode), before disabling the DMA channel. The software must explicitly program the DMA_CNDTRx value before starting/enabling a transfer, and after having stopped a circular transfer.

Memory-to-memory mode

The DMA channels may operate without being triggered by a request from a peripheral. This mode is called memory-to-memory mode, and is initiated by software.

If the MEM2MEM bit in the DMA_CCRx register is set, the channel, if enabled, initiates transfers. The transfer stops once the DMA_CNDTRx register reaches zero.

Note: The memory-to-memory mode must not be used in circular mode. Before enabling a channel in memory-to-memory mode (MEM2MEM = 1), the software must clear the CIRC bit of the DMA_CCRx register.

Peripheral-to-peripheral mode

Any DMA channel can operate in peripheral-to-peripheral mode:

Programming transfer direction, assigning source/destination

The value of the DIR bit of the DMA_CCRx register sets the direction of the transfer, and consequently, it identifies the source and the destination, regardless the source/destination type (peripheral or memory):

13.4.6 DMA data width, alignment and endianness

When PSIZE[1:0] and MSIZE[1:0] are not equal, the DMA controller performs some data alignments as described in Table 79 .

Table 79. Programmable data width and endian behavior (when PINC = MINC = 1)

Source port width (MSIZE if DIR = 1, else PSIZE)Destination port width (PSIZE if DIR = 1, else MSIZE)Number of data items to transfer (NDT)Source content: address / data (DMA_CMARx if DIR = 1, else DMA_CPARx)DMA transfersDestination content: address / data (DMA_CPARx if DIR = 1, else DMA_CMARx)
888@0x0 / B0
@0x1 / B1
@0x2 / B2
@0x3 / B3
1: read B0[7:0] @0x0 then write B0[7:0] @0x0
2: read B1[7:0] @0x1 then write B1[7:0] @0x1
3: read B2[7:0] @0x2 then write B2[7:0] @0x2
4: read B3[7:0] @0x3 then write B3[7:0] @0x3
@0x0 / B0
@0x1 / B1
@0x2 / B2
@0x3 / B3
8164@0x0 / B0
@0x1 / B1
@0x2 / B2
@0x3 / B3
1: read B0[7:0] @0x0 then write 00B0[15:0] @0x0
2: read B1[7:0] @0x1 then write 00B1[15:0] @0x2
3: read B2[7:0] @0x2 then write 00B2[15:0] @0x4
4: read B3[7:0] @0x3 then write 00B3[15:0] @0x6
@0x0 / 00B0
@0x2 / 00B1
@0x4 / 00B2
@0x6 / 00B3
8324@0x0 / B0
@0x1 / B1
@0x2 / B2
@0x3 / B3
1: read B0[7:0] @0x0 then write 000000B0[31:0] @0x0
2: read B1[7:0] @0x1 then write 000000B1[31:0] @0x4
3: read B2[7:0] @0x2 then write 000000B2[31:0] @0x8
4: read B3[7:0] @0x3 then write 000000B3[31:0] @0xC
@0x0 / 000000B0
@0x4 / 000000B1
@0x8 / 000000B2
@0xC / 000000B3
1684@0x0 / B1B0
@0x2 / B3B2
@0x4 / B5B4
@0x6 / B7B6
1: read B1B0[15:0] @0x0 then write B0[7:0] @0x0
2: read B3B2[15:0] @0x2 then write B2[7:0] @0x1
3: read B5B4[15:0] @0x4 then write B4[7:0] @0x2
4: read B7B6[15:0] @0x6 then write B6[7:0] @0x3
@0x0 / B0
@0x1 / B2
@0x2 / B4
@0x3 / B6
16164@0x0 / B1B0
@0x2 / B3B2
@0x4 / B5B4
@0x6 / B7B6
1: read B1B0[15:0] @0x0 then write B1B0[15:0] @0x0
2: read B3B2[15:0] @0x2 then write B3B2[15:0] @0x2
3: read B5B4[15:0] @0x4 then write B5B4[15:0] @0x4
4: read B7B6[15:0] @0x6 then write B7B6[15:0] @0x6
@0x0 / B1B0
@0x2 / B3B2
@0x4 / B5B4
@0x6 / B7B6
16324@0x0 / B1B0
@0x2 / B3B2
@0x4 / B5B4
@0x6 / B7B6
1: read B1B0[15:0] @0x0 then write 0000B1B0[31:0] @0x0
2: read B3B2[15:0] @0x2 then write 0000B3B2[31:0] @0x4
3: read B5B4[15:0] @0x4 then write 0000B5B4[31:0] @0x8
4: read B7B6[15:0] @0x6 then write 0000B7B6[31:0] @0xC
@0x0 / 0000B1B0
@0x4 / 0000B3B2
@0x8 / 0000B5B4
@0xC / 0000B7B6
3284@0x0 / B3B2B1B0
@0x4 / B7B6B5B4
@0x8 / BBBAB9B8
@0xC / BFBEBDBC
1: read B3B2B1B0[31:0] @0x0 then write B0[7:0] @0x0
2: read B7B6B5B4[31:0] @0x4 then write B4[7:0] @0x1
3: read BBBAB9B8[31:0] @0x8 then write B8[7:0] @0x2
4: read BFBEBDBC[31:0] @0xC then write BC[7:0] @0x3
@0x0 / B0
@0x1 / B4
@0x2 / B8
@0x3 / BC
32164@0x0 / B3B2B1B0
@0x4 / B7B6B5B4
@0x8 / BBBAB9B8
@0xC / BFBEBDBC
1: read B3B2B1B0[31:0] @0x0 then write B1B0[15:0] @0x0
2: read B7B6B5B4[31:0] @0x4 then write B5B4[15:0] @0x2
3: read BBBAB9B8[31:0] @0x8 then write B9B8[15:0] @0x4
4: read BFBEBDBC[31:0] @0xC then write BDBC[15:0] @0x6
@0x0 / B1B0
@0x2 / B5B4
@0x4 / B9B8
@0x6 / BDBC
32324@0x0 / B3B2B1B0
@0x4 / B7B6B5B4
@0x8 / BBBAB9B8
@0xC / BFBEBDBC
1: read B3B2B1B0[31:0] @0x0 then write B3B2B1B0[31:0] @0x0
2: read B7B6B5B4[31:0] @0x4 then write B7B6B5B4[31:0] @0x4
3: read BBBAB9B8[31:0] @0x8 then write BBBAB9B8[31:0] @0x8
4: read BFBEBDBC[31:0] @0xC then write BFBEBDBC[31:0] @0xC
@0x0 / B3B2B1B0
@0x4 / B7B6B5B4
@0x8 / BBBAB9B8
@0xC / BFBEBDBC

Addressing AHB peripherals not supporting byte/half-word write transfers

When the DMA controller initiates an AHB byte or half-word write transfer, the data are duplicated on the unused lanes of the AHB master 32-bit data bus (HWDATA[31:0]).

When the AHB slave peripheral does not support byte or half-word write transfers and does not generate any error, the DMA controller writes the 32 HWDATA bits as shown in the two examples below:

Assuming the AHB/APB bridge is an AHB 32-bit slave peripheral that does not take into account the HSIZE data, any AHB byte or half-word transfer is changed into a 32-bit APB transfer as described below:

13.4.7 DMA error management

A DMA transfer error is generated when reading from or writing to a reserved address space. When a DMA transfer error occurs during a DMA read or write access, the faulty channel x is automatically disabled through a hardware clear of its EN bit in the corresponding DMA_CCRx register.

The TEIFx bit of the DMA_ISR register is set. An interrupt is then generated if the TEIE bit of the DMA_CCRx register is set.

The EN bit of the DMA_CCRx register can not be set again by software (channel x re-activated) until the TEIFx bit of the DMA_ISR register is cleared (by setting the CTEIFx bit of the DMA_IFCR register).

When the software is notified with a transfer error over a channel which involves a peripheral, the software has first to stop this peripheral in DMA mode, in order to disable any pending or future DMA request. Then software may normally reconfigure both DMA and the peripheral in DMA mode for a new transfer.

Additionally, a security illegal access pulse signal is generated on an illegal non-secure software access to a secure DMA register. This signal is routed to the secure interrupt controller.

13.5 DMA interrupts

An interrupt can be generated on a half transfer, transfer complete or transfer error for each DMA channel x (whatever the channel is secure or non-secure). Separate interrupt enable bits are available for flexibility.

Table 80. DMA interrupt requests

Interrupt requestInterrupt eventEvent flagInterrupt enable bit
Channel x interruptHalf transfer on channel xHTIFxHTIEx
Transfer complete on channel xTCIFxTCIEx
Transfer error on channel xTEIFxTEIEx
Half transfer or transfer complete or transfer error on channel xGIFx-

13.6 DMA registers

Refer to Section 1.2 for a list of abbreviations used in register descriptions.

The DMA registers have to be accessed by words (32-bit).

13.6.1 DMA interrupt status register (DMA_ISR)

Address offset: 0x00

Reset value: 0x0000 0000

This register may mix secure and non secure information, depending on the secure mode of each channel (SECM bit of the DMA_CCRx register). A secure software can read the full interrupt status. A non-secure software is restricted to read the status of non-secure channel(s), other secure bit fields returning zero.

This register may mix privileged and unprivileged information, depending on the privileged mode of each channel (PRIV bit of the DMA_CCRx register). A privileged software can read the full interrupt status. An unprivileged software is restricted to read the status of unprivileged channel(s), other privileged bit fields returning zero.

Every status / flag bit is set by hardware, independently of the privileged and the secure mode of the channel.

Every status bit is cleared by hardware when the software sets the corresponding clear bit or the corresponding global clear bit CGIFx, in the DMA_IFCR register, provided that, if the channel x is in privileged mode and/or in secure mode, then the software access to DMA_IFCR is also privileged and/or secure.

31302928272625242322212019181716
Res.Res.Res.Res.TEIF7HTIF7TCIF7GIF7TEIF6HTIF6TCIF6GIF6TEIF5HTIF5TCIF5GIF5
rrrrrrrrrrrr
1514131211109876543210
TEIF4HTIF4TCIF4GIF4TEIF3HTIF3TCIF3GIF3TEIF2HTIF2TCIF2GIF2TEIF1HTIF1TCIF1GIF1
rrrrrrrrrrrrrrrr

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

Bit 27 TEIF7 : Transfer error (TE) flag for channel 7

0: No TE event

1: A TE event occurred.

Bit 26 HTIF7 : Half transfer (HT) flag for channel 7

0: No HT event

1: An HT event occurred.

Bit 25 TCIF7 : Transfer complete (TC) flag for channel 7

0: No TC event

1: A TC event occurred.

Bit 24 GIF7 : Global interrupt flag for channel 7

0: No TE, HT, or TC event

1: A TE, HT, or TC event occurred.

Bit 23 TEIF6 : Transfer error (TE) flag for channel 6

0: No TE event

1: A TE event occurred.

Bit 22 HTIF6 : Half transfer (HT) flag for channel 6

0: No HT event

1: An HT event occurred.

Bit 21 TCIF6 : Transfer complete (TC) flag for channel 6

0: No TC event

1: A TC event occurred.

Bit 20 GIF6 : Global interrupt flag for channel 6

0: No TE, HT, or TC event

1: A TE, HT, or TC event occurred.

Bit 19 TEIF5 : Transfer error (TE) flag for channel 5

0: No TE event

1: A TE event occurred.

Bit 18 HTIF5 : Half transfer (HT) flag for channel 5

0: No HT event

1: An HT event occurred.

Bit 17 TCIF5 : Transfer complete (TC) flag for channel 5

0: No TC event

1: A TC event occurred.

Bit 16 GIF5 : Global interrupt flag for channel 5

0: No TE, HT, or TC event

1: a TE, HT, or TC event occurred.

Bit 15 TEIF4 : Transfer error (TE) flag for channel 4

0: No TE event

1: A TE event occurred.

Bit 14 HTIF4 : Half transfer (HT) flag for channel 4

0: No HT event

1: An HT event occurred.

  1. Bit 13 TCIF4 : Transfer complete (TC) flag for channel 4
    0: No TC event
    1: A TC event occurred.
  2. Bit 12 GIF4 : Global interrupt flag for channel 4
    0: No TE, HT, or TC event
    1: A TE, HT, or TC event occurred.
  3. Bit 11 TEIF3 : Transfer error (TE) flag for channel 3
    0: No TE event
    1: A TE event occurred.
  4. Bit 10 HTIF3 : Half transfer (HT) flag for channel 3
    0: No HT event
    1: An HT event occurred.
  5. Bit 9 TCIF3 : Transfer complete (TC) flag for channel 3
    0: no TC event
    1: A TC event occurred.
  6. Bit 8 GIF3 : Global interrupt flag for channel 3
    0: No TE, HT, or TC event
    1: A TE, HT, or TC event occurred.
  7. Bit 7 TEIF2 : Transfer error (TE) flag for channel 2
    0: No TE event
    1: A TE event occurred.
  8. Bit 6 HTIF2 : Half transfer (HT) flag for channel 2
    0: No HT event
    1: An HT event occurred.
  9. Bit 5 TCIF2 : Transfer complete (TC) flag for channel 2
    0: No TC event
    1: A TC event occurred.
  10. Bit 4 GIF2 : Global interrupt flag for channel 2
    0: No TE, HT, or TC event
    1: A TE, HT, or TC event occurred.
  11. Bit 3 TEIF1 : Transfer error (TE) flag for channel 1
    0: No TE event
    1: A TE event occurred.
  12. Bit 2 HTIF1 : Half transfer (HT) flag for channel 1
    0: No HT event
    1: An HT event occurred.
  13. Bit 1 TCIF1 : Transfer complete (TC) flag for channel 1
    0: No TC event
    1: A TC event occurred.
  14. Bit 0 GIF1 : Global interrupt flag for channel 1
    0: No TE, HT, or TC event
    1: A TE, HT, or TC event occurred.

13.6.2 DMA interrupt flag clear register (DMA_IFCR)

Address offset: 0x04

Reset value: 0x0000 0000

This register may mix secure and non-secure information, depending on the secure mode of each channel (SECM bit of the DMA_CCRx register).

A secure software is able to set any flag clear bit of the DMA_IFCR, and order DMA hardware to clear any corresponding flag(s) in the DMA_ISR register.

A non-secure software is restricted to order DMA hardware to clear the non-secure flag(s) in the DMA_ISR, by setting any non-secure corresponding flag clear bit(s) of the DMA_IFCR register.

This register may mix privileged and unprivileged information, depending on the privileged mode of each channel (PRIV bit of the DMA_CCRx register).

A privileged software is able to set any flag clear bit of the DMA_IFCR, and order DMA hardware to clear any corresponding flag(s) in the DMA_ISR register.

An unprivileged software is restricted to order DMA hardware to clear the unprivileged flag(s) in the DMA_ISR, by setting any unprivileged corresponding flag clear bit(s) of the DMA_IFCR register.

Setting the global clear bit CGIFx of the channel x in this DMA_IFCR register, causes the DMA hardware to clear the corresponding GIFx bit and any individual flag among TEIFx, HTIFx, TCIFx, in the DMA_ISR register.

Setting any individual clear bit among CTEIFx, CHTIFx, CTCIFx in this DMA_IFCR register, causes the DMA hardware to clear the corresponding individual flag and the global flag GIFx in the DMA_ISR register, provided that none of the two other individual flags is set.

Writing 0 into any flag clear bit has no effect.

31302928272625242322212019181716
Res.Res.Res.Res.CTEIF7CHTIF7CTCIF7CGIF7CTEIF6CHTIF6CTCIF6CGIF6CTEIF5CHTIF5CTCIF5CGIF5
wwwwwwwwwwww
1514131211109876543210
CTEIF4CHTIF4CTCIF4CGIF4CTEIF3CHTIF3CTCIF3CGIF3CTEIF2CHTIF2CTCIF2CGIF2CTEIF1CHTIF1CTCIF1CGIF1
wwwwwwwwwwwwwwww

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

Bit 27 CTEIF7 : Transfer error flag clear for channel 7

Bit 26 CHTIF7 : Half transfer flag clear for channel 7

Bit 25 CTCIF7 : Transfer complete flag clear for channel 7

Bit 24 CGIF7 : Global interrupt flag clear for channel 7

Bit 23 CTEIF6 : Transfer error flag clear for channel 6

Bit 22 CHTIF6 : Half transfer flag clear for channel 6

Bit 21 CTCIF6 : Transfer complete flag clear for channel 6

13.6.3 DMA channel x configuration register (DMA_CCRx)

Address offset: \( 0x08 + 0x14 * (x - 1) \) , ( \( x = 1 \) to \( 7 \) )

Reset value: 0x0000 0000

This register contains secure and privileged information: the secure state and the privileged state of the channel x (SECM and PRIV control bits).

Modifying the SECM bit must be performed by a secure write access to this register.
Modifying the PRIV bit must be performed by a privileged write access to this register.

Setting any of the DSEC or SSEC bits must be performed by a secure write access to this register.

Except SECM and PRIV control bits, any other register field is non-readable by a non-secure software if the SECM bit is set, and non-readable by an unprivileged software if the PRIV bit is set.

The register fields/bits PRIV, DSEC, SSEC, SECM, MEM2MEM, PL[1:0], MSIZE[1:0], PSIZE[1:0], MINC, PINC, and DIR are read-only when EN = 1.

The states of MEM2MEM and CIRC bits must not be both high at the same time.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRIVDSECSSECSECMRes.
1514131211109876543210
Res.MEM2MEMPL[1:0]MSIZE[1:0]PSIZE[1:0]MINCPINCCIRCDIRTEIEHTIETCIEEN
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bit 20 PRIV : Privileged mode

This bit can only be set and cleared by a privileged software.

0: Disabled

1: Enabled

This bit must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

Bit 19 DSEC : Security of the DMA transfer to the destination

This bit can only be read, set or cleared by a secure software. It must be a privileged software if the channel is in privileged mode.

This bit is cleared by hardware when the securely written data bit 17 is cleared (on a secure reconfiguration of the channel as non-secure).

A non-secure read to this secure configuration bit returns 0.

A non-secure write of 1 to this secure configuration bit has no impact on the register setting and an illegal access pulse is asserted.

Destination (peripheral or memory) of the DMA transfer is defined by the direction DIR configuration bit.

0: Non-secure DMA transfer to the destination

1: Secure DMA transfer to the destination

This bit must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

Bit 18 SSEC : Security of the DMA transfer from the source

This bit can only be accessed - read, set or cleared - by a secure software. It must be a privileged software if the channel is in privileged mode.

This bit is cleared by hardware when the securely written data bit 17 is cleared (on a secure reconfiguration of the channel as non -secure).

A non-secure read to this secure configuration bit returns 0.

A non-secure write of 1 to this secure configuration bit has no impact on the register setting and an illegal access pulse is asserted.

Source (peripheral or memory) of the DMA transfer is defined by the direction DIR configuration bit.

0: Non-secure DMA transfer from the source

1: Secure DMA transfer from the source

This bit must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

Bit 17 SECM : Secure mode

This bit can only be set or cleared by a secure software.

0: Non-secure channel

1: Secure channel

This bit must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

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

Bit 14 MEM2MEM : Memory-to-memory mode

0: Disabled

1: Enabled

Note: This bit is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

Bits 13:12 PL[1:0] : Priority level

00: Low

01: Medium

10: High

11: Very high

Note: This bitfield is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

Bits 11:10 MSIZE[1:0] : Memory size

Defines the data size of each DMA transfer to the identified memory.

In memory-to-memory mode, this bitfield identifies the memory source if DIR = 1 and the memory destination if DIR = 0.

In peripheral-to-peripheral mode, this bitfield identifies the peripheral source if DIR = 1 and the peripheral destination if DIR = 0.

00: 8 bits

01: 16 bits

10: 32 bits

11: Reserved

Note: This bitfield is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

Bits 9:8 PSIZE[1:0] : Peripheral size

Defines the data size of each DMA transfer to the identified peripheral.

In memory-to-memory mode, this bitfield identifies the memory destination if DIR = 1 and the memory source if DIR = 0.

In peripheral-to-peripheral mode, this bitfield identifies the peripheral destination if DIR = 1 and the peripheral source if DIR = 0.

00: 8 bits

01: 16 bits

10: 32 bits

11: Reserved

Note: This bitfield is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

Bit 7 MINC : Memory increment mode

Defines the increment mode for each DMA transfer to the identified memory.

In memory-to-memory mode, this bit identifies the memory source if DIR = 1 and the memory destination if DIR = 0.

In peripheral-to-peripheral mode, this bit identifies the peripheral source if DIR = 1 and the peripheral destination if DIR = 0.

0: Disabled

1: Enabled

Note: This bit is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

Bit 6 PINC: Peripheral increment mode

Defines the increment mode for each DMA transfer to the identified peripheral.

In memory-to-memory mode, this bit identifies the memory destination if DIR = 1 and the memory source if DIR = 0.

In peripheral-to-peripheral mode, this bit identifies the peripheral destination if DIR = 1 and the peripheral source if DIR = 0.

0: Disabled

1: Enabled

Note: This bit is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

Bit 5 CIRC: Circular mode

0: Disabled

1: Enabled

Note: This bit is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

Bit 4 DIR: Data transfer direction

This bit must be set only in memory-to-peripheral and peripheral-to-memory modes.

0: Read from peripheral

1: Read from memory

Note: This bit is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

Bit 3 TEIE: Transfer error interrupt enable

0: Disabled

1: Enabled

Note: This bit is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is not read-only when the channel is enabled (EN = 1).

Bit 2 HTIE : Half transfer interrupt enable

0: Disabled

1: Enabled

Note: This bit is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is not read-only when the channel is enabled (EN = 1).

Bit 1 TCIE : Transfer complete interrupt enable

0: Disabled

1: Enabled

Note: This bit is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is not read-only when the channel is enabled (EN = 1).

Bit 0 EN : Channel enable

When a channel transfer error occurs, this bit is cleared by hardware. It can not be set again by software (channel x re-activated) until the TEIFx bit of the DMA_ISR register is cleared (by setting the CTEIFx bit of the DMA_IFCR register).

0: Disabled

1: Enabled

Note: This bit is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode)

13.6.4 DMA channel x number of data to transfer register (DMA_CNDTRx)

Address offset: 0x0C + 0x14 * (x - 1), (x = 1 to 7)

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NDT[17:16]
rwrw
1514131211109876543210
NDT[15:0]
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

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

Bits 17:0 NDT[17:0] : Number of data to transfer (0 to \( 2^{18} - 1 \) )

This bitfield is updated by hardware when the channel is enabled:

If this bitfield is zero, no transfer can be served whatever the channel status (enabled or not).

Note: This bitfield is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

13.6.5 DMA channel x peripheral address register (DMA_CPARx)

Address offset: \( 0x10 + 0x14 \times (x - 1) \) , ( \( x = 1 \) to \( 7 \) )

Reset value: 0x0000 0000

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

Bits 31:0 PA[31:0] : Peripheral address

It contains the base address of the peripheral data register from/to which the data is read/written.
When PSIZE[1:0] = 01 (16 bits), bit 0 of PA[31:0] is ignored. Access is automatically aligned to a half-word address.
When PSIZE = 10 (32 bits), bits 1 and 0 of PA[31:0] are ignored. Access is automatically aligned to a word address.
In memory-to-memory mode, this bitfield identifies the memory destination address if DIR = 1 and the memory source address if DIR = 0.
In peripheral-to-peripheral mode, this bitfield identifies the peripheral destination address if DIR = 1 and the peripheral source address if DIR = 0.

Note: This bitfield is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

13.6.6 DMA channel x memory address register (DMA_CMARx)

Address offset: \( 0x14 + 0x14 \times (x - 1) \) , ( \( x = 1 \) to \( 7 \) )

Reset value: 0x0000 0000

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

Bits 31:0 MA[31:0] : Peripheral address

It contains the base address of the memory from/to which the data is read/written.

When MSIZE[1:0] = 01 (16 bits), bit 0 of MA[31:0] is ignored. Access is automatically aligned to a half-word address.

When MSIZE = 10 (32 bits), bits 1 and 0 of MA[31:0] are ignored. Access is automatically aligned to a word address.

In memory-to-memory mode, this bitfield identifies the memory source address if DIR = 1 and the memory destination address if DIR = 0.

In peripheral-to-peripheral mode, this bitfield identifies the peripheral source address DIR = 1 and the peripheral destination address if DIR = 0.

Note: This bitfield is set and cleared by software (privileged/secure software if the channel is in privileged/secure mode).

It must not be written when the channel is enabled (EN = 1).

It is read-only when the channel is enabled (EN = 1).

13.6.7 DMA register map

Table 81. DMA register map and reset values

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x000DMA_ISRRes.Res.Res.Res.TEIF7HTIF7TCIF7GIF7TEIF6HTIF6TCIF6GIF6TEIF5HTIF5TCIF5GIF5TEIF4HTIF4TCIF4GIF4TEIF3HTIF3TCIF3GIF3TEIF2HTIF2TCIF2GIF2TEIF1HTIF1TCIF1GIF1
Reset value0000000000000000000000000000
0x004DMA_IFCRRes.Res.Res.Res.CTEIF7CHIF7CTCIF7CGIF7CTEIF6CHIF6CTCIF6CGIF6CTEIF5CHIF5CTCIF5CGIF5CTEIF4CHIF4CTCIF4CGIF4CTEIF3CHIF3CTCIF3CGIF3CTEIF2CHIF2CTCIF2CGIF2CTEIF1CHIF1CTCIF1CGIF1
Reset value0000000000000000000000000000
0x008DMA_CCR1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRIVDSECSSECSECMRes.Res.MEM2MEMPL[1:0]MSIZE[1:0]PSIZE[1:0]MINCPINCCIRCDIRTEIEHTIETCIEEN
Reset value0000000000000000
0x00CDMA_CNDTR1Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NDT[17:0]
Reset value000000000000000
0x010DMA_CPAR1PA[31:0]
Reset value0000000000000000000000000000000
0x014DMA_CMAR1MA[31:0]
Reset value0000000000000000000000000000000
0x018ReservedReserved
0x01CDMA_CCR2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRIVDSECSSECSECMRes.Res.MEM2MEMPL[1:0]MSIZE[1:0]PSIZE[1:0]MINCPINCCIRCDIRTEIEHTIETCIEEN
Reset value0000000000000000
0x020DMA_CNDTR2Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NDT[17:0]
Reset value000000000000000
0x024DMA_CPAR2PA[31:0]
Reset value0000000000000000000000000000000
0x028DMA_CMAR2MA[31:0]
Reset value0000000000000000000000000000000
0x02CReservedReserved

Table 81. DMA register map and reset values (continued)

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x030DMA_CCR3Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRIVDSECSSECSECMRes.Res.MEM2MEMPL[1:0]MSIZE[1:0]PSIZE[1:0]MINCPINCCIRCDIRTEIEHTIETCIEEN
Reset value0000000000000000000
0x034DMA_CNDTR3Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NDT[17:0]
Reset value0000000000000000
0x038DMA_CPAR3PA[31:0]
Reset value00000000000000000000000000000000
0x03CDMA_CMAR3MA[31:0]
Reset value00000000000000000000000000000000
0x040ReservedReserved
0x044DMA_CCR4Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRIVDSECSSECSECMRes.Res.MEM2MEMPL[1:0]MSIZE[1:0]PSIZE[1:0]MINCPINCCIRCDIRTEIEHTIETCIEEN
Reset value0000000000000000000
0x048DMA_CNDTR4Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NDT[17:0]
Reset value0000000000000000
0x04CDMA_CPAR4PA[31:0]
Reset value00000000000000000000000000000000
0x050DMA_CMAR4MA[31:0]
Reset value00000000000000000000000000000000
0x054ReservedReserved
0x058DMA_CCR5Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRIVDSECSSECSECMRes.Res.MEM2MEMPL[1:0]MSIZE[1:0]PSIZE[1:0]MINCPINCCIRCDIRTEIEHTIETCIEEN
Reset value0000000000000000000
0x05CDMA_CNDTR5Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NDT[17:0]
Reset value0000000000000000
0x060DMA_CPAR5PA[31:0]
Reset value00000000000000000000000000000000
0x064DMA_CMAR5MA[31:0]
Reset value00000000000000000000000000000000
0x068ReservedReserved
0x06CDMA_CCR6Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRIVDSECSSECSECMRes.Res.MEM2MEMPL[1:0]MSIZE[1:0]PSIZE[1:0]MINCPINCCIRCDIRTEIEHTIETCIEEN
Reset value0000000000000000000
0x070DMA_CNDTR6Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NDT[17:0]
Reset value0000000000000000
0x074DMA_CPAR6PA[31:0]
Reset value00000000000000000000000000000000
0x078DMA_CMAR6MA[31:0]
Reset value00000000000000000000000000000000
0x07CReservedReserved
0x080DMA_CCR7Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.PRIVDSECSSECSECMRes.Res.MEM2MEMPL[1:0]MSIZE[1:0]PSIZE[1:0]MINCPINCCIRCDIRTEIEHTIETCIEEN
Reset value0000000000000000000

Table 81. DMA register map and reset values (continued)

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x084DMA_CNDTR7NDT[17:0]
Reset value000000000000000000000000000000000
0x088DMA_CPAR7PA[31:0]
Reset value00000000000000000000000000000000
0x08CDMA_CMAR7MA[31:0]
Reset value00000000000000000000000000000000

Refer to Section 2.6 for the register boundary addresses.