cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UART_Transmit_DMA problem

Min-Kyoung Kim
Associate III
Posted on February 06, 2017 at 14:22

I had problem for 'HAL_UART_Transmit_DMA', once I transmitted some data, I couldn't send any data after that.

I used this function,

'HAL_UART_Transmit_DMA' in 'USART1_IRQHander'.

(Because I should parse the data as soon as I receive any data. (N of data is not fixed.).)

So I found the solution in this forum. And I succeeded using'HAL_UART_Transmit_DMA'.

I attached one line(huart->gState = HAL_UART_STATE_READY;) in 'UART_DMATransmitCplt' like below.

static void UART_DMATransmitCplt(DMA_HandleTypeDef *hdma)
{
 UART_HandleTypeDef* huart = ( UART_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
 /* DMA Normal mode*/
 if((hdma->Instance->CR & DMA_SxCR_CIRC) == 0U)
 {
 huart->TxXferCount = 0U;
/* Disable the DMA transfer for transmit request by setting the DMAT bit
 in the UART CR3 register */
 CLEAR_BIT(huart->Instance->CR3, USART_CR3_DMAT);
/* Enable the UART Transmit Complete Interrupt */
 SET_BIT(huart->Instance->CR1, USART_CR1_TCIE);
huart->gState = HAL_UART_STATE_READY; <- this!!!!
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?

But I wonder if I can use

'HAL_UART_Transmit_DMA' in'USART1_IRQHander'.

Does any problem happen later?

Please answer me,

#usart1 #dam
10 REPLIES 10
Posted on February 09, 2017 at 22:33

Correct