diff --git a/os/hal/platforms/STM32/USARTv1/uart_lld.c b/os/hal/platforms/STM32/USARTv1/uart_lld.c index d09f96c93..496fb0e13 100644 --- a/os/hal/platforms/STM32/USARTv1/uart_lld.c +++ b/os/hal/platforms/STM32/USARTv1/uart_lld.c @@ -395,6 +395,7 @@ void uart_lld_init(void) { #if STM32_UART_USE_USART1 uartObjectInit(&UARTD1); UARTD1.usart = USART1; + UARTD1.dmamode = STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE; UARTD1.dmarx = STM32_DMA_STREAM(STM32_UART_USART1_RX_DMA_STREAM); UARTD1.dmatx = STM32_DMA_STREAM(STM32_UART_USART1_TX_DMA_STREAM); #endif @@ -402,6 +403,7 @@ void uart_lld_init(void) { #if STM32_UART_USE_USART2 uartObjectInit(&UARTD2); UARTD2.usart = USART2; + UARTD2.dmamode = STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE; UARTD2.dmarx = STM32_DMA_STREAM(STM32_UART_USART2_RX_DMA_STREAM); UARTD2.dmatx = STM32_DMA_STREAM(STM32_UART_USART2_TX_DMA_STREAM); #endif @@ -409,6 +411,7 @@ void uart_lld_init(void) { #if STM32_UART_USE_USART3 uartObjectInit(&UARTD3); UARTD3.usart = USART3; + UARTD3.dmamode = STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE; UARTD3.dmarx = STM32_DMA_STREAM(STM32_UART_USART3_RX_DMA_STREAM); UARTD3.dmatx = STM32_DMA_STREAM(STM32_UART_USART3_TX_DMA_STREAM); #endif @@ -430,8 +433,6 @@ void uart_lld_init(void) { */ void uart_lld_start(UARTDriver *uartp) { - uartp->dmamode = STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE; - if (uartp->state == UART_STOP) { #if STM32_UART_USE_USART1 if (&UARTD1 == uartp) { diff --git a/os/hal/platforms/STM32/USARTv2/uart_lld.c b/os/hal/platforms/STM32/USARTv2/uart_lld.c index 378f93348..bcb399496 100644 --- a/os/hal/platforms/STM32/USARTv2/uart_lld.c +++ b/os/hal/platforms/STM32/USARTv2/uart_lld.c @@ -362,6 +362,7 @@ void uart_lld_init(void) { #if STM32_UART_USE_USART1 uartObjectInit(&UARTD1); UARTD1.usart = USART1; + UARTD1.dmamode = STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE; UARTD1.dmarx = STM32_DMA_STREAM(STM32_UART_USART1_RX_DMA_STREAM); UARTD1.dmatx = STM32_DMA_STREAM(STM32_UART_USART1_TX_DMA_STREAM); #endif @@ -369,6 +370,7 @@ void uart_lld_init(void) { #if STM32_UART_USE_USART2 uartObjectInit(&UARTD2); UARTD2.usart = USART2; + UARTD2.dmamode = STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE; UARTD2.dmarx = STM32_DMA_STREAM(STM32_UART_USART2_RX_DMA_STREAM); UARTD2.dmatx = STM32_DMA_STREAM(STM32_UART_USART2_TX_DMA_STREAM); #endif @@ -376,6 +378,7 @@ void uart_lld_init(void) { #if STM32_UART_USE_USART3 uartObjectInit(&UARTD3); UARTD3.usart = USART3; + UARTD3.dmamode = STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE; UARTD3.dmarx = STM32_DMA_STREAM(STM32_UART_USART3_RX_DMA_STREAM); UARTD3.dmatx = STM32_DMA_STREAM(STM32_UART_USART3_TX_DMA_STREAM); #endif @@ -390,8 +393,6 @@ void uart_lld_init(void) { */ void uart_lld_start(UARTDriver *uartp) { - uartp->dmamode = STM32_DMA_CR_DMEIE | STM32_DMA_CR_TEIE; - if (uartp->state == UART_STOP) { #if STM32_UART_USE_USART1 if (&UARTD1 == uartp) { diff --git a/readme.txt b/readme.txt index 7946caea0..d5ba0a6ba 100644 --- a/readme.txt +++ b/readme.txt @@ -92,7 +92,9 @@ to 2.4.3). - FIX: Potential problem with RTC_CRL_RSF bit (bug 3593972)(backported to 2.4.3). -- FIX: Fixed DMA reconfiguration problem in STM32 SPI driver (bug 3592809) +- FIX: Fixed STM32 UART driver redundant initialization (bug 3592809) + (backported to 2.4.3). +- FIX: Fixed DMA reconfiguration problem in STM32 SPI driver (bug 3592764) (backported to 2.4.3). - FIX: Fixed wrong stack initializations in GCC STM32L1xx port files (bug 3591321)(backported to 2.4.3).