Local Interconnect Network
Encyclopedia
The LIN-Bus is a vehicle bus
Vehicle bus
A vehicle bus is a specialized internal communications network that interconnects components inside a vehicle...

 standard or computer networking bus-system used within current automotive network architectures.
The LIN specification is enforced by the LIN-consortium, with the first exploited version
Protocol versioning
Since digital communications protocols are controlled by software, protocol versioning generally follows software versioning standards....

 being 1.1, released in 1999. Since then the specification has evolved to version 2.2 to meet current networking needs.

The LIN bus is a small and slow network system that is used as a cheap sub-network of a CAN
Controller Area Network
Controller–area network is a vehicle bus standard designed to allow microcontrollers and devices to communicate with each other within a vehicle without a host computer....

 bus to integrate intelligent sensor devices or actuators in today’s cars.
Recently LIN may be used also over the vehicle's battery power-line with a special DC-LIN transceiver.

Network topology

LIN is a broadcast
Broadcasting (networks)
right|250pxIn telecommunication and information theory, broadcasting refers to a method of transferring a message to all recipients simultaneously...

 serial
Serial communications
In telecommunication and computer science, serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus. This is in contrast to parallel communication, where several bits are sent as a whole, on a link with several parallel channels...

 network comprising one master and typically up to 12 slaves. All messages are initiated by the master with at most one slave replying for a given message identifier. Therefore it is not necessary to implement a collision detection.
The master is typically a microcontroller
Microcontroller
A microcontroller is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM...

, whereas the slaves are implemented as ASIC
Application-specific integrated circuit
An application-specific integrated circuit is an integrated circuit customized for a particular use, rather than intended for general-purpose use. For example, a chip designed solely to run a cell phone is an ASIC...

s.

Current uses combine the low cost efficency of LIN and simple sensors to create small networks. These sub-systems can be connected by back-bone-network. (i.e. CAN in cars)

Overview

The LIN bus is an inexpensive serial communications protocol, which effectively supports remote application within a car’s network. It is particularly intended for mechatronic nodes in distributed automotive applications, but is equally suited to industrial applications. It is intended to complement the existing CAN network leading to hierarchical networks within cars.

In the late 1990s the Local Interconnect Network (LIN) Consortium was founded by five European automakers, Volcano Automotive Group and Freescale. The first fully implemented version of the new LIN specification was published in November 2002 as LIN version 1.3. In September 2003 version 2.0 was introduced to expand configuration capabilities and make provisions for significant additional diagnostics features and tool interfaces

The protocol’s main features are listed below:
  • Single master, up to 16 slaves (i.e. no bus arbitration).
    • Slave Node Position Detection (SNPD) allows node address assignment after power-up
  • Single wire communications up to 19,2 kbit/s @ 40 meter bus length.

  • Guaranteed latency times.
  • Variable length of data frame (2, 4 and 8 byte).
  • Configuration flexibility.
  • Multi-cast reception with time synchronization, without crystals or ceramic resonators.
  • Data checksum and error detection.
  • Detection of defective nodes.
  • Low cost silicon implementation based on standard UART
    Universal asynchronous receiver/transmitter
    A universal asynchronous receiver/transmitter, abbreviated UART , is a type of "asynchronous receiver/transmitter", a piece of computer hardware that translates data between parallel and serial forms. UARTs are commonly used in conjunction with communication standards such as EIA RS-232, RS-422 or...

    /SCI
    Serial communication
    In telecommunication and computer science, serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or computer bus. This is in contrast to parallel communication, where several bits are sent as a whole, on a link with several parallel channels...

     hardware.
  • Enabler for hierarchical networks.
  • Operating Voltage of 12 V.


Data is transferred across the bus in fixed form messages of selectable lengths. The master task transmits a header that consists of a break signal followed by synchronization and identifier fields. The slaves respond with a data frame that consists of between 2, 4 and 8 data bytes plus 3 bytes of control information.

LIN Message frame

A message contains the following fields:
  • Synchronization break,
  • Synchronization byte,
  • Identifier byte,
  • Data bytes,
  • Checksum byte.


Frame Types:
  • 1- Unconditional Frame:
    • Unconditional frames always carry signals and their identifiers are in the range 0 to 59 (0x00 to 0x3b). All subscribers of the unconditional frame shall receive the frame and make it available to the application (assuming no errors were detected).

  • 2- Event triggered Frame
    • The purpose of an event triggered frame is to increase the responsibility of the LIN cluster without assigning too much of the bus bandwidth to the polling of multiple slave nodes with seldom occurring events. The first data byte of the carried unconditional frame shall be equal to its protected identifier. The publisher of an associated unconditional frame shall only provide the carried by its frame is updated. If none of the slave tasks responds to the header the rest of the frame slot is silent and the header is ignored. If more than one slave task responds to the header in the same frame slot a collision will occur, the master has to resolve the collision by requesting all associated unconditional frames before requesting the event triggered frame again.

  • 3- Sporadic Frame

The header of a sporadic frame shall only be sent in its associated frame slot when the master task knows that a signal carried in the frame has been updated. The publisher of the sporadic frame shall always provide the response to the header.
  • 4- Diagnostic Frame
    • Diagnostic frame always carry diagnostic or configuration data and they always contain eight data bytes. The identifier is either 60 (0x3C) ,called master request frame, or 61(0x3D),called slave response frame. Before generating the header of a diagnostic frame, the master task requires its diagnostic module if it shall be sent or if the bus shall be silent. The slave tasks publish and subscribe to the response according to their diagnostic module.

  • 5- User-Defined Frame
    • User-Defined frames carry any kind of information. Their identifier is 62 (0x3E). The header of a user -defined frame is always transmitted when a frame slot allocated to the frame is processed

  • 6- Reserved Frame
    • Reserved frames shall not be used in a LIN 2.0 cluster. Their identifier is 63 (0x3F).

LIN hardware

The LIN specification was designed to allow very cheap hardware-nodes being used within a network. It is a low-cost, single-wire network based on ISO 9141
On-board diagnostics
On-Board Diagnostics, or OBD, in an automotive context, is a generic term referring to a vehicle's self-diagnostic and reporting capability. OBD systems give the vehicle owner or a repair technician access to state of health information for various vehicle sub-systems...

. In today’s car networking topologies, microcontrollers with either UART
Universal asynchronous receiver/transmitter
A universal asynchronous receiver/transmitter, abbreviated UART , is a type of "asynchronous receiver/transmitter", a piece of computer hardware that translates data between parallel and serial forms. UARTs are commonly used in conjunction with communication standards such as EIA RS-232, RS-422 or...

 capability or dedicated LIN hardware are used.
The microcontroller generates all needed LIN data (protocol ...) (partly) by software and is connected to the LIN network via a LIN transceiver
Transceiver
A transceiver is a device comprising both a transmitter and a receiver which are combined and share common circuitry or a single housing. When no circuitry is common between transmit and receive functions, the device is a transmitter-receiver. The term originated in the early 1920s...

 (simply speaking, a level shifter with some add-ons). Working as a LIN node is only part of the possible functionality.
The LIN hardware may include this transceiver and works as a pure LIN node without added functionality.

As LIN Slave nodes should be as cheap as possible, they may generate their internal clocks by using RC oscillator
RC oscillator
Linear electronic oscillator circuits, which generate a sinusoidal output signal, are composed of an amplifier and a frequency selective element, a filter. An oscillator circuit which uses an RC network, a combination of resistors and capacitors, for its frequency selective part is called an RC...

s instead of crystal oscillator
Crystal oscillator
A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency...

s (quartz or a ceramic).
To ensure the baud
Baud
In telecommunications and electronics, baud is synonymous to symbols per second or pulses per second. It is the unit of symbol rate, also known as baud rate or modulation rate; the number of distinct symbol changes made to the transmission medium per second in a digitally modulated signal or a...

 rate-stability within one LIN frame, the SYNC field within the header is used.

LIN protocol

The LIN-Master uses one or more predefined scheduling
I/O scheduling
Input/output scheduling is a term used to describe the method computer operating systems decide the order that block I/O operations will be submitted to storage volumes...

 tables to start the sending and receiving to the LIN bus. These scheduling tables contain at least the relative timing, where the message sending is initiated.
One LIN Frame consists of the two parts header and response. The header is always sent by the LIN Master, while the response is sent by only one dedicated LIN-Slave.

Transmitted data within the LIN is transmitted serially as eight bit data bytes with one start & stop-bit and no parity. Bit rates vary within the range of 1 kbit/s to 20 kbit/s.
Data on the bus is divided into recessive (logical HIGH) and dominant (logical LOW).
The time normal is considered by the LIN Masters stable clock source, the smallest entity is one bit time
Bit time
Bit time is a concept in computer networking. It is defined as the time it takes for one bit to be ejected from a Network Interface Card operating at some predefined standard speed, such as 10 Mbit/s. The time is measured between the time the logical link control layer 2 sublayer receives the...

 (52 µs @ 19.2 kbit/s).

Two bus states — Sleep-mode and active — are used within the LIN protocol. While data is on the bus, all LIN-nodes are requested to be in active state. After a specified timeout, the nodes enter Sleep mode and will be released back to active state by a WAKEUP frame.
This frame may be sent by any node requesting activity on the bus, either the LIN Master following its internal schedule, or one of the attached LIN Slaves being activated by its internal software application.
After all nodes are awakened, the Master continues to schedule the next Identifier.

Header

The header consists of three parts:

BREAK:
The BREAK field is used to activate all attached LIN slaves to listen to the following parts of the header. It consists of one start bit and several dominant bits. The length is at least 11-bit times; standard use as of today are 13-bit times, and therefore differs from the basic data format.
This is used to ensure that listening LIN nodes with a main-clock differing from the set bus baud rate in specified ranges will detect the BREAK as the frame starting the communication and not as a standard data byte with all values zero (hexadecimal
Hexadecimal
In mathematics and computer science, hexadecimal is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen...

 0x00).

SYNC:
The SYNC is a standard data format byte with a value of hexadecimal 0x55.
LIN slaves running on RC oscillator will use the distance between a fixed amount of rising and falling edges to measure the current bit time on the bus (the master's time normal) and to recalculate the internal baud rate.

IDENTIFIER:
The IDENTIFIER defines one action to be fulfilled by one or several of the attached LIN slave nodes. The network designer has to ensure the fault-free functionality in the design phase (one slave is allowed to send data to the bus in one frame time).

If the identifier causes one physical LIN slave to send the response, the identifier may be called a Rx-identifier.
If the master's slave task sends data to the bus, it may be called Tx-identifier.

Response

The response is sent by one of the attached LIN slave tasks and is divided into data and checksum
Checksum
A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmission or storage. The integrity of the data can be checked at any later time by recomputing the checksum and...

.

DATA:
The responding slave may send zero to eight data bytes to the bus. The amount of data is fixed by the application designer and mirrors data relevant for the application which the LIN slave runs in.

CHECKSUM:
There are two checksum-models available within LIN - The first is the checksum including the data bytes only (specification up to Version 1.3), the second one includes the identifier in addition (Version 2.0+).
The used checksum model is pre-defined by the application designer.

Slave Node Position Detection (SNPD) ie autoaddressing

These methods allow the detection of the position of slave nodes on the LIN bus and allow the assignment of a unique node address.
  • Allows similar or the same devices to be connected on the bus without end of line programming or connector pin programming.


Restrictions:
  • All auto-addressing slaves must be in one line
    • Standard slaves can be connected in any way

SNPD Method SNPD Method ID Company
Extra Wire Daisy Chain 0x01 NXP formerly Phillips
Bus Shunt Method 0x02 Elmos
Reserved 0x03 TBD
Reserved ... TBD
Reserved 0xFF TBD

Extra Wire Daisy Chain (XWDC)

Each slave node has to provide two extra pins, one input D1 and one output D2.
  • The first SNPD node input D1 is either set to gnd or connected to the output of the master.
    • The output of the first node D2 is connected to the input D1 of the second node, and so on resulting in a daisy chain.


Each configuration pin Dx (x=1-2) has additional circuitry to aid in the position detection.
  1. Switchable resistive pull-up to vbat
  2. Pull-down to gnd
  3. Comparator referenced to vbat/2

XWDC Auto-addressing Procedure

At the start of the procedure no SNPD devices have a NAD assigned

1 First auto-addressing LIN mesasge
1.1 All outputs (D2) are set to a high level, all pull-downs are turned off
1.2 The first SNPD node is selected. It is identified by having the input D1 low (hardwired).
1.3 The selected node takes the address from the LIN configuration message
1.4 The detected node turns on the pull-down at the output D2

2 Subsequent auto-addressing LIN messages
2.1 The first non addressed SNPD node is selected. It is identified by having the input D1 low (D2 of previous node).
2.2 The selected node takes the address from the LIN configuration message
2.3 The detected node turns on the pull-down at the output D2
2.4 Steps 2.1-2.4 are repeated until all slave nodes are assigned an address

3 All pull-ups and pull-downs are turned off completing the addressing procedure

Bus Shunt Method (BSM)

Each slave node has two LIN pins
  1. bus_in
  2. bus_out


Each slave node needs some additional circuitry compared to the standard LIN circuitry to aid in the position detection.
  1. The standard pull-up must be switchable
  2. Switchable 2mA current source from VBAT
  3. Shunt resistor
  4. Differential amplifier
  5. Analog to digital converter

BSM Auto-addressing Procedure

At the start of the procedure no SNPD devices have a NAD assigned

The autoaddressing routine is performed during the sync field

The sync field is broken into three phases

1 Offset current measurement
1.1 All outputs pull-ups and current sources are switched off
1.2 The bus current is measured Ioffset

2 Pull-up Mode
2.1 Pull-ups are turned on and current sources remain off
2.2 The bus current is measured IPU
2.3 Nodes with ΔI = IPU-Ioffset < 1mA are "selected"

3 Current Source Mode
3.1 Selected nodes switch current source on and others switch pull-ups off
3.2 Bus current is measured ICS
3.3 Node with ΔI = ICS-Ioffset < 1mA is detected as the last node
3.4 Current sources are switched off and pull-ups are switched on
3.5 The last node will accept the address contained in the LIN configuration message


This technique is covered by the following patents:
EP 1490772 B1
US 7091876

LIN advantages

  • Easy to use
  • Components available
  • Cheaper than CAN and other communications buses
  • Harness reduction
  • More reliable vehicles
  • Extension easy to implement.
  • No protocol license fee required


LIN is not a full replacement of the CAN bus. But the LIN bus is a good alternative wherever costs are essential and speed/bandwidth is not essential.

Applications

Application Segments Specific LIN Application Examples
Roof Sensor, light sensor, light control, sun roof
Steering Wheel Cruise control, wiper, turning light, climate control, radio
Seat Seat position motors, occupant sensors, control panel
Engine Sensors, small motors
Climate Small motors, control panel
Door Mirror, central ECU, mirror switch, window lift, seat control switch, door lock

LIN API

The LIN application programming interface
Application programming interface
An application programming interface is a source code based specification intended to be used as an interface by software components to communicate with each other...

 (API) provides a given set of function calls (base is the programming language C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

) which have to be implemented within each LIN software driver.
Using this pre-defined set of driver routines, all LIN functions may be accessed.

The usage of API-compliant functions eases the implementation of standard software drivers. Also the testing is sped up.

Development tools

When developing and/or troubleshooting the LIN bus, examination of hardware signals can be very important. Logic analyzers and bus analyzers
Bus analyzer
A bus analyzer is a computer bus analysis tool, often a combination of hardware and software, used during development of hardware or device drivers for a specific bus, for diagnosing bus or device failures, or reverse engineering....

are tools which collect, analyze, decode, store signals so people can view the high-speed waveforms at their leisure.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK