428
CHAPTER 20 LIN-UART
●
Communication:
For initialization of the synchronous mode, following settings have to be done:
Baud rate generator registers (BGR0/BGR1):
Set the desired reload value for the dedicated baud rate reload counter.
Serial mode register (SMR):
MD1, MD0: "10
B
" (Mode 2)
SCKE:"1" for the dedicated baud rate reload counter
"0" for external clock input
SOE: "1" for transmission and reception
"0" for reception only
Serial control register (SCR):
RXE, TXE: set one or both of these bits to "1"
AD: no address/data selection - don’t care
CL: automatically fixed to 8-bit data - don’t care
CRE: "1" to clear receive error flags. Suspend transmission and reception.
-- when SSM=0:
PEN, P, SBL: don’t care
-- when SSM=1:
PEN: "1" if parity bit is added/detected, "0" if not
P: "0" for even parity, "1" odd parity
SBL: "1" for 2 stop bits, "0" for 1 stop bit.
Serial status register (SSR):
BDS: "0" for LSB first, "1" for MSB first
RIE: "1" if reception interrupts are used; "0" reception interrupts are disabled.
TIE: "1" if transmission interrupts are used; "0" transmission interrupts are disabled.
Extended communication control register (ECCR):
SSM: "0" if no start/stop bits are desired (normal); "1" for adding start/stop bits (exteneded function)
MS: "0" for master mode (LIN-UART generates the serial clock); "1" for slave mode (LIN-UART
receives serial clock from the master device)
Note:
To start the communication, write data to TDR register. When receiving the data, disable the serial
output (SMR: SOE = "0") and write the dummy data to TDR. By enabling the continuous clock and
start/stop bits, in the bi-directional communication the same as the asynchronous mode is allowed.