Professional Documents
Culture Documents
11 11302 9646322999 Ind F TS Implementation of The Network Layer For The Diagnostic CAN Et LIN Networks
11 11302 9646322999 Ind F TS Implementation of The Network Layer For The Diagnostic CAN Et LIN Networks
11 11302 9646322999 Ind F TS Implementation of The Network Layer For The Diagnostic CAN Et LIN Networks
Page 1 of 40
TS_Implementation_of_the_network_layer_for_the_diag
nostic_CAN_and_LIN_networks
PURPOSE: This document gives details on the implementation of the standard ISO 15765-2
(Diagnostic on Can) on the CAN networks, as well as the conversion for the LIN ECUs
diagnostic.
9B B October 5.3.1 “After-sales diagnostic session” renamed” Active diagnostic communication session”
2001
Removal of the “Programming session”.
6.3.1 Setting of the BS to 0 for the Active diagnostic session; removal of N-Wtmax (no
longer used).
7.3 Details concerning the long execution requests.
9.1 Addition of format example of the diagnostic service and of the segmenting timing with
the gateway.
9C C January Insertion of the requirement numbers in the document.
2002
6.3.3 Details on the timings values
99 OR February The requirement numbers have been updated by removing the “9C” index from the
2003 numbering. All requirements modified in the future will have an index number after their
number.
Example: 463.229-9C-0005-01A becomes 463.229-0005-01A
Example with future index: 463.229-0005-01A.2
§4: Removal of the paragraph. The following paragraphs are consequently renumbered
Modifying the requirement 463.229-0005-01A: No stuffing of the frames shorter than 8
bytes.
§4.3: Note on the different implementation of the diagnostic sessions on the ECU diagnostic
sessions on the Inter-Systems networks, of the ECU on the Comfort and Body networks
Addition of §4.4 and 4.5, depending on whether we address to the CAN Inter-Systems or to
the CAN Comfort and Body.
Requirements 463.229-0003-01C and 463.229-0011-01N removed.
Requirement 463.229-0011-01P added.
Removal of the note in §463.229-0012
Addition of paragraphs §§463.229-0020 to –0023 and of the associated requirements.
Addition of the requirement 463.229-0030-01D
Removal of the requirements 463.229-0110-01A, -01C.
Addition of the requirement 463.229-0110-01D.
Modification of the timing values on the requirements 463.229-0112-01A to –01F. Addition
of –01G and of –01H.
Adding the requirement 463.229-0205-01D.
§463.229-0110: Removal of the comment on the average value of the delays between 2
segments.
Removal of the operation mode 2 from §463.229-0205.
99 Ind. A September The diagnostic of ECUs on the LIN network is added.
2004
Modification of the document title to acknowledge the LIN acknowledgement.
Modification of the copywriter and verifier and addition of a verifier.
Contents
6.3.2 Influence of the vehicle life phases on the opening of the sessions and of the diagnostic communications 22
6.3.3 Timings..........................................................................................................................................................23
6.4 Values of the communication parameters........................................................................................24
7 ”Diagnostics On CAN” specifications..........................................................................................25
7.1 Composition of the CAN frames........................................................................................................25
7.1.1 SINGLE_FRAME.........................................................................................................................................25
7.1.2 FIRST FRAME.............................................................................................................................................25
7.1.3 CONSECUTIVE_FRAME...........................................................................................................................26
7.1.4 FLOW_CONTROL.......................................................................................................................................26
7.1.4.1 Overflow management for the body ECUs (CAN LS CAR, DIV & CONF, LIN)..................................27
7.1.4.2 Management of the overflow for the powertrain ECUs (CAN_IS)..........................................................28
7.2 Segmenting...........................................................................................................................................29
7.2.1 Sequence........................................................................................................................................................29
7.2.2 Identifiers......................................................................................................................................................29
7.2.2.1 Emission of a segmented request..............................................................................................................29
7.2.2.2 Emission of a segmented response............................................................................................................29
7.3 Parameters and timings......................................................................................................................30
7.3.1 Segmenting parameters for diagnostic..........................................................................................................30
7.3.2 Segmenting parameters for the programming...............................................................................................30
7.4 Timing..................................................................................................................................................31
8 Specificities of the CAN frames sent for a LIN network that implements the protocol described
in document [10]..................................................................................................................................33
8.1 Constitution of the frames..................................................................................................................33
8.1.1 SINGLE_FRAME.........................................................................................................................................33
8.1.2 FIRST FRAME.............................................................................................................................................34
8.1.3 CONSECUTIVE_FRAME...........................................................................................................................34
8.1.4 FLOW_CONTROL.......................................................................................................................................35
8.1.4.1 Management of the overflow for the ECUs (LIN master)........................................................................36
8.2 Segmenting...........................................................................................................................................37
8.3 Parameters and timings......................................................................................................................39
8.4 Timing..................................................................................................................................................39
9 Strategy of error recovery strategy...............................................................................................40
1 Purpose
This document describes our implementation of the network layer of the Diagnostics on Can standard (ISO 15765-2).
The purpose of this document is to specify the various exchange parameters and mechanisms which are implemented in
our ECUs. These mechanisms allow us to convey the information necessary to the download and diagnostic services.
These information transfers concern the diagnostic exchanges (between the tool and an ECU or between 2 ECU). These
exchanges can be made accross hardware or software gateways which allow a change of the network or of the network
type.
In addition to the ECUs on the CAN High Speed and CAN LOW Speed networks, this document takes into account the
diagnostic for the ECUs on the LIN network (not processed in the Diagnostics on Can standard ISO 15765-2).
This document does not cover the OBD communication protocol.
2 Scope
This document is applicable to all PSA vehicles whose architecture is based on the protocol “Diagnostics on Can” (ISO
15765-2).
Therefore all the following ECUs are targeted:
ECUs connected on the CAN network whose diagnostic, download, coding, calibration is executed via a CAN
Low Speed network (CAR, DIV, CONF & DIAG Body) or CAN High Speed network (IS)
ECU connected on a LIN network, managing diagnostic services.
After Sales, factory and engineering tools
The ECUs diagnosed only via a K line are therefore excluded from this specification.
3 Reference documents
NA
Titre Réf.
[1] Spécification des règles de communication CAN 96.431.967.99
[2] Spécification des phases de vie réseau CAN 96.431.966.99
[3] Spécification des règles de communication LIN 96.459.907.99
[4] Spécification des phases de vie réseau LIN STE 96.459.904.99
[5] Keyword Protocol 2000 – 3F Implémentation des services de diagnostic 96.253.521.99
[6] STD Passerelle Diagnostic CAN_LS - LIN 96.587.833.99
[7] STD BSI Passerelle CANDiag LIN 96.574.560.99
[8] TS CAN - LIN diagnostic gateway 96 649 678 9A
[9] TS Implementation of UDS 96.646.970.99
[10] ST Réseau LIN - Règles de communication LIN 2.1 96 648 782 9B
[11] ST Règles de communication CAN LS 96 649 897 9B
[12] ST Phases de vie CAN LS 96 649 896 9B
[13] ST Réseau LIN - Phases de vie réseau LIN 2.1 96.648.783.9B
[14] ST d’Interfaces Réseaux Pour le domaine « Règles de communication du 96.622.355.9A
réseau LIN (basée sur LIN 1.3)
4 Terminology
4.1 Glossary
4.2 Glossary
Gateway : Object that transfers the message from a network (or subnet) to another network (or subnet).
Inactive mode: Operating mode allowing, from the diagnostic tool, to request to the ECUs to stop their network
communication and the storage of their fault, but to carry on responding to the diagnostic requests.
5 Agreements
AAA.BBB-CCCC-NNN.Y
where:
AAA.BBB : Reference of the document
CCC-NNN : Number of the requirement
Y : Requirement evolution index
Important: As this requirement numbering corresponds to traceability needs, a requirement number that was created may
not be destroyed, because of the risk of reusing it for a future requirement unrelated to the previous one. For a
requirement that has become irrelevant, the number is kept, and the corresponding text is "Deleted":
Example:
6 Communication protocol
More accurately, we use a Half-Duplex protocol, namely the sender can only send a new request to the same recipient
when the response to its previous request has been received or when a fixed delay has expired (time out notion to avoid
locking if the receiver does not reply).
However, the protocol authorizes the simultaneous emission of several requests toward different ECUs without waiting
for the response from the first request (the ECU must be on the same LIN sub-network).
The diagnostic tool issues a request toward an ECU. The ECU sends back a response to the tool.
In the simplest case, the sender is the diagnostic tool, and the receiver is the diagnosed ECU:
In the more complicated case when the diagnosed ECU is not directly linked to the tool, and is located behind one or
several gateways, each gateway receives the request (from the tool or the previous gateway) and transmits it on the
network to the following recipient (the next gateway or the diagnosed ECU):
A gateway cannot initiate a diagnostic request without first receiving it from another gateway (gateways #1 to #N) or
directly from a tool (gateway #1).
Note:
Various designs of a CAN - LIN diagnostic gateway are possible (non exhaustive list):
diagnostic gateway via frame insertion (the LIN request frame is issued on each reception of a CAN request)
diagnostic gateway with reserved location (an “empty” LIN request frame is issued periodically; it is used or
non-empty with each reception of a CAN request frame)
The same operations by insertion or allocation are authorized for the response; in the “by allocation” case, a response
request is issued by the master, but no LIN slave replies.
The diagnostic tool is plugged on the single diagnostic socket available in the vehicle; this socket allows the simultaneous
communication on several CAN type communication channels.
Two CAN networks can be simultaneously accessible on the diagnostic socket (the CAN IS network (Inter-Systems
(Powertrain domain), the CAN DIAG network...). The BSI gateway does not operate in diffusion and is not symmetrical:
Downward gateway: a request received on the CAN DIAG of the BSI is transferred on one of its sub-networks
(LIN, CAR, DIV, CONF or IS).
Upward gateway: a response received on one of the sub-networks is transferred on the CAN DIAG toward the
tool.
In the case of the downward gateway, the recipient sub-network choice is made depending on the identifier of the frame
received.
For the upward gateway, all response frames received from one of the sub-networks is transferred on the CAN DIAG.
Each ECU has an identifier reserved for emission and at least one identifier reserved for reception.
6.1.2.1 ECU connected to the CAN Comfort, Body and Entertainment networks
6.1.2.2 ECU connected to the CAN Inter-Systems, CAN LAS and CAN Hybrid network
6.1.2.3 ECU connected to the LIN networks that implement the protocol described in the document [3] or [14]
In order to ensure the routing of the diagnostic requests to the LIN ECU, two CAN identifiers are assigned to each LIN
ECU.
Each master of the LIN sub-network has the responsibility to execute the gateway, from and to the CAN network, for the
requests and diagnostic replies of its LIN slaves.
On the LIN network, the diagnostic request frames are being broadcasted with the same identifier (0x3C); Each slave
must analyze the first data byte of this request frame to identify if the LIN slave targeted by the request is itself.
6.1.2.4 ECU connected to the LIN networks that implement the protocol described in the document [10]
For this LIN ECU type, the CAN identifiers used are associated to the network
Each master of the LIN sub-network has the responsibility to execute the gateway, from and to the CAN network, for the
diagnostic requests and replies of its LIN slaves.
On the LIN network, the diagnostic request frames are being broadcasted with the same identifier (0x3C); Each slave
must analyze the first data byte of this request frame to identify if the LIN slave targeted by the request is itself.
6.2.1.1 ECU not being a LIN ECU and that respects the communication rules of the document [3] or [14]
The Diagnostics on Can protocol allows the transmission on a CAN network of a message with the maximum size of
4095 bytes (informative data, excluding the bytes of the Diagnostics On Can protocol itself). The ECU connected on a
network that respects the communication rules of the document [10] also support this maximum size for a message.
When the diagnostic tools refers to a CAN or a LIN ECU, the requests and responses are segmented, if needed, in
maximum 8 byte frames according to the process described in chapter 7.2 .
6.2.1.2 ECU connected on the LIN sub-networks respecting the communication rules from document [3] or [14]
Segmenting is not managed for this type of LIN sub-networks.
A diagnostic frame will therefore have at most 8 bytes of data, including the protocol byte; There are at most 7
informative data bytes available to implement a KWP2000 request.
The protocol byte regroups the station number of the diagnosed LIN part, as well as the informative data number among
the 7 with data.
The KWP2000-3F services available are therefore limited, and an adapted use of the KWP2000-3F application diagnostic
services allows the execution of the diagnostic replies and requests. See document [5] Keyword Protocol 2000 – 3F
Implémentation des services de diagnostic.
We have decided to use the 0x3C identifiers for the diagnostic request frames and 0x3D for the diagnostic response
frames on the LIN networks. These identifiers correspond to 8 bytes long frames; This means all 8 bytes of the
informative data of the CAN frame must be filled, in order to fill in all bytes of the LIN frame with “useless” bytes, called
“stuffing” or “padding”.
The 1st data byte of the LIN frame includes the number of data bytes actually used (3 bits). This number corresponds to
the SF_DL (Data Length) field of the NPCI from the Diagnostics on CAN protocol.
Reciprocally, the master receives the number of informative data bytes in the LIN response frame (lower than or equal to
7), and creates a CAN response frame that includes this informative data and the NPCI byte of the SingleFrame.
6.2.1.3 ECU connected to the LIN sub-networks respecting the communication rules from document [10]
The requirement concerning the size of the frames and of the messages that travel on this LIN bus type is described in the
document [10].
The requirements specific to the diagnostic communications are described in chapter 6.2.2.3
The identifiers of the CAN frames chosen within the standard 11 bits addressing used by PSA integrate the notion of
destination, of source and functional or physical addressing mode.
6.2.2.2 ECU connected to LIN sub- networks that implement the protocol described in the document [3] or [14]
The diagnostic request frames are broadcasted on the LIN network by the master, with the identifier 0x3C.
A diagnostic request issued by tool is only sent once by the master to the slave targeted by the request; These frames are
not repeated by the master that executes the diagnostic gateway.
The master of the LIN network gets the response to the previous diagnostic request on a 0x3D identifier frame.
463.229- In order not to generate segmentation on the LIN, the diagnostic services in GEN-VHL-DC-DIAG.264 (1)
0006-01F.1 the KWP2000 format (request/response) intended for the LIN slaves are
“single frames” limited to 7 data bytes (byte 1 of the CAN is reserved to
the NPCI byte that manages the segmentation).
463.229- All LIN slaves receive diagnostic request frames and analyze the first byte GEN-VHL-DC-DIAG.261 (1)
0006-01G which contains the number of the LIN slave, recipient of the request frame;
only the ECU whose station number corresponds to the 4 low-order bits of
the first byte executes the request.
463.229- Only the LIN slave that is the recipient of the last 0x3C request is GEN-VHL-DC-DIAG.264 (1)
0006-01H authorized to response in the 0x3D response frame.
463.229- All the slave equipment on the LIN network whose response is not ready GEN-VHL-DC-DIAG.261 (1)
0006-01I after receiving a request must systematically respond by using the most
adequate response according to KWP2000 (to be defined in the STE
diagnostic messaging).
463.229- The high order bit of the first byte (bit 1.7) of the LIN diagnostic request GEN-VHL-DC-DIAG.264 (1)
0006-01J frames is always set to 1 (corresponds to the free of use frames in the LIN
standard).
463.229- The high order bit of the first byte (bit 1.7) of the diagnostic response GEN-VHL-DC-DIAG.439 (0)
0006-01K frames on the LIN is always set to 1 (corresponds to the free of use frames
in the LIN standard).
463.229- The encoding of the informative data size in the LIN diagnostic request GEN-VHL-DC-DIAG.439 (0)
0006-01L and response frames is set on the bits 1.6 to 1.4 of the first byte of these
frames.
The values that this field can take are 1 to 7.
Bit 1.4 contains the low-order of the size (20).
To summarize, here is the content of byte 1 of the diagnostic request and response frames on the LIN network:
Content of byte 1 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1.0
DIAG_REQUETE (0x3C) and Reserved Frame informative data N_ECU_LIN_diag
DIAG_REPONSE (0x3D) (=1)
Possible values: 1 to 7 Station number of the LIN slave
(4 bits)
Requirement Input
Description
no. requirement
If the master must send a LIN diagnostic request (0x3C) when there is no request issued GEN-VHL-DC-
by the tool, the request frame sent by the diagnostic tool contains 0 informative byte and DIAG.261 (1)
the 1st byte is the following:1
463.229- - byte 1: 0x8F
0006-01M.1 1.7 1.6 1.5 1.4 1.3 1.2 1.1 1.0
Reserved
0 0 0 1 1 1 1
(=1)
Size = 0 Diagnosed station number = 0xF
Requirement Input
Description
no. requirement
463.229- A LIN slave must ignore all diagnostic request frames received with an informative data GEN-VHL-DC-
0006-01N size equal to 0; the slave must not consider itself to be the recipient of this request. DIAG.261 (1)
6.2.2.3 ECU connected to LIN sub- networks that implement the protocol described in the document [10]
Requireme Input
Description
nt no. requirement
463.229- GEN-VHL-
The headers of the LIN request and response frames have a specific identifier, 0x3C for the DC-DIAG.264
0006-02A
request, and 0x3D for the response. (1)
Note: The first byte of the diagnostic request LIN frame contains the LIN station number of the ECU that receives this
request, the NAD.
Reciprocally, the first byte of the LIN response contains the number of the sender station.
The diagnostic request frames are broadcasted by the master on the LIN network, with the 0x3C identifier.
A diagnostic request issued by the tool is only sent once by the master to the slave targeted by the request; These frames
are not repeated by the master that executes the diagnostic gateway.
The master of the LIN network gets the response to the previous diagnostic request on a 0x3D identifier frame.
6.2.3 Mechanisms
The data bytes of the CAN frames respect the services defined by the documents [5] or Error: Reference source not
found.
A request is issued by the tool with the request identifier.
After processing, the response is sent by the ECU using its response identifier.
2
This operation is the opposite of the one expected for the slaves that comply with the protocol described in document [3]
or [14]
3
A message that does not contain enough data bytes to fill an 8 bytes frame is completed. These added bytes are called
padding bytes in contrast with the informative data bytes. These bytes are therefore not handled in the PCI
Date: 09/04/2008 Classification level 1- Internal 2 - Confidential 3–
PSA/DPTA/ use PSA/DPTA/ PSA/DPTA/restricted
confidential
This document is the property of PSA Peugeot Citroën; it may not be communicated to third parties and/or reproduced without the prior written consent of PSA Peugeot Citroën and
its content may not be disclosed.
Generic 96 463 229 99 Ind. F TS_Implementation_of_the_network_layer_for_the_diagno Page 22 of 40
stic_CAN_and_LIN_networks
6.2.3.3 Interlacing
The tool has the possibility to send a new request without waiting for the response to the previous request if these
requests have different ECU destinations (simultaneous requests on multiple sessions). On the contrary the interlacing of
the requests towards the same ECU is not authorized.
6.3.1 Generalities
For the KWP 2000 ECUs, the sessions mechanisms are described in document [5].
For the UDS ECUs, these mechanisms are described in document Error: Reference source not found.
The communication sessions for the diagnostic are implemented differently on the ECU connected to the CAN Inter-
Systems networks and on the ECU connected to the CAN Comfort, Body and Entertainment networks.
For each communication session, the diagnostic tool must comply with the requirements corresponding to the addressed
ECUs, whether they are on the Inter-Systems, Comfort, Body or Entertainment network or on the LIN sub-networks.
6.3.2 Influence of the vehicle life phases on the opening of the sessions and of the diagnostic
communications
According to the ECU life phase, it is possible or impossible to open a diagnostic session and to communicate.
The timings that are specific to network life phases are defined in the PSA document "Spécification des phases de vie
réseau ".
6.3.3 Timings
The synchronization of the exchanges is ensured by a certain number of maximum and minimum delays that must not be
exceeded, defined at the level of the application layer and at the level of the network layer.
At the level of the network layer (see document [N2] part 2):
Various delays are defined in the standard. They are resumed in this document with the authorized value ranges (see
chapter 7.4)
P2 = Tdiag for the ECU queried by the tool (via the gateway)
P2 = Tret for the tool
The T_Ret delay corresponds to a time-out on the tool side. Beyond this delay, the tool considers that it will not receive
the answer from the ECU. The tool is authorized to repeat its request.
The T_Diag delay corresponds to a time delay during which the ECU must send its response. Beyond this T_Diag delay,
the ECU must no longer response to avoid interlacing a request with a previous response.
The following values are valid for all ECUs and all Diagnostic tools, whether they are connected to the CAN HS (Inter-
Systems or Diagnostic), CAN LS (Body or Comfort) or LIN (LIN BSI 1 and 2, or any other LIN ECU) networks.
The application timings and their management are defined in the document [5] Keyword Protocol 2000 – 3F
Implémentation des services de diagnostic.
The Diagnostics On Can protocol allows the transmission of data blocks with a size that can be equal up to 4095 bytes.
These blocks are issued by using a segmenting mechanism whose sequencing and timings are defined.
7.1.1 SINGLE_FRAME
The SINGLE_FRAME message is used for issuing a block of maximum 7 bytes of informative data.
Description:
Description:
7.1.3 CONSECUTIVE_FRAME
The CONSECUTIVE_FRAME message is used during the sending of a block of more than 7 bytes of informative data.
This message contains a segment of the data block to issue.
Description:
7.1.4 FLOW_CONTROL
The FLOW_CONTROL message is used to manage the exchange flow during the sending of the segments. This message
is issued by the data receiver.
Description:
FS is the status (Flow_status); the status can take one of the following values:
OVERFLOW (FS = 2) to indicate that the message length (FF_DL) sent by the sender is over the size of the receiver
buffer. The sender must then stop the emission.The request is therefore not manageable by the receiver. This
“overflow” is therefore a request error or a design error because the receiver is not able to process the request.
WAIT (FS = 1) to temporarily stop the segments transmission: The sender must wait for a new
FLOW_CONTROL message. As long as the Flow_status of the FLOW_CONTROL message equals WAIT, the
sender continues to wait for a new FLOW_CONTROL message; The transmission resumes when the sender receives
a FLOW_CONTROL with Flow_status equal to CLEAR_TO_SEND, and the sender returns a
CONSECUTIVE_FRAME message block.
CLEAR_TO_SEND (FS = 0) to restart or confirm the transmission of the following segments.
The other values [0x3…0xF] are reserved (RESERVED) and must not be used (generate an error case).
Block Size (BS) indicates the number of CONSECUTIVE_FRAME after which the sender must wait for the
FLOW_CONTROL message from the receiver before continuing to send its CONSECUTIVE_FRAME; This
FLOW_CONTROL message indicates to the sender whether it can continue to send or if it must wait. This flow control
mechanism is repeated until all CONSECUTIVE_FRAME have been sent.
If BS equals 0, only the first FLOW_CONTROL message of the response to FIRST_FRAME is sent by the receiver; no
other FLOW_CONTROL message must be sent by the receiver as a response to CONSECUTIVE_FRAME; the sender
therefore sends all its CONSECUTIVE_FRAME in a single burst (complying with STmin); The receiver must therefore be
designed to accept the maximum number of bytes that must be sent to it (depending on the diagnostic, remote encoding
and download of each ECU).
STmin specifies the minimum delay that must separate the sending of two consecutive CONSECUTIVE_FRAME
messages.
7.1.4.1 Overflow management for the body ECUs (CAN LS CAR, DIV & CONF, LIN)
Management of the ECU resource overrun:
In case the ECU is not able to receive, in its receive buffer, the entire message sent by the tool (FF_DL size indicated by
the tool in the FIRST_FRAME frame); the ECU must then response with a FLOW_CONTROL frame containing a
Flow_status equal to OVERFLOW ; the tool must then stop sending its message.
Errors management:
7.2 Segmenting
7.2.1 Sequence
In the case when a request or a response is segmented, the sequencing is as follow:
7.2.2 Identifiers
The identifiers used for the segmented exchanges are the same as those used for the requests and replies.
Note: The possible routers are likely to modify the STmin value of the FLOW_CONTROL frames that pass through these
routers.
To receive the programmed data, the ECU connected to the CAN Inter-Systems network must comply with the
requirements expressed in the specification 96.435.787.99.
7.4 Timing
All the ECU and tools connected to the Inter-Systems, Diagnostic, Comfort and Body networks must comply with the
minimum and maximum timings for the parameters defined in the Diagnostics on Can standard, as well as with the
performance criteria specified.
463.229- N_Bs Delay until receiving Not 250 ms for GEN-VHL-DC-DIAG.430 (0)
0112-01C.1 the next applicable Body
Flow_Control networks
message (CAN LS
CAR, DIV
and CONF)
The programming tools attempts to use the entire network transmission capacities to obtain the fastest possible
programming while respecting all the ECU constraints
Note: For ECUs connected to the Comfort and Body networks, PSA recommends the following implementation:
N_Cs = STmin + 5 ms.
8 Specificities of the CAN frames sent for a LIN network that implements the protocol described in
document [10]
Each request or response therefore includes encoded information that allows the transmission of 1 to 4095 informative
data bytes.
This encoded information is called PCI + LEN in the LIN specification, equivalent to NPCI CAN. The first frame byte is
NAD. The data called “informative data” are other than the bytes contained in the (SID + N_DATA) frame.
Format of the CAN and LIN frames sent to or received from a LIN.
N_PDU type Identifier Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
LIN format on
SingleFrame (SF) N_AI/E – N_AI/R NAD PCI SID N_Data N_Data N_Data N_Data N_Data
the CAN
network
FirstFrame( FF) N_AI/E – N_AI/R NAD PCI LEN SID N_Data N_Data N_Data N_Data
ConsecutiveFrame
(CF) N_AI/E – N_AI/R NAD PCI N_Data N_Data N_Data N_Data N_Data N_Data
FlowControl (FC) N_AI/E – N_AI/R NAD PCI PCI PCI N/A N/A N/A N/A
N_PDU type Identifier Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
LIN format
SingleFrame (SF) 0x3C - 0x3D NAD PCI SID N_Data N_Data N_Data N_Data N_Data
FirstFrame( FF) 0x3C - 0x3D NAD PCI LEN SID N_Data N_Data N_Data N_Data
ConsecutiveFrame
(CF) 0x3C - 0x3D NAD PCI N_Data N_Data N_Data N_Data N_Data N_Data
FlowControl (FC) N/A N/A N/A N/A N/A N/A N/A N/A N/A
8.1.1 SINGLE_FRAME
The SINGLE_FRAME message is used for issuing a block of maximum 6 bytes of informative data.
LIN format N_PDU type Identifier Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
on the CAN
network SingleFrame (SF) N_AI/E – N_AI/R NAD PCI SID N_Data N_Data N_Data N_Data N_Data
N_PDU type Identifier Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
LIN format
SingleFrame (SF) 0x3C - 0x3D NAD PCI SID N_Data N_Data N_Data N_Data N_Data
463.229- The frames going through the CAN network and sent to a LIN slave, in the case of a SF GEN-VHL-DC-
0006-02F type frame, must respect the following: DIAG.264 (1)
The encoding of the number of informative data (PCI) in the diagnostic
requests and responses frames on the LIN network is done on the 4 low order
bits of the second byte.
The second byte high order nibble is set to 0.
Byte 3 contains the SID
The following bytes contain data.
LIN format N_PDU type Identifier Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
on the CAN
network FirstFrame( FF) N_AI/E – N_AI/R NAD PCI LEN SID N_Data N_Data N_Data N_Data
N_PDU type Identifier Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
LIN format
FirstFrame( FF) 0x3C - 0x3D NAD PCI LEN SID N_Data N_Data N_Data N_Data
463.229- For the frames on the CAN network and sent to a LIN slave, in the case of a FF type GEN-VHL-DC-
0006-02G.1 frame: DIAG.264 (1)
The encoding of the number of informative data in the diagnostic requests and
responses frames on the LIN network is done on the 4 low order bits of the
second byte (PCI) associated with the third byte (LEN) for a total length of 12
bits.
The second byte high order nibble is set to 1
Byte 4 contains the SID.
The following bytes contain data.
8.1.3 CONSECUTIVE_FRAME
The CONSECUTIVE_FRAME message is used during the sending of a block of more than 6 bytes of informative data
(SID + N_DATA). This message contains a segment of the data block to issue.
LIN format N_PDU type Identifier Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
on the CAN ConsecutiveFrame (CF) N_AI/E – N_AI/R NAD PCI N_Data N_Data N_Data N_Data N_Data N_Data
N_PDU type Identifier Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
LIN format
ConsecutiveFrame (CF) 0x3C - 0x3D NAD PCI N_Data N_Data N_Data N_Data N_Data N_Data
463.229- For the frames on the CAN network and sent to a LIN slave, in the case of a CF type frame: GEN-VHL-DC-
0006-02H The second byte low order nibble (PCI) represents the frame counter. When DIAG.264 (1)
sending a segmented frame, this counter is set to 1 for the first CF. It is then
incremented with each new CF. In case of an overflow; this counter takes the value
0 and is incremented for the following frames.
The second byte high order nibble is set to 2
The following bytes contain data.
8.1.4 FLOW_CONTROL
The FLOW_CONTROL message is used to manage the exchange flow during the sending of the segments. This message
is issued by the data receiver. (LIN master or tool, the slave does not manage this frame)
LIN format N_PDU type Identifier Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
on the CAN FlowControl (FC) N_AI/E – N_AI/R NAD PCI PCI PCI N/A N/A N/A N/A
N_PDU type Identifier Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7 Byte 8
LIN format
FlowControl (FC) N/A N/A N/A N/A N/A N/A N/A N/A N/A
463.229- For the frames on the CAN network and sent to a LIN slave, in the case of a FC type frame GEN-VHL-
0006-02J (sent by the tool or the LIN master): DC-
The second byte high order nibble is set to 3 DIAG.264
(1)
The second byte low order nibble (PCI) FS represents the Flow_Status:
- OVERFLOW (FS = 2) to indicate that the message length (FF_DL) sent by the
sender is higher than the size of the receive buffer. The sender must then stop the
emission; the request is therefore not manageable by the receiver. This “overflow”
is therefore a request error or a design error because the receiver is not able to
process the request.
- WAIT (FS = 1) to temporarily stop the sending of the segments: The sender must
wait for a new FLOW_CONTROL message. As long as the Flow_status of the
FLOW_CONTROL message equals WAIT, the sender keeps on waiting for a new
FLOW_CONTROL message; When the sender receives a Flow_status equal to
CLEAR_TO_SEND, the sender resumes the transmission and sends a
CONSECUTIVE_FRAME message block.
- CLEAR_TO_SEND (FS = 0) to restart or confirm the transmission of the
following segments.
- The other values [3..0xF] are reserved (RESERVED) and must not be used
(generate an error case).
The third byte (PCI) BS represents the Block Size (BS), BS indicates the number of
CONSECUTIVE_FRAME after which the sender must wait for the
FLOW_CONTROL message from the receiver before continuing to send its
CONSECUTIVE_FRAME; This FLOW_CONTROL message indicates to the sender
whether it can continue to send or if it must wait. This flow control mechanism is
repeated until all CONSECUTIVE_FRAME have been sent. If BS equals 0, only the
first FLOW_CONTROL message of the response to FIRST_FRAME is sent by the
receiver; no other FLOW_CONTROL message must be sent by the receiver as a
response to CONSECUTIVE_FRAME; the sender therefore sends all its
CONSECUTIVE_FRAME in a single burst (complying with STmin); The receiver
must therefore be designed to accept the maximum number of bytes that must be sent
to it (depending on the diagnostic, coding and programming of each ECU).
The fourth byte (PCI) STmin specifies the minimum delay that must separate two
CONSECUTIVE_FRAME messages.
Errors management:
8.2 Segmenting
The segmentation of the messages coming from a LIN to a CAN network and vice versa is organized as follows:
8.4 Timing
The timing parameter to comply with on the CAN network for the exchanges between a CAN ECU and a LIN slave are
the same as for the exchanges between 2 CAN ECUs, with the exception of the following parameters:
Requirement Description Minimum Maximum Input
Timing Performance
no. period period requirement
463.229-0113- Bus transfert delay of a LIN GEN-VHL-
01C.1 frame sent by the sender DC-DIAG.264
N_As_LI (1)
See document [1]
N
FOR PROGRAMMING
9 Strategy of error recovery strategy
For ECUs able to communicate with a diagnostic tool, if the appropriate error handling strategy is not defined in this
document, the default choice is to abandon the transmission.