UM1940
USART HAL driver macros list
Below the list of most used macros in USART HAL driver.
__HAL_USART_ENABLE: Enable the USART peripheral
__HAL_USART_DISABLE: Disable the USART peripheral
__HAL_USART_GET_FLAG : Check whether the specified USART flag is set or not
__HAL_USART_CLEAR_FLAG : Clear the specified USART pending flag
__HAL_USART_ENABLE_IT: Enable the specified USART interrupt
__HAL_USART_DISABLE_IT: Disable the specified USART interrupt
48.2.2
Initialization and Configuration functions
This subsection provides a set of functions allowing to initialize the USART in
asynchronous and in synchronous modes.
For the asynchronous mode only these parameters can be configured:
The HAL_USART_Init() function follows the USART synchronous configuration procedure
(details for the procedure are available in reference manual (RM0329)).
This section contains the following APIs:
HAL_USART_Init()
HAL_USART_DeInit()
HAL_USART_MspInit()
HAL_USART_MspDeInit()
48.2.3
IO operation functions
This subsection provides a set of functions allowing to manage the USART synchronous
data transfers.
The USART supports master mode only: it cannot receive or send data related to an input
clock (SCLK is always an output).
1.
There are two modes of transfer:
You can refer to the USART HAL driver header file for more useful macros
Baud Rate
Word Length
Stop Bit
Parity: If the parity is enabled, then the MSB bit of the data written in the data
register is transmitted but is changed by the parity bit. Depending on the frame
length defined by the M bit (8-bits or 9-bits), please refer to Reference manual for
possible USART frame formats.
USART polarity
USART phase
USART LastBit
Receiver/transmitter modes
Blocking mode: The communication is performed in polling mode. The HAL
status of all data processing is returned by the same function after finishing
transfer.
No-Blocking mode: The communication is performed using Interrupts or DMA,
These API's return the HAL status. The end of the data processing will be
DocID028236 Rev 2
HAL USART Generic Driver
675/1371
Need help?
Do you have a question about the STM32F2 and is the answer not in the manual?