XCP - Part 4 - Interface Specification - 1.0
XCP - Part 4 - Interface Specification - 1.0
Version 1.0
Part 4
Interface Specification
Date: 2003-04-08
Authors: Roel Schuermans, Vector Informatik GmbH
Rainer Zaiser, Vector Informatik GmbH
Frank Hepperle, DaimlerChrysler AG
Hans Schröter, DaimlerChrysler AG
Reiner Motz, Robert Bosch GmbH
Andreas Aberfeld, Robert Bosch GmbH
Hans-Georg Kunz, Siemens VDO Automotive AG
Thomas Tyl, Siemens VDO Automotive AG
Robert Leinfellner, dSPACE GmbH
Hendirk Amsbeck, dSPACE GmbH
Harald Styrsky, Compact Dynamics GmbH
Boris Ruoff, ETAS GmbH
Lars Wahlmann, Accurate Technologies Inc.
Version: 1.0
Doc-ID: XCP-Part 4- Interface Specification -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
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” and so on.
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 and UDP/IP.
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 (this document).
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
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
LEN LENgth
MCD Measurement Calibration and Diagnostics
MTA Memory Transfer Address
ODT Object Descriptor Table
PAG PAGing
PGM ProGraMming
PID Packet IDentifier
RES command RESponse packet
SERV SERVice request packet
SPI Serial Peripheral Interface
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
The main.a2l that describes a slave that supports XCP on different Transport Layers, includes
an XCP_definitions.aml that contains a reference to the Common_Parameters and a reference
to the parameters that are specific for the different Transport Layers the slave supports.
The main.a2l that describes a slave that supports XCP on different Transport Layers, also
includes an XCP_vX_Y.aml that describes the structure of an “IF_DATA XCP ..”. An “IF_DATA
XCP ..” has the possibility to describe default Transport Layer independent parameters,
Transport Layer specific parameters and the overruling of the default parameters depending on
the Transport Layer used.
XCP_on_CAN_vI_J.AML
XCP_common_vX_Y.AML XCP_on_UDP_IP_vK_L.AML
XCP_on_##_vU_V.AML
XCP_definitions.AML
XCP_vX_Y.AML
XCP_vX_Y_IF_DATA.A2L
XCP_vX_Y_main.A2L
The main.a2l that describes a slave that supports XCP on different Transport Layers, includes
an XCP_definitions.aml that contains a reference to the Common_Parameters and a reference
to the parameters that are specific for the different Transport Layers the slave supports.
Part 2 of the XCP specification “Protocol Layer Specification”, defines the generic protocol,
which is independent from the Transport Layer used.
Part 3 of the XCP specification “Transport Layer Specification” defines the way how the XCP
protocol is transported by a particular Transport Layer like CAN, TCP/IP and UDP/IP.
XCP_on_##_vU_V.aml in the respective Part 3 specifies the AML description of the specific
parameters for each Transport Layer.
The Compatibility Matrix gives an overview of the allowed combinations of Protocol Layer and
Transport Layer parts.
/************************************************************************************/
/* XCP_definitions.aml has to include */
/* a reference to a Protocol Layer part */
/* and */
/* (a) reference(s) to that(those) Transport Layer(s) your slave supports */
/* */
/* the Compatibility Matrix gives an overview of the allowed */
/* combinations of Protocol Layer and Transport Layer parts */
/* */
/*************************************************************************************/
/************************ start of XCP definitions *********************************/
Example :
This slave supports XCP protocol version 1.0, when transported on UDP/IP in version 1.0 and
when transported on CAN in version 1.1
The main.a2l that describes a slave that supports XCP on different Transport Layers, includes
an XCP_vX_Y.aml that describes the structure of an “IF_DATA XCP ..”.
An “IF_DATA XCP ..” basically contains the Common_Parameters that are used as default
values for communicating through XCP.
Inside a “/begin XCP_on_## ..” there’re the parameters that are specific for this particular
Transport Layer. Also there exists the possibility to define Transport Layer specific values for
the Common_Parameters that overrule the default Common_Parameters.
If looking for Common_Parameters for XCP on a specific Transport Layer, the master first has
to check the availability of a Common_Parameters part inside the “/begin XCP_on_##” and use
them if available. If this part is not available, the master has to use the default values for the
Common_Parameters as defined in the “IF_DATA XCP ..”.
/***************************************************************************************************/
/* XCP_vX_Y.aml always has to have the same structure */
/* first there’s a reference to the default parameters */
/* then there’s (a) reference(s) to that(those) Transport Layer(s) your slave supports */
/* */
/***************************************************************************************************/
/*************************** start of XCP on different Transport Layers ***********************/
"XCP" struct {
taggedstruct Common_Parameters ; /* default parameters */
taggedstruct { /* transport layer specific parameters */
/* overruling of the default parameters */
block "XCP_ON_##" struct {
struct ##_Parameters ; /* specific for ## */
taggedstruct Common_Parameters; /* overruling of default */
};
};
};/**************************** end of XCP on different Transport Layers **********************/
Example :
/*************************** start of XCP on different Transport Layers ***********************/
"XCP" struct {
taggedstruct Common_Parameters ; /* default parameters */
taggedstruct { /* transport layer specific parameters */
/* overruling of the default parameters */
block "XCP_ON_UDP_IP" struct {
struct UDP_IP_Parameters ; /* specific for UDP_IP */
taggedstruct Common_Parameters; /* overruling of default */
};
block "XCP_ON_CAN" struct {
struct CAN_Parameters ; /* specific for CAN */
taggedstruct Common_Parameters; /* overruling of default */
};
};
};/**************************** end of XCP on different Transport Layers **********************/
This chapter gives an example of an IF_DATA XCP at MODULE for a slave that supports XCP
on UDP/IP and XCP on CAN.
For XCP on UDP/IP the default values for the Common_Parameters are used.
For XCP on CAN the DAQ part of the Common_Parameters is overruled.
Example:
/begin PROTOCOL_LAYER
0x0019 /* T1 [ms] */
0x0019 /* T2 [ms] */
0x0019 /* T3 [ms] */
0x0019 /* T4 [ms] */
0x0019 /* T5 [ms] */
0x0005 /* T6 [ms] */
0x00C8 /* T7 [ms] */
0x20 /* MAX_CTO */
0x00FF /* MAX_DTO */
BYTE_ORDER_MSB_FIRST
ADDRESS_GRANULARITY_WORD
SEED_AND_KEY_EXTERNAL_FUNCTION "MyS&K.DLL"
OPTIONAL_CMD GET_ID
OPTIONAL_CMD SET_REQUEST
OPTIONAL_CMD GET_SEED
OPTIONAL_CMD UNLOCK
OPTIONAL_CMD SET_MTA
OPTIONAL_CMD UPLOAD
OPTIONAL_CMD BUILD_CHECKSUM
OPTIONAL_CMD DOWNLOAD
OPTIONAL_CMD SET_CAL_PAGE
OPTIONAL_CMD GET_CAL_PAGE
OPTIONAL_CMD COPY_CAL_PAGE
OPTIONAL_CMD CLEAR_DAQ_LIST
OPTIONAL_CMD SET_DAQ_PTR
OPTIONAL_CMD WRITE_DAQ
OPTIONAL_CMD SET_DAQ_LIST_MODE
OPTIONAL_CMD START_STOP_DAQ_LIST
OPTIONAL_CMD START_STOP_SYNCH
OPTIONAL_CMD GET_DAQ_CLOCK
/end PROTOCOL_LAYER
DYNAMIC /* DAQ_CONFIG_TYPE */
0x0100 /* MAX_DAQ */
0x0100 /* MAX_EVENT_CHANNEL */
0x05 /* MIN_DAQ */
OPTIMISATION_TYPE_ODT_TYPE_32
ADDRESS_EXTENSION_FREE
IDENTIFICATION_FIELD_TYPE_RELATIVE_WORD_ALIGNED
GRANULARITY_ODT_ENTRY_SIZE_DAQ_WORD
0x04 /* MAX_ODT_ENTRY_SIZE_DAQ */
NO_OVERLOAD_INDICATION
PRESCALER_SUPPORTED
RESUME_SUPPORTED
/begin STIM
GRANULARITY_ODT_ENTRY_SIZE_STIM_WORD
0x04 /* MAX_ODT_ENTRY_SIZE_STIM */
BIT_STIM_SUPPORTED
/end STIM
/begin TIMESTAMP_SUPPORTED
0x0100 /* TIMESTAMP_TICKS */
SIZE_WORD
UNIT_1MS
TIMESTAMP_FIXED
/end TIMESTAMP_SUPPORTED
/begin EVENT
"10_ms_task" /* name */
"10 ms" /* short name */
0x0000 /* EVENT_CHANNEL_NUMBER */
DAQ_STIM
0x02 /* MAX_DAQ_LIST */
0x0A /* TIME_CYCLE */
0x00 /* TIME_UNIT */
0x00 /* PRIORITY */
/end EVENT
"100_ms_task" /* name */
"100 ms" /* short name */
0x0001 /* EVENT_CHANNEL_NUMBER */
DAQ_STIM
0x02 /* MAX_DAQ_LIST */
0x64 /* TIME_CYCLE */
0x00 /* TIME_UNIT */
0x10 /* PRIORITY */
/end EVENT
/end DAQ
/begin PAG
0x01 /* MAX_SEGMENTS */
FREEZE_SUPPORTED
/end PAG
/begin PGM
PGM_MODE_ABSOLUTE_AND_FUNCTIONAL
0x02 /* MAX_SECTORS */
0x08 /* MAX_CTO_PGM */
/begin SECTOR
0x000000 /* address */
0x20000 /* length */
/end SECTOR
0x020000 /* address */
0x20000 /* length */
/end SECTOR
/end PGM
/begin XCP_ON_UDP_IP
0x5555 /* PORT */
/begin PROTOCOL_LAYER
0x0019 /* T1 [ms] */
0x0019 /* T2 [ms] */
0x0019 /* T3 [ms] */
0x0019 /* T4 [ms] */
0x0019 /* T5 [ms] */
0x0005 /* T6 [ms] */
0x00C8 /* T7 [ms] */
0x20 /* MAX_CTO */
0x00FF /* MAX_DTO */
BYTE_ORDER_MSB_FIRST
ADDRESS_GRANULARITY_WORD
OPTIONAL_CMD FREE_DAQ
OPTIONAL_CMD ALLOC_DAQ
OPTIONAL_CMD ALLOC_ODT
OPTIONAL_CMD ALLOC_ODT_ENTRY
/end PROTOCOL_LAYER
/end XCP_ON_UDP_IP
/begin DAQ_LIST_CAN_ID
/end DAQ_LIST_CAN_ID
/begin DAQ_LIST_CAN_ID
/end DAQ_LIST_CAN_ID
/begin DAQ_LIST_CAN_ID
/end DAQ_LIST_CAN_ID
/begin PROTOCOL_LAYER
0x000A /* T1 [ms] */
0x000A /* T2 [ms] */
0x000A /* T3 [ms] */
0x000A /* T4 [ms] */
0x000A /* T5 [ms] */
0x0000 /* T6 [ms] */
0x0020 /* T7 [ms] */
0x08 /* MAX_CTO */
0x0008 /* MAX_DTO */
BYTE_ORDER_MSB_FIRST
ADDRESS_GRANULARITY_BYTE
OPTIONAL_CMD SHORT_UPLOAD
OPTIONAL_CMD SHORT_DOWNLOAD
OPTIONAL_CMD DOWNLOAD_NEXT
/end PROTOCOL_LAYER
STATIC /* DAQ_CONFIG_TYPE */
0x0003 /* MAX_DAQ */
0x0002 /* MAX_EVENT_CHANNEL */
0x01 /* MIN_DAQ */
OPTIMISATION_TYPE_DEFAULT
ADDRESS_EXTENSION_DAQ
IDENTIFICATION_FIELD_TYPE_ABSOLUTE
GRANULARITY_ODT_ENTRY_SIZE_DAQ_BYTE
0x02 /* MAX_ODT_ENTRY_SIZE_DAQ */
OVERLOAD_INDICATION_EVENT
PRESCALER_SUPPORTED
RESUME_SUPPORTED
/begin DAQ_LIST
0x0000 /* DAQ_LIST_NUMBER */
DAQ_LIST_TYPE DAQ
MAX_ODT 0x01
MAX_ODT_ENTRIES 0x02
/begin PREDEFINED
/begin ODT 0
/end ODT
/end PREDEFINED
/end DAQ_LIST
/begin DAQ_LIST
0x0001 /* DAQ_LIST_NUMBER */
DAQ_LIST_TYPE DAQ_STIM
MAX_ODT 0x03
MAX_ODT_ENTRIES 0x10
/end DAQ_LIST
0x0002 /* DAQ_LIST_NUMBER */
DAQ_LIST_TYPE DAQ_STIM
MAX_ODT 0x10
MAX_ODT_ENTRIES 0x20
/end DAQ_LIST
/begin EVENT
"10_ms_task" /* name */
"10 ms" /* short name */
0x0000 /* EVENT_CHANNEL_NUMBER */
DAQ_STIM
0x02 /* MAX_DAQ_LIST */
0x0A /* TIME_CYCLE */
0x00 /* TIME_UNIT */
0x00 /* PRIORITY */
/end EVENT
/begin EVENT
"100_ms_task" /* name */
"100 ms" /* short name */
0x0001 /* EVENT_CHANNEL_NUMBER */
DAQ_STIM
0x02 /* MAX_DAQ_LIST */
0x64 /* TIME_CYCLE */
0x00 /* TIME_UNIT */
0x10 /* PRIORITY */
/end EVENT
/end DAQ
/end XCP_ON_CAN
/end IF_DATA
This chapter gives an example of an ASAM MCD 2MC description file for a slave that supports
XCP on UDP/IP and XCP on CAN.
Example:
/begin HEADER
"Example of Default_Overruling principle"
VERSION "Sue01"
PROJECT_NO XCPv01
/end HEADER
/begin A2ML
/include XCP_definitions.aml
/include XCP_v1_0.aml
};
/end A2ML
BYTE_ORDER MSB_LAST
/end MOD_COMMON
/include XCP_v1_0_IF_DATA.a2l
/begin MEMORY_SEGMENT
Calib /* name */
"Calibration data" /* long identifier */
DATA /* PrgType */
FLASH /* Memory Type */
INTERN /* Attribute */
0x4000 /* Address */
0x200 /* Size */
-1 -1 -1 -1 -1 /* no mirrored segments */
/begin SEGMENT
/begin CHECKSUM
/end CHECKSUM
/begin PAGE
ECU_ACCESS_ALLOWED_DONT_CARE
XCP_READ_ACCESS_ALLOWED_DONT_CARE
XCP_WRITE_ACCESS_NOT_ALLOWED
/end PAGE
ECU_ACCESS_ALLOWED_DONT_CARE
XCP_READ_ACCESS_ALLOWED_DONT_CARE
XCP_WRITE_ACCESS_ALLOWED_WITH_ECU_ONLY
/end PAGE
/begin ADDRESS_MAPPING
0x04000 /* from */
0x14000 /* to */
0x100 /* length */
/end ADDRESS_MAPPING
/begin ADDRESS_MAPPING
0x04100 /* from */
0x24100 /* to */
0x100 /* length */
/end ADDRESS_MAPPING
/end SEGMENT
/end IF_DATA
/end MEMORY_SEGMENT
/end MOD_PAR
Triangle /* name */
"Triangle test signal" /* long identifier */
SBYTE /* DataType */
BitSlice.CONVERSION /* conversion */
0 /* resolution */
0 /* accuracy */
-50 50 /* lower, upper limit */
BIT_MASK 0xFF
ECU_ADDRESS 0x44A16
FORMAT "%7.3"
/begin AVAILABLE_EVENT_LIST
EVENT 0001 EVENT 0002
/end AVAILABLE_EVENT_LIST
/begin DEFAULT_EVENT_LIST
EVENT 0001
/end DEFAULT_EVENT_LIST
/end DAQ_EVENT
/end IF_DATA
/end MEASUREMENT
/begin COMPU_METHOD
BitSlice.CONVERSION
""
RAT_FUNC
"%2.0"
"-"
COEFFS 0 1 0 0 0 1
/end COMPU_METHOD
/end MODULE
/end PROJECT
The parameterization of the XCP protocol can be described in IF_DATA sections of an ASAM
MCD 2MC description file.
If supported, the master also can read out almost all of these parameters directly from the slave.
If for a parameter there’s both information in the ASAM MCD 2MC file and by reading it out from
the slave, the master has to check the consistency of both values.
If the master detects an inconsistency, he has to inform the user about the detected
inconsistency. The master has to give the user the possibility to decide whether the master for
this parameter has to use the value from the ASAM MCD 2MC description file or the value read
from the slave.
The integration of this function file is programming language and platform dependent. E.g. when using
®
a Windows operating system, these “external functions” could be located in a MySeedNKey.DLL
®
(Dynamically Linked Library). When using a UNIX operating system, these “external functions” could
be located in a MySeedNKey.SO (Shared Object).
To have an easy handling for XCP there is only one external function file which may contain all
algorithms to unlock all privileges or only a subset. That means the supplier can generate different
external function files with different privilege level combinations.
The privilege levels are described based on the “Resource Mask” of XCP and coded as defined there.
The ECU needs one algorithm for each privilege (if protected).
The external function file contains 2 functions: one to get information about the available privileges of
this function file and one to calculate a key from a seed for the requested privilege.
Function “XCP_GetAvailablePrivileges”:
The external function “XCP_ComputeKeyFromSeed “ should calculate Key from Seed for the
requested privilege
Remark:
Parameter 4 “Byte Length Key” must be initialised with the maximum Length of Key reserved by the
Master when calling the external Seed&Key function. This makes sure that the Seed&Key function will
not write into other memory than reserved. It is recommended to reserve 255 bytes since this is the
maximum length that is possible.
Example:
®
Example source code for a Windows -DLL can be downloaded from .
The integration of this function file is programming language and platform dependent. E.g. when using
®
a Windows operating system, this “external function” could be located in a MyChecksum.DLL
®
(Dynamically Linked Library). When using a UNIX operating system, this “external function” could be
located in a MyChecksum.SO (Shared Object).
Chapter “Win32 API for the ASAP1a Checksum Algorithm DLL” in the specification of the ASAM MCD
2MC Description File Format, describes the API for calling a Win32 Checksum.DLL.