how to use UART with DMA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 1:34 AM
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.
Solved! Go to Solution.
- Labels:
-
DMA
-
STM32H7 Series
-
UART-USART
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 12:26 PM
Hello @NKann.1​ ,
Please consider the following example and article:
- Application note regarding STM32 UART DMA RX/TX
- DMA is not working on STM32H7 device
Hope this helps you :)
Imen
Thanks
Imen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 12:26 PM
Hello @NKann.1​ ,
Please consider the following example and article:
- Application note regarding STM32 UART DMA RX/TX
- DMA is not working on STM32H7 device
Hope this helps you :)
Imen
Thanks
Imen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-23 9:54 PM
Thanks a lot Imen DAHMEN
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-24 3:34 AM
You are welcome :)
Thanks
Imen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-14 5:06 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-14 5:17 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-14 5:38 AM
Thanks @Juanjo97 , now it's working!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-30 9:18 PM - edited ‎2023-09-30 9:21 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-05 1:07 AM
Thank you for this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-08-11 11:34 PM
Why do we need to set gstate to HAL_UART_STATE_READY ,in uart isr ? because if we use dma for uart tx, lets say we have 100bytes to transfer, after we sent data uart tx isr will be triggered after the 1st byte of the data , shouldnt it be HAL_UART_STATE_BUSY_TX untill the last byte ?
