cancel
Showing results for 
Search instead for 
Did you mean: 

UART using DMA communication problem

HKim.28
Associate

Hello,

I'm posting a question to get advice on a problem about communication with UART using DMA.

I wrote code like followings : Transmit data only when HAL_DMA_STATE is ready.

  

 if(HAL_DMA_GetState(hdma) == HAL_DMA_STATE_READY)

  HAL_UART_Transmit(huart, msg, len);

During the experiment for several UART ports, the port using DMA1 Stream operated normally.

But the port using DMA2 Stream found a problem that data could not be transmitted.

During finding cause of this problem, It was confirmed that HAL_DMA_STATE is maintained in Busy state, after sending data for the first time.

How can I solve the problem that HAL_DMA_STATE of DMA2 not returning to Ready and remaining Busy?

<Note>

  • After setting the MCU through CubeIDE, the code is generated using 'Generate Code'
  • All global interrupts are enabled in 'NVIC Settings' of UART/USART ports
  • The 'MX_DMA_Init()' function is located just below the 'MX_GPIO_Init()' function.
  • MCU is STM32F767ZITx
1 REPLY 1
HKim.28
Associate

I solved this by changing the pinout settings.