cancel
Showing results for 
Search instead for 
Did you mean: 

how to use UART with DMA

NKann.1
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee

Hello @NKann.1​ ,

Please consider the following example and article:

Hope this helps you 🙂

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

8 REPLIES 8
Imen.D
ST Employee

Hello @NKann.1​ ,

Please consider the following example and article:

Hope this helps you 🙂

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Thanks a lot Imen DAHMEN

You are welcome 🙂

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
TFBorth
Associate II

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?

Juanjo97
Associate II

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.

TFBorth
Associate II

Thanks @Juanjo97 , now it's working!

Georgy Moshkin
Senior II

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 

Disappointed with crowdfunding projects? Make a lasting, meaningful impact as a Tech Sponsor instead: Visit TechSponsor.io to Start Your Journey!

Thank you for this