STM32H5 DMA Overview

GPDMA

GPDMA is a peripheral device on the AHB bus with dual-port masters. It is used to transfer data between external and/or memory through chaining. All programmable transfers by GPDMA provide higher efficiency at the system level, relieving the CPU from performing these data transfer tasks.

STM32CubeMX Setting

Unlike the old DMA, all settings are consolidated into the GPDMA. In interfaces where DMA needs to be enabled, the settings are directly linked to the GPDMA configuration. Typically, standard mode is set here.

Note that different channels may have different word lengths.

GPDMA Coding

You could refer the UART sample

#deifne RX_SIZE  (16)
#define TX_SIZE  (33)
  
ALIGN_32BYTES (uint8_t tx1_buffer[])="**STM32H5 UART Test with Polling**\r\n\n";
ALIGN_32BYTES (uint8_t tx_buffer[])="**STM32H5 UART Test with DMA**\r\n\n";
ALIGN_32BYTES (uint8_t rx_buffer[16]);
  
_HAL_LINKDMA(&huart3, hdmarx , handle_GPDMA1_Channel0);
_HAL_LINKDMA(&huart3, hdmatx, handle_GPDMA1_Channel1);%
   
   HAL_UART_Receive_DMA(&huart3,  rx_buffer,  RX_SIZE);//For RX
   
     /* USER CODE BEGIN WHILE */
while (1)
  {

    HAL_Delay(2023);

  HAL_UART_Transmit_DMA(&huart3, (uint8_t *)tx_buffer, TX_SIZE);
  //HAL_UART_Transmit(&huart3, (uint8_t *)tx1_buffer, 37,0xfff);
   huart3.gState = HAL_UART_STATE_READY
   
  }

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart