Skip to main content
NKann.1
Associate II
June 23, 2021
Solved

how to use UART with DMA

  • June 23, 2021
  • 5 replies
  • 8323 views

I am using STM32H7B0VBT6 MCU.

i want to transmit data using UART with DMA in normal mode.

i am using "HAL_UART_Transmit_DMA(&huart4, &UART4_array[0], UART4_ARRAY_SIZE);"

it sends only once , next time it do not work. Where i am doing wrong ? am I using wrong syntax ?

Please help me.

Best answer by Imen.D

Hello @NKann.1​ ,

Please consider the following example and article:

Hope this helps you :)

Imen

5 replies

Imen.DBest answer
ST Technical Moderator
June 23, 2021

Hello @NKann.1​ ,

Please consider the following example and article:

Hope this helps you :)

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
NKann.1
NKann.1Author
Associate II
June 24, 2021

Thanks a lot Imen DAHMEN

ST Technical Moderator
June 24, 2021

You are welcome :)

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
Associate II
September 14, 2023

Dear @NKann.1 , I facing the same problem with stm32h725ze. I've tried to implement the suggested solutions but nothing was effective... The strange thing is that configuring DMA as circular the communication runs...
How did you solve your issue in this case?

Associate II
September 14, 2023

To transmit USART/UART with DMA using HAL, you need to enable the global interrupt for the USART/UART you are using. This is necessary because the HAL library, when using DMA, sets huart->gstate to HAL_UART_STATE_BUSY_TX and does not set it back to HAL_UART_STATE_READY. You can do this manually or enable UART global interrupts automatically by configuring NVIC settings in your .ioc file.

Associate III
April 5, 2024

Thank you for this

Associate II
September 14, 2023

Thanks @Juanjo97 , now it's working!

Georgy Moshkin
Senior
October 1, 2023

Try my new multi-port uart dma library which works on f1,f4,h7 and can be easily modified through defines to support more series: https://github.com/georgy-moshkin/stm32uart 

Configure UART ports using stm32cubeide, enable global interrupts, dma, and circular mode for RX channel. Use COM_Init with HAL's huart1, huart2, etc. pointers and you can start sending/receiving from multiple uart ports using simple functions.

Tutorial on how to use can be found here: https://youtu.be/ZlsmW7s1N10 

Check my STM32 Bootloader - flash your STM32 with AES-encrypted binaries right from web browser!