Skip to content

Commit

Permalink
Update drv_usart_v2.c
Browse files Browse the repository at this point in the history
修复stm32h7开启DCache之后,串口dma发送数据不同步的bug
  • Loading branch information
xinliu0260 authored Dec 8, 2024
1 parent ec900a7 commit 060f9c4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@ static rt_ssize_t stm32_transmit(struct rt_serial_device *serial,

if (uart->uart_dma_flag & RT_DEVICE_FLAG_DMA_TX)
{
#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U)
struct rt_serial_tx_fifo *tx_fifo = (struct rt_serial_tx_fifo *) serial->serial_tx;
SCB_CleanDCache_by_Addr((uint32_t *)tx_fifo->rb.buffer_ptr, tx_fifo->rb.buffer_size);
#endif
HAL_UART_Transmit_DMA(&uart->handle, buf, size);
return size;
}
Expand Down

0 comments on commit 060f9c4

Please sign in to comment.