LINKTYPE_LIN
This document is based on email conversation with Hannes Kaelber.
Hannes Kaelber translated the original documentation from German.
Frame Format
0 | 1 | 2 | 3 | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
Header | msg_format_rev | reserved | ||||||||||||||||||||||||||||||
payload_length | message type | checksum type | PID | checksum | errors | |||||||||||||||||||||||||||
Payload | payload1 | payload2 | payload3 | payload4 | ||||||||||||||||||||||||||||
payload5 | payload6 | payload7 | payload8 |
Fields
Field | Length in Bits | Meaning |
---|---|---|
msg_format_rev | 8 | LIN Message Format Revision, this field must always be set to 1, 0 is invalid value. |
payload_length | 4 | Number of LIN payload bytes. |
message_type | 2 | Message type (0=LIN-Frame, 3=LIN-Event, 1 and 2=undefined). |
checksum_type | 2 |
Checksum type (0=unknown/error, 1=classic, 2=enhanced, 3=undefined). Unknown/error means that either the checksum is incorrect (usually the case) or that a checksum algorithm we do not know has been used (should not happen). Since we detect which checksum variant has been used and we cannot say that for sure if the checksum is incorrect, we have introduced this value. |
PID | 8 | Protected Identifier, as described in section 5.2.2.5 "PID field" of ISO 17987-3:2016. |
checksum | 8 | Checksum, as described in section 5.2.2.7 "Checksum" of ISO 17987-3:2016. |
errors | 8 | Error Bits (see below). |
payload[n] | 8 | Payload Byte n. Payload 5-8 exists only if payload_length is larger than 4. |
Error Bits
The Error Bits are as follows:
Error Bit | Bits Bitmask | Meaning |
---|---|---|
reserved | 0x80 |
Reserved. |
reserved | 0x40 |
Reserved. |
e_overflow | 0x20 |
Overflow Error, we have lost at least one message during reception because there was no space in the receiving controller's buffer. |
e_invalidid | 0x10 |
Invalid ID, i.e. a frame ID of 0x3E or 0x3F has been received. |
e_cksum | 0x08 |
Checksum Error. |
e_parity | 0x04 |
Parity Error in the Protected Identifier field. |
e_framing | 0x02 |
Framing Error, low-level transmissions/reception error. |
e_noslaveresp | 0x01 |
No Slave Response Error; no slave wrote the Response part of the frame, as per section 4.2.2 "Frames" of ISO 17987-3:2016. |
LIN Frame
If a message is a LIN-Frame, the payload is a LIN N_PDU, as described in section 7.4 "Transport layer protocol data units" of ISO 17987-2.LIN Event
If a message is a LIN-Event, the following rules apply:- payload_length is always 4.
- The fields checksum_type, PID, checksum and errors are set to 0 and must be ignored.
- The payload bytes 1-4 contain the type of the LIN event (big endian).
Event Types
Payload | Event Type |
---|---|
0xB0B00001 |
Go-to-Sleep Event caused by a Go-to-Sleep Frame. |
0xB0B00002 |
Go-to-Sleep Event caused by bus inactivity for more than 4s. |
0xB0B00004 |
Wake-up Event caused by a Wake-up Signal. |