HAL Library 07- USART for STM32Fxxx

Here it is. UART library for HAL based libraries. If you don’t know, how UART work on STM32Fxxx devices, then you might take a look at my first library, where I also explained how to used it.

This library works successfully on F4 and F7 based devices for now. I will add support for F0 too as soon as possible.

Library

Read more about new HAL libraries

Features

  • Supports up to 8 UART peripherals at a time
  • Interrupt driven RX
  • Support for different UART omdes
  • Support for receiveing string
  • Support for sending string/character/array
  • Supports multiple predefined GPIO pins for specific UART or custom based pin initialization

Dependencies

  • HAL
  • TM
    • STM32Fxxx HAL
    • defines.h
    • GPIO
    • BUFFER

Pinouts

Below are possible USART pins. You select them on USART initialization.

Pins pack 1 Pins pack 2 Pins pack 3
U(S)ARTx TX RX TX RX TX RX
USART1 PA9 PA10 PB6 PB7
USART2 PA2 PA3 PD5 PD6
USART3 PB10 PB11 PC10 PC11 PD8 PD9
UART4 PA0 PA1 PC10 PC11
UART5 PC12 PD2
USART6 PC6 PC7 PG14 PG9
UART7 PE8 PE7 PF7 PF6
UART8 PE1 PE0

Functions and enumerations

Example 1

Example 2

Example 3

Projects are available on Github, download all libraries below.

tilz0R

Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!