Today's automobiles are not simply a means of transportation; they possess a multitude of functions. To achieve this, automobiles require an internal communication standard. In this article, we'll explore LIN.
Characteristic
LIN (Local Interconnect Network) is a communications standard for simple automotive functions. Therefore, CAN can be considered high-performance communication, while LIN can be considered low-performance communication.
- Low-cost
- 1 Master – Multi-Slave (up to 15 slaves can be connected)
- Primarily supports low-performance systems such as lighting, window control, and seat adjustment (CAN supports major systems such as engine control and brake systems)
- Simple 1-wire communication (CAN supports 2-wire)
| Application | 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 |
| Grille | Grille shutter |
| Climate | Small motors, control panel |
| Door | Mirror, central ECU, mirror switch, window lift, seat control switch, door lock |
LIN Protocol
LIN communication largely consists of two types of frames. The Master initiates communication via a Frame Header, and the Slave responds via a Frame Response. The Frame Response can also originate from the Master.
Except for the break fieldin the Frame Header, all byte fields that make up a Frame are 10 bits, including the Start bit and Stop bit, and the LSB is first and the MSB is last.
Frame Header (Master)
The Frame Header is largely divided into three parts.
- Sync break: Communication has begun
The master initiates communication by sending a sync break on the LIN bus. Slaves must receive the sync break and prepare for communication, so they must hold the LOW state for a long time (13-bits or more).
- Sync field: Transmits sync information so that slaves can synchronize with the master.
Since it's a 1-wire communication, there's no separate clock. Therefore, for communication between Master and Slave, the communication speed must be synchronized. Slaves connected to the Master synchronize their communication speeds through the falling edge of the Sync field signal (fixed at 0x55).
- PID field: Transmits communication information
Rather than using signals like I2C's address phase or SPI's CS (chip select) signal to designate a specific slave, PIDs specify which slaves participate in communication. These settings are determined through a schedule table, a detailed explanation of which will be discussed later.
The PID field consists of a 6-bit ID and a 2-bit parity. That is, the available IDs are 0x0 to 0x3F. Of these, 0x0 to 0x3B are used for general communication, 0x3C is used for the Master Request Frame, and 0x3D is used for the Slave Response Frame.
Here's how to calculate parity:
Frame Response (Master or Slave)
Frame Response is broadly divided into two types.
- Data field: Data transmission. Up to 8 byte can be transmitted in a single frame. 1, 2, 4, or 8 bytes can be transmitted depending on the PID.
- Checksum: Error checking
The checksum error checking method is calculated by adding all received data and subtracting the carry.
There are two types of checksums: classic checksum and enhanced checksum. Classic checksum is calculated using only data, while enhanced checksum is calculated using data and PID.
It is up to the user to decide which checksum to use, but the classic checksum should always be used when the PID is 0x3C or 0x3D.
Sleep
When communication is inactive (typically, the bus remains inactive for more than 4 seconds), LIN enters a power-saving Sleep state to reduce power consumption. When communication resumes, a wake-up signal is used to wake the device from Sleep.
The Master can put the Slave to sleep using the go to sleep command (version 2.1 or later). When the PID is 0x3C, the Slave will go to sleep if the first data is 0 and the remaining data is 0xFF.
To summarize, if the master requests Sleep or the bus is idle for a certain period of time, it enters sleep mode.
Wake up
To initiate communication, a device in Sleep mode must be awakened by a wake-up. Wake-ups can be initiated by both the Master and the Slave. To initiate a wake-up, a signal must be sent to the LIN bus for at least 150 microseconds. All devices connected to the bus must be ready to communicate within 100 milliseconds.
When a slave requests a wake-up, the master must initiate communication within 100 to 150 milliseconds. This means that it must transmit a frame header. If the master does not send a frame header within 150 milliseconds of the slave's wake-up request, the slave will request a wake-up again.
If the Master does not continue to send Frame headers, the Slave will make an infinite number of wake-up requests. These requests should be made three at a time, with an interval of at least 1.5 seconds between each request.
The above situations are situations where the Slave sends a wakeup signal to the Master.
When the Master sends a wakeup signal to the Slave, it can wake up the Slaves connected to the bus through the break signal in the Frame header.
References: LIN specification