AN5224. STM32 DMAMUX: the DMA request router. Application note. Introduction

Similar documents
Using the GPIOs and interrupt controller to drive LEDs on STM8 Nucleo-64 boards

STSW-BLUENRG1-DK. BlueNRG-1, BlueNRG-2 DK SW package

Bluetooth low energy profiles for the X-CUBE-BLE1 expansion for STM32Cube. Description

AN4045 Application note

Description. January 2019 DB2381 Rev 3 1/5

AN4113 Application note

STM32 embedded target for MATLAB and Simulink release 3.1. Summary for STM32 embedded target for MATLAB and Simulink release 3.1:

AN4696 Application note

AN5123 Application note

L9958 Evaluation board for high current (8.6A) DC and Stepper Motors. Description

Getting started with X-CUBE-LED channel LED driver software expansion based on LED1642GW for STM32Cube

UM2167 User manual. OrCAD PSpice model usage instructions

UM2092 User manual. Basic metrology firmware for the STM32F103RD and the STPM32 devices. Introduction

AN4515 Application note

AN4311 Application note

Getting started with the digital MEMS microphone expansion board based on MP34DT01-M for STM32 Nucleo

P-NUCLEO-IKA02A1. STM32 Nucleo pack: electrochemical toxic gas sensor expansion board with CO sensor. Description. Features

AN3281 Application note

A scalable approach to your body, networking and security platforms. Description

AN4838. Managing memory protection unit (MPU) in STM32 MCUs. Application note. Introduction

UM0792 User manual. Demonstration firmware for the DMX-512 communication protocol transmitter based on the STM32F103Zx.

Dynamic Electro-Thermal simulator for VIPower products. Description

Getting started with the X-CUBE-IKA02A1 multifunctional software expansion for STM32Cube

NUCLEO-L496ZG. STM32 Nucleo-144 board. Features. Description

AN3996 Application Note

Description. July 2016 DocID Rev 2 1/6

AN4274 Application note

AN3279 Application Note

ST Payment Secure Solution Java Card platform with up to 100 Kbytes of user NVM for AMEX payment applications

UM2045 User manual. Getting started with the X-CUBE-NFC3 near field communication transceiver software expansion for STM32Cube.

AN2548 Application note

P-NUCLEO-USB001. STM32 Nucleo pack for USB Type-C and Power Delivery. Features. Description

EVLKSTCOMET10-1. STCOMET smart meter system-on-chip development kit. Features

STA bit single chip baseband controller for GPS and telematic applications. Features

STM32SnippetsL0. STM32L0xx Snippets firmware package. Features. Description

AN2667 Application note

SPC584Cx, SPC58ECx. 32-bit Power Architecture microcontroller for automotive ASIL-B applications. Features

USB Type-C and Power Delivery Nucleo pack with NUCLEO-F072RB expansion board based on STUSB1602. Description

STSW-STWBCFWDT. STWBC firmware downloader tool. Description. Features

AN4777 Application note

Motor control power board based on the SLLIMM-nano 2 nd series

External memory code execution on STM32F7x0 Value line and STM32H750 Value line MCUs

NUCLEO-L433RC-P NUCLEO-L452RE-P

AN4666 Application note

SPC58EHx,SPC58NHx. A scalable approach for high-end body, networking and security platforms for Automotive. Description. Features

USB Type-C and Power Delivery Nucleo pack with NUCLEO-F072RB expansion board based on the STUSB1602

STM32H7x3I-EVAL. Evaluation board with STM32H7x3XI MCUs. Data brief. Features

ST25DV-DISCOVERY. Discovery kit for the ST25DV04K dynamic NFC/RFID tag. Features

UM2255 User manual. SPC58NG-DISP user manual. Introduction

X-NUCLEO-53L0A1. Ranging and gesture detection sensor expansion board based on VL53L0X for STM32 Nucleo. Description. Features

RN0084 Release note. ST-LINK/V2 firmware upgrade. About this release note

AN4624 Application note

AN5179. RS232 communications with a terminal using the STM8 Nucleo-64 boards. Application note. Introduction

AN4872 Application note

Getting started with the software package for STEVAL-STLKT01V1 based on STM32Cube

P-NUCLEO-USB001. STM32 Nucleo pack for USB Type-C and Power Delivery Data brief. Features. Description

Emulating Dual SPI Using FlexIO

UM1844 User manual. EVAL-L9958 Graphical user interface (GUI) Introduction

AN4491 Application note

AN2261 APPLICATION NOTE

AN5181. Building a thermometer using the STM8 Nucleo-64 boards. Application note. Introduction

AN2676 Application note

P-NUCLEO-53L1A1. VL53L1X nucleo pack with X-NUCLEO-53L1A1 expansion board and STM32F401RE nucleo board. Description. Features

X-NUCLEO-53L1A1. Long distance ranging Time-of-Flight sensor expansion board based on VL53L1X for STM32 Nucleo. Description.

AN4749 Application note

ST Payment Secure Solution - Java Card platform with up to 90 Kbytes of user NVM for Visa, MasterCard, AMEX, Discover and Interac applications

TN1235 Technical note

STEVAL-CCM002V1. TFT-LCD panel demonstration board based on the STM32 as LCD controller. Features. Description

AN4943 Application note

STSW-BNRGUI. BlueNRG GUI SW package. Data brief. Features. Description

P-NUCLEO-53L0A1. VL53L0X Nucleo pack with ranging, gesture detection sensor expansion board and STM32F401RE. Description. Features

STSW-BNRG-Mesh. Mesh over Bluetooth low energy. Features. Description. Applications

SPC584C80C3, SPC58EC80C3

EVALSTGAP1AS. Demonstration board for STGAP1AS galvanically isolated single gate driver. Description. Features

AN2673 Application note

300 ma triple DC-DC converter for powering AMOLED displays. Description. Table 1: Device summary Negative voltage. Auxiliary positive voltage

Table 1. Device summary STM32G081CB, STM32G081EB, STM32G081GB, STM32G081KB, STM32G081RB. Table 2. Device variants. Device marking (1) REV_ID (2)

AN2442 Application note

STEVAL-IPMnM2N. Motor control power board based on the SLLIMM-nano 2 nd series. Description. Features. RoHS compliant

EVALKITSTKNX. Miniature transceiver STKNX evaluation and development kit. Features

STSW-L9960, STSW-L9960T Graphical User Interface (GUI) for EVAL-L9960 & EVAL-L9960T

Description SPC564A-DISP. March 2014 DocID Rev 3 1/5

EV-VNQ7003SY. VNQ7003SY Evaluation Board. Data brief. Features. Applications. Description

P-NUCLEO-6180X2. Proximity, gesture, ambient light sensor expansion board based on VL6180X for STM32L053R8. Description. Features

How to configure the BlueNRG-1 and BlueNRG-2 devices in network coprocessor mode. Main components Bluetooth Low Energy wireless system-on-chip

AN4782 Application note

Getting started with the X-CUBE-NFC5 high performance HF reader / NFC initiator IC software expansion for STM32Cube

IoT node with BLE connectivity, digital microphone, environmental and motion sensors, motion and audio middleware libraries.

Table 1: Device summary Part numbers Device info (stored in register 0xF0 and 0xF1) Comment SPIRIT1QTR 0x0130 Cut 3.0

Getting started with the STSW-BCNKT01 software package for STEVAL-BCNKT01V1 based on STM32Cube

AN2548 Application note

AN4058 Application note

UM2119 User manual. Graphical user interface (GUI) for EVAL-L9907-H. Introduction

AN2672 Application note

UM2232. Getting started with the IO-Link demonstration kit firmware. User manual. Introduction

EVAL6494L. Demonstration board for L6494L gate driver. Description. Features

AN2737 Application note Basic in-application programming example using the STM8 I 2 C and SPI peripherals Introduction

STM32L4R9I-EVAL. Evaluation board with STM32L4R9AI MCU. Features

AN3268 Application note

Getting started with osxmotiongc gyroscope calibration library for X-CUBE-MEMS1 expansion for STM32Cube

Transcription:

Application note STM32 DMAMUX: the DMA request router Introduction In order to offload certain data transfer duties from the CPU, STM32 microcontrollers embed direct memory access (DMA) controllers. The DMA can perform block-oriented data transfer upon a peripheral request or a software trigger. Each DMA channel has a software-configurable selection of the peripheral requesting its services. On legacy STM32 products, the channel request selection is implemented within the DMA controller with a restricted list of peripheral requests for a given channel. The software application cannot freely map any peripheral request to any channel. STM32 DMA request routing capabilities are enhanced by a DMA request multiplexer (DMAMUX peripheral). The DMAMUX adds more flexibility to give full dynamic DMA peripheral request mapping instead of 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 application note explains the various DMAMUX features of the products listed in the table below: how to configure the DMAMUX as well as giving guidance on the use of the new synchronization and request generation capabilities. For further information on DMAMUX in STM32 devices, refer to the product reference manuals available on www.st.com. Table 1. Applicable products Type Product series STM32H7 Series STM32 microcontrollers STM32G0 Series STM32L4+ Series STM32WB Series - Rev 3 - January 2019 For further information contact your local STMicroelectronics sales office. www.st.com

DMAMUX description 1 DMAMUX description A peripheral indicates a request for DMA transfer by setting its DMA request signal. The DMA request is pending until it is served by the DMA controller that generates a DMA acknowledge signal, and the corresponding DMA request signal is de-asserted. In this document, the set of control signals required for the DMA request/acknowledge protocol is not explicitly described and it is referred to as peripheral DMA request line. The DMA request router can be considered as an extension of the DMA controller. It routes the DMA peripheral requests to the DMA controller itself. The DMAMUX request multiplexer enables routing a DMA request line from the peripherals to the DMA controllers of the product. The routing function is ensured by a programmable multi-channel DMA request line multiplexer. Each channel (DMAMUX channel 0 in the example of the figure below) selects a unique DMA request line to forward (unconditionally or synchronously) to the associated DMA controller channel (DMA channel 0 in the example of the figure below). This allows DMA requests to be managed with a high flexibility, maximizing the number of DMA requests that run concurrently. Figure 1. DMAMUX request multiplexer P1 P2 P3... DMAMUX channel 0 DMA channel 0 Pn... DMAMUX channel 15 DMA channel 15 Px Peripheral x request (example LPUART1_TX or LPUART1_RX) - Rev 3 page 2/14

DMAMUX features 2 DMAMUX features The figure below represents a simplified DMAMUX block diagram. The Request multiplexer structure is duplicated N times depending on the number of DMA channels managed by the DMAMUX. Figure 2. DMAMUX simplified block diagram DMA requests from peripherals: dmamux_req_inx DMAMUX p 1 0 Request multiplexer n+p+2 Channel 0 DMAMUX_C0CR Channel select Ctrl Request generator Channel n DMAMUX_RGCnCR Channel 1 DMAMUX_RGC1CR Channel 0 DMAMUX_RGC0CR n 1 0 dmamux_req_genx dmamux_reqx n+3 n+2 n+1 2 1 s Sync 1 0 DMA request to DMA Channel 0: dmamux_req_out0 DMA channel event: dmamux_evt0 t 1 0 s 1 0 Trigger inputs: dmamux_trgx Note: Simplified block diagram with only one request multiplexer. Synchronization inputs: dmamux_syncx The DMAMUX is mainly composed of two components, the request multiplexer (or router block) and the request generator. The request multiplexer includes a synchronization unit per channel, with inputs/outputs as follows: Inputs: dmamux_reqx: DMA request from a peripheral (dmamux_req_inx) or from the request generator (dmamux_req_genx) dmamux_req_gen[0..n] are affected respectively to dmamux_req[1..n+1] and dmamux_req_inx are affected starting from dmamux_req[n+2]. dmamux_syncx: optional synchronization event Outputs: dmamux_req_outx: DMA request dmamux_reqx forwarded from the input to the output dmamux_evtx: optional generated event that may be used to trigger/synchronize other DMAMUX channels The request generator allows DMA request generation on interrupt signals or events, with input/output as follows: Input: dmamux_trgx, trigger event inputs to the request generator sub-block Output: dmamux_req_genx, DMA request from the request generator sub-block to the DMAMUX request multiplexer channels The number of request multiplexer blocks depends on the number of DMA channels managed by the DMAMUX. For examples: For a 8 channels DMA, 8 request multiplexer channels must be available. For a product with two DMA controllers with 8 channels each, 16 request multiplexer channels must be available. - Rev 3 page 3/14

Request routing and synchronization The request generator is instantiated once by DMAMUX. It contains N channels (depending on the product) capable of generating DMA requests. Refer to the 'DMAMUX implementation' section in the product reference manual for more details. Thanks to the request generator block, user software can trigger DMA transfers based on signals from peripherals that do not implement the DMA requests. 2.1 Request routing and synchronization 2.1.1 Unconditional request forwarding In order to perform peripheral-to-memory or memory-to-peripheral transfers, the DMA controller channel requires each time a peripheral DMA request line. Each time a request occurs, the DMA channel transfers data from/to peripheral. The DMAMUX request multiplexer channel x allows the selection/routing of the peripheral DMA request line to the DMA channel x. When the multiplex is set (DMAREQ_ID not equal to zero), it ensures the actual routing of DMA request line. The connection of peripheral DMA request to the multiplexer channel output is selected through the programmed ID in DMAREQ_ID bits of the channel control register (DMAMUX_CxCR). For each peripheral DMA request line in the product, a unique ID is affected. The value zero (DMAREQ_ID = 0x00) corresponds to no DMA request line selected. After the configuration of a DMAMUX channel, the corresponding DMA controller channel can be configured on its turn. Two different DMAMUX channels can not be configured to select the same peripheral DMA request line as source. 2.1.2 Conditional request forwarding In addition to unconditional request forwarding, the synchronization unit allows the software to implement conditional request forwarding. The routing is effectively done only when a defined condition is detected. The DMA transfers can be synchronized with internal or external signals. For example, the user software can use the synchronization unit to initiate or adjust data transmission throughput. DMA request can be forwarded in one of the following way: each time an edge is detected on a GPIO pin (EXTI) in response to a periodic event from a timer in response to an asynchronous event from a peripheral in response to an event from another request router (request chaining) On top of DMA request conditioning, the synchronization unit allows the generation of events that may be used by other DMAMUX sub-blocks (such as the request generator or another DMAMUX request multiplexer channel). - Rev 3 page 4/14

Request routing and synchronization Figure 3. DMA request line multiplexer channel - Event generation dmamux_req dmamux_req_out Request counter auto-reload DMA request counter 3 2 1 0 3 2 1 0 3 2 1 0 dmamux_evt Event generation (can be used as sync event) Request counter decrements after each transfer. When DMAMUX channel is configured in synchronous mode its behavior is as follows: 1. The request multiplexer input (DMA request from the peripheral) can become active but it is not forwarded on the DMAMUX request multiplexer output until the synchronization signal is received. 2. When the sync event is received the request multiplexer connects its input and output and the pending peripheral request, if any, is forwarded. 3. Each forwarded DMA request decrements the request multiplexer counter (user programmed value). When the counter reaches zero and the last forwarded request is acknowledged by the DMA controller, the connection between the DMA controller and the peripheral is disabled (not forwarded) waiting for a new synchronization event. For each underrun of the counter, request multiplexer line can generate an optional event to synchronize with a second DMAMUX line. The same event can be used in some low-power scenarios to switch the system back to stop mode without any CPU intervention. Synchronization mode can be used to automatically synchronize data transfers with a timer for example, or to trigger the transfers on a peripheral event. The synchronization signal (SYNC_ID), the synchronization signal polarity (SPOL) and the number of requests to forward (NBREQ+1) are configured in the request line multiplexer channel configuration register (DMAMUX_CxCR). - Rev 3 page 5/14

Request generation 2.2 Request generation The request generator can be considered as an intermediary between a peripheral and the DMA controllers. It allows peripherals without DMA capability (such as RTC alarm or comparators) to generate a programmable number of DMA requests on an event. The trigger signal (SIG_ID), the trigger polarity (GPOL) and the number of requests minus 1 to generate (GNBREQ) are configured in the request generator configuration register (DMAMUX_RGxCR). Upon the trigger event reception, the corresponding generator channel starts generating DMA requests on its output. Each time the DMAMUX generated request is served by the connected DMA controller, a built-in DMA request counter (one counter per request generator channel) is decremented. At its underrun, the request generator channel stops generating DMA requests and the DMA request counter is automatically reloaded to its programmed value upon the next trigger event. dmamux_req_gen Figure 4. DMA request generation dmamux_req_out Request counter auto-reload (wait for new trigger) Request generator counter 3 2 1 0 3 2 1 0 3 dmamux_trg Active trigger event edge Generator request counter decremets after each transfer. If a new trigger event is received while the generator is managing the previous triggered DMA request sequence, then the request trigger event overrun flag bit OFx is asserted by the hardware in the status DMAMUX_RGSR register. 2.3 Request generation and synchronization In order to implement autonomous transfer and control scenarios, the DMAMUX offers the possibility to combine request generation and request synchronization feature within the same configuration. - Rev 3 page 6/14

DMAMUX examples 3 DMAMUX examples These examples use the STM32CubeMX tool version 4.26.1, running on STM32 microcontrollers (based on Arm cores). Note: Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere. 3.1 Example using the synchronization After the configuration of the DMA channel to serve the peripheral DMA request line (example SPI6_TX), synchronization block can be enabled as shown in the figure below. In this case, the LPTIM3_out signal rising edge is used to control the transfer periods. Figure 5. Example using the synchronization (based on STM32CubeH7) Set Enable synchronization checkbox Set Synchronization signal from the list (configured in the application) Set Synchronization signal polarity Set Enable event checkbox (enable event generation) Set number of requests to be forwarded - Rev 3 page 7/14

Example using the DMAMUX request generator sub-block 3.2 Example using the DMAMUX request generator sub-block In order to have some automation, new DMA transfers can be generated following the DMA transfer to SPI6. Thanks to the DMAMUX Channel 0 event generation, the request generator can be triggered. The scenario can be configured as shown in the figure below. Figure 6. Example using the request generator (based on STM32CubeH7) Set request generation signal from the list (using the event from DMAMUX2 request generator 0) Set signal polarity (using the rising edge) Set the number of requests to be generated (from the DMAMUX2 channel 1 to the BDMA channel 1) The synchronization for this channel is not enabled. - Rev 3 page 8/14

STM32CubeH7 examples 3.3 STM32CubeH7 examples The following examples are extracted from the STM32CubeH7 ones: DMAMUX_RequestGen This example uses the EXTI0 line to trigger the DMAMUX request generator and to perform DMA data transfers from the SRAM buffer to the GPIO output data register, changing output pin state on every EXTI0 rising edge occurrence. Figure 7. DMAMUX_RequestGen SRAM4 buffer DMAMUX2 Mux Ch 0 BDMA Ch 0 Req Gen ch 0 EXTI 0 GPIOF ODR EXTI PF10 PA0 DMAMUX_SYNC This example uses the USART1 in DMA synchronized mode to send a countdown from 10 to 00 with 2 seconds period. The DMAMUX synchronization block is configured to synchronize the DMA transfer with the LPTIM1 output signal. Each rising edge of the synchronization signal (LPTIM1 output signal) authorizes four USART1 requests to be transmitted to the USART1 peripheral using the DMA. These four requests represent the two characters '\n\r' plus the two characters count down itself from '10' to '00'. LPTIM1 is configured to generate a PWM with 2 seconds period. Figure 8. DMAMUX_SYNC SRAM buffer = {10 to 00 } DMAMUX1 usart1_tx_dma Mux Ch 0 Synch NBREQ=4-1 DMA Ch 0 USART1 TX 10 09 08 lptim1_out LPTIM1 out 2 s - Rev 3 page 9/14

Conclusion 4 Conclusion The DMAMUX controller is designed to simplify embedded application resources allocation as it offers the flexibility to dynamically allocate a peripheral to a DMA channel. Additionally it increases the DMA capabilities by offering synchronization mechanism which allows an increased CPU offload from transfer control and synchronization. Also the combination of synchronization and request generation can be used to implement power optimized data transfer (in autonomous mode without CPU involvement). - Rev 3 page 10/14

Revision history Table 2. Document revision history Date Version Changes 16-Oct-2018 1 Initial release. 20-Nov-2018 2 Updated Table 1. Applicable products. 16-Jan-2019 3 Updated Section 3 DMAMUX examples. - Rev 3 page 11/14

Contents Contents 1 DMAMUX description...2 2 DMAMUX features...3 2.1 Request routing and synchronization...4 2.1.1 Unconditional request forwarding...4 2.1.2 Conditional request forwarding...4 2.2 Request generation...6 2.3 Request generation and synchronization...6 3 DMAMUX examples...7 3.1 Example using the synchronization...7 3.2 Example using the DMAMUX request generator sub-block...7 3.3 STM32CubeH7 examples...9 4 Conclusion...10 Revision history...11 - Rev 3 page 12/14

List of figures List of figures Figure 1. DMAMUX request multiplexer....2 Figure 2. DMAMUX simplified block diagram...3 Figure 3. DMA request line multiplexer channel - Event generation... 5 Figure 4. DMA request generation...6 Figure 5. Example using the synchronization (based on STM32CubeH7)....7 Figure 6. Example using the request generator (based on STM32CubeH7)... 8 Figure 7. DMAMUX_RequestGen....9 Figure 8. DMAMUX_SYNC...9 - Rev 3 page 13/14

IMPORTANT NOTICE PLEASE READ CAREFULLY STMicroelectronics NV and its subsidiaries ( ST ) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST s terms and conditions of sale in place at the time of order acknowledgement. Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of Purchasers products. No license, express or implied, to any intellectual property right is granted by ST herein. Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product. ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners. Information in this document supersedes and replaces information previously supplied in any prior versions of this document. 2019 STMicroelectronics All rights reserved - Rev 3 page 14/14