Bus Communication

Transactions on the LIN bus are broken into master and slave processes. The master process is the first part of the message. It is always initiated by the master node on the LIN bus, and is comprised of the header followed by a response period where it waits for the slave period. The header contains the following sections:

The Break is compromised of a level transition on the line from recessive to dominant, and persists for a total of 13 bit times. Immediately following the Break is a delimiter bit, which is at least one bit time of the recessive level. Following the delimiter is a Sync byte, in which the master sends 0x55 on the LIN line, allowing for bit rate synchronization between the master and the slave devices on the bus. Finally, the master process finishes with an identifier byte for the message. Identifiers are determined by the design of each specific LIN bus and outlined in the LDF.

Figure 1. LIN Header

After the master process completes, it allows the slave process to take over the LIN bus. The slave process consists of two portions: data and checksum. The data can be sent by any of the nodes (including the master). The ID field of the header determines which specific node is transmitting, how much is being transmitted, and what data is sent. After the data has finished transmitting, the final piece of the slave process is the checksum. There are two methods of calculating checksums in the LIN protocol. LIN 1.3 and older devices calculated the checksum only on the data bytes of the message, while newer LIN standards also include the PID byte in the checksum calculation. In both, the checksum is calculated by adding together the bytes and subtracting 255 every time the sum is greater than 256. An example calculation is shown below.

Example Data Frame:

PID: 0x15

Data bytes: 0x34, 0x55, 0x67, 0x97

Checksum type: Includes PID

0x34+0x55=0x89

0x89+0x67=0xF0

0xF0+0x97=0x187

this is greater than 256(0x100), so 255 (0xFF) is subtracted.

0x187-0xFF=0x88

0x88+0x15=0x9D

Final Checksum value is 0x9D.