# USART

A minimal UART setup can be achieved by setting up the [Starter Project](https://tk233.gitbook.io/notes/stm32/getting-started-stm32-edition/going-through-a-starter-project). 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.

![](https://1287130752-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvVJ0h2a4qMIhB1I8GdV8%2Fuploads%2Fgit-blob-fdb5dd2d097d5d14800cfcfca68768d456f7bb4f%2Fimage.png?alt=media)

{% 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>" %}
