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. Others are used for low cost and short range communication such as I2C, and so on.
The backbone car’s network is the Controller Area Network (CAN). CAN 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, today’s protocol LIN, 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, 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 20 kbit/s.
- signal based application interaction.
The LIN topology consists of one master and several slaves. The master provides the header which consists of a break and sync pattern (0x55) followed by an identifier.
The 0x55 Synch byte helps the slaves to be synchronized with the master clock. All messages are initiated by the master with unique ID; A slave will reply according to a given message identifier.
The identifier specifies the frame type which can be one of the following:
- Unconditional frame
- Event triggered frame
- Sporadic frame
- Diagnostic frames
- User-defined frames
The nodes are typically microcontrollers, but as LIN is designed for automotive applications in the first place, some specialized transceivers can be added to the nodes such as Melexis MLX80030 which is basically a level shifter with some add-ons like low drop voltage regulator with some protection features since the available supply voltage in cars are mostly a spiky 12v.
Note: From the schematic above you may see that the MLX80031 has split the one wire (LIN BUS) to RX and TX for the microcontroller.
When it comes to software development, there is a standard API for LIN bus (slave and master) implemented in C language.
To know more about LIN protocol please refer to Hackaday article and to the official LIN manual.
Source: LIN Protocol — One Wire Protocol for Automotive Applications