197
ATmega16M1/32M1/64M1 [DATASHEET]
8209E–AVR–11/2012
considers that the in-coming character is irrelevant without reading it, he directly can clear the flag (see specific flag
The intrinsic structure of the Rx service offers a 2-byte buffer. The fist one is used for serial to parallel conversion,
the second one receives the result of the conversion. This second buffer byte is reached reading LINDAT register.
If the 2-byte buffer is full, a new in-coming character will overwrite the second one already recorded. An OVRERR
error in LINERR register will then accompany this character when read.
A FERR error in LINERR register will be set in case of framing error.
20.4.7.3
Tx service
If this service is enabled, the user sends a character by writing in LINDAT register. Automatically the LTXOK flag of
LINSIR register is cleared. It will rise at the end of the serial transmission. If no new character has to be sent,
There is no transmit buffering.
No error is detected by this service.
20.5
LIN / UART description
20.5.1
Reset
The AVR core reset logic signal also resets the LIN/UART controller. Another form of reset exists, a software reset
controlled by LSWRES bit in LINCR register. This self-reset bit performs a partial reset as shown in
Table 20-2.20.5.2
Clock
The I/O clock signal (clk
i/o) also clocks the LIN/UART controller. It is its unique clock.
20.5.3
LIN protocol selection
LIN13 bit in LINCR register is used to select the LIN protocol:
LIN13 = 0 (default): LIN 2.1 protocol
LIN13 = 1: LIN 1.3 protocol
The controller checks the LIN13 bit in computing the checksum (enhanced checksum in LIN2.1 / classic checksum
This bit is irrelevant for UART commands.
Table 20-2.
Reset of LIN/UART registers.
Register
Name
Reset Value
LSWRES value
Comment
LIN control reg.
LINCR
0000 0000
b
0000 0000
b
x=unknown
u=unchanged
LIN status & interrupt reg.
LINSIR
0000 0000
b
0000 0000
b
LIN enable interrupt reg.
LINENIR
0000 0000
b
xxxx 0000
b
LIN error reg.
LINERR
0000 0000
b
0000 0000
b
LIN bit timing reg.
LINBTR
0010 0000
b
0010 0000
b
LIN baud rate reg. low
LINBRRL
0000 0000
b
uuuu uuuu
b
LIN baud rate reg. high
LINBRRH
0000 0000
b
xxxx uuuu
b
LIN data length reg.
LINDLR
0000 0000
b
0000 0000
b
LIN identifier reg.
LINIDR
1000 0000
b
1000 0000
b
LIN data buffer selection
LINSEL
0000 0000
b
xxxx 0000
b
LIN data
LINDAT
0000 0000
b
0000 0000
b