> For the complete documentation index, see [llms.txt](https://tk233.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tk233.gitbook.io/notes/stm32/connectivity/usart.md).

# USART

A minimal UART setup can be achieved by setting up the [Starter Project](/notes/stm32/getting-started-stm32-edition/going-through-a-starter-project.md). This section will introduce some advanced concepts like interrupt and DMA transfer.

## 1. Interrupt

## 2. DMA

> Note: sometimes CUBEIDE will put the `DMAinit()` code after the `UART_init` code in the autogenerated section. If this happens, UART will **not** work!
>
> We need to manually move the `DMA_init()` piece to the top.

![](/files/JK0YoRlTzgRY57kvEvol)

{% embed url="<https://community.st.com/s/question/0D50X0000BbKaA5SQK/haluarttransmitdma-doesnt>" %}

HAL\_UARTEx\_RxEventCallback

{% embed url="<https://community.st.com/s/question/0D53W00000cyh6MSAQ/uartdmarxhalfcplt-is-bugged-for-stm32g0>" %}
