You are on page 1of 16

Embedded Systems

Serial IO LIN Bus


ENEL4ES - Embedded Systems 2023
Lecture 8
R Khuboni
University of KwaZulu-Natal
Electrical, Electronic, and Computer Engineering (EECE) Discipline
LIN Protocol – Advancement of CAN Bus
This is a nice local mini network protocol . Called Local Interconnected Network.
With the host of protocols available in electronics interfaces, choosing a protocol is a
hard job.
Some protocols are designed for long distance and reliable communication
applications such as RS-485 serial comm.
Others are used for low cost and short range communication such as I2C and so on.
LIN bus is a multipoint, low-cost, easily-implemented communication bus working as
a sub-bus for the CAN bus.
It has a six bit identifier so it is able to address 64 devices or nodes in one cluster (i.e.
2^6 = 64).
Circuit Configuration with a micro-controller
Designed for There are 3 components to the
automotives LIN bus configuration –
so VBAT is the (1) Microcontroller
car battery (2) LIN Bus IC (MLX 8003151)
voltage (i.e., (3) LIN Bus line.
12volts)
These are the pin
The IC is configuration to
compable of the microcontroller
handling high (VCC at 5volts).
currents and
voltage spikes Microcontroller
connects to LIN
12v & 5v MLX 8003151 IC to
interface – a communicate to
level shifter This is our LIN Bus line another
used within (Full Duplex / Bidirectional Comms) microcontroller
the IC
LIN Bus Protocol – Cont.. On CAN Bus
The backbone car’s network is the Controller Area Network (CAN). CAN bus is reliable
and adopted widely in automotive industry but it’s expensive to embed CAN interface
in all aspects of the car’s sub-system. As a cheap alternative, LIN bus protocol is
designed for low cost and multi-nodes automotive networks.
LIN can be used to communicate with non-critical sub-systems such as door-lock
driver and window motors. Moreover, LIN is implemented to be a one-wire interface.
LIN stands for local Interconnect Network according to the official LIN manual,
http://forums.ni.com/attachments/ni/30/3619/1/LIN.pdf
LIN Bus Protocol – Properties
The main properties of the LIN bus are:
Single master with multiple slaves concept
Low cost silicon implementation based on common UART/SCI interface hardware, an
equivalent in software, or as pure state machine.
Self-synchronization without a quartz or ceramics resonator in the slave nodes.
Deterministic signal transmission with signal propagation time computable in advance
low cost single-wire implementation.
Speed up to 20Kbits/s
Signal based application interaction.
LIN Bus Protocol – Concept of operation
• LIN cluster consists of one master task and several slave tasks. A master
node contains the master task as well as a slave task. All other node contain
a slave task only.
• The master task decides when and which frame shall be transferred on the
bus. The slave tasks provide the data transported by each frame.
• E.g., a LIN cluster with one master and two slave nodes is depicted below.
Centrally controlled message distribution system
LIN devices or nodes do not have equal access to the bus due to the Master-Slave
architecture
LIN Master delegates communication to rest of the slave nodes (similar to delegated token
principle)
Message distribution based on message addressing
64 addressable identifiers
LIN Bus Protocol – Frames
A frame consists of a header (i.e., provided by the master task) and a response (i.e.,
provided by a slave task).
The header consists of a break and sync pattern followed by an identifier. The
identifier uniquely defines the purpose of the frame. The slave task appointed for
providing the response associated with the identifier transmits it.
The response consists of a data field and a checksum field.
The slave tasks interested in the data associated with the identifier receives the
response, verifies the checksum and uses the data transported.
Message Header and Response
The Token is referred to as the Message The Message Response is sent by a Slave Task
Header
The Message Response is comprised of the
The Message Header is sent by the Master data and checksum
Task Standard Checksum over data field (LIN v1.x)
The Message Header is used for Enhanced checksum over data field with ID field (LIN
v2.0)
synchronization
The Message Header includes the identifier
LIN Bus Protocol – Frames
This results in the following desired features:
System flexibility: Nodes can be added to the LIN cluster without requiring hardware
or software changes in other slave nodes.
Message routing: The content of a message is defined by the identifier. This is similar
to CAN identifier.
Multicast: Any number of nodes can simultaneously receive and act upon a single
frame.
LIN Bus Protocol – Data transport
There are two types of data may be transported in a frame (i.e., signal or diagnostic
message).
Signals
Signals are scalar values or byte arrays that are packed into the data field of a frame.
A signal is always present at the same position of the data field for all frames with the same
identifier.
Diagnostic messages
Diagnostic messages are transported in frames with two reserved identifiers
The interpretation of the data field depends on the data field itself as well as the state of the
communicating nodes.
LIN Bus Protocol – Schedule table
The master task (in the master node) transmits the frame headers based on a
schedule table.
The schedule table specifies the identifiers for each header and the interval between
the start of a frame and the start of the following frame.
The master application may use different schedule tables and select amongst them.
LIN bus frame types
Unconditional – master requests data from a specific slave. Using IDs 0 – 59.
Event triggered – master polls the multiple slaves for updated data. If there is a
collision, the master defaults back to unconditional frame.
Sporadic – only initiated by the master if it knows a specific slave has updated data
and act as a slave to response back with its own header.
Diagnostic – frames with IDs 60-61 may be used for diagnostic reading. ID 60 is used
for the master request, 61 for the slave response.
User defined – frames with an ID 62 may contain any type of information
Reserved – frames with an ID 63 to be used with LIN v2.0
LIN Description File (LDF) vs DBC file
The process of decoding for a LIN
bus is similar to CAN bus decoding
•ID: Which LIN frame ID contains
the LIN bus signal
•Name: The LIN signal name should
be known
•Start bit: Start position of the LIN
signal in the payload
•Length: Length of the LIN bus
signal
•Endianness: LIN signals are little
endian (Intel byte order)
•Scale: How to multiply the decimal
value of the LIN signal bits
•Offset: By what constant should
the LIN signal value be offset
•Unit/Min/Max: Additional
supporting information (optional)
Comparison between LIN and CAN
LIN BUS CAN BUS

Low-cost and low performance High cost and high performance


Uses a single 12v wire Uses twisted shielded dual wires at
5v
1 master cluster
Can have multiple clusters
Uses 6 bit identifiers
Identifies with 11 to 29 bits
Only operates at 20kbits/s
Operates at 1Mbits/s
Some applications of the LIN Bus
Steering wheel – Comfort – sensors Air condition –
Powertrain – Engine – small Door – side mirrors,
cruise control, for temperature, motors, control
sensors for position, motors, cooling fan windows, seat
wiper, climate sunroof, light, panel (AC is often
speed, pressure motors control, locks
control, radio humidity complex)

Automation –
Seats – position Home appliances – Other – window
manufacturing
motors, pressure washing machines, wipers, rain sensors,
equipment, metal
sensors refrigerators, stoves headlights, airflow
working

You might also like