LIN Frame & Protected ID Calculator
Calculate or decode LIN protected identifiers, verify P0 and P1 parity bits, inspect six-bit frame IDs and calculate classic or enhanced LIN checksums for data fields of up to eight bytes.
P0 = ID0 ⊕ ID1 ⊕ ID2 ⊕ ID4 and
P1 = ¬(ID1 ⊕ ID3 ⊕ ID4 ⊕ ID5).
The transmitted Protected Identifier is
ID | (P0<<6) | (P1<<7).
—
What Is a LIN Protected Identifier?
LIN uses a six-bit frame identifier rather than transmitting the identifier directly as an unprotected byte. Two parity bits are calculated from the six identifier bits and inserted into bits 6 and 7.
The resulting eight-bit value is called the Protected Identifier, commonly abbreviated PID.
LIN Protected ID Bit Layout
Protected Identifier:
Bit 7 Bit 6 Bit 5 ... Bit 0
P1 P0 ID5 ... ID0
Frame ID:
6 bits
Protected ID:
8 bitsLIN Parity Calculation
LIN defines two parity equations using selected bits from the six-bit identifier.
P0 = ID0 XOR ID1 XOR ID2 XOR ID4
P1 = NOT(
ID1 XOR ID3 XOR ID4 XOR ID5
)
Protected ID =
ID
| (P0 << 6)
| (P1 << 7)LIN Frame ID Range
The identifier contains six bits, so its numeric range is 0 through 63,
or hexadecimal 0x00 through 0x3F.
Minimum ID:
0
Maximum ID:
63
Hex range:
0x00 – 0x3FExample LIN Protected ID
For frame ID 0x12, the six identifier bits are evaluated by the
two parity equations and combined into the transmitted PID.
Frame ID:
0x12
Binary:
010010
ID0 = 0
ID1 = 1
ID2 = 0
ID3 = 0
ID4 = 1
ID5 = 0
P0 =
ID0 XOR ID1 XOR ID2 XOR ID4
= 0 XOR 1 XOR 0 XOR 1
= 0
P1 =
NOT(ID1 XOR ID3 XOR ID4 XOR ID5)
= NOT(1 XOR 0 XOR 1 XOR 0)
= 1
Protected ID:
0x92LIN Classic Checksum
The classic LIN checksum is calculated using the data bytes only. Byte values are summed using end-around carry and then one’s complemented.
Classic Checksum Input:
Data0
Data1
...
DataN
PID is NOT included.
Classic checksum is required for LIN diagnostic frame identifiers
0x3C and 0x3D.
LIN Enhanced Checksum
The enhanced checksum uses the same checksum arithmetic but includes the Protected Identifier before the data bytes.
Enhanced Checksum Input:
PID
Data0
Data1
...
DataNEnhanced checksum is normally used for applicable LIN 2.x unconditional frames, while the diagnostic identifiers remain an important exception.
LIN Checksum End-Around Carry
LIN checksum addition is not simply a normal eight-bit modulo sum. When the
sum exceeds 0xFF, the carry is added back into the low byte.
Example:
0xF0 + 0x30
= 0x120
Low byte:
0x20
Carry:
1
End-around sum:
0x21After all bytes are accumulated, the final eight-bit sum is inverted to produce the checksum.
LIN Diagnostic Identifiers 0x3C and 0x3D
| Frame ID | Typical Role | Checksum Rule |
|---|---|---|
| 0x3C | Master Request Frame | Classic |
| 0x3D | Slave Response Frame | Classic |
These identifiers are reserved for diagnostic communication. The calculator’s
Automatic checksum option therefore selects classic checksum for IDs
0x3C and 0x3D.
LIN Frame Structure
Header:
Break
Sync = 0x55
Protected Identifier
Response:
Data Byte 0
...
Data Byte N
ChecksumThe LIN master generates the header. Depending on the schedule and frame definition, either the master or a slave may publish the response bytes.
Decode a LIN Protected ID
When decoding a PID, the calculator extracts bits 0 through 5 as the frame ID, reads transmitted P0 and P1 from bits 6 and 7, recalculates both parity bits and compares them.
PID:
0x92
Frame ID:
0x12
Received P0:
0
Received P1:
1
Calculated P0:
0
Calculated P1:
1
Parity:
VALIDLIN Frame & Protected ID Calculator FAQs
What is a LIN protected ID?
What is the LIN frame ID range?
How is LIN P0 calculated?
How is LIN P1 calculated?
What is the protected ID for LIN ID 0x12?
What is a classic LIN checksum?
What is an enhanced LIN checksum?
Do diagnostic LIN frames use enhanced checksum?
How many data bytes can a LIN frame contain?
Can this tool validate a received PID?
Calculate LIN Frame IDs, PIDs and Checksums
Generate or decode LIN protected identifiers, verify parity bits and calculate classic or enhanced checksums for LIN bus response data.