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);