on
2021-09-16
12:59 AM
- edited on
2024-10-23
08:31 AM
by
Laurids_PETERSE
DMAMUX is included in the latest STM32 microcontrollers (STM32H7/G0/G4/L4+/L5/WB/MP1 Series) and is an enhancement over the previous DMA controller, providing more flexibility and fully dynamic peripheral request mapping over pseudo-dynamic mapping.
It offers fully configurable routing of any DMA request from a given peripheral to any DMA controller and/or controller DMA channel. This article will briefly explain the DMAMUX as well as how to use it.
The DMAMUX request multiplexer enables routing DMA request lines from the peripherals to the DMA controllers in the products. The routing function is ensured by a programmable multi-channel DMA request line multiplexer. Each channel selects a unique DMA request line to forward (unconditionally or synchronously) to the associated DMA controller channel. This allows DMA requests to be managed with a high flexibility, maximizing the number of DMA requests that run concurrently.
Features include:
The DMAMUX is easy to use and configure with STM32CubeMX and its flexibility will be shown in this section.
This example uses the STM32G071RBTx as the target device. The SPI peripheral will be configured to use DMAMUX for serial communication with another device. Using STM32CubeMX for the configuration will illustrate the ease of use and flexibility of DMAMUX.
The first step within STM32CubeMX is to enable the SPI peripheral that is going to be used for serial communication (see figure below):
The next step is to click on DMA Settings to make those configurations:
We are going to add two DMA Requests, one for SPI RX (reception) and one for SPI TX (transmission). To do this click on Add.
Now click on Select in the drop-down box and then click on SPI1_RX.
Because of DMAMUX's flexibility you can select any DMA channel for the peripheral you are using. In this example case, channel 3 is selected by clicking on the drop-down box and clicking on DMA1 Channel 3.
The next step is to select the DMAMUX channel for SPI1_TX. Again, due to the flexibility of DMAMUX, any channel is available and channel 7 is used in this example.
As illustrated in this example, DMAMUX offers the flexibility to select any DMA channel to be used with the peripherals as opposed to being limited to a specific channel.
More details including the advanced features of DMAMUX are described in the associated application note mentioned in the Links section.
For more details on DMAMUX please refer to the following application note:
Introduction to DMAMUX for STM32 MCUs
For more information about STM32CubeMX, please refer to the webpage.
This (and AN5224) is completely incorrect, because
I've ranted about this for years, e.g. https://community.st.com/s/question/0D53W000006s8dISAQ/dmamux-to-dma-channelstream-numbering-discrepancy, and while RM0440 I mentioned specifically there has been subsequently fixed, RM0444 for example does not mention the mapping not even in the incorrect way. I of course won't check all RMs containing DMAMUX (hence needing this subchapter) for ST. By now, I am tired by repeating the same thing again and again, just because ST "fixes" one particular "complaint/ticket" but can't communicate a broader issue internally.
That you magically fix it up in various Cubes is entirely irrelevant.
Btw. AN5224 is an opportunity to give an overview of all instances of DMAMUX and all mappings.
JW
@ST AME Support NF
@Imen DAHMEN
Thanks a lot. The fixed RM0440 saved me quite some time. Nether the less the DMAMUX chapter still is a mess. The difference between "unconditional request forwarding" and "conditional request forwarding" is not described. Without AN5224 it is really hard to understand the DMAMUX. Also Figure 32 of RM0440 is missing (page 428), which should be equal or similar to Figure 2 of AN5224 (or the second Figure on this page).
I'm referring to revision 7 of RM0440 and revision 5 of AN5224.