From 706c0410cd9bc68102e0c39657f695e72a1d1e44 Mon Sep 17 00:00:00 2001 From: HubretXie Date: Sat, 12 Jan 2019 15:03:37 +0800 Subject: [PATCH] =?UTF-8?q?[stm32][drv=5Fusart]=E4=BF=AE=E5=A4=8D=E4=B8=B2?= =?UTF-8?q?=E5=8F=A3=E4=B8=AD=E6=96=AD=E6=8E=A5=E6=94=B6=E4=B8=A2=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 使用串口中断方式接收数据,读取数据时会自动清除标识,这里再次清除中断标识会导致下一个数据丢失。 使用finsh就可以测出这个问题,中断接收丢数据时无法查看历史命令。 --- bsp/stm32/libraries/HAL_Drivers/drv_usart.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_usart.c b/bsp/stm32/libraries/HAL_Drivers/drv_usart.c index 87543442b6..03ba4c6f2a 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_usart.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_usart.c @@ -235,8 +235,6 @@ static void uart_isr(struct rt_serial_device *serial) (__HAL_UART_GET_IT_SOURCE(&(uart->handle), UART_IT_RXNE) != RESET)) { rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND); - /* Clear RXNE interrupt flag */ - UART_INSTANCE_CLEAR_FUNCTION(&(uart->handle), UART_FLAG_RXNE); } #ifdef RT_SERIAL_USING_DMA else if ((uart->uart_dma_flag) && (__HAL_UART_GET_FLAG(&(uart->handle), UART_FLAG_IDLE) != RESET) &&