RM0016 Universal asynchronous receiver transmitter (UART)
Doc ID 14587 Rev 8 333/449
22.4 LIN mode functional description
In LIN mode, 8-bit data format with 1 stop bit is required in accordance with the LIN
standard.
To configure these settings, clear the M bit in UART_CR1 register and clear the STOP[1:0]
bits in the UART_CR3 register.
22.4.1 Master mode
UART initialization
Procedure:
1. Select the desired baudrate by programming the UART_BRR2 and UART_BRR1
registers.
2. Enable LIN mode by setting the LINEN bit in the UART_CR3 register.
3. Enable the transmitter and receiver by setting the TEN and REN bits in the UART_CR2
register.
LIN header transmission
According to the LIN protocol, any communication on the LIN bus is triggered by the Master
sending a Header, followed by the response. The Header is transmitted by the Master Task
(master node) while the data are transmitted by the Slave task of a node (master node or
one of the slave nodes).
Procedure without error monitoring:
1. Request Break + Delimiter transmission (13 dominant bits and 1 recessive bit) by
setting the SBK bit in the UART_CR2 register.
2. Request Synch Field transmission by writing 0x55 in the UART_DR register.
3. Wait for the TC flag in the UART_SR register.
4. Request Identifier Field transmission by writing the protected identifier value in the
UART_DR register.
5. Wait for the TC flag in the UART_SR register.
Procedure with error monitoring:
1. Request Break + Delimiter transmission (13 dominant bits and 1 recessive bit) by
setting the SBK bit in the UART_CR2 register;
2. Wait for the LBDF flag in the UART_CR4 register.
3. Request Synch Field transmission by writing 0x55 into UART_DR register.
4. Wait for the RXNE flag in the UART_SR register and read back the UART_DR register.
5. Request Identifier Field transmission by writing the protected identifier value in the
UART_DR register.
6. Wait for the RXNE flag in the UART_SR register and read back the UART_DR register.
The LBDF flag is set only if a valid Break + Delimiter has been received back on the
UART_RX pin.