From 194fd6df0544deb69b3bc0b25939e56f013f71a1 Mon Sep 17 00:00:00 2001 From: sheltonyu Date: Thu, 16 May 2024 17:44:02 +0800 Subject: [PATCH] [bsp/at32] 1.fixed f402 uart7/8 pierph clock source error, 2.fixed compiling error of drv_usart_v2.c with no dma --- .../drivers/src/at32f402_405_usart.c | 2 +- bsp/at32/libraries/rt_drivers/drv_usart_v2.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bsp/at32/libraries/AT32F402_405_Firmware_Library/drivers/src/at32f402_405_usart.c b/bsp/at32/libraries/AT32F402_405_Firmware_Library/drivers/src/at32f402_405_usart.c index a6fe06efe1..0b9c450f13 100644 --- a/bsp/at32/libraries/AT32F402_405_Firmware_Library/drivers/src/at32f402_405_usart.c +++ b/bsp/at32/libraries/AT32F402_405_Firmware_Library/drivers/src/at32f402_405_usart.c @@ -115,7 +115,7 @@ void usart_init(usart_type* usart_x, uint32_t baud_rate, usart_data_bit_num_type crm_clocks_freq_type clocks_freq; uint32_t apb_clock, temp_val; crm_clocks_freq_get(&clocks_freq); - if((usart_x == USART1) || (usart_x == USART6) || (usart_x == UART7) || (usart_x == UART8)) + if((usart_x == USART1) || (usart_x == USART6)) { apb_clock = clocks_freq.apb2_freq; } diff --git a/bsp/at32/libraries/rt_drivers/drv_usart_v2.c b/bsp/at32/libraries/rt_drivers/drv_usart_v2.c index 57ccb36e11..a0c3455e9a 100644 --- a/bsp/at32/libraries/rt_drivers/drv_usart_v2.c +++ b/bsp/at32/libraries/rt_drivers/drv_usart_v2.c @@ -398,7 +398,9 @@ static rt_ssize_t at32_transmit(struct rt_serial_device *serial, rt_uint8_t *buf if(instance->uart_dma_flag & RT_DEVICE_FLAG_DMA_TX) { +#ifdef RT_SERIAL_USING_DMA _uart_dma_transmit(instance, buf, size); +#endif return size; }