Introduction To LIN (Local Interconnect Network)
Introduction To LIN (Local Interconnect Network)
Introduction To LIN (Local Interconnect Network)
LIN
(Local Interconnect Network)
Stéphane REY
Revision 1.0 - May 13th, 2003
Table of content
1 INTRODUCTION ...................................................................................................................3
1.1 PURPOSE OF THE DOCUMENT.............................................................................................3
1.2 ACRONYMOUS .................................................................................................................3
1.3 R ELATED DOCUMENTS ......................................................................................................3
1.4 R EFERENCE DOCUMENTS ..................................................................................................3
2 OVERVIEW ...........................................................................................................................4
2.1 INTRODUCTION ................................................................................................................4
2.2 MAIN FEATURES ...............................................................................................................4
2.3 TOPOLOGY .....................................................................................................................5
2.4 EXAMPLE OF LIN IMPLEMENTATION .....................................................................................6
2.5 LIN ADVANTAGES .............................................................................................................6
3 PROTOCOL..........................................................................................................................7
3.1 STRUCTURE OF A MESSAGE ...............................................................................................7
3.1.1 Synchronization break ................................................................................................7
3.1.2 Synchronization byte..................................................................................................8
3.1.3 Identifier byte.............................................................................................................8
3.1.4 Data byte...................................................................................................................9
3.1.5 Cheksum byte............................................................................................................9
3.2 W AKE-UP / SLEEP MODES .................................................................................................9
3.2.1 Sleep mode conditions ............................................................................................. 10
3.2.2 Wake-up conditions .................................................................................................. 10
3.3 ERRORS DETECTION ....................................................................................................... 11
3.3.1 Master error detection .............................................................................................. 11
3.3.2 Slave error detection ................................................................................................ 11
Introduction to LIN
1 INTRODUCTION
This document is intended to give a general introduction to the LIN. It’s a compilation
of informations from the lin specifications. It describes the features and highlights the
main advantages of this communication bus.
1.2 Acronymous
Page 3/11
Introduction to LIN
2 OVERVIEW
2.1 Introduction
LIN was designed by the LIN consortium and the first specification has been
published in 1999. The consortium members are mainly European cars constructors :
Audi AG, BMW AG, Daimler Chrysler AG, Volkswagen AG, Volvo Cars Corporation
AB, Motorola and Volcano Communications Technologies.
Many car constructors are currently implementing LIN in their vehicles like PSA.
It was particularly designed for low-cost communication between smart sensors and
actuators in automotive applications. It's intended to be used when high bitrates
communications as CAN bus are not needed. It can be based on the UART/SCI
hardware interface, software UART or state-machine.
Applications may be Instrument cluster, air conditioning, seats, mirrors, rain sensors,
light sensors, door locking, windows, ...
Bitrates
(bits/s)
LIN vs others Automotive bus protocols
25M
D2B,MOST
Token ring
Optical bus
2M
TTx,Flexray
Time triggered
2x2 wires
Fault tolerant
1M
CAN-C Bluetooth
Multi-master Wireless
Two wires
125K CAN-B
Multi-master
Two wires
Fault tolerant
J1850
20K
LIN
Master-slave
Single wire
No crystal
s Mono-master, up to 15 slaves
s 1 wire bus
s Bitrates from 1 to 20 Kbits/s : 2.4, 9.6 and 19.2 Kbits are usually used in
automotive applications
s Multicast (broadcast) messages
Page 4/11
Introduction to LIN
The specifications describes 3 of the 7 layers of the OSI model : physical layer, data
link and application layers.
2.3 Topology
A LIN network consists of a LIN master and one or several LIN slaves. Usually in
automotive application, the LIN bus is connected between smart sensor or actuators
and an Electronic Control Unit (ECU) which is often a gateway with CAN bus.
You may find several LIN busses not interconnected between them as shown in the
figure below. This is a major difference with other low-cost busses as K-line which
was intended to link all the ECUs to an external analyse tool for diagnosis purpose.
Page 5/11
Introduction to LIN
LIN
Door Universal
panel
Module
LIN
Universal panel
• Easy to use,
• Components available,
• Cheaper than CAN and other communications busses,
• Harness reduction,
• More reliable vehicles,
• Extension easy to implement.
Page 6/11
Introduction to LIN
3 PROTOCOL
The LIN master knows the sequential order of all data to be transmitted and sends
requests to slaves. These requests are achieved by sending a header.
The data are INTEL coded which means that LSB are sent first.
A slave can detect a synchronization break by measuring the low phase duration
which is higher than a databyte length.
SYNCH. BREAK FIELD SYNCH. FIELD
= T SYNBRK TSYNDEL
Page 7/11
Introduction to LIN
The synchronization byte is only sent by the master. It’s used for slave self-
synchronization.
SYNCH. FIELD
8 T BIT
START STOP
BIT
0 1 2 3 4 5 6 7 BIT
LSB MSB
A slave defines a bit duration by measuring the 8 bits length and dividing by 8. This
defines the baudrate.
The identifier byte defines the containt and length of the following data. There is 64
identifiers sorted in 4 groups of 16 messages.
IDENTIFIER FIELD
Parity
Identifier bits bits
START
ID0 ID1 ID2 ID3 ID4 ID5 P0 P1 STOP
BIT BIT
LSB MSB
This is the message identifier. There is identifiers from the specification which covers
the LIN protocol. Some identifiers are reserved for future extension and custom
messages.
Page 8/11
Introduction to LIN
The data length is defined by ID5 and ID6 from the identifier field. It can be 2, 4 or
bytes. The data can be transmitted either by the master or the slave.
DATA FIELD
START D0 D1 D2 D3 D4 D5 D6 D7 STOP
BIT BIT
LSB MSB
The checksum (CRC) is computed only on the data field. All other fields are not
included.
CHECKSUM FIELD
START C0 C1 C2 C3 C4 C5 C6 C7 STOP
BIT BIT
LSB MSB
The value of the checksum is equal to the inverted modulo 256 sum.
This means : Checksum = (1 - ∑data ) mod 256.
The carry of the previous addition is added to the LSB of the next addition.
The LIN protocol allows to be in sleep mode to be compliant with the standards and
the environmental constraints. When the vehicle isn´t used, the consumption of the
whole vehicle have to be less than a few milliamps in order to not discharge the
battery. So, each ECU has to enter in sleep mode. Thus, strategies have been
implemented to manage the sleep/wake-up modes on the communication busses.
Page 9/11
Introduction to LIN
The master has to send three times the sleep mode request : identifier 0x3C and
data byte 0x00. The slaves have to enter in sleep mode in less than 25000 BitTime
and then the bus remains to the recessive level.
The time between the first sleep command and the effective sleep mode is below
30ms+Tsleep.
When the bus remains in the recessive level during a specified time, the ECUs have
to enter in sleep mode.
If an event occurs, a slave can awake the master and the communication will start
again. It will use the wake-up identifier 0x80. The master has to manage a bad wake-
up signal. When the bus becomes dominant, it’s a wake-up condition. However, the
master has to check the wake-up message validity to start again the normal
operation.
The master can awake the slaves by sending the wake-up message 0x80. Once the
request has been sent, the master starts again its normal communication.
Page 10/11
Introduction to LIN
There is no error diagnosis thru the LIN. This means that the detected errors are not
sent on the LIN. However, the following errors have to be managed by the ECUs :
- bit error : the monitored output bit is different from the transmitted one,
- checksum error,
- identifier parity error,
- slave no answer,
- bad synchronization frame,
- inactive bus = sleep mode.
The master has to manage most of the errors recovering. It means that it has to apply
a specified faliure mode when needed.
When transmitting a message, the slave has to monitor the follwing error :
- bit error
- End Of Document -
Page 11/11