HAL UART Overview ¶
Introducing UART ¶
- group UART_Introduction
-
The UART hardware abstraction layer provides a set of APIs to interface with STM32 peripherals such as UART (Universal Asynchronous Receiver Transmitter), LPUART (Low-Power UART) and USART (Universal Synchronous/Asynchronous Receiver Transmitter) supporting the UART communications (asynchronous, half-duplex single-wire, multiprocessor, LIN, ModBus, …).
It simplifies the configuration, initialization, and management of asynchronous UART communications by supporting various modes, such as polling, interrupt, and DMA, for efficient data transfer.
This abstraction layer ensures portability and ease of use across different STM32 series, as well as multiple peripherals supporting the UART communications (USART, UART, and LPUART).
Module and files ¶
The following diagram illustrates the UART module and its associated files.
Component diagram ¶
The following diagram illustrates the software components involved in the UART module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.
Configuration table ¶
The following table lists the configuration defines for the HAL UART module, specifying their locations, default values, and descriptions:
- group UART_Configuration_Table
-
¶
9- Configuration inside the UART driver: ¶
Software configuration defined in stm32c5xx_hal_conf.h:
Preprocessor flags
Default value
Comment
USE_HAL_UART_MODULE
1
Enable HAL UART driver module
USE_HAL_UART_REGISTER_CALLBACKS
0
Allows you to define your own callback
USE_HAL_UART_DMA
1
Enable DMA code inside the HAL UART
USE_HAL_CHECK_PARAM
0
Enable runtime parameter checking
USE_HAL_UART_CLK_ENABLE_MODEL
HAL_CLK_ENABLE_NO
Enable the gating of the peripheral clock
USE_HAL_CHECK_PROCESS_STATE
0
Enable atomicity of process state checking
USE_HAL_MUTEX
0
Enable semaphore creation for OS
USE_HAL_UART_USER_DATA
0
Add user data inside the HAL UART handle
USE_HAL_UART_GET_LAST_ERRORS
0
Enable retrieval of the last process error codes
Software configuration defined in preprocessor environment:
Preprocessor flags
Default value
Comment
USE_ASSERT_DBG_PARAM
Not defined
Enable parameter checking for HAL and LL
USE_ASSERT_DBG_STATE
Not defined
Enable state checking for HAL