ASAM XCP Part3 Transport Layer Specification XCPonCAN V1 1 0
ASAM XCP Part3 Transport Layer Specification XCPonCAN V1 1 0
Version 1.1
Status of Document
Date: 31-03-2008
Author: Roel Schuermans, Vector Informatik GmbH
Andreas Zeiser, Vector Informatik GmbH
Oliver Kitt, Vector Informatik GmbH
Hans-Georg Kunz, VDO Automotive AG
Hendirk Amsbeck, dSPACE GmbH
Bastian Kellers, dSPACE GmbH
Boris Ruoff, ETAS GmbH
Reiner Motz, Robert Bosch GmbH
Dirk Forwick, Robert Bosch GmbH
Version: Version 1.1
Doc-ID:
Status: Release
Type
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.
Revision History
This revision history shows only major modifications between release versions.
Table of contents
0. Introduction 7
0.1 The XCP Protocol Family 7
0.2 Documentation Overview 8
0.3 Definitions and Abbreviations 9
0.4 Mapping between XCP Data Types and ASAM Data Types 10
Table of diagrams:
Diagram 1 : Master Block Transfer with Incremental CAN-ID 12
Diagram 2 : Header and Tail for XCP on CAN 13
Diagram 3 : No XCP Tail if DLC = LEN (<= MAX_DLC) 14
Diagram 4 : XCP Tail if DLC = MAX_DLC (> LEN) 14
Diagram 5 : Typical use of GET_SLAVE_ID modes 18
0. INTRODUCTION
XCP
CAN TCP/IP UDP/IP USB ...
XCP is not backwards compatible to an existing CCP implementation.
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.
This document describes the way how the XCP protocol is transported on CAN.
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.
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
0.4 MAPPING BETWEEN XCP DATA TYPES AND ASAM DATA TYPES
The following table defines the mapping between data types used in this specification and
ASAM data types defined by the Project Data Harmonization Version 2.0 (ref.
www.asam.net).
1.1 ADDRESSING
The master can use GET_SLAVE_ID to detect all XCP slaves within a CAN network. The
master has to send GET_SLAVE_ID with the XCP Broadcast CAN identifier.
GET_SLAVE_ID CAN XCP XCP CAN GET_SLAVE_ID
XCP on CAN uses at least two different CAN identifiers for each independent slave: one
identifier for the CMD and STIM packets and one identifier for the RES, ERR, EV, SERV and
CAN XCP CAN CMD STIM RES ERR EV
DAQ packets. SERV DAQ
The STIM CAN Identifiers may be the same as the CMD CAN Identifier or may be assigned
by the SET_DAQ_ID command. STIM CAN CMD CAN SET_DAQ_ID
The DAQ CAN Identifiers may be the same as the RES/ERR/EV/SERV CAN Identifier or
may be assigned by the SET_DAQ_ID command. DAQ CAN SET_DAQ_ID RES / ERR / EV / SERV CAN
The assignment of CAN message identifiers to the XCP objects CMD/STIM and
RES/ERR/EV/SERV/DAQ is defined in the slave device description file (e.g. the ASAP2
format description file), which is used to configure the master device. It is recommended that
the bus priority of the message objects be carefully determined in order to avoid injury to
other real-time communication on the bus. Also, the CMD/STIM should obtain higher priority
than the RES/ERR/EV/SERV/DAQ.
CAN XCP CMD / STIM RES / ERR / EV / SERV / DAQ ASAP2
CMD / STIM
RES / ERR / EV / SERV / DAQ
The most significant bit (of the 32-bit value) set, indicates a 29 bit CAN identifier.
32 29 CAN
For block transfer from Master to Slave during a download or programming sequence,
performance can be increased if the Master uses different CAN-ID s for every request and
the communication is done with MIN_ST(_PGM) = 0.
With CAN_ID_MASTER_INCREMENTAL, the slave can inform the master that for a block
transfer sequence it has to use a range of CAN-IDs for the different requests. The Master
has to send the first request with CAN_ID_MASTER. The Master has to send consecutive
requests by incrementing CAN_ID_MASTER for every new request. The master has to send
the last request of the block transfer sequence with CAN_ID_MASTER+MAX_BS(_PGM)-1.
CAN-ID MIN_ST _PGM = 0
CAN_ID_MASTER_INCREMENTAL CAN-ID CAN_ID_MASTER
CAN_ID_MASTER CAN_ID_MASTER + MAX_BS _PGM -1
1.3.1 HEADER
1.3.2 TAIL
For XCP on CAN, the Tail consists of a Control Field containing optional Fill bytes. CAN XCP
The maximum data length of a CAN message and therefore maximum length of an XCP on
CAN message is MAX_DLC = 8. CAN CAN XCP MAX_DLC = 8
If the length (LEN) of an XCP Packet equals MAX_DLC, the Control Field of the XCP Tail is
empty and the XCP on CAN Message is the same as the XCP Packet (DLC = LEN =
XCP LEN MAX_DLC XCP CAN XCP XCP DLC = LEN = MAX_DLC
MAX_DLC).
If LEN is smaller than MAX_DLC, there’re 2 possibilities to set the DLC. LEN MAX_DLC DLC
A first possibility is to set DLC = LEN. The Control Field of the XCP Tail is empty and the
XCP on CAN Message is the same as the XCP Packet.
DLC = LEN XCP CAN XCP XCP
XCP Packet
XCP Tail
DLC PID .... empty
LEN
A second possibility is to set DLC = MAX_DLC = 8. The Control Field of the XCP Tail
contains MAX_DLC – LEN fill bytes. The contents of the FILL bytes is “don’t care”.
DLC = MAX_DLC =8 XCP MAX_DLC – LEN FILL “ ”
With MAX_DLC_REQUIRED, the slave can inform the master that it has to use CAN frames
with DLC = MAX_DLC = 8 when sending to the slave.
MAX_DLC_REQUIRED DLC = MAX_DLC = 8 CAN
The master can use GET_SLAVE_ID to detect all XCP slaves within a CAN network.
At the same time, the master gets to know the CAN identifier the master has to use when
transferring CMD/STIM to a specific slave and the CAN identifier this slave uses for
transferring RES/ERR/EV/SERV/DAQ.
The master has to send GET_SLAVE_ID with the XCP Broadcast CAN identifier.
If the master sends an XCP message with the XCP Broadcast CAN identifier, all XCP slaves
that are connected to the CAN network have to respond. GET_SLAVE_ID is the only XCP
message that can be broadcasted.
A slave always has to respond to GET_SLAVE_ID, even if the slave device is not in
Connected state yet.
The slave has to send the response with the CAN identifier it uses for transferring
RES/ERR/EV/SERV/DAQ. The CAN identifier for CMD/STIM is coded in Intel format (MSB
on higher position).
ASCII The master sends GET_SLAVE_ID with an Identification Pattern (ASCII for “XCP”). The
“ XCP” GET_SLAVE_ID
XCP master uses this Pattern for recognizing answers from XCP slaves.
GET_SLAVE_ID
If the master sends a GET_SLAVE_ID(identify by echo), the slave has to send a response
CMD / that contains an echo of the Pattern. Additionally the slave informs the master about the
STIM
CAN CAN identifier the master has to use when transferring CMD/STIM to this slave.
If the master sends a GET_SLAVE_ID(confirm by inverse echo), the slave has to send a
response that contains an inversed echo of the Pattern. Additionally the slave repeats the
CAN identifier the master has to use when transferring CMD/STIM to this slave.
GET_SLAVE_ID CMD / STIM
CAN
GET_SLAVE_ID
If the master sends a GET_SLAVE_ID(confirm by inverse echo), without a previous
GET_SLAVE_ID
GET_SLAVE_ID(identify by echo), the slaves will silently ignore that command.
GET_SLAVE_ID If the master first sends a GET_SLAVE_ID(identify by echo) and then a
GET_SLAVE_ID GET_SLAVE_ID(confirm by inversed echo), this sequence allows the master to reliably
CAN distinguish the responses of the slaves from other communication frames on the CAN network
CAN and to reliably detect the CAN identifier pairs for every single slave.
Master Slave
upon GET_SLAVE_ID(XCP, identify by echo)
Broadcast CAN id
slave 1 upon its
Response(XCP, CAN id for CMD/STIM) CAN id for RES/
ERR/EV/SERV/DAQ
upon CONNECT
CAN id for CMD/STIM
for slave 1 slave 1 upon its
Response
CAN id for RES/
ERR/EV/SERV/DAQ
upon CONNECT
CAN id for CMD/STIM
for slave 2 slave 2 upon its
Response
CAN id for RES/
ERR/EV/SERV/DAQ
Positive Response:
As a default, the master transfers all DAQ lists with DIRECTION = STIM on the same CAN
Identifier as used for CMD.
Alternatively, the master may have individual CAN Identifiers (other than the one used for
CMD) for the DAQ lists with DIRECTION = STIM.
CMD CAN DIRECTION = STIM DAQ
DIRECTION = STIM DAQ CAN CMD
As a default, the slave transfers all DAQ lists with DIRECTION = DAQ on the same CAN
Identifier as used for RES/ERR/EV/SERV.
RES / ERR / EV / SERV CAN DIRECTION = DAQ DAQ
Alternatively, the slave may have individual CAN Identifiers (other than the one used for
RES/ERR/EV/SERV) for its DAQ lists with DIRECTION = DAQ.
DQ CAN RES / ERR / EV / SERV DIRECTION = DAQ
With GET_DAQ_ID, the master can detect whether a DAQ list uses an individual CAN
identifier and whether this Identifier is fixed or configurable.
GET_DAQ_ID DAQ CAN
If the CAN Identifier is configurable, the master can configure the individual Can Identifier for
this DAQ list with SET_DAQ_ID.
CAN SET_DAQ_ID DAQ Can
taggedstruct { /* optional */
“CAN_ID_BROADCAST” ulong; /* Auto detection CAN-ID */
/* master -> slaves */
/* Bit31= 1: extended identifier */
“CAN_ID_MASTER” ulong;
/* CMD/STIM CAN-ID */
/* master -> slave */
/* Bit31= 1: extended identifier */
"CAN_ID_MASTER_INCREMENTAL"; /* master uses range of CAN-IDs */
/* start of range = CAN_ID_MASTER */
/* end of range = CAN_ID_MASTER+MAX_BS(_PGM)-1 */
“SAMPLE_RATE” enum {
"SINGLE" = 1, /* 1 sample per bit */
"TRIPLE" = 3 /* 3 samples per bit */
};
})*;
};
/begin DAQ_LIST_CAN_ID
0x0000 /* for DAQ_LIST 0 */
FIXED 0x310
/end DAQ_LIST_CAN_ID
/begin DAQ_LIST_CAN_ID
0x0001 /* for DAQ_LIST 1 */
FIXED 0x320
/end DAQ_LIST_CAN_ID
/begin DAQ_LIST_CAN_ID
0x0002 /* for DAQ_LIST 2 */
FIXED 0x330
/end DAQ_LIST_CAN_ID
/end XCP_ON_CAN
ASAM e.V.
Arnikastraße 2
D-85635 Höhenkirchen
Germany