cancel
Showing results for 
Search instead for 
Did you mean: 

Implement UART Transmit in DMA mode correct way

phenom
Associate II

I am using stm32f779I eval kit. I am using example UART_HyperTerminal_DMA by en.stm32cubef7.

I am trying to implement UART in DMA mode to transmit a simple string.

So I have used CubeMX to generate the code and I have configured UART1 TX DMA in normal mode.

Whenever I run the code in debugging mode, I see the first time I attemp to send the string, it works ok and sends the string.

But I couldn't send a second transmission.

Can any one please suggest the correct way to use Uart Tx in DMA mode? How can I send successive strings one after another?

E.g. :

i used

 if(HAL_UART_Transmit_DMA(&UartHandle, (uint8_t*)aTxStartMessage, TXSTARTMESSAGESIZE-10)!= HAL_OK)

 {

  /* Transfer error in transmission process */

  Error_Handler();

 }

 if(HAL_UART_Transmit_DMA(&UartHandle, (uint8_t*)aTxStartMessage, TXSTARTMESSAGESIZE-10)!= HAL_OK)

 {

  /* Transfer error in transmission process */

  Error_Handler();

 }

2 times HAL_UART_Transmit_DMA() API. 2nd time API has huart->gState == HAL_UART_STATE_BUSY_TX

14 REPLIES 14

polling UART (HAL_UART_Transmit) and HAL_UART_Transmit_IT both are working properly.

Even Uart Rx in dma mode is also working properly.

Having issues with Uart TX DMA only.

i forgot please change (&huart1, str_tx, str_tx_len); to>> (&huart1, &str_tx[0], str_tx_len);

KRich.4
Associate

Hey,

I am facing the same issue. How did you solve it? Thank you for your Answer.

I am using a STM32G4

Facing exactly same issue, have you ever find the solution and root cause? DISCOVERY 1 stm32f407 board...

You haven't posted any code so no telling what could be wrong.

See if this helps https://github.com/karlyamashita/Nucleo-G431RB_Three_UART/wiki

 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.