Initialization And Configuration Functions - ST STM32F31xx User Manual

Table of Contents

Advertisement

Universal synchronous asynchronous receiver
transmitter (USART)
4.
Program the Baud Rate, Word Length , Stop Bit, Parity, Hardware flow control and
Mode(Receiver/Transmitter) using the SPI_Init() function.
5.
For synchronous mode, enable the clock and program the polarity, phase and last bit
using the USART_ClockInit() function.
6.
Enable the NVIC and the corresponding interrupt using the function
USART_ITConfig() if you need to use interrupt mode.
7.
When using the DMA mode:
8.
Enable the USART using the USART_Cmd() function.
9.
Enable the DMA using the DMA_Cmd() function, when using DMA mode.
Refer to Multi-Processor, LIN, half-duplex, Smartcard, IrDA sub-sections for more details.
23.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:
M bit
0
0
1
1
(++) Hardware flow control. (++) Receiver/transmitter modes.
The USART_Init() function follows the USART asynchronous configuration
procedure(details for the procedure are available in reference manual.
For the synchronous mode in addition to the asynchronous mode parameters these
parameters should be also configured:
536/584
Configure the desired pin in alternate function by: GPIO_InitStruct->GPIO_Mode
= GPIO_Mode_AF.
Select the type, pull-up/pull-down and output speed via GPIO_PuPd,
GPIO_OType and GPIO_Speed members.
Call GPIO_Init() function.
Configure the DMA using DMA_Init() function.
Active the needed channel Request using USART_DMACmd() function.
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), the possible USART frame formats
are as listed in the following table:
PCE bit
0
1
0
1
USART Clock Enabled.
USART polarity.
USART phase.
USART LastBit.
DocID023800 Rev 1
UART frame
SB | 8 bit data | STB
SB | 7 bit data | PB | STB
SB | 9 bit data | STB
SB | 8 bit data | PB | STB
UM1581

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F31xx and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Stm32f30xx

Table of Contents