XCP - Part 1 - Overview - 1.0
XCP - Part 1 - Overview - 1.0
Version 1.0
Part 1
Overview
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 1- Overview -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 ........................................................................................................7
0.1 The XCP Protocol Family............................................................................................... 7
0.2 Documentation Overview............................................................................................... 8
0.3 Definitions and Abbreviations........................................................................................ 9
1 XCP Features....................................................................................................10
1.1 Synchronous Data Transfer .......................................................................................... 11
1.1.1 The Synchronous Data Transfer Model (basic)....................................................... 11
1.1.1.1 General: DAQ, STIM and ODT .......................................................................... 11
1.1.1.2 ODT entry ........................................................................................................ 12
1.1.1.3 Object Description Table (ODT) ......................................................................... 13
1.1.1.4 DAQ list ........................................................................................................... 14
1.1.1.5 Event channels ................................................................................................. 15
1.1.2 The Synchronous Data Transfer Model (optional features) .................................... 16
1.1.2.1 Dynamic DAQ Configuration.............................................................................. 16
1.1.2.2 Advanced features............................................................................................ 18
1.1.2.2.1 power-up data transfer (RESUME mode) ......................................................... 18
1.1.2.2.2 Master-slave synchronization ......................................................................... 20
1.1.2.2.3 DAQ list prioritization .................................................................................. 21
1.1.2.2.4 ODT optimization ........................................................................................ 22
1.1.2.2.5 Bitwise stimulation ...................................................................................... 24
1.1.3 The Synchronous Data Transfer DIRECTION........................................................ 25
1.1.3.1 Synchronous data acquisition (DAQ) ................................................................. 25
1.1.3.2 Synchronous data stimulation (STIM)................................................................. 26
1.1.3.3 Bypassing (BYP) .............................................................................................. 27
1.2 Online Calibration ........................................................................................................ 28
1.2.1 The Online Data Calibration Model (basic) ............................................................ 28
1.2.1.1 General: SECTOR, SEGMENT and PAGE ......................................................... 28
1.2.1.2 Logical lay-out: SEGMENT................................................................................ 29
1.2.1.3 Accessability: PAGE ......................................................................................... 30
1.2.2 The Online Data Calibration Model (optional features).......................................... 31
1.2.2.1 Calibration Data Page Switching........................................................................ 31
1.2.2.2 Advanced features............................................................................................ 32
1.2.2.2.1 Calibration Data Page Freezing ...................................................................... 32
1.2.3 The Online Data Calibration actions ....................................................................... 33
1.2.3.1 Addressing ....................................................................................................... 33
1.2.3.2 Master - slave .................................................................................................. 34
1.2.3.3 Page – page..................................................................................................... 35
1.3 Flash programming....................................................................................................... 36
1.3.1 The Flashing Model................................................................................................. 36
1.3.1.1 Physical lay-out: SECTOR ................................................................................ 36
1.3.1.2 General:........................................................................................................... 37
1.3.1.3 Absolute Access Mode : access by address ....................................................... 38
1.3.1.4 Functional Access Mode : access by flash area .................................................. 39
4 Versioning ........................................................................................................55
4.1 The XCP Protocol Layer Version Number................................................................... 55
4.2 The XCP Transport Layer Version Number................................................................. 56
4.3 The Compatibility Matrix............................................................................................. 57
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.
XCP
CAN TCP/IP UDP/IP USB ...
Part 1 “Overview” gives an overview over the XCP protocol family, the XCP features and the
fundamental protocol definitions (this document).
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.
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
ECU
memory ODT List organization
ODT
0 address,length
Element
1 address,length
Element 2 address,length
3 address,length
Element
4 address,length
5 address,length
6 address,length
Element
Data elements located in the slave’s memory are transmitted in Data Transfer Objects DAQ from slave
to master and STIM from master to slave. The Object Description Table (ODT) describes the mapping
between the synchronous data transfer objects and the slave’s memory.
A synchronous data transfer object is identified by its Packet IDentifier (PID) that identifies the ODT
that describes the contents of this synchronous data transfer object.
An entry in an ODT references a data element by its address, the address extension, the size of the
element in ADDRESS_GRANULARITY and for a data element that represents a bit, the bit offset.
For the address of the element described by an ODT entry, the following has to be fulfilled :
For every size of the element described by an ODT entry, the following has to be fulfilled :
The MAX_ODT_ENTRY_SIZE_x parameters indicate the upper limits for the size of the element
described by an ODT entry in ADDRESS_GRANULARITY.
For every size of the element described by an ODT entry the following has to be fulfilled :
If a slave only supports elements with size = BYTE, the master has to split up multi-byte data elements
into single bytes.
For every ODT the numbering of the ODT entries through ODT_ENTRY_NUMBER restarts from 0
Several ODTs can be grouped to a DAQ-list. XCP allows for several DAQ-lists, which may be
simultaneously active. The sampling and transfer of each DAQ-list is triggered by individual events in
the slave (see SET_DAQ_LIST_MODE).
DAQ List #0
ODT #2 0 address,length
1 address,length
ODT #1 0 address,length
2 address,length
1 address,length
3 address,length
ODT #0 0 address,length
2 address,length
1 4 address,length
address,length
3 address,length PID=2 0 1 2 3 4 5 6
2 5 address,length
address,length
4 address,length
3 6 address,length
address,length PID=1 0 1 2 3 4 5 6
5 address,length
4 address,length
6 address,length PID=0 0 1 2 3 4 5 6
5 address,length
6 address,length
If DAQ lists are configured statically, MAX_ODT specifies the number of ODTs for this DAQ list.
If DAQ lists are configured dynamically, MAX_ODT is not fixed and will be 0.
MAX_DAQ is the total number of DAQ lists available in the slave device. It includes the predefined
DAQ lists that are not configurable (indicated with PREDEFINED at GET_DAQ_LIST_INFO) and the
ones that are configurable. If DAQ_CONFIG_TYPE = dynamic, MAX_DAQ equals
MIN_DAQ+DAQ_COUNT.
MIN_DAQ is the number of predefined DAQ lists. For predefined DAQ lists, DAQ_LIST_NUMBER is in
the range [0,1,..MIN_DAQ-1].
DAQ_COUNT is the number of dynamically allocated DAQ lists.
MAX_DAQ-MIN_DAQ is the number of configurable DAQ lists. For configurable DAQ lists,
DAQ_LIST_NUMBER is in the range [MIN_DAQ,MIN_DAQ+1,..MAX_DAQ-1].
For every DAQ list the numbering of the ODTs through ODT_NUMBER restarts from 0
Within one and the same XCP slave device, the range for the DAQ list number starts from 0 and has
to be continuous.
To allow reduction of the desired transfer rate, a transfer rate prescaler may be applied to the DAQ lists.
(ref. PRESCALER_SUPPORTED flag in DAQ_PROPERTIES at GET_DAQ_PROCESSOR_INFO).
Without reduction, the prescaler value must equal 1. For reduction, the prescaler has to be greater than
1.The use of a prescaler is only allowed for DAQ lists with DIRECTION = DAQ.
An event channel builds the generic signal source that effectively determines the data transfer timing.
EVENT_CHANNEL_NUMBER [0,1,..MAX_EVENT_CHANNEL-1]
For each event channel MAX_DAQ_LIST indicates the maximum number of DAQ lists that can be
allocated to this event channel. MAX_DAQ_LIST = 0 means there’s no limitation.
XCP allows for the prioritization of event channels. This prioritization is a fixed attribute of the slave
and therefore read-only. The event channel with event channel priority = FF has the highest priority.
The assignment of MEASUREMENT variables to event channels can optionally be controlled in the
section DAQ_EVENT local at each definition of the MEASUREMENT variable.
The assignment can either be fixed or variable.
If the assignment shall be fixed, a list with all event channels to be used (FIXED_EVENT_LIST) must
be defined at any MEASUREMENT variable where the fixed assignment is required. The tool cannot
change the assignment of the event channels for a MEASUREMENT variable with a fixed list.
If the assignment shall not be fixed but variable, a list with all valid events channels for this
MEASUREMENT (AVAILABLE_EVENT_LIST) can be provided local at the MEASUREMENT. In case
that such lists does not exist, all event channels provided by the ECU can be assigned by the tool.
A default assignment of the event channels to the MEASUREMENT variables can be supported by
providing a list with the default event channels (DEFAULT_EVENT_LIST). This default assignment
can be changed by the tool to a different assignment.
In case an AVAILABLE_EVENT LIST is defined, the event channels in the DEFAULT_EVENT_LIST
must be the same or a sub-set of the event channels in the AVAILABLE_EVENT_LIST for this
MEASUREMENT variable.
Lists are possible as some MCD tools allow measurement in multiple events.
Lists provide the user of a tool a simplified measurement configuration.
For the DAQ lists that are configurable, the slave can have certain fixed limits concerning the number
of DAQ lists, the number of ODTs for each DAQ list and the number of ODT entries for each ODT.
The slave also can have the possibility to configure DAQ lists completely dynamically.
Whether the configurable DAQ lists are configurable statically or dynamically is indicated by the
DAQ_CONFIG_TYPE flag in DAQ_PROPERTIES at GET_DAQ_PROCESSOR_INFO.
static dynamic
MAX_DAQ MIN_DAQ+DAQ_COUNT
MAX_DAQ_ABS
MAX_ODT MAX_ODT_DAQ_ABS
MAX_ODT_STIM_ABS
MAX_ODT_ENTRIES MAX_ODT_ENTRIES_ABS
MAX_ODT_ENTRIES_DAQ_ABS
MAX_ODT_ENTRIES_STIM_ABS
If DAQ lists are configured dynamically, MIN_DAQ still indicates the lower limit of the DAQ list number
range.
DAQ_COUNT indicates the number of configurable DAQ lists.
For the size of an element described by an ODT entry, still the same rules concerning
GRANULARITY_ODT_ENTRY_SIZE_x and MAX_ODT_ENTRY_SIZE_x have to be fulfilled.
For the allocation of FIRST_PID, still the same rules apply.
The scope of ODT_NUMBER still is local within a DAQ list.
The scope of ODT_ENTRY_NUMBER still is local within an ODT.
For the continuous numbering of DAQ list, still the same rule applies.
For the continuous numbering of event channels, still the same rule applies.
Dynamic DAQ list configuration is done with the commands FREE_DAQ, ALLOC_DAQ, ALLOC_ODT
and ALLOC_ODT_ENTRY. These commands allow to allocate dynamically but within the above
mentioned limits, a number of DAQ list, a number of ODTs to a DAQ list and a number of ODT entries
to an ODT.
These commands get an ERR_MEMORY_OVERFLOW as negative response if there’s not enough
memory available to allocate the requested objects. If an ERR_MEMORY_OVERFLOW occurs, the
complete DAQ list configuration is invalid.
During a dynamic DAQ list configuration, the master has to respect a special sequence for the use of
FREE_DAQ, ALLOC_DAQ, ALLOC_ODT and ALLOC_ODT_ENTRY.
At the start of a dynamic DAQ list configuration sequence, the master always first has to send a
FREE_DAQ. Secondly, with ALLOC_DAQ the master has to allocate the number of configurable DAQ
lists. Then, the master has to allocate all ODTs to all DAQ lists with ALLOC_ODT commands. Finally,
the master has to allocate all ODT entries to all ODTs for all DAQ lists with ALLOC_ODT_ENTRY
commands.
If the master sends an ALLOC_DAQ directly after an ALLOC_ODT without a FREE_DAQ in between,
the slave returns an ERR_SEQUENCE as negative response.
a fte r
FREE_DAQ ALLOC_DAQ ALLOC_ODT ALLOC_ODT_ENTRY
This rule implies that a new DAQ list cannot be added to an already existing configuration.
The master has to completely reconfigure the whole DAQ list configuration to include the additional
DAQ list.
The purpose of the resume mode is to enable automatic data transfer (DAQ,STIM) directly after the
power up of the slave.
STORE_DAQ_RE
DAQ_RUNNING
Master Slave
SELECTED
RUNNING
RESUME
RESUME
Configure DAQ lists
Q
START_STOP_DAQ_LIST(Select)
1 0 1 0 1 0 1 0 1 0 1 0
SET_REQUEST(STORE_DAQ_REQ,ID)
Start of
Storing
EV_STORE_DAQ End of
Storing
Slave
Go into restart
RESUME mode
Start in
EV_RESUME_MODE(ID, timestamp) RESUME
mode
DTO(DAQ)
Compare Ids
Config valid ?
DTO(DAQ) valid
GET_DAQ_LIST_MODE
DTO(STIM)
Start DTO(STIM)
GET_STATUS
CONNECT
With START_STOP_DAQ_LIST(Select) , the master can select a DAQ list to be part of a DAQ list
configuration the slave uses when being in RESUME mode.
With GET_DAQ_LIST_MODE the master can identify whether a DAQ list is part of a DAQ list
configuration the slave uses when in RESUME mode.
The master has to calculate a Session Configuration Id based upon the current configuration of the
DAQ lists selected for RESUME mode.
The master has to store this Session Configuration Id internally for further use.
The master also has to send the Session Configuration Id to the slave with SET_REQUEST.
If STORE_DAQ_REQ is set, the slave internally has to set the RESUME bit of those DAQ lists that
previously have been selected with START_STOP_DAQ_LIST(select).
If STORE_DAQ_REQ is set and the appropriate conditions are met, the slave then has to save all
DAQ lists which have the RESUME bit set, into non-volatile memory.
If STORE_DAQ_REQ is set, the slave also has to store the Session Configuration Id in non-volatile
memory. It will be returned in an EV_RESUME_MODE and in the response of GET_STATUS.
This allows the master device to verify that automatically started DAQ lists contain the expected data
transfer configuration.
Upon saving, the slave first has to clear any DAQ list configuration that might already be stored in non-
volatile memory.
The STORE_DAQ_REQ bit obtained by GET_STATUS will be reset by the slave, when the request is
fulfilled. The slave device may indicate this by transmitting an EV_STORE_DAQ event packet.
RESUME mode is allowed for both directions, DAQ and STIM.
On each power up, the slave has to restore the DAQ lists and send an EV_RESUME_MODE to the
master.
If the configuration of an ODT does not correspond to the requested optimization method,
1. the slave can answer with an ERR_DAQ_CONFIG message to show that this configuration
can not be handled. The configuration of all DAQ lists is not valid.
2. the slave implementation can be tolerant. In this case it will handle the configuration, but in a
non-optimal way.
The BIT_OFFSET field at WRITE_DAQ allows the transfer of data stimulation elements that represent
the status of a bit. For a MEASUREMENT that’s in a DAQ list with DIRECTION = DAQ, the key word
BIT_MASK describes the mask to be applied to the measured data to find out the status of a single bit.
For a MEASUREMENT that’s in a DAQ list with DIRECTION = STIM, the key word BIT_MASK
describes the position of the bit that has to be stimulated. The Master has to transform the BIT_MASK
to the BIT_OFFSET
e.g Bit7 " BIT_MASK = 0x80 " BIT_OFFSET = 0x07
When BIT_OFFSET = FF, the field can be ignored and the WRITE_DAQ applies to a normal data
element with size expressed in bytes. If the BIT_OFFSET is from 0x00 to 0x1F, the ODT entry
describes an element that represents the status of a bit. In this case, the Size of DAQ element always
has to be equal to the GRANULARITY_ODT_ENTRY_SIZE_x. If the value of this element = 0, the
value for the bit = 0. If the value of the element > 0, the value for the bit = 1.
By means of the DIRECTION flag , a DAQ-list can be put in Synchronous Data Acquisition mode.
By means of DAQ with 0x00 <= PID <= 0xFB the slave has to transfer the contents of the elements
defined in each ODT of the DAQ-list to the master.
When processing an ODT, the slave can go to the next ODT as soon as it finds an element with size =
0 in the current ODT or all ODT entries of this ODT have been processed.
When processing a DAQ list, the slave can go to the next DAQ list as soon as it finds an element with
size = 0 at the first ODT entry of the first ODT of this DAQ list or all ODTs of this DAQ list have been
processed.
The slave has to sample the elements consistently. When a DAQ list is triggered, the slave at least
has to sample the data for one and the same ODT in a consistent way, so consistency on the ODT
level is always guaranteed. However, the slave may need some time to sample and transmit the
complete DAQ list with all its ODTs. When a new event cycle is triggered before the transfer of the
previous cycle has been finished, the slave is said to have an “OVERLOAD situation”. The slave
device may indicate this OVERLOAD situation to the master. The kind of OVERLOAD indication is
indicated by the OVERLOAD_x flags in DAQ_PROPERTIES at GET_DAQ_PROCESSOR_INFO. The
slave’s reaction on an OVERLOAD situation is implementation dependent.
Bypassing can be realized by making use of Synchronous Data Acquisition and Synchronous Data
Stimulation simultaneously. Except from these 2 basic functions, state-of-the-art Bypassing also
requires the administration of the bypassed functions. This function is not part of this specification.
Also the slave should perform plausibility checks on the data it receives through data stimulation. The
borders and actions of these checks are set by standard calibration methods. No special XCP
commands are needed for this.
XCP access
SEGMENT 1
SEGMENT 1 SEGMENT 1 SEGMENT 1
...
SECTOR 2
ECU access
SEGMENT 0
SEGMENT 0
...
PAGE 0
SECTOR 1
SECTOR 0
address
The slave’s memory lay-out is described as one continuous physical space. Elements are referenced
with a 40 bit address (32 bit XCP address + 8 bit XCP address extension).
When searching for data to be used by the control algorithms in the slave, at any moment (for every
SEGMENT) the slave can access only one PAGE. This PAGE is called the “active PAGE for ECU
access for this SEGMENT”.
When referencing data with XCP commands, at any moment (for every SEGMENT) the XCP master
can access only one PAGE. This PAGE is called the “active PAGE for XCP access for this
SEGMENT”.
The active PAGE for ECU access and XCP access can be switched independently.
The active PAGE can be switched independently for every SEGMENT.
The logical lay-out of the slave’s memory is described with objects called SEGMENTS.
SEGMENTS describe WHERE the calibratable data objects are located in the slave’s memory.
The start address and size of a SEGMENT doesn’t have to respect the limitations given by the start
addresses and sizes of the SECTOR lay-out (ref. Flashing).
A SEGMENT is described with the normal ASAM MCD2 keyword MEMORY_SEGMENT which
contains information like Name, Address, Size and Offsets for Mirrored Segments.
For having a 40 bit address space, every SEGMENT is having an address extension which is valid for
all calibratable objects that are located within this SEGMENT.
Within one and the same XCP slave device, the range for the SEGMENT_NUMBER starts from 0 and
has to be continuous.
SEGMENT_NUMBER [0,1,..255]
The slave always has to initialize all its PAGEs for all its SEGMENTs.
PAGE 0 of the INIT_SEGMENT of a PAGE contains the initial data for a PAGE.
With GET_CAL_PAGE, the master can get the current active PAGEs for XCP and ECU access of the
slave.
The ECU_ACCESS_x flags indicate whether and how the ECU can access this page.
If the ECU can access this PAGE, the ECU_ACCESS_x flags indicate whether the ECU can access
this PAGE only if the XCP master does NOT access this PAGE at the same time, only if the XCP
master accesses this page at the same time, or the ECU doesn’t care whether the XCP master
accesses this page at the same time or not.
The XCP_x_ACCESS_y flags indicate whether and how the XCP master can access this page. The
flags make a distinction for the XCP_ACCESS_TYPE depending on the kind of access the XCP
master can have on this page (READABLE and/or WRITEABLE).
If the XCP master can access this PAGE, the XCP_READ_ACCESS_x flags indicate whether the XCP
master can read from this PAGE only if the ECU does NOT access this PAGE at the same time, only if
the ECU accesses this page at the same time, or the XCP master doesn’t need to care whether the
ECU accesses this page at the same time or not.
If the XCP master can access this PAGE, the XCP_WRITE_ACCESS_x flags indicate whether the
XCP master can write to this PAGE only if the ECU does NOT access this PAGE at the same time,
only if the ECU accesses this page at the same time, or the XCP master doesn’t need to care whether
the ECU accesses this page at the same time or not.
For every SEGMENT the numbering of the PAGEs through PAGE_NUMBER restarts from 0
PAGE_NUMBER(Segment j) [0,1,..255]
If the slave supports the optional commands GET_CAL_PAGE and SET_CAL_PAGE, page switching
is supported.
When searching for data to be used by the control algorithms in the slave, at any moment (for every
SEGMENT) the slave can access only one PAGE. This PAGE is called the “active PAGE for ECU
access for this SEGMENT”.
When referencing data with XCP commands, at any moment (for every SEGMENT) the XCP master
can access only one PAGE. This PAGE is called the “active PAGE for XCP access for this
SEGMENT”.
With GET_CAL_PAGE, the master can request the slave to answer the current active PAGE for ECU
or XCP access for this SEGMENT.
With SET_CAL_PAGE, the master can set the current active PAGE for ECU or XCP access for this
SEGMENT.
The master has the full control for switching the pages. The slave can not switch its pages
autonomously.
The active PAGE for ECU access and XCP access can be switched independently.
The master has to respect the constraints given by the XCP_ACCESS_TYPE and
ECU_ACCESS_TYPE.
With STORE_CAL_REQ in SET_REQUEST, the master requests the slave to save calibration data
into non-volatile memory.
For each SEGMENT that is in FREEZE mode, the slave has to save the current active XCP PAGE for
this SEGMENT into PAGE 0 of the INIT_SEGMENT of this PAGE.
The STORE_CAL_REQ bit obtained by GET_STATUS will be reset by the slave, when the request is
fulfilled. The slave device may indicate this by transmitting an EV_STORE_CAL event packet.
1.2.3.1 Addressing
The slave’s memory lay-out is described as one continuous physical space. Elements are referenced
with a 40 bit address (32 bit XCP address + 8 bit XCP address extension).
The address extension is taken from the SEGMENT to which the currently referenced address
belongs.
The address range at MEMORY_SEGMENT describes the addresses from which the master can
generate a file that can be programmed into the slave and then will result in a normal operating slave.
A2L_address
at CHARACTERISTIC
XCP Calibrating
ECU_CALIBRATION_OFFSET +
+ + ADDRESS_MAPPING
From
YES -
Near pointer ?
NO +
*(x) To
+
+
+
Address is located in
Address in HEX file for flashing Working Base address MEMORY_SEGMENT
XCP Flashing
The slave has to support checksum calculation on all address ranges that are described with
SECTORS or SEGMENTS.
Checksum calculation has to be possible for all PAGEs that have XCP_ACCESS_ALLOWED.
If a PAGE is READABLE by the XCP master, the master can access this PAGE with the commands
UPLOAD and SHORT_UPLOAD, in standard mode and if supported in block mode.
If a PAGE is WRITEABLE by the XCP master, the master can access this PAGE with the commands
SHORT_DOWNLOAD and DOWNLOAD_MAX in standard mode.
If a PAGE is WRITEABLE by the XCP master, the master can access this PAGE with the commands
DOWNLOAD and if block mode supported with DOWNLOAD_NEXT.
If a PAGE is WRITEABLE by the XCP master, the master can access this PAGE with the command
MODIFY_BITS which allows to modify bits in an atomic way.
If the XCP slave device has more than one PAGE, the master can copy the data from one PAGE to
another with COPY_CAL_PAGE.
In principal any PAGE of any SEGMENT can be copied to any PAGE of any SEGMENT. However,
restrictions might be possible. The slave indicates this by ERR_PAGE_NOT_VALID,
ERR_SEGMENT_NOT_VALID or ERR_WRITE_PROTECTED.
The physical lay-out of the slave’s memory is described with objects called SECTORS.
SECTOR start addresses and sizes are important when reprogramming (Flashing) the slave device.
SECTOR_NUMBER [0,1,..255]
In principle the complete flash process can be divided into three steps. It depends on the point
of view, whether the individual use case needs all of them:
The XCP protocol deals with these steps in different ways. The commands for the original flash
process are the focus of XCP.
XCP offers special programming commands. The project specific use of all the commands must
be specified in a project specific “programming flow control”. This document specifies no
standard for this additional description file. In practice every project needs a project specific
agreement between the ECU and the tool supplier.
PROGRAM_START
PROGRAM_CLEAR
PROGRAM_FORMAT
PROGRAM (Loop)
It is also possible to use a block transfer mode optionally.
PROGRAM_VERIFY
PROGRAM_RESET
Usually administration before means version control before the original flash process has been
started. This examination checks inside the tool whether the new flash content fits to the ECU.
Therefore the tools needs identification information of the ECU and of the new flash content.
XCP doesn’t support special version control commands for the flash process. In practice the
administration actions are very project specific and it depends on the ECU, which services are
necessary.
The ECU functional description can specify with which standard XCP commands a version
control before could be done.
The actions of the version control below can be done inside the ECU. XCP supports some
flexible commands.
The original flash process can be done with different concepts. The XCP protocol supports two
different flash access methods. They are called the “absolute” and the “functional” access
modes. Both methods use the same commands with sometimes different parameters. It is
possible to mix, i.e. to use a different access method for the delete phase in comparison to the
programming phase.
The recommended concept is based on the available address and memory information and
specified in the project specific programming flow control.
This mode bases on some conditions and is used as default. The physical layout of the flash
device is well-known to the tool and the flash content to be programmed is available and also
the address information of the data.
It depends on the project, whether the physical layout information are supported by an
description file or can be read out of the ECU. There exist different optional XCP commands for
different information.
Moreover the tool needs all the necessary sequence information, which must be specified in a
project specific programming flow control.
The data block of the specified length (size) contained in the CTO will be programmed into non-
volatile memory, starting at the MTA. The MTA will be post-incremented by the number of data
bytes.
XCP
transfer area of
defined by new flash
new Flash content Data Block content
Data Block ** MTA = Adr X
gaps
depend
on MTA
Data Block ** defined by
Adr X
MTA = Adr Y
Adr Y
Address
Information
LEGEND
Data Block ** : may be crypted and/or compressed
XCP Transfer : flash gaps (= missing adresses inside area of new flash content)
are allowed
XCP
transfer area of
Address
calculated new flash
new Flash content by ECU Data Block content
Data Block **
MTA = gaps are
Block calculated
Sequence by ECU
Counter
Data Block ** defined by
PROGRAMM
_CLEAR
01
relative pointer
LEGEND
Data Block ** : may be crypted and/or compressed
XCP Transfer : missing relative pointer during XCP transfer are not allowed
It is optionally possible to change to the absolute access mode at the end of the flash session.
Affected Commands
PROGRAM_CLEAR, PROGRAM_FORMAT, PROGRAM, SET_MTA
After the original flash process a version control is helpful. This action checks whether the new flash
content fits to the rest of the flash. In practice exists different methods, but XCP supports only a
checksum control and the start of internal test routines.
The checksum method can be done with the standard checksum command (examination inside the
tool). On the other hand XCP supports an examination inside the slave. The tool can start slave
internal test routines and send verification values to the slave.
Affected Commands
BUILD_CHECKSUM, PROGRAM_VERIFY
The end of the overall programming sequence is indicated by a PROGRAM_RESET command. The
slave device will go to disconnected state. Usually a hardware reset of the slave device is executed.
Affected Commands
PROGRAM_RESET
The XCP Protocol uses a “soft” master/slave principle. Once the master established a
communication channel with the slave, the slave is allowed to send certain messages (Events,
Service Requests and Data Acquisition messages) autonomously. Also the master sends Data
stimulation messages without expecting a direct response from the slave.
Master
master network
Slave 1 Slave 2 Slave 5
gate-way
remote network
Slave 3 Slave 4
When transferring XCP messages, a gate-way has to be able to adapt the XCP Header and Tail
depending upon the Transport Layer used in Master Network and Remote Network.
The XCP gate-way has to logically represent the nodes of its Remote Network in the Master Network.
In the connected state, each request packet will be responded by a corresponding response
packet or an error packet.
Master Slave
Request k
Response k
Request k+1
Response k+1
time
In the standard communication model, the master device may not send a new request until the
response to the previous request has been received.
In XCP Standard Communication mode, each request packet will be responded by a single
response packet or an error packet.
To speed up memory uploads, downloads and flash programming, the XCP commands
UPLOAD, SHORT_UPLOAD, DOWNLOAD, SHORT_DOWNLOAD and PROGRAM may
support a block transfer mode similar to ISO/DIS 15765-2.
The block transfer communication mode excludes interleaved communication mode.
Master Slave
Request k_1
Request k_2
MIN_ST
Request k_3
MAX_BS
Response k
Request k+1
time
Response k
Request k+1
time
In the standard communication model, the master device may not send a new request until the
response to the previous request has been received.
To speed up data transfer, in Interleaved Communication Mode the master may already send
the next request before having received the response on the previous request.
The interleaved communication mode excludes block transfer communication mode.
Master Slave
Request k
Request k+1
QUEUE_SIZE
Response k
Response k+1
time
START
Severity:
S0: Information
RE S1: Warning
f
of SU S2: Error
= S3: Fatal Error
E M
M E
SU =
on
RE
S0-S2
As soon as the XCP slave device starts its operation, it has to check whether there’s a DAQ list
configuration, to be used for RESUME mode, available in non-volatile memory.
If there’s no such a configuration available, the slave has to go to “DISCONNECTED” state.
In “DISCONNECTED” state, there’s no XCP communication. The session status, all DAQ lists and
the protection status bits are reset, which means that DAQ list transfer is inactive and the seed and
key procedure is necessary for all protected functions.
In “DISCONNECTED” state, the slave processes no XCP commands except for CONNECT.
Master Slave
CONNECT(USER_DEFINED) Slave OFF
Go into
user defined mode
CONNECT(USER_DEFINED)
.
CONNECT(USER_DEFINED)
.
.
Slave ON
CONNECT(USER_DEFINED) receipt
of CONNECT(USER_DEFINED)
go into special (user defined) mode
FF
Send RES
.
.
.
any XCP command
RES
.
.
.
Go into
NORMAL mode CONNECT(NORMAL)
receipt
FF
of CONNECT(NORMAL)
leave special (user defined) mode
Send RES
In “CONNECTED” state, the slave has to acknowledge a new CONNECT and handle it like a
CONNECT command to a disconnected device.
If the slave when starting its operation detects that there’s a DAQ list configuration, to be used
for RESUME mode, available in non-volatile memory , the slave has to go to the ” RESUME”
state.
In “RESUME”, the slave automatically has to start those DAQ lists that are stored in non-volatile
memory and that are to be used for RESUME mode (ref. Description of RESUME mode).
In “RESUME”, the slave processes no XCP commands except for CONNECT.
In “RESUME” state, the slave has to acknowledge a CONNECT and handle it like a CONNECT
command to a disconnected device, but keep the current DTO transfer running.
In “CONNECTED” state, if the master sends a DISCONNECT command, the slave goes to
“DISCONNECTED” state.
If an error occurs with severity S0-S2, the slave will not change its state.
If an error occurs with severity S3 “Fatal error”, this will bring the slave to the
“DISCONNECTED” state.
XCP messages always are transported in the Data Field of a particular transport layer e.g. CAN,
TCP/IP and UDP/IP. In general, the transport layer has to fulfill the requirements below :
An XCP Message ( = Frame) consists of an XCP Header, an XCP Packet and an XCP Tail.
The XCP Packet contains the generic part of the protocol, which is independent from the
transport layer used.
An XCP Packet consists of an Identification Field, an optional Timestamp Field and a Data Field.
Part 2 of the XCP Specification, “Protocol Layer Specification”, describes the contents of an XCP
Packet.
The XCP Header and XCP Tail depend upon the transport layer used.
Both XCP Header and XCP Tail consist of a Control Field.
Part 3 of the XCP Specification, “Transport Layer Specification”, describes the contents of the
Control Fields for different transport layers e.g. CAN, TCP/IP and UDP/IP.
The range of both protocol parameters can be smaller, depending on the used transport layer.
MAX_ODT_ENTRIES indicates the maximum amount of entries into an ODT of the XCP slave.
ODT_ENTRIES_COUNT indicates the amount of entries into an ODT using dynamic DAQ list
configuration.
An entry is identified by a number called ODT_ENTRY_NUMBER.
Counting starts at zero.
The XCP Protocol Layer Version Number indicates the version of the Protocol Layer Specification.
The XCP Protocol Layer Version Number is a 16-bit value.
If the Protocol Layer is modified in such a way that a functional modification in the slave’s driver
software is needed, the higher byte of the XCP Protocol Layer Version Number will be incremented.
This could be the case e.g. when modifying the parameters of an existing command or adding a new
command to the specification.
If the Protocol Layer is modified in such a way that it has no direct influence on the slave’s driver
software, the lower byte of the XCP Protocol Layer Version Number will be incremented.
This could be the case e.g. when rephrasing the explaining text or modifying the AML description.
The slave only returns the most significant byte of the XCP Protocol Layer Version Number in
the response upon CONNECT.
Part 3 of the XCP Specification also describes possible additional Packets for a specific
Transport Layer.
Independent from Part 2, every Part 3 has its own XCP Transport Layer Version Number.
The XCP Transport Layer Version Number indicates the version of a specific Part 3 of the
specification.
The XCP Transport Layer Version Number is a 16-bit value.
If a specific Part 3 is modified in such a way that a functional modification in the slave’s driver
software is needed, the higher byte of its XCP Transport Layer Version Number will be
incremented. This could be the case e.g. when modifying the parameters of an existing
command or adding a new command to the specification.
If a specific Part 3 is modified in such a way that it has no direct influence on the slave’s driver
software, the lower byte of its XCP Transport Layer Version Number will be incremented. This
could be the case e.g. when rephrasing the explaining text or modifying the AML description.
The slave only returns the most significant byte of the XCP Transport Layer Version Number for
the current Transport Layer in the response upon CONNECT.
The main.a2l that describes a slave that supports XCP on different Transport Layers, includes
an XCP_definitions.aml that contains a reference to a certain version of Protocol Layer
Specification and (a) reference(s) to (a) certain version(s) of Transport Layer Specification(s).
If a certain version of the Protocol Layer Specification needs a certain version of a Transport
Layer Specification, this will be mentioned as prerequisite in the Protocol Layer Specification.
If a certain version of a Transport Layer Specification needs a certain version of Protocol Layer
Specification, this will be mentioned as prerequisite in the Transport Layer Specification.