XCP - Part 3 - Transport Layer Specification XCP On FlexRay-1.0
XCP - Part 3 - Transport Layer Specification XCP On FlexRay-1.0
Version 1.0
Part 3
XCP on FlexRay - Transport Layer Specification
Date: 2005-12-21
Authors: Roel Schuermans, Vector Informatik GmbH
Oliver Kalweit, BMW AG
Rainer Zaiser, Vector Informatik GmbH
Oliver Kitt, Vector Informatik GmbH
Andreas Herkommer, Vector Informatik GmbH
Andreas Aberfeld, Robert Bosch GmbH
Reiner Motz, Robert Bosch GmbH
Karsten Wehefritz, Robert Bosch GmbH
Hans-Georg Kunz, Siemens VDO Automotive AG
Hendirk Amsbeck, dSPACE GmbH
Bastian Kellers, dSPACE GmbH
Thomas Kirschbaum, ETAS GmbH
Martin Laichinger, ETAS GmbH
Version: 1.0
Doc-ID: XCP - Part 3- Transport Layer Specification
XCP on FlexRay -1.0
Status: Released
Type Final
Disclaimer of Warranty
Although this document was created with the utmost care it cannot be guaranteed
that it is completely free of errors or inconsistencies.
ASAM e.V. makes no representations or warranties with respect to the contents or
use of this documentation, and specifically disclaims any expressed or implied
warranties of merchantability or fitness for any particular purpose. Neither ASAM
nor the author(s) therefore accept any liability for damages or other consequences
that arise from the use of this document.
ASAM e.V. reserves the right to revise this publication and to make changes to its
content, at any time, without obligation to notify any person or entity of such
revisions or changes.
This revision history shows only major modifications between release versions.
0 Introduction ........................................................................................................6
0.1 The XCP Protocol Family .......................................................................................... 6
0.2 Documentation Overview .......................................................................................... 7
0.3 Definitions and Abbreviations ................................................................................... 8
0.4 Normative Reference.................................................................................................. 9
This document is based on experiences with the CAN Calibration Protocol (CCP) version 2.1 as
described in feedback from the companies Accurate Technologies Inc., Compact Dynamics GmbH,
DaimlerChrysler AG, dSPACE GmbH, ETAS GmbH, Kleinknecht Automotive GmbH, Robert Bosch
GmbH, Siemens VDO Automotive AG and Vector Informatik GmbH.
The XCP Specification documents describe an improved and generalized version of CCP.
The generalized protocol definition serves as standard for a protocol family and is called “XCP”
(Universal Measurement and Calibration Protocol).
The “X” generalizes the “various” transportation layers that are used by the members of the protocol
family e.g “XCP on CAN”, “XCP on TCP/IP”, “XCP on UDP/IP”, “XCP on USB” , “XCP on FlexRay” and
so on.
XCP
CAN TCP/IP UDP/IP USB FlexRay
Part 1 “Overview” gives an overview over the XCP protocol family, the XCP features and the
fundamental protocol definitions.
Part 2 “Protocol Layer Specification” defines the generic protocol, which is independent from the
transportation layer used.
Part 3 “Transport Layer Specification” defines the way how the XCP protocol is transported by a
particular transportation layer like CAN, TCP/IP, UDP/IP and FlexRay.
This document describes the way how the XCP protocol is transported on FlexRay.
Part 4 “Interface Specification” defines the interfaces from an XCP master to an ASAM MCD 2MC
description file and for calculating Seed & Key algorithms and checksums.
Part 5 “Example Communication Sequences” gives example sequences for typical actions
performed with XCP.
Everything not explicitly mentioned in this document, should be considered as implementation specific.
The following table gives an overview about the most commonly used definitions and
abbreviations throughout this document.
Abbreviation Description
A2L File Extension for an ASAM 2MC Language File
AML ASAM 2 Meta Language
ASAM Association for Standardization of Automation and Measuring Systems
BYP BYPassing
CAL CALibration
CAN Controller Area Network
CCP Can Calibration Protocol
CHI Controller Host Interface
CMD CoMmanD
CS CheckSum
CTO Command Transfer Object
CTR CounTeR
DAQ Data AcQuisition, Data AcQuisition Packet
DTO Data Transfer Object
ECU Electronic Control Unit
ERR ERRor Packet
EV EVent Packet
FIBEX FIeld Bus EXchange Format
FLX FLeXRay
LEN LENgth
LPDU_ID Data Link Layer Protocol Data Unit IDentifier
MCD Measurement Calibration and Diagnostics
MTA Memory Transfer Address
NAX Node Address for XCP
ODT Object Descriptor Table
PAG PAGing
PGM ProGraMming
PID Packet IDentifier
RES command RESponse packet
SERV SERVice request packet
STD STanDard
STIM Data STIMulation packet
TCP/IP Transfer Control Protocol / Internet Protocol
TS Time Stamp
UDP/IP Unified Data Protocol / Internet Protocol
USB Universal Serial Bus
XCP Universal Calibration Protocol
1.1.1 LPDU_ID
LPDU_ID
Channel A
...
... ... Channel B
Cycle ID
...
...
...
...
...
...
...
...
...
...
...
... ...
... ...
... ...
... ...
... ...
...
...
...
...
...
...
...
...
...
...
...
...
...
... ...
... ...
...
Slot ID
Diagram 1 : Data Link Layer Protocol Data Unit Identifier
Additionally, up to two FlexRay nodes can share a slot that is not used redundantly, by using
the channel as a demultiplexer.
A FlexRay Data Link Layer Protocol Data Unit Identifier (FLX_LPDU_ID) generalizes the notion
of a slot-ID by taking into account these multiplexing possibilities. The following 4 parameters
describe a FlexRay LPDU-Identifier :
• FlexRay slot identifier (FLX_SLOT_ID)
• cycle counter offset (OFFSET)
• cycle counter repetition (CYCLE_REPETITION)
• FlexRay channel (FLX_CHANNEL).
MAX_FLX_LEN_ABS (=254)
The maximum theoretical data length of a FlexRay frame and therefore the maximum length of
an XCP on FlexRay message is MAX_FLX_LEN_ABS = 254 (bytes).
In actual practice the maximum data length of a FlexRay frame can be considerably shorter due
to FlexRay controller limitations. The actual maximum data length of a FlexRay frame, which a
specific slave is able to receive or transmit in a specific XCP-dedicated buffer, is called
MAX_FLX_LEN_BUF_x.
The initial maximum data length of a FlexRay frame, which a specific slave is able to receive or
transmit in a specific XCP-dedicated buffer, is called MAX_FLX_LEN_BUF_x_init.
The actual length of the FlexRay payload segment of a specific FlexRay frame, expressed in
bytes, is called FLX_LEN_BUF_x.
The payload length field in the FlexRay frame header always is set to the number of payload
data bytes divided by two. Therefore the following relation always applies:
XCP-dedicated LPDU_IDs
Channel A
...
... ... Channel B
Cycle ID
...
...
...
...
...
...
...
...
...
...
... ...
... ...
... ...
... ...
... ...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
... ...
... ...
...
Slot ID
Diagram 3 : XCP dedicated LPDU_IDs on the network
The FlexRay system designer for a specific network specifies where the LPDU_IDs that can be
used for XCP communication are located within the schedule.
These XCP-dedicated LPDU_IDs define the maximum bandwidth available for XCP from the
point of view of the network.
FLX_LPDU_ID
Buffer CYCLE MAX_FLX_LEN
FLX_SLOT_ID OFFSET _REPETITION CHANNEL _BUF_x
Buffer_1 123 0 1 A 32
Buffer_2 124 1 2 A 32
Buffer_3 (125) 0 2 A 32
Buffer_4 126 (*) (*) A (64)
Buffer_5 (*) (*) (*) (*) (64)
In the example Buffer_1 and Buffer_2 have completely unconfigurable LPDU_ID parameters.
For Buffer_3 the Slot-ID is initialised but it could be changed by the XCP on FlexRay master.
For Buffer_4 the parameters for the set of cycle counters are uninitialised and have to be
configured by the XCP on FlexRay master.
Buffer_5 is completely uninitialised and has to be completely configured by the XCP on FlexRay
master.
Master and Slave for every buffer have to know what type of XCP packet is transported in the
corresponding LPDU_ID.
A buffer can have a fixed assignment to always transport a specific type of XCP packet. The
XCP on FlexRay master cannot change this assignment.
A buffer also can have an initial assignment to transport a specific type of XCP packet. The XCP
on FlexRay master then with FLX_ASSIGN can change this assignment.
A buffer for a specific XCP packet type initially can be unassigned. The XCP on FlexRay master
however with FLX_ASSIGN could request this buffer to transport this specific XCP packet type.
Finally a buffer can not allow to have an assignment for transporting a specific XCP packet type.
In the example Buffer_1 has a fixed assignment to transport CMD and STIM packets. Buffer_1
can neither transport RES, ERR, EV, SERV nor DAQ. Buffer_1 for the slave looks like a
“receive only buffer”.
Buffer_2 has a fixed assignment to transport RES, ER, EV, SERV and DAQ. Buffer_2 can
neither transport CMD nor STIM. Buffer_2 for the slave looks like a “transmit only buffer”.
Buffer_3 has an initial assignment to transport DAQ. However, the XCP on FlexRay master
could request this buffer to transport RES, ERR, EV or SERV. The XCP on FlexRay master
cannot request this buffer to transport CMD neither STIM.
All other buffers are completely freely configurable. The XCP on FlexRay master can request
these buffers to transport any type of XCP packet.
CMD RES
... ...CMD
...
...
...
...
...
...
...
...
... ...
... ...
... ...
... ...
... ...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
CMD RES RES
CMD RES ... ...CMD
CMD RES ... ...
...
Slot ID
If an XCP master sets up a connection to an XCP on FlexRay slave, it gets the information
about the XCP-dedicated LPDU_IDs of the network from the FIBEX description file. The XCP
master gets the information about the slave’s XCP-dedicated buffers from the ASAM MCD 2MC
description file for this specific slave.
If the XCP master sets up a connection to a single slave, it has to check whether the values of
non-configurable LPDU_ID parameters of the slave result in an LPDU_ID that is in the valid set
of XCP-dedicated LPDU_IDs of the network.
When assigning the configurable parameters, the XCP master itself has to make sure that these
assignments result in an LPDU_ID that is in the valid set of XCP-dedicated LPDU_IDs of the
network.
If the connected slaves all use their own exclusive LPDU_IDs that are not shared with the other
slaves, the XCP master has not to do any further management of the configuration.
Multiple XCP slaves get in competition for XCP-dedicated LPDU_IDs of the network if their fixed
assigned buffers want to use the same LPDU_ID. Another reason for slaves getting in
competition is the limited bandwidth provided by the XCP-dedicated LPDU_IDs of the network.
Finally the slaves themselves have a limited number of XCP-dedicated buffers to be shared by
all XCP packet types.
Multiple XCP slaves sharing XCP-dedicated LPDU_IDs, is only allowed if those LPDU_IDs are
located in the dynamic part of the FlexRay cycle.
With FLX_ACTIVATE / FLX_DEACTIVATE the XCP on FlexRay master can mutually activate
the use of an LPDU_ID that is shared among multiple slaves.
The XCP master is responsible to activate the communication on LPDU_IDs in such a way that
communication conflicts are avoided in every case.
The bandwidth provided by the XCP-dedicated LPDU_IDs of the network on FlexRay in typical
automotive systems in practice will be limited. The “normal” functional frame transmission
already claims most of the busses’ bandwidth.
On the other hand XCP needs a high bandwidth to perform sufficiently. A solution can be to
have the XCP on FlexRay master perform a bandwidth distribution. Bandwidth distribution
means sharing the limited resources of a FlexRay Bus by assigning the LPDU_IDs dynamically
to dedicated communication channels between master and slave.
With FLX_ASSIGN the XCP on FlexRay master can re-assign the configurable buffers of the
slaves to the XCP-dedicated LPDU_IDs provided by the network.
The XCP master is responsible to re-assign the communication on LPDU_IDs in such a way
that communication conflicts are avoided in every case.
The same re-assigning also can be used if the different XCP packet types of a slave internally
are competing for the limited number of XCP-dedicated buffers.
Not all XCP-dedicated buffers that are available also must be used. Buffers may be left
unassigned.
A slave can only use an XCP-dedicated buffer if it has all LPDU_ID parameters configured.
Furthermore the assignment of XCP packet type(s) has to be configured.
For the master being able to contact the slave, a slave always has to have an initial assignment
for CMD. A slave processes a CMD on the specific LPDU_ID if the message contains its NAX.
For the master being able to contact the slave , a slave always has to have an initial assignment
for RES, ERR. A slave transmits RES, ERR on the specific LPDU_ID if the previous CMD
message contains its NAX.
A slave transmits DAQ and receives STIM on the specific LPDU_ID if the XCP on FlexRay
master previously started the DAQ-lists.
For EV, SERV a slave only transmits on the specific LPDU_ID if the XCP on FlexRay master
previously with FLX_ACTIVATE explicitly has activated the LPDU_ID.
For CMD, RES, ERR, DAQ and STIM no explicit activation by the XCP on FlexRay master is
necessary.
NAX CTR FILL LEN PID FILL DAQ TIMESTAMP DATA FILL
1.4.1 Header
The XCP on FlexRay header consists of a control field containing a Node Address for XCP
(NAX), an optional CounTeR (CTR), optional FILL bytes and an optional LENgth (LEN).
Depending upon the requirements on sequencing correctness, alignment and net data
throughput, different header types are possible. A slave for transmitting and receiving always
uses one and the same header type.
8 bit
NAX
alignment
16 bit 8 / 16 bit
NAX FILL NAX CTR
alignment alignment
32 bit
32 bit NAX CTR FILL_2
NAX FILL_3 alignment
alignment
concatenation allowed
8 / 16 bit 8 bit
NAX LEN NAX CTR LEN
alignment alignment
32 bit 16 / 32 bit
NAX FILL_2 LEN NAX CTR FILL LEN
alignment alignment
LEN
1.4.1.3 Fill
The performance for accessing the contents of the XCP messages can be increased when an
XCP packet starts on an aligned address.
PACKET_ALIGNMENT_x (x = 8, 16, 32) indicates the alignment a slave uses for its XCP
packets. The aligning is performed by optional FILL bytes within the header. The contents of the
FILL bytes is “don’t care”.
If the slave uses a header type without LEN and without CTR, with HEADER_NAX the
requirement for 8-bit alignment can be fulfilled. With HEADER_NAX_FILL the requirement for
16-bit alignment can be fulfilled. With HEADER_NAX_FILL_3 the requirement for 32-bit
alignment can be fulfilled.
If the slave uses a header type without LEN and with CTR, with HEADER_NAX_CTR the
requirement for 8-bit and 16-bit alignment can be fulfilled. With HEADER_NAX_CTR_FILL_2
the requirement for 32-bit alignment can be fulfilled.
If the slave uses a header type with LEN and without CTR, with HEADER_NAX_LEN the
requirement for 8-bit and 16-bit alignment can be fulfilled. With HEADER_NAX_FILL_2_LEN the
requirement for 32-bit alignment can be fulfilled.
If the slave uses a header type with LEN and with CTR, with HEADER_NAX_CTR_LEN the
requirement for 8-bit alignment can be fulfilled. With HEADER_NAX_CTR_FILL_LEN the
requirement for 16-bit and 32-bit alignment can be fulfilled.
If there’s a concatenation of multiple XCP messages in one FlexRay frame, then only the
header of the first XCP message contains the FILL field. The headers of the subsequent XCP
messages do not contain the FILL field.
FLX_LEN_BUF_x
for rounding up
Diagram 8 : Tail for rounding up to even FlexRay length
For avoiding the recalculation of HEADER_CRC, the slave can transmit its FlexRay frames with
MAX_FLX_LEN_BUF_x. The tail serves for filling up the FlexRay payload segment to
MAX_FLX_LEN_BUF_x.
FLX_LEN_BUF_x
= MAX_FLX_LEN_BUF_x
for filling up
Header Packet Tail Header Packet Tail ... Header Packet Tail
FLX_LEN_BUF_x
for aligning for rounding up
payload length field
= FLX_LEN_BUF_x / 2
XCP on FLX Msg #1 XCP on FLX Msg #2 XCP on FLX Msg #n unused
Header Packet Tail Header Packet Tail ... Header Packet Tail LEN = 0
FLX_LEN_BUF_x = MAX_FLX_LEN_BUF_x
Diagram 11 : LEN = 0 for detecting the end of the used payload segment
MAX_FLX_LEN_BUF_x
Diagram 12 : Relation between MAX_CTO. MAX_DTO and MAX_FLX_LEN_BUF_x
Since an XCP on FlexRay message always at least contains a NAX, the practical maximum
length of a CTO or a DTO packet of a specific slave is MAX_FLX_LEN_BUF_x-1.
Bit
7 6 5 4 3 2 1 0
RES_ERR
EV_SERV
STIM
CMD
DAQ
x
x
x
An XCP-dedicated buffer can either be a receive buffer or a transmit buffer. Depending on the
type of buffer, only certain values of XCP_PACKET_TYPE are allowed.
Using this command with XCP_PACKET_TYPE = 0x00 for a specific buffer FLX_BUF resets its
assignment for both LPDU_ID used and type of XCP packet(s) transported. By resetting, the
state of the configurable parameters becomes “uninitialised” or “unassigned” as shown in the
slave assignment tables with “(*)”.
Using this command with XCP_PACKET_TYPE = 0x00 and FLX_BUF = 0xFF resets the
assignment of all XCP-dedicated buffers of a slave to their initial assignments.
Any other values of XCP_PACKET_TYPE as explicitly mentioned here, are not allowed.
For easy configuration of the slave, the master with FLX_ASSIGN transfers the FlexRay
HEADER_CRC which results from using FLX_SLOT_ID and MAX_FLX_LEN_BUF_x.
If the slave uses frame lengths FLX_LEN_BUF_x <= MAX_FLX_LEN_BUF_x, it has to calculate
HEADER_CRC by itself.
By configuring MAX_FLX_LEN_BUF_x the XCP on FlexRay master can organize the XCP-
dedicated buffers of the slave in such a way that the master’s communication requirements are
optimally fulfilled.
For EV and SERV this command activates the communication of a specific FLX_BUF in a
specific slave.
Before using this command, the XCP master shall have successfully assigned the FLX_BUF to
a FLX_LPDU_ID by the command FLX_ASSIGN.
The XCP master is responsible to avoid multiple activated communication of different slaves
using the same FlexRay cells.
For EV and SERV this command deactivates the communication of a specific FLX_BUF in a
specific slave.
Before using this command, the XCP master shall have properly assigned the FLX_BUF to a
FLX_LPDU_ID by the command FLX_ASSIGN.
Positive Response:
With GET_DAQ_FLX_BUF, the master can detect whether a DAQ list uses one or more
individual FlexRay buffer(s) and whether this FlexRay buffer(s) is (are) fixed or configurable.
If the FlexRay buffer is configurable, the master can configure the individual FlexRay buffer for
this DAQ list with SET_DAQ_FLX_BUF.
The master can assign one or more individual FlexRay buffers to a DAQ list.
If the given FlexRay buffer(s) is not (are not) successfully assigned, the slave returns an
ERR_OUT_OF_RANGE.
/************************************************************************************/
/* */
/* ASAP2 meta language for XCP on FlexRay V1.0 */
/* */
/* 2005-10-13 */
/* */
/* Datatypes: */
/* */
/* A2ML ASAP2 Windows description */
/* --------------------------------------------------------------------------------------------*/
/* uchar UBYTE BYTE unsigned 8 Bit */
/* char SBYTE char signed 8 Bit */
/* uint UWORD WORD unsigned integer 16 Bit */
/* int SWORD int signed integer 16 Bit */
/* ulong ULONG DWORD unsigned integer 32 Bit */
/* long SLONG LONG signed integer 32 Bit */
/* float FLOAT32_IEEE float 32 Bit */
/* */
/**************************************************************************************/
/************************ start of FLX **************************************/
enum packet_assignment_type {
"NOT_ALLOWED",
"FIXED",
"VARIABLE_INITIALISED",
"VARIABLE"
}; /* end of packet_assignment_type */
struct buffer {
uchar; /* FLX_BUF */
taggedstruct {
"MAX_FLX_LEN_BUF" taggedunion {
"FIXED" uchar; /* constant value */
"VARIABLE" uchar; /* initial value */
}; /* end of MAX_FLX_LEN_BUF */
"FLX_SLOT_ID" taggedunion {
"FIXED" uint;
"VARIABLE" taggedstruct{
"INITIAL_VALUE" uint;
};
}; /* end of FLX_SLOT_ID */
"OFFSET" taggedunion {
"FIXED" uchar;
"VARIABLE" taggedstruct{
"INITIAL_VALUE" uchar;
};
}; /* end of OFFSET */
"CHANNEL" taggedunion {
"FIXED" enum {
"A" = 0,
"B" = 1
};
"VARIABLE" taggedstruct{
"INITIAL_VALUE" enum {
"A" = 0,
"B" = 1
};
};
}; /* end of CHANNEL */
}; /* end of LPDU_ID */
}; /* end of XCP_PACKET */
};
}; /* end of buffer */
struct FLX_Parameters {
char[256]; /* Cluster-ID */
uchar; /* NAX */
enum {
"HEADER_NAX" = 0,
"HEADER_NAX_FILL" = 1,
"HEADER_NAX_CTR" = 2,
"HEADER_NAX_FILL3" = 3,
"HEADER_NAX_CTR_FILL2" = 4,
"HEADER_NAX_LEN" = 5,
"HEADER_NAX_CTR_LEN" = 6,
"HEADER_NAX_FILL2_LEN" = 7,
"HEADER_NAX_CTR_FILL_LEN" =8
};
taggedunion {
block "INITIAL_CMD_BUFFER" struct buffer;
};
taggedunion {
block "INITIAL_RES_ERR_BUFFER" struct buffer;
};
taggedstruct {
};
/begin INITIAL_CMD_BUFFER
0x01 /* FLX_BUF */
MAX_FLX_LEN_BUF FIXED 32
/begin LPDU_ID
/end LPDU_ID
/begin XCP_PACKET
CMD FIXED
RES_ERR NOT_ALLOWED
EV_SERV NOT_ALLOWED
DAQ NOT_ALLOWED
STIM FIXED
/end XCP_PACKET
/end INITIAL_CMD_BUFFER
/begin INITIAL_RES_ERR_BUFFER
0x02 /* FLX_BUF */
MAX_FLX_LEN_BUF FIXED 32
/begin LPDU_ID
/end LPDU_ID
/begin XCP_PACKET
CMD NOT_ALLOWED
RES_ERR FIXED
EV_SERV FIXED
DAQ FIXED
STIM NOT_ALLOWED
/end XCP_PACKET
/end INITIAL_RES_ERR_BUFFER
0x03 /* FLX_BUF */
MAX_FLX_LEN_BUF FIXED 32
/begin LPDU_ID
/end LPDU_ID
/begin XCP_PACKET
CMD NOT_ALLOWED
RES_ERR VARIABLE
EV_SERV VARIABLE
DAQ VARIABLE_INITIALISED
STIM NOT_ALLOWED
/end XCP_PACKET
/end POOL_BUFFER
/begin POOL_BUFFER
0x04 /* FLX_BUF */
MAX_FLX_LEN_BUF VARIABLE 64
/begin LPDU_ID
/end LPDU_ID
/begin XCP_PACKET
CMD VARIABLE
RES_ERR VARIABLE
EV_SERV VARIABLE
DAQ VARIABLE
STIM VARIABLE
/end XCP_PACKET
/end POOL_BUFFER
/begin POOL_BUFFER
0x05 /* FLX_BUF */
MAX_FLX_LEN_BUF VARIABLE 64
/begin LPDU_ID
FLX_SLOT_ID VARIABLE
OFFSET VARIABLE
CYCLE_REPETITION VARIABLE
CHANNEL VARIABLE
/end LPDU_ID
CMD VARIABLE
RES_ERR VARIABLE
EV_SERV VARIABLE
DAQ VARIABLE
STIM VARIABLE
/end XCP_PACKET
/end POOL_BUFFER
/end XCP_ON_FLX
The XCP master builds the set of valid XCP-dedicated LPDU_IDs of the network by checking
the frames for having a FRAME-TYPE “OTHER” and having a MANUFACTURER-EXTENSION
called “FRAME-TYPE-EXTENSION” with the value “XCP”.
As soon as the FIBEX description file format inherently supports the definition of XCP-
dedicated LPDU_IDs of the network, that definition will become recommended practice.
However, the alternative with FRAMETYPE “OTHER” and MANUFACTURER-EXTENSION
“FRAME-TYPE-EXTENSION” = “XCP” stays valid.