EasyManuals Logo

ST STM32F31xx User Manual

ST STM32F31xx
584 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #536 background imageLoading...
Page #536 background image
Universal synchronous asynchronous receiver
transmitter (USART)
UM1581
536/584
DocID023800 Rev 1
 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.
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:
 Configure the DMA using DMA_Init() function.
 Active the needed channel Request using USART_DMACmd() function.
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:
 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:
M bit
PCE bit
UART frame
0
0
SB | 8 bit data | STB
0
1
SB | 7 bit data | PB | STB
1
0
SB | 9 bit data | STB
1
1
SB | 8 bit data | PB | STB
(++) 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:
 USART Clock Enabled.
 USART polarity.
 USART phase.
 USART LastBit.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

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

ST STM32F31xx Specifications

General IconGeneral
BrandST
ModelSTM32F31xx
CategoryMicrocontrollers
LanguageEnglish

Related product manuals