2017-02-06 05:22 AM
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 #dam2017-02-09 02:33 PM
Correct