From 76885ca908319d2f6b587ccd363bffa4f038cbfc Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Thu, 4 Aug 2022 19:08:28 -0400 Subject: [PATCH] =?UTF-8?q?[stm32][drv=5Fserial]=20=E4=BF=AE=E5=A4=8Drecv?= =?UTF-8?q?=5Flen=E6=84=8F=E5=A4=96=E4=B8=BA=E8=B4=9F=EF=BC=88=E5=8D=B3?= =?UTF-8?q?=E5=BE=88=E5=A4=A7=E6=AD=A3=E6=95=B0=EF=BC=89=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/RT-Thread/rt-thread/issues/6106 https://github.com/RT-Thread/rt-thread/issues/4467#issuecomment-850814143 --- bsp/stm32/libraries/HAL_Drivers/drv_usart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_usart.c b/bsp/stm32/libraries/HAL_Drivers/drv_usart.c index 63644bc719..97de96b22d 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_usart.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_usart.c @@ -489,7 +489,7 @@ static void dma_isr(struct rt_serial_device *serial) } else { - recv_len = recv_total_index - uart->dma_rx.last_index; + recv_len = serial->config.bufsz - uart->dma_rx.last_index + recv_total_index; } uart->dma_rx.last_index = recv_total_index; rt_hw_interrupt_enable(level);