Universal synchronous asynchronous receiver transmitter (USART)
RM0090
964/1731
DocID018909 Rev 11
Figure 298. Configurable stop bits
Procedure:
1.
Enable the USART by writing the UE bit in USART_CR1 register to 1.
2. Program the M bit in USART_CR1 to define the word length.
3. Program the number of stop bits in USART_CR2.
4. Select DMA enable (DMAT) in USART_CR3 if Multi buffer Communication is to take
place. Configure the DMA register as explained in multibuffer communication.
5. Select the desired baud rate using the USART_BRR register.
6. Set the TE bit in USART_CR1 to send an idle frame as first transmission.
7. Write the data to send in the USART_DR register (this clears the TXE bit). Repeat this
for each data to be transmitted in case of single buffer.
8. After writing the last data into the USART_DR register, wait until TC=1. This indicates
that the transmission of the last frame is complete. This is required for instance when
the USART is disabled or enters the Halt mode to avoid corrupting the last
transmission.
Single byte communication
Clearing the TXE bit is always performed by a write to the data register.
The TXE bit is set by hardware and it indicates:
•
The data has been moved from TDR to the shift register and the data transmission has
started.
•
The TDR register is empty.
•
The next data can be written in the USART_DR register without overwriting the
previous data.
This flag generates an interrupt if the TXEIE bit is set.
Bit0
Bit1
Bit2
Bit3
Bit4
Bit5
Bit6
Bit7
Start
Bit
Stop
bit
Next
start
bit
8-bit Word length (M bit is reset)
Possible
parity
bit
Data frame
Next data frame
****
** LBCL bit controls last data clock pulse
CLOCK
**
Bit0
Bit1
Bit2
Bit3
Bit4
Bit5
Bit6
Bit7
Start
Bit
2 Stop
Bits
Next
Start
Bit
Possible
parity
bit
Data frame
Next data frame
Bit0
Bit1
Bit2
Bit3
Bit4
Bit5
Bit6
Bit7
Start
Bit
Next
start
bit
Possible
Parity
Bit
Data frame
Next data frame
1/2 stop bit
Bit0
Bit1
Bit2
Bit3
Bit4
Bit5
Bit6
Bit7
Start
Bit
Next
start
bit
Possible
Parity
Bit
Data frame
Next data frame
1 1/2 stop bits
a) 1 Stop Bit
b) 1 1/2 stop Bits
c) 2 Stop Bits
d) 1/2 Stop Bit