cancel
Showing results for 
Search instead for 
Did you mean: 

Inquiry about DMA and Uart

imenjazirii
Visitor

Hello, 

I am making a project where i'm using usart2 as a virtual com port and where i'm making a CLI based HMI using teraterm , so there's a lot of diplay and hal_uart_transmit functions , it all worked fine until I added a DMA in the uart1 in order to read gps data.

What happened is that the HMI menu doesn't work as it used to but when i removed the gps reading data part from dma receive to idle it worked like it used to.

Someone told me that using DMA in receive mode like that + Hal_Uart_Transmit causes a block.

Since HAl_uart_transmit is a blocking function, it will cause problems for dma receive ,

And among the problems is that my functions in HMI don't work anymore like they used to, but at the same time i can implement dma with adc and it works fine, the problem is in the uart 

Can anyone please explain to me the logic behind it? The issue reminded me of the Hal_delay() block when used inside an interrupt.

You'll find in the first picture how the normal behaviour should be and in the second one what actually happened when dma is also used 

imenjazirii_0-1749829169644.png

imenjazirii_1-1749829260086.png

 

 

 

3 REPLIES 3
TDK
Super User

There are no inherent issues using HAL_UART_Transmit and HAL_UART_Receive_DMA at the same time.

The issues you describe are likely due to a bug in user code, perhaps in how you are using the HAL functions.

If you feel a post has answered your question, please click "Accept as Solution".
Saket_Om
ST Employee

Hello @imenjazirii 

Could share your code please? 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om
Karl Yamashita
Principal

If you're sending "gps" and not getting anything back, then it's probably has to do how you've set up the DMA.

Show your code.

Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.