How To Use STM32’s UART with DMA, Module 1: Creating convenient library for transmitting and receiving data using STM32’s UART.
Course Description
Through this module, you’ll learn how to use STM32’s UART the right way. Everything you’ve seen before is garbage! Just trash it… We will create a serial library which is fast, reliable and can be easily reused in different projects. Multi-port, powered by HAL and compatible with any STM32 microcontroller series.
There are many STM32 UART myths created by incompetent people. E.g., that DMA can’t be used with variable-size data packets and other nonsense. Avoiding DMA peripheral is one of the worst things you can do. It is much simpler to make really good UART code when DMA is used.
Many will say that their UART code is reliable, good, etc. Do you believe it? We will perform two simple tests to ensure that our serial library is reliable:
- Loopback test to ensure that each byte is sent and received correctly.
- Hot-plug test to ensure that communication can be resumed after cable is re-connected.
Our serial library must be portable across multiple STM32 series. Generally, we should consider portability across microcontrollers from different manufactures. E.g., porting code to Microchip’s PIC32 would be complicated if our library heavily relies on STM32’s “idle” interrupt. Thus, we know what functions to avoid if we want our library to be more portable.