Question
STM32CubeMX and BUG in UART_DMATransmitCplt
Posted on November 02, 2015 at 12:53
STM32CubeMX V4.11
STM32Cube FW_F4 V1.9.0/** ****************************************************************************** * @file stm32f4xx_hal_uart.c * @author MCD Application Team * @version V1.4.1 * @date 09-October-2015 * @brief UART HAL module driver. * This file provides firmware functions to manage the following * functionalities of the Universal Asynchronous Receiver Transmitter (UART) peripheral: * + Initialization and de-initialization functions * + IO operation functions * + Peripheral Control functions * + Peripheral State and Errors functions * @verbatim.......
/** * @brief DMA UART transmit process complete callback. * @param hdma: DMA handle * @retval None */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) == 0) { huart->TxXferCount = 0; /* Disable the DMA transfer for transmit request by setting the DMAT bit in the UART CR3 register */ huart->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_DMAT); /* Enable the UART Transmit Complete Interrupt */ __HAL_UART_ENABLE_IT(huart, UART_IT_TC); } /* DMA Circular mode */ else { HAL_UART_TxCpltCallback(huart); }}very similar to that lacks the following code fragment:
if(huart->State == HAL_UART_STATE_BUSY_TX_RX) { huart->State = HAL_UART_STATE_BUSY_RX; } else { huart->State = HAL_UART_STATE_READY; }as in
/** * @brief DMA UART receive process complete callback. * @param hdma: DMA handle * @retval None */static void UART_DMAReceiveCplt(DMA_HandleTypeDef *hdma) { UART_HandleTypeDef* huart = ( UART_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent; /* DMA Normal mode*/ if((hdma->Instance->CR & DMA_SxCR_CIRC) == 0) { huart->RxXferCount = 0; /* Disable the DMA transfer for the receiver request by setting the DMAR bit in the UART CR3 register */ huart->Instance->CR3 &= (uint32_t)~((uint32_t)USART_CR3_DMAR); /* Check if a transmit process is ongoing or not */ if(huart->State == HAL_UART_STATE_BUSY_TX_RX) { huart->State = HAL_UART_STATE_BUSY_TX; } else { huart->State = HAL_UART_STATE_READY; } } HAL_UART_RxCpltCallback(huart);}