5.1.7.2.1. Informational Requirements
USART is a module that enables serial communication between devices. |
There are three USART peripherals and their configuration is as follows: |
- USART1:
TX: PA9 or PB6
RX: PA10 or PB7
Alternate Function: AF7
- USART2:
TX: PA2 or PD5
RX: PA3 or PD6
Alternate Function: AF7
- USART6:
TX: PC6 or PG14
RX: PC7 or PG9
Alternate Function: AF8
The two modes of USART are synchronous and asynchronous. |
Asynchronous mode uses start and stop bits to indicate the beginning and end of transmission. |
Asynchronous mode does not require a clock line. |
Synchronous mode uses a clock line between the devices. |
In synchronous mode both devices send and receive data. |
|
BRR: Baud Rate Register, used to set the baud rate for communication. |
Oversampling is a process where the data is sampled multiple times during one bit of transmission. |
Oversampling is used in order to get better accuracy in asynchronous mode. |
16x oversampling (1) is the standard mode which enables a stable signal. |
8x oversampling (0) enables a faster data transmission and is not as precise. |
Oversampling is adjusted in CR1. |
CR1 is used to configure the parameters of USART. |
The bits in CR1 are: UE (USART enable), TE (Transmitter enable), RE (Receiver enable). |
UE enables or disables USART. |
TE enables or disables data transmission. |
RE enables or disables data reception. |
RXNE bit in USART_SR is used to check if the byte of data is available (1) or not available (0). |
RCC: Reset and Clock Control, used to enable the clock for USART. |
DR: Data Register, used to hold data to be transmitted. |
SR: Status Register, used to check the status of the USART, including the TXE (Transmit Data Register Empty) flag. |
TXE (Transfer Data Register Empty) is a bit in the USART_SR. |
If TXE is 1 the register is empty and a new byte can be sent. |
TC (Transmission Complete) is a bit in USART_SR. |
If the value of TC is 1 the byte was successfully sent and the transfer is done. |
Uncorrupted data means that no changes in data occurred in the transmission process. |