UserManual_CANdescs









 
 
 
 
 
 
 
 
 

User Manual 
 
  CANdesc  
 
  A Step by Step Introduction
Version 1.7 
 
  English 
 
 
 
 

 
 
 
Impressum 
 
Vector Informatik GmbH 
Ingersheimer Straße 24 
D-70499 Stuttgart 
 
 
The information and data given in this user manual can be changed without prior notice. No part of this manual may be reproduced in 
any form or by any means without the written permission of the publisher, regardless of which method or which instruments, electronic 
or mechanical, are used. All technical information, drafts, etc. are liable to law of copyright protection. 
 © Copyright 2009, Vector Informatik GmbH  
All rights reserved. 
 

User Manual CANdesc  
Manual Information 
Manual History 
Author 
Date 
Version 
Details 
Klaus Emmert 
2004-05-10 
1.1 
Vector symbols included, template 
version 1.8 used (this history 
included), AppDesc… changed to 
ApplDesc due to software 
modifications, description of GENy 
as generation tool added, testing of 
diagnostics layer described with 
CANoe demo configuration, further 
Information about diagnostic buffer 
(linear and ring buffer mechanism) 
and the repeated service call 
feature 
Klaus Emmert 
2004-10-15 
1.2 
Modifications after Review. 
Klaus Emmert 
2005-08-12 
1.3 
Two new functions: 
DescTimerTask(), 
DescStateTask().  
These two functions can be used 
instead of DescTask to handle the 
timers and the application 
separately. 
Klaus Emmert 
2006-03-24 
1.4 
Issues in example code fixed 
Document overview added 
Oliver Garnatz 
2007-01-12 
1.5 
Added description of 
CANdesc_ConnectorCAN GENy 
component 
Klaus Emmert 
2008-01-28 
1.6 
References fixed 
Manuela Scheufele 
2009-07-27 
1.7 
(see section Version 1.7 on page 
66)  
 
 
Reference Documents 
No. 
Source 
Title 
[1] 
Vector Informatik  Technical Reference CANdesc 
[2] 
Vector Informatik  Technical Reference CANdescBasic 
  
 
© Vector Informatik GmbH 
Version 1.7 
- 3 - 

Manual Information 
User Manual CANdesc 
Inhaltsverzeichnis 
1 
Manual Information 
6 
1.1 
About this user manual 

1.1.1 
Certification 

1.1.2 
Warranty 

1.1.3 
Registered trademarks 

1.1.4 
Errata Sheet of manufacturers 

2 
Getting Started 
9 
2.1 
How to use this Manual 
10 
3 
Basic Information 11 
3.1 
An Overall View 
12 
3.2 
What is Diagnostic 
13 
3.3 
What happens during Diagnostics? 13 
3.4 
What is CANdesc? 
14 
3.5 
Tools and Files 
14 
3.5.1 
CANdela Studio, CDDT, CDD 14 
3.5.2 
Generation Tool, CDD, DBC 14 
3.5.3 
Generation Process with CANbedded Software Components 15 
3.6 
What CANdesc does 
15 
3.7 
Diagnostics – a more detailed View 17 
3.7.1 
Basic Nomenclature from the Bottom Up 18 
3.7.2 
The same Nomenclature from the Top Down 19 
3.7.3 
Where to find this Nomenclature in CANdela Studio 19 
3.7.4 
Generic Handling of a Diagnostic Request in the CANdesc Component 21 
3.7.5 
User, None, OEM, Generated – what does this mean? 23 
4 
A Few STEPS to CANdesc 24 
4.1 
STEP What do you need before start? 25 
4.2 
Startup Code 
25 
4.3 
Overview 
25 
4.4 
STEP Installation 
26 
4.5 
STEP Configuration with the Generation Tool 26 
4.5.1 

Using the Generation Tool CANgen 26 
4.5.2 
Using the Generation Tool GENy 27 
4.6 
STEP Generating Files 
29 
4.6.1 
Using Generation Tool CANgen 29 
4.6.2 
Using the Generation Tool GENy 32 
4.7 
STEP Add CANbedded to your Project 32 
4.8 
STEP Adapt Your Application Files 33 
4.8.1 

Including, Initializing and Cyclic Calling 33 
4.9 
STEP Functional Connection between your Application and CANdesc/CANdela Studio 35 
4.9.1 

How to handle User-Defined Handlers 35 
4.9.2 
How to Handle Predefined Handlers (for MainHandler only) 38 
4.9.3 
Handling OEM-Specific Settings 40 
- 4 - 
Version 1.7 
© Vector Informatik GmbH 

User Manual CANdesc  
Manual Information 
4.10 
STEP Compile and link your Project 41 
4.11 
STEP Test it via CANoe 41 
4.11.1 

Start CANoe.CAN OSEK TP enlarged 41 
4.11.2 
Test of CANdesc 42 
5 
Further Information 44 
5.1 
Diagnostic State Handling using CANdela Studio 45 
5.2 
Typical Examples of State Groups and States in an Automotive Environment 45 
5.3 
Creating and editing State Groups, States and Transitions 45 
5.4 
Connection between the states and your application 47 
5.5 
Diagnostic Buffer 
48 
5.5.1 
Linear Diagnostic Buffer 48 
5.5.2 
Ring Buffer Mechanism 49 
5.5.2.1 
Activation of the Ring Buffer 51 
5.5.2.2 
Main Control Functions for the Ring Buffer Mechanism 51 
5.5.2.3 
Examples for Ring Buffer Mechanism 52 
5.6 
Repeated Service Call Feature 55 
5.6.1 

Activation of the Repeated Service Call 55 
5.6.2 
Repeated Service Call and Ring Buffer 1 – “Write and Check” 56 
5.6.3 
Repeated Service Call and Ring Buffer 2 – “Check and Write” 57 
6 
Additional Information 58 
6.1 
Persistors 
59 
6.1.1 
Update Persistors – Install current Version 60 
7 
FAQs 
63 
7.1 
Introduction 
64 
7.2 
Frequently Asked Questions 64 
8 
What’s new, what’s changed 65 
8.1 
Version 1.7 
66 
8.1.1 
What’s new 
66 
8.1.2 
What’s changed 66 
9 
Address table 67 
10 
Glossar 69 
11 
Index 
70 
 
© Vector Informatik GmbH 
Version 1.7 
- 5 - 

Manual Information 
User Manual CANdesc 
1 Manual 
Information 
In this chapter you find the following information: 
1.1 
About this user manual  
page 
7
 
Certification 
 
Warranty 
 
Registered trademarks 
 
Errata Sheet of manufacturers 
  
 
- 6 - 
Version 1.7 
© Vector Informatik GmbH 








User Manual CANdesc  
Manual Information 
1.1 
About this user manual 
Finding information 
The user manual provides the following access help: 
quickly 
¼  At the beginning of each chapter you will find a summary of the contents, 
¼  In the header you can see in which chapter and paragraph you are, 
¼  In the footer you can see to which version the user manual replies, 
¼  At the end of the user manual you will find an index, with whose help you will 
quickly find information, 
¼  Also at the end of the user manual you will find a glossary in which you can look 
up an explanation of used technical terms 
  
Conventions 
In the two following charts you will find the conventions used in the user manual 
regarding utilized spellings and symbols. 
  
 
Style 
Utilization 
 
bold 
Blocks, surface elements, window- and dialog names of the 
software. Accentuation of warnings and advices. 
[OK] 
 
Push buttons in brackets 
File|Save 
Notation for menus and menu entries 
 
MICROSAR 
Legally protected proper names and side notes. 
 
Source Code 
File name and source code. 
 
Hyperlink 
Hyperlinks and references. 
 
<CTRL>+<S> Notation 
for 
shortcuts. 
  
 
Symbol 
Utilization 
 
Here you can obtain supplemental information. 
 
 
This symbol calls your attention to warnings. 
 
 
Here you can find additional information. 
 
 
Here is an example that has been prepared for you. 
 
 
Step-by-step instructions provide assistance at these points. 
 
 
Instructions on editing files are found at these points. 
 
 
 
This symbol warns you not to edit the specified file. 
 
  
© Vector Informatik GmbH 
Version 1.7 
- 7 - 



Manual Information 
User Manual CANdesc 
1.1.1  Certification 
Certified Quality 
Vector Informatik GmbH has ISO 9001:2000 certification. The ISO standard is a 
Management System  globally recognized standard. 
  
Spice Level 3 
The Embedded Software Components business area at Vector Informatik GmbH 
achieved process maturity level 3 during a HIS-conformant assessment. 
  
1.1.2  Warranty 
Restriction of 
We reserve the right to change the contents of the documentation and the software 
warranty 
without notice. Vector Informatik GmbH assumes no liability for correct contents or 
damages which are resulted from the usage of the documentation. We are grateful for 
 
references to mistakes or for suggestions for improvement to be able to offer you 
even more efficient products in the future. 
  
1.1.3  Registered trademarks 
Registered 
All trademarks mentioned in this documentation and if necessary third party 
trademarks 
registered are absolutely subject to the conditions of each valid label right and the 
rights of particular registered proprietor. All trademarks, trade names or company 
 
names are or can be trademarks or registered trademarks of their particular 
proprietors. All rights which are not expressly allowed are reserved. If an explicit label 
of trademarks, which are used in this documentation, fails, should not mean that a 
name is free of third party rights. 
 
¼ Outlook, Windows, Windows XP, Windows 2000, Windows NT, Visual Studio are 
trademarks of the Microsoft Corporation. 
  
1.1.4  Errata Sheet of manufacturers 
Caution: Vector only delivers software!  
 
Your hardware manufacturer will provide you with the necessary errata sheets 
concerning your used hardware. In case of errata dealing with CAN please provide us 
the relevant erratas and we will figure out whether this hardware problem is already 
known to us or whether to get a possible workaround.  
 
Info: Because of many NDAs with different hardware manufacturers or because we 
are not informed about, we are not able to provide you with information concerning 
 
hardware errata of the hardware manufacturers.  
 
 
- 8 - 
Version 1.7 
© Vector Informatik GmbH 

User Manual CANdesc  
Getting Started 
2 Getting 
Started 
In this chapter you find the following information: 
2.1 
How to use this Manual  
page 
10
  
 
© Vector Informatik GmbH 
Version 1.7 
- 9 - 

Getting Started 
User Manual CANdesc 
2.1 
How to use this Manual 
 
Just follow the description step by step. 
  
 
FAQ
To find answers to special questions without reading the whole document use the 
FAQ list (see section FAQs on page 63). 
  
- 10 - 
Version 1.7 
© Vector Informatik GmbH 

User Manual CANdesc  
Basic Information 
3 Basic 
Information 
In this chapter you find the following information: 
3.2 
What is Diagnostic 
 
 page 13
3.3 
What happens during Diagnostics?  
page 
13
3.4 
What is CANdesc? 
 page 14
3.5 
Tools and Files 
 page 14
 
CANdela Studio, CDDT, CDD 
 
Generation Tool, CDD, DBC 
 
Generation Process with CANbedded Software Components 
3.6 
What CANdesc does  
page 
15
3.7 
Diagnostics – a more detailed View  
page 
17
 
Basic Nomenclature from the Bottom Up 
 
The same Nomenclature from the Top Down 
 
Where to find this Nomenclature in CANdela Studio 
 
Generic Handling of a Diagnostic Request in the CANdesc Component 
 
User, None, OEM, Generated – what does this mean? 
  
© Vector Informatik GmbH 
Version 1.7 
- 11 - 



Basic Information 
User Manual CANdesc 
3.1 
An Overall View 
ECU in the focus 
What we are now talking about is an ECU, a module to be built-in a vehicle like 
shown in the figure below. Almost every ECU participates in a certain bus system like 
x
e.g. CAN, Fle Ray or LIN. 
  
 
Vehicle with different bus systems
‰
CAN Highspeed
‰
CAN Lowspeed
‰
LIN
‰
FlexRay
‰
MOST
  
 
So any ECU within one bus system has to provide an identical interface to this bus 
system because all ECUs have to share information via this bus system as you see in 
the figure below. 
 
CAN Lowspeed as 
an example bus 
system 
 
  
 
For that reason all ECUs are built-up in the same way. There is a software part to 
realize the main job (application) of this ECU e.g. to control the engine or a door. The 
other part is the software part to be able to communicate with the other ECUs via the 
bus system that is the communication software. 
  
- 12 - 
Version 1.7 
© Vector Informatik GmbH 



User Manual CANdesc  
Basic Information 
 
Application Software
Software for Network 
Communication and Diagnostics
 
 
 
3.2 
What is Diagnostic 
Dia'gno stics - 
Diagnostics in a technical context is the examination of a machine. But diagnostics in 
Detection, 
this context goes way beyond this definition.  
Examination of a 
Diagnostics comprises function monitoring, error detection, fault memory, activation, 
machine; 
data acquisition etc. and is used for variant coding, end-of-line programming, 
[greek. diagnoskein 
reprogramming, identification etc. 
„analyze deeply, 
differentiate] 
In contrast to Dia’gno 
‚ sis – Examination 
(med.) 
 
  
3.3 
What happens during Diagnostics? 
 
In most cases an Off-Board tester (Client) sends a diagnostic request to the ECU (via 
CAN) and the ECU (Server) sends back a diagnostic response. This can be a positive 
or a negative response. The following figure clearly shows a basic representation of 
this mechanism. 
  
CANdesc –  
CAN Diagnostic 
Embedded Software 
Component 
 
  
© Vector Informatik GmbH 
Version 1.7 
- 13 - 



Basic Information 
User Manual CANdesc 
3.4 
What is CANdesc? 
CANdesc is totally 
CANdesc stands for CAN Diagnostic Embedded Software Component.  
generated based 
This software component differs from all other CANbedded Software Components in 
upon the CDD file. 
that it is totally generated. To be able to generate this component you need a CDD 
 
file, a DBC file and the generation tool (GENy / CANgen). 
  
Generated Software 
Component based 
on .CDD and .DBC 
 
  
Info: The CANdesc will be explained in the section Generic Handling of a Diagnostic 
Request in the CANdesc Component on page 21, where you will get detailed insight 
 
into the CANdesc Component and how it works when processing a diagnostic 
request. 
  
3.5 
Tools and Files 
3.5.1  CANdela Studio, CDDT, CDD 
All settings you have  CANdela Studio is a PC tool. It reads in the diagnostic template file CDDT and 
ela 
to do in CANd
generates a diagnostic data base, the CDD file. 
Studio to use 
The CDDT is a description of the OEM diagnostic specification. 
CANdesc are stored 
in the CDD file. 
All necessary diagnostic information, such as supported diagnostic services, sub 
services, format, signals, state filters, state transitions etc., is described via CANdela 
Studio and stored in the CDD file. 
To use the CANdesc component, you need the CDD file and you need to know how 
to make the necessary settings in CANdela Studio. 
  
3.5.2  Generation Tool, CDD, DBC 
Remember to add 
The generation tool (GENy / CANgen) is a PC Tool, too. It generates configuration 
the path to the CDD 
files and signal interface files for the CANbedded Software Components. The 
file in the Generation  generation tool needs the DBC file to generate the files. 
ol 
To
 
 
The DBC file is designed by the vehicle manufacturer and distributed to all suppliers 
that develop an ECU. Thus every supplier uses the SAME DBC file for one vehicle 
There is the same 
platform and one bus system (powertrain, body CAN etc.) to guarantee a common 
DBC file per bus 
- 14 - 
Version 1.7 
© Vector Informatik GmbH 


User Manual CANdesc  
Basic Information 
system (high speed, 
basis for development. 
low speed, etc) for all  For example, every ECU has to know that a 1 in bit 7 in the 4th byte of the message 
suppliers to 
0x305 means “Ignition Key” on/off. 
guarantee a 

commo
The DBC file contains information about every node and the messages / sig
s the 
nal
basis for 
node has to send and to receive. 
development 
When using CANdesc for diagnostics the CDD file must be read in by the generation 
tool, to be able to generate the CANdesc code. 
  
3.5.3 
n Process w
Generatio
ith CANbedded Software Components 
 
Normally the generation tool generates files that contain the configuration and the 
signal interface of the CANbedded Software Components. CANbedded can be 
compiled and linked using the source code of each component. 
  
The standard 
generation process 
for Vector Software 
Components. 
 
 
 
 
 
 
 
CANdesc is a 
completely 
generated Software 
Component 
 
  
 
The main difference for CANdesc is that the source code for CANdesc is totally 
generated from the CDD file and therefore not included in your delivery as the other 
software components are. Since the CDD file contains most of the information about 
CANdesc, there are only a few configuration settings left that can be done via the 
generation tool on the CANdesc tab 
  
3.6 
What CANdesc does 
Handles Diagnostic 
¼  CANdesc receives addressed requests physically or/and functionally 
Communication 
¼  CANdesc generates and handles a physical or functional request with appropriate 
response message headers, corresponding to the given KWP2000/UDS (ISO 
14229-1) Diagnostics on CAN manufacturer specification. 
¼  CANdesc connects to underlying Transport Protocol and handles the 
communication errors of the underlying layers. 
© Vector Informatik GmbH 
Version 1.7 
- 15 - 

Basic Information 
User Manual CANdesc 
¼  CANdesc is capable of communication on any bus systems, using an own 
abstraction interface. 
  
Manages Diagnostic  ¼  CANdesc keeps the data consistency, which guarantees that no other request will 
Data (Buffer) 
delete the current diagnostic request data being processed. 
  
dle
Han
s Diagnostic 
¼  CANdesc prrovides centralized diagnostic error handling based on the method 
Errors 
report only first detected error
¼  CANdesc monitors timeouts (e.g. S3- “Tester Present”, P2- “Response pending”, 
etc.). 
  
Analyzes Requests 
¼  CANdesc detects relevant SID (Service Identifier) for the ECU. If an SID is not 
(state machine, 
supported by the current configuration, the appropriate reaction will be executed 
filtering) 
(e.g. negative response or the request will be ignored). 
¼  CANdesc analyzes the service instance. This includes recognition of the service-
specific sub functions for each supported SID. The request length is validated if it 
is defined to be constant. For dynamic fields, the application must do range 
checking of the request length. 
¼  CANdesc validates the states. The component ensures that a service is only 
executed if the diagnostic state allows the processing of that service. E. g. some 
services are only allowed to be executed inside a special diagnostic session. If 
the current state does not allow the execution, a corresponding negative 
response is sent automatically. 
  
Processes the 
¼  CANdesc generates a complete diagnostic handler function which fills out the 
request (optional) 
correct response data for the application. 
¼  CANdesc generates signal handlers to help the application place the response 
information. 
¼  CANdesc generates a Service MainHandler which will use data access functions 
provided by the application, but will place the information on the message as 
defined in the diagnostic data description. 
¼  CANdesc dispatches incoming request(s) to the application (Service MainHandler 
or signal handler level). 
  
- 16 - 
Version 1.7 
© Vector Informatik GmbH 

User Manual CANdesc  
Basic Information 
3.7 
Diagnostics – a more detailed View 
 this chapter 
In
you find the following information: 
3.7.1  Basic Nomenclature from the Bottom Up
 
  page 
18
3.7.2  The same Nomenclature from the Top Down  
page 
19
3.7.3  Where to find this Nomenclature in CANdela Studio  
page 
19
3.7.4  Generic Handling of a Diagnostic Request in the CANdesc Component  
page 
21
3.7.5  User, None, OEM, Generated – what does this mean?  
page 
23
  
 
© Vector Informatik GmbH 
Version 1.7 
- 17 - 



Basic Information 
User Manual CANdesc 
3.7.1  Basic Nomenclature from the Bottom Up 
Using the same 
Basic diagnostic communication is based upon a request / response mechanism. To 
expressions does not  understand the structure of 
ela Stu
CANd
dio it is necessary to make some detailed 
mean to talk about 
naming definitions. 
the same thing 
The combin
e
ation of a requ st and responses (positive and negative) forms a Service, 
 
as you can see in the figure below. A service (in the scope of CANdesc) is a concrete 
service of an ECU. 
This nomenclature 
should help to 
Request and responses are so-called service primitives. 
proceed with 
CANdesc and 
CANdela. 
  
Service Identifier = 
ID 
S
 
Build-up of Requests 
and Response 
Messages 
 
  
Service 
protocol service is a pattern for a service. The protocol service defines how the 
service primitives have to be built up. It determines the number and meaning of bytes 
Protocol Service 
for the sub service, and specifies the data bytes. 
Request 
Response 
Diagnostic Instance 
Diagnostic Class   
  
Info: The order of service identifier, sub service and data bytes can be found at the 
byte stream level, too. 
 
  
Request 
A request is a service primitive and is created as shown in figure above. A request is 
always sent from a tester to an ECU. The ECU processes the request and has to 
send back a response message. 
  
Response  
The positive response is calculated very easily by just adding the value 0x40 (hex 
format) to the SID of the request. The sub service is just repeated from the request 
 
and the data depends on the service. 
The negative response always starts with 0x7F as the SID followed by the SID of the 
request. The error code shows the reason for the negative response (e.g. wrong 
format of the request, …). 
  
 
Services with the same sub service (similar functional scope) are combined into the 
same Diagnostic Instance. This sub service is the characteristic factor for the 
- 18 - 
Version 1.7 
© Vector Informatik GmbH 

User Manual CANdesc  
Basic Information 
diagnostic instance. 
A diagnostic instance is a part of a 
nostic cla
diag
ss.  
A diagnostic class is the abstract description of a use case. 
This is shown in the following two illustrations. 
  
Services
 
 with the
Diagnostic Instance
ame Su
s
bservice are 
ned int
combi
o a 
Service 4
Diagnostic Instance - 
Service 3
the Sub Func

tio
Requ
Req est
4000
Serv
Ser ice 2
4000 is Just an 
Respo
sp nse
Requ
Req est
4000
4000
(positive)
Service 1
Respo
sp nse
Example 
Respo
sp nse
Requ
Re
e
qu st
4000
40(neg
00ative)
(positive)
Respo
sp nse
Res
Re ponse
Requ
Req est
(neg
4000
4000ative)
(posit
osi ive)
Res
Re ponse
Resp
Res onse
(negat
eg iv
4000 e)
(positive)
Resp
Res onse
(negative)
  
A Diagnostic 
Diagnostic Class
Instance is a part of 
a Diagnostic 
ss 
Cla
Diagnostic Instance 2
Diagnostic Instance 1
Diagnostic Instance 
Service 4
Service 3
Request
100A
Service 2
Reques
qu
t
es
100A
Resp
es onse
ons
Service 4
100A
(positive)
Service 1
Response
Service 3 Request
4000pons
4000
R
100esp
A
es onse
(posi
os tive)
ons
ve)
(negative)
Req
Re uest
Response
pons
4000
Respo
sp nse
Service 2
Request
(nega
4000
(p
4000 tive)
(posi
os tive)
Request
4000
Resp
Re o
sps nse
ponse
pons
4000
Respo
sp nse
Service 1
(neg
40(p at
os iiv
00tiev)e)
(p
Re os
sp it
o iv
n e)
se
Req
Re uest
4000
40Respons
00
e
(positive)
pons
)
Respo
sp nse
(negative)
(
R n
e eg
sp ati
egon ve
se )
Response
Request
pons
st
(neg
4000
4000ati
eg
ve)
(posi
pos tive)
Response
pons
Respo
sp nse
(negativ
4000 e)
(posi
os tive)
Respo
sp nse
(negative)
  
3.7.2 
e same Nomenclature from the Top Dow
Th

CANdela is top 
diagnostic class is an abstract description of a use case.  
own, CANd
d
esc 
diagnostic instance is derived from a diagnostic class. Some diagnostic classes 
bottom up – try to 
can be instantiated only once. Any diagnostic instance is unique and can be 
understand both 
distinguished from another diagnostic instance via its sub service (e.g
). 
. data identifier
directions. 
A diagnostic instance contains services. 
Services are composed of the three service primitives: request, positive response 
and negative response. The protocol service is the pattern for the service, the 
grammar definition.  
The service primitive data is a co
n
ncrete i formation unit exchanged between the 
tester and the ECU. In the automotive environment you call them signals, too. 
  
.7.3 
3
Where to find this Nomenclature in CANdela Studio 
Getting around in 
To generate CANdesc you will have to make settings in the CDD file, i.e. you will 
CANdela Studio  
have to work with CANdela Studio. That’s the reason why it is very importa
you 
nt that 
get to know the areas in the CANdela Studio where to make the necessary settings.  
Below there is a screenshot of CANdela Studio. 
  
© Vector Informatik GmbH 
Version 1.7 
- 19 - 



Basic Information 
User Manual CANdesc 
See the Diagnostics 
Classes and 
Diagnostic Instances 
in the CANdela 
Studio tree structure 
 
 
  
 
The structure within CANdela Studio is top down. In the tree on the left of CANdela 
Studio you will find the diagnostic class and the diagnostic instances as shown in the 
figure above. 
  
Info: To get familiar with the idea of diagnostic classes and diagnostic instances, 
have a look at all supported diagnostic classes. Verify for yourself what is meant by 
 
abstract description of a use case, e.g. talking about Sessions, Security Access, 
Fault Memory… 
  
 
If you click on a Service Instance you get a window like the following figure. Use this 
figure to understand the different areas on the diagnostic instance window and to 
close the gap between the nomenclature in the section above and it appears in 
CANdela Studio. 
  
- 20 - 
Version 1.7 
© Vector Informatik GmbH 



User Manual CANdesc  
Basic Information 
Diagnostic Instance 
window of CANdela 
Studio – a very 
important window 
 
 
 
 
 
  
3.7.4  Generic Handling of a Diagnostic Request in the CANdesc Component 
What happens in the  Now you know the basic diagnostic elements and the build-up of diagnostic services. 
CANdesc if a 
Now we take a closer look at how the diagnostic services are processed by CANdesc. 
diagnostic message 
You also need to know these processing steps so you can control and adapt this 
received? 
process. 
  
Info: For this adaptation you have to use CANdela Studio. 
 
  
 
The following figure shows the processing of a diagnostic service in detail. 
  
© Vector Informatik GmbH 
Version 1.7 
- 21 - 




Basic Information 
User Manual CANdesc 
Processing a 
Diagnostic Message 
received by 
CANdesc and the 
connections to the 
Application. 
 
  
n  Everything starts with a diagnostic request from a tester to the ECU. 
  
Info: The path of this message through the CAN Driver and the Transport Protocol is 
not shown in the illustration. 
 
  
o  Now this incoming diagnostic request will be checked in different ways. Is the SID 
supported in the ECU? Is this SID supported in the current session? Is the service 
supported? Is the format of this request message correct, i.e. correct length? Correct 
 
data? etc.
  
p  If any of these checks fail a negative response is sent
to the tester. Th
 back 
e error 
code informs about the reason (e.g. wrong format). 
  
q  If the incoming diagnostic request passes all of these checks, a PreHandler function 
could be called. This PreHandler function is optional. You have options to set it to 
<none>, <user> or <OEM>. 
  
r  The next function is the MainHandler. This is a mandatory function. Every service 
must provide a MainHandler. The MainHandler is designed to analyze the request 
and assemble the response message. The MainHandler provides the options <user>, 
<OEM> and <generated>. 
  
s  After the MainHandler has processed the diagnostic data, provided the data for the 
response and informed the CANdesc Component about the end of the processing 
(processing done), the positive response message will be sent back to the tester. 
  
Info: The path through the Transport Protocol and the CAN Driver is not shown in the 
figure above. 
 
  
t  After the diagnostic response is sent by the transport layer (ACK) 
  
u  the call of the PostHandler function is triggered. This function is optional too and 
- 22 - 
Version 1.7 
© Vector Informatik GmbH 




User Manual CANdesc  
Basic Information 
can be set to <none>, <user> and <OEM>. Use this function to do any kind of state 
updates. 
  
Info: A typical example for the PostHandler is to reset the CPU to start the 
bootloader. 
 
  
3.7.5  User, None, OEM, Generated – what does this mean? 
 
As you have read in the section above, a Pre-, Main- and PostHandler can be 
selected for any service to process the diagnostic service in a very user-friendly 
manner. 
  
All handlers can be 
defined via CANdela  Handler 
Selectable settings 
Studio 
 
PreHandler 
none, user, OEM 
 
MainHandler 
user, OEM, generated 
 
PostHandler 
none, user, OEM 
  
None 
None can be selected for Pre and PostHandlers only because these handlers are 
optional. As the name says, none switches the handler off. 
  
er 
Us
The setting user means that you have to do the complete code for this handler. The 
function prototype is generated in appdesc.h. 
  
OEM (predefined) 
The setting OEM handles the request as required by the car manufacturer. The 
implemen tion is pa
ta
rt of the CANbedded Software Component. The user does not 
have to add anything. 
  
Info: The setting OEM should only be used if it is predefined. 
 
  
Generated 
If you select Generated you have two options for this handler (MainHandler) 
(Signal Handler) 
1.  Generate a function prototype (appdesc.h). Use this function to handle the 
diagnostic data by returning the current value (reading service) or using the 
parameter (writing service).  
2. In 
CANdela Studio you can enter the name of the variable. In appdesc.h the 
external decl
his variable is
aration of t
 generated and you only need to define this 
variable in your application and that’s all. Your application now just has to keep 
the content up to date. 
  
Cross reference: For more details about the using the handlers and how to make the 
settings in CANdela refer to STEP Functional Connection between your Application 
 
and CANdesc/CANdela Studio on page 35. 
 
 
 
 
© Vector Informatik GmbH 
Version 1.7 
- 23 - 

A Few STEPS to CANdesc 
User Manual CANdesc 
4 A 
Few 
STEPS to CANdesc 
In this chapter you find the following information: 
4.1 
STEP What do you need before start?  
page 
25
4.2 
Startup Code 
 page 25
4.3 
Overview 
25
 page 
4.4 
STEP Installation 
 page 26
4.5 
STEP Configuration 
e Gen
with th
eration Tool  
page 
26
 
Using the Generation Tool CANgen 
 
Using the Generation Tool GENy 
4.6 
STEP Generating Files
page 
29
  
 
Using Generation Tool CANgen 
 
Using the Generation Tool GENy 
4.7 
STEP Add CANbedded to 
r Proje
you
ct  
page 
32
4.8 
STEP Adapt Your Application Files
 
33
  
page
 
Including, Initializing and Cyclic Calling 
4.9 
STEP Functional Connection between your Application and CANdesc/CANdela Studio  
page 
35
 
How to handle User-Defined Handlers 
 
How to Handle Predefined Handlers (for MainHandler only) 
 
Handling OEM-Specific Settings 
4.10  STEP Compile and link your Project  
page 
41
4.11  STEP Test it via CANoe
 
  page 
41
 
Start CANoe.CAN OSEK TP enlarged 
 
Test of CANdesc 
  
 
- 24 - 
Version 1.7 
© Vector Informatik GmbH 



User Manual CANdesc  
A Few STEPS to CANdesc 
4.1 
STEP What do you need before start? 
Check before you 
Before you start make sure
 
 that you have received everything you need. 
start 
  
edd
CANb
ed 
d
Did you get the CANbed ed delivery? 
  
YES? Then go on 
Except for the converter, you should answer all other questions with yes before going 
on here. 
  
.2 
4
Startup Code 
It is yo
 
ur 
The startup code of the microcontroller is not part of the Vector delivery. The startup 
responsibility 
code complete is in your responsibility.  
Take care to provide an appropriate startup code regarding e.g. wait states, etc.  
  
Info: The startup code is not part of the Vector delivery. 
 
 
4.3 
Overview 
Step overview 
This overview show
steps to CA
s the 
Ndesc. These steps are described in detail on 
ing s
the follow
ections. 
 
  
 
© Vector Informatik GmbH 
Version 1.7 
- 25 - 








A Few STEPS to CANdesc 
User Manual CANdesc 
4.4 
STEP Installation 
As you see in the picture before, you need 2 PC tools to work with CANbedded 
containing CANdesc as a diagnostic component. 
  
Generation Tool 
The first tool is the generation tool. It 
delivered 
is 
with the CANbedded Software 
Components. Extract the files to an appropriate folder and follow the installation 
instructions. 
  
Info: There are two kinds of generation tools, CANgen and GENy. Which of them you 
have to use depends on the delivery. In the following steps the usage of both tools 
 
are shown. 
  
CANdela Studio 
The second PC tool is CANdela Studio. This tool is for editing the *.CDD file. Install 
the tool by following the installation instructions. 
 
edde
Extract CANb

The number of CANbedded components in your delivery depends on your project.  
ftware 
So
To use CANdesc you need at least a CAN Driver and a Transport Protocol (e.g. 
Components 
OSEK / ISO 15765-2).  
Copy all C and H files which are necessary for the components into your application 
project folder.  
  
Cross reference: Refer to the corresponding user manuals (e.g. CANDriver User 
Manual) to get further information about the files of the different Software 
 
Components. 
  
Info: Since CANdesc is totally generated, you won’t find any source files for CANdesc 
in your delivery. 
 
  
4.5 
STEP Configuration with the Generation Tool 
As described above there are two generation tools for configuring the CANbedded 
Software Components, CANgen and GENy.  
 
In the following chapters we describe the handling of both tools, beginning with 
 
en
CANg
. Figure out which tool you use and read the corresponding chapters only. 
  
4.5.1 
 the G
Using
eneration Tool CANgen 
 
Open CANgen. Add a data base (DBC file) via the green plus 

 
Info: Normally you get a data base (DBC) from your vehicle manufacturer that is 
designed for your project. 
 
  
Are the files 
Make all the component settings as described in the appropriate User Manuals. For 
generated in the 
the Transport Protocol use the default [Set Defaults] for the first attempt. 
- 26 - 
Version 1.7 
© Vector Informatik GmbH 





User Manual CANdesc  
A Few STEPS to CANdesc 
correct path? 
  
Info: Remember to set the paths where the generation tool does the output. 
 
  
 
To configure CANdesc, open the CANdesc options tab. For this first attempt click 
[Set Defaults]. The generation tool needs to read an additional data base, the 
 
CANdela data base (CDD file). Browse for the CANdela data base file and select the 
 
CDD file you received from your vehicle manufacturer. 
Very few settings 
have to be made in 
the Generation Tool 
CANgen for 
CANdesc 
If the two checkboxes for debugging are checked you have to provide debug callback 
functions in your application. 
A very important entry is the Call Cycle. This call cycle must be the one you call the 
DescTask function or the DescTimerTask function in your application (this will be 
explained in detail in the next steps). 
  
4.5.2  Using the Generation Tool GENy 
 
Open the generation tool GENy and create a new project as described in the 
OnlineHelp of GENy in the chapter First Steps
  
Info: Normally you get a data base (DBC) from your vehicle manufacturer that is 
designed for your project. 
 
  
 
Make all the 
one
comp
nt settings as described in the appropriate User Manuals.  
  
Info: Remember to set the paths where the generation tool does the output. 
 
  
© Vector Informatik GmbH 
Version 1.7 
- 27 - 




A Few STEPS to CANdesc 
User Manual CANdesc 
 
Activate the component CANdesc in the component selection view. 
  
 
 
Component 
ie
Selection V w of 
GENy 
 
  
 
The activation of the CANdesc component is modified with the 
Diag_CANdesc_xxx.DLL version 3.0. 
  
mp
Co
onent 
Selection View of 
GENy with separate 
CANdesc_Connector
CAN component 
 
  
 
Starting with this version 
sc 
CANde
can be connected to more than one channel or 
can be used standalone. The Diag _CANdesc_UDS/KWP component includes the 
main configuration window of CANdesc. The Diag_CANdesc_Conn
N
ectorCA  
component connects CANdesc to a CAN network and configures the TPMC to work 
with CANdesc. 
  
Caution: If you do not activate CANdesc_ConnectorCAN component CANdesc will 
generate successful as standalone CANdesc. Therefore it is necessary to connect 
 
CANdesc with the CANdesc_ConnectorCAN component to a channel, if the TPMC 
shall be used. 
  
- 28 - 
Version 1.7 
© Vector Informatik GmbH 



User Manual CANdesc  
A Few STEPS to CANdesc 
GENy Configuration 
View for CANdesc 
 
  
 
To configure CANdesc, open the CANdesc configuration via the 
Diag_CANde
view. 
sc_UDS in the navigation 
As you see in the figure above, the 
generation tool needs to read an additional data base, the CANdela data base (CDD 
file). Browse for the CANdela data base file and select the CDD file you received from 
your vehicle manufacturer. 
If the two checkboxes for 
rt
Debug Suppo  are checked you have to provide debug 
callback functions in your a plication. 
p
A very important entry is the Call Cycle (“Cycle Time”). This call 
 th
cycle must be

one you call the DescTask function or your DescTimerTask function in your 
application (this will be explained in detail in the next steps). 
  
4.6 
STEP
n
 Ge erating Files 
.6.1 
4
Using Generation Tool CANgen 
 
If you have finished the settings in the previous step, hit the [Generate] 
 button. 
You get a message box containing information about the generation process and a 
[Success] window containing information about the generated files and their paths. 
Check to see if the files are generated into the correct folders. 
  
© Vector Informatik GmbH 
Version 1.7 
- 29 - 



A Few STEPS to CANdesc 
User Manual CANdesc 
Success Window 
after a Generation 
Process 
 
  
 
Open the folder you generated in the files listed above. There you should find the 
generated files for CANdesc, too. These are: 
  
desc.c  
This file contains the implementation and the private interface of the Diagnostic 
Software Component. 
 
  
This file contains the public interface of CANdesc. You will also find the <Negative 
esc.h 
d
response codes> here. 
  
appdesc.c 
This file is an implementation example for the proper usage of the diagnostics 
callback func
s. All nece
tion
ssary callback functions are generated in this file and 
commented what is left to be done (<<TBD>>). See the example below: 
  
Example: Extract of the Generated Callback Functions Template. 
 
- 30 - 
Version 1.7 
© Vector Informatik GmbH 



User Manual CANdesc  
A Few STEPS to CANdesc 
/* ********************************************************************************
* Function name:ApplDescReadVoltageService_Instance_For_Demonstration_Purposes
* Description: Reads a signal.
* Returns: signal value
* Parameter(s): none
* Particularitie(s) and limitation(s):
*   - The function "DescProcessingDone" may not be called.
*   - The function "DescSetNegResponse" may not be called.
******************************************************************************** */
vuint8 DESC_API_CALLBACK_TYPE 
ApplDescReadVoltageService_Instance_For_Demonstration_Purposes(void)
{
/*<<TBD>> Remove this comment once you have completely implemented this function!!!*/
/*Return the signal value.*/
return 0xFF;
}
/* ********************************************************************************
* Function name:ApplDescReadCurrentService_Instance_For_Demonstration_Purposes
* Description: Reads a signal.
* Returns: signal value
* Parameter(s): none
* Particularitie(s) and limitation(s):
*   - The function "DescProcessingDone" may not be called.
*   - The function "DescSetNegResponse" may not be called.
******************************************************************************** */
vuint8 DESC_API_CALLBACK_TYPE 
ApplDescReadCurrentService_Instance_For_Demonstration_Purposes(void)
{
/*<<TBD>> Remove this comment once you have completely implemented this function!!!*/
/*Return the signal value.*/
return 0xFF;
}
/* ********************************************************************************
* Function name:ApplDescReadResistanceService_Instance_For_Demonstration_Purposes
* Description: Reads a signal.
* Returns: signal value
* Parameter(s): none
* Particularitie(s) and limitation(s):
*   - The function "DescProcessingDone" may not be called.
*   - The function "DescSetNegResponse" may not be called.
******************************************************************************** */
vuint16 DESC_API_CALLBA
YPE
CK_T
 
ApplDescReadResistanceService_Instance_For_Demonstration_Purposes(void)
{
/*<<TBD>> Remove this comment once you have completely implemented this functio
*
n!!! /
/*Return the signal value.*/
return 0xFFFF;
}
  
Appdesc modification   If you start programming in the file appdesc.c, you fill in the missing code for the 
services and 
ne
you start a 
w generation process, the generation tool detects whether 
Detection to prevent 
the file has been chan

ge or not: 
loss of changes 
 
  
Info: So better rename the file before you implement the diagnostic services. 
 
  
appdesc.h 
This file provides prototypes of the application diagnostic callback functions and 
© Vector Informatik GmbH 
Version 1.7 
- 31 - 








A Few STEPS to CANdesc 
User Manual CANdesc 
external application declarations, which are accessed by CANdesc. 
All callback function 
prototypes are 
generated in 
appdesc.h. 
  
Appdescdev.c 
This file contains the definition of the used variables in CANdela Studio.  
  
Info: This file shall be used only during the first integration in order to make your 
project fully compile- and linkable. This file is no necessary later, since the variables 
 
that will be defined here shall be implemented within your ECU application code. 
  
Cross reference: (see section How to Handle Predefined Handlers (for MainHandler 
only) on page 38) 
 
  
4.6.2  Using the Generation Tool GENy 
 
If you have finished the settings in the pr
s
eviou  step, hit the [Generate] 
 button.  
  
Info: All files for the CANdesc Software Component are generated! 
 
  
Generated Files for 
In the Genera
iew you see the f
ted Files v
iles listed as shown in the figure below. Use 
Nd
CA
esc –CANdesc  this output to check the paths. In the list you only see the CANdesc-relevant files. The 
Core File
re 
s a
files are the same as generated with CANgen, so refer above for de
ation. 
tailed inform
Gene
o! 
rated, to
 
  
4.7 
STEP Add CANbedded to your Project 
What to do in this step depends on your development environment. Perhaps you are 
working with a makefile? 
 
Regardless of this you have to add the CANbedded files to your project. These are 
the files discussed in Section Extract CANbedded Software Components on page 26 
and the ones generated in the previous step. 
  
Caution: Always make sure that the path in which you generate the files and the path 
your compiler is working on are the same! 
 
  
 
Now there are several adaptations for you to make in your application. 
  
- 32 - 
Version 1.7 
© Vector Informatik GmbH 





User Manual CANdesc  
A Few STEPS to CANdesc 
4.8 
STEP Adapt Your Application Files 
Now all files for CANbedded and CANdesc are included in your project, and we can 
go on to make the necessary adaptations in your application files. 
 
  
 
These adaptations can be split in two categories: 
¼  Include, initialize and make the cyclic calls for the CANbedded Software 
Components (use the component-specific documentation for details). 
¼  Connect your application to CANdesc 
  
4.8.1  Including, Initializing and Cyclic Calling 
Two CANdesc 
As for all other CANbedded Components, CANdesc must be included, initialized and 
headers have to be 
used via a cyclic call. 
included in your 
application: 
desc.h 
appdesc.h 
 
Keep the including 
file structure. 
The figure shows all generated files of CANdesc. Your application only needs to 
include the files desc.h and appdesc.h in the order they are mentioned. 
  
Info: Any User Manual dealing with our CANbedded Software Components shows 
this kind of illustration. Always keep the include file structure that is shown. 
 
  
Like all other 
As for all other CANbedded Software Components the initialization function follows 
CANbedded 
the same naming conventions. For CANdesc use: 
Software 
DescInitPowerOn( initParameter ); 
Components, 
 
 
 
 
/*Interrupts must be disabled*/ 
CANdesc must be 
initialized and the 
Interrupts must be 
disabled during 
initialization 
  
Cross reference: For information about the initParameter  refer to your OEM-specific 
Technical Reference for CANdesc. 
 
  
 
Make sure that DescInitPowerOn is called after the call of CanInitPowerOn and 
© Vector Informatik GmbH 
Version 1.7 
- 33 - 




A Few STEPS to CANdesc 
User Manual CANdesc 
TpInitPowerOn.  
Normally the components are initialized from the bottom up according to the layer 
model. Always do these initializations with disabled interrupts. 
This is the correct order of initialization if you use CAN Driver, Transport Protocol and 
CANdesc. 
1. CanInitPowerOn(); 
2. TpInitPowerOn(); 
3. DescInitPowerOn(0); 
  
 
As you adjusted things in Using the Generation Tool CANgen on page 26 (Call cycle 
for CANdescMain
) the components need a cyclic call in your application to work 
properly. The call cycle must be the same as entered on the CANdesc tab / view 
(CANgen / GENy). The functions to call cyclically are: 
  
It is very important 
DescTask( ); or 
that you call 
ther with DescStateTask) 
DescTimerTask(); (toge
DescTask( ) or 
DescTimerTask() 
c
cycli ally and keep 
the adjusted call 
cle 
cy
  
Caution: Never use DescTask() and DescTimerTask() / DescStateTask() together! 
 
 
Using DescTask 
With the call of this single function the handling of the timers and of the internal 
service processing (including application functions) is triggered. If you receive a 
diagnostic request, the response can be handled not until the next call of DescTask.  
  
Info: This could lead to slower service processing. 
 
  
Using 
This concept splits the timer handling for CANdesc from the internal service 
scTimerTask
De
 
processing. Now only the function DescTimerTa
has to be 
sk() 
called in the predefined 
and 
(configuration tool) cycle time.  
DescStateTask 
The function DescStateTask() has to be call
cyclic ma
ed in a 
nner too, but does not 
need a fix cycle time. It can be called very fast to speed-up the reaction on a 
diagnostic request or it can be called as soon as there are free resources (e.g. an idle 
task in an operating system). 
  
Info: CANdesc and DescTimerTask use the cyclic call as a time base for the timing 
calculations. 
 
Do not make this call out of a timer interrupt. Just call DescTask() or 
DescTimerTask() at the task level. 
  
- 34 - 
Version 1.7 
© Vector Informatik GmbH 






User Manual CANdesc  
A Few STEPS to CANdesc 
4.9  STEP Functional Connection between your Application and 
CANdesc/CANdela Studio 
 
It is up to you when you perform this step: before STEP Configuration with the 
Generation Tool (page 26), as a part of STEP Adapt Your Application Files (page 33) 
or perhaps at both times. 
  
Info: There is a very close connection between the settings in CANdela Studio and 
what to do in your application. 
 
  
Have a look a look at section Generic Handling of a Diagnostic Request in the 
CANdesc Component on page 21. 
 
As you can see, there are three types of handlers (Pre-, Main- and PostHandler) that 
can be selected for any service. It is very important to know what happens when you 
choose the Value
he h
 for t
andlers. For this decision you need an overview of the 
great flexibility arising with the choice. 
We will first go through the possible settings for one service as an example. With the 
knowledge you gain from this you can then go on with the other services. 
The settings of the handlers value can be made in the Properties windows of each 
service on the 
 tab (see value
Attributes
s in the following figure). 
  
How are the settings 
in CANdela  appe
m

to your application? 
 
 
 
Support for the 
different Handlers 
can be adjusted on 
the Service Property 
Page 
 
  
4.9.1 
ow
H
 to handle User-Defined Handlers 
If you choose for the handlers to be user-defined, you have to do all the programming 
work for this service yourself, except for the checks. A callback function prototype will 
be generated in the file appdesc.h. 
 
  
Service Qualifier 
Open the Service Properties and then the General tab. 
© Vector Informatik GmbH 
Version 1.7 
- 35 - 




A Few STEPS to CANdesc 
User Manual CANdesc 
 
  
Diagnostic Instance 
Open the Diagnostic Instance Properties and then the General Tab 
Qualifier 
  
Names of the 
The names of these callback functions are built as the following  
generated callback 
 
functions 
  
Example: For this example, the callback function would look like this: 
appldesc + Read + Service_Instance_For_Demonstration_Purposes 
 
appldesc +PreRead + Service_Instance_For_Demonstration_Purposes 
appldesc +PostRead + Service_Instance_For_Demonstration_Purposes 
with parameters: 
void ApplDescReadService_Instance_For_Demonstration_Purposes(DescMsgContext* pMsgContext);
void ApplDescPreReadService_Instance_For_Demonstration_Purposes(void);
void ApplDescPostReadService_Instance_For_Demonstration_Purposes(vuint8 status);
  
 
Now you have to provide all the prototypes of the appdesc.h file as functions in your 
application and do the coding for each service, i.e. for each Pre-, Main- and 
PostHandler that is switched to User.  
See an example for a ReadDataByIdentifier MainHandler for the service above 
- 36 - 
Version 1.7 
© Vector Informatik GmbH 




User Manual CANdesc  
A Few STEPS to CANdesc 
defined for User. The data bytes of this service are: 
¼  g_Voltage (1 Byte) 
¼  g_Current (1 Byte) 
¼  g_Resistant (2 Bytes) 
  
 
To process this service by yourself, you need to know how to access the diagnostic 
data. The following figure 
w
sho s the data access for a reading service (upper figure) 
and a writing service. 
A reading service consists of a SID and perhaps a Sub-Service. The requested da  
ta
is then sent with the response. 
A writing service consists of a SID, perhaps a Sub-Service and the data. The 
response is only a confirmation with SID+0x40 and perhaps a Sub-Service. 
When working with CANdesc you only need to process the data. That is the reason 
why the pointer is directed to the first data byte.  
The same Diagnostic Buffer is used for receiving a diagnostic request AND sending the response
reqDataLen = 0
Diagnostic request (A: reading service)
reqData[ 0 ]
Diagnostic
SID 
Sub Service
-
-
-
Buffer
SID + 0x40
Sub Service
Data
Data
Data
(RAM Memory)
resData[ 1 ]
resData[ 2 ]
Positive Diagnostic response
resData[ 0 ]
resDataLen
reqData[ 0 ]
reqDataLen
Diagnostic request (B: writing service)
reqData[ 1 ]
reqData[ 2 ]
Diagnostic
SID 
Sub Service
Data
Data
Data
Buffer
SID + 0x40
Sub Service
-
-
-
(RAM Memory)
Positive Diagnostic response
resData[ 0 ]
resDataLen = 0
 
  
Info: The request data and the response data are stored to the same memory 
location. Writing the response data means deleting the request data. 
 
  
Example: The example below shows a very easy way to process a diagnostic 
request. The data is copied to the Diagnostic Buffer, the amount of the response 
 
data is determined and the diagnostic service is finished via DescProcessingDone. 
 
Code Example for 
the MainHandler 
Using the User 
Option 
  
© Vector Informatik GmbH 
Version 1.7 
- 37 - 




A Few STEPS to CANdesc 
User Manual CANdesc 
Example: When preparing the diagnostic response, it is very important to provide the 
correct data and calculate the length of the response (ÆresDataLen).  
 
To finish the service processing with a positive response, call: 
DescProcessingDone();  
For a negative response, finish the service processing with: 
DescSetNegResponse(<errorCode>); 
DescProcessingDone(); 
  
Info: A negative response can also be set in the PreHandler. There it is enough to 
call DescSetNegResponse(<errorCode>). The PreHandler must not be finished with 
 
DescProcessingDone. See desc.h for the definitions of the erro
es. 
r cod
Remember: in the PreHandlers no access to the diagnostic data buffer is possible. 
  
Response pending 
What to do if the response cannot be sent immediately? 
will be sent 
In some cases (e.g. writing data to the EEPROM) you cannot send the response 
automatically by 
immediately, but you need not treat this as an exception. CANdesc will automatically 
CANdesc 
inform the tester about the delay in the diagnostic response. So process the request 
and if you finish it, send DescProcessingDone. All other timing aspects are realized 
by CANdesc (Response Pending). 
  
4.9.2  How to Handle Predefined Handlers (for MainHandler only) 
If you select generated you need not to program the complete service by hand. Using 
this option gives you two further options: 
1.  A signal callback function will be generated 
  2.  You can tell CANdela the name of the variable (and data type) for a certain 
service and you only have to provide this variable in your application code. 
 
To get a signal callback function generated, i.e. to implement the first option, right 
click on a data object and choose Properties from the pull down menu. Now the 
Properties window of the chosen data object opens. In this example it is the data 
c
obje t Voltage. 
  
- 38 - 
Version 1.7 
© Vector Informatik GmbH 




User Manual CANdesc  
A Few STEPS to CANdesc 
Signal Access via the 
Application and a 
Callback Function 
 
  
Example: Make sure that the Overwritten Value field on the Attributes tab is empty. 
The generated prototype should look like this.  
 
vuint8  
ApplDescReadVoltageService_Instance_For_Demonstration_Purposes(
void); 
  
Example: All you have to do in your application for this MainHandler is to provide the 
function ApplDescReadVoltageService_Instance_For_Demonstration_Purposes and 
 
return the current value for the voltage stored anywhere in your application. The data 
type of the return value will be adjusted automatically to the data type (Element Type) 
in CANdela Studio. In this case it is a 1 byte value, therefore it is the data type vuint8. 
vuint8  
oses(
ApplDescReadVoltageService_Instance_For_Demonstration_Purp
void); 

  return g_Voltage; 

  
Generated does not 
The second option is to connect the settings in CANdela Studio more closely to your 
mean that you do not  application. Do the same steps as described above, but now enter the name of the 
have to do anything 
variable in the value field of the Attributes tab as shown in the following figure. 
– but there is little 
prog
m
ram ing work 
left to do 
  
© Vector Informatik GmbH 
Version 1.7 
- 39 - 




A Few STEPS to CANdesc 
User Manual CANdesc 
Direct Signal Access 
  
Example: Now an external declaration of the variable g_Voltage prototype should be 
generated. 
 
extern vuint8 g_Voltage; 
The data type for this declaration again depends on the element type of the data 
object, in this case 1 byte again. 
Provide g_Voltage in your application (or use the appdescdev.c) and use it for storing 
the current voltage value. If a diagnostic request requests this value, CANdesc 
automatically refers to the content of g_Voltage. There is nothing more left to do for 
you. 
  
4.9.3  Handling OEM-Specific Settings 
 
The third choice is OEM. Do not change this. If the setting is on OEM, leave the 
settings as they are and refer to the OEM-specific documentation on how to deal with 
this service. 
Now your task is to implement all diagnostic services you have to support and select 
the desired status for Pre-, Main- and PostHandlers (none, user, OEM, generated). 
 
  
Caution: Do not touch the OEM-defined handlers. 
 
  
 
Then save the settings. This will change the CDD file. Depending on which step you 
are on right now, either 
- 40 - 
Version 1.7 
© Vector Informatik GmbH 




User Manual CANdesc  
A Few STEPS to CANdesc 
continue with STEP Configuration with the Generation Tool on page 26 or 
start the generation process again to generated the files containing the changes you 
made. 
  
Info: Sometimes in development, not all diagnostic services have been defined yet by 
the OEM. Provide this function anyway and send a negative response back. Then you 
 
can compile and link and test the other functions until the specification of the missing 
services is completed. 
  
4.10  STEP Compile and link your Project 
Now we have all the includes and all initializations. The components have the cyclic 
calls of their task functions and all callback functions are provided and programmed. 
 
Start the compiler or makefile and get the project compiled and linked.  
Is it ok? No errors? 
Congratulations! That’s it.  
Go on to the next step and do the testing. 
  
4.11  STEP Test it via CANoe 
Since you have arrived at this step, you are now able to compile and link. Have you 
already downloaded the code to your target platform?  
 
Testing of the generated CANdesc depends on you and the OEM you are working for. 
Perhaps you do have a diagnostic tester, perhaps not.  
If you do not have an appropriate tester, we recommend using CANoe (a Vector PC 
tool) and one of its demo configurations. 
  
4.11.1  Start CANoe.CAN OSEK TP enlarged 
The CANoe demo 
To test you diagnostics layer use one of the CANoe demo applications. Open this 
environment is very 
config
n via 
uratio
Start/Programs/CANoe/Demos/More Demos/CANoe.CAN OSEK 
simple way to 
d
TP enlarge 
basically test 
A CANoe configuration will open with four nodes (A to D). All nodes look quite the 
requests and 
same like this: 
responses 
© Vector Informatik GmbH 
Version 1.7 
- 41 - 





A Few STEPS to CANdesc 
User Manual CANdesc 
 
  
 
Set the baud rate in CANoe to the one of your ECU and connect it to CANoe via CAN 
(CANcardXL, CANAC2…). Now run CANoe via the yellow lightning bolt and run 
YourECU. 
  
Info: Make sure that the CANoe mode is switched to Real bus and you have 
selected the same baud rate as the real node “YourECU” is working with. 
 
  
4.11.2  Test of CANdesc 
 
Use one of the four nodes for your tests. Change the TpTxId and the TpRxId in the 
“Addressing” field of the node window. 
  
Caution: The TpTxId is the Rx Diagnostic message in your generation tool and the 
TpRxId is the Tx Diagnostic message. In the example case the DiagResponse 
 
message is 0x7C0 and the DiagRequest message 0x7B0. 
It is optional to set the time for ST Min from 64ms (default) to 20ms. This is to prevent 
the ECU from running in time out. 
  
- 42 - 
Version 1.7 
© Vector Informatik GmbH 





User Manual CANdesc  
A Few STEPS to CANdesc 
Panel to Test 
Diagnostics Layer 
 
 
 
 
 
 
Compare the Values 
with the ones shown 
in CANdela Studio 
  Æ...
 
  
 
It is very simple to test the services using CANoe. Enter the request in the 
Transmission box and press Send Data and see the response in the same box. 
Compare this response with the desired one in CANdela Studio. The contents of the 
signals depend on the application. 
  
Info: Make some variations to the signal contents to confirm the tests. 
 
  
 
Repeat this for all other services. 
  
© Vector Informatik GmbH 
Version 1.7 
- 43 - 

Further Information 
User Manual CANdesc 
5 Further 
Information 
In this chapter you find the following information: 
5.1 
Diagnostic State Handling using CANdela Studio  
page 
45
5.2 
Typical Examples of State Groups and States in an Automotive Environment  
page 
45
5.3 
Creating and editing State Groups, States and Transitions  
page 
45
5.4 
Connection between the states and your application  
page 
47
5.5 
Diagnostic Buffer 
 page 48
 
Linear Diagnostic Buffer 
 
Ring Buffer Mechanism 
5.6 
Repeated Service Call Feature  
page 
55
 
Activation of the Repeated Service Call 
 
Repeated Service Call and Ring Buffer 1 – “Write and Check” 
 
Repeated Service Call and Ring Buffer 2 – “Check and Write” 
  
 
- 44 - 
Version 1.7 
© Vector Informatik GmbH 


User Manual CANdesc  
Further Information 
5.1  Diagnostic State Handling using CANdela Studio 
 
Executing a diagnostic service generally causes a state change in the electronic 
control unit. Some services may only be executed if the electronic control unit is in a 
particular state. For example, services that change critical data may only be executed 
if the electronic control unit is first switched into a “security mode” (for example with 
the specification of a numeric key).  
CANdela Studio offers the opportunity to define and edit global states and state 
transitions for the services of a diagnostic instance. In addition, states can be 
combined into state groups. 
  
5.2  Typical Examples of State Groups and States in an Automotive 
Environment 

 
The sessions (which should already be predefined) are a very “famous” example of a 
state group. Any diagnostic session has its set of services that are executable while 
the ECU is in this session. There are basically three sessions, defined from the ISO: 
¼  Default session – as the name says, this is the standard session 
¼  Programming session – while the ECU is in reprogramming mode (flashing) 
¼  Extended Session – session for e.g. the development phase, providing an 
extended amount of services 
Another very easy example for state groups is the security access. The ECU must be 
set to a specific state to be able to do critical data manipulation, su
s
ch a  the flashing 
action mentioned above. For example, the states for the state group security access 
would be: 
¼  Locked  
¼  Access granted 
We use this example to very basically explain the state concept of CANdela Studio. 
  
Cross reference: For more detailed information about this topic refer to the CANdesc 
Technical Reference. 
 
  
5.3 
Creating and editing State Groups, States and Transitions 
 
To create or edit the State Groups, click on [State Groups] in the CANdela Studio 
tree. Enter the new State Group Security Access by clicking on the text. A new State 
Group will be created called:  
New State Group 1. 
If you generate more than one State Group without renaming the previous ones, the 
groups are numbered counting from 1 up.  
To edit the new State Group you have two options. The first is to click on the State 
Group name and edit the name, then click on the description field and enter the text. 
Another way is to open the pull down menu of the State Group with a right click on the 
row of SecurityAccess and select Properties. The Properties of State Group 
Security Access”
 window will open. Enter the name and description. 
  
© Vector Informatik GmbH 
Version 1.7 
- 45 - 





Further Information 
User Manual CANdesc 
Info: The qualifier will be created automatically. 
 
  
 
 
  
 
Now we can add the states below in the same way. Click on the text to create a new 
element, adjust the names and enter a description. 
The next step is to assign the relevant services to the states. 
  
Defining States for 
the Service 
SecurityAccess – 
Request Seed 
 
  
 
Select the Diagnostic Instance Security Access Seed and open the Properties of the 
Service Request Seed. Select the tab State Transitions and then SecurityAccess
- 46 - 
Version 1.7 
© Vector Informatik GmbH 




User Manual CANdesc  
Further Information 
You see the service with the two columns states Locked and Access granted
  
 
Info: To select yes or no just select the row, click on the yes/no and then use the pull 
down menu. 
 
  
Info: Pull down menu selections: 
No = Must not be executed 
 
Yes = may be executed, no state transition 
Locked = state transition 
Access granted = state transition 
  
 
The following figure shows the properties for the service Send Key in the Key 
instance. This service is also assigned to both of the states, but there is also a 
transition to state defined. How do you interpret this entry?  
The service Send Key could be executed in the state Locked. If the data is 
processed (depending on the OEM, this must be done by the application or is a 
generated, OEM-specific Code) and a positive response is sent back, CANde
 
sc
switches the state from Locked to Access Granted. In case of a negative re
o
sp nse 
the ECU remains in the diagno
 state 
stic
Locked. 
  
A positive response 
is the trigger for a 
transition from the 
Locked state to the 
state Access granted 
 
 
  
5.4 
Connection between the states and your application 
 
The initial state after the ECU starts is the st
this case the 
ate at the top of the list. In 
initial state is Locked. 
  
© Vector Informatik GmbH 
Version 1.7 
- 47 - 






Further Information 
User Manual CANdesc 
Info: Think about the states very carefully before editing. Make sure that the initial 
state is listed on top. 
 
  
Example: The state transition mentioned above is monitored to your application via a 
callback function. You will find the prototype of this function, as usual, in the 
 
appdesc.h file. It may look like this: 
void ApplDescOnTransitionSecurityAccess(DescStateGroup 
newState, DescStateGroup formerState); 
The parameters show the direction of the transition. Provide the function and react to 
a transition as you wish. 
  
Example: There is another way to switch states. Leave the transition to state empty 
and do the state transition in your application. This could look like: 
 
DescSetStateSecurityAccess( 
kDescStateSecurityAccessAccess_granted ); 
Use  
DescStateGroup DescGetStateSession (void) 
to find out the current session. 
  
Info: The function declaration and parameter can be found in the generated file 
desc.h. 
 
  
5.5 
Diagnostic Buffer 
 
As described in chapter How to handle User-Defined Handlers on page 35, the 
diagnostic buffer is an area in the RAM where the application and the CANdesc 
Software Component are allowed to write on and read from. How this is handled is 
described in this chapter above. 
What is not explained until now is: 
¼  how to choose the length of the diagnostic buffer 
¼  that there are two mechanisms of using the buffer and 
¼  when to use which mechanism  
  
5.5.1  Linear Diagnostic Buffer 
 
The easiest way of using the diagnostic buffer is to use it as a linear buffer. The size 
of the buffer in bytes must be the size of the longest data (diagnostic response or 
request). 
  
Info: Normally this is a diagnostic trouble code message (DTC) and can reach up to 
100 bytes and more. 
 
  
 
Copy the complete response information to the diagnostic buffer and confirm this via 
the call of DescProcessingDone. 
- 48 - 
Version 1.7 
© Vector Informatik GmbH 


User Manual CANdesc  
Further Information 
This is easy to handle but there are some disadvantages arising with this concept: 
¼  The RAM consumption could be enormous 
¼  The delay time between the reception of a Diagnostic Request and the first 
response message could be very long, depending on the service and the amount 
f the respon
of bytes o
se message. 
There is another concept without these disadvantages but this concept needs a little 
bit more insight in CANdesc func onality. 
ti
  
5.5.2  Ring Buffer Mechanism 
 
There are several reason
ring buffe
s for using the 
r mechanism: 
¼  Little RAM consum
cau
ption be
se of small diagnostic buffer 
¼  Shorter delay between the diagnostic request and the first response message 
The ring buffer mechanism offers the following features: 
¼  Asynchronous writing of serial diagnostic data to the diagnostic buffer 
¼  Underrun allowed, time monitored (in case of TP underrun the PostHandler is 
called with a Tx error code) 
¼  Overrun prevented and monitored via return code 
One of the advantages of the ring buffer mechanism is the little RAM consumption 
(compared with the linear buffer). The consequence is that this little diagnostic buffer 
can hold less data than a diagnostic buffer de
ed for linea
sign
r buffer mechanism. 
That means that the application has to fill the buffer in portions until the complete 
diagnostic response is sent. 
The following example is very simple and designed to understand the concept behind 
the ring buffer mechanism. 
  
Ring Buffer STEP 1 
– Application Data 
and Ring Buffer 
  
 
Starting point is a diagnostic buffer with 10 bytes size and 12 bytes of application data 
to be sent. First you have to set the length of the complete diag
stic data 
no
(resDataLen = 12) and start the ring buffer mechanism 
(DescRingBufferStart). 
  
© Vector Informatik GmbH 
Version 1.7 
- 49 - 




Further Information 
User Manual CANdesc 
Ring Buffer STEP 2 
– First four data 
bytes are copied to 
e Ring Buffer 
th
 
  
 
Now hand over the pointer to the location 
plicatio
of the first four ap
n data bytes 
e
(point r and amount of data - DescRingBufferWrite) to the CANdesc Software 
Component. CANdesc Basic copies the four data bytes to the diagnostic buffer. 
  
ng Buffer S
Ri
TEP 3 
– Eight Data Bytes in 
the Diagnostic 
Buffer, six Bytes are 
being sent via CAN 
 
  
 
Hand over the pointer to the location of the next four application data bytes and 
CANdesc copies the data to the diagnostic buffer right after the first four bytes. Now 
there is enou
ta in the
gh da
 buffer and CANdesc sends the first six data bytes via the 
CAN bus. 
  
Info: The first 2 bytes of the message are transport information and therefore not 
 
free
for application data (TP bytes on position 0 and 1). 
 
 
- 50 - 
Version 1.7 
© Vector Informatik GmbH 






User Manual CANdesc  
Further Information 
Ring Buffer STEP 4 
– The Diagnostic 
Buffer is filled round 
robin 
 
  
 
Now there are only four bytes left to be copied to the Diagno

stic Buffer. The first tw
bytes are stored in position
 9 of the 
 8 and
buffer, the next two bytes in position 0 and 
1. 
  
Info: Now it should be obvious why this concept is called Ring Buffer; the buffer is 
filled round robin. 
 
  
 
In a next step the six data bytes will be copied and sent via CAN starting with the byte 
on position 6.  
That is the basic mechanism, but how do you know when there is enough space in 
the buffer? What happens if the application writes data and the buffer is not free? 
How to handle this buffer in code details? 
  
5.5.2.1 
Activation of the Ring Buffer 
Activation of Ring 
Although the ring buffer could be used for any service and you can meet this decision 
Buffer in GENy 
at run-time you must activate this functionality in general.  
Do this on the CANdesc configuration view in GENy by clicking the Ring Buffer 
Support
 checkbox. 
  
Activation of Ring 
In CANgen you have to select the Ring buffer checkbox at tab CANdesc Options
Buffer in CANgen 
 
  
 
5.5.2.2 
Main Control Functions for the Ring Buffer Mechanism 
Cross reference: For a more detailed description of the API refer to the 
TechnicalReference_CANdesc.pdf. 
 
  
DescRingBufferStart  The call of this function starts the ring buffer mechanism. You can use it for any 
© Vector Informatik GmbH 
Version 1.7 
- 51 - 




Further Information 
User Manual CANdesc 
service and it replaces the DescProcessingDone that you use for the linear buffer 
mechanism. 
  
Info: Call DescRingBufferStart on MainHandler level. 
 
  
DescRingBufferWrite  Via this function you tell CANdesc the location and the amount of the application 
diagnostic data and the software component copies this data to the diagnostic buffer. 
The function has two parameters; one is a pointer which points to the memory 
location of the next diagnostic data. The other parameter is the amount of data that 
should be copied (should be lower or equal to the ring buffer size). 
The return value of this function can be kDescOk or kDescFailed and indicates that 
the write process to the diagnostic buffer was successful or that there was not enough 
free space in the buffer. 
  
Info: In case of kDescFailed no data has been written to the diagnostic buffer. 
 
  
sc
De
RingBufferGetF
This function shows the amount of free space in the diagnostic buffer. 
reeSpace 
  
DescRingBufferGetP
This function shows the amount of data that has already been written to the 
rogress 
diagnostic buffer (for this service). 
 
  
5.5.2.3 
Examples for Ring Buffer Mechanism 
 
Now start the coding for the example above (chapter 5.5.2). The diagnostic buffer is 
10 bytes and the amount of application data to be sent via a diagnostic response is 
12. In the example you write to the diagnostic buffer in four byte portions. 
The examples use an OSEK-OS operating system, but it should be very easy for you 
to transfer this to a system without OSEK-OS. 
  
ing Buffer Example 1 - “Write and Check” 
R
Example: MainHandler of the Service “Service” 
uint8 state; /*global variable*/
 
void ApplDescService( DescMsgContext* pMsgContext)
{
pMsgContext->resDataLen = 12;  /*amout of the complete data to be sent*/
DescRingBufferStart( ); 
state = 0;
DescRingBufferWrite( &dataPtr[state*4], 4 );  /*first write to diagnostic buffer*/
state++;
SetRelAlarm(ALServiceStateMachine, 0, <cycle> ); /*Alarm for activating the Basic 
TASK*/
}
  
 
Define the length of the complete diagnostic response (resDataLen = 12) and start 
the ring buffer mechanism (DescRingBufferStart). The global variable state is to 
- 52 - 
Version 1.7 
© Vector Informatik GmbH 



User Manual CANdesc  
Further Information 
identify in which state your state machine is and it is an index for the data pointer 
dataPtr.  
In the MainHandler you write to the diagnostic buffer the first time for this service - it 
must be free. So you can write the first four data bytes via DescRingBufferWrite. 
  
Info: As the handling of the diagnostic (CANdesc only works if its task is called 
cyclically) needs a cyclic call of the DescTask() or DescStateTask() you have to fill 
 
the diagnostic buffer gradually e.g. by the means of a cyclic basic task. Otherwise the 
DescTask() or DescStateTask() would not be called and the CANdesc could not work.
  
 
Now start an alarm to get the basic task BTServiceStateMachine called all 
<cycle> ms. 
  
Basic Task to Handle 
TASK( BTServiceStateMachine )
the Service State 
{
Machine 
if( DescRingBufferWrite( &dataPtr[state*4], 4 ) == kDescOk )
{
state++;

if( state == 3 ) 
{
CancelAlarm( ALServiceStateMachine );   /*all data (3x4 bytes) has been 
transferred to diagnostic buffer*/
}
TerminateTask( BTServiceStateMachine);
}
  
 
This basic task is designed to write the next 8 data bytes to the diagnostic buffer. But 
the application does not know if the buffer is free or not (Write and Check). To get 
this information use the return value of the DescRingBufferWrite function. Is it 
kDescOk, then the write was successful and we can increment the state. If not 
(kDescFailed), we have to repeat writing the last four bytes agai
l of 
n in the next cal
the task.  
If state is equal to three, 
een
i.e. all 12 bytes have b
 written to the diagnostic buffer, 
we cancel the alarm to stop
 handlin
 the
g of this diagnostic service. 
  
am
Ring Buffer Ex
ple 2 - “Check and Write” 
 
The MainHandler for this example is the same as in example 1. 
The difference is, that you first check whether there is enough free space in the buffer 
before you write the next data (check and write). Via the function 
DescRingBufferGetFreeSpace you get the information about the free space in 
the buffer. If there is enough space, write the next data and increm
t, 
ent the state, if no
terminate the task and repeat the try with the next activation of the task. 
  
Example:  
 
© Vector Informatik GmbH 
Version 1.7 
- 53 - 


Further Information 
User Manual CANdesc 
TASK( BTServiceStateMachine )
{
DescMsgLen freeSpace;
freeSpace = DescRingBufferGetFreeSpace();  /*MISRA*/
if( freeSpace >= 4 )
{
DescRingBufferWrite( &dataPtr[state*4], 4 );
state++;

if( state == 3 ) 
{
CancelAlarm( ALServiceStateMachine );   /*all data (3x4 bytes) has been 
transferred to diagnostic
u
 b ffer*/
}
TerminateTask( BTServiceStateMachine);
}
  
ing Buffer Example 3 – “GetProgress” 
R
 
In this example you use th
a
e alre dy mentioned function 
DescRingBufferGetProgress to figure out how many bytes you have written to 
the buffer until now. This makes the example much easier but a little bit more difficult 
to understand why it works in this way.  
As you see you do not need a global variable for the state. The state now is defined 
by the amount of data that you have already written to the buffer. 
 
Example:  
 
void ApplDescService(DescMsgContext* pMsgContext)
{
pMsgContext->resDataLen = 12;
DescRingBufferStart();
DescRingBufferWrite( &dataPtr[ DescRingBufferGetProgress() ], 4); /* will be 0 at 
the beginning*/
SetRelAlarm( ALServiceStateMachine, 0, cycle ); /*Alarm for activating the Basic 
TASK*/
}
TASK( BTServiceStateMachine )
{
DescMsgLen progress = DescRingBufferGetProgress();
if(progress < 12)
{
DescRingBufferWrite( &data

Ptr
progress ], 4 );
}
TerminateTask( BTServiceStateMachine );
}
  
Conclusion 
 
As you see in these three little examples, the handling of the ring buffer is always the 
same. You start the writing, you write cyclically and in portions and you have to define 
an ending criteria – a typical state machine.  
CANdesc offers a feature to support that kind of handling that is not only useful when 
working with ring buffer mechanism – the repeated service call. 
  
- 54 - 
Version 1.7 
© Vector Informatik GmbH 


User Manual CANdesc  
Further Information 
5.6 
Repeated Service Call Feature 
 
The easy way would be to transfer all data in the MainHandler to the diagnostic 
buffer, to call DescProcessingDone and the service is done. 
But what to do with information that cannot be provided immediate
aso
ly? For this re

you have to trigger a further function that handles the provision of diagnostic da

ta an
then finishes the service via DescProcessingDone. 
The Repeated Service Call helps you to handle situations like above very easy. Via 
the function call DescStartRepeatedServiceCall( CyclicFunction ) you 
trigger the call of the “CyclicFunction” with the call cycle of DescTask
ith 
 or w
the call of 
cStateTask
Des

  
Repeated Service 
CanDesc
ApplDescMainHandler
CyclicFunction
Call 
call
DescStartRepeatedServiceCall(CyclicFunction)
  
 
The CyclicFunction can be the function where from you call the repeated service call 
or a second function.  
At the end of the service handling you can stop the function from being called 
cyclically in two ways: 
¼  call DescProcessingDone in linear mode 
¼  if you have copied all announced data bytes to the diagnostic buffer if ring buffer 
mechanism is used 
The repeated service call is stopped too, if you  
¼  call DescRingBufferStart 
¼  call (another) DescStartRepeatedServiceCall( ) 
  
Info: Using repeated service call and the ring buffer you have to take care about the 
order DescRingBufferStart and DescStartRepeatedServiceCall. 
 
  
6.1 
5.
Activation of the Repeated Service Call 
 
u
As the ring b ffer mechanism you have to activate the repeated service call in the 
generation tool. 
In GENy you have to select a mode for repeated service call in the CANdesc 
configuration view. CANgen offers the same modes in the CANdesc option tab. 
As you see in the screenshot there are three modes for the Repeated Service Call: 
  
  
Deactivated 
You cannot use this feature at all. 
© Vector Informatik GmbH 
Version 1.7 
- 55 - 






Further Information 
User Manual CANdesc 
  
Deactivated 
You cannot use this feature at all. 
 
The repeated service call is switched to on for any service in the 
Always 
way that the MainHandler is called cyclically as long as you call 
DescProcessingDone or all data is written to the ring buffer. 
 
With the individual setting you decide for every service whether to 
use the repeated service call or not. To use it, just activate it via 
Individual 
DescStartRepeatedServiceCall as you see in the following 
examples. 
  
Selection for 
Repeated Service 
Call in GENy 
 
  
Selection for 
Repeated Service 
Call in CANgen 
 
  
 
The following two examples show the handling of the ring buffer mechanism using the 
repeated service call. 
  
Info: The setting in the generation tool is individual. 
 
  
5.6.2  Repeated Service Call and Ring Buffer 1 – “Write and Check” 
 
This is the same example as in the chapter dealing with the ring buffer mechanism. 
This time use the repeated service call instead of the OSEK-OS task. And in this first 
example, define the MainHandler itself to be called cyclically via: 
  
Example: DescStartRepeatedServiceCall( ApplDescService ); 
 
  
 
For this case the MainHandler must be realized as a state machine because the start 
of the repeated service call has to be done only once per diagnostic request handling. 
  
Example:  
 
- 56 - 
Version 1.7 
© Vector Informatik GmbH 


User Manual CANdesc  
Further Information 
uint8 state; /*global variable, set to 0 in PreHandler*/
void ApplDescService( DescMsgContext* pMsgContext)
{
if( state == 0)
{
pMsgContext->resDataLen = 12;
/*amout of the complete data to be sent*/
DescRingBufferStart( );
DescRingBufferWrite( &dataPtr[ state*4 ], 4 )
DescStartRepeatedServiceCall(ApplDescService);
state++;
}
else
{
if( DescRingBufferWrite( *dataPtr[ state*4 ], 4 ) == kDescOk )
{
state++; /*if resDataLen data bytes have been copied to the diagnostic   
buffer the repeated service call stops automatically*/
}
}
}
  
5.6.3  Repeated Service Call and Ring Buffer 2 – “Check and Write” 
 
Now add a second function and call it cyclically after the MainHandler has been 
called. The MainHandler acts as initialization of the state machine and the second 
function handles all further states. 
  
Example:  
 
uint8 state; /*global variable*/
void ApplDescService( DescMsgContext* pMsgContext)
{
state = 0;
pMsgContext->resDataLen = 12;
/*amout of the complete data to be 
sent*/
DescRingBufferSt
( );
art
DescRingBufferWrite( &dataPtr[ state*4
 4
 ],
)
DescStartRepeatedServiceCall( SecondFunction );
}
void SecondFunction( DescMsgContext* pMsgContext ) /*prototype must be defined 
by application*/
{
DescMsgLen freeSpace;
freeSpace = DescRingBufferGetFreeSpace();  /*MISRA*/
if( freeSpace >= 4 )
{
state++; 
DescRingBufferWrite( &dataPtr[
tat
 s
e*4 ], 4 ); 
/*if resDataLen (12) data byte
hav

e been copied to the diagnostic buffer
the repeated service call
op
 st
s automatically*/
}
}
  
 
© Vector Informatik GmbH 
Version 1.7 
- 57 - 

Additional Information 
User Manual CANdesc 
6 Additional 
o
Informati n 
In this chapter you find the following information: 
6.1 
Persistors 
 page 59
 
Update Persistors – Install current Version 
  
- 58 - 
Version 1.7 
© Vector Informatik GmbH 


User Manual CANdesc  
Additional Information 
6.1 
Persistors 
What is the Persistor  The CANdela data base file (CDD) is created by CANdela Studio and used by GENy 
for? 
for configuring CANdesc. 
If you use a newer version of the CANdela Studio, the format of the CDD file could be 
also newer than your GENy is able to deal with. 
The Persistors are responsible to convert the newer CDD file into a CDD file which is 
able to read by GENy.  
  
Update Persistors – 
The latest Persistors can be downloaded from Vector homepage 
Download current 
www.vector.com
Version 
Select Downloads and then the three settings for ProductsCategories and 
Standards.  
¼  Products: CANdela Studio 
¼  Categories: Add-Ons/Freeware 
¼  Standards: All Standards 
  
Cross reference: See the following illustration. 
 
  
Available for 
The name for the Persistors download is:  
NT/2000/XP or 
¼  Converters for CANdela diagnostic descriptions for Windows xxx
Windows 9.x 
  
 
© Vector Informatik GmbH 
Version 1.7 
- 59 - 



Additional Information 
User Manual CANdesc 
 
 
Download 
Select on or more items from the list (
) and click on [>> Select one or more items, 
then continue] to download the files after entering some administrative information.  
  
6.1.1  Update Persistors – Install current Version 
Follow description 
Start the downloaded file SetupPersistorsXP.exe
step by step 
    
- 60 - 
Version 1.7 
© Vector Informatik GmbH 



User Manual CANdesc  
Additional Information 
 
 
Click [Next]
 
 
Select Custom and enter the path to the …\Generators\Components folder as 
Destination Folder for Custom Setup and click [OK]
© Vector Informatik GmbH 
Version 1.7 
- 61 - 



Additional Information 
User Manual CANdesc 
 
Click [Install] and the installation process will be started and then on [Finish] when 
ready. 
  
Ready 
Now the current Persistors are installed and your GENy is able to read the latest CDD 
file.  
  
 
- 62 - 
Version 1.7 
© Vector Informatik GmbH 

User Manual CANdesc  
FAQs 
7 FAQs 
In this chapter you find the following information: 
7.1 
Introduction 
 page 64
7.2 
Frequently Asked Questions  
page 
64
  
© Vector Informatik GmbH 
Version 1.7 
- 63 - 


FAQs 
User Manual CANdesc 
7.1 
Introduction 
Find not search 
You have a certain question? You just want to know how to do e.g. a certain setting 
without reading the whole document again? 
Then go on reading the following list and use the links to get at the place in the 
document where your question will be answered. 
This chapter will be extended continuously. 
  
7.2 
Frequently Asked Questions 
FAQ: RingBuffer and the UDS SuppressPositiveResponseMessageIndicationBit 
(SPRMIB) 
 
If the application wants to use the ring-buffer for a diagnostic service with a sub-
function (usually service 0x19 "ReadDtcInformation") it shall consider the SPRMIB 
prior deciding to start the ring buffer. The reason for that is, once the ring-buffer 
response is activated this means to CANdesc that the application wants to send data. 
But if the SPRMIB=TRUE, there shall be no positive response on the communication 
bus. So in such cases the Application shall follow the sequence below: 
 
if(pMsgContext->msgAddInfo.suppPosRes != 0) 

  DescProcessingDone();/* just close the service processing 
now. No response will be sent back*/ 

else 

  DescRingBufferStart(); /* initate the ring-buffer response 
transmission */ 

  
 
- 64 - 
Version 1.7 
© Vector Informatik GmbH 

User Manual CANdesc  
What’s new, what’s changed 
8  What’s new, what’s changed 
In this chapter you find the following information: 
8.1 
Version 1.7 
 page 66
 
What’s new 
 
What’s changed 
  
 
© Vector Informatik GmbH 
Version 1.7 
- 65 - 

What’s new, what’s changed 
User Manual CANdesc 
8.1 
Version 1.7 
What’s new and 
This explains the changes within this document form the previous Versi
 
on to the one
what’s changed  
mentioned in this headline. 
 
8.1.1  What’s new 
w ch
Ne
apter 
There is a new chapter for additional information about Persistors setup and update 
at chapter additional information (see section Persistors on page 59). 
Persistors setup and 
update  
  
8.1.2  What’s changed 
New Layout 
The Document has got a new template. 
 
- 66 - 
Version 1.7 
© Vector Informatik GmbH 

User Manual CANdesc  
Address table 
9 Address 
table 
Vector Informatik 
Vector Informatik GmbH  
GmbH 
Ingersheimer Str. 24  
D-70499 Stuttgart  
one: +4
Ph
9 (711) 80670-0  
Fax: +49 (711) 80670-111  
mailto:info@de.vector.com  
http://www.vector-informatik.com/ 
  
Vector CANtech, Inc.  Vector CANtech, Inc.  
Suite 550  
39500 Orchard Hill Place  
USA-Novi, Mi 48375  
Phone: +1 (248) 449 9290  
Fax: +1 (248) 449 9704  
mailto:info@us.vector.com  
http://www.vector-cantech.com/ 
  
Vector France SAS 
Vector France SAS  
168, Boulevard Camélinat  
F-92240 Malakoff  
Phone: +33 (1) 4231 4000  
Fax: +33 (1) 4231 4009  
mailto:info@fr.vector.com  
http://www.vector-france.com/ 
  
Vector GB Ltd. 
Vector GB Ltd. 
Rhodium Central Boulevard Blythe Valley Park 
Solihull, Birmingham 
West Midlands B90 8AS 
Phone: +44 121 50681-50 
mailto:info@uk.vector.com  
http://www.vector-gb.co.uk 
  
© Vector Informatik GmbH 
Version 1.7 
- 67 - 

Address table 
User Manual CANdesc 
Vector Japan Co., 
Vector Japan Co., Ltd.  
Ltd.  
Seafort Square Center Bld. 18F  
2-3-12, Higashi-shinagawa, Shinagawa-ku  
J-140-0002 Tokyo  
Phone: +81 3 (5769) 7800  
Fax: +81 3 (5769) 6975  
mailto:info@jp.vector.com  
http://www.vector-japan.co.jp/ 
  
Vector Korea IT Inc. 
Vector Korea IT Inc. 
Daerung Post Tower III, 508 
Guro-d
uro
ong, G
-gu, 182-4 
2
Seoul, 15 -790 
Republic of Korea 
Phone: +82(0)2 2028 0600 
Fax: +82(0)2 2028 0604 
mailto:info@kr.vector.com  
http://www.vector-korea.com/ 
  
VecScan AB  
VecScan AB  
Theres Svenssons Gata 9 
SE-417 55 Göteborg  
Phone: +46 (31) 76476-00  
Fax: +46 (31) 76476-19  
mailto:info@se.vector.com  
http://www.vecscan.com/ 
  
 
  
- 68 - 
Version 1.7 
© Vector Informatik GmbH 

User Manual CANdesc  
Glossar 
10 Glossar 
Callback function 
This is a function provided by an application. E.g. the CAN Driver calls a callback 
function to allow the application to control some action, to make decisions at runtime 
and to influen
 work o
ce the
f the driver. 
Diagnostics layer 
Diagnostics services that ar
omotive appli
e used in aut
cations have recently become 
standardized. As a result, basic requirements can be implemented by a software 
component for KWP20
S. 
00/UD
  
 
 
© Vector Informatik GmbH 
Version 1.7 
- 69 - 

User Manual CANdesc  
Index 
11 Index 
 
DescRingBufferWrite ......................................... 52 
A 
development environment ................................. 32 
Adapt Your Application Files ..............................33 
Diagnostic Buffer................................................ 48 
AppDesc .............................................................36 
Diagnostic Class .......................................... 18, 19 
appdesc.h .....................................................31, 33 
Diagnostic Instance...................................... 18, 19 
application...........................................................33 
Diagnostic Request.................... 11, 14, 17, 21, 35 
Asynchronous writing..........................................49 
Diagnostics .................................................. 11, 17 
C 
E 
call-back function ................................................48 
Example 1 .......................................................... 52 
CANbedded ..................................................

24, 3
Example 2 .......................................................... 53 
CANdela Studio ................... 11, 14, 19, 20, 45, 55 
Example 3 .......................................................... 54 
CANdesc.......................................... 11, 14, 15, 33 
Examples ........................................................... 52 
Ndesc
CA
 tab.......................................................15 
Extended Session .............................................. 45 
CANgen
.............
.........
........................................26 
CanInitPowerOn .................................................33 
G 
CANoe ..........................................................41, 42 
Generate Files ................................................... 29 
CDD ..............................................................

11, 1
Generated .............................................. 11, 17, 23 
Compile.........................................................24, 41 
Generation Process ..................................... 11, 15 
compiler ..............................................................
 
32
Generation Tool ........................................... 14, 26 
onfiguration
C
................................... 24, 26, 35, 40 
GENy ................................................................. 26 
c c
y lic calls ...........................................................33 
I 
D 
Include ......................................................... 24, 33 
data .....................................................................19 
Initialization .................................................. 24, 33 
DBC ....................................................................14 
initParameter...................................................... 33 
DBC file...............................................................14 
K 
Default session ...................................................45 
KWP2000........................................................... 16 
delay ...................................................................38 
desc.c .................................................................30 
L 
desc.h ...........................................................30, 33 
Linear Diagnostic Buffer .................................... 48 
desccore.h ..........................................................30 
Link .............................................................. 24, 41 
DescInitPowerOn................................................33 
M 
DescRingBufferGetProgress ..............................52 
MainHandler........................................... 24, 32, 38 
DescRingBufferStart ...........................................51 
makefile.............................................................. 32 
© Vector Informatik GmbH 
Version 1.7 
- 70 - 

User Manual CANdesc  
Index 
N 
Service ............................................................... 18 
Nomenclature .................................. 11, 17, 18, 19 
service primitives ............................................... 19 
None .......................................................11, 17, 23 
Sessions ............................................................ 45 
signal.................................................................. 38 
O 
State Groups................................................
 
44, 45
OEM........................................................11, 17, 23 
e Handlin
Stat
g ............................................. 44, 45 
OSEK Transport 
to
Pro col ...................................26 
States ...........................................................
 
44, 45
P 
T 
Programming session .........................................45 
Test ........................................................ 24, 41, 42 
roperies
P
............................................................38 
test environment ................................................ 41 
protocol service...................................................18 
transition to state................................................ 47 
R 
Transitions ......................................................... 45 
RAM consumption ........................................48, 49 
U 
Repeated Service Call Feature ..........................55 
UDS ................................................................... 16 
Request ..............................................................18 
User ....................................................... 11, 17, 23 
Response............................................................18 
User-Defined Handlers ...................................... 35 
Response Pending .............................................38 
Ring Buffer Mechanism ......................................49 
V 
value field........................................................... 39 
S 
variable .............................................................. 38 
security access ...................................................45 
 
© Vector Informatik GmbH 
Version 1.7 
- 71 - 


 
 
Get more Information! 
Visit our Website for: 
> News 
> Products 
> Demo Software 
> Support 
> Training Classes 
> Addresses 
 
 
 
 
 
 
 
 
www.vector-worldwid .com 

e
 

Document Outline


Last modified July 6, 2025: Initial commit (5e3f2e6)