TechnicalReference XCP Protocol Layer PDF
TechnicalReference XCP Protocol Layer PDF
Technical Reference
Version 1.0
1 History
Please note
We have configured the programs in accordance with your specifications in the
questionnaire. Whereas the programs do support other configurations than the one
specified in your questionnaire, Vector´s release of the programs delivered to your
company is expressly restricted to the configuration you have specified in the
questionnaire..
Contents
1 History ......................................................................................................................... 2
2 Overview ..................................................................................................................... 8
2.1 Abbreviations and items used in this paper ................................................. 9
2.2 Naming conventions................................................................................... 10
3 Functional description............................................................................................. 11
3.1 Overview of the functional scope ............................................................... 11
3.2 Communication mode info ......................................................................... 11
3.3 Block transfer communication model (XCP Professional only) .................. 11
3.4 Slave device identification.......................................................................... 11
3.4.1 XCP Station Identifier................................................................................. 11
3.4.2 Transferring of XCP MAP filenames .......................................................... 12
3.5 Seed & Key ................................................................................................ 12
3.6 Checksum calculation ................................................................................ 13
3.7 Memory protection (XCP Professional only) .............................................. 14
3.8 Event Codes............................................................................................... 14
3.9 Service Request Messages (XCP Professional only) ................................ 14
3.10 User defined command .............................................................................. 15
3.11 Synchronous Data Transfer ....................................................................... 15
3.11.1 Synchronous data acquisition (DAQ) ......................................................... 15
3.11.2 DAQ timestamp.......................................................................................... 15
3.11.3 Power-up data transfer (XCP Professional only) ....................................... 15
3.11.4 Data stimulation (STIM) (XCP Professional only) ...................................... 16
3.11.5 Bypassing (XCP Professional only) ........................................................... 16
3.11.6 Data acquisition plug & play mechanisms.................................................. 16
3.11.7 Event channel plug & play mechanism ...................................................... 17
3.12 The online data calibration model .............................................................. 17
3.12.1 Page switching ........................................................................................... 17
3.12.2 Page switching plug & play mechanism..................................................... 17
3.12.3 Calibration data page freezing ................................................................... 17
3.12.4 Calibration data page copying.................................................................... 18
3.13 Flash Programming (XCP Professional only)............................................. 18
3.13.1 Flash Programming by the ECU’s application............................................ 18
3.13.1.1 Flash Programming plug & play mechanism.............................................. 18
3.13.2 Flash Programming with a flash kernel ...................................................... 19
3.14 EEPROM access (XCP Professional only) ................................................ 19
3.15 Parameter check ........................................................................................ 20
9 Limitations ................................................................................................................ 68
10 FAQ 70
10.1 Connection to MCS not possible................................................................ 70
11 Bibliography ............................................................................................................. 71
12 Contact 72
Illustrations
figure 4-1 Integration of XCP on CAN into the application.............................................. 22
figure 4-2 Integration of XCP with a proprietary XCP Transport Layer ........................... 23
2 Overview
This document describes the features, API, configuration and integration of the XCP
Protocol Layer. Both XCP versions: XCP Professional and XCP Basic are covered by this
document. Chapters that are only relevant for XCP Professional are marked.
This document does not cover the XCP on CAN Transport Layer. Please refer to [IV] for
further information about XCP on CAN and the integration of XCP on CAN with the Vector
CANbeddded software components.
Please also refer to “The Universal Measurement and Calibration Protocol Family”
specification by ASAM e.V.
The XCP Protocol Layer is a hardware independent protocol that can be ported to almost
any hardware. Due to there are numerous combinations of micro controllers, compilers
and memory models it cannot be guaranteed that it will run properly on any of the above
mentioned combinations.
Please note that in this document the term Application is not used strictly for the user
software but also for any higher software layer, like e.g. a Communication Control Layer.
Therefore, Application refers to any of the software components using XCP on CAN.
The API of the functions is described in a separate chapter at the end of this document.
Referred functions are always shown in the single channel mode.
Info
The source code of the XCP Protocol Layer, configuration examples and
documentation are available on the Internet at www.vector-informatik.de in a
functional restricted form.
Naming conventions
Xcp… It is mandatory to use all functions beginning with Xcp…
These services are called by either the data link layer or the application.
They are e.g. used for the initialization of the XCP Protocol Layer and for the
cyclic background task.
ApplXcp... The functions, starting with ApplXcp… are functions that are provided either by
any XCP Transport Layer or the application and are called by the XCP Protocol
Layer.
These services are user callback functions that are application specific and have
to be implemented depending on the application.
3 Functional description
has to verify a received key and if appropriate return the resource that shell be unlocked.
Annotation for the usage of CANape
The calculation of the key is done in a DLL named SEEDKEY1.DLL, which is developed
by the ECU manufacturer and which must be located in the EXEC directory of CANape.
CANape can access the ECU only if the ECU accepts the key. If the key is not valid, the
ECU is locked.
Example Implementation for SEEDKEY1.DLL
The function call of ASAP1A_XCP_ComputeKeyFromSeed() is standardized by the ASAM
committee.
Example
FILE SEEDKEY1.H
#ifndef _SEEDKEY_H_
#define _SEEDKEY_H_
#ifndef DllImport
#define DllImport __declspec(dllimport)
#endif
#ifndef DllExport
#define DllExport __declspec(dllexport)
#endif
#ifdef SEEDKEYAPI_IMPL
FILE SEEDKEY1.C
#include <windows.h>
#define SEEDKEYAPI_IMPL
#include "SeedKey1.h"
extern "C" {
BOOL SEEDKEYAPI ASAP1A_XCP_ComputeKeyFromSeed( BYTE *seed,
unsigned short sizeSeed,
BYTE *key,
unsigned short maxSizeKey,
unsigned short *sizeKey
)
{ // in that example sizeSeed == 4 is expected only
if( sizeSeed != 4 ) return FALSE;
if( maxSizeKey < 4 ) return FALSE;
*((unsigned long*)key) *= 3;
*((unsigned long*)key) &= 0x55555555;
*((unsigned long*)key) *= 5;
*sizeKey = 4;
return TRUE;
}
}
The slave and the master have to store all the necessary communication parameters for
the automatic data transfer after power-up. Therefore the following functions have to be
implemented in the slave.
vuint8 ApplXcpDaqResume ( tXcpData * xcpData ) (6.5.16)
vuint8 ApplXcpDaqResumeStore ( MEMORY_ROM tXcpData * xcpData ) (6.5.17)
vuint8 ApplXcpDaqResumeClear ( void ) (6.5.18)
To use the
resume mode the compiler switches XCP_ENBALE_DAQ and
XCP_ENABLE_RESUME_MODE have to be defined.
Annotation for the usage of CANape
Start the resume mode with the menu command Measurement|Start and push the button
“Measure offline” on the dialog box.
Also refer to chapter 7.9 (Configuration of the page switching plug & play mechanism) and
to the XCP Specification [II].
The page switching plug & play mechanism is enabled with the switch
XCP_ENBALE_PAGE_INFO.
The flash programming plug & play mechanism is enabled with the switch
XCP_ENABLE_PROGRAM_INFO.
vuint8 ApplXcpCheckWriteEEPROM
( MTABYTEPTR addr, vuint8 size, MEMORY_ROM BYTEPTR data ) (6.5.6)
checks whether EEPROM or RAM is accessed.
This chapter describes the steps for the integration of the XCP Protocol Layer into an
application environment of an ECU.
Additionally the following files are generated by the generation tool GENy. If no generation
tool or if CANgen is used the XPC Protocol Layer has to be customized manually. In this
case the following files will be available as template.
Files generated by GENy
XCP_CFG.H Configuration file for the XCP Protocol Layer.
V_INC.H General header for including the Vector CANbedded stack headers.
Note that all files of XCP Professional must not be changed manually!
XCP_PAR.C Template with parameter definitions for the XCP Protocol Layer.
It is just an example and has to be customized
XCP_PAR.H Template with external declarations for the parameters.
It is just an example and has to be customized
XCP on CAN
CAN Driver
(can_drv.c)
XcpCommand
XCP on CAN
Interface Layer ApplXcpSend
XcpSendCallback
(xcp_can.c)
XCP
Protocol Layer
XcpEvent
( XcpProf.c )
XcpInit
Application XcpBackground
ApplXcp..
XcpSendCallback
XCP
Application - XCPTransport Layer interface
Protocol Layer
XcpEvent
( XcpBasic.c )
XcpInit
Application XcpBackground
ApplXcp..
The transport layer driver has to notify the protocol layer after reception of a XCP protocol
message by calling the protocol layer function XcpCommand().
The protocol layer will use the function ApplXcpSend() of the transport layer to transmit a
command response message or a data acquisition message.
After the message has been transmitted successfully, the transport layer has to call the
function XcpSendCallBack() of the protocol layer to indicate this.
The functions XcpInit(), XcpEvent() and XcpBackground() are called from the ECU’s
application program.
The function ApplXcpGetPointer() is used by the protocol layer to convert a 32 Bit
address with an address extension to a valid pointer.
Depending on the optional features that can be enabled upon demand further application
callback functions are necessary. All application functions are indicated in “figure 4-2
Integration of XCP with a proprietary XCP Transport Layer” by their prefix ApplXcp….
Example
The following C pseudo code example shows the required software handshake between
the protocol layer and the transport layer. The example uses a simple transport layer
definition where the length of the protocol message is transmitted in the first byte of the
protocol packet:
/* Initialization */
XcpInit();
/* Main Loop */
for (;;) {
/* Packet received */
if (Message received) {
XcpCommand(&ReceiveBuffer[1]);
}
/* Background Processing */
XcpBackground();
}
/* Transmit Function */
void ApplXcpSend(vuint8 len, MEMORY_ROM BYTEPTR msg ) {
TransmitBuffer[0] = len; /* This is transport layer specific */
memcpy(&TransmitBuffer[1],msg,len);
Transmit(TransmitBuffer);
return 1;
}
/* Pointer Conversion */
MTABYTEPTR ApplXcpGetPointer( vuint8 addr_ext, vuint32 addr ) {
Return (BYTE*)addr;
}
5 Feature List
This general feature list describes the overall feature set of the XCP Protocol Layer. Not all
of these features are available in XCP Basic. Please also refer to 9.2 “Limitations of XCP
Basic”.
Description of the XCP functionality Version Functions
Initialization
Initialization Prof, Basic XcpInit
ApplXcpInit
Task
Background task Prof, Basic ApplXcpBackground
XcpBackground
XCP Command Processor
Command Processor Prof, Basic XcpCommand
Transmission and Confirmation of packets Prof, Basic ApplXcpSend
XcpSendCallback
Transmission of Response packets Prof, Basic XcpSendCrm
Transmission of packets Prof, Basic AppXcpSendStall
ApplXcpSendFlush
XCP Commands
Get MAP filenames Prof, Basic ApplXcpGetIdData
Seed & Key Prof, Basic ApplXcpGetSeed
ApplXcpUnlock
User command Prof, Basic ApplXcpUserService
Data Acquisition (DAQ)
Synchronous Data Acquisition and Stimulation Prof, Basic XcpEvent
DAQ Timestamp Prof, Basic ApplXcpGetTimestamp
Resume Mode Prof ApplXcpDaqResume
ApplXcpDaqResumeStore
ApplXcpDaqResumeClear
Online Data Calibration
Calibration page switching Prof, Basic ApplXcpGetCalPage
ApplXcpSetCalPage
Copy calibration page Prof, Basic ApplXcpCopyCalPage
Boot loader Download
Disable normal operation of ECU Prof ApplXcpDisableNormalOpera
tion
Start of the boot loader Prof ApplXcpStartBootLoader
Flash Programming
Reset of ECU Prof ApplXcpReset
Clear flash memory Prof ApplXcpFlashClear
The XCP Protocol Layer application programming interface consists of services, which are
realized by function calls. These services are called wherever they are required. They
transfer information to- or take over information from the XCP Protocol Layer. This
information is stored in the XCP Protocol Layer until it is not required anymore,
respectively until it is changed by other operations.
Examples for calling the services of the XCP Protocol Layer can be found in the
description of the services.
Example
Version 1.00.00 is registered as:
kCp_XcpMainVersion = 0x01;
kCp_XcpSubVersion = 0x00;
kCp_XcpReleaseVersion = 0x00;
These constants are declared as external and can be read by the application at any time.
Return code
- -
Functional Description
This services initializes the XCP Protocol Layer and its internal variables. It must be called from
the application program before any other XCP function is called.
Particularities and Limitations
This service function has to be called after the initialization of XCP Transport Layer.
The interrupts have to be disabled while this service function is called. This function should be called
during initialization of the ECU. Therefore the interrupt should have been enabled before.
Parameter
event Number of event channels to process
The event channel numbers have to start at 0 and have to be
continuous. The range is: 0..x
Return code
Parameter
event Event channel number
Functional Description
Check if a data stimulation (STIM) event can perform or delete the buffers.
Parameter
- -
Return code
vuint8 0 : background calculation finished
1 : background calculation is still in progress
Functional Description
If the XCP command for the calculation of the memory checksum has to be used for large memory
areas, it might not be appropriate to block the processor for a long period of time. Therefore, the
checksum calculation is divided into smaller sections that are handled in XcpBackground.
Therefore XcpBackground should be called periodically whenever the ECU’s CPU is idle.
Particularities and Limitations
The XCP Protocol Layer has been initialized correctly
Parameter
evc event code
Return code
- -
Functional Description
Transmission of event codes via event packets (EV).
Please refer to chapter 3.8 Event Codes.
Particularities and Limitations
The XCP Protocol Layer has been initialized correctly and XCP is in connected state.
Data acquisition has to be enabled: XCP_ENABLE_SEND_EVENT has to be defined
Parameter
c character that is put in a service request packet
Return code
- -
Functional Description
Put a char into a service request packet (SERV).
The service request packet is transmitted if either the maximum packet length is reached (the
service request message packet is full) or the character 0x00 is out in the service request packet.
Particularities and Limitations
The XCP Protocol Layer has been initialized correctly and XCP is in connected state.
The switch XCP_ENABLE_SERV_TEXT_PUTCHAR has to be defined
Single Channel
Single Receive Channel void XcpPrint ( MEMORY_ROM vuint8 *str )
Multi Channel
Indexed not supported
Parameter
str pointer to a string that is terminated by 0x00
Return code
- -
Functional Description
Transmission of a service request packet (SERV).
The string str is sent via service request packets. The string has to be terminated by 0x00.
Particularities and Limitations
The XCP Protocol Layer has been initialized correctly and XCP is in connected state.
The switch XCP_ENABLE_SERV_TEXT_PRINT has to be defined
Parameter
str pointer to a string that is terminated by 0x00
Return code
- -
Functional Description
If the XCP slave is connected to a XCP master a call of this function discontinues the connection
(transition to disconnected state). If the XCP slave is not connected this function performs no
action.
Particularities and Limitations
The XCP Protocol Layer has been initialized correctly and XCP is in connected state.
Parameter
- -
Return code
- -
Functional Description
Transmission of a command response packet (RES), or error packet (ERR) if no other packet is
pending.
Particularities and Limitations
The XCP Protocol Layer has been initialized correctly, XCP is in connected state an a command packet
(CMD) has been received..
6.3 XCP Protocol Layer functions, called by the XCP Transport Layer
For using the following functions there are some limitations which have to be taken into
consideration – especially when using an operation system like, i.e. OSEK OS:
The ISR level for the transmission and reception of CAN messages has to be the same.
Interrupts must be mutually
No nested calls of these functions are allowed
All functions provided by the application must match the required interfaces. This can be
ensured by including the header file in the modules which provide the required functions. If
these interfaces do not match unexpected run-time behavior may occur.
Parameter
pCommand pointer to the XCP protocol message, which must be extracted from
the XCP protocol packet.
Return code
- -
Functional Description
Every time the XCP Transport Layer receives a XCP packet this function has to be called.
The parameter is a pointer to the XCP protocol message, which must be extracted from the XCP
protocol packet.
Particularities and Limitations
The XCP Protocol Layer has to be initialized correctly.
Parameter
- -
Return code
vuint8 0 : if the XCP Protocol Layer is idle (no transmit messages are
pending)
Functional Description
The XCP Protocol Layer does not call ApplXcpSend again, until XcpSendCallBack has confirmed
the successful transmission of the previous message. XcpSendCallBack transmits pending data
acquisition messages by calling ApplXcpSend again.
Note that if XcpSendCallBack is called from inside ApplXcpSend a recursion occurs, which
assumes enough space on the call stack.
Particularities and Limitations
The XCP Protocol Layer has been initialized correctly.
6.4 XCP Transport Layer services called by the XCP Protocol Layer
The prototypes of the functions that are required by the XCP Protocol Layer can be found in the
component’s header.
Parameter
len Length of message data
Return code
vuint8 0 : if the XCP Protocol Layer is idle (no transmit messages are
pending)
Functional Description
Requests for the transmission of a command transfer object (CTO) or data transfer object (DTO).
XcpSendCallBack must be called after the successful transmission of any XCP message. The
XCP Protocol Layer will not request further transmissions, until XcpSendCallBack has been
called.
Particularities and Limitations
ApplXcpSend is not defined as macro
Parameter
- -
Return code
- -
Functional Description
Initializations of the XCP Transport Layer.
In the XCP on CAN implementation by Vector is this function required if no transmit queue is
used.
Particularities and Limitations
ApplXcpInit is not defined as macro
Parameter
- -
Return code
- -
Functional Description
Performs background operations of the XCP Transport Layer.
In the XCP on CAN implementation by Vector is this function required if no transmit queue is
used.
Particularities and Limitations
ApplXcpBackground is not defined as macro
Parameter
- -
Return code
- -
Functional Description
Enabling of the global interrupts.
Parameter
- -
Return code
- -
Functional Description
Disabling of the global interrupts.
Parameter
addr_ext 8 bit address extension
Return code
MTABYTEPTR Pointer to the address specified by the parameters
Functional Description
This function converts a memory address from XCP format (32-bit address plus 8-bit address
extension) to a C style pointer. An MCS like CANape usually reads this memory addresses from
the ASAP2 database or from a linker map file.
The address extension may be used to distinguish different address spaces or memory types. In
most cases, the address extension is not used and may be ignored.
This function is used for memory transfers like DOWNLOAD and UPLOAD.
Example:
The following code shows an example of a typical implementation of ApplXcpGetPointer:
MTABYTEPTR ApplXcpGetPointer( vuint8 addr_ext, vuint32 addr )
{
return (MTABYTEPTR)addr;
}
Particularities and Limitations
XCP is initialized correctly and in connected state
This function can be overwritten by defining ApplXcpGetPointer as macro.
Parameter
pData Returns a pointer to a pointer of MAP file names
Return code
vuint32 length of the MAP file names
Functional Description
Returns a pointer to a pointer of MAP file names.
Refer to chapter 3.4.2 (Transferring of XCP MAP filenames).
Particularities and Limitations
XCP is initialized correctly and in connected state
The switch XCP_ENABLE_VECTOR_MAPNAMES has to be defined
Parameter
resource Resource for which the seed has to be generated
XCP Professional and XPC Basic
RM_CAL_PAG : to unlock the resource calibration/paging
RM_DAQ : to unlock the resource data acquisition
XCP Professional only
RM_STIM : to unlock the resource stimulation
RM_PGM : to unlock the resource programming
Return code
vuint8 The length of the generated seed that is returned by seed.
Functional Description
Generate a seed for the appropriate resource.
The seed has a maximum length of MAX_CTO-2 bytes.
Particularities and Limitations
XCP is initialized correctly and in connected state
The switch XCP_ENABLE_SEED_KEY has to be defined
Parameter
key Pointer to the key.
Return code
vuint8 XCP Professional and XPC Basic
0: if the key is not valid
RM_CAL_PAG : to unlock the resource calibration/paging
RM_DAQ : to unlock the resource data acquisition
XCP Professional only
RM_STIM : to unlock the resource stimulation
RM_PGM : to unlock the resource programming
Functional Description
Check the key and return the resource that has to be unlocked.
Only one resource may be unlocked at one time.
Particularities and Limitations
XCP is initialized correctly and in connected state
The switch XCP_ENABLE_SEED_KEY has to be defined
Parameter
addr Address that is checked
Parameter
addr Address that is checked
Parameter
address address
Return code
vuint8 0 : if access is denied
>= 1 : if access is granted
Functional Description
Check addresses for valid write access. A write access is enabled with the
XCP_ENABLE_WRITE_PROTECTION, it should be only used, if write protection of memory areas is
required
Particularities and Limitations
Parameter
pCmd Pointer to XCP command packet
Return code
vuint8 XCP_CMD_OK : positive response
XCP_CMD_PENDING : no response
XCP_CMD_SYNTAX : negative response
Functional Description
Application specific user command.
Please refer to 3.10 User defined command.
Particularities and Limitations
XCP is initialized correctly and in connected state
The switch XCP_ENABLE_USER_COMMAND has to be defined
Parameter
- -
Return code
vuint8 0: if not succesful
> 0 : successful
Functional Description
Resolve a transmit stall condition in XcpPutchar or XcpSendEvent.
Particularities and Limitations
XCP is initialized correctly and in connected state
The switch XCP_ENABLE_SEND_EVENT or XCP_ENABLE_SERV_TEXT_PUTCHAR and
XCP_ENABLE_SEND_QUEUE are defined
The function can be overwritten by the macro ApplXcpSendStall()
Parameter
- -
Return code
- -
Functional Description
Flush the transmit buffer if there is one implemented in ApplXcpSend.
This function can be overwritten by a macro.
Particularities and Limitations
The function can be overwritten by the macro ApplXcpSendStall()
Parameter
a Address (where the flash kernel is downloaded to)
Return code
vuint8 XCP_CMD_OK : download of flash kernel confirmed
XCP_CMD_DENIED : download of flash kernel refused
Functional Description
Prior to the flash kernel download has the ECU’s normal operation to be stopped in order to
avoid misbehavior due to data inconsistencies.
Particularities and Limitations
XCP is initialized correctly and in connected state
The switch XCP_ENABLE_BOOTLOADER_DOWNLAOD has to be defined
Parameter
- -
Return code
vuint8 This function should not return.
0 : negative response
> 0 : positive response
Functional Description
Start of the boot loader.
Parameter
- -
Return code
- -
Functional Description
Perform an ECU reset after reprogramming of the application.
Parameter
address Address
size Size
Return code
vuint8 XCP_CMD_OK : Flash memory erase done
XCP_CMD_ERROR : Flash memory erase error
Functional Description
Clear the flash memory, before the flash memory will be reprogrammed.
Parameter
data Pointer to data
address Address
size Size
Return code
vuint8 XCP_CMD_OK : Flash memory programming finished
XCP_CMD_PENDING : Flash memory programming in progress.
XcpSendCrm has to be called when done.
Functional Description
Program the cleared flash memory.
Multi Channel
Indexed not supported
Parameter
xcpData Pointer to internal data of the XCP Protocol Layer
Return code
vuin8 0 : failed
>0 : Ok
Functional Description
Resume the automatic data transfer.
All communication parameters that had been stored have to be restored.
Particularities and Limitations
XCP is initialized correctly and in connected state
The switches XCP_ENABLE_DAQ and XCP_ENABLE_DAQ_RESUME are defined
Parameter
xcpData Pointer to internal data of the XCP Protocol Layer
Return code
vuin8 0 : failed
>0 : Ok
Functional Description
Store DAQ lists for DAQ resume mode.
Parameter
- -
Return code
vuin8 0 : failed
>0 : Ok
Functional Description
Clear DAQ lists that are stored during resume mode.
Parameter
- -
Return code
XcpDaqTimestampType timestamp
Functional Description
Returns the current timestamp.
Parameter
segment Logical data segment number
Parameter
Parameter
srcSeg Source segment
Return code
vuint8 0: Ok
CRC_PAGE_NOT_VALID : Page not available
CRC_SEGMENT_NOT_VALID : Segment not available
CRC_SEGMENT_NOT_VALID : Destination page is write protected.
Functional Description
Copying of calibration data pages.
The pages are copied from source to destination.
Particularities and Limitations
XCP is initialized correctly and in connected state
The switches XCP_ENABLE_PAGE_COPY is defined
Parameter
dest pointer to destination address
Return code
- -
Functional Description
General memcopy function that copies a memory range from source to destination.
This function is used in the inner loop of XcpEvent for data acquisition sampling.
This function is already defined in the XCP Protocol Layer, but can be overwritten by a macro or
function for optimization purposes. E.g. it would be possible to use DMA for faster execution.
Particularities and Limitations
The XCP Protocol Layer has been initialized correctly.
This function can be overwritten XcpMemCpy is defined.
Parameter
p pointer to start address
Return code
- -
Functional Description
Initialization of n bytes starting from address p with b.
This function is already defined in the XCP Protocol Layer, but can be overwritten by a macro or
function for optimization purposes. E.g. it would be possible to use DMA for faster execution.
Particularities and Limitations
The XCP Protocol Layer has been initialized correctly.
This function can be overwritten XcpMemSet is defined.
Parameter
p pointer to start address
Return code
- -
Functional Description
Initialize n data bytes starting from address p with 0x00.
This function is already defined in the XCP Protocol Layer, but can be overwritten by a macro or
function for optimization purposes. E.g. it would be possible to use DMA for faster execution.
Particularities and Limitations
The XCP Protocol Layer has been initialized correctly.
This function can be overwritten XcpMemClr is defined.
Parameter
dto pointer to data transfer object
Return code
- -
Functional Description
Transmit a data transfer object (DTO).
This chapter describes the common options for configuring (customizing) the XCP Protocol
Layer. Please note that the XCP Protocol Layer can comfortably be configured with GENy.
In this case no manual configuration has to be applied to the configuration files. Therefore
the following description is mainly applicable for the configuration of XCP Basic.
The configuration of the configuration switches and constants is done in the file
XCP_CFG.H. An example that contains the default configuration of XCP Basic is
distributed together with XCP Basic. It is recommended to use this example as a template
for the individual configuration.
1
The XCP Protocol allows three identification field types for DTOs: ‘absolute ODT number’, ‘relative ODT
number and absolute DAQ list number’, ‘empty identification field’ (not supported)
The following table contains an additional list of all configuration switches, used to control
the functional units that are only available in XCP Professional. The default values are
bold.
Configuration switches Value Description
XCP_xxx_BLOCK_UPLOAD ENABLE, Enables/disables the slave block transfer.
DISABLE
XCP_xxx_BLOCK_DOWNLOAD ENABLE, Enables/disables the master block transfer.
DISABLE
XCP_xxx_WRITE_PROTECTION ENABLE, Write access to RAM
DISABLE
XCP_xxx_READ_EEPROM ENABLE, Read access to EEPROM
DISABLE
XCP_xxx_WRITE_EEPROM ENABLE, Write access to EEPROM
DISABLE
XCP_xxx_PROGRAM ENABLE, Flash programming
DISABLE
XCP_xxx_PROGRAM_INFO ENABLE, Flash programming plug & play mechanism
DISABLE
XCP_xxx_BOOTLOADER_DOWNLOAD ENABLE, Flash programming with a flash kernel
DISABLE
XCP_xxx_STIM ENABLE, Enables/disables data stimulation.
DISABLE
(also XCP_ENABLE_DAQ has to be defined in order to
use data stimulation)
XCP_xxx_DAQ_RESUME ENABLE, Data acquisition resume mode.
DISABLE
XCP_xxx_SERV_TEXT ENABLE, Transmission of service request codes
DISABLE
XCP_xxx_SERV_TEXT_PUTCHAR ENABLE, Putchar function for the transmission of service
DISABLE
request messages
XCP_xxx_SERV_TEXT_PRINTF ENABLE, Print function for the transmission of service
DISABLE
request messages
The following table contains an additional list of all configuration switches, used to control
the functional units that are only available in XCP basic. The default values are bold.
Configuration switches Value Description
XCP_ENABLE_TESTMODE ENABLE, Test mode that allows the output of debugging
DISABLE
information.
Not included in XCP Professional due to multiple MISRA
rule violations!
2
Implementation specific range. The range is 8..0xFFFF according to XCP specification [I], [II].
3
Implementation specific range. The range is 0..0xFFFE according to XCP specification [I], [II].
4
Implementation specific range. The range is 0..0xFFFE according to XCP specification [I], [II].
Example:
#define XCP_ENABLE_DAQ_EVENT_INFO
#define kXcpMaxEvent 3
Example
#define XCP_ENABLE_PROGRAM_INFO
#define kXcpMaxSector 2
8 Resource Requirements
The resource requirements of the XCP Protocol Layer mainly depends on the micro
controller, compiler options and configuration. Within this chapter only the configuration
specific resource requirements are taken in consideration.
9 Limitations
10 FAQ
FAQ
After integration of XCP on CAN or integration of XCP Basic with a proprietary
CAN-Driver does the MCS (e.g. CANape) not connect with the XCP slave, even
though the CAN communication is working properly.
The XCP protocol allows to transmit XCP packets with a variable data length. However
many OEMs require that all CAN messages sent within their automotive networks have to
have a static DLC. Therefore messages sent by the MCS with a DLC of less than 8 (e.g.
CONNECT has a DLC of 2) might be discarded by the ECU’s CAN-Driver and the
connection is not possible.
Check whether your MCS supports transmission with static DLC. This is supported by
CANape 5.5.
11 Bibliography
12 Contact
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector-informatik.com