Documentation
#Documentation
BSW_TMS570_PSA
Automotive Basic Software (BSW) modules for the Texas Instruments TMS570 microcontroller platform, tailored for PSA (Peugeot Société Anonyme) automotive requirements. This repository provides core communication, transport, and diagnostic layers, including PSA-specific network management and application interfaces.
Features
Project Structure (partial)
BSW/
├── Il/ # Interaction Layer (il.c, il_def.h)
├── Tp/ # Transport Protocol (tpmc.c)
├── Xcp/ # XCP Protocol and CAN adaption (xcp_can.c, xcp_can.h, XcpProf.c, _xcp_appl.c)
├── Nm/ # PSA Station Manager (Stat_mgr.h)
└── VStdLib/ # Vector standard library (vstdlib_lib.asm)
Doc/
└── DeliveryInformation/ # Delivery documentation
Note: Only a subset of files/folders is shown.
For the full structure, browse the repo.
Documentation
Getting Started
Prerequisites
- Hardware: TI TMS570 series microcontroller (e.g., 0812BPGEQQ1)
- Compiler: Texas Instruments 4.9.5
- Environment: Suitable for integration with Vector CANbedded stack and PSA automotive projects
Usage
- Integrate the BSW modules with your automotive ECU application.
- Use the Station Manager (
BSW/Nm/Stat_mgr.h
) for PSA-specific network management. - Include the Interaction and Transport Layer modules for CAN communication and diagnostics.
- The XCP modules enable measurement and calibration over CAN.
License
This project is licensed under the MIT License.
See LICENSE for details.
Disclaimer
Some files are provided “as is” and without warranty.
See module headers and delivery documentation for details.
If you add new documentation, place it in the Doc/
directory and update this README.
1 - Documentation
Documentation
1.1 - Doc
Doc
ApplicationNotes
TechnicalReferences
UserManuals
1.1.1 - AN-ISC-2-1029_Transceiver_Handling
Transceiver Handling1.1.2 - AN-ISC-2-1029_Transceiver_Handling_ind
Page 1Page 2Page 3Page 41.1.3 - AN-ISC-2-1029_Transceiver_Handlings
Transceiver Handling Version 1.2 2007-09-17 Application Note AN-ISC-2-1029
Author(s) Hussain
Darwish
Restrictions Restricted
membership
Abstract
This application note describes how to handle the transceiver before or after calling Vector's API.
Table of Contents
1.0 Introduction ......................................................................................................................................................
1 2.0 Transceiver Handling .......................................................................................................................................
2 2.1 Initialization....................................................................................................................................................
2 2.2 Sleep Mode ...................................................................................................................................................
2 2.3 Wakeup .........................................................................................................................................................
2 3.0 Special Considerations ....................................................................................................................................
2 3.1 Possible Deadlock.........................................................................................................................................
2 3.2 Return Value of the Function CanSleep() .....................................................................................................
3 4.0 CAN Communication Layer (CCL)...................................................................................................................
3 5.0 Contacts...........................................................................................................................................................
3 1.0 Introduction
In communications, transceivers are used to convert the voltage level of the signal to a different signal form such
as lights, frequency or even different voltage level. the appropriate bus voltage level to communicate through a
medium. to be more resistant to transient noise, and reduce the Electromagnetic Emission (EME). Transceivers
also detect collisions in the bus. There are different transceivers for different applications. For instance, the
automotive industry uses three types of transceivers:
1.
High Speed Transceivers (ISO 11898-2): the most common type used in the automotive industry. They
are mostly used in power train buses and can handle baud rates up to 1Mbps.
2.
Fault-Tolerant Transceivers (ISO 11898-3): used mostly in slow baud rate buses like body bus and can
handle baud rates up to 125kbps. The major advantage of this type of transceivers is that they can
communicate without errors even if one bus line gets disconnected, shorted to ground or battery. Also,
they can communicate without errors if both bus lines are shorted together. However, they cannot
communicate if both bus lines are disconnected, shorted to ground or battery. Up to 32 nodes can be
connected to the fault-tolerant bus.
MicroconTx
TranscRx
troleiverSTB
CANL
ler EN
CAN
H
Figure 1: High-Speed and Fault-Tolerant Transceiver Wiring
Copyright © 2007 - Vector Informatik GmbH 1 Contact Information: www.vector-informatik.com or +49 (0)711 80670-0
Transceiver
Handling
When using Vector’s embedded software, the user has to switch the transceiver to a certain mode before or after
calling specific functions. In the following sections, the transceiver handling is explained.
2.0 Transceiver Handling
Essentially, the transceiver shall be handled in three situations:
1. During initialization (after a reset)
2. After putting the CAN cell into sleep mode
3. During a wakeup
2.1 Initialization The transceiver must be switched into Normal mode before calling the CAN driver initialization function
CanInitPowerOn(). Some CAN cells needs to monitor 11 consecutive recessive bits to initialize (or enter
configuration mode). If the CAN transceiver is not in Normal mode, it may assert the Rx line to a dominant state.
Consequently, if the transceiver is not in Normal mode and the function
CanInitPowerOn() (or
CanInit()) is
called, the function may not finish executing as it is waiting for 11 recessive bits to synchronize the CAN cell to the
bus. Some CAN cells do not need to monitor any recessive bit to initialize and thus the transceiver do not have to
be in Normal mode before calling the CAN driver initialization function. However, for consistency and portability
reasons, we strongly recommend that the transceiver is in Normal mode before calling the initialization function.
2.2 Sleep Mode When using the sleep mode feature of the CAN cell, make sure to switch the transceiver into low-power or standby
mode AFTER switching the CAN cell into sleep mode. In other words, the transceiver should be switched into low-
power or standby mode only after calling the function
CanSleep(). If the function
CanSleep() returns
kCanFailed,
the application must not put the transceiver into low-power or standby mode.
2.3 Wakeup When the application wants to wake up the CAN cell to transmit a message, he/she shall switch the transceiver
into Normal mode before waking the CAN cell (or calling the function
CanWakeUp()), Some CAN cells cannot
wakeup properly until they monitor 11 consecutive recessive bits in the bus. If the transceiver is not in Normal
state, it may assert the Rx line to dominant state (due to a received wakeup signal from the CAN bus).
Consequently, the
CanWakeUp() function may not finish executing as it is waiting for 11 recessive bits to synchronize the CAN
cell to the bus.
3.0 Special Considerations 3.1 Possible Deadlock Make sure that the CAN cell is in sleep mode when the transceiver is in sleep or standby mode. If the CAN cell is
not in sleep mode and the transceiver is in sleep or standby mode, activities from the bus will never be detected.
This is because the CAN cell wakes up from the sleep mode when it detects a dominant bit on the Rx pin. When
the transceiver is in sleep or standby mode, it will try to wake up the CAN cell by signaling a dominant level on the
Rx pin. From there, the microcontroller will send a wakeup event to the application and the application will switch
the transceiver into Normal mode.
On the other hand, if the transceiver is in sleep or standby mode while the CAN cell is in Normal operation mode,
the microcontroller will never detect a wakeup event as the CAN cell is not in sleep mode. Since the wakeup event
Application Note AN-ISC-2-1029 2
Transceiver
Handling
is not detected nor passed to the application (via the function
ApplCanWakeUp()), the application may never be
able to switch the transceiver into Normal mode. Consequently, the application will not be able to transmit nor
receive CAN messages on the bus and may stick in a deadlock situation.
3.2 Return Value of the Function CanSleep() As a result of the possible deadlock mentioned in the previous section, the application must check the return value
of the function
CanSleep() when calling it. If
CanSleep() returns
kCanOk, the application can put the
transceiver into sleep or standby mode. If
CanSleep() returns
kCanFailed, the state of the CAN cell might be
unknown and thus the application must not put the transceiver into sleep or standby mode. In this case, the CAN
cell might be in sleep or normal operation mode depending on the hardware. What to be done if
CanSleep() returns
kCanFailed is OEM specific.
Pseudocode example:
if(CanSleep() == kCanOk) { DeactivateTransceiver(); /* Application function to put the transceiver into standby or sleep mode */ } 4.0 CAN Communication Layer (CCL)
To make the implementation more consistent, Vector offers a layer called ‘Communication Control Layer (CCL)’
that takes care of transceiver handling (including initialization, sleep, wakeup, and power-off). In addition, this layer
controls all other Vector’s software layers initializations and tasks. In other words, CCL is an abstraction layer that
provides a more consistent interface to the application.
For more information on the CCL layer, please visit our website or contact us.
5.0 Contacts
Vector Informatik GmbH Vector CANtech, Inc. VecScan AB Ingersheimer Straße 24
39500 Orchard Hill Pl., Ste 550
Lindholmspiren 5
70499 Stuttgart
Novi, MI 48375
402 78 Göteborg
Germany
USA
Sweden
Tel.: +49 711-80670-0
Tel: +1-248-449-9290
Tel: +46 (0)31 764 76 00
Fax: +49 711-80670-111
Fax: +1-248-449-9704
Fax: +46 (0)31 764 76 19
Email: info@vector-informatik.de
Email: info@vector-cantech.com
Email: info@vecscan.com
Application Note AN-ISC-2-1029 3
Transceiver
Handling
Vector France SAS Vector Japan Co. Ltd. 168 Boulevard Camélinat
Seafort Square Center Bld. 18F
92240 Malakoff
2-3-12, Higashi-shinagawa,
France
Shinagawa-ku
Tel: +33 (0)1 42 31 40 00
J-140-0002 Tokyo
Fax: +33 (0)1 42 31 40 09
Tel.: +81 3 5769 6970
Email: information@vector-france.fr
Fax: +81 3 5769 6975
Email: info@vector-japan.co.jp
Application Note AN-ISC-2-1029 4
1.1.4 - AN-ISC-2-1035_Start_Stop_Periodic_Transmission_IL
Start Stop Periodic Transmission with IL1.1.5 - AN-ISC-2-1035_Start_Stop_Periodic_Transmission_IL_ind
Page 1Page 2Page 3Page 4Page 51.1.6 - AN-ISC-2-1035_Start_Stop_Periodic_Transmission_ILs

Start Stop Periodic Transmission with IL Version 1.3 2007-08-14 Application Note AN-ISC-2-1035
Author(s) Gunnar
Meiss
Restrictions Restricted
membership
Abstract
Start and stop a periodical transmission of the Interaction Layer.
Table of Contents
1.0 How to start and stop periodic transmission....................................................................................................
1 1.1 Manufacturer, Hardware platform, derivative................................................................................................
1 1.2 Problem Description ......................................................................................................................................
1 1.3 Problem Solution ...........................................................................................................................................
1 1.3.1 Additional Configuration of the Interaction Layer in CANgen .....................................................................
2 1.3.2 Configuration of the Interaction Layer in GENy ..........................................................................................
3 1.3.3 Additional Functions Provided by the Interaction Layer Kernel..................................................................3 2.0 Contacts...........................................................................................................................................................
5 1.0 How to start and stop periodic transmission 1.1 Manufacturer, Hardware platform, derivative There are no dependencies between manufacturer, hardware platform and derivative according to this problem.
1.2 Problem Description After the transmission path of the IL was started ( IlTxStart() ) the transmission of cyclic message takes place.
Nothing further is needed to be done to keep the transmission running. The cycle time must be pre-configured in
the network database at compile time. Some applications need to stop and restart the periodic transmission for
individual messages.
1.3 Problem Solution The periodical transmission can be stopped and restarted by the application optionally. Therefore the Interaction
Layer provides some additional service functions. The function IlStopCycle(<IlMessageHandle>) stops the periodic
transmission of a message, the function IlStartCycle(<IlMessageHandle>) restarts the periodic transmission.
Each call of the function IlTxStart() starts the cyclic transmission. In some cases it might be necessary to avoid the
cyclic transmission after IlTxStart(). Therefore it is possible to call the function IlStopCycle(<IlMessageHandle>)
within the callback function ApplIlTxStart(). This disables the cyclic transmission of a message immediately after
IlTxStart(). In this case the cyclic transmission will not be started for this message.
Caution This API shall
never be performed on Messages containing multiplexed signals.
1 Copyright © 2007 - Vector Informatik GmbH
Contact Information: www.vector-informatik.com or ++49-711-80 670-0

Start Stop Periodic Transmission with IL
1.3.1 Additional Configuration of the Interaction Layer in CANgen Figure 1 - Configuration of the Interaction Layer in the Generation Tool
Figure 1 shows a screen shot of the configuration tool CANgen. Within the tab IL options the Interaction Layer
could be configured. The relevant option on this tab is shown in the table below.
Parameter
Value
Meaning
Reference
Use start/stop On/Off
This option is necessary if periodic transmission should
of periodic
be stopped and restarted during runtime.
messages
Table 1 – Il options tab
2 Application Note AN-ISC-2-1035

Start Stop Periodic Transmission with IL
1.3.2 Configuration of the Interaction Layer in GENy Figure 2 – Start/Stop API in GENy
Figure 2 shows a screen shot of the configuration tool GENy. On the configuration view of
Il Vector the Interaction
Layer could be configured. The Start/Stop API is the relevant option you have to activate if periodic transmission
should be stopped and restarted during runtime.
1.3.3 Additional Functions Provided by the Interaction Layer Kernel Name:
IlStartCycle Standard
void IlStartCycle (IlTransmitHandle ilTxHnd);
Prototype:
Multi Channel
void IlStartCycle_
X(IlTransmitHandle ilTxHnd);
Prototype:
with X = 0... Number of CAN channel
Indexed
void IlStartCycle (IlTransmitHandle ilTxHnd);
Prototype:
Argument(s):
ilTxHandle
IL Handle of the messages for with the cyclic transmitted
should
be
restarted
The generated
<IlMessageHandle> shall be used:
In CANgen (ilpar.h):
_ILTx<MessageName>
In GENy (il_par.h):
IlTxMsgHnd<MessageName>
Return: None
Description:
This function restarts the periodical transmission of a message and shall be called
on task level. Due to this that all timing counters are set in the state transition tx start
the callback function ApplIlTxStart may be used to implement the changed cycle
time behavior.
Table 2 – Description of IlStartCycle
Name:
IlStopCycle Standard
void IlStopCycle (IlTransmitHandle ilTxHnd);
Prototype:
3 Application Note AN-ISC-2-1035
Start Stop Periodic Transmission with IL
Multi Channel
void IlStopCycle_
X(IlTransmitHandle ilTxHnd);
Prototype:
with X = 0... Number of CAN channel
Indexed
void IlStopCycle (IlTransmitHandle ilTxHnd);
Prototype:
Argument(s):
ilTxHandle
IL Handle of the messages for with the cyclic transmitted
should
be
stopped
The generated
<IlMessageHandle> shall used:
In CANgen (ilpar.h):
_ILTx<MessageName>
In GENy (il_par.h):
IlTxMsgHnd<MessageName>
Return: None
Description:
This function stops the periodical transmission of a message and shall be called on
task level.
Table 3 – Description of IlStopCycle
4 Application Note AN-ISC-2-1035
Start Stop Periodic Transmission with IL
2.0 Contacts
Vector Informatik GmbH Vector CANtech, Inc. VecScan AB Ingersheimer Straße 24
39500 Orchard Hill Pl., Ste 550
Lindholmspiren 5
70499 Stuttgart
Novi, MI 48375
402 78 Göteborg
Germany
USA
Sweden
Tel.: +49 711-80670-0
Tel: +1-248-449-9290
Tel: +46 (0)31 764 76 00
Fax: +49 711-80670-111
Fax: +1-248-449-9704
Fax: +46 (0)31 764 76 19
Email: info@vector-informatik.de
Email: info@vector-cantech.com
Email: info@vecscan.com
Vector France SAS Vector Japan Co. Ltd. 168 Boulevard Camélinat
Seafort Square Center Bld. 18F
92240 Malakoff
2-3-12, Higashi-shinagawa,
France
Shinagawa-ku
Tel: +33 (0)1 42 31 40 00
J-140-0002 Tokyo
Fax: +33 (0)1 42 31 40 09
Tel.: +81 3 5769 6970
Email: information@vector-france.fr
Fax: +81 3 5769 6975
Email: info@vector-japan.co.jp
5 Application Note AN-ISC-2-1035
1.1.7 - AN-ISC-2-1052_CANbedded_and_Operating_Systems
CANbedded and Operating Systems1.1.8 - AN-ISC-2-1052_CANbedded_and_Operating_Systems_ind
Page 1Page 2Page 3Page 4Page 51.1.9 - AN-ISC-2-1052_CANbedded_and_Operating_Systemss
CANbedded and Operating Systems Version 1.0 2007-01-18 Application Note AN-ISC-2-1052
Author(s) Hartmut
Hörner, Patrick Markl
Restrictions Restricted
Membership
Abstract
The Vector CANbedded software components have some requirements for the run-time
environment. These requirements are described in this application note.
Table of Contents
1.0 Overview ..........................................................................................................................................................
1 2.0 General Requirements.....................................................................................................................................
1 3.0 Interrupt Handling ............................................................................................................................................
2 3.1 Interrupt Service Routines (ISRs) .................................................................................................................
2 3.2 Access to interrupt control registers..............................................................................................................
2 4.0 Data consistency..............................................................................................................................................
3 5.0 Memory protection and virtual memory management .....................................................................................
3 6.0 Privilege modes ...............................................................................................................................................
4 7.0 Operating systems with stringent driver models..............................................................................................
4 8.0 Startup Time ....................................................................................................................................................
5 9.0 Contacts...........................................................................................................................................................
5 1.0 Overview
The Vector CANbedded components have some requirements for the run-time environment. Some of these might
impact the usage of the operating system elements as well as the real-time design.
Two run-time environments are explicitly supported by CANbedded:
• A system without operating system
• An OSEK Operating System (version 2.1r1 onwards) such as Vector osCAN
In the following chapters the requirements are listed and for some cases where no explicitly support exists
workarounds are described.
2.0 General Requirements
Higher layer CANbedded components require an initialization function and one or more cyclic functions.
CANbedded hardware drivers have an initialization function, ISRs in interrupt driven mode and cyclic functions in
polling mode. The initialization function must be called before the cyclic function is called for the first time and
before the first ISR occurs.
The CANbedded stack requires a shared address space with the application since some functionalities such as
signal and flag access are implemented by macros.
There are no requirements for dynamic memory management. All not constant global variables are explicitly
initialized in the initialization functions. There are no requirements for memory initialization in the start-up code
unless constant data is located in RAM.
1 Copyright © 2007 - Vector Informatik GmbH
Contact Information: www.vector-informatik.com or ++49-711-80 670-0
CANbedded and Operating Systems
Since the CANbedded components have to interface directly with the communication hardware adequate access
privileges are required.
3.0 Interrupt Handling 3.1 Interrupt Service Routines (ISRs) If the CAN Driver is used in an interrupt driven mode one or more ISRs must be installed.
Two categories of ISRs are supported:
• ISR implemented with the related compiler pragma or qualifier. This is used in a system without operating
system and for OSEK-OS ISRs of category 1.
• OSEK-OS ISR category 2.
If an operating system other than OSEK is used the following workaround is possible:
If OSEK-OS and OSEK-OS category 2 ISR support are selected in the generation tool the ISR has the following C
syntax:
ISR(CanInterrupt)
{
…
}
Supply a header file osek.h with the following macro, to make the ISR available in other modules as a void-void
function.
#define ISR(x) void x(void)
Example for an operating system which provides a service OSRegisterISR to register an ISR:
OSRegisterISR(CanInterrupt, 10); /* second parameter is interrupt vector number */
If the prototype of the ISR required by the OS is not of the kind void x(void) an intermediate function must be used
to circumvent type conflicts.
3.2 Access to interrupt control registers To achieve its own data consistency and to export such services to the application the CANbedded components
require access to the interrupt control registers of the communication controller and to interrupt control registers of
the interrupt controller or the CPU which allow to disable interrupts globally or up to a certain level.
If it is not desirable or possible that the CANbedded components access the global interrupt directly this
functionality can be replaced by other mechanisms (“interrupt control by application”, supported in CAN driver RI
version 1.4 onwards).
If a resource locking mechanism of the operating system is used it must support nested critical sections.
2 Application Note AN-ISC-2-1052
CANbedded and Operating Systems
4.0 Data consistency
For efficiency reasons some services of the CANbedded components are implemented as macros with
unprotected critical sections. If these macros are used in multiple full-preemptive tasks or in multiple ISRs data
consistency problems can be caused. One of the following solutions is possible:
• Use these services only in non-preemptable tasks
• Use these services only in one cooperative task group (OSEK: internal resource concept)
• Supply critical section in the application code
Some CANbedded components have specific requirements concerning processing priorities and reentrancy. These
requirements are described in the technical reference of the individual component.
5.0 Memory protection and virtual memory management
This chapter is only applicable if the processor and the run-time environment support such mechanisms. Since some CANbedded services are implemented as macros which access to global variables the application part
which uses the CANbedded services and the complete CANbedded stack must reside in one address space.
In addition all CANbedded tasks and ISRs must be able to access the peripheral address space of the
communication hardware.
The following figure shows a possible configuration with three different applications with an own address space.
Two applications perform application tasks (drawn in green), one application is responsible for the communication
(drawn in red).
Application 1
Application 2
Communication application
CANbedded stack
Communication hardware
Figure 1 Different applications with own address space
To move data between the applications operating system services are required which have the capability to tunnel
the address barrier (drawn with blue arrows)..
3 Application Note AN-ISC-2-1052
CANbedded and Operating Systems
6.0 Privilege modes
This chapter is only applicable if the processor and the run-time environment support such mechanisms.
In some architectures different privilege modes such as user and supervisor mode are defined. If a task or ISR is
running in user mode the access to peripheral hardware and global resources such as interrupt control registers
may be restricted.
It must be possible to assign all tasks and ISRs which provide or use CANbedded services a sufficient privilege
level to allow for:
• Access to communication hardware
• Access to communication related interrupt control
• Access to global interrupt control registers including the capability to execute instructions related to global
interrupt control registers unless interrupt control by application is used (s. chapt
er 3.2). If such a privilege level is not possible for tasks but only for ISRs a cyclic timer ISR can be used to perform all
required CANbedded cyclic processing. Note that such an ISR must have a lower interrupt level than the ISRs of
the CANbedded drivers.
7.0 Operating systems with stringent driver models
This chapter is only applicable if the run-time environment supports such mechanisms.
In some operating systems hardware access is only allowed for specific hardware drivers which have to follow a
predefined implementation model. When a hardware driver is called in such a system the required privileges are
assigned. To allow the usage of CANbedded a wrapper layer between application and CANbedded is required to
implement the required driver interface.
Such a design is illustrated in the figure below, the driver interface is drawn with blue arrows:
Application 1
Application 2
Wrapper layer
CANbedded stack
Figure 2 With Wrapper Layer
4 Application Note AN-ISC-2-1052
CANbedded and Operating Systems
8.0 Startup Time
Some Operating systems (especially more sophisticated and larger ones) are running out of RAM, while the
binaries are stored in non-volatile memories like Flash. This requires that the startup code transfers the OS image
into RAM after power on reset. Depending on the size of the OS image this can take up to several hundreds of
milliseconds. As a consequence the initialization of the CANbedded stack occurs after the kernel is loaded
completely. Often this long startup times do not match the OEMs’ startup requirements. There are two possibilities
to solve this issue. Either the OEM accepts the longer startup time or the operating system supports a mechanism
that allows initialization of the CANbedded stack before the kernel is loaded completely.
If the operating system supports some kind of a runtime environment before the kernel is loaded it could be also
relevant to have a possibility to hand over the information received during the startup phase via CAN to the fully
loaded kernel environment.
9.0 Contacts
Vector Informatik GmbH Vector CANtech, Inc. VecScan AB Ingersheimer Straße 24
39500 Orchard Hill Pl., Ste 550
Lindholmspiren 5
70499 Stuttgart
Novi, MI 48375
402 78 Göteborg
Germany
USA
Sweden
Tel.: +49 711-80670-0
Tel: +1-248-449-9290
Tel: +46 (0)31 764 76 00
Fax: +49 711-80670-111
Fax: +1-248-449-9704
Fax: +46 (0)31 764 76 19
Email: info@vector-informatik.de
Email: info@vector-cantech.com
Email: info@vecscan.com
Vector France SAS Vector Japan Co. Ltd. 168 Boulevard Camélinat
Seafort Square Center Bld. 18F
92240 Malakoff
2-3-12, Higashi-shinagawa,
France
Shinagawa-ku
Tel: +33 (0)1 42 31 40 00
J-140-0002 Tokyo
Fax: +33 (0)1 42 31 40 09
Tel.: +81 3 5769 6970
Email: information@vector-france.fr
Fax: +81 3 5769 6975
Email: info@vector-japan.co.jp
5 Application Note AN-ISC-2-1052
1.1.10 - AN-ISC-2-1081_Interrupt_Control_VStdLib
Application Interrupt Control with VStdLib1.1.12 - AN-ISC-2-1081_Interrupt_Control_VStdLibs

Application Interrupt Control with VStdLib Version 1.0 2008-08-06 Application Note AN-ISC-2-1081
Author(s) Patrick
Markl
Restrictions Restricted
Membership
Abstract
This application note explains how the application can control interrupt handling via the
VStdLib and which constraints apply.
Table of Contents
1.0 Overview ..........................................................................................................................................................
1 1.1 Introduction....................................................................................................................................................
1 2.0 Interrupt Control by Application .......................................................................................................................
3 2.1 Constraints ....................................................................................................................................................
3 2.1.1 Constraint 1: Nested Calls ..........................................................................................................................
3 2.1.2 Constraint 2: Recursive Calls when Disabling CAN Interrupts...................................................................3 2.1.3 Constraint 3: No Locking when Disabling CAN Interrupts..........................................................................
3 3.0 Solution ............................................................................................................................................................
6 3.1.1 Nested Calls................................................................................................................................................
6 3.1.2 No Locking of Interrupts..............................................................................................................................
7 4.0 Referenced Documents .................................................................................................................................
12 5.0 Contacts.........................................................................................................................................................
13 1.0 Overview
This application note describes how the user can configure the interrupt control options of the VStdLib. Some
applications provide their own lock/unlock functions, which better fulfill the application’s needs. Because of this the
VStdLib provides a means which allows the application to use it’s own lock/unlock functions, instead of the
implementation provided by the VStdLib.
This application note describes the handling of this use case in more detail.
1.1 Introduction The VStdLib provides functions to lock/unlock interrupts. There are three options to be set in the configuration tool,
as shown in figure1. The first option (Default) lets the VStdLib lock global interrupts. Depending on the hardware
plattform it is also possible to lock interrupts to a certain level. The lock is implemented by the VStdLib itself.
Figure 1: Possible configuration options for VStdLib interrupt control
1 Copyright © 2008 - Vector Informatik GmbH
Contact Information: www.vector-informatik.com or ++49-711-80 670-0


Application Interrupt Control with VStdLib
The second option (OSEK) is to configure the VStdLib in a way that locking of interrupts is done by means of
OSEK OS functions. The third and last option (User defined) requires the application to perform the
locking/unlocking functionality within callback functions.
This application note focusses mainly on the third option. It describes the way the application has to implement the
callback functions required by the VStdLib.
Figure 2: Configuration of interrupt control by application
Figure 2 shows the VStdLib configuration dialog, if interrupt control by application is configured. The user has to
enter the names of two functions in the dialog, which will be called by the VStdLib in order to lock/unlock interrupts.
If the user has specified the callback function names as shown in figure 2, the application must provide the
implementations of these two two functions. The prototypes are:
void ApplNestedDisable(void);
void ApplNestedRestore(void);
From now on these two function names will be used within this application note.
These two functions are called by the VStdLib, in case any Vector component requests a lock for a critical section.
The user has to make sure that the locking mechanism within these two functions is sufficient to protect data. This
depends heavily on the architecture of the application. The more priority levels exists, which call Vector functions,
the more restrictive the lock must be.
Please check the technical references of the other Vector components for restrictions regarding the call
context of the API functions.
2 Application Note AN-ISC-2-1081

Application Interrupt Control with VStdLib
2.0 Interrupt Control by Application
This configuration option is usually used, if a global lock is not desired by the user or special lock mechanisms are
used. Once this option is configured, there are two functions to be provided by the application. The user can
specify the names of these functions in the configuration dialog of the VStdLib. The VStdLib calls these functions
instead of directly locking/unlocking interrupts. This means, if any Vector component requests an interrupt lock, it is
finally performed by the application provided functions.
The first function is called, in order to perform a lock operation. It is expected, that the application function stores
the current interrupt state(or any other), in order to restore it later. The second function is to restore the previously
saved lock state.
The implementation of these two functions is up to the user. The user may lock just certain interrupt sources or set
a mutex, semaphore or whatever ensures consistent data and fulfills the call context requirements, described in the
Vector component specific technical references.
2.1 Constraints The usage of Interrupt Control by Application has some constraints, which have to be taken into account. The
following chapters describe them.
2.1.1 Constraint 1: Nested Calls It is expected that the two callback functions (ApplNestedDisable()/-Restore()) are implemented in a way that
nested calls are possible. This means if the function ApplNestedDisable() was called by some software component
it may happen that this function is called again from somewhere else. This has to be taken into account when
saving and restoring the interrupt state! The implementer of these two function can assume that the number of lock
and unlock calls is identical and nesting is balanced.
2.1.2 Constraint 2: Recursive Calls when Disabling CAN Interrupts Instead of implementing an own lock mechanism, the user could configure interrupt control by application and call
the CAN driver’s CanCanInterruptDisable()/-Restore() functions. These two function simply disable CAN interrupts
for the given CAN channel. These two CAN driver functions protect the access to their state variables by means of
the VStdLib’s lock mechanism, which would again be implemented by the callbacks provided by the application.
This would cause an indirect recursion.
Please note that CanCanInterruptDisable()/Restore() shall not be called from
ApplNestedDisable()/Restore(). This application note does not provide a solution for this use case!
2.1.3 Constraint 3: No Locking when Disabling CAN Interrupts One could think of letting the application directly modify the interrupt flags of the CAN controller, to overcome the
recursion, described in the previous chapter. But this would cause the CAN interrupts to be never locked, when
CanCanInterruptDisable() is called, by any component. The reason is that the application’s interrupt lock code
would interfere with the code in the CAN driver’s function CanCanInterruptDisable(). The following pseudo code
shows the way CanCanInterruptDisable() is implemented. It is assumed that ApplNestedDisable()/-Restore() are
implemented to allow nested calls.
3 Application Note AN-ISC-2-1081
Application Interrupt Control with VStdLib
/* CAN Interrupt will be never locked in this example!!! */
void CanCanInterruptDisable(CAN_CHANNEL_CANTYPE_ONLY)
{
ApplNestedDisable();
Lock CAN interrupts
ApplNestedRestore();
}
void ApplNestedDisable(void)
{
Save current CAN interrupt state();
Lock CAN Interrupts();
}
void ApplNestedRestore(void)
{
Restore CAN interrupts to previous state();
}
Figure 3 shows what happens in this case. The function CanCanInterruptDisable() calls ApplNestedDisable() in
order to protect an internal counter. This lock function disables the CAN interrupts, afterwards the CAN driver’s
function locks the CAN interrupts too. The next thing is to call ApplNestedRestore() which again is implemented by
the application and restores the previous CAN interrupt state – in this case enables the CAN interrupts. Now an
inconsistency exists. The code which called CanCanInterruptDisable() assumes locked CAN interrupts, but they
aren’t
4 Application Note AN-ISC-2-1081
Application Interrupt Control with VStdLib
sd FailedLockComponent
CAN Driver
Application
CAN Controller
CanCanInterruptDisable
VStdGlobalInterruptDisable
Lock CAN Interrupt
Lock CAN Interrupt
VStdGlobalInterruptRestore
Unlock CAN Interrupt
Figure 3: Sequence diagram of CanCanInterruptDisable()
5 Application Note AN-ISC-2-1081
Application Interrupt Control with VStdLib
3.0 Solution
This chapter proposes a solution and a code examples, to overcome the constraints 1 and 3 described in the
previous chapters.
3.1.1 Nested Calls Solving the first issue – nested calls – is simply done by introducation of a nesting counter. The callbacks
implemented by the application need to manage this counter. The counter is to be incremented, if the function to
lock interrupts is called and decremented if the unlock function is called. The application has to take care to
initialize this counter, before any Vector function is called, in order to ensure a consistent interrupt locking.
The interrupt state is to be modified only if the counter has the value zero. If the value is greater than zero, the
counter is just maintained. The following code example shows, how this nested counter could be implemented.
/* Global variable as nesting counter */
vuint8 gApplNestingCounter;
/* Must be called before the Vector components are initialized! */
void SomeApplicationInitFunction(void)
{
gApplNestingCounter = (vuint8)0;
}
void ApplNestedDisable(void)
{
/* check counter – lock if counter is 0 */
if((vuint8)0 == gApplNestingCounter)
{
/* Save current state and perform lock */
ApplicationSpecificSaveStateAndLock();
}
/* increment counter – do not disable if nested, because already done */
gApplNestingCounter++;
}
void ApplNestedRestore(void)
{
gApplNestingCounter--;
if((vuint8)0 == gApplNestingCounter)
{
6 Application Note AN-ISC-2-1081
Application Interrupt Control with VStdLib
ApplicationSpecificRestoreToPreviousState();
}
}
3.1.2 No Locking of Interrupts Constraint 3 described a situation, in which the CAN interrupts are not locked at all. This is because the application
implements a lock function, which modifes the CAN interrupt registers with own code. To overcome this issue, a
global flag needs to be implemented. This global flag tells the application, when to lock or unlock CAN interrupts.
The flag is set within two additional callback functions to be implemented by the application. The prototypes of the
additional callbacks are:
void ApplCanAddCanInterruptDisable(CanChannelHandle channel);
void ApplCanAddCanInterruptRestore(CanChannelHandle channel);
The callback functions are called by the CAN driver from within the functions CanCanInterruptDisable() and
CanCanInterruptRestore() and have to be enabled by means of the preprocessor define
C_ENABLE_INTCTRL_ADD_CAN_FCT. This is done, by creating a user config file, which contains this definition.
More information about these two functions can be found in [1].
The sequence diagrams in figure 4 and figure 5 show the lock and unlocking procedure respectively.
7 Application Note AN-ISC-2-1081
Application Interrupt Control with VStdLib
sd InterruptControlByApplication_LockComponent
CAN Driver
VStdLib
Application
CanCanInterruptDisable
CanNestedGlobalInterruptDisable
ApplDisableFunc
Lock if
Flag
cleared
Lock CAN Interrupts
ApplCanAddCanInterruptDisable
Set
Global
Flag
CanNestedGlobalInterruptRestore
ApplRestoreFunc
Unlock
if Flag
cleared
Figure 4: Sequence diagram for locking just CAN interrupts.
8 Application Note AN-ISC-2-1081
Application Interrupt Control with VStdLib
sd InterruptControlByApplication_UnLockComponent
CAN Driver
VStdLib
Application
CanCanInterruptRestore
VStdGlobalInterruptDisable
ApplDisableFunc
Lock if
Flag
cleared
Restore CAN Interrupts
ApplCanAddCanInterruptRestore
Clear Global Flag
VStdGlobalInterruptRestore
ApplRestoreFunc
Unlock
if Flag
cleared
Figure 5: Sequence diagram for unlocking just CAN interrupts
The following code example shows how to implement the handling of the global flag. If the function
CanCanInterruptDisable() is called, it calls the ApplNestedDisable(), in order to protect a counter. This function
locks CAN interrupts using own code. When ApplNestedDisable() returns, the CAN driver locks CAN interrupts too.
Afterwards ApplCanAddCanInterruptDisable() is called. This function is implemented by the application and sets
the global flag. Before the function CanCanInterruptDisable() returns, it calls ApplNestedRestore(). The application,
which implements the restore callback function has to check, if the global flag is set. If yes, the CAN interrupts
must not be unlocked!
If the function CanCanInterruptRestore() is called, first ApplNestedDisable() is called again. Then the CAN driver
unlocks the CAN interrupts (if its nesting counter reached the value zero) and calls the function
ApplCanAddCanInterruptRestore(). Within this function the flag is cleared. If ApplNestedRestore() is called now,
the flag is not set anymore and the restore of the CAN interrupts is performed.
9 Application Note AN-ISC-2-1081
Application Interrupt Control with VStdLib
Note that the application needs to implement also a nesting counter, if it uses own code to lock CAN interrupts, in
order to avoid the issue described by constraint 1. The following code example shows, how to implement the
nesting counter and the flag.
vuint8 gCanLockFlag;
vuint8 gApplNestingCounter;
void ApplicationInitFunction(void)
{
/* initialize the flags */
gCanLockFlag = (vuint8)0;
gApplNestingCounter = (vuint8)0;
}
void ApplNestedDisable(void)
{
if((vuint8)0 == gApplNestingCounter)
{
if((vuint8)0 == gCanLockFlag)
{
Save current CAN interrupt state();
Lock CAN Interrupts();
}
}
gApplNestingCounter++;
}
void ApplNestedRestore (void)
{
gApplNestingCounter--;
if((vuint8)0 == gApplNestingCounter)
{
if((vuint8)0 == gCanLockFlag)
{
Restore CAN interrupts to previous state();
}
10 Application Note AN-ISC-2-1081
Application Interrupt Control with VStdLib
}
}
void ApplCanAddCanInterruptDisable(CanChannelHandle channel)
{
gCanLockFlag = (vuint8)1;
}
void ApplCanAddCanInterruptRestore(CanChannelHandle channel)
{
gCanLockFlag = (vuint8)0;
}
11 Application Note AN-ISC-2-1081
Application Interrupt Control with VStdLib
4.0 Referenced Documents
The following table contains the referenced documents.
Referenced Documents [1] TechnicalReference_CANDriver.pdf
12 Application Note AN-ISC-2-1081
Application Interrupt Control with VStdLib
5.0 Contacts
Vector Informatik GmbH Vector CANtech, Inc. VecScan AB Ingersheimer Straße 24
39500 Orchard Hill Pl., Ste 550
Lindholmspiren 5
70499 Stuttgart
Novi, MI 48375
402 78 Göteborg
Germany
USA
Sweden
Tel.: +49 711-80670-0
Tel: +1-248-449-9290
Tel: +46 (0)31 764 76 00
Fax: +49 711-80670-111
Fax: +1-248-449-9704
Fax: +46 (0)31 764 76 19
Email: info@vector-informatik.de
Email: info@vector-cantech.com
Email: info@vecscan.com
Vector France SAS Vector Japan Co. Ltd. Vector Korea IT Inc. 168 Boulevard Camélinat
Seafort Square Center Bld. 18F
Daerung Post Tower III, 508
92240 Malakoff
2-3-12, Higashi-shinagawa,
Guro-gu, Guro-dong, 182-4
France
Shinagawa-ku
Seoul, 152-790
Tel: +33 (0)1 42 31 40 00
J-140-0002 Tokyo
Republic of Korea
Fax: +33 (0)1 42 31 40 09
Tel.: +81 3 5769 6970
Tel.: +82-2-2028-0600
Email: information@vector-france.fr
Fax: +81 3 5769 6975
Fax: +82-2-2028-0604
Email: info@vector-japan.co.jp
Email: info@vector-korea.com
13 Application Note AN-ISC-2-1081
1.1.13 - AN-ISC-8-1056_CANbedded_Program_Stack_Usage
CANbedded Program-Stack usage1.1.14 - AN-ISC-8-1056_CANbedded_Program_Stack_Usage_ind
Page 1Page 2Page 3Page 4Page 5Page 61.1.15 - AN-ISC-8-1056_CANbedded_Program_Stack_Usages
CANbedded Program-Stack usage Version 1.0 2007/01/08 Application Note AN-ISC-8-1056
Author(s) Andreas
Raisch
Restrictions Customer
confidential
- subject to prior approval by PSC
Abstract
This application note provides basic information on the (program-) stack consumption of
Vector's CANbedded communication components.
Table of Contents
1.0 Overview ..........................................................................................................................................................
1 1.1 Definition “The Stack”....................................................................................................................................
1 1.2 Embedded System Stack Handling...............................................................................................................
2 1.3 Stack-Usage Approach in CANbedded.........................................................................................................
3 1.3.1 Example ......................................................................................................................................................
3 1.3.2 Configuration Aspects.................................................................................................................................
5 1.4 Calculating and Measuring Stack Need........................................................................................................
5 2.0 Summary..........................................................................................................................................................
5 3.0 Contacts...........................................................................................................................................................
6 1.0 Overview
This application note provides basic information on the (program-) stack consumption of Vector’s CANbedded
communication components.
1.1 Definition “The Stack” In computer science, a call stack is a special stack, which stores information about the active subroutines of a
computer program. (The active subroutines are those, which have been called but have not yet completed
execution by returning.) This kind of stack is also known as a program stack, execution stack, control stack,
function stack or run-time stack and is often abbreviated to just "the stack".
The actual details of the stack in a programming language depend upon the compiler, operating system, and the
available instruction set.
As noted above, the primary purpose of the stack is:
•
Storing the return address – When a subroutine is called, the location of the instruction to return to
needs to be saved somewhere.
A stack may serve additional functions, depending on the language, operating system and machine environment.
Among them can be:
•
Local data storage – A subroutine frequently needs memory space for storing the values of local
variables, the variables that are known only within the active subroutine and do not retain values after it
returns.
1 Copyright © 2007 - Vector Informatik GmbH
Contact Information: www.vector-informatik.com or ++49-711-80 670-0

CANbedded Program-Stack usage
•
Parameter passing – Subroutines often require that values for parameters must be supplied to them by
the code which calls them and it is not uncommon that space for these parameters may be laid out in the
stack. Generally if there are only a few small parameters, processor registers will be used to pass the
values. The stack works well as a place for these parameters, especially since each call to a subroutine,
which will have differing values for parameters, will be given separate space on the stack for those values.
•
Other return state – Besides the return address, in some environments there may be other machine or
software states that need to be restored when a subroutine returns. This might include things like
processor registers, privilege level, exception handling information, arithmetic modes and so on. If needed,
this may be stored on the stack just as the return address is.
The typical stack is used for the return address, locals, and parameters (known as a call frame). In some
environments there may be more or fewer functions assigned to the stack.
A stack is composed of stack frames (sometimes called activation records). Each stack frame corresponds to a call
to a subroutine, which has not yet terminated with a return. For example, if a subroutine named DrawLine is
currently running, having just been called by a subroutine DrawSquare, the top part of the stack might be laid out
like this:
The stack frame at the top of the stack is for the currently executing routine. In the most common approach the
stack frame includes space for the local variables of the routine, the return address back to the routine's caller, and
the parameter values passed into the routine. The memory locations within a frame are often accessed via a
register called the stack pointer, which also serves to indicate the current top of the stack. Alternatively, memory
within the frame may be accessed via a separate register, often termed the frame pointer, which typically points to
some fixed point in the frame structure, such as the location for the return address.
Stack frames are not all of the same size. Different subroutines have differing numbers of parameters, so that part
of the stack frame will be different for different subroutines, although usually fixed across all activations of a
particular subroutine. Similarly, the amount of space needed for local variables will be different for different
subroutines.
[Source: Wikipedia]
1.2 Embedded System Stack Handling The bandwidth of embedded system architectures and also the used µC (and compilers) results in a huge variety
of stack handling approaches.
The simplest approach is often valid, when no operating system (OS) is used. In such a case the stack is simply a
2 Application Note AN-ISC-8-1056
CANbedded Program-Stack usage
reserved RAM area used by the whole system.
If an OSEK/OS or AUTOSAR OS is used, the stack handling depends on the available features in the OS and the
underlying µC. Each OS task has usually its own stack but can share this stack if some preconditions are kept with
other tasks. Providing one or more own stacks for interrupts can reduce the stack need of the OS tasks, too.
The stack need of an embedded system depends also on the specific handling for interrupts:
• Storing of CPU registers on the stack or simply switching to a different stack bank
• Supporting/using nested interrupts; i.e. interrupts can cause multiple store actions to the stack
• Configuring own stack(s) for interrupts or using the stack of the currently running OS task (or other
interrupt)
Please note that for most implementations the stack pointer starts at a high address and grows to lower addresses.
1.3 Stack-Usage Approach in CANbedded The CANbedded architecture is optimized for so-called deeply embedded systems with limited RAM and runtime in
real-time systems. As a result of this, the architecture is gained to be a good compromise between
• ROM usage (multiple implementation of same behavior vs. in-lining or calling functions)
• RAM usage (static parameters vs. local parameters on the stack; calling a function vs. implementing
something short twice, …)
• Runtime consumption (calling a function needs more time than local handling)
A CANbedded function shall therefore
• have only few arguments (none, 1 or 2, very very rarely more than 2 parameters)
• be implemented in a way that local data stored on the stack is minimized
• call no other functions unless it is necessary due to layered architecture
Most CANbedded API functions are implemented in a way that only flags are set which are evaluated on a cyclic
function to prevent too deep function call trees (and with this an increased stack need).
An additional task of the CANbedded communication components is the separation of the interrupt driven
hardware handling and the task-level view of the application. To be able to react on communication events
correctly, parts of the handler implementation are executed on interrupt level and parts are executed on task level.
Which stack and how much stacks are used for the task and the interrupt context depends on the underlying
system (see chapte
r 1.2 for details). 1.3.1 Example A typical example for such a CANbedded implementation is a transport protocol, where the reaction on incoming
events has to be fast whereas the timeout and state handling can be slower. The implementation will therefore be
split in a function called within the CAN RX interrupt for fast actions and a cyclic called function for the slower ones.
The same is true for the next upper layer, the diagnostic layer. See
Figure 2 for details how the diagnostic layer
handles the separation of RX event notification in CAN ISR context and further handling on task context.
As a result, the call tree of the RX event handling in ISR context stops latest on diagnostic layer level. All further
handling (including application calls) is processed a few milliseconds later from task level with only very few
function calls on the stack.
3 Application Note AN-ISC-8-1056




















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































CANbedded Program-Stack usage
osCAN
Application
Diagnostics
Layer
Universal
Measure-
Interaction
Network
ment
Layer
Management
And
Communication
Calibration
Control
Transport Protocol
Protocol
Layer
CAN Driver
CAN Controller
Transce
Transc iver
CAN Bus Figure 1 Example CANbedded Stack with CAN Driver, TP and Diagnostic Layer as the largest call-tree
Data
Da
Eve
Ev nt
ready
Cyclic
han
ha dler
flag
hand
ha
l
nd er
CAN
CAN
Transp
Trans ort
Diagnostics
osti
Application
Driver
Protocol
Protoc
Laye
Lay r
Further handling
RX o
RX f TP frame
am
Optional call to application
unknown to std. SW
Copy RX data
dat
Check RX
data ready
Further handling
RX o
RX f last TP frame
am
Optional call to application
unknown to std. SW
Copy RX data
dat
Indicate RX data ready
Check RX
data ready
PreHandler
Further handling
unknown to std. SW
MainHandler
Further handling
unknown to std. SW
ISR/Event context
Task context
Figure 2 Example call-tree for diagnostic data reception
4 Application Note AN-ISC-8-1056
CANbedded Program-Stack usage
1.3.2 Configuration Aspects The configurations of the CANbedded components have a large impact on the stack needs. There is a customer
specific, static setup of CANbedded components which interact together to fulfill the OEM requirements. I.e. the
CAN driver always informs e.g. the transport layer if a specific CAN frame is received and the transport layer
informs the diagnostic layer if the full message is received. This call sequence is preconfigured by Vector,
nevertheless, the software supports multiple points (callbacks) where customer specific hooks can be included.
This customer hooks have additional influence to the stack needs.
Another very important configuration parameter is the decision if the RX/TX handling shall be processed in
interrupt or on task context. If it is processed on task context, the stack need can be calculated easier than when
the handling is performed with interrupts.
In an ECU with one CAN bus, an interaction layer (IL), a network management (NM), a transport layer (TP) and a
diagnostic component, the RX path of incoming diagnostic CAN messages has usually the largest call tree form
communication point of view and therefore the highest stack need.
1.4 Calculating and Measuring Stack Need Exactly calculating the stack needs is a difficult and error-prone task. Therefore the stack size is often estimated
based on the environmental conditions describ
ed in chapter 1.2 and a safety value of 10% to 20%, sometimes
100%, is added to the result.
If an operating system is used, this system usually provides means to measure stack usage and test stack
consistency. OSEK/OS and AUTOSAR OS for instance provides such means to check the stack with each OS
action and also to initialize the stack with patterns so the worst case usage for a given scenario can be found.
When using such a method, it is important to analyze upfront the worst case call trees and make sure they have
happened during test execution, too. This implies also “special” scenarios like “ECU in diagnostics”, “ECU with high
I/O interrupt load”, occurrence of OSEK category 1 and 2 interrupts at the same time, …
2.0 Summary
As a result of all this effects, no detailed figure for the concrete stack usage of the CANbedded communication
components can be given upfront of the real usage in an ECU project.
Vector offers different levels of support to customers, starting from telephone hotline for the more simple questions,
integrating the CANbedded communication components and other software up to analyzing your ECU setup as a
separate project work.
Note:
Please be aware that due to all the points mentioned in this application note Vector can not finally
list the stack needs of the CANbedded communication components in your project. The concrete
layout and dimension of the stack(s) in an ECU project is the task of the system integrator.
5 Application Note AN-ISC-8-1056
CANbedded Program-Stack usage
3.0 Contacts
Vector Informatik GmbH Vector CANtech, Inc. VecScan AB Ingersheimer Straße 24
39500 Orchard Hill Pl., Ste 550
Lindholmspiren 5
70499 Stuttgart
Novi, MI 48375
402 78 Göteborg
Germany
USA
Sweden
Tel.: +49 711-80670-0
Tel: +1-248-449-9290
Tel: +46 (0)31 764 76 00
Fax: +49 711-80670-111
Fax: +1-248-449-9704
Fax: +46 (0)31 764 76 19
Email: info@vector-informatik.de
Email: info@vector-cantech.com
Email: info@vecscan.com
Vector France SAS Vector Japan Co. Ltd. 168 Boulevard Camélinat
Seafort Square Center Bld. 18F
92240 Malakoff
2-3-12, Higashi-shinagawa,
France
Shinagawa-ku
Tel: +33 (0)1 42 31 40 00
J-140-0002 Tokyo
Fax: +33 (0)1 42 31 40 09
Tel.: +81 3 5769 6970
Email: information@vector-france.fr
Fax: +81 3 5769 6975
Email: info@vector-japan.co.jp
6 Application Note AN-ISC-8-1056
1.1.16 - AN-ISC-8-1067_GenMsgMinAcceptLength
GenMsgMinAcceptLength with Il_Vector in Geny1.1.17 - AN-ISC-8-1067_GenMsgMinAcceptLength_ind
Page 1Page 2Page 3Page 4Page 51.1.18 - AN-ISC-8-1067_GenMsgMinAcceptLengths
GenMsgMinAcceptLength with Il_Vector in Geny Version 1.1 2008-09-09 Application Note AN-ISC-8-1067
Author(s) Meiss,
Gunnar
Restrictions Customer
confidential - PSA, Renault and Nissan only
Abstract
This Application Note describes the reception of messages with a DLC smaller or equal
than the described DLC in the database with the Il_Vector and the database attribute
GenMsgMinAcceptLength.
Table of Contents
1.0 Overview ..........................................................................................................................................................
1 1.1 Database Attributes.......................................................................................................................................
1 1.2 Particularities and Limitations .......................................................................................................................
2 1.2.1 Indication Notification..................................................................................................................................
2 1.2.2 Example Without DLC Change...................................................................................................................
2 1.2.3 Example With DLC Change........................................................................................................................
3 1.2.4 Data Changed Flags...................................................................................................................................
4 1.2.5 Timeout Flags and Functions .....................................................................................................................
4 1.2.6 Multiplexed Signals.....................................................................................................................................
4 2.0 Additional Resources .......................................................................................................................................
4 3.0 Contacts...........................................................................................................................................................
5 1.0 Overview
The Specification of PSA defines, that a CAN message has to be accepted by the ECU with different lengths. The
minimum length can be equal to the DLC of a message defined in the database for an ECU or smaller.
If a message is received, where the DLC is smaller than defined in the database, the application has to be
implemented with care according to the rules described in this document. All messages received with a DLC
smaller than the configured GenMsgMinAcceptLength, the messages are discarded by the ECU, because received
length is smaller than the minimum expected one.
1.1 Database Attributes The following table describes the properties of the database attribute GenMsgMinAcceptLength.
Name
GenMsgMinAcceptLength
Description
This value defines the minimum acceptance length in bytes of a CAN message. If no
value is specified, set the value to the DLC.
Type Of Object
Message
Value Type
Integer
Default 8
Minimum 0
Maximum 8
Table 1 – Properties of database attribute
1 Copyright © 2008 - Vector Informatik GmbH
Contact Information: www.vector-informatik.com or ++49-711-80 670-0
GenMsgMinAcceptLength with Il_Vector in Geny
1.2 Particularities and Limitations 1.2.1 Indication Notification If the received DLC of a message is greater or equal to the GenMsgMinAcceptLength configured in the database,
the indication notification (first value flags and indication flags are set and indication functions are called) is
performed for all signals or signal groups which are entirely contained in the received DLC of the message. If a
grouped signal is entirely within the received DLC, but the signal group is not within the received DLC, the
indication notification is not performed.
Note:
The application must check the indication flag or function before the signal value can be read by
the IlGet<SignalName>() signal access function or macro. If the indication flag is not set or the
indication function is not called, the application has to use the default value of the signal.
1.2.2 Example Without DLC Change The following code is an example if a message is received with a DLC smaller as defined in the database but the
DLC does not change during runtime ( GenMsgMinAcceptLength < DLC < DatabaseDLC ).
The example function is the application task which reads the signals “Speed” and “Rpm” of the message
“EngineInfo”.
/* Declare variables for the signal values. */
vuint8 ApplicationSpeedVariable;
vuint8 ApplicationRpmVariable;
void ApplicationTask(void)
{
if(IlGetSpeedIndication())
{
/* Read the received signal value. */
ApplicationSpeedVariable = IlGetRxSpeed();
/* Reset the indication flag. */
IlClrSpeedIndication();
}
else
{
/*
The signal has not been received yet.
Set the default value, if the default value is not configured.
*/
ApplicationSpeedVariable = 5;
}
/*
Read the received signal value or the default value,
which is configured in the generation tool.
*/
ApplicationRpmVariable = IlGetRxRpm();
}
2 Application Note AN-ISC-8-1067

GenMsgMinAcceptLength with Il_Vector in Geny
1.2.3 Example With DLC Change The following code is an example if a network is used where the DLC of a received messages changes during
runtime. The example function is the application task which reads the signals “Speed” and “Rpm” of the message
“EngineInfo”.
Note:
The application has to implement a message based CAN Driver PreCopy function which has to
clear all signal indication flags of the message and the polling feature of the Il_Vector must be
activated for this message. The following figure shows the configured attributes in GENy.
Figure 1 – Rx Messages of GENy
/* Declare variables for the signal values. */
vuint8 ApplicationSpeedVariable;
vuint8 ApplicationRpmVariable;
void ApplicationTask(void)
{
if(IlGetSpeedIndication())
{
/* Read the received signal value. */
ApplicationSpeedVariable = IlGetRxSpeed();
/* Reset the indication flag. */
IlClrSpeedIndication();
}
else
{
/*
The signal has not been received yet.
Set the default value, if the default value is not configured.
*/
ApplicationSpeedVariable = 5;
}
/*
Read the received signal value or the default value,
which is configured in the generation tool.
*/
ApplicationRpmVariable = IlGetRxRpm();
}
3 Application Note AN-ISC-8-1067
GenMsgMinAcceptLength with Il_Vector in Geny
vuint8 EngineInfoPreCopy(CanRxInfoStructPtr rxStruct)
{
rxStruct = rxStruct;
/*
Clear all signal indication Flags of the message to guarantee,
that only received signals are processed by the application.
*/
IlClrSpeedIndication();
IlClrRpmIndication();
return kCanCopyData;
}
1.2.4 Data Changed Flags The “Data Changed Flag” of a rx signal is only valid, if the indication flag is set or the signal indication function is
called previously.
Note:
Indication Flags have to be cleared by the application, or use the IlGetClr macros to get and clear
the indication flags.
1.2.5 Timeout Flags and Functions Message is never received after IlRxStart Timeout flags are set and timeout functions are called for all signals in the message if the timeout is elapsed.
Message is received minimum once after IlRxStart Timeout flags are set and timeout functions are called for all signals in the message, which are received with a
DLC greater than GenMsgMinAcceptLength, but smaller than the Size of the receive buffer.
1.2.6 Multiplexed Signals The database attribute GenMsgMinAcceptLength must not be used with messages containing multiplexed signals.
2.0 Additional Resources
See additional in the Technical Reference of the Il_Vector.
4 Application Note AN-ISC-8-1067
GenMsgMinAcceptLength with Il_Vector in Geny
3.0 Contacts Vector Informatik GmbH Vector CANtech, Inc. VecScan AB Ingersheimer Straße 24
39500 Orchard Hill Pl., Ste 550
Theres Svenssons Gata 9
70499 Stuttgart
Novi, MI 48375
41755 Göteborg
Germany
USA
Sweden
Tel.: +49 711-80670-0
Tel: +1-248-449-9290
Tel: +46 (0)31 764 76 00
Fax: +49 711-80670-111
Fax: +1-248-449-9704
Fax: +46 (0)31 764 76 19
Email: info@vector-informatik.de
Email: info@vector-cantech.com
Email: info@vecscan.com
Vector France SAS Vector Japan Co. Ltd. Vector Korea IT Inc. 168 Boulevard Camélinat
Seafort Square Center Bld. 18F
Daerung Post Tower III, 508
92240 Malakoff
2-3-12, Higashi-shinagawa,
182-4 Guro-dong, Guro-gu
France
Shinagawa-ku
Seoul, 152-790
Tel: +33 (0)1 42 31 40 00
Tokyo 140-0002
Republic of Korea
Fax: +33 (0)1 42 31 40 09
Japan
Tel.: +82-2-2028-0600
Email: information@vector-france.fr
Tel.: +81 3 5769 7800
Fax: +82-2-2028-0604
Fax: +81 3 5769 6975
Email: info@vector-korea.com
Email: info@vector-japan.co.jp
5 Application Note AN-ISC-8-1067
1.1.19 - 1854.0_ADD_Nexteer_CBD_PSA_SLP4_Sch_TexasInstruments TMS570
StandardAddendum0308071.1.20 - 1854.0_ADD_Nexteer_CBD_PSA_SLP4_Sch_TexasInstruments TMS570_ind
Page 1Page 2Page 3Page 41.1.21 - 1854.0_ADD_Nexteer_CBD_PSA_SLP4_Sch_TexasInstruments TMS570s
ADDENDUM TOMASTER SOFTWARE LICENSE AGREEMENTNotice: This Addendum shall be deemed accepted regardless of signature pursuant to Section 7.1 of the Master Software
License Agreement between Vector CANtech, Inc. and Nexteer Automotive ("Agreement") if not otherwise rejected along with
the Licensed Software in accordance with Section 7.2 of the Agreement.0.1
Addendum Effective Date:
2014/03/310.2
Pursuant to and fully incorporated into the Vector CANtech, Inc.
2009/11/01Master Software License Agreement, dated:
0.3
License Serial Number
CBD13006601.0
GENERAL TERMS APPLICABLE TO ALL SOFTWARE LISTED
IN ADDENDUM1.1
Licensee (Licensee Division):
Nexteer Automotive1.2
Sublicense Affiliate(s):
Not Applicable
1.3
Excluded Affiliates and/or Divisions:
Not Applicable
1.4
Sublicense Contractor(s):
All Licensee software engineering sub-contractors which are not affiliated
with a competitor of Vector.
1.5
Excluded Contractors:
All contractors competitive with Vector, including but not limited to,
Elektrobit Group Plc., all affiliates thereof (including 3SOFT), Mentor
Graphics
Corp.
and
all
affiliates
thereof
(including
Volcano
Communications Technologies AB), and Dearborn Group.
1.6
License Term:
Perpetual
1.7
Geographical Restriction on License:
North America (the geographic restriction applies only to the "Point of
Sale" location of the Licensee business entities that may enter into
business agreements for the sale of products incorporating the Vector
Licensed Software listed below. The geographic restriction does not
restrict the location in which the Licensee or Licensees’ contractors
develop, and/or manufacture the Licensee's products).
1.8
Standard Warranty for Licensed Software:
Two (2) Years
1.9
Extended Warranty and Extended Warranty Fee:
Not Applicable
1.10
Total Warranty Period for Licensed Software:
Two (2) Years
2.0
Identification of Protocol-Specific Embedded Software:Single Channel CAN Driver-Extended
2.1
OEM Restriction:
No OEM Restriction
2.2
Licensed Application:
Restricted solely to the development of electronic modules manufactured
by the Licensee.
2.3
Excluded Applications:
All applications not specified in Part 2.2 of this Addendum, including but
in no way limited to: network tools for sale, aerospace applications,
medical
applications,
and
for
those
safety-critical
component
applications, Licensee hereby acknowledges, agrees, and assumes sole
responsibility for the fact that Vector is unable to assess and warrant the
fitness of the Licensed Software for integration and use with the safety-
critical applications contemplated by Licensee; however, irrespective of
such, Vector would be willing (for an additional cost) to assess and
consult on the Licensed Software for integration and use with such
applications without assuming any additional responsibility or liability
therefore.
2.4
General Microcontroller Family:
TexasInstruments TMS570
2.5
General Compiler Family:
Texas Instruments
2.6
Specific Microcontroller:
0812BPGEQQ1
2.7
Specific Compiler Version:
4.9.5
2.8
Applicable Specifications:
Vector User Manual supplied with the CAN-Specific Embedded Software,
to the exclusion of all other specifications, documents, previous or
subsequent manual versions, and/or written or oral communications.
2.9
Corresponding Software License Fee:
Listed in Total License Fee
3.0
Identification of OEM-Specific Embedded Software:PSA SLP4 Single Channel - SIP
- Interaction Layer Single Channel
- Indirect OSEK NM Single Channel
- Transport Protocol
- CANdesc PSA
-XCP
© 2014 Vector CANtech, Inc.Page 1 of 4
CBD1300660_PO# UI124433 Ul127402
ADDENDUM TOMASTER SOFTWARE LICENSE AGREEMENT3.1
OEM Restriction:
Solely restricted to the following original equipment manufacturer (OEM):
PSA, to the exclusion of all subsidiaries and affiliates of the same.
3.2
Licensed Application:
Restricted solely to the development and manufacturing of electronic
modules
for
the
automotive
industry,
on
PSA
product/vehicle
applications, and for component application for integration into those
products manufactured by PSA.
3.3
Excluded Applications:
All applications not specified in Part 3.2 of this Addendum, including but
in no way limited to: network tools for sale, aerospace applications,
medical
applications,
and
for
those
safety-critical
component
applications, Licensee hereby acknowledges, agrees, and assumes sole
responsibility for the fact that Vector is unable to assess and warrant the
fitness of the Licensed Software for integration and use with the safety-
critical applications contemplated by Licensee; however, irrespective of
such, Vector would be willing (for an additional cost) to assess and
consult on the Licensed Software for integration and use with such
applications without assuming any additional responsibility or liability
therefore.
3.4
General Microcontroller Family:
TexasInstruments TMS570
3.5
General Compiler Family:
Texas Instruments
3.6
Specific Microcontroller:
0812BPGEQQ1
3.7
Specific Compiler Version:
4.9.5
3.8
Applicable Specifications:
To the exclusion of all other specifications, documents, previous or
subsequent Specifications versions, and/or written or oral
communications:
The applicable parts of the specification 00948_10_01988 1.0 Technical
Specification of Network Interface and
9646322999_Ind_F_TS_Implementation_of_the_network_layer_for_the_
diagnostic_CAN_et_LIN_networks will be supported by the quoted
software.
The Interaction Layer implements the functionality of the Vector
specification.
The Indirect OSEK Network Management implements the algorithms of
the OSEK specification 2.5.3 (Indirect NM).
The ISO Transport Protocol is based on the specification ISO 15765-
2:2004.
The CANdesc software component provides services according to the
ISO 15765-3:2004 and ISO14229-1:2006 specification. In addition the
diagnostics layer provides enhancements of application functions as
specified by PSA PEUGEOT CITROËN-Spezifikation 96 646 970 9A
"Implémentation des services diagnostic UDS" (Preliminary) from
February 2007.
The software component XCP-on-CAN includes the XCP protocol layer
according to the ASAM specification, version 1.0, and the XCP on CAN
transport layer for the Vector CAN Driver.
3.9
Corresponding Software License Fee:
Listed in Total License Fee
4.0
Identification of Application-Specific Embedded Software:Not Applicable4.1
OEM Restriction:
Not Applicable4.2
Licensed Application:
Not Applicable4.3
Excluded Applications:
Not Applicable4.4
General Microcontroller Family:
Not Applicable4.5
General Compiler Family:
Not Applicable4.6
Specific Microcontroller:
Not Applicable4.7
Specific Compiler Version:
Not Applicable4.8
Applicable Specifications:
Not Applicable4.9
Corresponding Software License Fee:
Not Applicable© 2014 Vector CANtech, Inc.Page 2 of 4
CBD1300660_PO# UI124433 Ul127402
ADDENDUM TOMASTER SOFTWARE LICENSE AGREEMENT5.0
Identification of Flash-Specific Embedded Software:Not Applicable5.1
OEM Restriction:
Not Applicable5.2
Licensed Application:
Not Applicable5.3
Excluded Applications:
Not Applicable5.4
General Microcontroller Family:
Not Applicable5.5
General Compiler Family:
Not Applicable5.6
Specific Microcontroller:
Not Applicable5.7
Specific Compiler Version:
Not Applicable5.8
Applicable Specifications:
Not Applicable5.9
Corresponding Software License Fee:
Not Applicable6.0
Identification of Generation Tool PC Software:Single Channel Generation Tool
6.1
OEM Restriction:
Solely restricted to the following original equipment manufacturer (OEM):
PSA, to the exclusion of all subsidiaries and affiliates of the same.
6.2
Licensed Application:
Restricted solely to the development and manufacturing of electronic
modules
for
the
automotive
industry,
on
PSA
product/vehicle
applications, and for component application for integration into those
products manufactured by PSA.
6.3
Excluded Applications:
All applications not specified in Part 6.2 of this Addendum, including but
in no way limited to: network tools for sale, aerospace applications,
medical
applications,
and
for
those
safety-critical
component
applications, Licensee hereby acknowledges, agrees, and assumes sole
responsibility for the fact that Vector is unable to assess and warrant the
fitness of the Licensed Software for integration and use with the safety-
critical applications contemplated by Licensee; however, irrespective of
such, Vector would be willing (for an additional cost) to assess and
consult on the Licensed Software for integration and use with such
applications without assuming any additional responsibility or liability
therefore.
6.4
General Microcontroller Family:
TexasInstruments TMS570
6.5
General Compiler Family:
Texas Instruments
6.6
Specific Microcontroller:
0812BPGEQQ1
6.7
Specific Compiler Version:
4.9.5
6.8
Applicable Specifications:
To the exclusion of all other specifications, documents, previous or
subsequent Specifications versions, and/or written or oral
communications:
The applicable parts of the specification 00948_10_01988 1.0 Technical
Specification of Network Interface and
9646322999_Ind_F_TS_Implementation_of_the_network_layer_for_the_
diagnostic_CAN_et_LIN_networks will be supported by the quoted
software.
The Interaction Layer implements the functionality of the Vector
specification.
The Indirect OSEK Network Management implements the algorithms of
the OSEK specification 2.5.3 (Indirect NM).
The ISO Transport Protocol is based on the specification ISO 15765-
2:2004.
The CANdesc software component provides services according to the
ISO 15765-3:2004 and ISO14229-1:2006 specification. In addition the
diagnostics layer provides enhancements of application functions as
specified by PSA PEUGEOT CITROËN-Spezifikation 96 646 970 9A
"Implémentation des services diagnostic UDS" (Preliminary) from
February 2007.
The software component XCP-on-CAN includes the XCP protocol layer
according to the ASAM specification, version 1.0, and the XCP on CAN
transport layer for the Vector CAN Driver.
© 2014 Vector CANtech, Inc.Page 3 of 4
CBD1300660_PO# UI124433 Ul127402
ADDENDUM TOMASTER SOFTWARE LICENSE AGREEMENT6.9
Corresponding Software License Fee:
Listed in Total License Fee
7.0
Identification of Flash Programming Tool PC Software:Not Applicable7.1
OEM Restriction:
Not Applicable7.2
Licensed Application:
Not Applicable7.3
Excluded Applications:
Not Applicable7.4
General Microcontroller Family:
Not Applicable7.5
General Compiler Family:
Not Applicable7.6
Specific Microcontroller:
Not Applicable7.7
Specific Compiler Version:
Not Applicable7.8
Applicable Specifications:
Not Applicable7.9
Corresponding Software License Fee:
Not Applicable8.0
Total License Fee for All Software Listed in This Addendum:
$116,713.60
9.0
This Addendum, having an effective date set forth above in Part 0.1 hereof, shall be subject to the terms, conditions, and limitations of the
Master Software License Agreement specified in Part 0.2 hereof, which are hereby incorporated into and made a part of this Addendum by
reference as though fully set forth herein.
© 2014 Vector CANtech, Inc.Page 4 of 4
CBD1300660_PO# UI124433 Ul127402
1.1.22 - DeliveryDescription_CBD1300660
Delivery Description CBD1300660Delivery Description CBD1300660
Delivery Information
Build Information
Version Information
Delivery Information
Package Information: | Nexteer Automotive Corporation
Package: CBD Psa SLP4
Micro: 0812BPGEQQ1
Compiler: TexasInstruments 4.9.5 |
License Number: | CBD1300660 |
License Expiry Date: | License does not expire |
OEM: | Psa |
SLP: | CBD Psa SLP4 |
Controller: | Tmsx70 |
CAN Cell: | Dcan |
Compiler: | TexasInstruments |
Ordered Derivative: | 0812BPGEQQ1 |
Customer Contacts: | Keith Johnson Keith.Johnson@nexteer.com Lonnie Newton lonnie.newton@nexteer.comContact address for Vector for all topics concerning this license. This includes questions and issue reports. Please inform Vector if this contact changes. |
Vector Contact: | SP Support SP.Support@vector.com Contact address at Vector for all questions concerning this delivery. |
Non-Disclosure: | A non-disclosure agreement related to this license exists. |
Delivery ID: | 05.00.17.01.30.06.60.01.00.00 This is the unique identification number of this delivery. Please always have this number and above license information ready when contacting Vector customer support. |
SIP Version: | 05.00.17 |
Delivery Number: | 01 |
Release Type: | Serial production release (complete functionality, fully tested , full process, incl. serial production release) |
Delivery Type: | Initial delivery (based on explicit purchase order) |
Delivery Reason: | 5014730-1.0 |
Vector Order Confirmation Number: | 5014730 |
Tested Derivative: | 0812BPGEQQ1 |
Version Information
Project | Component | Version |
---|
CBD_Psa_SLP4 | Preconfig | 5.00.02 |
Common_Vdef | Implementation | 3.40.00 |
Cp_Xcp | GenTool_Geny | 2.20.06 |
Cp_Xcp | Implementation | 1.29.00 |
Cp_XcpOnCan | GenTool_Geny | 1.08.02 |
Cp_XcpOnCan | Implementation | 1.07.03 |
Diag_CanDesc__coreBase | GenTool_Geny_CANdesc | 3.03.00 |
Diag_CanDesc__coreBase | Implementation | 5.07.44 |
Diag_CddPersistors | Implementation | 1.06.00 |
Diag_DataCddt_Psa | DiagDescription | 1.00.00 |
Diag_Geny_coreBase | GenTool_Geny | 3.11.18 |
DrvCan__base | GenTool_Geny | 3.21.04 |
DrvCan__baseHll | GenTool_Geny | 3.05.03 |
DrvCan__baseRi14 | GenTool_Geny | 2.09.01 |
DrvCan__baseRi14Hll | GenTool_Geny | 2.05.02 |
DrvCan__baseRi15 | GenTool_Geny | 1.05.00 |
DrvCan__baseRi15Hll | GenTool_Geny | 1.01.03 |
DrvCan_Tms470DcanHll | GenTool_Geny | 1.05.00 |
DrvCan_Tms470DcanHll | Implementation | 1.15.00 |
GenTool_GenyDriverBase | GenTool_Geny | 2.08.04 |
GenTool_GenyFrameworkCsyntax | GenTool_Geny | 2.10.00 |
GenTool_GenyFrameworkGenXml | GenTool_Geny | 1.13.00 |
GenTool_GenyGraphicsLibCan | GenTool_Geny | 1.03.00 |
GenTool_GenyGuiChannelCfg | GenTool_Geny | 1.05.01 |
GenTool_GenyHtmlConfigDocumentor | Implementation | 1.00.01 |
GenTool_GenyObjectHierarchyCan | GenTool_Geny | 1.22.00 |
GenTool_GenyObjectModel | GenTool_Geny | 2.12.00 |
GenTool_GenyPluginConfigDocumentor | GenTool_Geny | 2.02.03 |
GenTool_GenyVcfgNameDecorator | Description | 1.01.01 |
GenTool_GenyVcfgNameDecorator | GenTool_Geny | 2.26.01 |
GenTool_XChecksumcrc | GenTool_Geny | 1.00.00 |
Hw__baseCpuCan | GenTool_Geny | 2.25.01 |
Hw_Tms470Cpu | GenTool_Geny | 2.13.01 |
Hw_Tms470DcanCpuCan | GenTool_Geny | 1.15.00 |
Il_Vector | GenTool_Geny | 1.17.00 |
Il_Vector | Implementation | 5.09.00 |
Nm_IndOsek | GenTool_Geny | 2.00.00 |
Nm_IndOsek | Implementation | 3.00.00 |
Nm_StMgrIndOsek_Ls | GenTool_Geny | 1.00.00 |
Nm_StMgrIndOsek_Ls | Implementation | 3.03.01 |
Tp_Iso15765 | GenTool_Geny | 2.34.00 |
Tp_Iso15765 | Implementation | 3.08.01 |
VStdLib__base | GenTool_Geny | 1.01.02 |
VStdLib_Arm7 | Implementation | 2.02.01 |
Build Information
Compiler |
Version: | TMS470 C/C++ Compiler v4.9.5 |
AdditionalOptions: | -fr obj -fb lst -ff lst -fs lst -dC_DERIVATIVE_LS2125 -dEVA_BOARD_ -dPLL_FREQUENCY=80 -dQUARTZ_FREQUENCY=20 -mv7R4 --float_support=vfpv3d16 --abi=eabi -O2 --opt_for_speed=3 -g --symdebug:dwarf_version=2 --no_inlining --define=APPLICATION --verbose --enum_type=packed --plain_char=unsigned -k -mt --code_state=16 |
Assembler |
Version: | TMS470 C/C++ Compiler v4.9.5 |
AdditionalOptions: | -fr obj -fb lst -ff lst -fs lst -dC_DERIVATIVE_LS2125 -dEVA_BOARD_ -dPLL_FREQUENCY=80 -dQUARTZ_FREQUENCY=20 -mv7R4 --float_support=vfpv3d16 --abi=eabi -O2 --opt_for_speed=3 -g --symdebug:dwarf_version=2 --no_inlining --define=APPLICATION --verbose --enum_type=packed --plain_char=unsigned -k -mt --code_state=16 |
Linker |
Version: | TMS470 Linker v4.9.5 |
AdditionalOptions: | -i D:\uti\Texas_Instruments\4.9.5\lib -m TestSuit.map -o TestSuit.out -l rtsv7R4_T_be_v3D16_eabi.lib -stack 0x800 --be32 -mv7R4 --abi=eabi -mEPS_PSA_BMPV_dbg.map --heap_size=0 -iD:utiTexas_Instruments4.9.5lib -iD:utiTexas_Instruments4.9.5include -iC:/Work/PSA_BMPV_EPS_TMS570/Fls/src --reread_libs --disable_auto_rts --warn_sections --issue_remarks --xml_link_info=EPS_PSA_BMPV_dbg_linkInfo.xml --rom_model --be32 --unused_section_elimination=off --compress_dwarf=off --zero_init=off --define=APPLICATION -mt -k |
Librarian |
Version: | TMS470 Archiver v4.9.5 |
Flags: | -rq makesupport.xml |
1.1.23 - DeliveryTestReport_CBD1300660
Delivery Test Report CBD1300660Delivery Test Report CBD1300660
The content of this delivery and the tested configuration is described in
CBD1300660_DeliveryDescription.html
Delivery Information
License Information
License Information: | Nexteer Automotive Corporation
Package: CBD Psa SLP4
Micro: 0812BPGEQQ1
Compiler: TexasInstruments 4.9.5 |
---|
License Number: | CBD1300660 |
---|
OEM: | Psa |
---|
SLP: | CBD Psa SLP4 |
---|
Controller: | Tmsx70 |
---|
CanCell: | Dcan |
---|
Compiler: | TexasInstruments |
---|
Delivery Information
Delivery Number: | 01 |
---|
SIP Version: | 05.00.17 |
---|
Delivery ID: | 05.00.17.01.30.06.60.01.00.00 |
---|
Tested Derivative: | 0812BPGEQQ1 |
---|
Release Type: | Serial production release (complete functionality, fully tested , full process, incl. serial production release) |
---|
Delivery Type: | Initial delivery (based on explicit purchase order) |
---|
Delivery Reason: | 5014730-1.0 |
---|
Test Verdict
Test Verdict | Passed |
Test Report Date | 2014-04-02 |
Test Activities
According to Vector’s embedded software development and delivery process, the test activities are assigned to the development phases of the software. The most important development phases for a delivery like this are the Component Test and the Delivery Test.
Component Tests
Each component listed in the section "Detailed Version Information" within the delivery description has been tested during the component development phase before component release independently of this specific delivery. The test activities on component level include:
- Code inspection and inspection of all work products, e.g. technical references
- Static and dynamic tests according to the component-specific test specification and test plan
- MISRA analysis and justification of deviations
- Code coverage analysis (target: high code coverage of dynamic tests, additional inspection of uncovered code areas)
Delivery Tests
Testing the ordered program ("SLP") on the real hardware with the target compiler and the requested configuration is performed for each delivery ("SIP") in order to detect any delivery specific issues. The test activities on delivery level include:
- Compile and link test on the real hardware with customer-specific compiler-, assembler- and linker-options (as specified in the questionnaire)
- Dynamic tests according to the program related delivery test suite
- Dynamic tests according to the ordered configuration or use-case (depending on the questionnaire or SLP defaults)
- Optional: manual tests to cover special use-cases
The results of the delivery specific tests are documented on a summary level within this report. The result of the component specific test is not documented here as it is a prerequisite that the component has passed its release test before being delivered to customers.
Vector does not distribute all the detailed test results to you. If you are interested in a review of the detailed delivery test results and those of the component specific tests, please contact Vector for more information.
Delivery Tests Results
Use Case Passed_Compiler_Options
IL Transmission Tests Check if messages are send according to configuration | Passed |
DUT Configuration and Test Environment Scan Station Manager configuration and used test environment | Passed |
Test status machine of life phases Test possible transitions of status machine of current ECU type | Passed |
Test wake up by external event Test transitions if DUT is requesting the network due to an external event ( Organtype 1 and 2 only ) | Passed |
DUT Configuration and Test Environment Scan Station Manager configuration and used test environment | Passed |
Test status machine of life phases Test possible transitions of status machine of current ECU type | Passed |
Test wake up by external event Test transitions if DUT is requesting the network due to an external event ( Organtype 1 and 2 only ) | Passed |
Read/Write by ID with multi frame
| Passed |
Change session from default to EXTENDED and back(functional)
| Passed |
Communication control (physical)
| Passed |
Periodic Data
| Passed |
Spontaneous Response (0x85)
| Passed |
Remote Frames Test Remote Frames | Passed |
Acceptance Filter Test Acceptance Filter | Passed |
Extended Status Test Extended Status | Passed |
Bus Load Test with heavy bus load | Passed |
Individual Polling Test Individual Polling | Passed |
Cancel Transmit Test Cancel Transmit | Passed |
Application Messages Test Rx / Tx ApplMsg, RDS macros, Pretransmit / Precopy | Passed |
Lock CAN interrupts Test functionality of CanCanInterruptDisable and CanCanInterruptRestore. | Passed |
TP Transmission Tests Test TP data transmission and TP data reception with variable data length | Passed |
VStdMemCopy Tests VStdMemCopy Tests | Passed |
VStdMemSet Tests VStdMemSet Tests | Passed |
VStdMemClr Tests VStdMemClr Tests | Passed |
Download/Upload Data Test Upload from RAM and ROM and Download to RAM | Passed |
1.1.24 - IssueReport_CBD1300660
website_Vector_BSW_TMS570_PSA/content/en/docs/Doc/DeliveryInformation/IssueReport_CBD13006601.1.26 - IssueReport_CBD1300660s
Issue ReportLicense NumberCustomerCBD1300660
Nexteer Automotive Corporation
Package: CBD Psa SLP4
Micro: 0812BPGEQQ1
Compiler: TexasInstruments 4.9.5
Maintenance Expiry Date2024-03-18
SIP Delivery DateSIP Version2014-03-18
05.00.17
SLPDelivery NumberCBD Psa SLP4
D01
Report Creation Date2014-04-02
ContactIn case of questions or the need for an update of the basic software delivery, please contact
SP.Support@vector.com or your Vector contact person.
Table of Contents
1.Introduction1.1 Resolving Issues1.2 Issue Classification2.New Issues2.1 Runtime Issues without Workaround: 02.2 Runtime Issues with Workaround: 62.3 Apparent Issues: 152.4 Compiler Warnings: 173.New Issues for Information: 04.Report Legend5.Quality Management Contact1
Issue Report1. Introduction1.1 Resolving IssuesReported issues are not necessarily fixed automatically by the next update delivery. If some of the
reported issues shall be fixed, please contact Vector to establish an agreement about issues that
shall be fixed in upcoming deliveries. Please note that Vector may fix additional issues without
explicit request.
1.2 Issue ClassificationThis Issue Report provides issues that have been detected since the last report. The issues have
been classified to facilitate the assessment of their impact:
The chapter 'New Issues' lists issues that have been detected since the last report and which could
not be excluded based on the use-case defined in the questionnaire. The issues are classified as
follows:
•
Runtime Issues without Workaround: Runtime issues without a workaround require an
update of the basic software delivery in case the issue affects the ECU overall functionality.
The effect of an issue to the ECU functionality has to be analyzed by the customer as the basic
software usage and its configuration is not known by Vector. The risk of change has also to be
taken into account.
•
Runtime Issues with Workaround: It is not recommended to update a delivery due to a
runtime issue with a documented workaround. The effect of an issue to the ECU functionality
has to be analyzed by the customer as the basic software usage and its configuration is not
known by Vector. The risk of change has also to be taken into account.
•
Compiler Warnings: As a service we report the known compiler warnings. The occurrence of
a compiler warning may depend on the used configuration and compiler settings.
•
Apparent Issues: Apparent issues are detected immediately when using the basic software.
If an issue does not show up while working with the basic software the ECU project is not
affected by the issue. Apparent issues may or may not have workarounds.
The chapter 'New Issues for Information' lists issues that are not relevant for the use case that
has been documented in the questionnaire provided to Vector. The issues may, however, be
relevant for other use cases. Additionally, issues that have been accepted or are tolerated by the
OEM (as defined in the questionnaire) are reported here.
2
Issue Report2. New Issues2.1 Runtime Issues without Workaround
The lists contain issues that have been detected since the last report and which could not be
excluded based on the use-cases defined in the questionnaire (see chapter ‘New Issues for
Information’).
2.2 Runtime Issues with WorkaroundIt is not recommended to update a delivery due to a runtime issue with a documented
workaround. The effect of an issue to the ECU functionality has to be analyzed by the customer as
the basic software usage and its configuration is not known by Vector. Thereby the risk of change
has also to be taken into account.
IndexESCAN00045854An incorrect timeout is issued for Flow Control and Consecutive Frame timing
supervision.
Tp_Iso15765@GenTool_Geny
ESCAN00055528Missing call-context limitation in the description of all DescSetStateXXX API
Diag_CanDesc__coreBase@Doc_TechRef
ESCAN00056993Busoff event incorrectly also causes wakeup event
DrvCan_Tms470DcanHll@Implementation
ESCAN00065128CANbedded only: multiplex messages are not received correctly
GenTool_GenyDriverBase@GenTool_Geny
ESCAN00066659canbedded only: multiplex messages are not received correctly
Hw__baseCpuCan@GenTool_Geny
ESCAN00070923Overrun occurs with higher probability
DrvCan_Tms470DcanLl@Implementation
3
Issue ReportESCAN00045854An incorrect timeout is issued for Flow Control and
Consecutive Frame timing supervision.Component@Subcomponent:Tp_Iso15765@GenTool_Geny
First affected version:2.00.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
An incorrect timeout is issued for Flow Control (TX) and Consecutive Frame (RX) timing
supervision in case of large timeouts.
When does this happen:
-------------------------------------------------------------------
During runtime at transmission and/or reception of multi frames.
In which configuration does this happen:
-------------------------------------------------------------------
This can only appear if channel specific timing is activated (#if defined
TP_CHANNEL_SPECIFIC_TIMING)
AND
the configured timeout values are greater than 255 "ticks".
Please note that the number of "ticks" is calculated by dividing the configured timeout value by
the configured periodic cycle time of the TP.
Resolution Description:
Workaround:
-------------------------------------------------------------------
Use smaller timeouts or increase the call-cycle of the TP task functions.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
4
Issue ReportESCAN00055528Missing call-context limitation in the description of
all DescSetStateXXX APIComponent@Subcomponent:Diag_CanDesc__coreBase@Doc_TechRef
First affected version:1.00.00
Fixed in versions:3.06.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Since the technical reference CANdesc does not restrict the call-context of the "DescSetStateXXX"
API, the application might call it from interrupt context or a task with higher priority than the
DescTask.
This might result in undefined run time effects.
When does this happen:
-------------------------------------------------------------------
During diagnostic application integration, when using a "DescSetStateXXX" API.
In which configuration does this happen:
-------------------------------------------------------------------
Any configuration.
Resolution Description:
Workaround:
-------------------------------------------------------------------
Do not call any of the "DescSetStateXXX" APIs from interrupt context or a task with higher
priority than the DescTask.
Resolution:
-------------------------------------------------------------------
Call context has been restricted to a task with priority lower or equal to the DescTask.
5
Issue ReportESCAN00056993Busoff event incorrectly also causes wakeup eventComponent@Subcomponent:DrvCan_Tms470DcanHll@Implementation
First affected version:1.00.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
When a busoff event is detected (via either CAN interrupt or polling CanTask), the driver executes
the code to handle the busoff correctly, but it also incorrectly executes the code to handle a
wakeup event, even though no wakeup event is pending.
When does this happen:
-------------------------------------------------------------------
On the next busoff event, if the last wakeup event was not immediately followed by at least 11
recessive bits.
In other words, if the bus is "noisy" when CAN wakes up, the next busoff event will cause the
driver to execute the wakeup routine again.
In which configuration does this happen:
-------------------------------------------------------------------
Configurations where 'Sleep/Wakeup Functionality' is enabled on the DrvCan_Tms470DcanHll
page in GENy.
Resolution Description:
Workaround:
-------------------------------------------------------------------
If global power down mode is configured: In ApplCanWakeUpFromSleepModeRequest, after
clearing the appropriate PCR bits as documented in the CAN driver technical reference, the
application must wait for the 'WakeUp Pnd' bit to clear in the DCAN Error and Status register. For
example:
while((*(vuint32 *)0xFFF7DC04 /* DCAN1 Error and Status register */) & (vuint32)0x00000200);
{
}
It is also recommended that the application have some sort of timeout for this loop in case the
bus is permanently disturbed.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
6
Issue ReportESCAN00065128CANbedded only: multiplex messages are not
received correctlyComponent@Subcomponent:GenTool_GenyDriverBase@GenTool_Geny
First affected version:1.00.00
Fixed in versions:2.09.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
With IL: wrong signal values are received.
The RDS message structs of the multiplexed messages are generated incorrect to the can_par.h
file.
The Il will access the wrong value as multiplexor signal within the message.
This Issue is fixed together with ESCAN00066659
When does this happen:
-------------------------------------------------------------------
At runtime on access to the multiplexed signals by the application if the described configuration is
valid for the message of this signal
In which configuration does this happen:
-------------------------------------------------------------------
In configurations in which
- Multiplex messages
AND
- the multiplexor of a multiplexed message is not in the first byte
AND
- the signals before the multiplexor value are not assigned as receive message for this ECU.
ADN
- Interaction Layer used
Resolution Description:
Workaround:
-------------------------------------------------------------------
access the multiplexor signal by using the buffer array access.
or if possible
Add your ECU as receiver of the signals before the multiplexor value.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
7
Issue ReportESCAN00066659canbedded only: multiplex messages are not
received correctlyComponent@Subcomponent:Hw__baseCpuCan@GenTool_Geny
First affected version:2.22.04
Fixed in versions:2.27.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
With IL: wrong signal values are received.
The message structs of the multiplexed messages are generated incorrect to the drv_par.h file.
The Il will access the wrong value as multiplexor signal within the message.
This Issue is fixed together with ESCAN00065128
When does this happen:
-------------------------------------------------------------------
At runtime on access to the multiplexed signals by the application if the described configuration is
valid for the message of this signal
In which configuration does this happen:
-------------------------------------------------------------------
In configurations in which
- Multiplex messages
AND
- the multiplexor of a multiplexed message is not in the first byte
AND
- the signals before the multiplexor value are not assigned as receive message for this ECU.
AND
- Il_Vector is used
Resolution Description:
Workaround:
-------------------------------------------------------------------
access the multiplexor signal by using the buffer array access.
or if possible
Add your ECU as receiver of the signals before the multiplexor value.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
8
Issue ReportESCAN00070923Overrun occurs with higher probabilityComponent@Subcomponent:DrvCan_Tms470DcanLl@Implementation
First affected version:1.07.00
Fixed in versions:1.20.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Overrun occurs with higher probability, CAN communication still works.
When does this happen:
-------------------------------------------------------------------
When BasicCAN overrun occurs.
The following must happen to achieve that the overrun functionality behaves as
expected again:
MSR:
1. Reinitialization of the CAN controller by calling the function Can_InitController().
2. Mode change to stop mode by calling the function Can_SetControllerMode(CAN_T_STOP).
CANbedded:
1. Reinitialization of the CAN controller by calling the function CanInit().
2. Mode change by calling the function CanStart()
(does only work if workaround for issue 22 is not disabled in user configuration file - enabled by
default)
Further BasicCAN overrun leads to same issue again.
In which configuration does this happen:
-------------------------------------------------------------------
MSR:
BasicCAN objects are used
AND
feature "overrun notification" is either set to APPL or DET.
(see can_cfg.h if CAN_OVERRUN_NOTIFICATION is set either to CAN_APPL or CAN_DET)
CANbedded:
BasicCAN objects are used
AND
feature "overrun notification" is enabled.
(see can_cfg.h if C_ENABLE_OVERRUN is set)
Resolution Description:
Workaround:
-------------------------------------------------------------------
Disable overrun notification.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
9
Issue Report2.3 Apparent IssuesApparent issues are detected immediately when using the basic software. If an issue does not
show up while working with the basic software the ECU project is not affected by the issue.
Apparent issues may or may not have workarounds.
IndexESCAN00024492API prototypes for InmNmRxGetCondition are not correct
Nm_IndOsek@Doc_TechRef
ESCAN00039653The interrupt lock functions do not work correctly for the user mode
VStdLib_Arm7@Implementation
ESCAN00047907limitation "InmNmTask" (no interrupt context usage)
Nm_IndOsek@Doc_TechRef
ESCAN00049589Compile error: direct signal access feature in CANdesc does not consider far
memory pointers
Diag_CanDesc__coreBase@Implementation
ESCAN00053779Linker error: CanBaseAddressRequest() and CanBaseAddressActivate() are not
available
DrvCan__coreHll@Implementation
ESCAN00055957appdesc.c missing line feed (LF) after carraige return (CR) on some lines
Diag_CanDesc__coreBase@Implementation
ESCAN00056617Compile error when compiling CanInterruptDisable(): missing ;
DrvCan__coreHll@Implementation
ESCAN00059562Compile error: Size of array CanRxMsgIndirection is zero if index search and
no Rx FullCANs are used
DrvCan__coreHll@Implementation
ESCAN00062165Compiler error: Interrupt control macros prevent can_drv.c from being
compiled in THUMB mode
VStdLib_Arm7@Implementation
ESCAN00062316[canbedded only] Wrong Rx Data Length of message displayed
GenTool_GenyDriverBase@GenTool_Geny
ESCAN00062872the function CanLL_HandleIllIrptNumber didn't clear a illegal interrupt
DrvCan_Tms470DcanLl@Implementation
ESCAN00063756certain extended IDs may not be received after Full CAN overrun ( if extended
ID masking is enabled )
DrvCan_Tms470DcanLl@Implementation
ESCAN00070517Compiler error: missing constant kDescStateSessionDefault
Diag_CanDesc__coreBase@Implementation
ESCAN00071804Functions and flags can be added to a Update Bit signal after an dbc update
was performed
Il_Vector@GenTool_Geny
ESCAN00073608"Unknown Service Support" feature in GENy is referenced as "Support Generic
User Service" feature
Diag_CanDesc__coreBase@Doc_TechRef
10
Issue ReportESCAN00024492API prototypes for InmNmRxGetCondition are not
correctComponent@Subcomponent:Nm_IndOsek@Doc_TechRef
First affected version:1.12.00
Fixed in versions:1.13.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
The API prototypes for InmNmRxGetCondition() are not correct. They contain the function name
InmNmRxTimeOut() instead of InmNmRxGetCondition() .
When does this happen:
-------------------------------------------------------------------
When reading the document
In which configuration does this happen:
-------------------------------------------------------------------
This issue occurs always.
Resolution Description:
Workaround:
-------------------------------------------------------------------
When using the API in the code, use the correct API name instead of the one given in the API
prototype.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected workproducts.
11
Issue ReportESCAN00039653The interrupt lock functions do not work correctly
for the user modeComponent@Subcomponent:VStdLib_Arm7@Implementation
First affected version:1.00.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
The interrupt lock functions have no effect and the interrupt will never be locked. This could lead
to data inconsistency.
This issue is permanent and happens more often with higher system load.
When does this happen:
-------------------------------------------------------------------
This happens at runtime.
In which configuration does this happen:
-------------------------------------------------------------------
It happens if the CPU core is running in the user mode.
For this mode, the change from enabled to disabled interrupts and vice versa is not possible.
To do this, the privileged operation mode is necessary. The current implementation of the CAN
driver
does not support switching from user mode to privileged mode and so the interrupt lock
mechanism of
the CAN driver does not work with the user mode.
Resolution Description:
Workaround:
-------------------------------------------------------------------
Run the CAN driver in the privileged operating mode.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
12
Issue ReportESCAN00047907limitation "InmNmTask" (no interrupt context
usage)Component@Subcomponent:Nm_IndOsek@Doc_TechRef
First affected version:1.00.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
The application must not call the service function "InmTask" in interrupt context (according to the
general CBD design rules). But such a limitation is not described in the technical reference.
When does this happen:
-------------------------------------------------------------------
When reading the technical reference.
In which configuration does this happen:
-------------------------------------------------------------------
Does not depend on any configuration.
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
13
Issue ReportESCAN00049589Compile error: direct signal access feature in
CANdesc does not consider far memory pointersComponent@Subcomponent:Diag_CanDesc__coreBase@Implementation
First affected version:1.00.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compile error for mismatching pointer type assignment.
When does this happen:
-------------------------------------------------------------------
At compile time.
In which configuration does this happen:
-------------------------------------------------------------------
- CANdesc
AND
- Direct signal access to RAM/ROM objects is used.
AND
- FAR memory
Some services such as the UDS ones 0x22/0x2A and 0x2E, can be processed on signal level. If
they are processed on signal level it is possible to choose "Direct Access" as Signal
Handler Type. In this case, CANdesc reads or writes the value of signal direct of/to a variable.
(The name of the variable is configured in the cdd file or GENy.) If this variable
is located in FAR memory a Compiler/Linker warning or error will occur.
Resolution Description:
Workaround:
-------------------------------------------------------------------
Avoid direct signal access to such objects and implement the main-handler within the application
code. (Choose "Signal Handler" for the Signal Handler Type and copy the
data that is located in the FAR memory in the application callback for this signal.)
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
14
Issue ReportESCAN00053779Linker error: CanBaseAddressRequest() and
CanBaseAddressActivate() are not availableComponent@Subcomponent:DrvCan__coreHll@Implementation
First affected version:2.10.00
Fixed in versions:2.14.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
A Linker error occurs: CanBaseAddressRequest() and CanBaseAddressActivate() are not available
When does this happen:
-------------------------------------------------------------------
This happens at link time
In which configuration does this happen:
-------------------------------------------------------------------
This happens if virtual addressing is activated for the CAN driver without QNX support:
- C_ENABLE_UPDATE_BASE_ADDRESS is activated in can_cfg.h
AND
- VGEN_ENABLE_MDWRAP is not defined in the system
AND
- VGEN_ENABLE_QWRAP is not defined in the system
This is a special feature which is not implement in general.
Resolution Description:
Workaround:
-------------------------------------------------------------------
add the following code to the user configuration file of the CAN driver:
#if defined C_ENABLE_UPDATE_BASE_ADDRESS
#define C_ENABLE_BASE_ADDRESS_UPDATE
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
15
Issue ReportESCAN00055957appdesc.c missing line feed (LF) after carraige
return (CR) on some linesComponent@Subcomponent:Diag_CanDesc__coreBase@Implementation
First affected version:5.07.26
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
The appdesc.c file is missing the line feed (LF) character at the end of certain lines. It should
follow the carraige return (CR) character. This will cause compilers and debuggers to display the
incorrect line of source code. Additionally, some IDEs will complain that the line feed character is
missing.
When does this happen:
-------------------------------------------------------------------
At generation time.
In which configuration does this happen:
-------------------------------------------------------------------
All configurations.
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
16
Issue ReportESCAN00056617Compile error when compiling
CanInterruptDisable(): missing ;Component@Subcomponent:DrvCan__coreHll@Implementation
First affected version:2.01.00
Fixed in versions:2.14.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
The compiler gives an error because of a missing ; when compiling
CanInterruptDisable();
In some configurations (see below), this is a macro:
# define CanInterruptDisable() (VStdSuspendAllInterrupts())
VStdSuspendAllInterrupts() is defined in osek.h. If it is a function,
there is no problem.
If it is itself a macro and if the macro starts with {, the code doesn't compile.
The same problem happens with the CanInterruptRestore() macro.
When does this happen:
-------------------------------------------------------------------
At compile time.
In which configuration does this happen:
-------------------------------------------------------------------
Any configuration with "Locking Mechanism" of VStdLib set to "OSEK".
There is only a problem if SuspendAllInterrupts() is a macro beginning with {
Resolution Description:
Workaround:
-------------------------------------------------------------------
configure "Locking Mechanism" of VStdLib to "User defined"
call SuspendAllInterrupts() and ResumeAllInterrupts() within the application function.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
17
Issue ReportESCAN00059562Compile error: Size of array CanRxMsgIndirection is
zero if index search and no Rx FullCANs are usedComponent@Subcomponent:DrvCan__coreHll@Implementation
First affected version:2.00.00
Fixed in versions:2.15.01
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
the compiler complains about "the size of an array must be greater than zero" about the following
code in can_def.h:
V_MEMROM0 extern V_MEMROM1 CanReceiveHandle V_MEMROM2
CanRxMsgIndirection[kCanNumberOfRxFullCANObjects];
The tabel CanRxMsgIndirection table itself is not available and no access to this table is performed
if not generated/necessary is no Rx FullCANs messages are used.
When does this happen:
-------------------------------------------------------------------
This happens during compile process.
In which configuration does this happen:
-------------------------------------------------------------------
HighEnd-license is used
AND
Index search is used
AND
No Rx FullCAN objects are used.
It depends on the Compiler whether no information is given or a compiler warning or compiler
error is generated. E.g. the GNU compiler don't complain about this.
The following compiler is currently known to be affected:
MPC Greenhills v5.2.4
Resolution Description:
Workaround:
-------------------------------------------------------------------
a) A compiler warning can be ignored.
b) A compiler error can be reduced to warning or ignored if possible. Otherwise there is no
workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
18
Issue ReportESCAN00062165Compiler error: Interrupt control macros prevent
can_drv.c from being compiled in THUMB modeComponent@Subcomponent:VStdLib_Arm7@Implementation
First affected version:0.00.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
VStdLL_GlobalInterruptDisable and VStdLL_GlobalInterruptRestore are implemented as macros
instead of functions. Since these macros use the compiler intrinsics __get_CPSR() and
__set_CPSR(), any file which relies on these functions (such as can_drv.c) cannot be compiled in
THUMB mode (compiler option -mt).
The following compiler warning occur in any file which uses VStdLL_GlobalInterruptDisable or
VStdLL_GlobalInterruptRestore:
warning #1445-D: intrinsic "_get_CPSR" not supported in thumb mode, treated as function call
warning #1445-D: intrinsic "_set_CPSR" not supported in thumb mode, treated as function call
In the linking phase, the symbols _get_CPSR and _set_CPSR will be undefined, preventing the
project from building.
When does this happen:
-------------------------------------------------------------------
At compile time.
In which configuration does this happen:
-------------------------------------------------------------------
TI compiler
AND
can_drv.c or other invoking file compiled in THUMB mode (compiler option -mt)
AND
Configurations which use default interrupt control in GENy on the Hw page
(all conditions must be true for the issue to occur)
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
19
Issue ReportESCAN00062316[canbedded only] Wrong Rx Data Length of
message displayedComponent@Subcomponent:GenTool_GenyDriverBase@GenTool_Geny
First affected version:2.08.00
Fixed in versions:2.09.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
In the GENy GUI the Rx Data Length of a message is erroneously displayed as 0 for messages
that fulfill the conditions described below.
When does this happen:
-------------------------------------------------------------------
Configuration time
In which configuration does this happen:
-------------------------------------------------------------------
Only in dbc-based configurations if the dbc file contains RxMessages which contain exactly one
signal and this signal meets the following conditions:
- Endianess is MOTOROLA
- Signal length is 8 bit
- Signal Start bit is 7
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
20
Issue ReportESCAN00062872the function CanLL_HandleIllIrptNumber didn't
clear a illegal interruptComponent@Subcomponent:DrvCan_Tms470DcanLl@Implementation
First affected version:1.00.00
Fixed in versions:1.17.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
If an undefined Interrupt occur, this interrupt will not be cleared.
When does this happen:
-------------------------------------------------------------------
If an interrupt with an undefined mailbox number occur. Normally this can not happen.
In which configuration does this happen:
-------------------------------------------------------------------
interrupt configurations
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
21
Issue ReportESCAN00063756certain extended IDs may not be received after Full
CAN overrun ( if extended ID masking is enabled )Component@Subcomponent:DrvCan_Tms470DcanLl@Implementation
First affected version:1.00.00
Fixed in versions:1.18.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Some extended IDs may not be received.
When does this happen:
-------------------------------------------------------------------
This can happen after a Rx Full CAN overrun occurs on the assigned Rx Full CAN mailbox.
In which configuration does this happen:
-------------------------------------------------------------------
This occurs only in configurations with
Rx FullCAN messages (C_ENABLE_RX_FULLCAN_OBJECTS is defined in the file can_cfg.h)
AND
Mixed Id (standard and extended Identifier) is used ( C_ENABLE_MIXED_ID is defined in the file
can_cfg.h)
AND
extended ID Masking is activated (C_ENABLE_RX_MASK_EXT_ID is defined in the file can_cfg.h)
This happens only with CANbedded CAN Driver.
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
22
Issue ReportESCAN00070517Compiler error: missing constant
kDescStateSessionDefaultComponent@Subcomponent:Diag_CanDesc__coreBase@Implementation
First affected version:1.00.05
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compile error for missing constant kDescStateSessionDefault
When does this happen:
-------------------------------------------------------------------
At compile time.
In which configuration does this happen:
-------------------------------------------------------------------
In the used CDD the name of the default session state is different from "Default".
Resolution Description:
Workaround:
-------------------------------------------------------------------
Rename the default session state in the CDD to "Default"
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
23
Issue ReportESCAN00071804Functions and flags can be added to a Update Bit
signal after an dbc update was performedComponent@Subcomponent:Il_Vector@GenTool_Geny
First affected version:1.15.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Functions and flags can be added to an Update Bit signal, in the GENy GUI, after an dbc update
was performed. Functions and flags should not be available for Update Bit signals.
When does this happen:
-------------------------------------------------------------------
After a dbc update.
As the functions/flags will not be saved and generated this is only relevant for the configuration
time.
In which configuration does this happen:
-------------------------------------------------------------------
In a configuration with Update Bits.
Resolution Description:
Workaround:
-------------------------------------------------------------------
Save the configuration and reopen the configuration.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
24
Issue ReportESCAN00073608"Unknown Service Support" feature in GENy is
referenced as "Support Generic User Service"
featureComponent@Subcomponent:Diag_CanDesc__coreBase@Doc_TechRef
First affected version:2.00.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
In the technical reference a "Support Generic User Service" feature is referenced. In the GENy
configuration only a "Unknown Service Processing" feature exists.
When does this happen:
-------------------------------------------------------------------
-
In which configuration does this happen:
-------------------------------------------------------------------
-
Resolution Description:
Workaround:
-------------------------------------------------------------------
These are two names for the same feature.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
25
Issue Report2.4 Compiler Warnings As a service we also provide the known compiler warnings. The occurrence of a compiler warning
may depend on the used basic software configuration and compiler settings.
IndexESCAN00022682Compiler warning statement not reached in DescUsdtNetIsoTpAssertUser
Diag_CanDesc__coreBase@Implementation
ESCAN00027751Compiler warning for cast to smaller type for "failedByteMask"
Diag_CanDesc__coreBase@Implementation
ESCAN00033658Compiler Warning: W549 condition is always true
Nm_IndOsek@Implementation
ESCAN00037685Compiler Warning: Possible loss of data
Nm_IndOsek@Implementation
ESCAN00038038Compiler warning: SP debug info incorrect because of optimization or inline
assembler
Cp_Xcp@Implementation
ESCAN00044044Compiler Warning: condition is always false
Cp_Xcp@Implementation
ESCAN00044161Compiler Warning: Unused Static Function *ValueChanged
Il_Vector@GenTool_Geny
ESCAN00047283IL flags are declared without the "volatile" keyword.
Il_Vector@Implementation
ESCAN00048020Compiler warning: Deprecated use of PSR; flag bits not specified, "cf" assumed
VStdLib_Arm7@Implementation
ESCAN00057831Compiler warning: "canCanInterruptOldStatus" was declared but never
referenced
DrvCan__coreHll@Implementation
ESCAN00057832Compiler warning: "canCanInterruptCounter" was set but never referenced
DrvCan__coreHll@Implementation
ESCAN00058586Compiler warning: comparison is always true due to limited range of data type
DrvCan__coreHll@Implementation
ESCAN00059701Compiler warning: condition is always true" in the IlTxTimerTask,
IlTxStateTask and IlTxRepetitionsAreActive
Il_Vector@Implementation
ESCAN00059736Compiler warning: pointless comparison of unsigned integer with zero
DrvCan__coreHll@Implementation
ESCAN00061505Compiler warning: ApplCanMsgReceived: prior identical declaration -- ignored
DrvCan__base@GenTool_Geny
ESCAN00061617Compiler warning: warning C4244: '=' : conversion from
'DescDynDidMemBlockSize' to 'vuint16', possible loss of data
Diag_CanDesc__coreBase@Implementation
ESCAN00066833Compiler warning: Redefined macro name when compiling a main GENy
project with a sub-project
GenTool_GenyDriverBase@GenTool_Geny
26
Issue ReportESCAN00022682Compiler warning statement not reached in
DescUsdtNetIsoTpAssertUserComponent@Subcomponent:Diag_CanDesc__coreBase@Implementation
First affected version:4.00.00
Fixed in versions:Problem Description:
What happens :
---------------------------------------------------------------
Compiler warning "statement not reached" in
DescUsdtNetIsoTpAssertUser((TP_CHANNEL_TX_PARAM_VALUE != kTpNoChannel),
kDescNetAssertWrongIsoTpTxChannel);
When does this happen:
------------------------------------------------------------------
At compile time
In which configuration does this happen:
-----------------------------------------------------------------
- CANdesc/CANdescBasic
AND
- Debug support has been activated
AND
- Static Multi TPMC has been configured
Resolution Description:
Workaround:
-------------------------------------------------------------------
This warning can be ignored since there is no danger for the software normal functioning.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected workproducts.
27
Issue ReportESCAN00027751Compiler warning for cast to smaller type for
"failedByteMask"Component@Subcomponent:Diag_CanDesc__coreBase@Implementation
First affected version:3.01.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compiler warning message for the assignment:
*failedByteMask = (vuint8)(0x02 << *failedByteMask);
But there is no real danger of losing information by casting down to a smaller type since the code
generator does not allow more than 7 (seven) sub-service bytes in the request message. So
skipping the SID (bit 0) does not lead to losing the MSB and the value of the failedByteMask
cannot be greater than six.
When does this happen:
-------------------------------------------------------------------
At compile time.
In which configuration does this happen:
-------------------------------------------------------------------
-CANdesc/CANdescBasic
Resolution Description:
Workaround:
-------------------------------------------------------------------
Ignore the warning
Resolution:
-------------------------------------------------------------------
This ESCAN will not be resolved, since the fix might require more resources on the ECU. The code
generator assures that there will be no overflow on the shift operation.
28
Issue ReportESCAN00033658Compiler Warning: W549 condition is always trueComponent@Subcomponent:Nm_IndOsek@Implementation
First affected version:2.13.00
Fixed in versions:3.01.01
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
There is a compiler warning about a condition that is always true.
When does this happen:
-------------------------------------------------------------------
This issue occurs at compile time.
In which configuration does this happen:
-------------------------------------------------------------------
This issue occurs-
- if the compiler and the configured warning level checks for conditions that are always true.
and
- if #define INM_ENABLE_CLEAR_COUNTER is set
Note: This issue was found with Tasking-Compiler v2.2r3
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
The condition was replaces with the following code.
#if defined ( INM_ENABLE_CLEAR_COUNTER )
/* ESCAN00033658 */ /* check is not necessary, as counter is always 0 */
#else
if( pEvent->counter == 0 )
#endif
29
Issue ReportESCAN00037685Compiler Warning: Possible loss of dataComponent@Subcomponent:Nm_IndOsek@Implementation
First affected version:2.14.00
Fixed in versions:3.02.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
There is a compiler warning about possible loss of data.
When does this happen:
-------------------------------------------------------------------
This issue occurs at compile time.
In which configuration does this happen:
-------------------------------------------------------------------
- The compiler warning was found with a Metrowerks compiler
- The issue does not depend on the configuration.
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
30
Issue ReportESCAN00038038Compiler warning: SP debug info incorrect because
of optimization or inline assemblerComponent@Subcomponent:Cp_Xcp@Implementation
First affected version:1.25.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compiler warning by using the Metrowerks compiler V4.5
When does this happen:
-------------------------------------------------------------------
This occur always during compilation
In which configuration does this happen:
-------------------------------------------------------------------
all configurations
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
31
Issue ReportESCAN00044044Compiler Warning: condition is always falseComponent@Subcomponent:Cp_Xcp@Implementation
First affected version:1.26.02
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compiling file: ../../BSW/Xcp/xcpProf.c
0 errors, 5 warnings
ctc W549: ["../../BSW/Xcp/xcpProf.c" 2518/22] condition is always false
ctc W549: ["../../BSW/Xcp/xcpProf.c" 2522/22] condition is always false
ctc W549: ["../../BSW/Xcp/xcpProf.c" 2526/22] condition is always false
ctc W549: ["../../BSW/Xcp/xcpProf.c" 2659/22] condition is always false
ctc W549: ["../../BSW/Xcp/xcpProf.c" 2663/22] condition is always false
0 errors, 5 warnings
When does this happen:
-------------------------------------------------------------------
This happens when XCP_DISABLE_WRITE_PROTECTION and XCP_DISABLE_WRITE_EEPROM are
defined.
In which configuration does this happen:
-------------------------------------------------------------------
see above
Resolution Description:
Workaround:
-------------------------------------------------------------------
Enable
XCP_DISABLE_WRITE_PROTECTION or XCP_DISABLE_WRITE_EEPROM
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
32
Issue ReportESCAN00044161Compiler Warning: Unused Static Function
*ValueChangedComponent@Subcomponent:Il_Vector@GenTool_Geny
First affected version:1.00.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
The compiler warning unused static function occurs in il_par.c for *ValueChanged functions.
When does this happen:
-------------------------------------------------------------------
At compile time.
In which configuration does this happen:
-------------------------------------------------------------------
Any configuration, where Tx Signal > 32 Bit are used with the dbc GenSigSendType "OnChange"
or "OnChangeWithRepetition" and the Put Signal Access is deactivated.
Using the Tasking Compiler V3_2r3.
Resolution Description:
Workaround:
-------------------------------------------------------------------
Activate the Put Signal Access.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
33
Issue ReportESCAN00047283IL flags are declared without the "volatile" keyword.Component@Subcomponent:Il_Vector@Implementation
First affected version:3.10.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
IL flags (Indication, FirstValue, Confirmation, Timeout) are declared without the "volatile"
keyword. Read and Write access to IL flags has no effect due to a Read-Modify-Write problematic.
e.g.
FlagA and FlagB are in the same byte and set on interrupt level
this sequence is executed on task level:
disable int;
clear FlagA; /*1*/
enable int;
... /*3*/
disable int;
clear FlagB; /*2*/
enable int;
The compiler might optimize this sequence and the flag read and write ALWAYS fails:
read the byte at 1), modify the local copy and write the byte at 2)
if the byte is written on interrupt level at 3), the data is lost.
When does this happen:
-------------------------------------------------------------------
At runtime (This Problem has been found by a review and has never been detected in a ECU)
In which configuration does this happen:
-------------------------------------------------------------------
- This issue highly depends on the used compiler and compiler options.
- Preemptive IL flag access is used (e.g. interrupt system)
Resolution Description:
Workaround:
-------------------------------------------------------------------
Review the optimization configuration of your compiler.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
34
Issue ReportESCAN00048020Compiler warning: Deprecated use of PSR; flag bits
not specified, "cf" assumedComponent@Subcomponent:VStdLib_Arm7@Implementation
First affected version:1.00.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Following warnings occur:
[W0000] Deprecated use of PSR; flag bits not specified, "cf" assumed: msr CPSR, r1
The warning can be ignored, because the implementation of the vstdlib handle the missing of
"_cf".
When does this happen:
-------------------------------------------------------------------
The warning occurred during compile time
In which configuration does this happen:
-------------------------------------------------------------------
all
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
35
Issue ReportESCAN00057831Compiler warning: "canCanInterruptOldStatus" was
declared but never referencedComponent@Subcomponent:DrvCan__coreHll@Implementation
First affected version:2.07.00
Fixed in versions:2.15.02
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compiler warns for a unused declaration of an variable which is not used in a special
configuration: Can be accepted
When does this happen:
-------------------------------------------------------------------
The warning is issued by the compiler during compilation of the code in case the configuration is
as described below.
In which configuration does this happen:
-------------------------------------------------------------------
Configurations which declare "#define C_DISABLE_CAN_CAN_INTERRUPT_CONTROL" in
can_cfg.h, means that CAN-driver did not interrupt-control by himself -> FlashBootLoader.
Resolution Description:
Workaround:
-------------------------------------------------------------------
The warning can be ignored.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
36
Issue ReportESCAN00057832Compiler warning: "canCanInterruptCounter" was
set but never referencedComponent@Subcomponent:DrvCan__coreHll@Implementation
First affected version:2.07.00
Fixed in versions:2.15.02
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compiler warns for an unused variable which is not used in a special configuration: Can be
accepted
When does this happen:
-------------------------------------------------------------------
The warning is issued by the compiler during compilation of the code in case the configuration is
as described below.
In which configuration does this happen:
-------------------------------------------------------------------
Configurations which declare "#define C_DISABLE_CAN_CAN_INTERRUPT_CONTROL", means that
CAN-driver did not interrupt-control by himself -> FlashBootLoader.
Resolution Description:
Workaround:
-------------------------------------------------------------------
The warning can be ignored.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
37
Issue ReportESCAN00058586Compiler warning: comparison is always true due to
limited range of data typeComponent@Subcomponent:DrvCan__coreHll@Implementation
First affected version:2.00.00
Fixed in versions:2.15.01
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compiler warns that comparison is always true in following code:
assertUser((CanSignedRxHandle)rxObjHandle >=
(CanSignedRxHandle)CAN_HL_HW_RX_BASIC_STARTINDEX(canHwChannel), channel,
kErrorHwHdlTooSmall);
There is no impact during runtime. The warning can be ignored.
When does this happen:
-------------------------------------------------------------------
The warning is issued by the compiler during compilation of the code in case the configuration is
as described below.
In which configuration does this happen:
-------------------------------------------------------------------
This happens if
- user assertions are enabled (C_ENABLE_USER_CHECK is defined in can_cfg.h)
AND
- single receive channel is used (C_SINGLE_RECEIVE_CHANNEL)
AND
- individual polling is enabled (C_ENABLE_INDIVIDUAL_POLLING is defined in can_cfg.h; requires
high end license)
AND
- at least one Rx BasicCAN object is present in the configuration
(C_ENABLE_RX_BASICCAN_OBJECTS is defined in can_cfg.h)
AND
- at least one Rx BasicCAN object is configured to be processed by polling
(C_ENABLE_RX_BASICCAN_POLLING is defined in can_cfg.h)
AND
- kCanHwRxBasicStartIndex is 0 (this is platform dependent)
Detected with DrvCan__Sh2RcanHll and "sh-elf-gcc.exe (GCC) 4.2-GNUSH_v0703"
Resolution Description:
Workaround:
-------------------------------------------------------------------
The warning can be ignored
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
38
Issue ReportESCAN00059701Compiler warning: condition is always true" in the
IlTxTimerTask, IlTxStateTask and
IlTxRepetitionsAreActiveComponent@Subcomponent:Il_Vector@Implementation
First affected version:2.42.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compiler warns for "condition is always true" in the IlTxTimerTask, IlTxStateTask and
IlTxRepetitionsAreActive API. This may happen depending on the configuration.
When does this happen:
-------------------------------------------------------------------
The warning is issued by the compiler during compilation of the code in case the configuration is
as described below.
In which configuration does this happen:
-------------------------------------------------------------------
IlTxTimerTask, IlTxStateTask: Any configuration with exactly one tx message.
IlTxRepetitionsAreActive: Any configuration with exactly one tx message and the API is
configured. (IL_ENABLE_SYS_TX_REPETITIONS_ARE_ACTIVE_FCT must be defined)
Hint:
-------------------------------------------------------------------
The compiler warning is known and has been analyzed thoroughly for its impact on the code.
Nevertheless it will not be fixed due to the rare configuration. The code uses a while loop with a
counter and can probably replaced by a for loop, but other compilers or codeanalysers may warn
about a useless loop. The code exists for about 15 Years and will not be changed.
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
39
Issue ReportESCAN00059736Compiler warning: pointless comparison of
unsigned integer with zeroComponent@Subcomponent:DrvCan__coreHll@Implementation
First affected version:2.00.00
Fixed in versions:2.15.01
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compiler warns that comparison is always true in following code:
assertUser((CanSignedRxHandle)rxObjHandle >=
(CanSignedRxHandle)CAN_HL_HW_RX_FULL_STARTINDEX(canHwChannel), channel,
kErrorHwHdlTooSmall);
There is no impact during runtime. The warning can be ignored.
When does this happen:
-------------------------------------------------------------------
The warning is issued by the compiler during compilation of the code in case the configuration is
as described below.
In which configuration does this happen:
-------------------------------------------------------------------
This happens if
- user assertions are enabled (C_ENABLE_USER_CHECK is defined in can_cfg.h)
AND
- single receive channel is used (C_SINGLE_RECEIVE_CHANNEL)
AND
- individual polling is enabled (C_ENABLE_INDIVIDUAL_POLLING is defined in can_cfg.h; requires
high end license)
AND
- at least one Rx FullCAN object is present in the configuration
(C_ENABLE_RX_FULLCAN_OBJECTS is defined in can_cfg.h)
AND
- at least one Rx FullCAN object is configured to be processed by polling
(C_ENABLE_RX_FULLCAN_POLLING is defined in can_cfg.h)
AND
- kCanHwRxFullStartIndex is 0 (this is platform dependent)
Detected with DrvCan_Mpc5500Flexcan2Hll and GHS v6.1.0
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
40
Issue ReportESCAN00061505Compiler warning: ApplCanMsgReceived: prior
identical declaration -- ignoredComponent@Subcomponent:DrvCan__base@GenTool_Geny
First affected version:3.18.01
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compiler warns for duplicated function prototype: Can be accepted
When does this happen:
-------------------------------------------------------------------
The warning is issued by the compiler during compilation of the code in case the configuration is
as described below.
In which configuration does this happen:
-------------------------------------------------------------------
One CAN channel is used (C_SINGLE_RECEIVE_CHANNEL is defined)
AND
Feature "Rx notification" is enabled (C_ENABLE_RECEIVE_FCT is defined)
AND
CANbedded CAN driver with Reference Implementation 1.4 or lower
Hint: This will not be resolved for RI 1.4 or lower. The warning can be ignored.
Resolution Description:
Workaround:
-------------------------------------------------------------------
The warning can be ignored.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
41
Issue ReportESCAN00061617Compiler warning: warning C4244: '=' : conversion
from 'DescDynDidMemBlockSize' to 'vuint16',
possible loss of dataComponent@Subcomponent:Diag_CanDesc__coreBase@Implementation
First affected version:1.00.00
Fixed in versions:Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
desc.c(8368): warning C4244: '=' : conversion from 'DescDynDidMemBlockSize' to 'vuint16',
possible loss of data
desc.c(8371): warning C4244: '=' : conversion from 'DescDynDidMemBlockSize' to 'DescMsgLen',
possible loss of data
desc.c(8424): warning C4244: '+=' : conversion from 'DescDynDidMemBlockSize' to
'DescMsgLen', possible loss of data
When does this happen:
-------------------------------------------------------------------
The warning is issued by the compiler during compilation of the code in case the configuration is
as described below.
In which configuration does this happen:
-------------------------------------------------------------------
constant FID (Format IDentifier) configured in cdd file
High Nibble of the FID (Length of the memory size parameter) is bigger than 2
=> no problem for the CAN use case (when CANdesc is used only with CAN)
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
42
Issue ReportESCAN00066833Compiler warning: Redefined macro name when
compiling a main GENy project with a sub-projectComponent@Subcomponent:GenTool_GenyDriverBase@GenTool_Geny
First affected version:2.00.00
Fixed in versions:2.10.00
Problem Description:
What happens (symptoms):
-------------------------------------------------------------------
Compiler generates warning on the following macro redefinitions:
v_cfg_1.h(180) : CC78K0R warning W0816: Redefined macro name
'V_ATOMIC_BIT_ACCESS_IN_BITFIELD'
v_cfg_1.h(181) : CC78K0R warning W0816: Redefined macro name
'V_ATOMIC_VARIABLE_ACCESS'
v_cfg_1.h(196) : CC78K0R warning W0816: Redefined macro name 'kComNumberOfNodes'
v_cfg_1.h(197) : CC78K0R warning W0816: Redefined macro name 'ComSetCurrentECU'
v_cfg_1.h(198) : CC78K0R warning W0816: Redefined macro name 'comMultipleECUCurrent'
When does this happen:
-------------------------------------------------------------------
The warning is issued by the compiler during compilation of the code in case the configuration is
as described below.
In which configuration does this happen:
-------------------------------------------------------------------
When two GENy projects are compiled together (e.g. CAN, LIN), one is setup as "main project"
and the other is setup as "sub-project"
Resolution Description:
Workaround:
-------------------------------------------------------------------
No workaround available.
Resolution:
-------------------------------------------------------------------
The described issue is corrected by modification of all affected work-products.
43
Issue Report3. New Issues for InformationIssues which should not have an effect on the usage of the license as the issues are relevant for
use cases other than those defined in the questionnaire. The list contains issues that have been
detected since the last report.
Issues listed in this section are not relevant for the use case that has been documented in the
questionnaire provided to Vector. However, the issues may be relevant for other use cases. Also
issues that have been accepted or are tolerated by the OEM (as defined in the questionnaire) are
reported here.
No issue to be reported.
44

Issue Report4. Report Legend45
Issue Report5. Quality Management ContactDiemo Krüger
PES Quality Management Engineer
Productline Embedded Software (PES)
Vector Informatik GmbH
Ingersheimer Str. 24
D-70499 Stuttgart
Phone: +49 711 80670-3477
Fax: +49 711 80670-399
eMail: diemo.krueger@vector.com
46
Document Outline
1.1.27 - TechnicalReference_CAN_TMS470DCAN
Vector CAN Driver1.1.29 - TechnicalReference_CAN_TMS470DCANs
Vector CAN Driver
Technical Reference
Texas Instruments
TMS470
DCAN
Authors Georg Pflügel, Karol Kostolny, Sebastian Gaertner, Arthur Jendrusch
Versions: 1.05.00
Status: Released


Vector CAN Driver Technical Reference TMS470 DCAN
Contents 1 Introduction ................................................................................................................... 5 2 Important References ................................................................................................... 6 2.1 Known Compatible Derivatives ........................................................................ 6 3 Usage of Controller Features ....................................................................................... 8 3.1 [#hw_comObj] - Communication Objects ......................................................... 8 3.2 Miscellaneous ................................................................................................. 9 4 [#hw_sleep] - SleepMode and WakeUp ...................................................................... 10 4.1 Global Power down mode ............................................................................. 10 4.2 Local Power down mode ............................................................................... 11 5 [#hw_loop] - Hardware Loop Check ........................................................................... 12 6 [#hw_busoff] - Bus off ................................................................................................ 13 7 CAN Driver Features ................................................................................................... 14 7.1 [#hw_feature] - Feature List ........................................................................... 14 7.2 Description of Hardware related features ...................................................... 16 7.2.1 [#hw_status] – Status .................................................................................... 16 7.2.2 [#hw_stop] - Stop Mode ................................................................................. 16 7.2.3 [#hw_int] - Control of CAN Interrupts ............................................................. 16 7.2.4 [#hw_cancel] - Cancel in Hardware ............................................................... 17 7.2.5 Polling Mode ................................................................................................. 18 8 [#hw_assert] - Assertions ........................................................................................... 19 9 API ................................................................................................................................ 20 9.1 Category ....................................................................................................... 20 10 Implementations Hints ................................................................................................ 21 10.1 Important Notes ............................................................................................. 21 11 Configuration .............................................................................................................. 22 11.1 Configuration by GENy .................................................................................. 22 11.1.1 Compiler and Chip Selection ......................................................................... 22 11.1.2 Bus Timing .................................................................................................... 23 11.1.3 Acceptance Filtering ...................................................................................... 24 2012, Vector Informatik GmbH
Version: 1.05.00
2 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
12 Known Issues / Limitations ........................................................................................ 27 13 Contact......................................................................................................................... 28 2012, Vector Informatik GmbH
Version: 1.05.00
3 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
History Author Date Version Remarks Georg Pflügel
12.06.2007
1.00
creation
Karol Kostolny
28.08.2007
1.01
Low level message transmit feature added
Sebastian Gärtner
28.07.2009
1.02
Support new derivative TMS470MSF542
Georg Pflügel
25.10.2010
1.03
Add description for DCAN Issue#22 workaround
Support new derivative TMS570PSFC66
Georg Pflügel
09.12.2010
1.03.01
Add description for the already supported derivatives
TMS570PSFC61, TMS570LS1x and TMS570LS2x
Georg Pflügel
29.09.2011
1.03.02
Add description for the already supported derivatives
TMS470MSF542, TMS470MF03107, TMS470MF04207
and TMS470MF06607.
Arthur Jendrusch
20.12.2011
1.03.03
CAN Driver Version changed to V1.14.01
Support new derivative TMS570LS30316U
Arthur Jendrusch
16.04.2012
1.03.04
Support new derivative TMS570LS12004U
Georg Pflügel
04.06.2012
1.04.00
Support of local dower down mode
Support of wakeup polling
Georg Pflügel
06.12.2012
1.05.00
Support new derivatives TMS570LS0322 and
TMS470PSF764
2012, Vector Informatik GmbH
Version: 1.05.00
4 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
1 Introduction The concept of the CAN driver and the standardized interface between the CAN driver and
the application is described in the document
TechnicalReference_CANDriver.pdf. The CAN
driver interface to the hardware is designed in a way that capabilities of the special CAN
chips can be utilized optimally. The interface to the application was made identical for the
different CAN chips, so that the "higher" layers such as network management, transport
protocols and especially the application would essentially be independent of the particular
CAN chip used.
This document describes the hardware dependent special features and implementation
specifics of the
CAN Chip D-CAN on the microcontrollers TMS470 and TMS570.
2012, Vector Informatik GmbH
Version: 1.05.00
5 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
2 Important References The following table summarizes information about the CAN Driver. It gives you detailed
information about the versions, derivatives and compilers. As a very important information
the documentations of the hardware manufacturers are listed. The CAN Driver is based
upon these documents in the given version.
Hardware Manufacturer Drivers RI Derivative Compiler Version Document Name 1.14.01
1.5 TMS470PSF761
Texas
TMS470PSF761 DesignSpec.pdf
Rev 0.8
TMS570PSF762
Instruments TMS570PSF762_1.5.pdf
Rev 1.5
TMS470PSF764
ARM
TMS470PSF764 Delphinus datasheet .pdf
SPNS146
TMS470MSF542
TMS470MSF54x TRM (Draft)
02/2009
TMS470MSF542PZ DesignSpec.pdf
Rev 1.01
TMS570PSFC66
TMS570PSFC66_design_specification_22.pdf Rev 2.2
TMS570PSFC66_device_datasheet.pdf
SPNS141
TMS570PSFC61
TMS570PSFC61_Specification_044.pdf
Rev 0.44
TMS570LS30316U
Gladiator_design_specification_GM_Auto.pdf
V2.5.1
TMS570LS12004U
TMS570LS0322
SPNS186_TMS570LS0x32_DataSheet.pdf
SPNS186
DCAN_reference_guide_v0_23.pdf
V 0.23
Drivers: This is the current version of the CAN Driver
RI: Shows the version of the Reference Implementation and therefore the functional scope of the CAN Driver
Derivative: This can be a single information or a list of derivatives, the CAN Driver can be used on.
Compiler: List of Compilers the CAN Driver is working with
Hardware Manufacturer Document Name: List of hardware documentation the CAN Driver is based on.
Version: To be able to reference to this hardware documentation its version is very important.
2.1 Known Compatible Derivatives Texas Instruments has established a new name space for the TMS570 derivatives. With
this name space it is possible to rename existing derivatives. Future planed derivatives will
named up to now with this name space too.
2012, Vector Informatik GmbH
Version: 1.05.00
6 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
Old name supported With this selection this derivatives Comment:
by Geny: from new name space will run too: TMS570PSFC66
TMS570LS101xx
1M Flash 128k RAM
TMS570LS102xx
1M Flash 160k RAM
TMS570LS202xx
2M Flash 160k RAM
TMS470MSF542
TMS470MF03107
320k Flash 16k RAM
TMS470MF04207
448k Flash 24k RAM
TMS470MF06607
640k Flash 64k RAM
2012, Vector Informatik GmbH
Version: 1.05.00
7 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
3 Usage of Controller Features 3.1 [#hw_comObj] - Communication Objects Depending of the controller the CAN cells provide a specific number of mailboxes.
Controller #Objects of CAN cell 1 #Objects of CAN cell 2 #Objects of CAN cell 3 TMS470PSF761
64
32
-
TMS570PSF762
64
32
-
TMS470PSF764
64
32
-
TMS470MSF542
16
32
-
TMS570PSFC61
64
64
32
TMS570PSFC66
64
64
32
TMS570LS30316U 64
64
64
TMS570LS12004U 64
64
64
TMS570LS0322
32
16
-
The generation tool supports a flexible allocation of message buffers. In the following
tables the configuration variants of the CAN driver are listed. The message buffers are
allocated in the following order for each channel:
Obj number Obj type No. of Objects comment 0-nmsg
These objects are used by
CanTransmit() to send
a certain message. The user must define
statically (Generation Tool) which CAN messages
1 – n
Tx Full CAN
are located in such Tx FullCAN objects. The
Generation Tool distributes the messages to the
FullCAN objects according to their identifier
priority.
1
This object is used by
CanTransmit() to send
several messages. If the transmit message object
m
Tx Normal
is busy, the transmit request is stored in a queue
0-1
This object is used by
CanMsgTransmit() to send
Low
Level
it’s messages, if the low level transmit
o
Tx
functionality is selected.
0-nmsg
These objects are not used. It depends on the
p – q
unused
configuration of receive and transmit objects if
unused objects are available.
2012, Vector Informatik GmbH
Version: 1.05.00
8 /28
based on template version 3.2



Vector CAN Driver Technical Reference TMS470 DCAN
0-nmsg
These objects are used to receive specific CAN
messages.
The
user
defines
statically
(Generation Tool) that a CAN message should be
r – x
Rx Full CAN
received in a FullCAN message object. The
Generation Tool distributes the message to the
FullCAN objects.
2-4
All
other
CAN
messages
(Application,
y – z
Basic CAN
Diagnostics, Network Management) are received
via the Basic CAN message object.
nmsg = (Max number of objects) – (number of Tx Normal objects) – (number of Basic CAN objects) Example For a CAN cell with 32 objects the following values are assumed:
Configurations with Standard Id or Extended Id: x = 30, y = 31, z = 32
Configurations with Mixed Id: x = 28, y = 29, z = 32
If the configuration contains Standard Ids and Extended Ids (configuration with
Mixed Id), the Basic CAN use 4 hardware message objects. Two of them will be
used for the reception of the Standard Ids and two will be used for the reception
of the Extended Ids.
3.2 Miscellaneous The CAN driver was designed to run in privileged mode only. There is no support for user
mode.
2012, Vector Informatik GmbH
Version: 1.05.00
9 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
4 [#hw_sleep] - SleepMode and WakeUp The CAN module can be switched into sleep mode by calling the function CanSleep and
from sleep into operation mode by calling the function CanWakeUp. There are two power-
down modes available, the global power-down mode and the local power-down mode. The
first is supported by all TMS570 DCAN derivates, the second only if it is documented in the
datasheet. This is because the CAN controller has not initially supported the local power-
down mode. It was added to the DCAN cell since documented in the reference guide
revision 0.30.
4.1 Global Power down mode The configuration-bits to set and reset the hardware of the D_CAN into and from global
power down mode are not inside the CAN-controller. It is part of the Power-down-
management of the CPU. To make the driver independent of access to the configuration
bits, there are two callback-functions inside CanSleep and CanWakeUp.
ApplCanGoToSleepModeRequest
This function will be called from CanSleep. The user has to add this function to the
application with some code inside to set the CAN-controller into sleep mode. Parameter
CAN_CHANNEL_CANTYPE_ONLY is
void for Single Receive Channels (SRC) and
channel for Multiple Receive Channel (MRC).
Example:
vuint8 ApplCanGoToSleepModeRequest(CAN_CHANNEL_CANTYPE_ONLY)
{
/* Quadrants are 256 bytes each, so DCAN1 is QUAD0 and QUAD1, DCAN2 is QUAD2
and QUAD3 */
if (channel == 0)
{
*((vuint32 *)0xFFFFE084 /* Peripheral Power-Down Set Register 1 */) = 0x00000003; /*
QUAD0 and QUAD1 */
}
else if (channel == 1)
{
*((vuint32 *)0xFFFFE084 /* Peripheral Power-Down Set Register 1 */) = 0x0000000C; /*
QUAD2 and QUAD3 */
}
return kCanOk;
}
2012, Vector Informatik GmbH
Version: 1.05.00
10 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
ApplCanWakeUpFromSleepModeRequest
This function will be called from CanWakeUp. The user has to add this function to the
application with some code inside to reset the CAN-controller from sleep mode. Parameter
CAN_CHANNEL_CANTYPE_ONLY is
void for Single channel and
channel for Multiple
channel.
Example:
vuint8 ApplCanWakeUpFromSleepModeRequest(CAN_CHANNEL_CANTYPE_ONLY)
{
/* Quadrants are 256 bytes each, so DCAN1 is QUAD0 and QUAD1, DCAN2 is QUAD2
and QUAD3 */
if (channel == 0)
{
*((vuint32 *)0xFFFFE0A4 /* Peripheral Power-Down Clear Register 1 */) = 0x00000003;
/* QUAD0 and QUAD1 */
}
else if (channel == 1)
{
*((vuint32 *)0xFFFFE0A4 /* Peripheral Power-Down Clear Register 1 */) = 0x0000000C;
/* QUAD2 and QUAD3 */
}
return kCanOk;
}
4.2 Local Power down mode If the local power down mode is selected, the PDR bit inside the CAN cell will be used to
set the CAN cell into the sleep mode. With this there are no callback functions necessary
and the application has not to handle some additional hardware register.
2012, Vector Informatik GmbH
Version: 1.05.00
11 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
5 [#hw_loop] - Hardware Loop Check For the feature Hardware Loop Check (see TechnicalReference_CANDriver in the chapter
Hardware Loop Check) this CAN Driver provides the following timer identifications:
KCanLoopIrqReq Where is the loop implemented?
CAN Interrupt service routine.
What is the loop for?
Loop over all pending interrupts (Rx, Tx).
Is the loop channel dependent? Can this timer identification be called reentrant?
One loop for each channel, no reentrant call.
How often is ApplCanTimerLoop called?
Once with every pending interrupt request or permanently until loop exit.
Maximum expected duration of the loop or maximum expected calls of the loop
Depend on interrupt occurrence.
Reasons for a delay - why is the maximum expected duration exceeded?
Defect in hardware (what leads to a longer duration than the maximum expected time)
If the loop does not end and the application has to terminate the loop, what has to be done
then?
Exit loop and retrigger interrupt after application action is done.
kCanLoopBusyReq Where is the loop implemented?
CanCopyDataAndStartTransmission, CanBasicCanMsgReceived, CanFullCanMsgReceived
CanHL_TxConfirmation, CanMsgTransmit
What is the loop for?
Check that the CAN-cell leaves the busy state.
Is the loop channel dependent? Can this timer identification be called reentrant?
One loop for each channel, reentrant call.
How often is ApplCanTimerLoop called?
Permanently until CAN-cell leaves the busy state.
Maximum expected duration of the loop or maximum expected calls of the loop
The busy state need 3-6 CAN_CLK periods.
Reasons for a delay - why is the maximum expected duration exceeded?
Defect in hardware (what leads to a longer duration than the maximum expected time)
If the loop does not end and the application has to terminate the loop, what has to be done
then?
If the loop does not end and the application has to terminate the loop, CanInit has to be called.
2012, Vector Informatik GmbH
Version: 1.05.00
12 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
6 [#hw_busoff] - Bus off The DCAN CAN-controller contains an Auto-Bus-On mode. Using this mode, the DCAN
automatically starts a bus-off-recovery sequence by resetting bit Init to
zero after a delay
defined by register „Auto Bus On Time“, when DCAN is getting bus-off.
The feature Auto-Bus-On is deactivated by the CAN-driver and the software has to decide,
whether to leave DCAN in bus-off state or to start the bus-off-recovery sequence by
resetting the Init bit. The CAN-driver supports the application with the call-back function
ApplCanBusOff and the macro CanResetBusStart, that is defined to CanInit.
The application has to call CanResetBusStart as soon as possible after the CAN driver has
made a busoff notification by calling ApplCanBusOff. After this the CAN-controller will be
initialized again and the Init bit will be reset.
2012, Vector Informatik GmbH
Version: 1.05.00
13 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
7 CAN Driver Features 7.1 [#hw_feature] - Feature List CAN Driver Functionality Standard HighEnd Texas Instruments / Texas Instruments / ARM ARM Initialization Power-On Initialization
Re-Initialization
Transmission Transmit Request
Transmit Request Queue
Internal data copy mechanism
Pretransmit functions
Common confirmation function
Confirmation flag
Confirmation function
Offline Mode
Partial Offline Mode
Passive Mode
Tx Observe mode
Dynamic TxObjects
ID
DLC
Data-Ptr
Full CAN Tx Objects
Cancellation in Hardware
Low Level Message Transmit
Reception Receive function
Search algorithms
Linear
Table
Index
Hash
Range specific precopy functions (min. 2, typ.4)
4
4
DLC check
Internal data copy mechanism
Generic precopy function
Precopy function
Indication flag
Indication function
2012, Vector Informatik GmbH
Version: 1.05.00
14 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
Message not matched function
Overrun Notification
FullCAN overrun notification
Multiple BasicCAN
Rx Queue
Bus off Notification function
Nested Recovery functions
Sleep Mode Mode Change
Preparation
Notification function
Special Feature Status
Security Level
Assertions
Hardware loop check
Stop Mode
Support of OSEK operating system
Polling Mode
Tx
Rx (FullCAN objects)
Rx (BasicCAN objects)
Error
Wakeup
Individual Polling
Multi-channel
Support extended ID addressing mode
Support mixed ID addressing mode
Support access to error counters
Copy functions
CAN RAM check
Interrupt-lock-level
2012, Vector Informatik GmbH
Version: 1.05.00
15 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
7.2 Description of Hardware related features 7.2.1 [#hw_status] – Status If a status is not supported, the related macro returns always false.
CanHwIsOk(state)
CanHwIsWarning(state)
CanHwIsPassive(state)
CanHwIsBusOff(state)
CanHwIsWakeup(state)
CanHwIsSleep(state)
CanHwIsStart(state)
CanHwIsStop(state)
CanIsOnline(state)
CanIsOffline(state)
7.2.2 [#hw_stop] - Stop Mode The function CanStop can be called to switch the CAN driver into stop mode. Then the
CAN module will enter the listen only mode. In this mode the CAN interface does not
communicate, i.e. no acknowledge and no active error flags are driven to the CAN bus.
The error counters stay at the current value.
The function CanStart has to be called to leave the stop mode and to switch the CAN
hardware back into operation mode.
CanOffline must be called before calling CanStop. CanOnline must be called after
CanStart to enable message transmission.
7.2.3 [#hw_int] - Control of CAN Interrupts The application has to initialize the CAN I/O port pins and the CAN interrupt request
register before calling function CanInitPowerOn.
2012, Vector Informatik GmbH
Version: 1.05.00
16 /28
based on template version 3.2



Vector CAN Driver Technical Reference TMS470 DCAN
7.2.4 [#hw_cancel] - Cancel in Hardware With the feature “cancel in hardware” it is possible to clear a transmit request direct inside
the CAN-controller hardware. This feature can be used to clear the pending transmit
request of a CAN-message that can not be send out of the hardware, because the CAN-
message can not arbitrate the bus.
If the feature cancel in Hardware is used, it is necessary to call the Tx-Task cyclic.
Yes No Has the CanTxTask() to be called by the application to handle the
canceled transmit request in the hardware?
Cancelling
transmission
of
messages
via
CanCancelTransmit
or
CanCancelMessageTransmit:
In some cases the callback function ApplCanTxConfirmation is called for an already
cancelled message. This is how this CAN Driver reacts:
Yes No ApplCanConfirmation() is only called for transmitted messages.
Successfully cancelled messages are not notified. That means the CAN
Driver is able to detect whether is message is transmitted even if the
application has tried to cancel the message.
After a message has finished the arbitration of the bus, it is no more possible to cancel this
message. Because of this, after cancel in Hardware was used, it is necessary to wait a
security delay time to be sure that a message, that was not able to cancel, was send. This
delay time must be the maximal length of a CAN-message (132 Bittimings). So the wait
time depends from the used Baudrate and is:
wait time [sec] = 132Bit * ( 1 / Baudrate [Bit/sec] )
Example Time for 100 kBaud:
wait time [sec] = 132Bit * ( 1 / 100000 [Bit/sec] ) = 0,00132 sec
This
wait
time
can
be
produced
with
the
two
call
back
functions
ApplCanTxCancelInHwStart and ApplCanTxCancelInHwConfirmed.
2012, Vector Informatik GmbH
Version: 1.05.00
17 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
void ApplCanTxCancelInHwStart(CanObjectHandle txHwObject)
{
}
This call back function will be called once time after the transmit request is cleared from
the hardware. It can be used from the application to start a wait time. This wait time
depends on the used baudrate.
vuint8
ApplCanTxCancelInHwConfirmed(CanObjectHandle txHwObject)
{
}
This call back function will be called from the CanTxTask. If the CanTxTask is called cyclic,
ApplCanTxCancelInHwConfirmed can be used from the application to count a wait time
down. The return value of this call back function has to be False after the delay time is
over, and True during the delay time.
7.2.5 Polling Mode The driver supports Rx Full-CAN Polling, Rx Basic-CAN Polling, Tx Polling and Error
Polling. Wake-up polling is not supported. If the hardware wakes up, a Status Interrupt will
be generated. It is not possible to notify a Wakeup with a polling mode. Because of this, it
is not allowed to activate the feature Sleep-Wakeup if Error Polling is configured.
2012, Vector Informatik GmbH
Version: 1.05.00
18 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
8 [#hw_assert] - Assertions In case of a user assertion: kErrorInitObjectHdlTooLarge
CanInit()
called with parameter too large
kErrorTxHdlTooLarge
CanTransmit() called with transmit handle too large
kErrorIntRestoreTooOften
CanInterruptRestore() called too often
kErrorIntDisableTooOften
CanInterruptDisable() called too often
kErrorAccessedInvalidDynObj
CanGetDynTxObj(), CanReleaseDynTxObj()
or
CanDynTxObjSet...() is called with wrong transmit
handle (transmit handle too large)
kErrorAccessedStatObjAsDyn
CanGetDynTxObj(), CanReleaseDynTxObj()
or
CanDynTxObjSet...() is called with wrong transmit
handle (transmit handle depends on a static object)
kErrorDynObjReleased
UserConfirmation() or UserPreTransmit() is called for a
dynamic object which is already released.
In case of a generation assertion: kErrorToManyFullCanObjects
The generated number of Full-CAN Objects is too big.
In case of a hardware assertion: kErrorTxBufferBusy
Hardware transmit object is busy, but this is not expected.
kErrorRxBufferBusy
Hardware receive object is busy, but this is not expected.
kErrorHwObjNotInPolling
In case of a internal assertion: kErrorIllIrptNumber
A CAN-Interrupt occurs with a not valid Interruptnumber.
kErrorHwObjNotInPolling
A Hardwareobject that is configured to Pollingmode
generates an unexpected CAN-Interrupt.
2012, Vector Informatik GmbH
Version: 1.05.00
19 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
9 API 9.1 Category Single Receive Channels (SRC)
A “Single Receive Channel” CAN Driver supports one CAN channel.)
Multiple Receive Channel (MRC):
A "Single Receive Channel" CAN Driver is typically extended for
multiple channels by adding an index to the function parameter list (e.g.
CanOnline() becomes to CanOnline(channel)) or by using the handle
as a channel indicator (e.g. CanTransmit(txHandle)).
2012, Vector Informatik GmbH
Version: 1.05.00
20 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
10 Implementations Hints These options are highly compiler dependent. The necessary options are described in the
installation instructions.
10.1 Important Notes 1.) The following condition will lead to an endless recursion in the CAN Driver:
recursive call of 'CanTransmit' within a confirmation routine, if the CAN Driver has been
set into the passive state by CanSetPassive.
recommendations =>
- NO CALL OF CanTransmit WITHIN CONFIRMATION-ROUTINES
- PLEASE USE CanSetPassive ONLY ACCORDING TO THE DESCRIPTION
2.) Only the transmit line of the CAN Driver is blocked by the functions CanOffline().
However, messages in the transmit buffer of the CAN-Chip, are still sent. For a reliable
prevention of this fact, call function CanInit after calling CanOffline(). The order of
the two function calls is urgently required, due to the fact, that CanInit() is only
allowed in offline mode.
3.) Resetting indication flags and confirmation flags is done by Read-Modify-Write. The
application is responsible for consistence. CanGlobalInterruptDisable() and
CanGlobalInterruptRestore() must be called to avoid interruption by the CAN.
Confirmations or indications can be lost otherwise.
4.) [TMS470MSF542 only:] The CAN driver will suspend all interrupts by disabling all
interrupts of the same or lower level (i.e. larger priority value). The chosen level must
be equal or higher than the highest level of any functionality of the CAN Driver
(Wakeup Interrupt, signal access, etc). To allow this the interrupt nesting option has to
be disabled during all CAN driver operations.
5.) [TMS470MSF542 only:] All external interrupts (i.e. all interrupts controlled by M3VIM)
have to be configured as ISR type. NMI exceptions would pass the global interrupt
suspension of the CAN driver.
2012, Vector Informatik GmbH
Version: 1.05.00
21 /28
based on template version 3.2




Vector CAN Driver Technical Reference TMS470 DCAN
11 Configuration 11.1 Configuration by GENy Using the Generation Tool the complete configuration can be done by the tool. The
configuration options common to all CAN Drivers are described in the CAN Driver manual
TechnicalReference_CANDriver.pdf.
Info To get further information please refer to the Online-Help of the Generation Tool.
11.1.1 Compiler and Chip Selection Target system Hw_Tms470/570Cpu (Dcan)
Compiler Texas Instruments
ARM
Derivative TMS470PSF761
TMS570PSF762
TMS470PSF764
TMS470MSF542
TMS570PSFC66
TMS570LS30316U
TMS570LS12004U
TMS570LS0322
2012, Vector Informatik GmbH
Version: 1.05.00
22 /28
based on template version 3.2



Vector CAN Driver Technical Reference TMS470 DCAN
11.1.2 Bus Timing In the Bus Timing dialog it is possible to select a Clock frequency and a Baudrate for the
calculation of the Bus timing register 1-3. The calculated values will be generated and
used by the can-driver.
Moreover it is possible to recalculate a Baudrate out of the values of given Bus timing
registers or the used Clock frequency of a configuration from values of given Bus timing
registers and the Baudrate.
You find detailed information concerning the bus timing settings in the online help of the
Generation Tool.
2012, Vector Informatik GmbH
Version: 1.05.00
23 /28
based on template version 3.2



Vector CAN Driver Technical Reference TMS470 DCAN
11.1.3 Acceptance Filtering The dialog of the acceptance filter settings depends from the Id-types in the used
database. If there are only standard Id’s used, the type of the acceptance filter is standard
and if there are only extended Id’s used, the type of the acceptance filter is extended (see
the two next pictures). Only if there are standard and extended Id’s used inside the
database, or if the configuration use both types of Id’s (for example there is a extended Id-
range configured in a standard Id database), there will be two acceptance filter used. The
type of the first acceptance filter will be standard and the second will be extended.
2012, Vector Informatik GmbH
Version: 1.05.00
24 /28
based on template version 3.2




Vector CAN Driver Technical Reference TMS470 DCAN
2012, Vector Informatik GmbH
Version: 1.05.00
25 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
The following mask and code values are the raw values written in the CAN cell registers, to set the
„Acceptance Filter“.
For multiple Basic CANs there will be one Acceptance Filter for each Basic CAN.
Please use one standard and one extended Filter to handle mixed ID systems. (mixed Filters lead
to problems for none fully opened filters because received messages may change the filter during
runtime – this is a hardware specific behavior)
MaskHi “Arbitration Mask Register High” value of the BasicCAN object.
The value can be modified by changing “Acceptance Filter” or by using “Open
filters” or “Optimize” button.
MaskLo “Arbitration Mask Register Low” value of the BasicCAN objects.
The value can be modified by changing “Acceptance Filter” or by using “Open
filters” or “Optimize” button.
This box is only available, if extended IDs are used.
CodeHi ”Arbitration Register High” value of the BasicCAN objects.
The value can be modified by changing “Acceptance Filter” or by using “Open
filters” or “Optimize” button.
CodeLo “Arbitration Register Low” value of the BasicCAN objects.
The value can be modified by changing “Acceptance Filter” or by using “Open
filters” or “Optimize” button.
This box is only available, if extended IDs are used.
To get further information please refer to the help file of the Generation Tool GENy
. 2012, Vector Informatik GmbH
Version: 1.05.00
26 /28
based on template version 3.2




Vector CAN Driver Technical Reference TMS470 DCAN
12 Known Issues / Limitations 1. Please refer to the errata sheets of Texas Instruments.
2. Errata DCAN#22:
It could happen that an incorrect payload (data bytes) is stored in mailbox under certain
conditions. This is a HW issue present in several revisions (A and earlier). For details
please refer to silicon errata. The CAN driver implements the workaround proposal no.1 as
it can be applied also to the families without local power down-mode and it does not
disturb the other peripherals.
For that purpose the user has to calibrate a “6 NOPs” dummy loop, i.e. the software has to
wait for at least 6 CAN clocks cycles (corresponding to the CAN clock input and not CAN
bus). The 6 NOPs are not optimized and the group cannot take less than 6 CPU cycles
even if the core has a pipeline.
The number of iterations through the “6 NOPs” has the following formula:
ErrataDcan22Iterations = CPU_CLOCK/CAN_CLOCK
Info
If the used version of the silicon is affected by this issue, the calculated value
corresponding to ErrataDcan22Iterations has to be entered in the configuration:
1) A user config file has to be created; this will be installed in the CAN driver
component of the configuration.
2) This used config file will contain the following line:
#define kCanErrata22Iterations <ErrataDcan22Iterations>
Please note that the workaround is by default activated and ErrataDcan22Iterations = 255.
Info
If the used version of the silicon is not affected by this issue, the workaround can
be disabled as followings:
1) A user config file has to be created; this will be installed in the CAN driver
component of the configuration.
2) This used config file will contain the following line:
#define C_DISABLE_DCAN_ISSUE22_WORKAROUND
2012, Vector Informatik GmbH
Version: 1.05.00
27 /28
based on template version 3.2


Vector CAN Driver Technical Reference TMS470 DCAN
13 Contact Visit our website for more information on
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector-informatik.com 2012, Vector Informatik GmbH
Version: 1.05.00
28 /28
based on template version 3.2
1.1.30 - TechnicalReference_CANdesc
Technical Reference1.1.32 - TechnicalReference_CANdesc_UDS_PSA
Technical Reference1.1.34 - TechnicalReference_CANdesc_UDS_PSAs
CANdesc Technical Reference
PSA
Version 1.00.00
Authors: Alexander Ditte
Version: 1.00.00
Status: released (in preparation/completed/inspected/released)

Technical Reference CANdesc UDS PSA
1 History Author Date Version Remarks Alexander Ditte
2007-12-05 1.0
Initial version
2008, Vector Informatik GmbH
Version: 1.00.00
2 / 18

Technical Reference CANdesc UDS PSA
2 Contents 1 History ......................................................................................................................... 2 2 Contents ...................................................................................................................... 3 3 Documents this one refers to… ................................................................................ 5 4 CANdesc Support by Diagnostic Service ................................................................ 6 4.1 CANdesc ...................................................................................................... 6 5 How to…...................................................................................................................... 9 5.1 …get the Id of the current active session..................................................... 9 6 CANdesc API categories.......................................................................................... 10 6.1 Single Context............................................................................................ 10 6.2 Multiple Context ......................................................................................... 10 6.3 API Context Abstraction ..............................................................................11 6.3.1 Direct parameter usage...............................................................................11 6.3.1.1 DESC_CONTEXT_PARAM_VALUE ...........................................................11 6.3.1.2 DESC_CONTEXT_PARAM_ONLY .............................................................11 6.3.1.3 DESC_CONTEXT_PARAM_FIRST ............................................................11 6.3.2 Function declaration/definition usage..........................................................11 6.3.2.1 DESC_CONTEXT_FORMAL_PARAM_DEF_ONLY.................................. 12 6.3.2.2 DESC_CONTEXT_FORMAL_PARAM_DEF_FIRST ................................. 12 6.3.3 Universal context wrapper.......................................................................... 12 6.3.3.1 DESC_CONTEXT_PARAM_WRAPPER_INDEX(contextConst) ............... 12 6.3.3.2 DESC_CONTEXT_PARAM_WRAPPER_ONLY(contextConst) ................ 12 6.3.3.3 DESC_CONTEXT_PARAM_WRAPPER_ONLY(contextConst) ................ 12 6.3.4 Utility .......................................................................................................... 13 6.3.4.1 DESC_CONTEXT_PARAM_DEF_LOCAL................................................. 13 6.3.4.2 DESC_CONTEXT_PARAM_DUMMY_USE............................................... 13 7 Functions .................................................................................................................. 14 7.1 Administrative Functions ............................................................................ 14 7.1.1 DescInitPowerOn ....................................................................................... 14 7.1.2 DescInit ...................................................................................................... 15 7.2 Help functions ............................................................................................ 16 2008, Vector Informatik GmbH
Version: 1.00.00
3 / 18

Technical Reference CANdesc UDS PSA
7.2.1 DescGetSessionIdOfSessionState............................................................. 16 8 Glossary .................................................................................................................... 17 9 Contact ...................................................................................................................... 18 2008, Vector Informatik GmbH
Version: 1.00.00
4 / 18




Technical Reference CANdesc UDS PSA
3 Documents this one refers to… Technical Reference CANdesc and CANdesc (one for both)
User Manual CANdesc
User ManualTechnicalTechnicalReferenceReferenceGeneralOEMYou are here Figure 3-1 Manuals and References for CANdesc
All OEM specific topics with CANdesc are described within this technical reference and the
common part (e.g. features, concepts) is in the generic technical reference.
For faster integration, refer to the user manual CANdesc.
2008, Vector Informatik GmbH
Version: 1.00.00
5 / 18

Technical Reference CANdesc UDS PSA
4 CANdesc Support by Diagnostic Service There are three possible levels of support provided by CANdesc for any specific diagnostic
request – complete, assisted and basic. The level of support provided by CANdesc varies
according to CANdesc functionality and user selection. All levels of support provide
complete communication handling, including all transport protocol processing and error
handling, diagnostic session and timer management and basic error checking.
“Communication handling includes testing support of service, but also consistency of
service, sub-function and/or identifier combination. Length checking or request is
performed. Validity of addressing is checked.”
Error handling is a significant part of the ECU software. All errors appearing on this level
are handled inside of CANdesc.
4.1 CANdesc
Complete
Complete support means that CANdesc is capable of handling the diagnostic transaction
without requesting support from (calling) the ECU application. The ECU developer need
not provide any code to help implement the diagnostic feature and CANdesc handles all
processing. In case a service modifies states, the application will be notified using event-
callbacks – it does not have to concern about the protocol.
Assisted
Assisted support means that CANdesc is capable of fully parsing request messages and
building response messages, but does not contain the logic necessary to execute the
request or determine signal values. The ECU developer shall provide callbacks for
CANdesc to invoke when needed to fill the logic gaps.
Basic
Basic support means that CANdesc is only capable of identifying that the ECU application
shall process the request. The ECU application may have to provide logic to validate the
request message (length, sub-function/parameter evaluation) and build the response byte-
by-byte.
2008, Vector Informatik GmbH
Version: 1.00.00
6 / 18

Technical Reference CANdesc UDS PSA
10 – Diagnostic Session Control – Assisted
The application shall provide only a function to check whether the session transition is
allowed or not. All other tasks (e.g. response assembling, state management) are
performed by CANdesc.
11 – Ecu Reset – Basic
The application must provide a function that resets the ECU.
14 – Clear Diagnostic Information – Basic
The application must provide a function that clears fault memory.
19 – Read DTC Information – Basic
The application must provide a function that implements the complete access to the fault
memory.
22 – Read Data By Identifier – Complete/Assisted
CANdesc completely implements this service for IDs that map to global variables.
Assisted support is provided for IDs that do not map to global variables (e.g. EEPROM /
I/O Ports).
The so called “multiple identifier in single request” support is handled by CANdesc
completely.
23 – Read Memory By Address – Basic
The application must provide a function that implements the read access to the memory.
27 – Security Access – Basic
The application must provide a function which includes the complete seed/key algorithm.
The state management can be designed to be handled by CANdesc.
2E – Write Data By Identifier – Complete/Assisted
CANdesc completely implements this service for IDs that map to global variables.
Assisted support is provided for IDs that do not map to global variables.
2F – Input Output Control By Identifier – Basic
The application must provide a function which implements the complete I/O control
operations.
31 – Routine Control – Basic
The application must provide a function which implements the complete routine control.
34 – Request Download – Basic
The application must provide a function which implements the complete service. Instead
the Vector FlashBootLoader can be used.
2008, Vector Informatik GmbH
Version: 1.00.00
7 / 18

Technical Reference CANdesc UDS PSA
35 – RequestUpload – Basic
The application must provide a function which implements the complete service. Instead
the Vector FlashBootLoader can be used.
36 – Transfer Data – Basic
The application must provide a function which implements the complete service. Instead
the Vector FlashBootLoader can be used.
37 – Request Transfer Exit – Basic
The application must provide a function which implements the complete service. Instead
the Vector FlashBootLoader can be used.
3D – Write Memory By Address – Basic
The application must provide a function that implements the write access to the memory.
3E – Tester Present – Complete
CANdesc completely implements this service.
85 – Control DTC Setting – Basic
The application must provide a function that controls the fault memory storage.
Diagnostic services not listed are not supported in any way by CANdesc and must be
implemented entirely by the ECU developer as a workaround.
2008, Vector Informatik GmbH
Version: 1.00.00
8 / 18

Technical Reference CANdesc UDS PSA
5 How to… There are some important use cases you have to consider in order to fulfill the PSA
diagnostic requirements. CANdesc offers special APIs and mechanisms to help your
application to realize these requirements and here you will find out how to do this.
5.1 …get the Id of the current active session
PSA defines no dedicated parameter identifier for reporting the current active diagnostic
session in the ECU, but if required you can use CANdesc to help you:
The CANdesc APIs for state access (i.e. DescGetStateSession()) returns the current
session, but it is only an internal representation of the session not the session identifier. So
you cannot use the return value of this API for that report.
To get the session Id your application shall use the
API DescGetSessionIdOfSessionState
that converts a session state internal representation into its corresponding session Id (e.g.
for the default session the state is 0x01, the session Id - 0x01, but for the extended
session the state representation is 0x04, the session Id – 0x03).
2008, Vector Informatik GmbH
Version: 1.00.00
9 / 18


Technical Reference CANdesc UDS PSA
6 CANdesc API categories CANdesc can be instantiated in case the configuration requires multiple diagnostic
instances or/and parallel service processing. In order to offer maximum optimization for the
single instance configurations there are two categories of CANdesc API.
Info Currently Multiple Context is
NOT relevant for PSA.
6.1 Single Context In this configuration, the run-time and code overhead of an indexed operation mode is
reduced to a minimum.
6.2 Multiple Context In this configuration, the code is using additional handles for exact addressing and
recognition of the used API.
For PSA there it depends on the configuration if a multi- or single-instance
diagnostics will be used. To lower the development effort of your application and to
be independent of the current configuration, please use the special API wrappers as
described below.
2008, Vector Informatik GmbH
Version: 1.00.00
10 / 18


Technical Reference CANdesc UDS PSA
6.3 API Context Abstraction
The following chapters describe the main use-cases where the abstraction-macros can be
used.
6.3.1 Direct parameter usage
This category is usable only in API with dedicated context parameter (e.g. Pre-
/PostHandlers, etc.)
6.3.1.1 DESC_CONTEXT_PARAM_VALUE
Use this macro if you have to access an array in your application that is dependent of the
CANdesc running context
Example:
void ApplDescPreHandlerXY(DESC_CONTEXT_FORMAL_PARAM_DEF_ONLY) { applDescState[DESC_CONTEXT_PARAM_VALUE] = active;
} 6.3.1.2 DESC_CONTEXT_PARAM_ONLY
Use this macro if you have to call a context dependent CANdesc API that have only the
context handle parameter
Example:
DescRingBufferStart(DESC_CONTEXT_PARAM_ONLY); 6.3.1.3 DESC_CONTEXT_PARAM_FIRST
Use this macro if you have to call a context dependent CANdesc API that have at least
one additional to the context handle parameter
Example:
DescSetNegResponse(DESC_CONTEXT_PARAM_FIRST kDescNrcGeneralReject); Caution
Please note, that there shall be no comma after the macro!!!
6.3.2 Function declaration/definition usage This category is useful if you declare/define functions that are context dependent.
2008, Vector Informatik GmbH
Version: 1.00.00
11 / 18



Technical Reference CANdesc UDS PSA
6.3.2.1 DESC_CONTEXT_FORMAL_PARAM_DEF_ONLY
You can use this macro in a function declaration that is context dependent and has only
parameter - the context handle.
Example:
void ApplDescPreHandlerXY(DESC_CONTEXT_FORMAL_PARAM_DEF_ONLY);
6.3.2.2 DESC_CONTEXT_FORMAL_PARAM_DEF_FIRST
You can use this macro in a function declaration that is context dependent and has at least
one additional parameter except the context handle one.
Example:
void ApplDescCheckSessionTransition(DESC_CONTEXT_FORMAL_PARAM_DEF_FIRST DescStateGroup newState, DescStateGroup formerState); Caution
Please note, that there shall be no comma after the macro!!!
6.3.3 Universal context wrapper
This category is useful in any call-back or call of an API that is context dependent.
6.3.3.1 DESC_CONTEXT_PARAM_WRAPPER_INDEX(contextConst)
This macro is equivalent to the
DESC_CONTEXT_PARAM_VALUE one but can take any
expression or identifier as a parameter name.
Example:
applDescState[DESC_CONTEXT_PARAM_WRAPPER_INDEX(MyContextVariable)] = active;
6.3.3.2 DESC_CONTEXT_PARAM_WRAPPER_ONLY(contextConst)
This macro is equivalent to the DESC_CONTEXT_PARAM_ONLY one but can take any
expression or identifier as a parameter name.
Example:
DescProcessingDone(DESC_CONTEXT_PARAM_WRAPPER_ONLY(pMsgContext->iContext));
6.3.3.3 DESC_CONTEXT_PARAM_WRAPPER_ONLY(contextConst)
This macro is equivalent to the
DESC_CONTEXT_PARAM_FIRST one but can take any
expression or identifier as a parameter name.
Example:
DescSetNegResponse(DESC_CONTEXT_PARAM_WRAPPER_FIRST(pMsgContext->iContext) kDescNrcGeneralReject); Caution
Please note, that there shall be no comma after the macro!!!
2008, Vector Informatik GmbH
Version: 1.00.00
12 / 18

Technical Reference CANdesc UDS PSA
6.3.4 Utility
This category is useful in any call-back or call of an API that uses a context dependent
API.
6.3.4.1 DESC_CONTEXT_PARAM_DEF_LOCAL
This defines a local context variable in a function, so you can use all the above macros
without name incompatibility issues.
Example:
void ApplTest(void) { DESC_CONTEXT_PARAM_DEF_LOCAL applDescState[DESC_CONTEXT_PARAM_VALUE] = active; }
6.3.4.2 DESC_CONTEXT_PARAM_DUMMY_USE
If some times you don't need to use the dedicated context handle parameter, you can use
this macro to avoid warnings of not referenced function parameter.
Example:
void ApplDescPreHandlerXY(DESC_CONTEXT_FORMAL_PARAM_DEF_ONLY) { DESC_CONTEXT_PARAM_DUMMY_USE /* Ignore warnings */ } 2008, Vector Informatik GmbH
Version: 1.00.00
13 / 18

Technical Reference CANdesc UDS PSA
7 Functions 7.1 Administrative Functions 7.1.1 DescInitPowerOn DescInitPowerOn Is Reentrant Is callback Prototype
Any Context
void
DescInitPowerOn (DescInitParam initParameter)
Parameter initParameter
•
‘kDescPowerOnInitParam’ : Default initialization
Return code -
-
Functional Description
PowerOn Initialization of the CANdesc.
This function has to be called before all other functions of CANdesc once after PowerOn.
Pre-conditions
CAN-driver via
CanInitPowerOn() and the TransportLayer via
TpInitPowerOn() are
initialized correctly.
Call context
Background-loop level with global disabled interrupts
Particularities and Limitations
The
DescInitPowerOn (initParameter) shall be called after the
TpInitPowerOn() was called
(please, refer the /TPMC/ documentation), otherwise the reserved diagnostic connection will be
lost.
DescInitPowerOn (initParameter) calls internally
DescInit() for further initializations
2008, Vector Informatik GmbH
Version: 1.00.00
14 / 18

Technical Reference CANdesc UDS PSA
7.1.2 DescInit DescInit Is Reentrant Is callback Prototype
Any Context
void
DescInit (DescInitParam initParameter)
Parameter initParameter
•
‘kDescPowerOnInitParam’ : Default initialization
Return code -
-
Functional Description
Re-initialization of CANdesc.
This function can be called to re-initialize CANdesc (e.g. after WakeUp). All internal states
will be set to default.
Pre-conditions
CANdesc has been once initialized by DescInitPowerOn().
Call context
Background-loop level with global disabled interrupts
Particularities and Limitations -
2008, Vector Informatik GmbH
Version: 1.00.00
15 / 18

Technical Reference CANdesc UDS PSA
7.2 Help functions 7.2.1 DescGetSessionIdOfSessionState DescGetSessionIdOfSessionState Is Reentrant Is callback Prototype
Any Context
DescMsgItem
DescGetSessionIdOfSessionState (DescStateGroup sessionState)
Parameter sessionState
- Shall be one of the valid session states (i.e. the value of the
API
DescGetStateSession() ).
Return code DescMsgItem
- Is the corresponding session identifier value.
Functional Description
This function provides a conversion from a session state to its corresponding session
identifier (e.g. calling this function with parameter
kDescStateSessionDefault will return
0x01).
Pre-conditions
-
Call context
-
Particularities and Limitations -
2008, Vector Informatik GmbH
Version: 1.00.00
16 / 18

Technical Reference CANdesc UDS PSA
8 Glossary Abbreviation Description CANdesc CAN Diagnostic
Embedded
Software
Component
Basic implementation variant
RCR-RP Request
Correctly
Received
– Response
Pending
P2 Maximum delay time before the first RCR-RP will be sent
(50ms by UDS) P2* (P2Ex) Maximum delay time before the second RCR-RP will be
sent (5000ms by UDS) SID Service
Identifier
2008, Vector Informatik GmbH
Version: 1.00.00
17 / 18

Technical Reference CANdesc UDS PSA
9 Contact Visit our website for more information on
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector-informatik.com 2008, Vector Informatik GmbH
Version: 1.00.00
18 / 18
Document Outline
1.1.35 - TechnicalReference_CANdescs
CANdesc Technical Reference
Version 2.19.00
Authors: Oliver Garnatz, Mishel Shishmanyan, Stefan
Hübner, Matthias Heil
Version: 2.19.00
Status: released (in preparation/completed/inspected/released)

Technical Reference CANdesc
1 History Author Date Version Remarks Oliver Garnatz
2003-11-12
2.00.00 Splitting into separate documents
and general revision
Oliver Garnatz
2004-01-13
2.00.01 Added chapter ‘Application interface
flow’
Updated format template
Mishel Shishmanyan
2004-03-09
2.01.00 New application callback convention
(from CANdesc 2.09.00)
Mishel Shishmanyan
2004-03-29
2.02.00 New APIs:
-
DescGetActivityState (from
CANdesc 2.10.00)
-
DescSchedulerTask() (from
CANdesc 2.09.00)
Mishel Shishmanyan
2004-04-26
2.03.00 Added more information and
limitations about the ring-buffer
mechanism (
6.6.8 “Ring Buffer
Mechanism”) New feature:
-
Support for generic user
service (from CANdesc
2.11.00)
-
Force CANdesc to send
RCR-RP response (from
CANdesc 2.11.00)
Stefan Hübner
2004-07-16
2.03.01 Editorial revision
Oliver Garnatz
2004-08-12
2.04.00 Added chapter 4.2
ReadDataByIdentifier (SID $22)
within the Single- and the Multiple
PID mode is described
Oliver Garnatz
2004-10-08
2.05.00 ESCAN0000982: Description of
MainHandler structure is not
readable
ROE transmission unit is described
in detail
Stefan Hübner
2004-10-15
2.06.00 Some additional information are
Oliver Garnatz
provided
Peter Herrmann
2005-06-22 2.07.00
Added: Service $2C description.
Klaus Emmert
Added: Warning Text added
Mishel Shishmanyan
2005-08.03 2.08.00
API added: Oliver Garnatz
- DescStateTask,
- DescTimerTask,
©2010, Vector Informatik GmbH
Version: 2.19.00
2 / 117

Technical Reference CANdesc
- DescMayCallStateTaskAgai
n.
- ApplDescFatalError
API modified: - DescTask,
- ApplDescCheckSessionTran
sition,
- DescGetActivityState,
- DescGetStateSession.
API removed: - DescSchedulerTask
Modified description for
ReadDataByIdentifier with long data
and negative response in main-
handler.
Oliver Garnatz
2006-03-02
2.09.00
Added: ...prevent the ECU going to
sleep while diagnostic is active
Mishel Shishmanyan
2006-03-24
2.10.00
Added: document overview
Mishel Shishmanyan
2006-04-27
2.11.00
Modified: -
6.6.12
DynamicallyDefineDataIdentifier
($2C) (UDS) functions -
6.6.12.1
DescMayCallStateTaskAgain() Mishel Shishmanyan
2007-02-22
2.12.00
Added: - 6.6.8.3 “DescRingBufferCancel()” Matthias Heil
2008-01-03
2.13.00
Added: Caution concerning user main
handler on protocol level
Matthias Heil
2008-02-29
2.14.00
Added: Handling of read/write memory by
address:
- 5.5 “Read/Write Memory by
Address” - 6.6.7.2
“DescStartMemByAddrRepeatedCal
l()” - 6.6.13 ”Memory Access Callbacks”Mishel Shishmanyan
2008-06-06
2.15.00
Removed: Chapter “ResponseOnEvent
Transmission Unit” Added: ©2010, Vector Informatik GmbH
Version: 2.19.00
3 / 117

Technical Reference CANdesc
- 6.6.12.3 “Non-volatile memory
support” Mishel Shishmanyan
2008-11-09
2.16.00
Modified: -
6.6.8 and
6.6.8.1: Added limitation
for UDS and SPRMIB with the ring
buffer usage.
-
7.6 …work with the ring-buffer
mechanism Added: - 6.6.14 Flash Boot Loader Support - 7.8 …send a positive response
without request after FBL flash job Mishel Shishmanyan
2009-05-18
2.17.00
Modified: 6.6.5.1ApplDescCheckSessionTran
sition() Added: 6.6.5.3DescIsSuppressPosResBitS
et () Mishel Shishmanyan
2009-08-11
2.18.00
Modified: Minor editorial changes
5.2 Configure Handlers using
CANdela attributes – added new
data object attributes
Added: 7.9 …enforce CANdesc to use
ANSI C instead of hardware
optimized bit type 5.1 Configure DBC attributes for
diagnostics Mishel Shishmanyan
2010-12-21
2.19.00
Modified: 6.6.8.2 DescRingBufferWrite() 6.6.13.1
ApplDescReadMemoryByAddress() 6.6.13.2
ApplDescWriteMemoryByAddress() ©2010, Vector Informatik GmbH
Version: 2.19.00
4 / 117

Technical Reference CANdesc
Contents 1 History............................................................................................................ 2 2 Introduction ................................................................................................. 10 3 Documents this one refers to… ................................................................. 11 4 Architecture Overview ................................................................................ 12 4.1 CANdesc – Internal processing..................................................... 12 4.1.1 Diagnostic protocol........................................................................ 12 4.1.2 How does this flow actually work? ................................................ 13 4.2 Application interface flow .............................................................. 16 4.2.1 Session- and CommunicationControl............................................ 16 5 Advanced Configuration ............................................................................ 17 5.1 Configure DBC attributes for diagnostics ...................................... 17 5.2 Configure Handlers using CANdela attributes .............................. 17 5.3 ReadDataByIdentifier (SID $22).................................................... 23 5.3.1 Limitations of the service............................................................... 24 5.3.2 Single PID mode ........................................................................... 25 5.3.2.1 Sending a positive response using linear buffer access ............... 25 5.3.2.2 Sending a positive response using ring buffer access .................. 26 5.3.2.3 Sending a negative response........................................................ 27 5.3.3 Multiple PID mode......................................................................... 27 5.3.3.1 Pure linear buffer configuration ..................................................... 28 5.3.3.1.1 Sending a positive response ......................................................... 28 5.3.3.1.2 Sending a negative response........................................................ 29 5.3.3.2 Ring buffer active configuration..................................................... 29 5.3.3.2.1 Sending a positive response ......................................................... 32 5.3.3.2.2 Sending a negative response........................................................ 33 5.3.3.2.3 PostHandler execution rule ........................................................... 34 5.4 DynamicallyDefineDataIdentifier (SID $2C) (UDS) ....................... 35 5.4.1 Feature set .................................................................................... 35 5.4.2 API Functions................................................................................ 35 5.4.3 Sequence Charts .......................................................................... 36 5.5 Read/Write Memory by Address (SID $23/$3D) (UDS) ................ 39 5.5.1 Tasks performed by CANdesc ...................................................... 39 5.5.2 Task to be performed by the Application....................................... 39 5.5.3 Repeated service calls .................................................................. 39 ©2010, Vector Informatik GmbH
Version: 2.19.00
5 / 117

Technical Reference CANdesc
6 CANdesc API ............................................................................................... 41 6.1 API Categories .............................................................................. 41 6.1.1 Single Context............................................................................... 41 6.1.2 Multiple Context (only CANdesc) .................................................. 41 6.2 Data Types.................................................................................... 41 6.3 Global Variables............................................................................ 41 6.4 Constants ...................................................................................... 41 6.4.1 Component Version ...................................................................... 41 6.5 Macros .......................................................................................... 42 6.5.1 Data exchange .............................................................................. 42 6.5.1.1 Splitting 16 bit data........................................................................ 42 6.5.1.2 Splitting 32 bit data........................................................................ 42 6.5.1.3 Assembling 16 bit data.................................................................. 43 6.5.1.4 Assembling 32 bit data.................................................................. 43 6.6 Functions....................................................................................... 44 6.6.1 Administrative Functions ............................................................... 44 6.6.1.1 DescInitPowerOn()........................................................................ 44 6.6.1.2 DescInit()....................................................................................... 45 6.6.1.3 DescTask().................................................................................... 46 6.6.1.4 DescStateTask() ........................................................................... 47 6.6.1.5 DescTimerTask()........................................................................... 48 6.6.1.6 DescGetActivityState() .................................................................. 49 6.6.2 Service Functions.......................................................................... 50 6.6.2.1 DescSetNegResponse() ............................................................... 50 6.6.2.2 DescProcessingDone() ................................................................. 51 6.6.3 Service Call-Back functions .......................................................... 52 6.6.3.1 Service PreHandler ....................................................................... 52 6.6.3.2 Service MainHandler..................................................................... 53 6.6.3.3 Service PostHandler ..................................................................... 55 6.6.4 User (Unknown) Service Handling ................................................ 56 6.6.4.1 How it works.................................................................................. 56 6.6.4.2 ApplDescCheckUserService()....................................................... 57 6.6.4.3 DescGetServiceId()....................................................................... 58 6.6.4.4 Generic User Service MainHandler............................................... 59 6.6.4.5 Generic User Service PostHandler ............................................... 60 6.6.5 Session Handling .......................................................................... 61 6.6.5.1 ApplDescCheckSessionTransition().............................................. 61 6.6.5.2 DescSessionTransitionChecked()................................................. 62 6.6.5.3 DescIsSuppressPosResBitSet () .................................................. 63 6.6.5.4 ApplDescOnTransitionSession() ................................................... 64 6.6.5.5 DescSetStateSession() ................................................................. 65 ©2010, Vector Informatik GmbH
Version: 2.19.00
6 / 117

Technical Reference CANdesc
6.6.5.6 DescGetStateSession()................................................................. 66 6.6.6 CommunicationControl Handling .................................................. 67 6.6.6.1 ApplDescCheckCommCtrl() .......................................................... 67 6.6.6.2 DescCommCtrlChecked() ............................................................. 68 6.6.7 Periodic call of ‘Service MainHandler’ ........................................... 69 6.6.7.1 DescStartRepeatedServiceCall() .................................................. 69 6.6.7.2 DescStartMemByAddrRepeatedCall() .......................................... 70 6.6.8 Ring Buffer Mechanism................................................................. 71 6.6.8.1 DescRingBufferStart() ................................................................... 72 6.6.8.2 DescRingBufferWrite() .................................................................. 73 6.6.8.3 DescRingBufferCancel() ............................................................... 74 6.6.8.4 DescRingBufferGetFreeSpace() ................................................... 75 6.6.8.5 DescRingBufferGetProgress() ...................................................... 76 6.6.9 Signal Interface of CANdesc ......................................................... 77 6.6.9.1 ApplDesc<Signal-Handler>() ........................................................ 77 6.6.9.2 Configuration of direct signal access ............................................ 78 6.6.10 State Handling (CANdesc only) .................................................... 78 6.6.10.1 DescGetState<StateGroup>()....................................................... 78 6.6.10.2 DescSetState<StateGroup>() ....................................................... 79 6.6.10.3 ApplDescOnTransition«StateGroup»() ......................................... 80 6.6.11 Force “Response Correctly Received - Response Pending” transmission 81 6.6.11.1 DescForceRcrRpResponse() ........................................................ 82 6.6.11.2 ApplDescRcrRpConfirmation()...................................................... 83 6.6.12 DynamicallyDefineDataIdentifier ($2C) (UDS) functions.............. 84 6.6.12.1 DescMayCallStateTaskAgain() ..................................................... 85 6.6.12.2 ApplDescCheckDynDidMemoryArea() .......................................... 86 6.6.12.3 Non-volatile memory support ........................................................ 87 6.6.12.3.1 DescDynDefineDidPowerUp()....................................................... 90 6.6.12.3.2 DescDynIdMemContentRestored () .............................................. 91 6.6.12.3.3 DescDynDefineDidPowerDown () ................................................. 92 6.6.12.3.4 ApplDescStoreDynIdMemContent ()............................................. 93 6.6.12.3.5 ApplDescRestoreDynIdMemContent ()......................................... 94 6.6.13 Memory Access Callbacks ............................................................ 95 6.6.13.1 ApplDescReadMemoryByAddress() ............................................. 95 6.6.13.2 ApplDescWriteMemoryByAddress().............................................. 96 6.6.14 Flash Boot Loader Support ........................................................... 96 6.6.14.1 DescSendPosRespFBL() .............................................................. 97 6.6.14.2 ApplDescInitPosResFblBusInfo().................................................. 98 6.6.15 Debug Interface / Assertion........................................................... 99 6.6.15.1 ApplDescFatalError() .................................................................... 99 ©2010, Vector Informatik GmbH
Version: 2.19.00
7 / 117

Technical Reference CANdesc
7 How To….................................................................................................... 104 7.1 …implement a protocol service MainHandler ............................. 104 7.2 …implement a service MainHandler ........................................... 107 7.3 …implement a Signal Handler .................................................... 108 7.4 …implement a Packet Handler ................................................... 109 7.5 …implement a state transition function ....................................... 109 7.6 …work with the ring-buffer mechanism ....................................... 110 7.6.1 with asynchronous write.............................................................. 110 7.6.2 with synchronous write................................................................ 112 7.7 …prevent the ECU going to sleep while diagnostic is active ...... 113 7.8 …send a positive response without request after FBL flash job . 114 7.9 …enforce CANdesc to use ANSI C instead of hardware optimized bit type 114 8 Related documents ................................................................................... 115 9 Glossary..................................................................................................... 116 10 Contact....................................................................................................... 117 ©2010, Vector Informatik GmbH
Version: 2.19.00
8 / 117

Technical Reference CANdesc
Illustrations Figure 3-1: Manuals and References for CANdesc ........................................................................ 11
Figure 4-1: General request flow .................................................................................................... 12
Figure 4-2: DESC run diagram ....................................................................................................... 13
Figure 4-3: Request message mapping .......................................................................................... 14
Figure 4-4: Request processing stages .......................................................................................... 15
Figure 5-1: Dependency of CANdesc Handler configuration .......................................................... 22
Figure 5-2: Linearly written positive response on single PID request ............................................. 25
Figure 5-3: “On the fly” response data writing................................................................................. 26
Figure 5-4: Negative response on single PID ................................................................................. 27
Figure 5-5: Linearly written positive response on multiple PIDs (global ring buffer option is off).... 28
Figure 5-6: Negative response on multiple PIDs (global ring buffer option is off) ........................... 29
Figure 5-7: Linearly written response data on multiple PIDs (global ring buffer option is on) ......... 32
Figure 5-8: Negative response on multiple PIDs (global ring buffer option is on) ........................... 33
Figure 5-9: Post-Handler execution sequence................................................................................ 34
Figure 5-10: Defining a DDID.......................................................................................................... 37
Figure 5-11: Reading a DDID. ........................................................................................................ 38
Figure 6-1 DynDID definition restore and tester interaction ............................................................ 88
Figure 6-2 Store DynDID definitions ............................................................................................... 89 ©2010, Vector Informatik GmbH
Version: 2.19.00
9 / 117


Technical Reference CANdesc
2 Introduction This document has not the job to describe the diagnostic itself. The focus of this document
is the technical aspects of the CANdesc component.
Please note
We have configured the programs in accordance with your specifications in the
questionnaire. Whereas the programs do support other configurations than the one
specified in your questionnaire, Vector’s release of the programs delivered to your
company is expressly restricted to the configuration you have specified in the
questionnaire.
©2010, Vector Informatik GmbH
Version: 2.19.00
10 / 117




Technical Reference CANdesc
3 Documents this one refers to… User Manuals CANdesc and CANdescBasic (one for both)
Docu OEM
User ManualTechnicalTechnicalReferenceReferenceGeneralOEMYou are here Figure 3-1: Manuals and References for CANdesc
All common topics with CANdesc and CANdescBasic are described within this technical
reference very detailed.
Read all about OEM-specific differences in the TechnicalReference_OEM.
For faster integration, refer to the product’s corresponding user manual CANdesc or
CANdescBasic.
©2010, Vector Informatik GmbH
Version: 2.19.00
11 / 117

Technical Reference CANdesc
4 Architecture Overview This chapter should describe the internal structure and behavior of the CANdesc
component.
4.1 CANdesc – Internal processing 4.1.1 Diagnostic protocol The communication described in the diagnostic protocol consists of a ping-pong
communication between a tester (client) and an ECU (server). The tester requests a
service in the ECU by transmitting a request to him. The ECU should response with a
positive response, if the result of this service is valid or the action is prepared to be done.
Is the result negative or the action could not be executed, the ECU should respond
negative.
The validity checks have typically the same pattern for all services (as shown in
Figure
4-1: General request flow). These components which are included in this flow, build up the
main base of the CANdesc component.
ApplicationPrehandler optionalMainhandlerPosthandler optional{
{
{
....
}
}
DescProcessingDone( );
}
Diagnostics - CANdescCheck
SvcCheck
SvcInstCheck
SessionCheck
FormatACKt
positive ResponseRequestnegative ResponseTester Figure 4-1: General request flow
©2010, Vector Informatik GmbH
Version: 2.19.00
12 / 117

Technical Reference CANdesc
4.1.2 How does this flow actually work? The picture below shows a simply structured description of the module functionality.
Request receptionDispatching the requestIdle mode/Awaiting requestProcessing the requestFinishing processing of the request Figure 4-2: DESC run diagram
Lets assume that the component is currently in the
“Awaiting request” state.
In this state
it waits for the next diagnostic request and if it is needed – it provides also timing
monitoring.
Once a diagnostic request transmission was initiated from the transport layer, the
component enters in the state
“Request reception”. If the reception is finished, further
physical requests will be blocked until the response is sent. Depending on the used OEM a
functional request in the ISO 14230 standard will be handled parallel
1 to physical request.
The ISO 14229-1 standard is more restricted to the parallel handling. Except the
TesterPresent Service no other service could be handled parallel.
1 Not all services could be handled parallel.
©2010, Vector Informatik GmbH
Version: 2.19.00
13 / 117

Technical Reference CANdesc
After the reception of the request is completed the request processing will be prepared.
The component is in the
“Dispatching request” state. The processing of the request is
done at a task level within the next call of the DescTask() function.
First the SID is checked whether supported or not. If not a negative response
‘ServiceNotSupported’ (NRC $11) will be sent.
Next step is to check if the supported SID is permitted in the current Session (Diagnostic
Mode). If not, the negative response ‘ServiceNotSupportedInTheCurrentSession’ (NRC
$7F) is sent automatically by the CANdesc component.
1Byte n
Bytes (n=0..N)
m Bytes (m = 0..M)
SID
SID_EXT
Application data
Service instance qualification
“Request head
“
Figure 4-3: Request message mapping
After that the CANdesc component validates, if the sub-service (service instance) is
supported or not. This is implemented with a powerful binary search. If the service
instance is not supported, the request will be rejected with the corresponding error code
‘SubFunctionNotSupported’ (NRC $11, for service which have SubFunctions) or
‘InvalidFormat’ (NRC $13, for service with data identifiers).
For each service instance which is supported by the current configuration, the CANdesc
component knows the exact length of most requests. (Some requests use variable data
length elements thus a fixed length doesn’t exist.) If the length is known and it does not
match, the dispatcher will reject this request (dependent to the manufacturer specification).
If the complete request length is not known, the application has to do this job.
If the service instance is found, the state checks (e.g. ‘Security Level’) will be performed. If
all of them are passed then the component enters the state
“Processing request” in the
diagram above. This state consists of several parts that are represented in more detailed
structure shown below. The dotted lines reveal the optional parts for the implementation.
For example – the Pre-, Post- and SignalHandlers are optional and might not be
implemented.
©2010, Vector Informatik GmbH
Version: 2.19.00
14 / 117

Technical Reference CANdesc
Request analyzedPreHandlerMainHandlerSignal-Handler #0Signal-Handler #1Signal-Handler #kPostHandler Figure 4-4: Request processing stages
After the response is composed CANdesc must be informed about, to start the
transmission of the final response. CANdesc is doing the handshake with the Tester
(automatic transmission of RCR-RP) while the state “” is doing.
Within the end of the transmission the state “
Finishing processing of the request” is
entered and the PostHandler (if configured) is called. In this PostHandler the application
has to do the closing (e.g. updating a state machine, prepare the ECU for a reset …). The
session state for example (which is managed by CANdesc) is also updated in a
PostHandler.
©2010, Vector Informatik GmbH
Version: 2.19.00
15 / 117

Technical Reference CANdesc
4.2 Application interface flow 4.2.1 Session- and CommunicationControl The services SessionControl and CommunicationControl are typically handled by
CANdesc. But the application still has the possibility to reject these service requests. You
can find a detailed description in chapter 6.6.5 Session Handling and in chapter
6.6.6
CommunicationControl Handling also.
IDLE
Receive a Request
Search
SID
SID $28
Supported Unsupported
SID $10
(SID $29)
SID $xx
SID $xx
ApplDesc<PreHandler>ApplDesc<PreHandler>ApplDesc<PreHandler>callbackcallbackcallbackApplDescCheckSessionTransitionApplDescCheckCommCtrlApplDesc<MainHandler>{{{ ... ... ...DescSessionTransitionChecked();DescCommCtrlChecked(); DescProcessingDone();}}}Transmit
Transmit positive
Transmit positive
Transmit positive
negative
response $50
response $68
response $xx
response
NRC $11
WAIT
WAIT
WAIT
TX acknowledge
TX acknowledge
TX acknowledge
$50
$68
$xx
ApplDescOnCommunicationEnabledApplDescOnSessionTransitionApplDescOnCommunicationDisabledApplDesc<PostHandler>>optional - not all OEMs<IDLE
©2010, Vector Informatik GmbH
Version: 2.19.00
16 / 117



Technical Reference CANdesc
5 Advanced Configuration 5.1 Configure DBC attributes for diagnostics If the diagnostic messages shall be defined in the communication data-base file (DBC),
and not received via CANdriver ranges (e.g. in case of normal fixed or extended
addressing), the following attributes in the DBC file must exist and shall be set as shown
below.
Attribute Name Object Value Values Description Type Type the default value is
written in bold
DiagRequest Message
Enum
No Specifies (Yes) that the message is a diagnostic
Yes
physical USDT request message.
DiagResponse Message
Enum
No Specifies (Yes) that the message is a diagnostic
Yes
USDT response message.
DiagState Message
Enum
No Specifies (Yes) that the message is a diagnostic
Yes
functional USDT request message.
DiagUudtResponse Message Enum
false Specifies (true) that the message is a diagnostic
true
UUDT response message.
Table 5-1: DBC file diagnostic message attributes
5.2 Configure Handlers using CANdela attributes The following attributes are relevant for configuration of CANdela software components:
All attributes have the category ‘CANdesc’.
Caution
Please note: if you have a CDD file where one of the below listed attributes is already
set to “oem”, you are not allowed to change this attribute value, since this will affect the
proper CANdesc functionality for the OEM.
Diagnostic Class attributes MainHandlerSupport (on
Type: enum: none = 0, oem = 1, user = 2
Protocol Service Level)
Provide MainHandlers and select type for all Protocol
Services of Diagnostic class.
PreHandlerSupport (for all Type: enum: none = 0; oem = 1; user = 2
Protocol Services)
©2010, Vector Informatik GmbH
Version: 2.19.00
17 / 117


Technical Reference CANdesc
Provide type of Service PreHandlers for all Protocol
Services of Diagnostic class.
Restriction: Only evaluated if ‘MainHandlerSupport (on
Protocol Service Level)’ is set, i.e. unequals to ‘none’.
PostHandlerSupport (for
Type: enum: none = 0; oem =1; user = 2
all Protocol Services)
Provide type of Service PostHandlers for all Protocol
Services of Diagnostic class.
Restriction: Only evaluated if ‘MainHandlerSupport (on
Protocol Service Level)’ is set, i.e. unequals to ‘none’.
PacketHandlerSupport
Type: enum: none = 0; all = 1
Switch on/off Packet Handlers support for each Diagnostic
instance of current Diagnostic class. Restriction: Only
evaluated if ‘MainHandlerSupport (on Protocol Service
Level)’ is set, i.e. unequals to ‘none’.
Table 5-2: Names of CANdela Diagnostic Class attributes
Caution
In some cases, the CANdesc service implementations of one service requires
subservice handling of other services. Which services - if any at all - are
affected by such a dependency is manufacturer specific. Thus, the attribute
‘MainHandler-Support (on Protocol Service Level)’ must be used carefully.
Before disabling the subservice handling (by setting the attribute to ‘user’),
check the manufacturer specific documentation. If you are in doubt, please
contact Vector to verify CANdesc will work correctly with your settings.
Diagnostic Instance attributes PacketHandlerOption
Type: enum:
user= 0; generated= 1
Provide type of current Packet Handler for first found
Service Positive response. Restriction: Only evaluated if
Folder attribute ‘PacketHandlerSupport’ is set to ‘all’.
Table 5-3: Names of CANdela Diagnostic Instance attributes
Service attributes MainHandlerSupport (on
Type: enum:
user = 0; oem = 1; generated = 2
Service Level)
Provide MainHandler for current Service
(Service/Subfunction combination).
Restriction: Only evaluated if Folder attribute
‘MainHandlerSupport (on Protocol Service Level)’ is not set,
i.e. equals to ‘none’.
PreHandlerSupport
Type: enum:
none = 0; oem = 1; user = 2
Provide type of Service PreHandler for current Service
(Service/Subfunction combination). The Service
PreHandler is executed directly before the MainHandler.
Restriction: Only evaluated if Folder attribute
©2010, Vector Informatik GmbH
Version: 2.19.00
18 / 117

Technical Reference CANdesc
‘MainHandlerSupport (on Protocol Service Level)’ is not set,
i.e. equals to ‘none’.
PreHandlerOverrideName Type: string: {empty}
Provide alternative name for Service PreHandler instead of
generated one (default prefix is added to
PreHandlerOverrideName).You can reuse one Service
PreHandler for different services, if you specify the same
Override Name.
Restriction: Only evaluated if Folder attribute
‘MainHandlerSupport (on Protocol Service Level)’ is not set,
i.e. equals to ‘none’.
PostHandlerSupport
Type: enum:
none = 0; oem = 1; user = 2
Provide type of Service PostHandler for current Service
(Service/Subfunction combination). The Service
PostHandler is executed after a positive confirmation of the
positive response.
Restriction: Only evaluated if Folder attribute
‘MainHandlerSupport (on Protocol Service Level)’ is not set,
i.e. equals to ‘none’.
PostHandlerOverrideName Type: string: {empty}
Provide alternative name for Service PostHandler instead of
generated one (default prefix is added to
PostHandlerOverrideName).You can reuse one Service
PostHandler for different Services, if you specify the same
Override Name.
Restriction: Only evaluated if Folder attribute
‘MainHandlerSupport (on Protocol Service Level)’ is not set,
i.e. equals to ‘none’.
Table 5-4: Names of CANdela Service attributes
©2010, Vector Informatik GmbH
Version: 2.19.00
19 / 117

Technical Reference CANdesc
Data Object attributes VariableForDirectAccess
Type: string: {empty}
Specify name of application variable to be accessed by
CANdesc. Currently, no (extended) type specifiers are
allowed. If no variable for direct access is specified, a
callback function will be generated.
SignalHandlerOverrideName
Type: string: {empty}
Provide alternative name for Signal Handler instead of
generated one (default prefix is added to
SignalHandlerOverrideName). You can reuse one Signal
Handler for different signals, if you specify the same
Override Name. Pay attention that the function signature
must match the different use-cases.
SignalPrototype
Type: enum: Generated = 0, GeneratedConst = 1,
GeneratedUserDefined = 2, None = 3
Provides the information about the generation type:
- "Generated" - RAM variables (default as we had up to
now)
- "GeneratedConst" - ROM variables
- "GenratedUserDefined" - use own types (use the
below attribute to determine the type (string))
- "None" - no prototype will be generated. Instead a
header file will be included
"DescType.h" where the user have to define his typedefs
(for structure access for example).
Restriction: Only evaluated if:
- Service attribute ‘MainHandler (on Service Level)’ is set
to ‘generated’ or
Diagnostic instance attribute ‘PacketHandlerOption’ is
set to ‘generated’.
- ‘VariableForDirectAccess’ is set to refer an object.
UserDefinedQualifier
Type: string: {empty}
Provides the information about the generation prototype
name (e.g. instead using the Vector convention (vuint8,
vuint16, etc. you can use uint8, t_StructType, etc.).
Restriction: Only evaluated if:
- Service attribute ‘MainHandler (on Service Level)’ is set
to ‘generated’ or Diagnostic in-stance attribute
‘PacketHandlerOption’ is set to ‘generated’.
- ‘VariableForDirectAccess’ is set to refer an object.
- ‘SignalPrototype’ is set to ‘GenratedUserDefined’.
Table 5-5: Names of CANdela Data Object attributes
©2010, Vector Informatik GmbH
Version: 2.19.00
20 / 117

Technical Reference CANdesc
Please note that not it is not possible to combine all kinds of handlers inside of one
Diagnostic instance (and sometimes, Diagnostic class).
The following flow chart shows the conditions and order in which the attributes are
evaluated.
©2010, Vector Informatik GmbH
Version: 2.19.00
21 / 117

Technical Reference CANdesc
Diagnostic Class::
MainHandlersSupport
user
(on Protocol Service level)
none
oem
Create
Create
OemMainHandler
UserMainHandler
for Protocol
for Protocol
Service
Service
DiagClass::
Service::
PreHandlersSupport
PreHandlerSupport
(for all Protocol Services)
oem
oem
user
user
Create
Create
UserPreHandler,
OemPreHandler,
Create
Create
consider override
consider override
UserPreHandler
OemPreHandler
none
none
qualifer
qualifer
DiagClass::
Service::
PostHandlerSupport
PostHandlerSupport
(for all Protocol Services)
oem
oem
user
user
Create
Create
UserPostHandler
OemPostHandler
Create
Create
consider override
consider override
UserPostHandler
OemPostHandler
none
none
qualifer
qualifer
Service::
DiagClass::
MainHandlerSupport
PacketHandlerSupport
user
generated
none
oem
all
done.
Create
Create
Create
Generated
UserService
OemService
ServiceMain
MainHandler
MainHandler
Handler
Diagnostic Instance::
PacketHandlerOption
generated
user
done.
Create
Create
Generated
UserPacket
Packet Handler
Handler
done.
DataObject::
VariableForDirectAccess
== { empty}
yes
no
Create
Create
UserSignal
GeneratedSignal
Handler, consider
Handler, consider
override qualifer
override qualifer
done.
Figure 5-1: Dependency of CANdesc Handler configuration
©2010, Vector Informatik GmbH
Version: 2.19.00
22 / 117

Technical Reference CANdesc
5.3 ReadDataByIdentifier (SID $22) This service has the purpose to read some predefined data records (PID). Each PID has a
concrete data structure which is designed by CANdelaStudio.
As the standard case the request contains a single PID. This results in a single response
containing the data structure of the record.
Singlng e PID mode ( PIDw mode ( ell knowell kno case) example for PID $1234 case) example for PTester‘s request:
$22 $12 $34
ECU‘s re
ECU‘
spon
s re
se:
spon
$62 $12 $34 Data block
The UDS allows to request multiple PIDs in a single request. This results is also a single
response including the data structure of each requested PID.
MultipMulti le PID mode example for PIDs: $123le PID mode exam4, $ABCDTester
Teste ‘s request:
‘s requ
$22
$2 $12 $34 $AB$CD
ECU‘s re
CU‘
spo
s re
n
spo se:
$62
$6 $12 $34 Data block $AB$CD
Data block
CANdesc will hide this multiple PID processing from the application. To do that some
minor limitations in the interf
ace has to be made (see chapter 5.3.2 Single PID mode). To
show the differences, we discuss first the standard case. In the standard case there is no
multiple PID processing possible. The second chapter (
5.3.3 Multiple PID mode) is
showing the multiple PID processing.
Which mode is used depends on the configuration (typically the OEM).
©2010, Vector Informatik GmbH
Version: 2.19.00
23 / 117

Technical Reference CANdesc
5.3.1 Limitations of the service Session management This service contains no sub-function identifier which means the global state group
“session” may not be selected as a “relevant group” for any instance of this service. If
there is a need for a PID to be rejected under a certain session, all PIDs must follow this
rule and be specified to be rejected for this session. As a result the whole SID $22 will be
rejected for this session. This behavior is harmonized with the UDS protocol specification,
which allows service identifiers to be rejected in a session but no parameter identifiers.
©2010, Vector Informatik GmbH
Version: 2.19.00
24 / 117

Technical Reference CANdesc
5.3.2 Single PID mode The Single PID mode is configured automatically, if the number of PIDs that can be
requested at the same time, is limited to one PID. If more than one PID is requested, the
request will be rejected with ‘RequestOutOfRange’ (NRC $31).
If the multiple PID mode of CANdesc is deactivated, the service $22 will be executed and
processed like any other diagnostic service without any additional specifics or limitations.
5.3.2.1 Sending a positive response using linear buffer access Tester
CANdesc
Application
Check all states if the
SId[ $22],Pid[$x xxx]
"read PID" service can
StateGroupsCheck for Pid
be executed.
If available execute the pre-handler and
ApplDescPreReadDataById_xx xx
check if the application rejected the service.
ApplDescReadDataById_xxxx
Execute the main-handler
W rite data (pMsgContext->resData )
to fill th e response data.
Set t otal respon se data length
(pMsgContext->resDataLen = N)
DescProcessingDone()
RSid[$62], PID[$xxxx], Data[N]
The positive response transmission will be
initiated after the DescProcessingDone
gets called.
Figure 5-2: Linearly written positive response on single PID request
©2010, Vector Informatik GmbH
Version: 2.19.00
25 / 117

Technical Reference CANdesc
5.3.2.2 Sending a positive response using ring buffer access Tester
CANdesc
Application
Check a ll st ates i f th e
SId[$22],Pid[$xxxx]
"read PID" service may
StateGroupsCheck for Pid
be e xecute d.
If available execute the pre-handler and check if
ApplDescPreReadDataById_xxxx
the application rejected the service.
Execute the main-handler
ApplDescReadDataById_xxxx
to fill the response data.
Set total response data length
(pMsgContext->resDataLen = N)
DescRingBufferStart()
W rite data (DescRingBufferW rite())
FF (RSid[$62], PID[$xxxx], Data[3])
The positive respo nse t ran smi ssion wi ll be i nitiate d after
the DescRingBufferStart gets called and th ere are at
le ast 7 by tes read y to be transmitte d (i. e. 3 d ata bytes).
W rite data (DescRingBufferW rite())
CF(Data[N-3])
Figure 5-3: “On the fly” response data writing.
©2010, Vector Informatik GmbH
Version: 2.19.00
26 / 117

Technical Reference CANdesc
5.3.2.3 Sending a negative response Due to the fact that the negative response handling has changed in the multiple PID mode,
we recommend to do the same handling in the Single PID mode, too. Please refer the
chapter
5.3.3.2 “Ring buffer active configuration” for the recommended negative response
handling.
Tester
CANdesc
Application
Check all states if the
SId[$22],Pid[$xxxx]
"read PID" service can
StateGroupsCheck for Pid
be executed.
If available execute the pre-handler and
check if the application rejected the service.
ApplDescPreReadDataById_xxxx
Ex ecute th e m ain -handl er
ApplDescReadDataBy Id_xxxx
to fi ll the res ponse data.
DescSetNegresponse(errorCode)
The m ain-handler st ill can
regi ster any errors.
DescProcessingDone()
RSid[$7F], Sid[$22], ErrorCode[errorCode]
The n egati ve re sponse transmissi on will be
ini ti at ed after the DescProc essin gDone
gets called .
Figure 5-4: Negative response on single PID
5.3.3 Multiple PID mode The Multiple PID mode is configured automatically if the number of PIDs, that can be
requested at the same time, is greater than one. If more than this predetermined number
of PIDs is requested, the request will be rejected with ‘RequestOutOfRange’ (NRC $31).
In this configuration some minor limitations must be taken into account while using the
CANdesc interfaces.
For the service “ReadDataByIdentifier” the ring-buffer feature can be used. Depending on
the usage of this feature, there are two main use cases for the multiple PID mode.:
©2010, Vector Informatik GmbH
Version: 2.19.00
27 / 117

Technical Reference CANdesc
5.3.3.1 Pure linear buffer configuration The ring-buffer feature is deactivated in general.
If the system doesn’t use any ring buffer access for filling the response, the PID pipeline is
still quite simple and therefore with less limitations to the CANdesc API usage and
application performance.
5.3.3.1.1 Sending a positive response Tester
CANde sc
Application
Before the requested PIDs wil l be proc essed, chec k
SId[$22],Pid0[$xxxx],Pid1[$yyy y]
StateGroupsCheck for PID0[$xxxx]
all PIDs':
1. Stat es (may be executed)
2. Pre-handlers .
ApplDescPreReadDataById_xxxx
St ateGroupsCheck fo r PID1[$ yyyy]
ApplDescPreReadDataById_yyyy
ApplDescReadDataById_xxxx
Execute the first PID's
main-handler to fill the response
data.
W rite data (pMsgContext->resData)
Set tot al response data length
(pM sgContext->resDat aLen = N)
Once the service execution of
the current PID has been
accomplished...
DescProcessingDone()
...execute the next
queued one.
ApplDescReadDataById_yyyy
W rite data (pMsgContext->resData)
Set tot al response data length
(pM sgContext->resDat aLen = M )
DescProcessingDone()
FF (RSid[$62], PID0[$xxxx], Data[3])
CF[i](Data[N-3],PID1[$yyy y]Data[M)
The positive response transmission will be
initiated after all PIDs have called
DescProcessingDone and all the data ...
Figure 5-5: Linearly written positive response on multiple PIDs (global ring buffer option is off)
©2010, Vector Informatik GmbH
Version: 2.19.00
28 / 117

Technical Reference CANdesc
5.3.3.1.2 Sending a negative response This example depicts the case where from two requested PIDs the first one may not be
accessible and rejects the service execution.
Tester
CANde sc
Application
Before reques ted PIDs will be proce ssed c heck a ll
SId[$22],Pid0[$xxxx],Pid 1[$yyy y]
PIDs':
StateGroupsCheck for PID0[$xxxx]
1. Stat es (may be execu ted)
2. Pre-handlers .
ApplDescPreReadDataById_xxxx
St ateGroupsCheck for PID 1[$ yyyy]
ApplDescPreReadDataById_yyyy
ApplDescReadDataById_xxxx
Execute the first PID's
main-handler to fill the response
data.
DescSetNegResponse(errorCode)
Once the service execution of
the current PID has been
accomplished...
DescProcessingDone()
Skip further processing
of the list
RSid[$7F], Sid[$22], ErrorCode[errorCode]
The second PID's
Main-handler will not be
executed.
...stops the further
processing a...
Figure 5-6: Negative response on multiple PIDs (global ring buffer option is off)
5.3.3.2 Ring buffer active configuration Attention: The Ring-Buffer in ‘Multiple PID‘ services can be first-time used since CANdesc
version 2.13.00
Different concepts for the buffer handling were discussed while development. Two
solutions with different pros and cons are discussed here:
•
Multiple buffer Normally each service handler (MainHandler routine) has the whole diagnostic buffer
available (apart from the protocol header bytes hidden by CANdesc). Based on this logic
the service $22 using PID pipelining has the same tasks as the normal service processor:
executing a PID handler and provide him the whole diagnostic buffer for response data.
This will hide the whole process and makes the application’s life easier (no exceptions for
the implementation). To realize this concept means to provide a separate diagnostic buffer
for each PID which size is the same as the main one (configured by GENtool). This is a
fast and quite simple solution but requires too much RAM to be reserved for only the case
©2010, Vector Informatik GmbH
Version: 2.19.00
29 / 117

Technical Reference CANdesc
that sometimes the testers would like to use the maximum capacity of the ECU (i.e.
requests as many PIDs as possible for this ECU in a single request).
Pros: less ROM usage
Cons: very high RAM usage
•
virtual multiple buffer This concept is more generically designed and will not have additional ROM overhead if
the pipeline size will be increased. An intelligent buffer concept gives the application the
whole size of the buffer for each MainHandler call.
Once the whole data for the current PID has been written, the data supplement will stop
(because the next PID handler will not be called). The transmission in the transport layer is
started and some time later it runs into buffer under-run. This ‘signal’ is used to call the
next PID MainHandler. This MainHandler has to provide his data very quick. Otherwise the
response transmission will stop (due to a continuously buffer under-run).
Pros: less RAM usage (practically independent of the maximum list size).
Cons: moderate ROM overhead / the response data must be composed very
quickly.
The virtual multiple buffer concept is the implemented solution. The application can choose
for each PID separately to write the data linearly or by using the ring buffer.
performance requirements The application has performance requirements:
- If linear access has been chosen, the whole response data of each MainHandler
must be filled within the lower duration of the P2 time and the TP confirmation
timeout. Normally the P2 time is shorter than the transport layers confirmation
timeout so just take into account that each Main-Handler must be able to fill its
response data within a time far shorter than the P2 time.
- If ring buffer access has been chosen, the application has to call the
“DescRingBufferWrite” fast enough to keep TP from confirmation timeout.
Negative response on PID The negative response handling
is changed in the multiple PID mode! This affects all
protocol-services with a activated ‘May be combined’ property. The UDS specification
encloses only the SIDs: $22 and $2A. For all other services the negative response
handling is not changed!
If the application has to reject a request (e.g. ignition key check) it has to do that in the
PreHandler. The application is
not allowed to call “DescSetNegResponse()” to send a
negative response in any MainHandler.
This limitation is based on the concept to check all reject conditions in PreHandlers before
starting the transmission. This is necessary because after CANdesc has executed the first
MainHandler (which starts the positive response transmission) there will be no chance to
send a negative response.
©2010, Vector Informatik GmbH
Version: 2.19.00
30 / 117

Technical Reference CANdesc
The usage of the concept: CANdesc starts to call all PreHandlers of this multiple PID
request. If no negative response is set, CANdesc will start to call the corresponding
MainHandlers. Within the first call of DescProcessingDone() the transmission is initiated.
Note (for version 3.02.00 of CANdesc and above): In case the application sets an error code during the main-handler execution in non-debug
(released) version of the component, depending on the situation will lead to:
For service $22:
- First DID of the list main-handler: sending a negative response to service $22;
- Second or any of the succeeding DIDs in the list: transmission interruption.
For service $2A:
- Ignoring the scheduled response.
©2010, Vector Informatik GmbH
Version: 2.19.00
31 / 117

Technical Reference CANdesc
5.3.3.2.1 Sending a positive response Tester
CANdesc
Application
SId[$22],Pid0[$xxxx],Pid1[$yyyy]
Before requested PIDs will be processed check all
StateGroupsCheck for PID0[$xxxx]
PIDs':
1. States (may be executed)
ApplDescPreReadDataById_xxxx
2. Pre-handlers.
StateGroupsCheck for PID1[$yyyy]
ApplDescPreReadDataById_yyyy
ApplDescReadDataById_xxxx
Execute the first PID's
main-handler to fill the response
data.
W rit e da ta (pM sgCont ext->resData)
Set total response data length
(pMsgContext->resDataLen = N)
DescProcessingDone()
FF (RSid[$62], PID0[$xxxx], Data[3])
W ith the first cal led
DescProcessingDone() sta rts
th e response transm ission.
CF[i](Data[N-3])
Once the whole data of the current PID has
been sent the next PID main-handler will be
ApplDescReadDataById_yyyy
called to supply the response data.
W rit e da ta (pM sgCont ext->resData)
CF[j](Data[N-k],PID1[$yyyy]Data[m])
Set total response data length
(pMsgContext->resDataLen = M)
DescProcessingDone()
CF[ l](Data[M-m] )
Figure 5-7: Linearly written response data on multiple PIDs (global ring buffer option is on)
©2010, Vector Informatik GmbH
Version: 2.19.00
32 / 117

Technical Reference CANdesc
5.3.3.2.2 Sending a negative response Tester
CANdesc
App li cat ion
SId[$22],Pid0[$xxxx],Pid1[$yyyy]
Before request ed PID s wi ll be processe d che ck all
StateGroupsCheck for PID0[$xxxx]
PIDs':
1. St ate s (may be execut ed)
2. Pre-h andle rs.
ApplDescPreReadDataById_xxxx
StateGroups Ch eck for PID1 [$yyy y]
ApplDescPreReadDataById_yyyy
DescSetNegResponse(errorCode)
If e rror has been s et - no
mai n-hadnler pro cessing w ill
fol low.
RSid[$7F], Sid[$22], ErrorCode[errorCode]
Send immediately
negative response.
Figure 5-8: Negative response on multiple PIDs (global ring buffer option is on)
©2010, Vector Informatik GmbH
Version: 2.19.00
33 / 117

Technical Reference CANdesc
5.3.3.2.3 PostHandler execution rule All PostHandlers are executed after the finished response transmission (like a normal
PostHandler).
Independent of the ring-buffer option setting (enabled or disabled), the execution of the
service $22 PostHandler(s) has the following rule which has to be taken into account:
calling the Post-Handler of a specific PID means: either the PreHandler of this PID
has been previously called or its MainHandler. The following sequence chart depicts this:
Tester
CANdesc
App li cat ion
SId[$22],Pid0[$xxxx],Pid1[$yyyy],
Before request ed PID s wi ll be processted check all
Pid2[$zzzz]
StateGroupsCheck for PID0[$xxxx]
PIDs':
1. St ate s (may be execut ed)
2. Pre-h andle rs.
ApplDescPreReadDataById_xxxx
PID0, PID1and PID2 have all
post-handlers configured.
StateGroups Check for PID1 [$yyy y]
PID1 has no pre-handler
cofigured.
StateGroupsCheck for PID2[$zzzz]
ApplDescPreReadDataById_zzzz
DescSetNegResponse(errorCode)
If e rror has been s et - no
mai n-hadnler pro cessing w ill
fol low.
RSid[$7F], Sid[$22], ErrorCode[errorCode]
Send immediately
negative response.
ApplDe scPostRead Dat aById_xxxx
PID1 has a post-handler but since
the application doesn't know about
its reception - no post-handler will
ApplDe scPostRead Dat aById_zzzz
be called.
Figure 5-9: Post-Handler execution sequence.
©2010, Vector Informatik GmbH
Version: 2.19.00
34 / 117

Technical Reference CANdesc
5.4 DynamicallyDefineDataIdentifier (SID $2C) (UDS) The DynamicallyDefineDataIdentifier service allows the client (tester) to dynamically define
in a server (ECU) a data identifier that can be read via the ReadDataByIdentifier service at
a later time.
The intention of this service is to provide the client with the ability to group one or more
data elements into a data superset that can be requested en masse via the
ReadDataByIdentifier or ReadDataByPeriodicIdentifier service. The data elements to be
grouped together can either be referenced by:
• a source data identifier, a position and size or,
• a memory address and a memory length, or,
• a combination of the two methods listed above using multiple requests to define the
single data element. The dynamically defined dataIdentifier will then contain a
concatenation of the data parameter definitions.
The definition of the dynamically defined data identifier can either be done via a single
request message or via multiple request messages. This allows for the definition of a
single data element referencing source identifier(s) and memory addresses. The server
has to concatenate the definitions for the single data element. A redefinition of a
dynamically defined data identifier can be achieved by clearing the current definition and
start over with the new definition.
At last the dynamically defined data identifier consists of a list of (non-dynamically) defined
data identifiers and memory area ranges that can be used in any combination.
For more information, see /ISO 14229-1/
5.4.1 Feature set These are the supported subfunctions for service $2C (DynamicallyDefineDataIdentifier):
Subfunction Name Hex Value defineByIdentifier 01
defineByMemoryAddress 02
clearDynamicallyDefinedDataIdentifier 03
5.4.2 API Functions The reception of a Service $2C request will either delete a DynamicDataIdentifier (DDID)
or PeriodicDataIdentifier (PDID) by subfunction $03 or build a DDID/PDID by (several
times) using subfunction $01 and/or $02.
For subfunction $02 (defineByMemoryAddress) there is a new application callback
function (see chapter
6.6.12 “DynamicallyDefineDataIdentifier ($2C) (UDS) functions”). It
allows the application to permit or deny the extension of the DDID/PDID by accessing the
defined memory range. The callback function must check, if the requested memory area is
readable for the external Tester and if the current security state of the ECU permits the
©2010, Vector Informatik GmbH
Version: 2.19.00
35 / 117

Technical Reference CANdesc
extension of the DDID/PDID. See chapter
6.6.12.2 for the full set of checks to be
executed.
Please note that later, when reading the DDID by using service $22
(ReadDataByIdentifier), further (security) checks for each element of the DDID’s list are
executed to verify that e.g. the (then active) security state permits the
reading of the
memory area or DID. These checks (of Service $22 and $23) are done in the traditional
sequence of Pre-, Main- and PostHandler.
The reception of a Service $22 request starts a new context in CANdesc. Typically the
requested data can not be asked from the application by using one single callback function
but must be constructed sequentially by collecting data for each part of the DDID’s
definition list:
• A requested basic source data identifier (DID) is asked of the application by the
respective callback (as for Service $22 request), the result data is stripped down to
the defined position and size
• A memory address is read by its defined function (typically the same as used for a
Service $23 request) and the defined ‘size’ bytes are collected.
As recommended from /ISO 14229-1/ to prevent data consistency problems a recursive
definition of DDIDs is NOT supported.
The Service $22 response data is collected by splitting the service request into these basic
tasks, then running the well known internal functions that were defined for them, collect
their results and build up the Service $22 response. Therefore, each of the above tasks
starts a new context, executes the defined Pre-, Main- and Post-Handler where
Application-Callbacks get data, delivers its result and finally ends its context.
The recursive evaluation of DDIDs enforces the usage of MultiContext mode.
We would like to point out that the described operating sequence above is completely run
within CANdesc and totally transparent for the application except for the additional API
callback function. Using Service $2C or $2A switches CANdesc to MultiContext mode – if
your application isn’t prepared to support MultiContext mode (by using the defined macros)
you’ll get compiler errors about inconsistent argument lists.
5.4.3 Sequence Charts Service $2C – Define a DDID The following picture exemplifies the sequence of defining a DDID by several call of
Service DynamicallyDefineDataIdentifier ($2C).
In our example the first Service $2C request defines the DDID $F300 to return two
independent memory areas. For both areas the callback function
ApplDescCheckDynDidMemoryArea() is triggered and in this example the application
permits both accesses.
The consecutive Service $2C request extends the DDID $F300 by (some fragments of) the
existing DID $F010. As the here executed PreHandler does not set a Negative Response
Code, CANdesc considers the extension of the DDID valid and enlarges the DDID
definition.
©2010, Vector Informatik GmbH
Version: 2.19.00
36 / 117

Technical Reference CANdesc
A third Service $2C request tries to extend the DDID $F300 once more by another
memory area. In our example the call fails, as the specified memory area ($0000) is not
valid for this ECU. The service is negative responded and the previous DDID specification
is left untouched.
sd Define a new DDID v ia Serv ice $2C requestTesterCANdescApplicationDefine DDID $F300 as
$2C 02 F300 12 ABCD04 FEDC05
4-byte m em ory block at
address $ABCD and
5-byte bl ock at $FEDC
check for
Appl DescCheckDynDi dM em oryArea
Addr. $ABCD,
m em BlockOk
Si ze $04
check for
Appl DescCheckDynDi dM em oryArea
Addr. $FEDC,
Size $05
m em BlockOk
PosResponse ($6C 02)
$2C 01 F300 F010 ...
Extend the DDID $F300
PreHandl er for DID F010
by using
exi sti ng DID $F010
No Neg. RCode
set --> success
PosResponse ($6C 01)
$2C 02 F300 12 000004
Further extenti on fail s
due i nval id address
val ue ($0000) in
Appl DescCheckDynDi dM em oryArea
request
check for Addr.
m em Bl ockInvAddress
$0000 fail s!
NegResponse ($7F 2C 31)
Figure 5-10: Defining a DDID.
©2010, Vector Informatik GmbH
Version: 2.19.00
37 / 117

Technical Reference CANdesc
Service $22 – Read a DDID The above defined DDID is now read by Service ReadDataByIdentifier ($22). Within
CANdesc the DDID is disassembled into its elements: One (virtual) request for the first
memory range, another request for the second memory range and finally a request for the
predefined DID $F010.
sd Read defined DDID v ia Serv ice $22 requestTesterCANdescApplicationRead DDID $F300 that
$22 F300
was defined as:
Addr ABCD, Si ze 04
$23 12 ABCD04
+ Addr FEDC, Size 05
+ DID F010, Pos .., Size ..
execute vi rtual
$23 request
PreHandler
M ainHandler
PostHandler
$23 12 FEDC05
execute vi rtual
$23 request
PreHandler
M ainHandler
PostHandler
$22 F010
execute vi rtual
$22 request ...
PreHandler
M ainHandler
PostHandler
... and cut out the
requi red bytes
from the result
concatenate
the resul ts
PosResponse ($62)
Figure 5-11: Reading a DDID.
Between
CANdesc and the
application the sequence looks same as if the tester would
have sent 3 requests: (1) ReadMemoryByAddress ($23) on first address range, (2)
ReadMemoryByAddress ($23) on second address range, and finally (3)
ReadDataByIdentifier ($22) on the DID $F010. Keep in mind: this is just a picture for the
succession of events/API-calls - these requests are not real, the messages are never seen
on the bus, the internal sequence is actually slightly different but for the application it looks
the same!
©2010, Vector Informatik GmbH
Version: 2.19.00
38 / 117


Technical Reference CANdesc
5.5 Read/Write Memory by Address (SID $23/$3D) (UDS) Caution
This chapter does not apply to all ECU configurations. Only in special cases the
memory access support will be available!
The services $23 (ReadMemoryByAddress) and $3D (WriteMemoryByAddress) are
handled uniformly in CANdesc.
Basically the memory by address requests look like this:
$23
FID
address length $3D
FID
address length data The application need not concern itself with the details how the address and length are
formatted. If a valid FID is recognized, CANdesc will extract the address and length
information from the request and call an appropriate application callback.
See also:
ApplDescReadMemoryByAddr
ess (6.6.13.1)
ApplDescWriteMemor
yByAddress (6.6.13.2)
5.5.1 Tasks performed by CANdesc To a certain degree CANdesc validates the request.
The basic format checks and service level state validation – this means e.g. security and
session validation – are performed before calling the application callback.
Service level state validation means that the request will be denied if all diagnostic
instances of service $23 or $3D are not allowed in the current state.
In case of WriteMemoryByAddress the application has linear access to the whole data
block to write.
5.5.2 Task to be performed by the Application CANdesc currently does not provide state validation on format identifier level or memory
address / memory block level.
This means, that for example different memory addresses shall require different security
levels, the application will have to verify that the ECU currently is in an appropriate state to
access the requested memory area.
5.5.3 Repeated service calls The repeated service call feature is available for the memory access callbacks.
Because they have a different prototype than a normal main handler, the usual API
‘DescStartRepeatedServiceCall (see
6.6.7.1)’ can not be used with the memory access
callbacks.
©2010, Vector Informatik GmbH
Version: 2.19.00
39 / 117

Technical Reference CANdesc
Instead, a new API call ‘DescStartMemByAddrRepeatedCall (see
6.6.7.2)’ has been
added.
To abort the repeated service call, use the usual API.
©2010, Vector Informatik GmbH
Version: 2.19.00
40 / 117

Technical Reference CANdesc
6 CANdesc API 6.1 API Categories 6.1.1 Single Context This API category is used if no parallel processing is necessary. This is typical for the ISO
14229 specification.
6.1.2 Multiple Context (only CANdesc) This API category is used if parallel processing is necessary. This means not that
CANdesc can work with multiple instances, but only one functional request can be
processed parallel to a working physical request.
6.2 Data Types The following standard data types are used in this document:
vuint8 Represents 8 bit unsigned integer value.
vsint8 Represents 8 bit signed integer value.
vuint16 Represents 16 bit unsigned integer value.
vsint16 Represents 16 bit signed integer value.
vuint32 Represents 32 bit unsigned integer value.
vsint32 Represents 32 bit signed integer value.
Table 6-1: standard data types
Additional data types used in this document are described in the corresponding function
description.
6.3 Global Variables -
6.4 Constants 6.4.1 Component Version The version of the CANdesc component consist of 3 parts in the following format:
MM.SS.BB,
Where:
MM is the main version of the component,
SS is the subversion of the component,
BB is the bug-fix version of the component.
To get the current CANdesc version, the application could use the following shared data:
©2010, Vector Informatik GmbH
Version: 2.19.00
41 / 117

Technical Reference CANdesc
Name Type Description g_descMainVersion
BCD
Contains the main version part.
g_descSubVersion
BCD
Contains the subversion part.
g_descBugFixVersion BCD
Contains the bug-fix version part.
Table 6-2: Version API data
Note: The version of the module is the same as the version of the generator’s DLL file.
6.5 Macros 6.5.1 Data exchange The CANdesc provides a generic API for splitting a multi-byte (up to 4 bytes) variable to a
byte sequence with platform transparent access to each byte, and assembling a multi-byte
(up to 4 bytes) variable from a sequence of bytes.
6.5.1.1 Splitting 16 bit data The following function could be used to get platform independent access to the
corresponding bytes of 16 bit data variable:
vuint8 DescGetHiByte(16BitData) vuint8 DescGetLoByte(16BitData) 6.5.1.2 Splitting 32 bit data The following function could be used to get platform independent access to the
corresponding bytes of 32 bit data variable:
vuint8 DescGetHiHiByte(32BitData) vuint8 DescGetHiLoByte(32BitData) vuint8 DescGetLoHiByte(32BitData) vuint8 DescGetLoLoByte(32BitData) ©2010, Vector Informatik GmbH
Version: 2.19.00
42 / 117

Technical Reference CANdesc
6.5.1.3 Assembling 16 bit data The application can create the 16 bit signal from a byte stream using the following API:
uint16 DescMake16Bit(hiByte, loByte) where the
hiByte, loByte are the corresponding bytes for the returned 16 bit data.
6.5.1.4 Assembling 32 bit data The application can create the 32 bit signal from a byte stream using the following API:
uint32 DescMake32Bit(HiHiByte, HiLoByte, LoHiByte, LoLoByte) where the
HiHiByte, HiLoByte, LoHiByte, LoLoByte are the corresponding bytes for the
returned 32 bit dat
©2010, Vector Informatik GmbH
Version: 2.19.00
43 / 117

Technical Reference CANdesc
6.6 Functions 6.6.1 Administrative Functions 6.6.1.1 DescInitPowerOn() DescInitPowerOnAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
DescInitPowerOn (DescInitParam initParameter)
Multi Context
void
DescInitPowerOn (DescInitParam initParameter)
Parameter initParameter
Manufacturer specific type, please refer ‘CANdesc: OEM
specifics’ document
Return code -
-
Functional Description PowerOn Initialization of the CANdesc.
This function has to be called once before all other functions of CANdesc after PowerOn.
Pre-conditions Correctly initialized CAN-driver via
CanInitPowerOn() and TransportLayer via
TpInitPowerOn().
Call context Background-loop level with global disabled interrupts
Particularities and Limitations
DescInitPowerOn (initParameter) must be called after
TpInitPowerOn() was called
(please, refer the /TPMC/ documentation), otherwise the reserved diagnostic
connection will be los
©2010, Vector Informatik GmbH
Version: 2.19.00
44 / 117

Technical Reference CANdesc
6.6.1.2 DescInit() DescInitAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
DescInit (DescInitParam initParameter)
Multi Context
void
DescInit (DescInitParam initParameter)
Parameter initParameter
Manufacturer specific type, please refer ‘CANdesc Part IV:
OEM specifics’ document
Return code -
-
Functional Description Re-initialization of CANdesc.
This function can be called to re-initialize CANdesc (e.g. after WakeUp). All internal states
will be set to default, except the states in this initParameter (e.g. Session or
CommunicationControl).
Pre-conditions CANdesc was once initialized via
DescInitPowerOn () Call context Background-loop level with global disabled
©2010, Vector Informatik GmbH
Version: 2.19.00
45 / 117

Technical Reference CANdesc
6.6.1.3 DescTask() DescTaskAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
DescTask (void)
Multi Context
void
DescTask (void)
Parameter -
-
Return code -
-
Functional Description The function
DescTask() has to be called periodically (cycle time TDescCallCycle) by the
application.
Within the context of this function the interaction with the application is performed. In
addition the monitoring of the timings is done, therefore the accuracy of the timings
depends on the call cycle and on the accuracy of the calls.
Pre-conditions -
Call context Background-loop level or OSEK-OS Task. The task should have a lower or equal priority
than all other interaction to the CANdesc component.
Particularities and Limitations May not be called if the
DescStateTask() and
DescTimerTask() are called.
©2010, Vector Informatik GmbH
Version: 2.19.00
46 / 117

Technical Reference CANdesc
6.6.1.4 DescStateTask() DescStateTaskAvailable since 4.00.00Is Reentrant Is callback Prototype Single Context
void
DescStateTask (void)
Multi Context
void
DescStateTask (void)
Parameter -
-
Return code -
-
Functional Description Motivation: Using a single task function for timers and processing leads either to slow
processing or to faster timers which costs runtime for the ECU. The timers need very
stable cyclical call but the processing tasks may be done “as soon as possible” (i.e. using
OSEK to be assigned to lower priority task).
The function
DescStateTask() has to be called periodically by the application. It is not a
timer task – it has no specific time period. As smaller this tasks call period is, so faster will
be the service processing.
This task function will process received request and to control the transmission of the
responses. Depending on the ECU requirements it is recommended to call this task as
soon as possible to avoid delays of the response (e.g. dynamically defined DID,
scheduled data, etc.), but
take into account that within this task the corresponding
MainHandler will be executed too. Pre-conditions -
Call context Background-loop level or OSEK-OS Task. The Task should have a lower or equal priority
than all other interaction to the CANdesc component.
Particularities and Limitations May not be called if the
DescTask() is used (reentrancy is forbidden).
©2010, Vector Informatik GmbH
Version: 2.19.00
47 / 117

Technical Reference CANdesc
6.6.1.5 DescTimerTask() DescTimerTaskAvailable since 4.00.00Is Reentrant Is callback Prototype Single Context
void
DescTimerTask (void)
Multi Context
void
DescTimerTask (void)
Parameter -
-
Return code -
-
Functional Description Motivation: Using a single task function for timers and processing leads either to slow
processing or to faster timers which costs runtime for the ECU. The timers need very
stable cyclical call but the processing tasks may be done “as soon as possible” (i.e. using
OSEK to be assigned to lower priority task).
The function
DescTimerTask() has to be called periodically by the application in the
configured task period. It can be called as slow as possible to free run time resources.
Pre-conditions -
Call context Background-loop level or OSEK-OS Task. The Task should have a lower or equal priority
than all other interaction to the CANdesc component.
Particularities and Limitations May not be called if the
DescTask() is used. This will lead to either reentrancy
(consistency) problems or/and to timing issues.
©2010, Vector Informatik GmbH
Version: 2.19.00
48 / 117

Technical Reference CANdesc
6.6.1.6 DescGetActivityState() DescGetActivityStateAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
DescContextActivity DescGetActivityState (void)
Multi Context
DescContextActivity DescGetActivityState (vuint8 iContext)
Parameter iContext
reference to the corresponding request context
Return code 1. kDescContextIdle
1. There is currently no request processing (even
when scheduler is active).
2. kDescContextActiveRxBegin
2. Currently request reception is active.
3. kDescContextActiveRxEnd
3. Reception finished, request will be processed.
4. kDescContextActiveProcess
4. The request was received, is under processing
now
5. kDescContextActiveProcessEnd
5. DescProcessingDone called waiting for data
6. kDescContextActiveTxReady
before starting the transmission.
7. kDescContextActiveTx
6. Ready for response transmission.
8. kDescContextActivePostProcess
7. Transmission of the response is currently active.
8. Transmission/processing ended. Post-processing
will be performed.
Functional Description Motivation: Sometimes the knowledge about the presence of a tester is necessary. A typical
use-case is to avoid the ECU from going into sleep mode.
A non-default session indicates that a tester is present. But how can this be done, if the ECU is
in the default session?
Due to that fact the ECU application can call the function
DescGetActivityState() any time to
check if CANdesc has something to do or is in idle mode. This can be used e.g. to change the
state of the ECU sleep mode.
Note: The return value is bit coded and any senseful combination of the above mentioned
values is possible (e.g.
kDescContextActiveRxBegin |
kDescContextActivePostProcess).
Please check always with bit test (and operation) and not using the value comparison.
Pre-conditions -
Call context -
Particularities and Limitations ©2010, Vector Informatik GmbH
Version: 2.19.00
49 / 117

Technical Reference CANdesc
6.6.2 Service Functions 6.6.2.1 DescSetNegResponse() DescSetNegResponseAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
DescSetNegResponse (DescNegResCode errorCode)
Multi Context
void
DescSetNegResponse (vuint8 iContext, DescNegResCode errorCode)
Parameter iContext
reference to the corresponding request context
errorCode
the
errorCode is the one of the provided error code constants
of CANdesc in the desc.h file with the following naming
convention:
kDescNrc<error name>.
Return code -
-
Functional Description In the PreHandler or in the MainHandler function the application has the possibility of
forcing negative response with a certain negative response code for the current request
when it is necessary.
Pre-conditions -
Call context Within a ‘Service PreHandler’ function and within or after a ‘Service MainHandler’ function
Particularities and Limitations Once an error was set it can not be overwritten or reset.
This function does not finish the processing of the request. It just sets a certain error
and after that the application must confirm that the request processing was completely
finished by calling DescProcessingDone().
©2010, Vector Informatik GmbH
Version: 2.19.00
50 / 117

Technical Reference CANdesc
6.6.2.2 DescProcessingDone() DescProcessingDoneAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
DescProcessingDone (void)
Multi Context
void
DescProcessingDone (vuint8 iContext)
Parameter iContext
reference to the corresponding request context
Return code -
-
Functional Description After completing the request execution the application must call the API function.
By calling this function, depending on the previous actions of the application the CANdesc
module will either send a response (positive/negative depending on the error state
machine) or no response will be send if the application/CANdesc decides that there must
be no response (please refer the Part III User Manual)
Pre-conditions -
Call context Within or after a ‘Service MainHandler’ function
Particularities and Limitations
©2010, Vector Informatik GmbH
Version: 2.19.00
51 / 117

Technical Reference CANdesc
6.6.3 Service Call-Back functions 6.6.3.1 Service PreHandler ApplDescPre<Service-Qualifier + Instance-Qualifier>>Available since 2.00.00Is callback Prototype Single Context
void
ApplDescPre<Service-Qualifier + Instance-Qualifier> (void)
Multi Context
void
ApplDescPre<Service-Qualifier + Instance-Qualifier> (vuint8 iContext)
Parameter iContext
the current request context location
Return code -
-
Functional Description The PreHandler is executed before the Service MainHandler is called. In the PreHandler,
the application can hook any (especially application-specific) state validations. One
PreHandler implementation may be shared with different service instances (only
CANdesc).
To allow quite complex operations to take place, the application has access to the request
data using the context data structure (if given).
Pre-conditions Must be configured to ‘User’ in attribute ‘PreHandlerSupport’’
Call context From
DescTask() Particularities and
©2010, Vector Informatik GmbH
Version: 2.19.00
52 / 117

Technical Reference CANdesc
6.6.3.2 Service MainHandler ApplDesc<Service-Qualifier + Instance-Qualifier>Available since 2.00.00Is callback Prototype Single Context
void
ApplDesc<Service-Qualifier + Instance-Qualifier> (DescMsgContext* pMsgContext)
Multi Context
void
ApplDesc<Service-Qualifier + Instance-Qualifier> (DescMsgContext* pMsgContext)
Parameter typedef struct
pMsgContext
{
DescMsg reqData;
DescMsgLen reqDataLen;
DescMsg resData;
DescMsgLen resDataLen;
DescMsgAddInfo msgAddInfo;
vuint8 iContext;
t_descUsdtNetBus busInfo;
} DescMsgContext;
DescBitType reqType :2; /* 0x01: Phys 0x02: Func */
DescMsgAddInfo DescBitType resOnReq :2; /* 0x01: Phys 0x02: Func */
DescBitType suppPosRes:1; /* 0x00: No 0x01: Yes */
Read access
pMsgContext->reqData pointer to the first byte of the already extracted request data.
pMsgContext->reqDataLen length of the extracted request data.
pMsgContext->iContext the current request context location
(used only as a handle -
DO NOT MODIFY).
pMsgContext->msgAddInfo.reqType the current request addressing method. Could be either
‚kDescFuncReq’ or ‚kDescPhysReq’
(bitmapped).
pMsgContext->msgAddInfo.suppPosRes if set, no positive response will be sent. (UDS only).
pMsgContext->busInfo the current request communication information (i.e. driver type (CAN,
MOST, FlexRay, etc.), addressing information, communication channel
number, tester address (if applicable) etc.
Write access
pMsgContext->resData
pointer to the first position where the response data can be written.
pMsgContext->resDataLen length of the written data.
pMsgContext->msgAddInfo.resOnReq can be used to disable the response transmission on the current
request. If set to ‘0’ no response will be transmitted. Physical and
function can be set separately (bitmapped).
Return code ©2010, Vector Informatik GmbH
Version: 2.19.00
53 / 117

Technical Reference CANdesc
-
-
Functional Description The MainHandler processes the service request.
•
Perform length validation for varying length information of request.
•
Disassemble any data received with the request telegram and process it,.
•
Assemble any data to be send with the response and update current response
length.
•
Confirm that the processing is finished.
Pre-conditions Must be configured to ‘User’ in attribute ‘MainHandlerSupport’
Call context From
DescTask() Particularities and Limitations If used as MainHandler for Protocol Services, the Protocol-Service-Qualifier is used
instead
©2010, Vector Informatik GmbH
Version: 2.19.00
54 / 117

Technical Reference CANdesc
6.6.3.3 Service PostHandler ApplDescPost<Service-Qualifier + Instance-Qualifier>Available since 2.00.00Is callback Prototype Single Context
void
ApplDescPost<Service-Qualifier + Instance-Qualifier> (vuint8 status)
Multi Context
void
ApplDescPost<Service-Qualifier + Instance-Qualifier> (vuint8 iContext,
vuint8 status)
Parameter iContext
the current request context location
KDescPostHandlerStateOk status (bit-coded)
The positive response was transmitted successfully
KDescPostHandlerStateNegResSent It was a negative response
kDescPostHandlerStateTxFailed A transmission error occurred
Return code -
-
Functional Description Any state transition may not be performed before the current service is finished
completely (the last frame of the response is sent successfully).
The PostHandler is executed after a confirmation of the message transmission is received
and is designated for state adaptation – all other things are already done when the
PostHandler is called.
Pre-conditions Must be configured to ‘User’ in attribute ‘PostHandlerSupport’
Call context From
DescTask() Particularities and Limitations If used as PostHandler for Protocol Services, the Protocol-Service-Qualifier is used
instead
You can override the given name extension (Service-Qualifier + Instance-Qualifier) by
using the ‘PostHandlerOverrideName’.
©2010, Vector Informatik GmbH
Version: 2.19.00
55 / 117

Technical Reference CANdesc
6.6.4 User (Unknown) Service Handling In some cases the ECU shall support a service which is not described in the common way
for CANdesc (by means of CANdelaStudio/GENtool). With a little bit more effort inside the
application than for the “known” services the ECU is still be able to support those user
defined services. The effort comes form the fact that CANdesc knows nothing about this
service (e.g. session, security or other states described in the CDD configuring CANdesc,
addressing methods allowed for those services, etc.) and therefore the application must do
this work for each user defined service by itself. In fact for CANdesc there is only one
“unknown” service and it is up to the application to differentiate between multiple unknown
service(s).
Attention: This feature is available since version 2.11.00 of CANdesc(Basic).
6.6.4.1 How it works If the feature “Support Generic User Service” is enabled in the GENtool CANdesc uses
following handling:
- if a service was not recognized by its SID, before the automatic negative
response transmission will be sent, the application will be called (see
6.6.4.2
ApplDescCheckUserService) to check this SID too. If it can not recognize it
as a valid one the usual negative response will be sent.
- If the application has accepted the SID, then a special “user service”
MainHandler will be calle
d (see 6.6.4.4 Generic User Service MainHandler).
- If in GENtool “Support Generic User Service PostHandler” is set, after the
request processing has been accomplished, a special “user service”
PostHandler will be calle
d (see 6.6.4.5 Generic User Service PostHandler).
Note: - Since CANdesc doesn’t distinguish user defined services, a special API was
designed to get the application the opportunity to dispatch among the SIDs
(in MainHandler and in the PostHandler).
- The user defined services are processed on service id level which means the
application shall dispatch and do the whole format check of these requests.
The state management shall be performed bye application, too.
©2010, Vector Informatik GmbH
Version: 2.19.00
56 / 117

Technical Reference CANdesc
6.6.4.2 ApplDescCheckUserService() ApplDescCheckUserServiceAvailable since 2.11.00Is callback Prototype Single Context
vuint8
ApplDescCheckUserService (DescMsgItem sid)
Multi Context
vuint8
ApplDescCheckUserService (DescMsgItem sid)
Parameter sid
The service identifier which is currently under processing.
Return code 1. Return this value if the service id is a “user defined” one.
1. kDescOk
2. Return this value if the service id is unknown for the
2. kDescFailed
application too.
Functional Description The currently received request contains an unknown for CANdesc service Id. Within this
function the ECU application has to decide immediately if the SID is one of the user
defined or not. Depending on the return value, CANdesc will process further this request
or will reject it by sending negative response ‘ServiceNotSupported’.
Pre-conditions The “Support Generic User Service” option was enabled in the GENtool configuration.
Call context From
DescTask() (in KWP diagnostics also from RxInterrupt).
Particularities and Limitations
©2010, Vector Informatik GmbH
Version: 2.19.00
57 / 117

Technical Reference CANdesc
6.6.4.3 DescGetServiceId() DescGetServiceIdAvailable since 2.11.00Is Reentrant Is callback Prototype Single Context
DescMsgItem
DescGetServiceId (void)
Multi Context
DescMsgItem
DescGetServiceId (vuint8 iContext)
Parameter iContext
The current request context location
Return code The service id which is currently under processing.
DescMsgItem
Functional Description Reports the service id of the currently processed user-service request.
Pre-conditions The “Support Generic User Service” option was enabled in the GENtool configuration.
Call context From
DescTask() Particularities and Limitations This function may be called at any time within a diagnostic request life cycle starting at
the call of the MainHandler and ending by the PostHandler (if configured) or (if none
configured) by calling
DescProcessingDon ©2010, Vector Informatik GmbH
Version: 2.19.00
58 / 117

Technical Reference CANdesc
6.6.4.4 Generic User Service MainHandler ApplDescUserServiceHandlerAvailable since 2.11.00Is callback Prototype Single Context
void
ApplDescUserServiceHandler (DescMsgContext* pMsgContext)
Multi Context
void
ApplDescUserServiceHandler (DescMsgContext* pMsgContext)
Parameter pMsgContext
Refer the section
6.6.3.2 Service MainHandler for details about this
parameter.
Read Access
pMsgContext->reqData pointer to the first byte after the service Id.
The other members of the parameter are describ
ed in 6.6.3.2 Service
MainHandler Write access
pMsgContext->resData pointer to the first byte after the response SID, where the data (incl. sub-
parameters) will be written.
The other members of the parameter are describ
ed in 6.6.3.2 Service
MainHandler Return code -
-
Functional Description This MainHandler is called for all unknown service requests at service id level, so the
application has to do following:
•
Perform service id dispatching (if more than one user defined service shall be
used).
•
Perform length validation for varying length information of request.
•
Perform parameter (if any) validation.
•
Disassemble any data received with the request telegram and process it.
•
Assemble any data to be send with the response and update current response
length
•
Confirm that the processing is finished.
Pre-conditions The “Support Generic User Service” option was enabled in the GENtool configuration.
Call context From
DescTask() Particularities and Limitations Refer the section
6.6.3.2 Service MainHandler.
DescGetServiceId() may be called here to dispatch the SID of the currently processed
user service (refer
6.6.4.3 DescGetServiceId ©2010, Vector Informatik GmbH
Version: 2.19.00
59 / 117

Technical Reference CANdesc
6.6.4.5 Generic User Service PostHandler ApplDescPostUserServiceHandlerAvailable since 2.11.00Is callback Prototype Single Context
void
ApplDescPostUserServiceHandler (vuint8 status)
Multi Context
void
ApplDescPostUserServiceHandler (vuint8 iContext, vuint8 status)
Parameter iContext, status
Refer
6.6.3.3 Service PostHandler for information.
Return code -
-
Functional Description The functionality of the user service PostHandler is the same as the one of the normal
service PostHandler. Refer
6.6.3.3 Service PostHandler for more details.
Pre-conditions The “Support Generic User Service PostHandler” option was enabled in the GENtool
configuration.
CANdesc version >= 2.11.00
Call context From
DescTask() Particularities and Limitations Refer the section
6.6.3.3 Service PostHandler for information.
DescGetServiceId() may be called here to dispatch the SID of the currently post-
processed user service (r
efer 6.6.4.3 DescGetServiceId ©2010, Vector Informatik GmbH
Version: 2.19.00
60 / 117

Technical Reference CANdesc
6.6.5 Session Handling 6.6.5.1 ApplDescCheckSessionTransition() ApplDescCheckSessionTransitionAvailable since 2.00.00Is callback Prototype Single Context
void
ApplDescCheckSessionTransition (DescStateGroup newState, DescStateGroup
formerState)
Multi Context
void
ApplDescCheckSessionTransition (vuint8 iContext, DescStateGroup newState,
DescStateGroup formerState)
Parameter iContext
the current request context location
the CANdesc component has change to this session state
newState
the CANdesc component has change from this session state
formerState
Return code -
-
Functional Description This hook function will be called, while session request is received (SID $10). If the
application wants to discard this request, an error must be set (via
DescSetNegResponse() ).
The application always has to confirm this hook function via
DescSessionTransitionChecked(). Both above functions can be called also outside of the context of this function (e.g.
application task waiting for results form an I/O port). CANdesc will send RCR-RP
response as long as the application delays the confirmation for the session transition.
In some cases the application has to know whether the SPRMIB in the request was set or
not. Since this API call does not contain this information, a dedicated API in CANdesc
provides it: DescIsSuppressPosResBitSet (). Pre-conditions At least one DiagnosticSessionControl service must be configured to ‘OEM’ in attribute
‘MainHandlerSupport’
Call context From
DescTask() Particularities and Limitations Call the API function
DescSessionTransitionChecked() to end the service processing
©2010, Vector Informatik GmbH
Version: 2.19.00
61 / 117

Technical Reference CANdesc
6.6.5.2 DescSessionTransitionChecked() DescSessionTransitionCheckedAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
DescSessionTransitionChecked (void)
Multi Context
void
DescSessionTransitionChecked (vuint8 iContext)
Parameter iContext
the current request context location
Return code -
-
Functional Description After the application has finished the processing in the hook function
ApplDescCheckSessionTransition() this function must be called.
Pre-conditions At least one DiagnosticSessionControl service must be configured to ‘OEM’ in attribute
‘MainHandlerSupport’
Call context Within or after a ‘
ApplDescCheckSessionTransition()’
function
Particularities and Limitations If this function will be called late, the CANdesc component sends automatically the
RCR-RP responses
©2010, Vector Informatik GmbH
Version: 2.19.00
62 / 117

Technical Reference CANdesc
6.6.5.3 DescIsSuppressPosResBitSet () DescIsSuppressPosResBitSetAvailable since 5.07.14Is Reentrant Is callback Prototype Single Context
DescBool
DescIsSuppressPosResBitSet (void)
Multi Context
DescBool
DescIsSuppressPosResBitSet (vuint8 iContext)
Parameter iContext
the current request context location
Return code The SPRMIB is set.
kDescTrue
The SPRMIB is NOT set.
kDescFalse
Functional Description This API can be always called while a diagnostic service processing is ongoing to get the
information about the SPRMIB state. All main-handlers do contain this information already
in the pMsgContext parameter so use it instead of this API.
In some other cases the application does not have access to the pMsgContext, and there
the API can be used.
Pre-conditions Only for UDS configurations.
May be called only while a diagnostic service processing is ongoing. Otherwise invalid
data can be reported.
Call context Any.
Particularities and Limitations
©2010, Vector Informatik GmbH
Version: 2.19.00
63 / 117

Technical Reference CANdesc
6.6.5.4 ApplDescOnTransitionSession() ApplDescOnTransitionSessionAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
ApplDescOnTransitionSession (DescStateGroup newState,
DescStateGroup formerState)
Multi Context
void
ApplDescOnTransitionSession (DescStateGroup newState,
DescStateGroup formerState)
Parameter newState
the CANdesc component has change to this session state
the CANdesc component has change from this session state
formerState
Return code -
-
Functional Description After the positive response of a SessionControl request the session will transit to the
requested session. This function informs the application that such a transition occurs.
Pre-conditions -
Call context From
DescTask() interrupts might be disabled
Particularities and Limitations Only informational function
©2010, Vector Informatik GmbH
Version: 2.19.00
64 / 117

Technical Reference CANdesc
6.6.5.5 DescSetStateSession() DescSetStateSessionAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
DescSetStateSession (DescStateGroup newSession)
Multi Context
void
DescSetStateSession (DescStateGroup newSession)
Parameter newSession
the CANdesc component will change to this session state
Return code -
-
Functional Description By this function the state of the SessionState-group can be changed by the ECU
application. The transition notification function ‘ApplDescOnTransitionSession’ will be
called to notify the application about the new session.
Pre-conditions -
Call context -
Particularities and Limitations Refer the section
6.6.10.2 "
DescSetState<StateGroup>()” for more details.
©2010, Vector Informatik GmbH
Version: 2.19.00
65 / 117

Technical Reference CANdesc
6.6.5.6 DescGetStateSession() DescGetStateSessionAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
currentSession
DescGetStateSession (void)
Multi Context
currentSession
DescGetStateSession (void)
Parameter -
Return code currentSession
Functional Description This function returns the current session state. Since the states are bit-coded the
evaluation expressions may be optimized for multiple use cases.
Example: Code execution only when either default or extended session is active.
lState = DescGetStateSession();
if ( (lState & (kDescStateSession<Default>) | kDescStateSession<Extended>)) != 0 )
{
/*execute code*/
}
Pre-conditions -
Call context -
Particularities and Limitations Refer the section
6.6.10.1 “DescGetState<StateGroup>()” for more details.
©2010, Vector Informatik GmbH
Version: 2.19.00
66 / 117

Technical Reference CANdesc
6.6.6 CommunicationControl Handling This API is provided, if the ECU supports the serviceCommunicationControl (UDS) or
service 0x28/0x29 Dis-/EnableNormalMessageTransmission (KWP).
6.6.6.1 ApplDescCheckCommCtrl() ApplDescCheckCommCtrlAvailable since 2.00.00Is callback Prototype Single Context
void
ApplDescCheckCommCtrl (DescOemCommControlInfo* commControlInfo)
Multi Context
void
ApplDescCheckCommCtrl (vuint8 iContext,
DescOemCommControlInfo* commControlInfo)
Parameter iContext
The current request context location
OEM dependent
commControlInfo
Return code -
-
Functional Description The execution of this service is completely done within the CANdesc component. This
hook function can be used to permit the application to reject the execution under some
circumstance. If the application wants to discard this request, an error must be set (via
DescSetNegResponse()).
The application always has to confirm this hook function (via
DescCommCtrlChecked()).
Pre-conditions The CommunicationControl service must be activated and the attribute
‘MainHandlerSupport’ has to be set to ‘OEM’
Call context From
DescTask() Particularities and Limitations If the API function
DescCommCtrlChecked() will be not called, the service processing
will not end
©2010, Vector Informatik GmbH
Version: 2.19.00
67 / 117

Technical Reference CANdesc
6.6.6.2 DescCommCtrlChecked() DescCommCtrlCheckedAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
DescCommCtrlChecked (void)
Multi Context
void
DescCommCtrlChecked (vuint8 iContext)
Parameter iContext
the current request context location
Return code -
-
Functional Description The CANdesc component calls a hook function to check for the execution permission of
the CommunicationControl service. Within or after this hook function
(
ApplDescCheckCommCtrl()) the application can set an error
(
DescSetNegResponse()) to reject the request. This function is used to terminate the
hook function
ApplDescCheckCommCtrl(). Pre-conditions The CommunicationControl service must be activated and the attribute
‘MainHandlerSupport’ has to be set to ‘OEM’
Call context Within or after
ApplDescCheckCommCtrl() Particularities and Limitations
©2010, Vector Informatik GmbH
Version: 2.19.00
68 / 117

Technical Reference CANdesc
6.6.7 Periodic call of ‘Service MainHandler’ 6.6.7.1 DescStartRepeatedServiceCall() DescStartRepeatedServiceCallAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
DescStartRepeatedServiceCall (DescMainHandler descMainHandler)
Multi Context
void
DescStartRepeatedServiceCall (vuint8 iContext, DescMainHandler descMainHandler)
Parameter descMainHandler
Reference to a function. The function prototype must be based
on a ‘Service MainHandler’.
The current request context location
iContext
Return code -
-
Functional Description The application can use this function to get a periodic call to the specified function (in the
parameter) from the CANdesc component.
It is possible to use the same ‘Service MainHandler’ function as it is called in.
Pre-conditions Call context Within or after a ‘Service MainHandler’ function
Particularities and Limitations CANdesc can do no validation, if this pointer is valid.
Is the parameter NULL, the periodic calls will get stopped.
The function is called in the same cycle time (context) as the DescTask()
©2010, Vector Informatik GmbH
Version: 2.19.00
69 / 117

Technical Reference CANdesc
6.6.7.2 DescStartMemByAddrRepeatedCall() DescStartMemByAddrRepeatedCallAvailable since 5.06.04Is Reentrant Is callback Prototype Single Context
void
DescStartMemByAddrRepeatedCall ()
Multi Context
void
DescStartMemByAddrRepeatedCall (vuint8 iContext)
Parameter iContext
The current request context location
Return code -
-
Functional Description The application can use this function to get a periodic call to the current Read/Write
memory by address handler.
Pre-conditions Call context Within ApplDescReadMemoryByAddress or ApplDescWriteMemoryByAddress.
Particularities and Limitations The memory access handler is called in the same cycle time (context) as the
DescTask()
©2010, Vector Informatik GmbH
Version: 2.19.00
70 / 117


Technical Reference CANdesc
6.6.8 Ring Buffer Mechanism The ring-buffer option can be used to save RAM when some responses are quite long and
reserving such space of RAM is impossible. In contrast to the linear responses, where the
response data will be first written and then the transmission to the tester will be initiated,
the ring-buffer concept starts a transmission as soon as it has either the whole data (for
short [single frame] responses) or at least enough data to fill a first-frame of a multi-frame
transmission. Once the ring buffer has been activated and the response transmission
initiated the application must supply enough data to keep the transmission away from lack
of data. Therefore the ring-buffer can not be used in diagnostic services which allow
multiple data to be combined in a single request (e.g. in CANdelaStudio the flag “
multiple
identifiers of different instances may be combined in one request” is set). Such services
are existing in both
KWP 14230 (OBD) and the
UDS 14229OBD, ReadDataByIdentifier
($22), ReadDataByPeriodicIdentifier ($2A)) standard.
Caution
On UDS: Always check the SPRMIB prior starting the ring-buffer. If this bit is set, the
ring-buffer may not be started. Instead the API
DescProcessingDone() must be
called. The response length can be set to zero since there will be no response on the
bus.
©2010, Vector Informatik GmbH
Version: 2.19.00
71 / 117

Technical Reference CANdesc
6.6.8.1 DescRingBufferStart() DescRingBufferStartAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
DescRingBufferStart (void)
Multi Context
void
DescRingBufferStart (vuint8 iContext)
Parameter iContext
reference to the corresponding request context
Return code -
-
Functional Description After completing the request validation the application can decide (in runtime), if the ring-
buffer mechanism should be used or not.
By calling this function, the decision is made to use the ring-buffer. Otherwise
DescProcessingDone() should be called, after filling the response data (in a linear way).
Either DescProcessingDone() or DescRingBufferStart() will finish the response handling.
Depending on the previous actions of the application the CANdesc module will either send
a response (positive/negative depending on the error state machine) or no response will
be send if the application/CANdesc decides that there must be no response (please refer
the Part III User Manual).
The transmission of the positive response will not start immediately. The application has
to fill the ring-buffer first. If the ring-buffer has enough data, the transmission will be
started (internally).
Pre-conditions - ring-buffer has been enabled in the configuration
Call context Within or after a ‘Service MainHandler’ function
Particularities and Limitations This API
must not be called from any of the other handler type (Pre- or PostHandlers)
Either DescProcessingDone() or DescRingBufferStart() must be used to finish the
response handling.
Total response length must be written before!
No response data must be written before!
This function
must not be called in interrupt context
Limitation: Until CANdesc version 2.13.00 it was not possible to use the Ring-Buffer in
‘Multiple PID’ services (as described in section
5.3.3 Multiple PID mode)
UDS limitation: Always check the SPRMIB prior starting the ring-buffer. If this bit is
set, the ring-buffer shall not be started. Instead DescProcessingDone() must be called
(see
7.6). ©2010, Vector Informatik GmbH
Version: 2.19.00
72 / 117

Technical Reference CANdesc
6.6.8.2 DescRingBufferWrite() DescRingBufferWriteAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
vuint8
DescRingBufferWrite (DescMsg data, DescMsgLen dataLength)
Multi Context
vuint8
DescRingBufferWrite (vuint8 iContext, DescMsg data, DescMsgLen dataLength)
Parameter iContext
Reference to the corresponding request context
Pointer to application data, which should be copied into ring-
DescMsg
buffer.
Amount of data, which should be copied (from pointer data) into
DescMsgLen
ring-buffer.
Return code kDescOk vuint8
If the copy process was successful
kDescFailed
if the data are
not copied into the ring-buffer
Functional Description The application writes data into the ring-buffer by this function. It is not necessary that the
application must write the data in the context of a special API function.
The write order is always linear! The first written byte is the first byte in the response
message.
Pre-conditions -
ring-buffer has been enabled in the configuration
-
DescRingBufferStart() must be called before to activate the ring-buffer mechanism
Call context - This API shall not interrupt the DescTask. Required for the case the currently ongoing
transmission is interrupted due to a communication error, and the application still writes
into the buffer.
Particularities and Limitations dataLength must be lower or equal to the ring-buffer size, else the function will
always fail
CANdesc has already filled the first bytes (SID, etc.) into the ring-buffer. So in the first
call of DescRingBufferWrite() the dataLength must lower as the buffer size + these
byte
©2010, Vector Informatik GmbH
Version: 2.19.00
73 / 117

Technical Reference CANdesc
6.6.8.3 DescRingBufferCancel() DescRingBufferCancelAvailable since 5.01.00Is Reentrant Is callback Prototype Single Context
void
DescRingBufferCancel (void)
Multi Context
void
DescRingBufferCancel (vuint8 iContext)
Parameter iContext
Reference to the corresponding request context
Return code -
-
Functional Description The application may call this API once the a data acquisition error has been occurred after
the ring-buffer has been
activated via DescRingBufferStart().
CANdesc will automatically determine the appropriate action depending on its current
internal state:
-
if the response data transmission has not been started yet, a negative
response will be sent back.
-
If the response transmission has been started – a transmission interrupt
will occur – the tester will not get a complete response.
Pre-conditions -
ring-buffer has been enabled in the configuration
-
DescRingBufferStart() must be called before to activate the ring-buffer mechanism
Call context -
Particularities and Limitations
©2010, Vector Informatik GmbH
Version: 2.19.00
74 / 117

Technical Reference CANdesc
6.6.8.4 DescRingBufferGetFreeSpace() DescRingBufferGetFreeSpaceAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
DescMsgLen
DescRingBufferGetFreeSpace (void)
Multi Context
DescMsgLen
DescRingBufferGetFreeSpace (vuint8 iContext)
Parameter iContext
reference to the corresponding request context
Return code The amount of free space/bytes in the ring-buffer.
DescMsgLen
Functional Description This function returns the amount of free space/bytes in the ring-buffer.
Pre-conditions -
ring-buffer has been enabled in the configuration
-
DescRingBufferStart() must be called before to activate the ring-buffer mechanism
Call context -
©2010, Vector Informatik GmbH
Version: 2.19.00
75 / 117

Technical Reference CANdesc
6.6.8.5 DescRingBufferGetProgress() DescRingBufferGetProgressAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
DescMsgLen
DescRingBufferGetProgress (void)
Multi Context
DescMsgLen
DescRingBufferGetProgress (vuint8 iContext)
Parameter iContext
reference to the corresponding request context
Return code Current byte position in the whole response.
DescRingBufferProgress
Functional Description This function returns the progress of the copy process.
Pre-conditions -
ring-buffer has been enabled in the configuration
-
DescRingBufferStart() must be called before to activate the ring-buffer mechanism
Call context -
Particularities and Limitations
©2010, Vector Informatik GmbH
Version: 2.19.00
76 / 117

Technical Reference CANdesc
6.6.9 Signal Interface of CANdesc CANdesc will provide a signal interface to the ECU application. This can help the ECU
application to assemble the response automatically. No further code changes are
necessary, if a signal will move or change its size.
The current implementation has only support for a synchronous signal interface. This
means the ECU application has to provide the signal value within the call/context of the
Signal Handler function (while reading) or to write thewithin the call/context of the Signal
Handler function (while writing).
6.6.9.1 ApplDesc<Signal-Handler>() ApplDesc<Signal-Handler>Available since 2.00.00Is callback Prototype Single Context
-
ApplDesc<Service-Qualifier + Data-Object-Qualifier + Instance-Qualifier> (-)
Multi Context
-
ApplDesc<Service-Qualifier + Data-Object-Qualifier + Instance-Qualifier> (-)
Parameter vuint8, vsint8,
Available for write services.
vuint16, vsint16,
Type depend on signal type
vuint32, vsint32,
DescMsg (vuint8*)
DescMsg (vuint8*)
Available for read services and signals > 32 bit (N bit)
Return code Available for read services.
vuint8, vsint8,
vuint16, vsint16,
Type depend on signal type.
vuint32, vsint32
Functional Description A Signal Handler is generated if the Service MainHandler is configured to be generated. In
this case, writing Signal Handlers are generated for all dataObjects transported with the
request and reading Signal Handlers are generated for all dataObjects transported with
the response (read/write from application point of view).
The data type of the Signal Handler argument depends on the dataObject which is to be
processed.
Pre-conditions Must be configured to ‘generated’ in attribute ‘MainHandlerSupport’
Call context From
DescTask() Particularities and Limitations You can override the given name extension (Service-Qualifier + Data-Object-Qualifier
+ Instance-Qualifier) by using the SignalHandlerOverrideName.
©2010, Vector Informatik GmbH
Version: 2.19.00
77 / 117

Technical Reference CANdesc
6.6.9.2 Configuration of direct signal access • Application variable for direct access (default = not set)
If this variable is specified, an access to the given external (= application) variable is
generated. Nothing has to be done by the application. The external variable must
be defined inside the application.
• SignalHandlerOverrideName (default = not set).
You can adapt the name of the Signal Handler setting this value. By using this
“Override Name” it is also possible to reuse an already existing Signal Handler
6.6.10 State Handling (CANdesc only) 6.6.10.1 DescGetState<StateGroup>() DescGetState<StateGroup>Available since 2.00.00Is Reentrant Is callback Prototype Single Context
DescStateGroup
DescGetState<StateGroup-Qualifier> (void)
Multi Context
DescStateGroup
DescGetState<StateGroup-Qualifier> (void)
Parameter -
-
Return code The current state of the state group
DescStateGroup
Functional Description This function returns the current session state. Since the states are bit-coded the
evaluation expressions may be optimized for multiple use cases.
Example: Code execution only when either the current state of this group is either state X
or state Y.
lState = DescGetState<
StateGroupQualifier >();
if ( (lState & (kDescState<
StateGroupQualifier ><StateQualifier_X>) |
kDescState<
StateGroupQualifier ><StateQualifier_Y>)) != 0 )
{
/*execute code*/
}
Pre-conditions -
Call context -
Particularities and Limitations For each state of a state-group a constant is defined in desc.h:
kDescState<StateGroup-Qualifier><StateQualifier> ©2010, Vector Informatik GmbH
Version: 2.19.00
78 / 117

Technical Reference CANdesc
6.6.10.2 DescSetState<StateGroup>() DescSetState<StateGroup>Available since 2.00.00Is Reentrant Is callback Prototype Single Context
void
DescSetState<StateGroup-Qualifier> (DescStateGroup newState)
Multi Context
void
DescSetState<StateGroup-Qualifier> (DescStateGroup newState)
Parameter DescStateGroup
the state in which the state group should be changed
Return code -
-
Functional Description By this function the state of the state-group can be changed by the ECU application. The transition
notification function ‘ApplDescOnTransition< StateGroupQualifier >’ will be called to notify the
application about the new state.
Example:
DescSetState<StateGroupQualifier>(kDescState<StateGroupQualifier><StateQualifier>);
This line will force CANdesc to change the state of the given state group to the new one.
Pre-conditions -
Call context -
Particularities and Limitations For each state of a state-group a constant will be defined in desc.h:
kDescState<StateGroup-Qualifier><State-Qualifier> The
ApplDescOnTransition<StateGroup-Qualifier>() notification function is called in any
case. Also if the newState is the same as the current stat
©2010, Vector Informatik GmbH
Version: 2.19.00
79 / 117

Technical Reference CANdesc
6.6.10.3 ApplDescOnTransition«StateGroup»() ApplDescOnTransition«StateGroup»Available since 2.00.00Is Reentrant Is callback Prototype Single Context
void
ApplDescOnTransition<StateGroup-Qualifier>(DescStateGroup newState,
DescStateGroup formerState)
Multi Context
void
ApplDescOnTransition<StateGroup-Qualifier> (DescStateGroup newState,
DescStateGroup formerState)
Parameter newState
the CANdesc component has changed to this session state
the CANdesc component has changed from this session state
formerState
Return code -
-
Functional Description This notification function will be called each time a transition has happened.
Pre-conditions -
Call context From
DescTask() interrupts might be disabled
Particularities and Limitations For each state of a state-group a constant will be defined in desc.h:
kDescState<StateGroup-Qualifier><StateName-Qualifier> For some exceptions (e.g. Session) the newState can be the same as the formerState.
©2010, Vector Informatik GmbH
Version: 2.19.00
80 / 117

Technical Reference CANdesc
6.6.11 Force “Response Correctly Received - Response Pending” transmission In some cases it is useful for the application to be sure that it has enough time to
accomplish a process without causing the tester to get response timeout. In such cases
the application can use the “force RCR-RP” mechanism of CANdesc, which prevents
timeout between the tester and the ECU application.
How it works: This feature is mostly applicable when a FlashBootLoader (FBL) is available for the ECU.
Before starting it, the application wants to assure that there is enough time to perform
reset and activate the FBL before the tester gets response timeout. The RCR-RP
mechanism notifies the tester that some action is ongoing and so resets the timeout timer
in the tester.
To transmit a ‘Response Correctly Received - Response Pending’ response the
application has to call the DescForceRcrRpResponse() function. To be sure this response
is transmitted, the application has to wait for the transmission confirmation of this forced
RCR-RP response (the function
ApplDescRcrRpConfirmation). Depending on its
transmission status parameter the application can decide how the processing shall
continue (a jump to FBL or to close the request processingth negative response).
©2010, Vector Informatik GmbH
Version: 2.19.00
81 / 117

Technical Reference CANdesc
6.6.11.1 DescForceRcrRpResponse() DescForceRcrRpResponseAvailable since 2.11.00Is Reentrant Is callback Prototype Single Context
void
DescForceRcrRpResponse(void)
Multi Context
void
DescForceRcrRpResponse(vuint8 iContext)
Parameter iContext
reference to the corresponding request context
Return code -
-
Functional Description Calling this function the application can force CANdesc to send immediately (not later than
the next call of DescTask() function) a RCR-RP response.
Pre-conditions CANdesc was configured to use this option (enabled in the GENtool).
Call context Task or interrupt.
Particularities and Limitations This function can be called:
after a call of a MainHandler function (e.g.
ApplDescCheckSessionTransition())
and until the call of
ApplDescResponsePendingOverrun() or
ApplDescResponsePendingOvertimed() or
pConfirmation(). ©2010, Vector Informatik GmbH
Version: 2.19.00
82 / 117

Technical Reference CANdesc
6.6.11.2 ApplDescRcrRpConfirmation() ApplDescRcrRpConfirmationAvailable since 2.11.00Is callback Prototype Single Context
void
ApplDescRcrRpConfirmation(vuint8 status)
Multi Context
void
ApplDescRcrRpConfirmation(vuint8 iContext, vuint8 status)
Parameter iContext
Reference to the corresponding request context
If the transmission was successful, the parameter value will be
status
kDescOk. Otherwise –
kDescFailed. Return code -
-
Functional Description Once the RCR-RP response has been forced, this function will be called in any case. The
transmission status is reported by the status parameter.
Pre-conditions CANdesc was configured to use this option (enabled in the GENtool).
Call context CAN Driver TX-ISR Æ TP Confirmation Æ this function
Particularities and Limitations Be aware of time consuming implementation for this function (interrupt call context).
©2010, Vector Informatik GmbH
Version: 2.19.00
83 / 117

Technical Reference CANdesc
6.6.12 DynamicallyDefineDataIdentifier ($2C) (UDS) functions Since this feature is only for some OEM available, please refer to the OEM specific documentation
to find out if is applicable for your configuration.
©2010, Vector Informatik GmbH
Version: 2.19.00
84 / 117

Technical Reference CANdesc
6.6.12.1 DescMayCallStateTaskAgain() DescMayCallStateTaskAgainAvailable since 4.00.00Is Reentrant Is callback Prototype Single Context
DescBool
DescMayCallStateTaskAgain (void)
Multi Context
DescBool
DescMayCallStateTaskAgain (void)
Parameter -
-
Return code TRUE if you may call again the state task within this application
kDescTrue
task cycle.
kDescFalse
FALSE if the DescStateTask() must not be called again.
Functional Description Motivation: The
DescStateTask() can be called as fast as possible but it still can not be
enough fast for complex service processing (e.g. DDIDs containing long descriptions) to
match fast timing-performance requirements. This function provides the info if the
application may call again the state-task in the same task context without causing endless
loop (important for non-preemptive OS environments).
Example of the API usage:
void ApplDiagTask(void) /* application function called as fast as possible */
{
do /* pump the state task as long as needed */
{
DescStateTask();
}
while(
DescMayCallStateTaskAgain() == kDescTrue);
}
Pre-conditions - Preprocessor define “
DESC_ENABLE_HIPERFORMANCE_DYNDID_MODE” is
available (using user-config file in GENtool).
- The application uses the split-task concept (i.e. calls
DescState-/TimerTask() instead of
DescTask()).
Call context Background-loop level or OSEK-OS Task. The Task should have a lower or equal priority
than all other interaction to the CANdesc component.
Particularities and Limitations
©2010, Vector Informatik GmbH
Version: 2.19.00
85 / 117

Technical Reference CANdesc
6.6.12.2 ApplDescCheckDynDidMemoryArea() ApplDescCheckDynDidMemoryArea Available since 3.02.00Must be Reentrant Is callback Prototype Any Context
DescDynDidMemCheckResult
ApplDescCheckDynDidMemoryArea (
DescDynDidMemBlockAddress srcAddr,
DescDynDidMemBlockSize len );
Parameter srcAddr
Start address (Service $2C 02 request parameter ‘memoryAddress’).
Length of block to read (Service $2C 02 request parameter
len
‘memorySize’).
Return code
memBlockOk
Permit the access to requested memory block and extend the DDID.
memBlockInvAddress
Forbid the access due invalid requested memory address
(requestOutOfRange).
memBlockInvSize
Forbid the access due invalid requested block length
(requestOutOfRange).
memBlockInvSecurity
Forbid the access due current security mode settings prohibit the DDID
definition (securityAccessDenied).
memBlockInvCondition Forbid the access due other restrictions (conditionsNotCorrect).
If the memory access if forbidden, the Service $2C Request is negative responded with NRC 22
(conditionsNotCorrect), 31 (requestOutOfRange) or 33 (securityAccessDenied).
Functional Description This callback function is triggered when defining a DDID that shall read bytes from the ECU’s
memory (Service Request $2C 02). The application can permit the (re-)definition of the DDID or
forbid it.
The service request is responded according to this.
The application must check
• if the given srcAddr and following len bytes are valid ECU addresses and if they are
readable,
• if the current security state allows to define the DDID right now,
• if there are other conditions that may forbid the definition of the DDID.
If all checks allow the DDID definition, the callback function must return memBlockOk.
FYI: When later reading the defined DDIDs by service $22, the standard checks [of Service $23
ReadMemoryByAddress] are executed, that perform security checks before accessing the
memory.
So, above security check with service $2C shall prove that the current security state permits the
definition of the DDID, the security check in service $22 (resp. $23) proves [in the context of the
then existing security state] the actual
reading of the memory range.
Pre-conditions ©2010, Vector Informatik GmbH
Version: 2.19.00
86 / 117


Technical Reference CANdesc
-
Call context From
DescTask() Particularities and Limitations •
6.6.12.3 Non-volatile memory support For some car-manufactures CANdesc provides NVRAM support for the dynamically
defined DID definitions. There are some APIs that must be operated and some call-backs
to be implemented by the application in order to get the NVRAM support fully operational.
The following diagrams show the two oeprations on NVRAM – restore (at power on) and st
ore (usuall prior power off) data.
Restore data at ECU power on Caution
At each CANdesc initialization (e.g. ECU reset/ power on) the “restore” procedure must
be performed!
©2010, Vector Informatik GmbH
Version: 2.19.00
87 / 117

Technical Reference CANdesc
sd NVram_RestoreT ester
CANdesc
Application
Reset/ PowerOn/()
DescInitPowerOn()
[E2PROM manager ready]:DescDynDefineDidPowerUp()
ApplDescRestoreDynIdMemContent(targetPtr, Size)
alt Synchronous acknow ledge[E2PROM data available immediately]
DescDynIdMemContentRestored(Size, CheckSum)
alt Asynchronous acknow ledge[E2PROM data need more time to be retrieved]
RQ: 0x2C(any )
RS: 0x7F(0x 22)
DescDynIdMemContentRestored(Size, CheckSum)
RQ:0x2C(any )
RS: 0x7F/0x6C(any )
Response type
depends on the
request data
validity.
Figure 6-1 DynDID definition restore and tester interaction
©2010, Vector Informatik GmbH
Version: 2.19.00
88 / 117


Technical Reference CANdesc
Store data at ECU power down Info The store operation can be performed at any time not only at power down.
sd NVram_StoreCANdesc
Application
On Syst em
Shutdown()
DescDynDefineDidPowerDown()
ApplDescStoreDynIdMemContent(targetPtr, Size, Checksum)
<shut down>()
Store the Data()
Perform Shutdown()
Figure 6-2 Store DynDID definitions
©2010, Vector Informatik GmbH
Version: 2.19.00
89 / 117

Technical Reference CANdesc
6.6.12.3.1 DescDynDefineDidPowerUp() DescDynDefineDidPowerUpAvailable since 5.06.09Is Reentrant Is callback Prototype Single Context
void
DescDynDefineDidPowerUp (void)
Multi Context
void
DescDynDefineDidPowerUp (void)
Parameter -
-
Return code -
-
Functional Description Once the ECU has been powered one/reset or just need to be reinitialized, this API must
be called to restore the dynamically defined DID content.
Usually called after the NVRAM manager is initialized.
Pre-conditions - Service 0x2C needs to store the DynDID definitions to the NVRAM (OEM specific
requirement)
Call context - any
Particularities and Limitations Must be called after DescInitPowerOn().
©2010, Vector Informatik GmbH
Version: 2.19.00
90 / 117

Technical Reference CANdesc
6.6.12.3.2 DescDynIdMemContentRestored () DescDynIdMemContentRestoredAvailable since 5.06.09Is Reentrant Is callback Prototype Single Context
void
DescDynIdMemContentRestored (DescDynDidStorageInfo storageInfo)
Multi Context
void
DescDynIdMemContentRestored (DescDynDidStorageInfo storageInfo)
Parameter storageInfo.nvData
Not used
The size (in bytes) of the restored table.
storageInfo.nvDataSize
The stored checksum, calculated by CANdesc at store time.
storageInfo.checkSum
Return code -
-
Functional Description After CANdesc has requested the application to restore the DynDID data
(“ApplDescRestoreDynIdMemContent ()”), this API must be called to notify CANdesc that
the DynDID content has been restored and can be used.
Pre-conditions - Service 0x2C needs to store the DynDID definitions to the NVRAM (OEM specific
requirement)
Call context - any
Particularities and Limitations none
©2010, Vector Informatik GmbH
Version: 2.19.00
91 / 117

Technical Reference CANdesc
6.6.12.3.3 DescDynDefineDidPowerDown () DescDynDefineDidPowerDownAvailable since 5.06.09Is Reentrant Is callback Prototype Single Context
void
DescDynDefineDidPowerDown (void)
Multi Context
void
DescDynDefineDidPowerDown (void)
Parameter -
-
Return code -
-
Functional Description If the ECU has to be reset or just power off /shutdown, this API must be called to store the
current DID definitions.
In order to save E2PROM write cycles, the application may perform compare to the
current E2PROM content and decide whether to store the table content or not.
Pre-conditions - Service 0x2C needs to store the DynDID definitions to the NVRAM (OEM specific
requirement)
Call context - any
Particularities and Limitations Shall be called prior power-down/shutdown execution
May be called any time to store the current content of the DynDID tables.
©2010, Vector Informatik GmbH
Version: 2.19.00
92 / 117

Technical Reference CANdesc
6.6.12.3.4 ApplDescStoreDynIdMemContent () ApplDescStoreDynIdMemContentAvailable since 5.06.09Is Reentrant Is callback Prototype Single Context
void
ApplDescStoreDynIdMemContent (DescDynDidStorageInfo storageInfo)
Multi Context
void
ApplDescStoreDynIdMemContent (DescDynDidStorageInfo storageInfo)
Parameter storageInfo.nvData
The pointer to the data to be stored;
The size (in bytes) of the table;
storageInfo.nvDataSize
The checksum value, calculated by CANdesc, to be stored.
storageInfo.checkSum
Return code -
-
Functional Description Once this API is called by CANdesc, the application must trigger a write E2PROM
procedure to store the data given by CANdesc and the checksum value.
In order to save E2PROM write cycles, the application may perform compare to the
current E2PROM content and decide whether to store the table content or not.
Pre-conditions - Service 0x2C needs to store the DynDID definitions to the NVRAM (OEM specific
requirement)
Call context - any
Particularities and Limitations CANdesc does not keep the data pointed by the parameter pointer during the write
operation! The application must mirror the data if needed!
©2010, Vector Informatik GmbH
Version: 2.19.00
93 / 117

Technical Reference CANdesc
6.6.12.3.5 ApplDescRestoreDynIdMemContent () ApplDescRestoreDynIdMemContentAvailable since 5.06.09Is Reentrant Is callback Prototype Single Context
void
ApplDescRestoreDynIdMemContent (DescDynDidStorageInfo storageInfo)
Multi Context
void
ApplDescRestoreDynIdMemContent (DescDynDidStorageInfo storageInfo)
Parameter storageInfo.nvData
The pointer to the data to where the stored data shall be written
The size (in bytes) of the table expected.
storageInfo.nvDataSize
Not used
storageInfo.checkSum
Return code -
-
Functional Description Once this API is called by CANdesc, the application must trigger a read E2PROM
procedure to restore the data for CANdesc and the checksum value.
Once the read process has complet
ed, the API “DescDynIdMemContentRestored ()” must
be called to acknowledge the operation status to CANdesc.
Pre-conditions - Service 0x2C needs to store the DynDID definitions to the NVRAM (OEM specific
requirement)
Call context - any
Particularities and Limitations
©2010, Vector Informatik GmbH
Version: 2.19.00
94 / 117

Technical Reference CANdesc
6.6.13 Memory Access Callbacks 6.6.13.1 ApplDescReadMemoryByAddress() ApplDescReadMemoryByAddressAvailable since 5.06.04Is Reentrant Is callback Prototype Any Context
void
ApplDescReadMemoryByAddress (DescMsgContext* pMsgContext,
t_descMemByAddrInfo* pMemInfo)
Parameter pMsgContext
Refer the section
6.6.3.2 Service MainHandler for details
about this parameter.
The response buffer pointer
pMsgContext->resData
The actual response length
pMsgContext->resDataLen
The address to read from
pMemInfo->address
The number of bytes to read
pMemInfo->length
Return code -
-
Functional Description This callback is called for read memory by address requests. The application has to do
following:
•
Perform memory block validation (negative response can be set by calling
DescSetNegResponse()).
•
Optional: Perform additional state validations (negative response can be set by
calling DescSetNegResponse()).
•
Copy the requested memory contents into the response buffer.
•
Set the response data length to the number of bytes copied.
•
Confirm that the processing is finished (by calling
DescProcessingDone()). Pre-conditions The read memory by address service is supported.
Refer to chapter 5.5Read/Write Memory by Address (SID $23/$3D) (UDS) for more
details of the availability of this API. If you don’t see this API provided in desc.h, then
this feature is not supported for your project.
Call context From
DescTask() Particularities and Limitations To call this handler periodically, ‘DescStartMemByAddrRepeatedCall’ needs to be used
©2010, Vector Informatik GmbH
Version: 2.19.00
95 / 117

Technical Reference CANdesc
6.6.13.2 ApplDescWriteMemoryByAddress() ApplDescWriteMemoryByAddressAvailable since 5.06.04Is Reentrant Is callback Prototype Any Context
void
ApplDescWriteMemoryByAddress (DescMsgContext* pMsgContext,
t_descMemByAddrInfo* pMemInfo)
Parameter pMsgContext
Refer the section
6.6.3.2 Service MainHandler for details
about this parameter.
The pointer to the data to store
pMsgContext->reqData
The address to write to
pMemInfo->address
The number of bytes to write
pMemInfo->length
Return code -
-
Functional Description This callback is called for write memory by address requests. The application has to do
following:
•
Perform memory block validation (negative response can be set by calling
DescSetNegResponse()).
•
Optional: Perform additional state validations (negative response can be set by
calling DescSetNegResponse()).
•
Copy the provided data into the memory area.
•
Confirm that the processing is finished (by calling
DescProcessingDone()). Pre-conditions The write memory by address service is supported.
Refer to chapter 5.5Read/Write Memory by Address (SID $23/$3D) (UDS) for more
details of the availability of this API. If you don’t see this API provided in desc.h, then
this feature is not supported for your project.
Call context From
DescTask() Particularities and Limitations To call this handler periodically, ‘DescStartMemByAddrRepeatedCall’ needs to be used
6.6.14 Flash Boot Loader Support CANdesc provides some features to comply with the HIS flash boot loader procedures.
These features are not released for all OEMs so if the below listed APIs are not available
in your CANdesc version, then for the OEM, you currently use CANdesc, does not require,
resp. has another FBL procedures.
©2010, Vector Informatik GmbH
Version: 2.19.00
96 / 117

Technical Reference CANdesc
6.6.14.1 DescSendPosRespFBL() DescSendPosRespFBLAvailable since 4.05.00Is Reentrant Is callback Prototype Any Context
void
DescSendPosRespFBL (t_descFblPosRespType posRespSId)
Parameter posRespSId
One of the following values are allowed:
kDescSendFblPosRespEcuHardReset
kDescSendFblPosRespDscDefault.
Return code -
-
Functional Description The application shall call this function as soon as possible after the initialization of the
CANdesc component is done and the ECU is able to communicate.
Once this function called, CANdesc will try to send the corresponding positive response
as follows:
kDescSendFblPosRespEcuHardReset – a positive response to EcuHardReset ($51
$01) will be sent.
kDescSendFblPosRespDscDefault – a positive response to DiagnosticSessionControl
Default session ($50 $01 $P2time $P2Star/10) will be sent.
If CANdesc is currently busy with a new tester request, there will be no response sent by
this API.
Pre-conditions The FBL positive response feature is supported.
Call context Any.
Particularities and Limitations
See 7.8 ©2010, Vector Informatik GmbH
Version: 2.19.00
97 / 117

Technical Reference CANdesc
6.6.14.2 ApplDescInitPosResFblBusInfo() ApplDescInitPosResFblBusInfoAvailable since 5.07.04Is Reentrant Is callback Prototype Any Context
vuint8
ApplDescInitPosResFblBusInfo (t_descUsdtNetBus* pBusInfo)
Parameter pBusInfo
Reference to the bus information structure that will be
initialized here.
The bus driver that will send the response
pBusInfo->busType
The communication channel on which the response will be
pBusInfo->comChannel
sent. (relevant only on multi channel systems)
The tester address which will be respond to. (relevant only on
pBusInfo->testerId
bus systems with source/target addresses)
Return code Operation was successful, the FBL positive response will be
kDescOk
sent.
Operation failed – no FBL positive response will be sent.
kDescFailed
Functional Description This callback is called once the application decided to call th
e API DescSendPosRespFBL
to get the concrete addressing information.
The application shall initialize only the parameter described above. The optional ones can
be skipped if not relevant on your system.
Pre-conditions The FBL positive response feature is supported.
Call context From DescSendPosRespFBL context.
Particularities and Limitations -
©2010, Vector Informatik GmbH
Version: 2.19.00
98 / 117

Technical Reference CANdesc
6.6.15 Debug Interface / Assertion 6.6.15.1 ApplDescFatalError() ApplDescFatalErrorAvailable since 2.00.00Is Reentrant Is callback Prototype Single Context
void
ApplDescFatalError (vuint8 errorCode, vuint16 lineNumber)
Multi Context
void
ApplDescFatalError (vuint8 errorCode, vuint16 lineNumber)
Parameter errorCode
The errorCode is a classification of the assertion. The
errorCodes can be also found in file ‘desc.h’. The errorCodes
are listed below:
A line number of file ‘desc.c’ from which this function is called.
lineNumber
Return code -
-
Functional Description The CANdesc debug interface is similar to assertion constructof common programming
languages. Assertions are code checks which are written so that they should always
evaluate to true. If an assertion is false, it indicates a possible bug in the program, corrupt
system state or a misoperation of the user-interface.
CANdesc is calling the function ApplDescFatalError() function to indicate a evaluation of
an assertion to false. If this will happen it is recommended to halt the program's execution
immediately. This could be reach by an endless loop in that call-back.
The assertions can be disabled in the GenTool settings. The resource (ROM and runtime)
consumption can be reduced by disabling the assertions.
Error codes kDescAssertWrongTpTxChannel (0x00):
The wrong TP channel is used – verify the TP interface to the CANdesc component
kDescAssertIndexTableInvalidReference (0x02):
Internal generation failure.
kDescAssertSvcTableUnreachableItem (0x03):
Internal generation failure.
kDescAssertSvcTableInvalidReference (0x04):
Internal generation failure.
©2010, Vector Informatik GmbH
Version: 2.19.00
99 / 117

Technical Reference CANdesc
kDescAssertSvcTableInconsistentNumber (0x05):
Internal generation failure.
kDescAssertMissingMainHandler (0x06):
Internal generation failure.
kDescAssertInvalidContextId (0x08):
Wrong iContext should be used - Check the consistency of the iContext parameter in the
application.
kDescAssertSvcTableIndexOutOfRange (0x09):
Internal generation failure.
kDescAssertSvcInstTableIndexOutOfRange (0x0A):
Internal generation failure.
kDescAssertContextIdWasModified (0x0B):
The iContext member of the pMsgContext parameter in the MainHandler functions are
illegal modified – verify the MainHandler functions in the application
kDescAssertProcessingDoneCallAfterResFlushing (0x0E):
DescProcessingDone() is called at least twice for one request – check the call of
DescProcessingDone() in the application.
kDescAssertTooLongSingleFrameResponse (0x0F):
Response lengthof a periodic DID is exceeding the SingleFrame length – check the
response length for periodic DIDs.
kDescAssertApplLackOfConfirmation (0x11):
The time for response processing is too long – verify if the call of DescProcessingDone()
is done in any case.
kDescAssertZeroStateValue (0x13):
The state parameter is zero – check state handling
kDescAssertInvalidContextMode (0x16):
Internal runtime error
kDescAssertUnexpectedWriteIntoRingBuffer (0x17):
DescRingBufferWrite() is called without activated ring-buffer
©2010, Vector Informatik GmbH
Version: 2.19.00
100 / 117

Technical Reference CANdesc
kDescAssertRingBufferWriteExceedsTheResLen (0x18):
DescRingBufferWrite() is called to often
kDescAssertIllegalUsageOfNegativeResponse (0x1A):
After call of DescProcessingDone() a negative response is set
kDescAssertDiagnosticBufferOverflow (0x1B):
currently not available
kDescAssertFuncReqWoResMayNotUseRingBuffer (0x1C):
It is not possible to use the ring-buffer feature for functional request (KWP only)
kDescAssertSchedulerTimerEventWithoutAnyPID (0x1E):
Internal runtime error
kDescAssertSchedulerRingBufferIsActivated (0x1F):
For periodic DIDs it is not possible to use the ring-buffer.
kDescAssertUnknownTpTransmissionType (0x21):
Internal runtime error
kDescAssertIllegalAddRequestCount (0x22):
Internal runtime error
kDescAssertNoSidCanBeReportedInIdleMode (0x23):
Call of DescGetSeriveId() while not a user-service is processed
kDescAssertInvalidUsageOfForceRcrRpApi (0x24):
The DescForceRcrRpResponse() function is used illegal.
kDescAssertPidResLenToCddDefNotMatched (0x26):
The response length set by the application do not fit to the response length defined in
CANdela (cdd).
kDescAssertPidResLenToCurrLinearFreeSpace (0x27):
Internal runtime error
kDescAssertMissingDataForTransmission (0x28):
Internal runtime error
©2010, Vector Informatik GmbH
Version: 2.19.00
101 / 117

Technical Reference CANdesc
kDescAssertSchedulerFreeCellNotFound (0x29):
Internal runtime error
kDescAssertInvalidStateParameterValue (0x2A):
The state parameter value is wrong – check state handling in your application
kDescAssertNoFreeICNChannel (0x2B):
Internal runtime error
kDescAssertInvalidDescICNClient (0x2C):
Internal runtime error
kDescAssertNoFreeMsgContext (0x2D):
Internal runtime error
kDescAssertUnExpectedContextWithResponse (0x2E):
A response will be sent out of a wrong context.
kDescAssertIllegalCallOfRingBufferCancel (0x2F):
The API DescRingBufferCancel() has been called for a response that is not using the ring-
buffer concept (e.g.
DescRingBufferStart() was not called).
kDescNetAssertWrongIsoTpRxChannel (0x40):
The wrong TP channel is used – verify the TP interface to the CANdesc component
kDescNetAssertWrongIsoTpTxChannel (0x41):
The wrong TP channel is used – verify the TP interface to the CANdesc component
kDescNetAssertWrongBusType (0x42):
The wrong bus type is used – verify the TP interface to the CANdesc component
kDescAssertDescIcnIllegalTargetPointer (0x50):
Internal runtime assertion
Pre-conditions At least on type of assertions are activated
Call context Form ISR or task level. The interrupts might be disabled
Particularities and Limitations After a call of this function the system is not stable anymore. It can not be guaranteed
that this component or the whole system is still working in correct manner.
©2010, Vector Informatik GmbH
Version: 2.19.00
102 / 117

Technical Reference CANdesc
©2010, Vector Informatik GmbH
Version: 2.19.00
103 / 117

Technical Reference CANdesc
7 How To… 7.1 …implement a protocol service MainHandler //1. Read ProtocolService
// - dynamic length
// - PIDs
void DESC_API_CALLBACK_TYPE
ApplDescManiOnTimerEvent_storeEvent(DescMsgContext
* pMsgContext)
{
/* Check the length */ if(pMsgContext
->reqDataLen
> 2)
{
/* Check the sub-parameters */ vuint16 param;
/* Compose one parameter combining the HiByte and the LoByte in this order*/ param
= DescMake16Bit(pMsgContext
->reqData[0], pMsgContext
->reqData[1]);
/* Dispatch the parameter */ switch(param)
{
case 0xFFFF
: if(pMsgContext
->reqDataLen
!= 0xFFFF)
{
/* Write some data (skip the parameter offsets 0 und 1) */ pMsgContext
->resData[2]
= DescGetLoByte(0x1234);
pMsgContext
->resData[3]
= DescGetHiByte(0x1234);
/* Set the response length */ pMsgContext
->resDataLen
= 4;
}
else {
DescSetNegResponse(pMsgContext
->iContext, kDescNrcInvalidFormat);
}
break;
default: /* unknown parameter */ DescSetNegResponse(pMsgContext
->iContext, kDescNrcInvalidFormat);
}
}
else {
DescSetNegResponse(pMsgContext
-iContext, kDescNrcInvalidFormat);
}
/* In this case we did everything in the main-handler */ DescProcessingDone(pMsgContext
->iContext);
}
//2. Read ProtocolService
// - dynamic length
// - sub-function
void DESC_API_CALLBACK_TYPE
ApplDescManiOnTimerEvent_storeEvent(DescMsgContext
* ©2010, Vector Informatik GmbH
Version: 2.19.00
104 / 117

Technical Reference CANdesc
pMsgContext)
{
/* Check the length */ if(pMsgContext
->reqDataLen
> 1)
{
/* Dispatch the sub-function */ switch(pMsgContext
->reqData[0])
{
case 0xFF
: if(pMsgContext
->reqDataLen
!= 0xFFFF)
{
/* Format check ok: write some data (skip the parameter) */ pMsgContext
->resData[1]
= DescGetLoByte(0x1234);
pMsgContext
->resData[2]
= DescGetHiByte(0x1234);
/* Set the response length */ /* Hint: if the response length wasn't set, zero value is assumed! */ pMsgContext
->resDataLen
= 3;
}
else {
/* Wrong sub-parameter format */ DescSetNegResponse(pMsgContext
->iContext, kDescNrcInvalidFormat);
}
break;
default: /* Unknown sub-function */ DescSetNegResponse(pMsgContext
->iContext,
kDescNrcSubfunctionNotSupported);
}
}
else {
DescSetNegResponse(pMsgContext
-iContext, kDescNrcInvalidFormat);
}
/* In this case we did everything in the main-handler */ DescProcessingDone(pMsgContext
->iContext);
}
//3. Write ProtocolService
// - dynamic length
// - PIDs
void DESC_API_CALLBACK_TYPE
ApplDescManiOnTimerEvent_storeEvent(DescMsgContext
* pMsgContext)
{
/* Check the sub-parameters */ vuint16 param;
/* Check the length */ if(pMsgContext
->reqDataLen
> 2)
{
/* Compose one parameter combining the HiByte and the LoByte in this order
*/ param
= DescMake16Bit(pMsgContext
->reqData[0], pMsgContext
->reqData[1]);
/* Dispatch the parameter */ switch(param)
{
case 0xFFFF
: if(pMsgContext
->reqDataLen
!= 0xFFFF)
©2010, Vector Informatik GmbH
Version: 2.19.00
105 / 117

Technical Reference CANdesc
{
/* Copy from the request data to your application */ /* Use the data pointed by: pMsgContext->reqData[2],
pMsgContext->reqData[3], etc.*/ }
else {
DescSetNegResponse(pMsgContext
->iContext, kDescNrcInvalidFormat);
}
break;
default: /* unknown parameter */ DescSetNegResponse(pMsgContext
->iContext, kDescNrcRequestOutOfRange);
}
}
else {
DescSetNegResponse(pMsgContext
-iContext, kDescNrcInvalidFormat);
}
/* In this case we did everything in the main-handler */ /* Hint: if the response length wasn't set, zero value is assumed! */ DescProcessingDone(pMsgContext
->iContext);
}
//4. Write ProtocolService
// - dynamic length
// - Sub-function
void DESC_API_CALLBACK_TYPE
ApplDescManiOnTimerEvent_storeEvent(DescMsgContext
* pMsgContext)
{
/* Check the sub-parameters */ vuint16 param;
/* Check the length */ if(pMsgContext
->reqDataLen
> 2)
{
/* Compose one parameter combining the HiByte and the LoByte in this order*/ param
= DescMake16Bit(pMsgContext
->reqData[0], pMsgContext
->reqData[1]);
/* Dispatch the parameter */ switch(param)
{
case 0xFFFF
: if(pMsgContext
->reqDataLen
!= 0xFFFF)
{
/* Copy from the request data to your application */ /* Use the data pointed by: pMsgContext->reqData[2],
pMsgContext->reqData[3], etc.*/ }
else {
DescSetNegResponse(pMsgContext
->iContext, kDescNrcInvalidFormat);
}
break;
default: /* unknown sub-function /
DescSetNegResponse(pMsgContext->iContext,
kDescNrcSubfunctionNotSupported);
}
©2010, Vector Informatik GmbH
Version: 2.19.00
106 / 117

Technical Reference CANdesc
}
else {
DescSetNegResponse(pMsgContext
-iContext, kDescNrcInvalidFormat);
}
/* In this case we did everything in the main-handler */ /* Hint: if the response length wasn't set, zero value is assumed! */ DescProcessingDone(pMsgContext
->iContext);
}
7.2 …implement a service MainHandler //5. Read Service
// - dynamic length
// - sub-function/PID
void DESC_API_CALLBACK_TYPE
ApplDescManiOnTimerEvent_storeEvent(DescMsgContext
* pMsgContext)
{
/* Check the length */ if(pMsgContext
->reqDataLen
!= 0xFFFF)
{
/* Format check ok: write some data */ pMsgContext
->resData[0]
= DescGetLoByte(0x1234);
pMsgContext
->resData[1]
= DescGetHiByte(0x1234);
/* Set the response length */ /* Hint: if the response length wasn't set, zero value is assumed! */ pMsgContext
->resDataLen
= 2;
}
else {
/* Wrong sub-function format */ DescSetNegResponse(pMsgContext
->iContext, kDescNrcInvalidFormat);
}
/* In this case we did everything in the main-handler */ DescProcessingDone(pMsgContext
->iContext);
}
//6. Read Service
// - static length
// - sub-function/PID
void DESC_API_CALLBACK_TYPE
ApplDescManiOnTimerEvent_storeEvent(DescMsgContext
* pMsgContext)
{
/* Format check ok: write some data */ pMsgContext
->resData[0]
= DescGetLoByte(0x1234);
pMsgContext
->resData[1]
= DescGetHiByte(0x1234);
/* Set the response length */ /* Hint: if the response length wasn't set, zero value is assumed! */ pMsgContext
->resDataLen
= 2;
/* In this case we did everything in the main-handler */ DescProcessingDone(pMsgContext
->iContext);
}
©2010, Vector Informatik GmbH
Version: 2.19.00
107 / 117

Technical Reference CANdesc
//7. Write Service
// - dynamic length
// - sub-function/PID
void DESC_API_CALLBACK_TYPE
ApplDescManiOnTimerEvent_storeEvent(DescMsgContext
* pMsgContext)
{
/* Check the length */ if(pMsgContext
->reqDataLen
!= 0xFFFF)
{
/* Format check ok: write some data */ /* Copy from the request data to your application */ /* Use the data pointed by: pMsgContext->reqData[0],
pMsgContext->reqData[1], etc.*/ }
else {
/* Wrong sub-function format */ DescSetNegResponse(pMsgContext
->iContext, kDescNrcInvalidFormat);
}
/* In this case we did everything in the main-handler */ /* Hint: if the response length wasn't set, zero value is assumed! */ DescProcessingDone(pMsgContext
->iContext);
}
//8. Write Service
// - static length
// - sub-function/PID
void DESC_API_CALLBACK_TYPE
ApplDescManiOnTimerEvent_storeEvent(DescMsgContext
* pMsgContext)
{
/* Copy from the request data to your application */ /* Use the data pointed by: pMsgContext->reqData[0], pMsgContext->reqData[1],
etc.*/ /* In this case we did everything in the main-handler */ /* Hint: if the response length wasn't set, zero value is assumed! */ DescProcessingDone(pMsgContext
->iContext);
}
7.3 …implement a Signal Handler //1. ReadSignalHandler
// - length <= 4Byte
// Limitations: No DescProcessingDone() or DescSetNegResponse() allowed.
vuintx DESC_API_CALLBACK_TYPE
ApplDescGetTemp(
void)
{
/* Return directly the signal value */ return (vuintx)0xFFFF;
}
//2. ReadSignalHandler ©2010, Vector Informatik GmbH
Version: 2.19.00
108 / 117

Technical Reference CANdesc
// - length > 4Byte
// Limitations: No DescProcessingDone() or DescSetNegResponse() allowed.
DescMsgLen DESC_API_CALLBACK_TYPE
ApplDescGetTemp(DescMsg tgt)
{
/* Copy the signal data into the buffer pointed by "tgt".*/ /* Return the amount of written bytes */ return 0;
}
//3. WriteSignalHandler
// - length <= 4Byte
// Limitations: No DescProcessingDone() or DescSetNegResponse() allowed.
void DESC_API_CALLBACK_TYPE
ApplDescGetTemp(vuintx data)
{
/* "data" contains the signal value as-is from the request.
Copy it into your application. */ }
//4. ReadSignalHandler
// - length > 4Byte
// Limitations: No DescProcessingDone() or DescSetNegResponse() allowed.
DescMsgLen DESC_API_CALLBACK_TYPE
ApplDescGetTemp(DescMsg src)
{
/* Copy the signal data from the buffer pointed by "src".*/ /* Return the amount of copied bytes */ return 0;
}
7.4 …implement a Packet Handler //1. ReadPacketHandler
// Limitations: No DescProcessingDone() or DescSetNegResponse() allowed.
void DESC_API_CALLBACK_TYPE
ApplDescGetTemp(DescMsg pMsg)
{
/* Copy the signal value into the "pMsg" buffer. */ pMsg[0]
= DescGetLoByte(0x1234);
pMsg[1]
= DescGetLoByte(0x1234);
}
7.5 …implement a state transition function //1. StateTransitionNotification
// Limitations: No DescProcessingDone() or DescSetNegResponse() allowed.
void DESC_API_CALLBACK_TYPE
ApplDescOnTransitionSession(DescStateGroup
formerState, DescStateGroup newState)
{
/* You are just notified that this state group has performed a transition from
* "formerState" to the "newState". */ ©2010, Vector Informatik GmbH
Version: 2.19.00
109 / 117

Technical Reference CANdesc
}
7.6 …work with the ring-buffer mechanism 7.6.1 with asynchronous write TPMC
Des c
Appl_MainHandler
Appl_MainHandler_2
EEPROM
Appl_PostHandler
Driver
call
Analyze and validate request
It is not possible to write data as in
W rite response length
the standard way if a ring-buffer will
be used (standard way is, to write to
DescMsgContext->ResData)
DescRingBufferStart()
DescRingBufferW rite(* dataPtr, dataLength)
Now - it is po ssib el to
Enough data are
writ e data to the ring-buffer
stored in the
ring-buffer to start
the transmission
DescRingBufferW rite(* dataPtr, dataLength)
DescRingBufferW rite(* dataPtr, dataLength)
StartTransmission
Not enough free
bytes to write
new data
TP reads
asynchronous the
DescRingBufferGetFreeSpace
data out of the
ring-buffer
return countOfFreeBytesInRingBuffer
TpCopyToCan
DescRingBufferGetFreeSpace
ret urn coun tOfFreeBytesInRingBuffer
DescRingBufferW rite(* dataPtr, dataLength)
TpCopyToCan
DescRingBufferGetProgress
return currentBytePosition
FinishTransmission
Call of Service Post Handler
©2010, Vector Informatik GmbH
Version: 2.19.00
110 / 117

Technical Reference CANdesc
//1. Read Service (with asynchronous Ring-Buffer)
// - static length
// - sub-function/PID
vuint8 g_iContext;
void DESC_API_CALLBACK_TYPE
ApplDescReadDTC(DescMsgContext
* pMsgContext)
{
vuint8 lData;
/* Format check already done by CANdesc */ /* Analysis of request has to done by ECU application */ /* Set the response length */ pMsgContext
->resDataLen
= 16;
/* Fill the first data */ lData
= 5;
/* Store iContext for further interaction with CANdesc */ g_iContext
= pMsgContext
->iContext;
/* check only on services with sub-function (e.g. 0x19) */ if(pMsgContext
->msgAddInfo.suppPosRes != 0)
{
/* since no response required – skip further processing */ DescProcessingDone(pMsgContext
->iContext);
}
else
{
/* Now we have to set CANdesc into the Ring-Buffer mode */ DescRingBufferStart(pMsgContext
->iContext);
/* Now it is possible to write into the Ring-Buffer */ DescRingBufferWrite(pMsgContext
->iContext, &lData, 1);
/* Now trigger e.g. an EEPROM read event */ ...
}
}
EEPROM_TASK(xyz)
{
vuint8 lDTC[3];
... /* Wait for EEPROM event */ /* EEPROM event is finished with reading */ {
DescRingBufferWrite(g_iContext, &lDTC, 3);
/* Now trigger next EEPROM reading */ }
}
©2010, Vector Informatik GmbH
Version: 2.19.00
111 / 117

Technical Reference CANdesc
7.6.2 with synchronous write Desc
Appl_M ai nHandl er
Appl_MainHandler_2
EEPROM
Appl_Post Handl er
Driver
call
Analyze and validate request
write response length
DescRingBufferStart
Desc RingBufferW ri te(* dataPtr, dataLength)
DescStartRepeatedServiceCall(&ApplMainHandler_2)
W ithin this function
Activate the
call the data can be
multiple service
written synchronous.
call to get a
periodic call from
CANdesc
call
GetEEPROMData
DescRingBufferW rite(* dataPtr, dataLength)
call
DescRingBufferGetFreeSpace
return cou ntOfFreeBytesInRing Bu ffer
call
DescRingBufferGetFreeSpace
return cou ntOfFreeBytesInRing Bu ffer
GetEEPROMData
DescRingBufferW rite(* dataPtr, dataLength)
PostHandler
//2. Read Service (with synchronous Ring-Buffer)
// - static length
// - sub-function/PID
extern void ApplDescReadDTC_AddOn(DescMsgContext
* pMsgContext);
void DESC_API_CALLBACK_TYPE
ApplDescReadDTC(DescMsgContext
* pMsgContext)
{
vuint8 lData;
/* Format check already done by CANdesc */ ©2010, Vector Informatik GmbH
Version: 2.19.00
112 / 117

Technical Reference CANdesc
/* Analysis of request has to done by ECU application */ /* Set the response length */ pMsgContext
->resDataLen
= 16;
/* Fill the first data */ lData
= 5;
/* check only on services with sub-function (e.g. 0x19) */ if(pMsgContext
->msgAddInfo.suppPosRes != 0)
{
/* since no response required – skip further processing */ DescProcessingDone(pMsgContext
->iContext);
}
else
{
/* Now we have to set CANdesc into the Ring-Buffer mode */ DescRingBufferStart(pMsgContext
->iContext);
/* Now it is possible to write into the Ring-Buffer */ DescRingBufferWrite(pMsgContext
->iContext, &lData, 1);
/* Use RepeatedSeriveCall feature to poll e.g. EEPROM driver */ DescStartRepeatedServiceCall(pMsgContext
->iContext, &ApplDescReadDTC_AddOn);
}
}
void ApplDescReadDTC_AddOn(DescMsgContext
* pMsgContext)
{
vuint8 lDTC[3];
DescMsgLen freeSpace;
/* Check if enough space is free in ring-buffer */ freeSpace
= DescRingBufferGetFreeSpace();
if (freeSpace
>= 3)
/* try to read from EEPROM */ {
/* Success - result is in lDTC */ DescRingBufferWrite(pMsgContext
->iContext, &lDTC, 3);
}
else {
/* nothing to do, wait for next MainHandler call, ring-buffer is full */ }
}
7.7 …prevent the ECU going to sleep while diagnostic is active Most car manufactures have the requirement to keep the ECU alive while the diagnostic
layer is active; including a pending request or a non-default session is currently active.
This requirement is handled by CANdesc for some car manufactures (see OEM specific
TechnicalReference_CANdesc document for details)
The following code example shows all necessary steps to keep the ECU alive while
diagnostic jobs are running (e.g. non-default session):
{
DescContextActivity lActivity;
DescStateGroup lState;
©2010, Vector Informatik GmbH
Version: 2.19.00
113 / 117

Technical Reference CANdesc
lAcitvity = DescGetActivityState();
lState = DescGetStateSession();
/* check for a pending request or a non-default session */
if ( ((lState & kDescStateSessionDefault) == 0) ||
(lActivity != kDescContextIdle) )
{
/* Force to stay alive */
}
else
{
/* Ready for sleeping */
}
}
7.8 …send a positive response without request after FBL flash job According to the DC ECU programming specification after successful flashing of the ECU
the application shall send a positive response either to “diagnostic session control –
default session” or “ECU reset – hard reset” immediately after restart of the application.
The Vector Flash Boot Loader will set a flag (reset response flag) in RAM or EEPROM
which has to be evaluated by the application at startup. Depending on its value the
application has to call the CANdesc function DescSendPosRespFBL with the appropriate
response ID.
CANdesc provides the API DescSendPosRespFBL for this purpose.
Due to bus communication is necessary to send the positive response; some limitations
have to be handled by the application:
1) Bus communication is to be requested by the application
2) If bus communication is possible, the application has to call DescSendPosRespFBL.
CANdescBasic will send the positive response.
3) The application will be called to provide the concrete addressing information of the
response.
4) Bus communication can be released by the application.
7.9 …enforce CANdesc to use ANSI C instead of hardware optimized bit type CANdesc uses per default the bit-type definition provided by the CANdriver, since it is
selected as optimal for the concrete CPU. On this way the CANdesc ROM and RAM
resource consumption is kept as low as possible.
Due to the complexity of some CANdesc data structures there can be problems on certain
compilers with special bit-structure compiler options.
If you encounter such problems either at compile or at run-time, you can turn the ANSIC C
bit-type support in CANdesc on. To do that, just add a user configuration file in GENy with
the following content:
#define DESC_USE_ANSI_C_BIT_TYPE
©2010, Vector Informatik GmbH
Version: 2.19.00
114 / 117

Technical Reference CANdesc
8 Related documents Abbreviation File Name Description /KWP2000/
Keyword 2000 protocol
/TPMC/
User manual of the multi-connection transport layer
module. The transport layer is implemented
according to /ISO 15765/
/ISO
15765/
This ISO standard describes diagnostics and
diagnostics on CAN.
Note: If no file name is given, the document is not provided by Vector.
©2010, Vector Informatik GmbH
Version: 2.19.00
115 / 117

Technical Reference CANdesc
9 Glossary Abbreviation Description CANdb CAN data
base by Vector which is used by Vector tools.
CANdesc CAN diagnostics
embedded
software
component
CDD CANdela
Diagnostic
Database
CF Consecutive
Frame (transport protocol frame)
CCL Communication
Control
Layer
DBC CAN database format of the Vector company, which is used by the
GENtool to gather information about the ECUs in the network, their
communication relations, message definitions, signals of
messages, network related information (e.g. manufacturer type,
network management type, etc.).
ECU Electronic
Control
Unit
FBL Flash
Boot
Loader
KWP 2000 Key
word
Protocol
2000 OSEK German abbreviation, “
Offene
Systeme und deren Schnittstellen
für die
Elektronik im
Kraftfahrzeug”, means “open systems and the
corresponding interfaces for automotive electronics”
RCR-RP Request
Correctly
Received
– Response
Pending
SF Single
Frame
SID Service
Identifier
SPRMIB Suppress
Positive
Response
Message
Indication
Bit
TP Transport
Protocol
UDS Unified
Diagnostic
Services
©2010, Vector Informatik GmbH
Version: 2.19.00
116 / 117

Technical Reference CANdesc
10 Contact Visit our website for more information on
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector-informatik.com ©2010, Vector Informatik GmbH
Version: 2.19.00
117 / 117
Document Outline
1.1.36 - TechnicalReference_CANDriver
TechnicalReference1.1.38 - TechnicalReference_CANDrivers
Vector CAN Driver
Technical Reference
Reference Implementation 1.5
Version 3.01.01
Authors: H. Honert, K. Emmert
Version: 3.01.01
Status: released (in preparation/completed/inspected/released)
©2010, Vector Informatik GmbH
Version: 3.01.01
1 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
1 Document Information 1.1 History Author Date Version Remarks Hoffmann
July, 30th 1997 1.00
Initial draft
Baudermann, Ebner
Aug, 9th 1999
2.00
Reorganization of the document
Hardware related
documentation removed
Ebner
Nov, 2nd 1999 2.01
Spelling corrections
Baudermann
Nov, 6th 1999
2.02
Restrictions with reentrance
capability for the following CAN
Driver functions: CanInit,
CanReset..., CanSleep,
CanWakeUp and CAN
interrupts
Honert
Dec, 14th 1999 2.03
DLC check added
Ebner
Feb, 8th 2000
2.04
Configuration by tool support
(CANgen) added
Baudermann, Rein, Honert, May, 23th 2000 2.10
Generally reworked
Brändle
According to reference
implementation, version 1.1
Honert
Oct, 31th 2000 2.11
Description of indexed CAN
Driver added
Honert
Feb, 28th 2001 2.12
Extensions according to
reference implementation
version 1.2
Hardware related
documentation of HC12 and
C16x moved to a separate
document
Honert
Aug, 10th 2001 2.13
Description of API extended
Single Receive Channel CAN
Driver
CanCancelTransmit and
CanCancelMsgTransmit added
Access to ErrorCounters added
Honert,
Aug, 20th 2001 2.14
Prototype of UserPrecopy
corrected
Spelling corrections
Emmert
Modifications for pdf conversion
Emmert
Okt, 9th 2001
2.15
Modifications of Figure 4 and 5.
Honert
Mai, 17th 2002 2.16
Function name corrected for
indexed driver
Extensions according to
©2010, Vector Informatik GmbH
Version: 3.01.01
2 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
reference implementation
version 1.3
Ebner, Honert, Emmert
Jun, 18th, 2003 2.20
Macro names corrected in
figure 7.
Extensions according to
reference implementation
version 1.4.
Additional explanation for offline
/ partial of
fline mode (ch. 5.2.6) Emmert, Honert
Juli, 29th, 2003 2.21
New tables for API descriptions.
Corrections of some
Parameters and API
descriptions.
Stephan Hoffmann, Klaus
May 17nd,
2.22 Description
of
API
extended
Emmert, Heike Honert,
2004
Direct Transmit Objects
Patrick Markl
Cancel in Hardware
Language corrections, New
Layout, Technical revisions
Klaus Emmert
2005-12-30
2.23
GENy added as Generation
Matthias Fleischmann
Tool
Added description for:
Multiple ECU
Common CAN
Signal Access Macros
Rx Queue
Conditional Message Received
Variable Datalen
Heike Honert
2006-08-01
2.30
Extensions according to
reference implementation 1.5.
Heike Honert
2007-01-09
3.00
prepare links to hw specific
Added description for:
CAN RAM check
Standard/HighEnd CAN Driver
Heike Honert
2007-01-29
3.01
some corrections
improve Common CAN
service functions for conditional
message reception added
Description for Partial Offline
Mode for GENy modified
ESCAN00032527: Update
description of
ApplCanAddCanInterruptDisabl
e/Restore call-back function
Heike Honert
2010-06-11
3.01.01
Reference to documentation of
VstdLib changed
Table 1-1 History of the Document
©2010, Vector Informatik GmbH
Version: 3.01.01
3 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
1.2 Reference Documents Index and Document Name
[1] TechnicalReference_<hardware>.pdf
Table 1-2 Reference Documents
Please note
We have configured the programs in accordance with your specifications in the
questionnaire. Whereas the programs do support other configurations than the one
specified in your questionnaire, Vector´s release of the programs delivered to your
company is expressly restricted to the configuration you have specified in the
questionnaire.
©2010, Vector Informatik GmbH
Version: 3.01.01
4 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
1.3 Contents 1 Document Information ............................................................................................... 2 1.1 History .......................................................................................................... 2 1.2 Reference Documents ................................................................................. 4 1.3 Contents....................................................................................................... 5 2 About this Document ............................................................................................... 13 2.1 Documents this one refers to….................................................................. 14 2.2 Naming Conventions.................................................................................. 14 3 Reference Implementations..................................................................................... 15 3.1 Version 1.0 ................................................................................................. 15 3.1.1 What's new?............................................................................................... 15 3.1.2 What's changed?........................................................................................ 15 3.2 Version 1.1 ................................................................................................. 16 3.2.1 What's new?............................................................................................... 16 3.2.1.1 Mandatory (for all CAN Drivers) ................................................................. 16 3.2.1.2 Optional (for some specific CAN Drivers) .................................................. 16 3.2.2 What's changed?........................................................................................ 16 3.3 Version 1.2 ................................................................................................. 17 3.3.1 What’s new?............................................................................................... 17 3.3.2 What’s changed? ....................................................................................... 17 3.4 Version 1.3 ................................................................................................. 17 3.4.1 What’s new?............................................................................................... 17 3.4.2 What’s changed? ....................................................................................... 17 3.5 Version 1.4 ................................................................................................. 18 3.5.1 What’s new?............................................................................................... 18 3.5.1.1 Mandatory (for all CAN Drivers) ................................................................. 18 3.5.1.1.1 Common features....................................................................................... 18 3.5.1.1.2 Transmission features ................................................................................ 18 3.5.1.2 Optional (for some specific CAN Drivers) .................................................. 18 3.5.1.2.1 Transmission features ................................................................................ 18 3.5.1.2.2 Reception features ..................................................................................... 18 3.5.2 What’s changed? ....................................................................................... 19 3.5.2.1 Transmission features ................................................................................ 19 3.6 Version 1.5 ................................................................................................. 19 3.6.1 What’s new?............................................................................................... 19 3.6.2 What’s changed? ....................................................................................... 20 ©2010, Vector Informatik GmbH
Version: 3.01.01
5 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
4 Overview ................................................................................................................... 21 4.1 Short Summary of the Functional Scope ................................................... 22 4.1.1 Initialization ................................................................................................ 22 4.1.2 Transmission .............................................................................................. 22 4.1.3 Reception ................................................................................................... 23 4.1.4 Bus-Off ....................................................................................................... 23 4.1.5 Sleep Mode ................................................................................................ 23 4.1.6 Special Features ........................................................................................ 23 4.2 Data Structures for CAN Driver Customization .......................................... 24 4.2.1 ROM Data .................................................................................................. 25 4.2.1.1 Initialization Structures ............................................................................... 25 4.2.1.2 Transmit Structures .................................................................................... 26 4.2.1.3 Receive Structures ..................................................................................... 26 4.2.2 RAM Data................................................................................................... 26 5 Detailed Description of the Functional Scope (Standard) .................................... 27 5.1 Initialization ................................................................................................ 27 5.1.1 Power-On Initialization of the CAN Driver .................................................. 27 5.1.2 Re-Initialization of the CAN Controller ....................................................... 27 5.2 Transmission .............................................................................................. 27 5.2.1 Detailed Functional Description ................................................................. 27 5.2.2 Transmit Queue.......................................................................................... 32 5.2.3 Data Copy Mechanisms ............................................................................. 33 5.2.3.1 Internal ....................................................................................................... 33 5.2.3.2 User defined (“Pretransmit Function”)........................................................ 34 5.2.4 Notification ................................................................................................. 34 5.2.4.1 Data Interface (Confirmation Flag)............................................................. 34 5.2.4.2 Functional Interface (Confirmation Function for each message) ............... 34 5.2.4.3 Functional Interface (Common Confirmation Function for all messages) .. 34 5.2.5 Offline Mode............................................................................................... 35 5.2.6 Partial Offline Mode.................................................................................... 35 5.2.6.1 Partial Offline Mode with GENy.................................................................. 36 5.2.7 Passive State ............................................................................................. 39 5.2.8 Tx Observe................................................................................................. 40 5.2.9 Cancellation of a Transmission .................................................................. 41 5.2.9.1 Cancel a Transmission via CanInit............................................................. 41 5.2.9.2 Cancel a Transmission via CanCancelTransmit or
CanCancelMsgTransmit............................................................................. 41 5.2.9.3 Notification about Cancellation of a message ............................................ 42 5.2.10 Overview of Transmit Objects .................................................................... 43 5.2.11 Normal Transmit Object ............................................................................. 43 ©2010, Vector Informatik GmbH
Version: 3.01.01
6 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
5.2.12 Full CAN Transmit Objects......................................................................... 43 5.2.13 Dynamic Transmit Objects ......................................................................... 43 5.2.14 Priority of Transmit Objects ........................................................................ 45 5.3 Reception ................................................................................................... 46 5.3.1 Detailed Functional Description ................................................................. 46 5.3.2 Receive Function ....................................................................................... 50 5.3.3 Range-Specific Precopy Functions ............................................................ 50 5.3.4 Identifier Search Algorithms ....................................................................... 50 5.3.5 DLC check.................................................................................................. 51 5.3.6 Data Copy Mechanism............................................................................... 51 5.3.6.1 Internal ....................................................................................................... 51 5.3.6.2 User-defined Precopy Functions................................................................ 52 5.3.7 Notification ................................................................................................. 52 5.3.7.1 Data Interface (Indication Flag).................................................................. 53 5.3.7.2 Functional Interface (Indication Function) .................................................. 53 5.3.8 Not-Matched Function................................................................................ 53 5.3.9 Overrun Handling ....................................................................................... 53 5.3.10 Full CAN Overrun Handling........................................................................ 53 5.3.11 Conditional Message Received.................................................................. 54 5.4 Bus-Off Handling........................................................................................ 54 5.5 Sleep Mode ................................................................................................ 55 5.6 Special Features ........................................................................................ 56 5.6.1 Status ......................................................................................................... 56 5.6.2 Stop Mode .................................................................................................. 57 5.6.3 Remote Frames ......................................................................................... 57 5.6.4 Interrupt Control ......................................................................................... 57 5.6.4.1 Security Level............................................................................................. 57 5.6.4.2 Control of CAN interrupts ........................................................................... 58 5.6.5 Assertions .................................................................................................. 59 5.6.6 Hardware Loop Check ............................................................................... 62 5.6.7 Support of OSEK-Compliant Operating Systems....................................... 63 5.6.8 Multiple-Channel CAN Driver ..................................................................... 63 5.6.8.1 Indexed CAN Driver ................................................................................... 63 5.6.9 Standard Polling Mode ............................................................................... 63 5.6.9.1 Application Hints ........................................................................................ 64 5.6.10 Handling of different identifier types........................................................... 64 5.6.11 Copying Mechanisms................................................................................. 65 5.6.12 Common CAN ............................................................................................ 65 5.6.13 Multiple ECU .............................................................................................. 65 5.6.14 Signal Access Macros ................................................................................ 65 5.6.15 CAN RAM Check ....................................................................................... 66 ©2010, Vector Informatik GmbH
Version: 3.01.01
7 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
6 Detailed Description of the Functional Scope (High End extension) .................. 67 6.1 Transmission .............................................................................................. 67 6.1.1 Low-Level Message Transmit .................................................................... 67 6.2 Reception ................................................................................................... 67 6.2.1 Multiple Basic CAN .................................................................................... 67 6.2.2 Rx Queue ................................................................................................... 67 6.2.2.1 Handling in Receive Interrupt..................................................................... 68 6.2.2.2 Handling on Task Level .............................................................................. 69 6.2.2.3 Resetting the Rx Queue............................................................................. 70 6.3 Special Features ........................................................................................ 71 6.3.1 Individual Polling ........................................................................................ 71 7 Feature List (Standard and High End) .................................................................... 72 8 Description of the API (Standard) ........................................................................... 75 8.1 API Categories ........................................................................................... 75 8.1.1 Single Receive Channel (SRC).................................................................. 75 8.1.2 Multiple Receive Channel (MRC)............................................................... 75 8.2 Data Types ................................................................................................. 76 8.3 Constants ................................................................................................... 77 8.3.1 Version Number ......................................................................................... 77 8.4 Macros ....................................................................................................... 77 8.4.1 Conversion between Logical and Hardware Representation of CAN
Parameter DLC .......................................................................................... 77 8.4.2 Direct Access to the CAN Controller Registers .......................................... 78 8.4.3 Interpretation of the CAN Status ................................................................ 79 8.4.4 Access to low level transmit structure ........................................................ 80 8.5 Functions.................................................................................................... 80 8.5.1 Service Functions....................................................................................... 81 8.5.1.1 CanInitPowerOn......................................................................................... 81 8.5.1.2 CanInit........................................................................................................ 81 8.5.1.3 CanTransmit............................................................................................... 82 8.5.1.4 CanTask ..................................................................................................... 83 8.5.1.5 CanTxTask ................................................................................................. 83 8.5.1.6 CanRxFullCANTask ................................................................................... 84 8.5.1.7 CanRxBasicCANTask ................................................................................ 84 8.5.1.8 CanErrorTask ............................................................................................. 85 8.5.1.9 CanWakeUpTask........................................................................................ 85 8.5.1.10 CanOnline .................................................................................................. 86 8.5.1.11 CanOffline .................................................................................................. 86 8.5.1.12 CanPartOnline............................................................................................ 87 ©2010, Vector Informatik GmbH
Version: 3.01.01
8 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
8.5.1.13 CanPartOffline............................................................................................ 87 8.5.1.14 CanGetPartMode ....................................................................................... 88 8.5.1.15 CanGetStatus............................................................................................. 88 8.5.1.16 CanSleep ................................................................................................... 89 8.5.1.17 CanWakeUp ............................................................................................... 90 8.5.1.18 CanStart ..................................................................................................... 91 8.5.1.19 CanStop ..................................................................................................... 92 8.5.1.20 CanGlobalInterruptDisable......................................................................... 92 8.5.1.21 CanGlobalInterruptRestore ........................................................................ 93 8.5.1.22 CanCanInterruptDisable............................................................................. 93 8.5.1.23 CanCanInterruptRestore ............................................................................ 94 8.5.1.24 CanSetPassive........................................................................................... 94 8.5.1.25 CanSetActive ............................................................................................. 95 8.5.1.26 CanResetBusOffStart ................................................................................. 95 8.5.1.27 CanResetBusOffEnd.................................................................................. 96 8.5.1.28 CanResetBusSleep.................................................................................... 96 8.5.1.29 CanGetDynTxObj....................................................................................... 97 8.5.1.30 CanReleaseDynTxObj ............................................................................... 99 8.5.1.31 CanDynTxObjSetId .................................................................................... 99 8.5.1.32 CanDynTxObjSetExtId ............................................................................. 100 8.5.1.33 CanDynTxObjSetDlc ................................................................................ 100 8.5.1.34 CanDynTxObjSetDataPtr ......................................................................... 101 8.5.1.35 CanCancelTransmit.................................................................................. 101 8.5.1.36 CanCopyFromCan ................................................................................... 101 8.5.1.37 CanCopyToCan........................................................................................ 102 8.5.1.38 CanTxGetActHandle ................................................................................ 102 8.5.1.39 CanResetMsgReceivedCondition ............................................................ 103 8.5.1.40 CanSetMsgReceivedCondition ................................................................ 103 8.5.1.41 CanGetMsgReceivedCondition................................................................ 104 8.5.2 User Specific Functions............................................................................ 105 8.5.2.1 UserPrecopy ............................................................................................ 105 8.5.2.2 UserIndication .......................................................................................... 105 8.5.2.3 UserPreTransmit ...................................................................................... 106 8.5.2.4 UserConfirmation ..................................................................................... 106 8.5.3 Callback Functions................................................................................... 107 8.5.3.1 ApplCanBusOff ........................................................................................ 107 8.5.3.2 ApplCanWakeUp...................................................................................... 107 8.5.3.3 ApplCanOverrun ...................................................................................... 108 8.5.3.4 ApplCanFullCanOverrun .......................................................................... 108 8.5.3.5 ApplCanMsgReceived.............................................................................. 109 8.5.3.6 ApplCanRangePrecopy............................................................................ 109 ©2010, Vector Informatik GmbH
Version: 3.01.01
9 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
8.5.3.7 ApplCanAddCanInterruptDisable ..............................................................110 8.5.3.8 ApplCanAddCanInterruptRestore .............................................................110 8.5.3.9 ApplCanFatalError ....................................................................................111 8.5.3.10 ApplCanMsgNotMatched ..........................................................................111 8.5.3.11 ApplCanInit................................................................................................112 8.5.3.12 ApplCanTxObjStart ...................................................................................113 8.5.3.13 ApplCanTxObjConfirmed ..........................................................................113 8.5.3.14 ApplCanTimerStart ....................................................................................114 8.5.3.15 ApplCanTimerLoop ...................................................................................114 8.5.3.16 ApplCanTimerEnd .....................................................................................115 8.5.3.17 ApplCanGenericPrecopy...........................................................................115 8.5.3.18 ApplCanPreWakeup..................................................................................115 8.5.3.19 ApplCanTxConfirmation ............................................................................116 8.5.3.20 ApplCanMsgDlcFailed...............................................................................117 8.5.3.21 ApplCanCancelNotification .......................................................................117 8.5.3.22 ApplCanOnline ..........................................................................................118 8.5.3.23 ApplCanOffline ..........................................................................................118 8.5.3.24 ApplCanMsgCondReceived ......................................................................118 8.5.3.25 ApplCanMemCheckFailed ........................................................................119 8.5.3.26 ApplCanCorruptMailbox ............................................................................119 9 Description of the API (High End extension) ....................................................... 121 9.1 Functions.................................................................................................. 121 9.1.1 Service Functions..................................................................................... 121 9.1.1.1 CanTxObjTask.......................................................................................... 121 9.1.1.2 CanRxFullCANObjTask............................................................................ 122 9.1.1.3 CanRxBasicCANObjTask......................................................................... 122 9.1.1.4 CanMsgTransmit ...................................................................................... 123 9.1.1.5 CanCancelMsgTransmit........................................................................... 123 9.1.1.6 CanHandleRxMsg .................................................................................... 124 9.1.1.7 CanDeleteRxQueue ................................................................................. 124 9.1.2 Callback Functions................................................................................... 125 9.1.2.1 ApplCanMsgTransmitConf ....................................................................... 125 9.1.2.2 ApplCanMsgTransmitInit .......................................................................... 125 9.1.2.3 ApplCanMsgCancelNotification................................................................ 125 9.1.2.4 ApplCanPreRxQueue............................................................................... 126 9.1.2.5 ApplCanRxQueueOverrun ....................................................................... 126 10 Configuration (Standard and High End)............................................................... 128 10.1 Network Database – Attribute Definition .................................................. 128 10.2 Automatic Configuration by GENy ........................................................... 128 ©2010, Vector Informatik GmbH
Version: 3.01.01
10 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
10.3 Automatic Configuration by CANgen ....................................................... 139 10.4 Manual configuration via user configuration file ....................................... 144 11 Glossary .................................................................................................................. 145 12 Contact .................................................................................................................... 149 ©2010, Vector Informatik GmbH
Version: 3.01.01
11 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Illustrations Figure 2-1 Manuals and References for the CAN Driver ................................................. 14 Figure 4-1 Relationship of the individual Software Components. They are
customized by the Generation Tool................................................................. 21 Figure 4-2 Description data, CAN Driver and Application with their interfaces. ............... 25 Figure 5-1 Transmission of a CAN message ................................................................... 28 Figure 5-2 Transmission with an available transmit object; Using global data buffer....... 30 Figure 5-3 Transmission with an available hardware transmit object; Using a
pretransmit function to copy data.................................................................... 31 Figure 5-4 Transmit procedure if no hardware transmit object available ......................... 32 Figure 5-5 Partial Offline Mode settings in GENy............................................................. 37 Figure 5-6 One Single Application Message Selected ..................................................... 38 Figure 5-7 User Defined assignment to Offline Modes .................................................... 38 Figure 5-8 Overview Messages and Offline Modes ......................................................... 39 Figure 5-9 Priority of Transmit Objects............................................................................. 45 Figure 5-10 Reception of a CAN messages....................................................................... 46 Figure 5-11 Reception of a CAN message: The data is completely processed in the precopy function ............................................................................................. 48 Figure 5-12 Reception of a CAN message: The CAN Driver internal copying mechanism is used ......................................................................................... 49 Figure 5-13 Name of signal access macros....................................................................... 66 Figure 6-1 Handling of the Rx queue within the receive routine. ..................................... 69 Figure 6-2 Handling of the Rx queue on task level. ......................................................... 70 Figure 10-1 Configuration of the common CAN Driver options with GENy...................... 129 Figure 10-2 Channel Specific Configuration for GENy..................................................... 135 Figure 10-3 Configuration of individual polling with GENy ............................................... 136 Figure 10-4 Configuration of a Tx message with GENy ................................................... 137 Figure 10-5 Configuration of an Rx message with GENy ................................................ 138 Figure 10-6 CAN Driver configuration tab ........................................................................ 139 Figure 10-7 Configuration of Partial Offline Mode ............................................................ 143 Tables
Table 1-1 History of the Document ................................................................................... 3 Table 1-2 Reference Documents ...................................................................................... 4 ©2010, Vector Informatik GmbH
Version: 3.01.01
12 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
2 About this Document This document describes the concept, features, API and the configuration of the Vector
CAN Driver.
The CAN Driver interface to the CAN Controller is designed to use the hardware specific
capabilities in an efficient way. The interface to the higher communication layers is mostly
identical for different CAN Controllers, so that the Interaction Layer, Network Management,
Transport Protocol and especially the user software are independent of the particular CAN
Controller used. Please note that in this document the term Application is not used strictly
for the user software but also for all the higher communication layers as listed above.
Therefore, Application refers to any of the software modules using the CAN Driver.
Two different types of CAN Driver are supported. These are the Standard CAN Driver and
the High End CAN Driver. The High End CAN Driver is an extended Standard CAN Driver.
The description of the Standard CAN Driver is also valid for the High End CAN Driver. The
additional features of the High End CAN Driver are described in own chapters.
The API of the functions is described in a separate chapter at the end of this document.
Referred functions are always shown in the Single receive channel mode.
Hardware related special features and implementation specifics are described in a
separate document which is named TechnicalReference_CAN_<hardware>.pdf.
©2010, Vector Informatik GmbH
Version: 3.01.01
13 / 149
based on template version 2.1




TechnicalReference Vector CAN Driver
2.1 Documents this one refers to… User Manual CAN Driver
Hardware-specific documentation for the CAN Driver
User ManualTechnicalTechnicalReferenceReferenceGeneralHardwareYou are here#hw_<xxx>
Figure 2-1 Manuals and References for the CAN Driver
2.2 Naming Conventions
Some of the function names are mandatory, because they are used in the CAN Driver.
Other names are placeholders, and the Application can redefine or has to select them
according to its requirements:
Can...
It is mandatory to use all names beginning with Can... as they appear. Can...
stands for CAN Driver.
ApplCan...
The functions, starting with Appl... are so called callback functions. They are
provided by the Application and called by the CAN Driver. They are used to
notify the application about events such as state transitions.
User...
All names starting with User... are placeholders and will be selected by using
the Generation Tool according to the requirements of the Application. User...
stands for user-specific functions.
©2010, Vector Informatik GmbH
Version: 3.01.01
14 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
3 Reference Implementations The reference implementation is a general specification for all Vector CAN Drivers. The
software versions for specific CAN Drivers differs, because there are different source
codes for different CAN Controllers. Therefore another overall version number exists,
representing the reference implementation. The CAN Drivers are implemented according
to this reference implementation with an identical feature set and Application interface as
well as a harmonized implementation.
3.1 Version 1.0 3.1.1 What's new? Identifier ranges defined by acceptance code and mask to receive a complete set of
several CAN identifiers. This is much more efficient for special requirements with fixed
identifier ranges and can be configured by the Application. Useful settings for
Application are selected automatically by the Generation Tool.
Some parameters are provided by preprocessor defines in the CAN Driver configuration
file instead of global variables. This results in more efficient code.
Notification of a CAN receive message overrun condition is done by the callback
function ApplCanOverrun(). This is configurable.
The internal copy mechanism of the CAN Driver is configurable separately for receive
and transmit direction. It will be enabled automatically if an Application data buffer is
selected by the Generation Tool.
3.1.2 What's changed? General interrupt disable during critical service functions is replaced by a reentrant
solution.
General assertion categories for the following severe errors in the CAN Driver:
- User interface (e.g. invalid handles)
- Generated data (caused by the Generation Tool)
- Hardware problems (unexpected conditions of the CAN Controller)
- Internal errors (e.g. inconsistent transmit queue entries)
The different categories can be configured separately and the name of the callback
function has changed from ApplFatalError(..) to ApplCanFatalError(..).
Callback function CanMsgReceive() has changed in ApplCanMsgReceived().
Plausibility check for configuration switches of the CAN Driver is optional and will be
done in a separate header file called CAN_CHK.H.
CanRxActualDLC will be provided as a preprocessor macro.
©2010, Vector Informatik GmbH
Version: 3.01.01
15 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
If the transmit queue is used for CAN Controllers with several hardware transmit
objects, only one of these register sets will be used for normal transmission (in
combination with the transmit queue). The others are reserved for Full CAN Transmit
Objects with fixed CAN identifier and DLC.
The names of the following global variables have been changed:
CanEcuNumber to canEcuNumber
CanRxHandle to canRxHandle
3.2 Version 1.1 3.2.1 What's new? 3.2.1.1 Mandatory (for all CAN Drivers) Configurable callback function if software acceptance filtering doesn't match.
Configurable callback functions to monitor the correct transmit behavior.
Dynamic transmit objects for variable CAN identifier and DLC
Security level for the data consistency during the internal copy routines for receive and
transmit data.
Configurable callback functions to control hardware dependent loop break conditions
(e.g. during the transition to reset, standby or sleep mode).
For micros with nested interrupt levels the global disabling of interrupts by
CanGlobalInterruptDisable/Restore() is replaced by a configurable interrupt lock level.
3.2.1.2 Optional (for some specific CAN Drivers) Support of extended CAN identifiers in different modes (extended only or mixed with
standard identifiers)
Non-interrupt (polling) mode for asynchronous transmission, reception, error and wake-
up notification.
Dynamic transmit objects (for flexible transmit buffer, pretransmit as well as confirmation
function).
Full CAN Transmit Objects with fixed CAN identifier and DLC.
Dynamic hardware acceptance filtering for the reception of different messages.
3.2.2 What's changed? Service functions for flexible CAN identifier and DLC CanTransmitVarDLC/ID(..) must
not be used for new developments. It will be replaced by dynamic transmit objects.
Special macros for the direct access to CAN message information (identifier, DLC, ...) in
the receive function (Dir...) will be removed. The standard macros can be used instead.
©2010, Vector Informatik GmbH
Version: 3.01.01
16 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Configurable DLC check for the length of the according receive buffer to avoid the
overwriting of the next receive buffer: The complete data will not be copied and the
Application will not be notified if an inconsistency is detected.
The return code data type of the CanGetStatus() service function has changed because
of additional information in the software state of the CAN Driver and the hardware state
of the CAN Controller.
3.3 Version 1.2 3.3.1 What’s new? Hash search algorithm
Low level transmit functionality to support e.g. gateways
Service functions to stop and restart the CAN Controller.
partial offline to switch dedicated transmit messages off.
New return code of CanTransmit() in case of partial offline.
Macros which return 8 bit of a received extended ID for use in precopy functions.
Access to error counter of the CAN controller
Service function to cancel transmit requests and confirmations
3.3.2 What’s changed? Generic Precopy function is now mandatory
CanSleep() and CanWakeUp() has now a return value.
CanGetStatus() is always available. Activation of extended status enables the additional
information in the hardware state of the CAN Controller.
Passive mode can only be activated for all transmit requests and not for dedicated
messages.
The name of some macros to access the ID in a precopy function has changed
In the indexed CAN Driver, CanGetDynTxObj() has the channel as additional parameter.
Macro CanRxActualIdHi renamed to CanRxActualIdRawHi
Macro CanRxActualIdLo renamed to CanRxActualIdRawLo
3.4 Version 1.3 3.4.1 What’s new? New service functions to disable and restore CAN interrupts
3.4.2 What’s changed? Function CanInterruptDisable renamed to CanGlobalInterruptDisable
©2010, Vector Informatik GmbH
Version: 3.01.01
17 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Function CanInterruptRestore renamed to CanGlobalInterruptRestore
Support of systems with mixed Identifier expanded
Macro CanRxActualId returns the Identifier always in the logical presentation
3.5 Version 1.4 3.5.1 What’s new? 3.5.1.1 Mandatory (for all CAN Drivers) 3.5.1.1.1 Common features New functions CanCopyFromCan and CanCopyToCan. Hardware/Compiler dependent
functions to optimize copying of data (provide for higher layers such as TP, Diag).
more… API… The CAN driver can be configured to run without any disabling of interrupts.
The application has to take care of reentrancy! To set the Can Driver to this mode, the
security level has to be set to the lowest value.
more… The CAN Driver is more fault tolerant against unexpected CAN interrupts like Rx
interrupt of a transmit object. Interrupt in polling mode or interrupts of unused objects
are handled by the driver.
Callback function ApplCanPreWakeUp which is called immediately after the activation of
the wakeup interrupt. more... API… The CAN Driver doesn’t use library function of the compiler library (except for intrinsic
functions)
The Can Driver code is MISRA compliant.
3.5.1.1.2 Transmission features
A confirmation function common to all transmit messages is supported. This function is
called after any successful transmission (except Direct Transmit Objects but includes
canceled transmit object
s that had been sent although). more… API… 3.5.1.2 Optional (for some specific CAN Drivers) 3.5.1.2.1 Transmission features CanDirectTransmit( txHandle ) to support direct transmit objects.
This transmission is completely independent of other transmit messages and can
be sent e.g. out of a NMI (non-maskable interrupt service routine. (see also what’s
changed).
3.5.1.2.2 Reception features For Full CAN controllers polling of Basic CAN is supported (all functionality of the CAN
driver can be used in polling mode).
more… A callback function is called, if the DLC check fails (this means if the DLC of the
received message is shorter than configured for this message).
more… API… ©2010, Vector Informatik GmbH
Version: 3.01.01
18 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Support variable data length (for specific OEMs).
3.5.2 What’s changed? The names of the different kinds of transmission objects changed. To make the
differences clear in the following table all kinds of transmission objects are listed even if
nothing changed.
more… Old names (before RI 1.4) New names (RI 1.4 and later) Transmit Objects
Normal Transmit Object
Direct Transmit Objects
Full CAN Transmit Object
Dynamic Transmit Objects
Dynamic Transmit Objects
--- Direct
Transmit
Objects
Low Level Message Transmit
Low Level Message Transmit
3.5.2.1 Transmission features The interface of the TxObserve Callback functions has changed (parameter of the
functions
ApplCanTxObjStart() and ApplCanTxObjConfirmed() and ApplCanInit(). An additional parameter is used. This additional parameter is the handle of the hardware
object (a unique number over all hardware transmit objects which starts with 0).
more… API… The functions CanCancelTransmit() and CanCancelMsgTransmit can now delete a
message in the hardware transmit buffe
r as well as in the queue. more… API… To get the tx handle of a pending transmit message, a new Service function is defined:
CanTxGetActHandle(CanObjectHand
le logTxHwObject) more… API… If a CAN controller doesn’t support arbitration by ID, Direct Transmit Objects and Full
CAN Transmit Objects have a higher priority than the Normal Transmit Object. The Low
Level Message transmission has the lowest priority
. more… It is not possible/necessary any longer to specify the number of the CAN transmit buffer
for Full CAN Transmit Objects. This will be done by the Generation Tool automatically.
The functions CanPartOffline and CanPartOnline are designed to
be reentrant. API… 3.6 Version 1.5 3.6.1 What’s new? data size optimized Tx Queue.
In systems with mixed IDs (standard and extended), each range can be configured to
standard or extended ID individually.
Each hardware objects can be configured individually to polling or interrupt mode.
more... API... Multiple Basic CAN objects can be defined to optimize the hardwar
e filters. more... ©2010, Vector Informatik GmbH
Version: 3.01.01
19 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Rx Queue supports now queuing of messages out of a range.
Notification about mode change of the CAN driver between offline and online mode.
New macros to fill structure of Low Level Message Transmit
distinguish between Standard CAN Driver and High End CAN Driver instead of optional
features
3.6.2 What’s changed? Source Address of Range Specific Precopy Messages removed – deviation to HIS CAN
Driver Sp
ecification. (EcuNumber isn’t any longer a member of tCanRxInfoStruct)
Return code of Range Precopy Functions has effect on further reception handling.
Direct Transmit Objects are not supported any more
API Categories Single Receive Buffer (SRD) and Multiple Receive Buffer (MRB) are not
supported any more.
Global Interrupt Control has been moved to VStdLib (CanGlobalInterruptDisable(),.
CanGlobalInterruptRestore(), Interrupt Control by Application, Interrupt Lock Level).
...more information see Application Note AN-ISC-2-1050_VstdLibIntegration.pdf.
Channel parameter for Hardware Loop Check Callbacks – deviation to HIS CAN Driver
Specification
API... The following macros are not available any more: MK_EXTID_LO, MK_EXTID_HI,
MK_STDID_LO, MK_STDID_HI, CanRxActualIdRaw, CanRxActualIdRawHi,
CanRxActualIdRawLo
The polling Tasks are allowed to be called in Sleep mode, too.
Improvement of usage of assertions
Same OSEK OS interrupt category for all CAN interrupts.
Variable data length replaced by copying data with received DLC and DLC check
against minimum length.
Description of dynamic pretransmit function, dynamic confirmation function and dynamic
acceptance filtering removed.
©2010, Vector Informatik GmbH
Version: 3.01.01
20 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
4 Overview For error prevention, maintainability and expandability of Application programs, it is
essential to have a uniform interface between Application and CAN Driver, mostly
independent of the CAN Controller used. The CAN Driver itself must be adapted to the
CAN Controller for reasons of efficiency. This yields the following requirements for a
universally applicable CAN Driver:
Independent of Application
Driver code optimized for the CAN Controller used
Uniform interface to the Application for different CAN Controllers
Efficient usage of hardware resources, especially RAM and run time
Support of special services like Interaction Layer, Network Management, Transport
Protocol
Figure 4-1 Relationship of the individual Software Components. They are customized by the Generation Tool
The generic CAN Driver code is independent of the Application. Only the callback
functions have to be given by the Application. The Application specific description data are
stored in dedicated data structures. The structure of the description data is fixed; however,
the contents of the structures are defined according to the ECU specific behavior by the
Generation Tool. This is done partly automatically based on information in the CAN
database and partly manually by user specific settings in the Generation Tool. The data
structures are specific for the CAN Controller, they are linked to the CAN Driver code
(ROM-capable).
The data to be transmitted or received are exchanged by default via global data buffers.
These data buffers are CAN message based. They are also created by the Generation
©2010, Vector Informatik GmbH
Version: 3.01.01
21 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Tool. Additionally, the Generation Tool creates signal-based access macros and/or
functions. This means the Application does not have to know the location and the structure
of the global data buffers. The names of the access macros/functions are formed from the
signal names in the CAN database. The detailed structure and features of the access
macros/functions are described in the documentation of the Generation Tool.
The Generation Tool will not be discussed in this CAN Driver documentation, since it is
irrelevant for the CAN Driver functionality. But the generated data structures are highly
optimized for an efficient usage of each CAN Controller. Therefore the usage of the
Generation Tool is a must to customize the CAN Driver code to the special needs of the
Application.
4.1 Short Summary of the Functional Scope
In this section the main tasks of the CAN Driver are summarized very briefly:
1. Initialize the CAN Controller
2. Transmit a single CAN message
3. Receive a single CAN messages
4. Handle Bus-Off
5. Support sleep mode
6. Support special services
4.1.1 Initialization
There are several CAN Driver service functions for initialization purposes available.
CanInitPowerOn(..) for the complete initialization of software and hardware after power-on,
CanResetBusOffStart(..) and CanResetBusOffEnd(..) for the re-initialization of the CAN
Controller after BusOff. For any other re-initialization the application can call CanInit(..).
Various initialization data structures can be predefined by the Generation Tool and
referenced in the Application by means of a specific initialization handle.
4.1.2 Transmission
One of the main services provided by the CAN Driver is to set up a transmit request in the
CAN Controller by the service function CanTransmit(..). The reference to the CAN
message specific description data is done by a transmit handle used in the Application.
This information like CAN identifier and DLC is set up by the Generation Tool based on the
CAN Database and additional user specific settings. If the CAN Controller is busy because
all hardware transmit objects are currently reserved, the transmit request can be stored
temporarily in a transmit queue. The number of hardware transmit objects depends on the
CAN Controller or CAN Driver configuration. For details please refer to the CAN Controller
specific documentation TechnicalReference_CAN_<hardware>.pdf [#hw_comObj]. If the
CAN Controller is ready, data can be copied by different mechanism to the hardware
transmit registers. The return code of the transmit function informs whether the transmit
request was accepted by the CAN Driver or not. If it was rejected by an error and no
transmit queue is used, the Application is responsible for the repetition of the transmit
©2010, Vector Informatik GmbH
Version: 3.01.01
22 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
request until the message is in the CAN Controller. A successful transmission is signaled
by a confirmation. Special features like offline or passive mode are available to control the
transmit path of the CAN Driver by the Network Management or Diagnostics.
4.1.3 Reception
If a message on the CAN bus was accepted by the hardware and software acceptance
filtering, data can be read by different mechanism and this asynchronous event is notified
to the application by an indication. Additionally a special callback function
ApplCanMsgReceived() allows the user to access receive data directly in the scope of a
receive interrupt before the software acceptance filtering. The algorithm for the software
acceptance filtering is configurable because in some Applications a lot of irrelevant CAN
identifiers are passing the hardware acceptance filter and an efficient software filtering is
very important.
4.1.4 Bus-Off
The CAN Driver notifies a detected BusOff state to the Application by calling a special
callback function ApplCanBusOff(). Further processing like re-initialization of the CAN
Controller and additional customer-specific requirements like disabling transmissions for a
certain time have to be done by the Application.
4.1.5 Sleep Mode
Some CAN Controller are supporting a so called sleep mode with reduced power
consumption. The CAN Driver provides the service functions CanSleep() and
CanWakeUp() to enter and leave this special mode on request of the Application.
If the CAN Controller is also wakeable by the CAN bus, the callback function
ApplCanWakeUp() is called if this condition is detected. In some cases this leads to the
situation that the CAN controller is initialized (CanWakeUp) before the application will be
notified.
In case of changing the PLL (SLEEP = slow speed / ACTIVE = normal speed) the
application must be informed immediately. Otherwise the “long” interrupt execution causes
a watchdog reset. Therefore the callback function
ApplCanPreWakeUp is called just after
the activation of the wakeup interrupt. The configuration is done via the Generation Tool or
user configuration file.
4.1.6 Special Features
There is additional support for special features like
Status of CAN Driver and CAN Controller
Interrupt control
Assertions
Hardware loop check
Support of OSEK compliant operating systems
Multiple-channel CAN Driver
Polling mode
©2010, Vector Informatik GmbH
Version: 3.01.01
23 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Handling of Extended Identifiers
Stop mode
4.2 Data Structures for CAN Driver Customization
The description data created by the Generation Tool are split into initialization structures
for the CAN Controller as well as transmission and reception structures for CAN
messages. They are located in the ROM memory of the microprocessor. The receive and
transmit buffers are mapped in RAM data and will be referenced by the description data.
The description data also contains references (pointers) to user-specific functions of the
Application. The CAN Driver accesses all the structures in the description data. The CAN
Driver is independent of the Application but the generated description data depends on the
particular Application.
©2010, Vector Informatik GmbH
Version: 3.01.01
24 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Figure 4-2 Description data, CAN Driver and Application with their interfaces.
4.2.1 ROM Data 4.2.1.1 Initialization Structures The CAN Controller is initialized with the description data stored in the initialization
structures. They consist of the register values for the CAN Controller. They are highly
dependent on the particular used CAN Controller.
©2010, Vector Informatik GmbH
Version: 3.01.01
25 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
4.2.1.2 Transmit Structures The structures listed below are used by the CAN Driver internally.
ID
Identifier of the messages to be transmitted. The format is CAN
Controller dependent for efficiency reasons.
DLC
Number of data bytes to be transmitted (Data Length Code).
The format is CAN Controller dependent for efficiency reasons.
DataPtr
Pointer to the CAN message based global transmit buffer.
UserPreTransmitPtr
Pointer to the user specific pretransmit function (must be a
NULL pointer if not used).
UserConfirmationPtr
Pointer to the user specific confirmation function (must be a
NULL pointer if not used).
ConfirmationOffset/Mask Byte offset and bit mask for the CAN Driver access to the
corresponding confirmation flag.
4.2.1.3 Receive Structures The structures listed below are used by the CAN Driver internally.
ID
Identifier of the messages to be received. The format is CAN
Controller dependent for efficiency reasons.
DataLen
Number of data bytes to be copied. The value may be different
from the DLC of the message received. The driver then only
copies the number of bytes stored in this structure. The other
bytes are ignored.
DataPtr
Pointer to the CAN message based global receive buffer.
UserPrecopyPtr
Pointer to the user specific precopy function (must be a NULL
pointer if not used).
UserIndicationPtr
Pointer to the user specific indication function (must be a NULL
pointer if not used).
IndicationOffset/Mask
Byte offset and bit mask for the CAN Driver access to the
corresponding indication flag.
4.2.2 RAM Data
The RAM data consist of transmit and receive buffers for the CAN messages.
In the data buffers, the first byte transmitted or received is located at the least significant
address of the data array (Note: Bit 7 is transmitted first).
For some microprocessors there are memory areas which can be accessed more
efficiently (e.g. internal RAM or bit addressable segments). The data buffers can be
mapped by the Generation Tool.
©2010, Vector Informatik GmbH
Version: 3.01.01
26 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
5 Detailed Description of the Functional Scope (Standard) 5.1 Initialization 5.1.1 Power-On Initialization of the CAN Driver
The following service function must be called once after power-on to initialize the CAN
Driver:
void CanInitPowerOn( void );
This call initializes the CAN Controller for each channel and all CAN Driver variables (local
and global), i.e. the CAN Driver is set to online and active state.
This service function has to be called for a proper initialization before any other CAN
Driver function and before the global interrupts are enabled.
5.1.2 Re-Initialization of the CAN Controller
The CAN Controller is completely re-initialized by the service function call:
void CanInit( CanInitHandle initObject );
The parameter initObject means a handle for a specific initialization structure.
It is a must to bring the CAN Driver into offline state before this service function is called.
By this service function only the CAN Controller and the corresponding internal variables
will be initialized. Software states like online/offline or active/passive remain unchanged.
Changes of individual registers of the CAN Controller are only possible by means of a
complete re-initialization, i.e. an entire initialization structure must be provided for each
register change (e.g. bit timing, acceptance filtering, .. ).
5.2 Transmission 5.2.1 Detailed Functional Description
This section shows the transmission of a CAN message using different methods. For the
general processing first a flow chart is used. The gray decision symbols branch to features
that can be removed from the CAN Driver using the configuration options (see
Figure 5-1).
In a second step sequence charts are used to show how the different objects of the CAN
Driver, description data and Application program work together.
©2010, Vector Informatik GmbH
Version: 3.01.01
27 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
STARTING POINTApplicationLeave Transmit InterruptCanTransmitYesCanTransmitQueuedObjNoQueue Empty
YesCAN offlineUse notNoUseTransmit QueueConfiguredPart offlinecheckNot configuredYesCAN offlineConfirmation Function
Not configuredYesPart offlineNoConfiguredConfirmation Function DefinedNoConfirmation Flag
Use QueueUseNot configuredConfiguredConfirmation FlagUse notDefinedTransmit Buffer Full
YesNoConfirm Transmission
Use notConfiguredPretransmit Function definedUseConfirmation of TransmissionPretransmit Function
Not configuredYesConfirm TxObserve
kCanCopyData
Use notUseNoUse TxObserveCopy DataSwitches in the Generation Tool for
optional features of the CAN DriverEnter Transmit InterruptDecisions in the code, if the feature is selected.Initiate TransmitOptional or mandatory functions of the CAN DriverNoend
Interrupt EnabledMandatory path through the CAN DriverQueue
UseUse TxObserveYesOptional path through the CAN DriverTxObserve Started
Use notDirection of work flowACKNOWLEDGE(sent message received)CAN Message
Transmit Figure 5-1 Transmission of a CAN message
©2010, Vector Informatik GmbH
Version: 3.01.01
28 / 149
based on template version 2.1
The main service function to initiate a transmit request is
vuint8 CanTransmit( CanTransmitHandle txObject );
The function parameter is a transmit message handle. It represents an index in the
generated transmit description data. The return code contains the following information:
kCanTxOk
Successful transmit request. The message is sent out by the
CAN Controller without any further action required. For CAN
Drivers with transmit queue, this return code is also used if the
transmit request has been accepted in the queue, even if it was
already in queue.
kCanTxFailed
CAN transmit request failed. In this case the calling application
has to repeat the transmit request later.
kCanTxPartOffline
Error code because CAN Driver’s transmit path is in partial
offline mode for this transmit object.
The left path (see
Figure 5-1) time flows from top to bottom. This path shows the program
flow calling the service function CanTransmit(..). First the CAN Driver checks whether the
transmit path is switched to offline state. If so the function returns with an error code. Then
the Driver checks (if configured) the partial offline mode. If the specified message is offline,
the function will return an error code.
In the next step the CAN Driver checks the availability of a hardware transmit object. If no
object is available the transmit request is stored in the transmit queue (if configured to be
used) and the CAN Driver returns to the Application with the return code kCanTxOk. If no
transmit queue is used the CAN Driver returns with an error code kCanTxFailed.
If a transmit object is available the CAN identifier and the data length code will be set in
accordance to the description data. Now, if a pretransmit function is configured, this
pretransmit function will be called. Within this user specific function the Application may
copy the data to be transmitted directly to the CAN Controller hardware registers. If the
data is completely copied, the pretransmit function returns kCanNoCopyData to the CAN
Driver.
The data has to be copied by the CAN Driver itself, if there is no pretransmit function
defined or this function returns kCanCopyData. In this case the CAN Driver copies the data
from the global data buffer associated with the message to the CAN Controller hardware
registers.
Then the transmission of the CAN message is started in the CAN Controller and the
function returns the code kCanTxOk to the Application.
Dependent on the configuration, the TxObserve function is now started.
In the right path of the figure below, the time flows from bottom to top. This path shows the
program flow in the interrupt service routine after a successfully transmission of the
message to the CAN bus. In the transmit interrupt routine, the confirmation actions are
performed. If configured, first the TxObservation is confirmed, then (if configured) a
©2010, Vector Informatik GmbH
Version: 3.01.01
29 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
confirmation function for all messages is called. Afterwards the confirmation flag is set and
then the message-specific confirmation function is called.
If the CAN Driver is configured to use a transmit queue, after processing the confirmation
actions the CAN Driver checks if the transmit queue is empty. If so the transmit interrupt
routine is finished. If there are entries in the queue the highest priority CAN message is
removed from the queue and the transmission of this message is requested. This is also
done on interrupt level.
In the middle of the picture we see the transmit queue which is used if all hardware
transmit objects are busy, when CanTransmit(..) is called.
The next sections describe the transmission of a CAN message using sequence charts.
The vertical lines within these diagrams represent program objects like interrupt routines,
functions (thick lines) or data objects (thin lines). The horizontal lines represent program
flow or data access within the program. Flow control and program instances are described
using thick lines, data access is described using thin lines. Time flows from the top of a
chart downwards so that sequence „1“ is performed before sequence „2“. The description
of the sequence charts is given in the tables following the charts.
The first sequence ch
art in Figure 5-2 shows the behavior if a hardware transmit object is
available, a global data buffer is associated to the message and the copy mechanism of
the CAN Driver is used.
CAN Data
TX Interrupt
Can-
Driver
Global Data
Conf.
CAN
Conf. Flag
Pretransmit
Application
Buffer
Routine
Transmit
Parameters Buffer
Function
1
2
3
4
5
6
7
8
9
10
Figure 5-2 Transmission with an available transmit object; Using global data buffer
No Description 1
The Application writes the data to the global data buffer
2
The Application calls CanTransmit(..) service function
3
Function uses description data (CAN identifier, DLC, etc...)
4
Global data buffer is read and copied; the transmit process is started
5
CanTransmit(..) service function is finished, the return code is kCanTxOk
6
The message is successfully sent to the CAN bus. Transmit interrupt routine is
started
7
Transmit confirmation flag is set (cleared by the Application)
©2010, Vector Informatik GmbH
Version: 3.01.01
30 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
8
Confirmation function is called
9
Confirmation functions returns to transmit interrupt routine
10
Transmit interrupt routine is left
The next sequence chart in shows the behavior if a hardware transmit object is available
and a pretransmit function is used to copy the data to be sent.
CAN Data
TX Interrupt Can-
Driver
Global Data
Conf.
CAN
Conf. Flag
Pretransmit
Application
Buffer
Routine
Transmit
Parameters Buffer
Function
1
2
3
4
5
6
7
8
9
10
11
Figure 5-3 Transmission with an available hardware transmit object; Using a pretransmit function to copy data
No Description 1
CanTransmit(..) service function is called by the Application
2
Function reads the description data (CAN identifier, DLC, etc.)
3
Call of the pretransmit function
4
Pretransmit function writes data to the CAN Controller
5
Pretransmit function returns to CanTransmit(..)
6
Start transmission; CanTransmit(..) service function is finished and the return code
is kCanTxOk
7
The message is successfully sent to the CAN bus. Transmit interrupt routine is
started
8
Transmit confirmation flag is set (cleared by the Application)
9
Confirmation function is called
10
Confirmation function returns to transmit interrupt routine
11
Transmit interrupt routine is left
©2010, Vector Informatik GmbH
Version: 3.01.01
31 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
The next sequence chart in shows the behavior, if no hardware transmit object is available.
This sequence chart is valid only if the CAN Driver is configured to use a transmit queue.
The data is copied by the CAN Driver itself.
TX Interrupt
Can-
Driver
Global Data
Conf.
CAN
CAN Data
Conf. Flag
Application
Buffer
Routine
Transmit
Parameters
Buffer
Pretransmit Function
1
2
3
4
5
6
7
8
9
10
Figure 5-4 Transmit procedure if no hardware transmit object available
No Description
1
The Application writes the data to the global data buffer
2
The Application calls CanTransmit() service function. No hardware transmit objects
available. Request is stored in the transmit queue.
3
Function returns kCanTxOk
4
Transmit interrupt: A (previous) CAN message was successfully sent, transmit object
is available again
5
Confirmation flag of the previous CAN message is set (cleared by the Application)
6
Confirmation function of the previous CAN message is called
7
Confirmation function return
8
The transmit queue is checked for requests. The pending transmit request is found.
The description data are evaluated (CAN identifier, DLC, etc...)
9
Global data buffer is read and copied; the transmit process is started
10 Transmit interrupt routine is left
5.2.2 Transmit Queue
The normal Tx object can be configured to use a transmit queue or not. The Transmit
Queue is not available for Full CAN Objects and the Low Level Transmit Object. If no
transmit queue is used, the Application is responsible to restart a transmit request if it
wasn’t accepted by the CAN Driver. In case of using a transmit queue, a transmit request
is always accepted (if the driver is online). But the transmit queue holds only the transmit
©2010, Vector Informatik GmbH
Version: 3.01.01
32 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
request of a CAN message. It doesn’t store the data to be sent. Please note the same
message can be queued only once. The CAN Driver sets a transmit request in the transmit
queue, if no hardware transmit object is available after CanTransmit(..) is called. On a
transmit interrupt, i. e. when a message has been sent successfully, the CAN Driver
checks whether transmit requests are stored in the queue. If so, one requests is removed
from the queue and the transmit request is executed. The search algorithm in the queue is
priority based, there is no FIFO strategy. This means the CAN identifier with the lowest
number is removed first from the queue.
If the CAN Driver is configured to use a transmit queue, the internal data copy mechanism
will be initiated and/or the pretransmit function will be called in the scope of a transmit
interrupt after the completion of a previous transmit request. Therefore the user has to
guarantee the data consistency, because an Application write access to the global data
buffer may be interrupted by such a transmit interrupt. If within this interrupt the associated
message is requested to be transmitted on the CAN bus, inconsistent data may be sent.
The Application must ensure data consistency by one of the following mechanisms:
Disable Interrupts while writing data to the global data buffer
Use the message based confirmation flag to manage the data access handling. On
startup the access right is on Application side. Calling CanTransmit(..) this access right
is given to the CAN Driver. As soon as the confirmation flag is set by the CAN Driver,
the access right is given back to the Application.
In polling mode the service function CanTxTask() must be used to transmit queued
messages. The transmission of a CAN message is only started if the CanTxTask() is
called. In polling mode every message is queued in the transmit queue. To ensure that
every message was send the CanTxTask() may be called cyclic.
5.2.3 Data Copy Mechanisms
There are two different methods for the Application to pass the data to be transmitted to
the CAN Driver. The CAN Driver selects the method for each message depending on the
CAN Driver description data. If no pretransmit function is defined, the usage of a global
data buffer is a prerequisite and the CAN Drivers internal data copy mechanism is always
used. If a pretransmit function is defined, the data to be transmitted may be stored
anywhere in the Applications memory and the user defined copy mechanism in the
pretransmit function is used.
5.2.3.1 Internal With the internal data copy mechanism, the Application writes the data to be transmitted to
a global data buffer associated with the transmit message. The global data buffer is
defined by the Generation Tool. The access to the global data buffer is done by means of
access macros and/or functions which are also defined by the Generation Tool. After
passing the data to the global data buffer, the Application initiates the transmit request by
calling CanTransmit(..) and the data is copied internally to the CAN Controller hardware
registers.
Important
Data consistency of CAN messages has to be guaranteed by the Application if
CanTransmit(..) is called on a higher interrupt or task level, or the transmit queue is
used.
©2010, Vector Informatik GmbH
Version: 3.01.01
33 / 149
based on template version 2.1




TechnicalReference Vector CAN Driver
5.2.3.2 User defined (“Pretransmit Function”) Using the pretransmit function to pass the data to be transmitted to the CAN bus, the
Application first initiates the transmit request by calling CanTransmit(..). Just before the
message is put in the CAN chip, the CAN Driver calls a user defined pretransmit function.
For each transmit message a separate pretransmit function may be defined. Within this
user specific function the user can write the data directly to the hardware registers of the
CAN Controller, but other tasks can also be performed. The return code of the pretransmit
function indicates to the CAN Driver whether the data are to be copied by the CAN Driver
internally from the global data buffer to the CAN Controller hardware registers or not (if it is
already done within the pretransmit function).
Important
Be careful if a pretransmit function is used. Interrupts are not disabled during the call of
this user specific function by the CAN Driver, therefore the restrictions for security level 0
are valid. If the interrupts are not disabled before and restored after the copy process by
the Application, data consistency of a CAN messages cannot be guaranteed if the
transmit queue is used.
5.2.4 Notification
After the successful transmission of a message on the CAN bus (i.e. at least one other
CAN bus node received the CAN message correctly with an acknowledge), the Application
can be notified by different confirmation mechanisms:
5.2.4.1 Data Interface (Confirmation Flag) If a confirmation flag is used, this message related flag is set by the CAN Driver, if the
associated CAN message was sent on the CAN bus. This is done in the scope of the
transmit interrupt. The flag must be cleared by the Application.
Important
Interrupts have to be disabled while the confirmation flags are being cleared, because of
the read-modify-write conflict if this operation is interrupted by a CAN transmit interrupt
routine. This can result in the loss of events.
5.2.4.2 Functional Interface (Confirmation Function for each message) In parallel or instead of the data interface a functional interface can be configured, i.e. user
specific function is called if the associated CAN message was sent on the CAN bus. This
is also done in the scope of the transmit interrupt and therefore special care of the run time
of this function has to be taken.
5.2.4.3 Functional Interface (Common Confirmation Function for all messages) A common confirmation function informs the application via
ApplCanTxConfirmation about
a successful transmission of a message. Any message is confirmed via this callback
function.
Info A canceled transmission will provoke a notification if the message was send on the bus.
If the message had been deleted out of the hardware, the application will not be notified.
More… ©2010, Vector Informatik GmbH
Version: 3.01.01
34 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
5.2.5 Offline Mode
The CAN Driver's transmit path can be switched to the offline state, i.e. disabled. In this
state no CAN messages are sent to the CAN bus. On each transmit request the CAN
Driver checks the internal flag which indicates whether the transmission is currently
disabled and the transmit service function returns an error code. This flag is set and reset
by the following CAN Driver service functions
void CanOnline( void );
void CanOffline( void );
These CAN Driver service functions are called by the Network Management or by the
Application (only if there is no Network Management available on a specific CAN channel).
The Application can be notified about the mode change (e.g. if the Network Management
calls CanOnline() or CanOffline()). This is done with the following callback functions:
void ApplCanOnline( void );
void ApplCanOffline( void );
5.2.6 Partial Offline Mode
The partial Offline Mode enables the application to prevent the transmission of groups of
CAN messages. CanTransmit() returns a special code, if the requested message cannot
be sent because of the active partial offline mode. The partial offline mode is implemented
by the following functions:
void CanPartOnline ( vuint8 sendGroup );
void CanPartOffline( vuint8 sendGroup );
vuint8 CanGetPartMode( void );
The partial offline mode can handle up to eight different groups of messages. The function
parameter sendGroup decides about this group. CanPartOffline() switches all messages of
one ore more send groups to the offline state. Earlier calls of CanPartOffline() are not
affected. CanPartOnline() switches one or more send groups back to online state.
Each message might be assigned to one or more send groups. The names of the send
groups are configurable. Each send group can be switched to offline or online by using the
generated define:
C_SEND_GRP_<name>
C_SEND_GRP_ALL can be used to switch all groups together to offline or online.
Example The following table shows, which message is assigned to which send group (CANgen
concept. For GENy concept, go to the next chapter.).
send group name 7 6 5 4 3 User2 User1 User0
©2010, Vector Informatik GmbH
Version: 3.01.01
35 / 149
based on template version 2.1



TechnicalReference Vector CAN Driver
MESSAGE1
x x
x
MESSAGE2
x
x
MESSAGE3
x x
Example for a possible program flow:
CanPartOffline(C_SEND_GRP_User0); MESSAGE2 is stopped to be send
CanPartOffline(C_SEND_GRP_User1); MESSAGE1 is stopped to be send
MESSAGE2 is still stopped to be send
status = CanGetPartMode(); status is equal to ( C_SEND_GRP_User0
| C_SEND_GRP_User1)
CanPartOnline(C_SEND_GRP_User0); MESSAGE1 is still stopped to be sent
MESSAGE2 can be sent again
CanPartOffline(C_SEND_GRP_User0 | C_SEND_GRP_3);
MESSAGE1 is stopped to be sent
MESSAGE2 is stopped to be sent
MESSAGE3 is stopped to be sent
CanPartOnline(C_SEND_GRP_ALL);
All send groups are online again. All
messages can be sent now.
Info If the offline mode and partial offline mode are used in parallel the offline
mode has ‘higher priority’. This means if the offline mode is set the function
CanTransmit always returns ‘kCanTxFailed’ independent of the current
partial offline state.
5.2.6.1 Partial Offline Mode with GENy
In GENy there are
8 Offline Modes (SendGroups)
Default name is UserX, but can be changed as shown in the illustration below. There
Offline mode 4 is changed to
MyGroup4.
5 Message Classes for
Default (0)
Appl
Nm
Tp
Diag
Il
©2010, Vector Informatik GmbH
Version: 3.01.01
36 / 149
based on template version 2.1



TechnicalReference Vector CAN Driver
All messages are assigned automatically to a message class using their attribute
information from the DBC file.
Figure 5-5 Partial Offline Mode settings in GENy
Info You find this information in the configuration view of the CAN Driver.
With the checked checkbox for OfflineMode4 (Message Class 1 (APPL) all application
messages are assigned to the Offline Mode 4.
If you select an application message, you will find the following:
©2010, Vector Informatik GmbH
Version: 3.01.01
37 / 149
based on template version 2.1



TechnicalReference Vector CAN Driver
Figure 5-6 One Single Application Message Selected
At the Message Class entry you see this is an application message and below you see
your MyGroup4 and a checked checkbox. I.e. this message is assigned to MyGroup4.
Figure 5-7 User Defined assignment to Offline Modes
For any message you can decide whether to assign the message to another Offline Mode
or to additionally assign the message to another Offline Mode. In the example above, the
messate DummyTransmit (application message) is not assigned to MyGroup4 anymore.
Now this message is assigned to USER2.
©2010, Vector Informatik GmbH
Version: 3.01.01
38 / 149
based on template version 2.1




TechnicalReference Vector CAN Driver
Figure 5-8 Overview Messages and Offline Modes
Info If you cannot find any information concerning Offline Modes you should use the
Customize Grid functionality. Activate the view below via:
View|Customize Grid and
then select
Offline Modes.
To get an overall view of which message is assigned to which group, or to do the
necessary assignments having a good overview, select all
TxMessages in the tree view
and activate the Offline Modes via Customize Grid (described at the top of this chapter).
5.2.7 Passive State
The CAN Driver's transmit path can be switched to the passive state. In passive state no
transmit request is passed to the CAN bus, i.e. no CAN message is sent. However, there
is only the CAN bus activity affected but not the Application interface because there is no
error code returned and the notification is done in the normal way, i.e. the Application
software runs in normal operating mode. This is the main difference to the offline mode.
The passive state may be used to localize errors in a CAN bus and is realized by the
following CAN Driver service functions
void CanSetActive ( void );
void CanSetPassive( void );
©2010, Vector Informatik GmbH
Version: 3.01.01
39 / 149
based on template version 2.1



TechnicalReference Vector CAN Driver
The passive state of the CAN Driver is usually used during the development phase of the
CAN bus. If an Application might disturb the other nodes, it can be switched to passive
state temporarily and simulated by an appropriated tool. This is usually done by a
Diagnostics.
Info To use the Passive State efficiently there must be a special support by the network
designer. An external tool must be able to take over the tasks of the ECU simultaneously
when the ECU is switched to passive state.
The passive state of the CAN Driver must not be mixed up with the passive state of
OSEK Network Management. If the OSEK Network Management is put into passive
state (service functions SilentNM / TalkNM) only Network Management messages are
affected. The passive state of the CAN Driver prevents any CAN messages (including
Network Management messages) from being sent on the CAN bus.
Also note the following hints for the usage of the passive state:
If the passive function is enabled the corresponding code in CanSetPassive() and
CanSetActive() is activated, otherwise only dummy macros will be provided. This results
in less CAN Driver code and an easy way to switch off this service function without
changing the Application software.
The Application calls the service function CanSetPassive() to prevent transmission. In
case of a transmit queue it is cleared, i.e. confirmation activities may be lost during the
transition from active to passive state. Beginning with the next CanTransmit() the
messages are not sent on the CAN bus until CanSetActive() is called.
In case of a transmit queue, the service function CanSetPassive() has to be called in
the confirmation function of the last message to be sent on the CAN bus. If there is no
such request, CanSetPassive() can be called at any time.
In passive mode, the result seems to be successful, i.e. the code kCanTxOk is returned
from CanTransmit(), and all configured flags (cleared by the Application) are set and the
functions are called (Common Confirmation Function, Confirmation Flag and/or
Confirmation Function). Tx Observation is not used in passive state.
To restart transmission, the service function CanSetActive() has to be called. Starting
with the next call of CanTransmit(), the messages are transmitted again on the CAN
bus.
Important
If the CAN Driver is switched from active to passive state, the transmit queue will be
cleared and therefore some confirmations may be lost.
5.2.8 Tx Observe
This functionality is used to check the transmit path of the CAN Driver by the following
way: After a successful transmit request in the CAN Controller a specific function is called:
void ApplCanTxObjStart( logTxHwObject );
©2010, Vector Informatik GmbH
Version: 3.01.01
40 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
If the message was sent on the CAN network successfully another callback function is
called in the scope of the transmit interrupt:
void ApplCanTxObjConfirmed( logTxHwObject );
This functionality can be used to observe any transmission. As the CAN Driver is not time
triggered, the call back functions offer the application a way to start a timer with
ApplCanTxObjStart and stop this timer with ApplCanTxObjConfirmed. In case of exceeding
a predefined time for transmission, the message can be deleted or any other reaction can
be done.
In case of a well working system, these callback functions are normally called in a
symmetric way within the maximum specified delay time which is allowed in the existing
run time environment after a transmit request until the CAN message is sent to the CAN
bus successfully. In case of a transmit error a time-out supervision can be implemented by
these callback functions and error recovery can be done. If more than one hardware
transmit object is used, these callback functions can be called in a nested way and so an
additional counter is necessary. That counter has to be reset after each re-initialization of
the CAN Controller. This can be done in the following callback function:
void ApplCanInit( logTxHwObjectFirstUsed,
logTxHwObjectFirstUnused);
5.2.9 Cancellation of a Transmission
There are several ways to cancel a requested transmission.
5.2.9.1 Cancel a Transmission via CanInit CanInit initializes the CAN controller hardware and can therefore be used to cancel any
current transmission. (see
Re-Initialization of the CAN Controller). Some controllers do not
stop their transmission immediately, so it is possible that the Cancellation via CanInit()
could lead to an errorframe on the bus.
5.2.9.2 Cancel a Transmission via CanCancelTransmit or CanCancelMsgTransmit Both functions work the same way, except that CanCancelTransmit cancels a transmission
initiated via CanTransmit and CanCancelMsgTransmit cancels a transmission initiated via
CanMsgTransmit.
The call of the confirmation function or the setting of the confirmation flag are suppressed,
if this message is already in the transmit buffer of the CAN Controller. If the transmit queue
is enabled, a pending transmit request in the queue is canceled.
These functions also delete messages in the hardware transmit buffer if configured. But
this feature is strongly dependent of the hardware. Some CAN Driver / CAN Controller
require the call of CanRxTask() / CanTxTask() to be able to continue.
Using the cancel functions out of the Tx observe functionality (see above) the handle for
the functions must be obtained via the functi
on CanTxGetActHandle(CanObjectHandle
logTxHwObject). The return code decides whether it was a CanTransmit or a
CanMsgTransmit which causes a
CanCancelTransmit or a CanCancelMsgTransmit.
©2010, Vector Informatik GmbH
Version: 3.01.01
41 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
CanTransmitHandle Hdl;
Hdl = CanTxGetActHandle(logTxHwObject);
if(Hdl == kCanBufferMsgTransmit)
{
CanCancelMsgTransmit(Hdl);
}
else if(Hdl < kCanBufferMsgTransmit)
{
CanCancelTransmit(Hdl);
}
else if(Hdl > kCanBufferMsgTransmit)
{
/* The Tx request was confirmed or cancelled, or no Tx request is pending. */
}
5.2.9.3 Notification about Cancellation of a message The application can be notified each time the transmit request or the pending confirmation
is cancel. That means either the message based confirmation (flag or function) or the
cancel notification will be executed after successful call of CanTransmit() or
CanMsgTransmit().
To enable the notification the flag “CAN Cancel Notification” in the Generation Tool must
be selected. If this flag is set a Callback function informs the Application about that a
message was cancelled. ApplCanCancelNotification() will be called if the transmit request
was initiated via CanTransmit(), ApplCanMsgCancelNotification() will be called if the
request was set up via CanMsgTransmit().
©2010, Vector Informatik GmbH
Version: 3.01.01
42 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
5.2.10 Overview of Transmit Objects
The table shows the naming for different RI versions. Some of the features of the column
are hardware dependent.
Names before RI 1.4 Names RI 1.4 Names RI 1.5 and later Transmit Object
Normal Transmit Object
Normal Transmit Object
Direct Transmit Objects
Full CAN Transmit Object
Full CAN Transmit Object
--- Direct
Transmit
Objects
---
Dynamic Transmit Objects
Dynamic Transmit Objects
Dynamic Transmit Objects
Low Level Message Transmit Low Level Message Transmit
Low Level Message Transmit
5.2.11 Normal Transmit Object
A Normal Transmit Object is the hardware transmit object supported by all CAN Drivers. All
transmit messages that are not assigned to a Full CAN Transmit Object will be transmitted
via this Normal Transmit Object. The transmit queue works only on this object and the
Dynamic Transmit Objects can only be transmitted via this object, too.
5.2.12 Full CAN Transmit Objects
Each Full CAN Transmit Object has its own Hardware Transmit Object. This means a Full
CAN Transmit Object holds exactly one CAN message with a specific CAN identifier and
DLC. These CAN messages are statically assigned by the Generation Tool. Changes of
this reference during run time are not possible. There are two reasons for Full CAN
Transmit Object:
1. The associated CAN message object is never occupied by another transmit request
2. There is no need to copy the CAN identifier and the DLC. The message data can also
be stored directly in the CAN Controller and the transmit request can be initiated
directly.
Info Full CAN objects are sent via CanTransmit() function.
5.2.13 Dynamic Transmit Objects
The CAN Driver supports the transmission of CAN messages with dynamic parameters.
These messages must not be specified in the CAN database. This feature can be used in
gateways, for example.
These dynamic objects can consist of mixed dynamic and static parts. CAN identifier, DLC
and data pointer can be selected separately as dynamic or static. The selection is common
for all dynamic objects. Pretransmit functions and confirmation functions are always static.
The CAN identifier priority for dynamic objects is lost if a transmit queue is used. Dynamic
objects have a higher internal priority than static objects, independent of their current CAN
identifier.
©2010, Vector Informatik GmbH
Version: 3.01.01
43 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Before the Application can use a dynamic object, the Application needs to reserve one.
This can be done by the following service function:
CanTransmitHandle CanGetDynTxObj( CanTransmitHandle txHandle);
The next step is to set all dynamic parameters of this object. This will be done by calling
the service functions:
void CanDynTxObjSetId ( ... );
void CanDynTxObjSetExtId ( ... );
void CanDynTxObjSetDlc ( ... );
void CanDynTxObjSetDataPtr ( ... );
After this, the dynamic object can be transmitted by calling CanTransmit(..) with the handle
of the dynamic object. The Application is allowed to use a dynamic object several times. If
the Application doesn’t need the dynamic objects any more, it can be released by the
service function
vuint8 CanReleaseDynTxObj( CanTransmitHandle txHandle );
There are two macros to allow a call of CanReleaseDynTxObj() in a confirmation function.
Both macros are only allowed to be called in the context of the user confirmation function
of this Dynamic Object.
CanConfirmStart(txHand This macro enables release of dynamic objects in a confirmation
le) function.
txHandle has to be equal to the parameter of the confirmation
function.
CanConfirmEnd() This macro restores security mechanism for release of dynamic
Objects.
Example:
void Confirm_ResDynTxObj ( CanTransmitHandle txHandle )
{
…
CanConfirmStart(txHandle);
if (CanReleaseDynTxObj( txHandle )== kCanDynNotReleased)
{ //error handling }
CanConfirmEnd();
…
}
If a dynamic object is used several times, the Application has to take care to use the
confirmation flag / function.
The maximum number of Dynamic Transmit Objects must be defined statically in the
Generation Tool.
Messages of dynamic transmit objects can not be sent via Full CAN Transmit Objects.
©2010, Vector Informatik GmbH
Version: 3.01.01
44 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
5.2.14 Priority of Transmit Objects
Message IDPriorityLow 0
Full CAN Transmit Objects
High n
Normal Transmit Object
Low Level Transmit Object
(High End)
Figure 5-9 Priority of Transmit Objects
Full CAN Objects have the highest priority and they are sorted according to their ID. This is
automatically done by the Generation Tool.
There is only one Normal Transmit Object with a lower priority than the Full CAN Objects.
Dynamic Transmit Objects are transmitted via the Normal Transmit Object.
The Low Level Message Transmit Object has the lowest priority.
This priority is only valid, if the hardware is not able to arbitrate according the IDs.
©2010, Vector Informatik GmbH
Version: 3.01.01
45 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
5.3 Reception 5.3.1 Detailed Functional Description CAN Message
ReceiveNo Action
Message not acceptedHardwareAcceptance FilterMessage acceptedInterrupt Request
NoInterrupt Enabledis stored
YesEnterReceive InterruptUseUse Receive FunctionReceive Function
Use notNokCanCopyData
YesUseRangeFilterNoMatch?
YesRange/Component
PreCopy Function
kCanNoCopyDataUseUseMessageMessage not matchedSoftwareMessage Not Matched
NotMatchedAcceptance FilterMessage acceptedUse notUseCheck DLCUse notUseFailedDLC Failed
UseDlcFailedDLC Check
OkUse notUseUse Generic PrecopyGeneric
Use notPreCopy Function
NokCanCopyData
YesDefinedPrecopy definedNot definedPrecopy Function
NokCanCopyData
Switches in the Generation Tool for
optional features of the CAN DriverYesDecisions in the code, if the feature is selected.Optional or mandatory functions of the CAN DriverCopy DataMandatory path through the CAN DriverDefinedIndication Flag Optional path through the CAN DriverdefinedDirection of work flowIndication Flag
Not definedDefinedIndication FunctiondefinedIndication Function
Not definedLeaveReceive Interrupt end
Figure 5-10 Reception of a CAN messages
©2010, Vector Informatik GmbH
Version: 3.01.01
46 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
CAN messages are received asynchronously and without any explicit service function call.
Normally, the CAN Driver is informed by the CAN Controller via interrupt of the reception of
a CAN message. That means the received CAN identifier has passed the hardware
acceptance filtering of the CAN Controller and the entire message is stored in a receive
register. In case of a Basic CAN object, the message has to be retrieved and processed as
fast as possible. If a feature is only in Basic CAN or Full CAN available if is mentioned in
the text.
The gray decision symbols branch to features that can be removed from the CAN Driver
using the configuration options of the Generation Tool. Disabled features cannot be used
for any messages. The code for these features is completely removed. If a feature is
enabled, it can be determined for each message whether it is used or not.
The receive callback function ApplCanMsgReceived(..) is called on every reception of a
CAN message after the hardware acceptance filter is passed. Within this function the
Application may preprocess the received message in any way (ECU specific dynamic
filtering mechanisms, gateway functionality, etc...). If the function returns kCanCopyData,
the CAN Driver continues the processing. If the function returns kCanNoCopyData, the
CAN Driver terminates the message reception.
During the software acceptance filtering (only available for Basic CAN) the CAN Driver first
checks for range specific identifiers. For the range specific identifiers special precopy
functions may be defined. Afterwards the single CAN identifier based filtering is performed.
The CAN Drivers support different mechanisms like linear search, hash search or an index
search. In any case the filtering capabilities of the CAN Controller are used. The
corresponding receive object has to be determined by comparing the generated CAN
identifier in the data description tables with the received CAN identifier in the Basic CAN
object.
If the result of the software acceptance filtering is negative (only done for a Basic CAN
object), the callback function ApplCanMsgNotMatched() is called. Then the receive
interrupt is terminated immediately after the CAN Controller hardware is serviced.
After a CAN identifier match, the DLC will be checked. In case of a failed DLC check there
can be a configured callback function to notify the application.
In case of a successful DLC check the generic precopy function is called (if configured).
Generic precopy means that a common function named ApplCanGenericPrecopy() is
called for all identifiers. If this function returns kCanNoCopyData the CAN Driver
terminates further processing. If this function returns kCanCopyData, the CAN Driver
continues to work on the message received.
After the generic precopy if configured a precopy function separate for each message
according to the entry in the description data is called. Within this user specific function
any processing of the message received may occur (complete processing of a message or
special storage methods like ring buffers, FIFOs, ...). If the precopy function returns
kCanNoCopyData the CAN Driver terminates further processing. If the precopy function
returns kCanCopyData, the CAN Driver continues to work on the message received.
In the next step the data is copied to the global data buffer. The CAN Driver copies only
the number of bytes from the CAN receive buffer that is stored in the array CanRxDataLen.
©2010, Vector Informatik GmbH
Version: 3.01.01
47 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Then the indication actions defined for this message are performed. This means the
indication flag is set and/or the indication function is called. The Application has to reset
the indication flag before or after data processing.
In the following sections the processing steps are described using sequence charts. The
vertical directed lines within these diagrams represent program objects like interrupt
routines, functions or data objects. The horizontal lines represent program flow or data
access within the program. Within the sequence charts below flow control and program
instances are described using thick lines, data access is described using thin lines. Time
flows from the top of a chart downwards so that sequence „1“ is performed before
sequence „2“. The description of the sequence charts is given in the tables following the
charts.
CAN Data
RX Interrupt Driver
Global Data Indication
ApplCan-
CAN
Precopy
Indication
Application
Buffer
Routine
Parameters
Buffer
Flag
MsgReceived
1
2
3
4
5
6
7
8
Figure 5-11 Reception of a CAN message: The data is completely processed in the precopy function
No Description
1
A CAN message has passed the hardware acceptance filtering, the receive interrupt
routine is triggered
2
If configured, the ApplCanMsgReceived() callback function is called
3
The ApplCanMsgReceived() callback function returns kCanCopyData
4
Software acceptance filtering and identification of the received CAN message
5
If configured, the precopy function is called. The Application is able to take control over
the receive process immediately after the software acceptance filtering and direct access
to the CAN Controller receive register is possible.
6
Within the precopy function the data in the CAN Controller hardware registers are read
and completely processed.
7
The precopy function returns kCanNoCopyData. No further processing (copying of data,
indication actions) occurs in the CAN Driver
8
After servicing the CAN Controller hardware (the receive registers of the CAN Controller
are released), the receive interrupt routine is left.
Info 1. If the ApplCanMsgReceived() callback function returns kCanNoCopyData, the
received message is ignored. This means no further software filtering, no precopy, no
©2010, Vector Informatik GmbH
Version: 3.01.01
48 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
copying of data and no indication actions are performed.
2. If the precopy function returns kCanNoCopyData, no copying of data and no
indication actions are performed.
RX
CAN Data
Driver
Indication
ApplCanMsg
Interrupt
Global Data
CAN
Buffer
Parameters
Flag
Precopy
Indication
Receive
Application
Routine
Buffer
1
2
3
4
5
6
7
8
9
10
11
Figure 5-12 Reception of a CAN message: The CAN Driver internal copying mechanism is used
No Description 1
A CAN message has passed the hardware acceptance filtering, the receive interrupt
routine is triggered
2
If configured, the ApplCanMsgReceived(..) callback function is called
3
The ApplCanMsgReceived(..) callback function returns kCanCopyData
4
Software acceptance filtering and identification of the received CAN message
5
If configured, the precopy function is called. The Application is able to take control
over the receive process immediately after the software acceptance filtering and the
direct access to the CAN Controller receive register is possible.
6
The precopy function returns kCanCopyData. The CAN Driver continues its normal
processing.
7
The received data are copied from the CAN Controller receive register to the global
data buffer associated to the CAN message
8
If configured, the indication flag is set (must be reset by the Application)
9
If configured, the indication function is called; any user actions can be performed
within this user specific function
10 Indication function returns to the receive interrupt routine
11 Receive interrupt routine is left
©2010, Vector Informatik GmbH
Version: 3.01.01
49 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
5.3.2 Receive Function
Before the software filtering is done, the Application optionally may use the
ApplCanMsgReceived() callback function called by the CAN Driver. Within this function the
Application can define whether to process the message received or not.
5.3.3 Range-Specific Precopy Functions
The CAN Driver's receive path can be configured to filter special identifier ranges and
associated precopy functions will be called directly. Up to four ranges are supported by the
CAN Driver. The ranges must be defined by a start address (e.g. 0x400) and a mask (e.g.
0x1F, i.e. if a bit is set it means don’t care) and leads to a specific range (in our example it
is from 0x400 to 0x 41F). The ranges are typically predefined by the Generation Tool for
special functions. If these are not used they are available for the application:
Range 0 Network
If the usage of a Network Management is configured
Management
Application
Application specific. May be used by the Application
Range 1 Diagnostics
If extended addressing mode of the Transport Protocol is configured
Application
Application specific. May be used by the Application
Range 2 Special usage
Car manufacturer specific
Application
Application specific. May be used by the Application
Range 3 Application
Application specific. May be used by the Application
Special capabilities of some CAN Controllers with several hardware acceptance filters may
also be used for the range specific filtering.
5.3.4 Identifier Search Algorithms
The following software filtering mechanisms are supported: All mechanisms but linear are
optional in the different hardware implementations.
Linear Search:
The identifier of the incoming message is compared to all CAN
identifiers in a table (if found, the search stops). The average search
time is proportional to the number of receive messages.
Hash Search:
An optimized search algorithm with a small known number of search
steps. The Generation tool calculates an optimized search table and
some parameters used at run time. The number of search steps can
be defined by the user. The less search steps the bigger the resulting
hash tables.
Table Search:
This is a kind of hash mechanism. The last three bits of a CAN
identifier are used as a selector for the search table. There are 8
different tables for each of the hardware acceptance filters in the
CAN Controller. Within the table a linear search is implemented.
Index Search:
A table with 2048 entries (one entry for each identifier) is used for
software filtering. Index Search is used for Standard ID only.
©2010, Vector Informatik GmbH
Version: 3.01.01
50 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
5.3.5 DLC check
The Data Length Code of a received message will be compared to the length of the
Application receive buffer of this message. If the DLC is smaller than the Application
receive buffer, data will not be copied. The length of the received message buffer is the
maximum length which is necessary to treat all signals for this ECU. To inform the
application the callback function ApplCanMsgDlcFailed will be called. The reception
process will be terminated afterwards.
Depending on the OEM the length of the received data bytes can be different at run time. It
is also possible to compare the length of the received message with a minimum length
which can be smaller than the Application receive buffer.
The behavior can be configured via generation tool and the database attribute
GenMsgMinAcceptLength.
5.3.6 Data Copy Mechanism
There are two different methods for the Application to access the data received from the
CAN bus.
5.3.6.1 Internal Using the internal data copy mechanism, the CAN Driver copies the contents of the CAN
controller receive registers to a global data buffer associated to the receive message. The
Application can access the signal values in the message specific data buffer using access
macros or functions. The access macros are generated by the Generation Tool using
information in the CAN database. The signal access macros always return
unsigned
values.
The Application itself is responsible for the data consistency of signals in a CAN message
which cannot be handled in atomic operations because the receive buffer may be
overwritten asynchronously by a CAN receive interrupt. Different mechanisms can be used
to guarantee data consistency:
1. Disabling of the CAN receive interrupt.
2. Read the receive signal. Compare the signal value with the signal in the hardware
buffer. Repeat the read operation if the values differ.
3. Usage of the message based indication flag:
3.1 Clear the message indication flag
3.2 Read the data (one or more signals of a message)
3.3 Check the message indication flag: If set then return to 3.1
Depending on the OEM the length of the received data bytes can be different at run time.
Instead of copying all needed bytes (equal to the length of the global data buffer
associated to the receive message) the CAN Driver can be configured to copy the number
of received bytes. In case the number of received bytes exceed the length of the data
buffer, the CAN Driver takes care to copy at maximum the length of the data buffer.
©2010, Vector Informatik GmbH
Version: 3.01.01
51 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Info The signal access macros are not affected. The application has to make sure, that it
does not access data via access macros that is not copied now because of a change of
the data length.
5.3.6.2 User-defined Precopy Functions The user can define specific precopy functions for each receive object in the Generation
Tool. If defined, the CAN Driver calls this user-specific function immediately after the
software filtering. Within this precopy function the Application can access the data directly
in the CAN Controller receive registers. The precopy function indicates this to the CAN
Driver by the appropriate return code kCanNoCopyData and the further processing will be
terminated immediately. On the other side the CAN Driver can be forced to continue with
normal processing of the message after the precopy function by using the return code
kCanCopyData.
The parameter of the precopy function is a pointer to a structure. This structure includes
the handle of the received message and a pointer to the received data.
A separate user-specific function may be defined for each receive message. But it is also
possible to use the same function for different messages.
If no such function is defined, a NULL pointer is written to the corresponding description
data by the Generation Tool.
The user has to note that these user-specific functions are called in the receive interrupt.
Only short receive actions should be done to avoid negative influence on the Application
task by a long interrupt disable time.
The precopy mechanism can be used to handle only a small number of receive signals in
an efficient way, if there is a CAN receive message with 8 bytes but the receiving ECU for
example only needs the 6th bit of the 7th byte. The standard copy routine starts always at
the beginning of the receive data buffer and copies all data up to the last byte with
significant signals for the dedicated node (the 7th byte in the example above). This results
in some overhead in RAM and run time, particularly if these signals are mapped in the rear
part of the message. The precopy function can therefore be used to implement a user
specific copy routine and has to return the return code kCanNoCopyData.
Another example for a precopy function is a compare mechanism between the CAN
Controller receive register and the global Application buffer. If both are matching, data
have not to be copied and the indication is not necessary, i.e. kCanNoCopyData is
returned. Otherwise the return code kCanCopyData leads to the standard copy
mechanism of the CAN Driver and notification to the Application using indications.
The precopy function can also be used to implement receive queues (FIFO, FILO or ring
buffer).
5.3.7 Notification
After the reception of a message from the CAN bus and the successful hardware and
software acceptance filtering, the Application can be notified by different indication
mechanisms:
©2010, Vector Informatik GmbH
Version: 3.01.01
52 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
5.3.7.1 Data Interface (Indication Flag) If an indication flag is used, this message related flag is set by the CAN Driver, if the
associated CAN message was received. This is done in the scope of the receive interrupt.
The flag must be cleared by the Application.
Caution
Interrupts have to be disabled during reset of the indication flags because of the read-
modify-write conflict if this operation is interrupted by a CAN receive interrupt routine.
This can result in the loss of events.
5.3.7.2 Functional Interface (Indication Function) In parallel or instead of the data interface a functional interface can be configured, i.e. a
user-specific function is called if the associated CAN message was received. This is also
done in the scope of the receive interrupt and therefore special care on the run time of this
user-specific function has to be taken. A special notification mechanism for the Application
can be implemented in such an indication function.
5.3.8 Not-Matched Function
If a CAN message has passed the hardware acceptance filtering but is rejected by the
software acceptance filtering (in case of a Basic CAN receive object) a special callback
function will be called (if configured):
void ApplCanMsgNotMatched( ... );
5.3.9 Overrun Handling
An Overrun appears if a CAN message is lost in the Basic CAN receive object, because
the other was not treated yet entirely. There are two possibilities how a message could be
lost. In some cases the old message was overwritten with a new message. In other cases
a new message couldn’t be received.
If enabled, the Application has to provide an overrun callback function:
void ApplCanOverrun( void );
The overrun handling itself is done by the CAN Driver.
5.3.10 Full CAN Overrun Handling
A Full CAN Overrun appears if a CAN message is lost in the Full CAN receive object,
because the other was not treated yet entirely. There are two possibilities how a message
could be lost. In some cases the old message was overwritten with a new message. In
other cases a new message couldn’t be received.
If enabled, the Application has to provide an overrun callback function for Full CAN
objects:
void ApplCanFullCanOverrun( void );
The overrun handling itself is done by the CAN Driver
©2010, Vector Informatik GmbH
Version: 3.01.01
53 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
5.3.11 Conditional Message Received
The Conditional Message Received function ApplCanMsgCondReceived() will be
conditional called for each reception of a CAN message. The condition can be set / reset
and read by application via CanResetMsgReceivedCondition(),
CanSetMsgReceivedCondition(), and CanGetMsgReceivedCondition(). The condition is
automatically set by CanInitPowerOn() and CanSleep().
5.4 Bus-Off Handling There are several functions provided by the CAN Driver to handle a BusOff state of the
CAN Controller after severe transmit errors. For some CAN Controllers a re-initialization
must be done to satisfy the hardware requirements others are changing automatically to
the 'Error Active' state after 128 x 11 recessive bits on the CAN bus as it is specified in the
CAN protocol. Nevertheless it is recommended by most of the customer specific CAN bus
specifications to re-initialize the CAN Controller in every case, because the transmit error
might be caused by a faulty bit in the CAN Controller registers, e.g. bus timing registers, in
case of EMC influences. The following service functions have to be used by the
Application to handle a BusOff error:
void CanResetBusOffStart( CanInitHandle initObject );
void CanResetBusOffEnd( CanInitHandle initObject );
Typically an extension (compared to the CAN protocol specific requirements) of the error
recovery time for the CAN bus is implemented. This is done by switching the CAN Driver's
transmit path to off using the service function CanOffline(). Because of recursive calls of
some CAN Driver service functions, CanResetBusOffStart(..) and CanResetBusOffEnd(..)
are only allowed to be called in the offline mode of the CAN Driver, i.e. CanOffline() has to
be called before.
Typically the Network Management handles BusOff errors. In such case there are no
additional activities necessary by the Application. If no Network Management is used, the
Application has to provide a callback function
void ApplCanBusOff( void );
This callback function is called by the CAN Driver in case of BusOff. The error handling as
described above has to be done in this function. CanOnline has to be called outside of this
function on task level.
Important
For CAN controller which has autorecovery after BusOff detection we don’t recommend
to use the status polling. If using status polling with autorecovery it could happen, that
the application doesn’t detect a BusOff because a transmit request was detected first
and the application wasn’t informed about the BusOff.
©2010, Vector Informatik GmbH
Version: 3.01.01
54 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
5.5 Sleep Mode Some CAN Controllers support a special power-down mode with reduced power
consumption which is typically called sleep mode. This mode will be entered by the
following service:
vuint8 CanSleep( void );
Important
Before entering the sleep mode, some hardware specific preconditions have to be
ensured, e.g. the CAN Controller transmit registers have to be empty. It has to be
guaranteed, that the following service functions are called before CanSleep():
void CanOffline( void );
void CanResetBusSleep( CanInitHandle initObject );.
The return to normal mode will be initiated by an explicit request of the Application:
vuint8 CanWakeUp( void );
Sleep mode is not supported by all CAN Controllers. If not, both related service functions
are provided to guarantee a unified service function interface for all CAN Drivers and to
make the Application mostly hardware independent. However, the functions itself have no
effect on the CAN Controller.
A subset of CAN Controllers, which are supporting a sleep mode in principle, are able to
be awakened by any CAN bus activity, i.e. a dominant level on the CAN bus. This wake-up
by CAN is an asynchronous event, normally detected by a special wake-up interrupt. The
Application will be notified by the following callback function:
void ApplCanWakeUp( void );
This callback function has to be provided by the Application. CanWakeUp() doesn't have to
be called in this case, because the CAN Controller returns to normal mode automatically
or initiated by the CAN Driver before this function call. Other communication related issues
like the activation of the bus transceiver hardware used or the return to the online mode
(see CanOnline()) have to be done in this callback function or as a consequence of this
event.
If a CAN Controller doesn't support a wake-up by the CAN bus, other hardware
substitutions like an external interrupt based on the CAN Controller's Rx line have to be
implemented.
The application should check the return value of CanSleep() and CanWakeUp() in
every case to get the status of the CAN Controller. If CanSleep() returns kCanFailed
the CAN controller hasn’t entered into sleep mode. If CanWakeUp() returns kCanFailed
the CAN controller has not woken up. The application has to decide how to react on this
behavior.
If sleep mode is not entered, no CAN wake-up interrupt will be generated on detection of
any message on the CAN bus. The callback function ApplCanWakeUp() will not be called
and as a consequence the bus transceiver will not be initialized. This may lead to a
deadlock. Therefore it is necessary to call CanSleep() successfully to build a wake-up
capable system.
©2010, Vector Informatik GmbH
Version: 3.01.01
55 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
There is a limit
ation in the access to the API in Sleep mode.
The implementation of this functionality is very hardware dependent. See also CAN
controller specific documentation TechnicalReference_CAN_<hardware>.pdf [#hw_sleep].
5.6 Special Features 5.6.1 Status
Some internal software states of the CAN Driver and hardware states of the CAN
Controller can be read by the return code of the following service function:
vuint8 CanGetStatus( void );
In detail this is the following information:
CAN Controller is in sleep mode (CanSleep() was called)
CAN Controller is in stop mode ( CanStop() was called )
CAN Driver transmit path is in offline mode(CanOffline() was called)
current error states of the CAN Controller (Error-Active, Warning, Error-Passive or Bus-
Off)
Not all of the CAN protocol specific bus states are supported by each CAN Driver. Please
refer to the CAN Controller related section of the CAN Driver documentation for details
TechnicalReference_CAN_<hardware>.pdf [#hw_status].
There are special macros to provide an easier access on the single information in the
return code. These macros are true (not equal to 0) if the specific condition is valid and
false (equal to 0) if not. The parameter of this macros is the status, i.e. the return code of
CanGetStatus():
vuint8 CanHwIsOk ( vuint8 status );
vuint8 CanHwIsWarning( vuint8 status );
vuint8 CanHwIsPassive( vuint8 status );
vuint8 CanHwIsBusOff ( vuint8 status );
vuint8 CanHwIsSleep ( vuint8 status );
vuint8 CanHwIsWakeUp ( vuint8 status );
vuint8 CanHwIsStop ( vuint8 status );
vuint8 CanHwIsStart ( vuint8 status );
vuint8 CanHwIsOffline( vuint8 status );
vuint8 CanHwIsOnline ( vuint8 status );
If the hardware status information isn’t used by the Application this part of the functionality
can be disabled.
©2010, Vector Informatik GmbH
Version: 3.01.01
56 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
5.6.2 Stop Mode
The function CanStop() switches the CAN controller hardware to a state in which the CAN
controller doesn’t influence the communication of other nodes on the bus. For example no
hardware acknowledge is given, messages can’t be transmitted or received. In this state
the Can controller can’t be activated by activities on the CAN bus.
The function CanStart() reactivates the CAN controller hardware again.
The implementation of this functionality is very hardware dependent. See also CAN
controller specific documentation TechnicalReference_CAN_<hardware>.pdf [#hw_stop].
5.6.3 Remote Frames
The CAN Driver ignores remote frames and doesn’t answer on a remote request.
5.6.4 Interrupt Control
The interrupt control of the CAN Driver is done by the service functions
void CanGlobalInterruptDisable( void );
void CanGlobalInterruptRestore( void );
These functions have been moved to VstdLib. Only macros for compatibility reasons are
still provided in the CAN Driver:
#define CanGlobalInterruptDisable VStdSuspendAllInterrupts
#define CanGlobalInterruptRestore VStdResumeAllInterrupts
...more information see in the technical reference of the VStdLib.
(TechnicalReference_VstdLib.pdf).
5.6.4.1 Security Level The security levels can be used to guarantee the data consistency of a complete CAN
message during the copy process (this is a must, because the CAN Driver does not know
anything about the signal structure of the message) and the access to the notification flags
(indication and confirmation). During these operations the interrupt lock time is as short as
possible. Depending on the program scope with access to CAN message signals,
indication or confirmation flags in the Application the following actions in the CAN Driver
have to be realized without any interruption:
Copy process for receive messages (in the scope of the receive interrupt)
Copy process for transmit messages (in the scope of CanTransmit(..) or in a pretransmit
function)
Set of indication and confirmation flags (in the scope of the receive and transmit
interrupt)
Some internal mechanisms for data consistency.
Therefore different security levels are supported:
©2010, Vector Informatik GmbH
Version: 3.01.01
57 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Level CAN Driver Restrictions for the Application prevention None
No consistency mechanisms at all. The CAN
00
driver has to be configured to polling mode.
CAN interrupts are not allowed. All CAN driver
tasks, all calls to service functions, all data and
flag access must be performed from the same
level.
10
No Flag and Copy No usage of CAN transmit and receive signals
Security
in the interrupt context. Usage of the TxQueue
is allowed in Tx polling mode only.
No reset of notification flags in the interrupt
context
If a fully-preemptive operating system is used,
the access to the transmit data and
transmission of the data has to be done on the
same priority level. (data consistency).
20 Interrupts
are
a) Interrupt-Mode:
disabled during the
No usage of CAN receive signals and no
copy process of
reset of notification flags in the interrupt
transmit messages
context
b) Polling-Mode
Access to CAN receive signals, indication
and confirmation flags is only allowed at the
same level or at lower level than CanTask().
30
Interrupts are
No restrictions for the Application, neither on
(default) disabled during the the usage of CAN receive or transmit signals
copy process of
nor on the reset of notifications flags, can i.e.
transmit and
both be done at any time.
receive messages
and during the
access to the
notification flags
Figure 1: Security levels
Important
Be careful if a pretransmit function is used. Interrupts are not disabled during the call of
this user specific function by the CAN Driver, therefore the restrictions for security level
10 are valid. If the interrupts are not disabled before and restored after the copy process
by the Application, data consistency of a CAN messages cannot be guaranteed if the
transmit queue is used..
5.6.4.2 Control of CAN interrupts The interrupt control of the CAN Interrupts is done by the service functions
void CanCanInterruptDisable( void );
©2010, Vector Informatik GmbH
Version: 3.01.01
58 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
void CanCanInterruptRestore( void );
These service functions control the CAN Interrupts. CanCanInterruptDisable disables the
CAN interrupts and CanCanInterruptRestore restores the state of the CAN interrupts
before the call of CanCanInterruptDisable. This mechanism is accompanied with a counter
to recognize the number of calls. A “disable” increments the counter and a “restore”
decrements the counter to allow nested calls of these functions.
These functions could only be called as pair. That means that on a
CanCanInterruptDisable must follow a CanCanInterruptRestore. Otherwise the selected
interrupt(s) are always disabled.
Additionally refer to the hardware description for the specific platform
TechnicalReference_CAN_<hardware>.pdf [#hw_int] especially concerning the handling of
the wake-up interrupt. It depends on the hardware whether the wake-up interrupt is
included or not.
There are two call back functions for the application. After the CanCanInterruptDisable the
function ApplCanAddCanInterruptDisable is called and after the CanCanInterruptRestore
the function ApplCanAddCanInterruptRestore is called.
Use these two functions to handle the wake-up interrupt if the hardware treats this interrupt
separately or if the Driver runs in Polling Mode disable the polling tasks.
To activate the call back functions refer to the API description of the functions.
5.6.5 Assertions
To detect some incorrect internal conditions of the CAN Driver during development,
integration and software test, there are different categories of so called assertions
configurable:
User interface (for example input parameters, reentrance if not allowed)
Fatal hardware errors
Generated data
Internal software errors (for example inconsistent internal states)
Each type of assertion can be configured independently.
These assertions will help in different development phases to deal with unexpected
problems which cannot be handled by the CAN Driver internally. In such case the following
callback function will be called by the CAN Driver:
void ApplCanFatalError( vuint8 errorNumber );
This callback function has to be provided by the Application. The function parameter
errorNumber gives more detailed information about the kind of error which is occurred.
Generally, the error number has to be checked to solve the underlying problem.
Important
This callback function must not return to the CAN Driver afterwards.
©2010, Vector Informatik GmbH
Version: 3.01.01
59 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
The recommended usage of the different assertion categories is explained in the following
table:
User Interface
Development of Application software
Fatal hardware errors
Development of Application software
New CAN Controller used
Generated Data
New version of the Generation Tool used
Test of software changes in the Generation Tool or CAN Driver
(Vector internal)
Internal software errors
Test of software changes in the CAN Driver (Vector internal)
These checks could be very run-time intensive and should only be activated for the
development phase of the CAN Driver
The call back function
ApplCanFatalError() is called with the following error codes:
In case of a user assertion:
kErrorTxDlcTooLarge
CanTransmitVarDlc() or
CanDynTxObjSetDlc() called
with DLC > 8.
kErrorTxHdlTooLarge service
function
called with transmit handle too large
kErrorIntRestoreTooOften
CanCanInterruptRestore() called too often
kErrorIntDisableTooOften
CanCanInterruptDisable() called too often
kErrorChannelHdlTooLarge service
function
called with channel handle too large
kErrorInitObjectHdlTooLarge
CanInit() called with parameter “initObject” too large
kErrorTxHwHdlTooLarge
CanTxGetActHandle() called with logical hardware
handle too large
kErrorHwObjNotInPolling
CanTxObjTask(), CanRxFullCANObjTask() or
CanRxBasicCANObjTask() called for hardware object
which is configured to interrupt mode.
kErrorHwHdlTooSmall
CanTxObjTask(), CanRxFullCANObjTask() or
CanRxBasicCANObjTask() called for hardware object
handle too small
kErrorHwHdlTooLarge
CanTxObjTask(), CanRxFullCANObjTask() or
CanRxBasicCANObjTask() called for hardware object
handle too large
kErrorAccessedInvalidDynObj
CanGetDynTxObj(),CanReleaseDynTxObj() or
CanDynTxObjSet...() is called with wrong transmit
handle (transmit handle too large)
kErrorAccessedStatObjAsDyn
CanGetDynTxObj(),CanReleaseDynTxObj() or
CanDynTxObjSet...() is called with wrong transmit
handle (transmit handle belongs to a static object)
kErrorDynObjReleased
UserConfirmation() or
UserPreTransmit() is called for a
dynamic object which is already released.
kErrorPollingTaskRecursion
CAN Driver Polling tasks (
Can...Task()) are called
©2010, Vector Informatik GmbH
Version: 3.01.01
60 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
recursive or interrupt each other.
kErrorDisabledChannel
Service function called for disabled channel on systems
with multiple configurations.
kErrorDisabledTxMessage
CanCancelTransmit() or CanTransmit() called with
txHandle that is not active in the current configuration.
(Physical multiple ECU)
kErrorDisabledCanInt
CanSleep() or
CanWakeUp() is called with disabled
CAN Interrupts (via
CanCanInterruptDisable()).
kErrorCanSleep
CanStop(), CanCanInterruptDisable() or
CanCanInterruptRestore() called during Sleep mode, or
offline mode is not active during sleep mode.
kErrorCanOnline
CanSleep() or
CanStop() is called without offline mode
. kErrorCanStop
CanSleep() is called during Stop mode or offline mode
is not active during Stop mode.
kErrorWrongMask
CanSetTxIdExtHi() is called with illegal mask (mask
higher than 0x1F).
kErrorWrongId
CanDynTxObjSetId() or CanDynTxObjSetExtid() is
called with illegal ID (standard ID higher than 0x7ff or
extended ID higher than 0x1FFFFFFF).
In case of a generation assertion:
kErrorTxROMDLCTooLarge
Error in generated table of transmit DLCs
In case of a hardware assertion:
kErrorTxBufferBusy
HW transmit object is busy, but this is not expected
In case of a internal assertion:
kErrorTxHandleWrong
saved transmit handle has an unexpected value
kErrorInternalTxHdlTooLarge
internal function called with parameter tx handle too
large
kErrorRxHandleWrong
The variable rx handle has an illegal value.
kErrorTxObjHandleWrong
The handle of the hardware transmit object has an
illegal value.
kErrorReleasedUnusedDynObj
CanReleaseDynTxObj() is called for an object which is
already released.
kErrorTxQueueToManyHandle
The data type of the Tx Queue cannot handle all tx
messages.
kErrorInternalChannelHdlTooLarge Static function
called with channel handle too large or
calculated channel handle too large.
kErrorInternalDisabledChannel
Static function called for disabled channel on systems
with multiple configurations.
kErrorInternalDisabledTxMessage Confirmation called with txHandle that is not active in
the current configuration. (Physical multiple ECU)
See the CAN Controller specific part of the CAN Driver documentation
TechnicalReference_CAN_<hardware>.pdf [#hw_assert] to get the list of additional
hardware specific error numbers for each CAN Driver.
©2010, Vector Informatik GmbH
Version: 3.01.01
61 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
5.6.6 Hardware Loop Check
There are two kinds of handling loops in the CAN Driver internally. The first one uses a
counter or other mathematics algorithms to abort the loop. The second one uses hardware
information from the CAN Controller to abort the loop.
Some of these state transitions have to be done by two steps:
1. Request
2. Acknowledge
In the first step the request for a specific action (e.g. re-initialization of the CAN Controller)
is set but generally it cannot be entered immediately because of the prerequisite that the
CAN bus has to be in idle state, i.e. waiting for a recessive CAN bus level. In normal
operation the described behavior is non-critical. However, an exception is a malfunction of
the hardware. If the hardware is damaged or disturbed for a longer time, this loop may be
too long or even endless and is finally stopped by a watchdog reset. Because of this
restrictive error recovery the complete software functionality is affected, nothing can be
done to prevent the repetition and additionally it is not possible to store any error specific
diagnostic information, i.e. the problem cannot be checked later.
To avoid those kinds of endless loops, the user can configure a special loop control. This
has to be handled by the Application. It cannot be done by the CAN Driver itself because it
is hardware dependent.
Therefore the Application is informed once by the following callback function if such a
critical loop is entered:
void ApplCanTimerStart( vuint8 timerIdentification );
This callback function starts a timer realized by the Application. The recommended timer
handling is counting downwards to zero because of faster code on most microprocessors.
The parameter identifies the timer, i.e. the kind of loop. It is necessary to identify the loop
type because the corresponding start value has to be set. Beside of this, different (not the
same) loops can be started re-entrant and so the Application has to provide one timer for
each kind of loop. The list of necessary timers is pre-defined by the CAN Driver and
depends on the CAN Controller. Please refer to CAN Controller specific documentation for
a detailed list TechnicalReference_CAN_<hardware>.pdf [#hw_loop].
During the loop wait state a second callback function is called repeatedly to control the
break condition for the loop by the Application:
vuint8 ApplCanTimerLoop( vuint8 timerIdentification );
This callback function returns the status of the corresponding timer to the CAN Driver. The
return code must be TRUE (not equal to 0) if the timer is still running and FALSE (equal to
0) if the timer has expired. In this case the CAN Driver loop will be left immediately. The
Application must be aware of a serious problem in the hardware and the following actions
have to be done:
Store diagnostics information
Switch off transmit (CanOffline()) and receive path of the CAN Driver
©2010, Vector Informatik GmbH
Version: 3.01.01
62 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Re-initialization of the CAN Driver (CanInit()). This may lead to the next loop control
failure, therefore it has to be limited and in case of a permanent severe hardware
problem a special limp home state has to be foreseen.
If the loop is terminated, a third callback function is provided to stop the previously started
loop control timer:
void ApplCanTimerEnd( vuint8 timerIdentification );
Important
Be aware of the priorities of the timer interrupt routine and the CAN interrupt routine. If
the priority of the timer interrupt is below the CAN Interrupt priority the timer value for the
loop check may not be changed anymore while a CAN interrupt routine is running.
5.6.7 Support of OSEK-Compliant Operating Systems
If an OSEK operating system is used (ISR category 2), the hard-coded interrupt routines
for receiving, transmitting, error and wake-up are replaced by the ISR macro. In this case
an OSEK-specific header has to be included in can_inc.h to provide this macro.
5.6.8 Multiple-Channel CAN Driver
There are two different kinds of multiple-channel CAN Drivers: Sometimes two CAN
Controllers are used by one ECU on the same CAN bus, to increase the number of receive
and transmit objects. Logically, they can be conceived as a single CAN Controller. This
behavior is described in the chapter Common CAN. more... Usually, two (or more) CAN Controllers are used to serve different CAN networks, for
example in gateways.
5.6.8.1 Indexed CAN Driver Indexed CAN Drivers work on more than one CAN bus without doubling of code. Function
names are equal to single channel (standard) CAN Driver. Function parameter are different
in many cases.
Switches in can_cfg.h are without a suffix but with effect to all CAN channels.
5.6.9 Standard Polling Mode
In polling mode no interrupts are used. Instead of interrupts the Application has to call
cyclic service functions in the CAN Driver, to work on transmit and receive messages as
well as other asynchronous events. This cyclic service function is
void CanTask ( void );
and calls all needed service functions for transmission, reception, error and wake-up which
can also be polled separately by the following service functions:
void CanRxBasicCANTask ( void );
void CanRxFullCANTask ( void );
void CanTxTask ( void );
©2010, Vector Informatik GmbH
Version: 3.01.01
63 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
void CanErrorTask ( void );
void CanWakeUpTask ( void );
The transmission and the reception of CAN messages can be served by interrupt or by
polling separately. Several configurations for polling are available:
Full CAN Receive objects (for Full CAN Controllers only)
Basic CAN Receive Objects
Transmit objects
Errors
Wake-Up
5.6.9.1 Application Hints Concerning the transmit polling the handling depends on the configuration of transmit
queue and the confirmation notification:
No transmit queue but confirmation flags and/or confirmation functions are configured:
The CanTxTask() has to be called cyclically as fast as the confirmation notification is
needed or before CanTransmit() is called to release the CAN Controller hardware
transmit register.
Transmit queue is configured: CanTransmit() puts only a transmit request into the
transmit queue. CanTxTask() transmits the messages on the CAN bus and does the
confirmation as well. Therefore CanTxTask() has to be called as fast as confirmation is
needed and the messages should be transmitted.
5.6.10 Handling of different identifier types
Every Vector CAN Driver supports per default only the standard mode using 11 bits for a
CAN identifier. In addition to this standard mode, some Vector CAN Drivers also support
the feature of extended mode using 29 bits for a CAN identifier.
Depending on the selected mode (standard or extended CAN identifiers) the Generation
Tool switches to the correct initialization structures used for the corresponding mode. The
type and number of supported search algorithms depends on the mode. Four different
CAN Driver configurations are possible:
Standard mode (only 11 bit CAN identifier)
Extended mode for the normal receive path of single CAN messages (only 29 bit CAN
identifier)
Mixed mode (11 bit and 29 bit CAN identifier mixed on one CAN bus)
For indexed drivers a bus dependent mode (11 bit CAN identifier on one and 29 bit CAN
identifier on the other CAN bus).
©2010, Vector Informatik GmbH
Version: 3.01.01
64 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
5.6.11 Copying Mechanisms
CanCopyToCan or CanCopyFromCan are hardware/compiler dependent functions that are
provided to optimize copying of data from/to the CAN hardware buffer.
Info CanCopyFromCan should only be used within a precopy function. CanCopyToCan
should only be used within a pretransmit function.
5.6.12 Common CAN
Common CAN is a special feature which is available only on request and on systems with
2 or more CAN controllers. The idea of this feature is to map different HW channels into
one application channel.
When Common CAN is activated additional receive FullCAN messages can be configured
on a channel. This is realized by using a second CAN controller for the same channel. The
first CAN controller (CAN A) supports Tx, Rx Full CAN and Rx Basic CAN. The second
CAN controller (CAN B) supports Rx Full CAN. Both CAN controllers have to be connected
to the same CAN bus. The API is always ‘Multiple Receive Channel’.
To enable the Common CAN feature activate the corresponding checkbox in the channel
settings.
First select the messages handled in Full CAN objects. Then select the “Hardware
Channel” to be used to receive the full CAN message.
Please note that the messages received on CAN B of the Common CAN must be filtered
out with the Basic CAN mask.
5.6.13 Multiple ECU
The feature Multiple ECU is usually used for nodes that exist more than once in a car with
only a few differences. At power up the application decides which node should be realized,
e.g. left passenger door, or right driver door.
To reduce the memory consumption messages that are sent exclusively from one node
can be overlapped with the exclusively sent messages from the other nodes. The result of
this overlapping is that all these messages share a common memory location for the
transmit data.
5.6.14 Signal Access Macros
Signal access macros are function like macros, to access signals within a message. They
can be used by the application for an easy access to signals. The generation of signal
value access macros can be enabled or disabled. If enabled, the Generation Tool
generates access macros using the signal names from the communication data base with
respect to prefixes or post-fixes defined in the Names tab.
©2010, Vector Informatik GmbH
Version: 3.01.01
65 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Figure 5-13 Name of signal access macros
For each signal an access macro is formed from the signal name in the CAN database, a
signal variable prefix (access via signal structures or byte/word commands), a signal
prefix, a signal postfix, and a signal variable postfix. Prefixes and postfixes can be
configured by the user in the generator program. To assure better readability, it is
advisable not to use all four prefixes and postfixes simultaneously.
The access macros for the CAN receive buffer get an extended prefix CAN_. Within
Precopy and Pretransmit routines these macros serve to access the CAN controller's CAN
receive and transmit buffer on a signal basis.
5.6.15 CAN RAM Check
The CAN driver supports a check of the CAN controller’s mailboxes. The CAN controller
RAM check is called internally every time the function CanInit() is called. The CAN driver
verifies that no used mailboxes is corrupt. A mailbox is considered corrupt if a predefined
pattern is written to the appropriate mailbox registers and the read operation does not
return the expected pattern. If a corrupt mailbox is found the function
ApplCanCorruptMailbox() is called. This function tells the application which mailbox is
corrupt.
After the check of all mailboxes the CAN driver calls the callback function
ApplCanMemCheckFailed() if at least one corrupt mailbox was found. The application
must decide if the CAN driver disables communication or not by means of the callback
function’s return value. If the application has decided to disable the communication there is
no possibility to enable the communication again until the next call to CanInitPowerOn().
The CAN RAM check functionality itself can be activated via Generation Tool. This include
the callback ApplCanMemCheckFailed(). The callback ApplCanCorruptMailbox() can only
be activated via a user configuration file.
©2010, Vector Informatik GmbH
Version: 3.01.01
66 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
6 Detailed Description of the Functional Scope (High End extension) 6.1 Transmission 6.1.1 Low-Level Message Transmit
Using a multiple channel CAN Driver the routing of complete CAN messages from one
CAN Bus to another one is supported by the function
vuint8 CanMsgTransmit(...);
This function has a parameter with a pointer to a CAN Message Buffer. So it is possible to
route the whole buffer from one CAN chip to the other one. To prevent a conflict with the
functional messages, this function uses an own send buffer (If an additional buffer is
available in the CAN Controller).
A special confirmation function and an initialization callback function are called.
void ApplCanMsgTransmitConf(...); within confirmation interrupt
void ApplCanMsgTransmitInit(...); within CanInit
These functions can be used by the application to implement a data queue mechanism.
There is no internal transmit queue for this transmit object available.
CanMsgTransmit() can also be used for dynamic transmission. Therefore the CAN driver
supports macros to write standard ID or extended ID, DLC and data to the structure:
CanMsgTransmitSetStdId (...)
CanMsgTransmitSetExtId (...)
CanMsgTransmitSetDlc (...)
CanMsgTransmitSetData (...)
6.2 Reception 6.2.1 Multiple Basic CAN
To improve efficiency of the hardware filtering and reduce the interrupt load produced by
reception of unwanted messages, the number of Hardware Basic CAN objects can be
changed in the Generation Tool. Each Hardware Basic CAN object has it’s own filter.
Increasing the number of Basic CAN objects will reduce the number of available Full CAN
objects (Rx and Tx).
This feature is only available for Full CAN controllers.
6.2.2 Rx Queue
The Rx Queue is a data queue which stores receive messages if the application does not
want to process them within the interrupt context. In some applications it may happen that
the run time in the receive interrupt becomes too long. This leads to long interrupt
latencies and possible loss of messages. The Rx Queue may help in these cases. If the
Rx Queue is configured the received messages are copied into this queue in the interrupt
©2010, Vector Informatik GmbH
Version: 3.01.01
67 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
context. The handling of the queued messages is done on task level. Messages which are
received by means of a RangePrecopy can also be copied into the queue or handled in
the interrupt context.
In order to handle the queued messages the application has to call cyclically a CAN Driver
function which checks for queued messages and processes them.
If Precopy and Indication functions are used for application messages, be aware that they
are not called in interrupt context any more.
By using the Rx Queue the runtime in the Rx interrupt is decreased. The average runtime
of the application is increased because of the overhead for handling the queue.
Please note
In case a range is configured to be handled via the Rx Queue, the return code of the
RangePrecopy for this range is ignored.
6.2.2.1 Handling in Receive Interrupt
During the receive interrupt the CAN Driver calls the callback function
ApplCanPreRxQueue() after the range or search algorithm match in order to let the
application decide whether the received message is processed within the interrupt or has
to be entered into the Rx queue. The function ApplCanPreRxQueue() is only called if
configured. Otherwise all received messages are handled by the Rx queue. If the Rx
Queue is full the CAN Driver notifies the application by calling the callback function
ApplCanRxQueueOverrun() (if configured) and discards the received message. After the
message was copied into the Rx queue the Rx interrupt is terminated.
©2010, Vector Informatik GmbH
Version: 3.01.01
68 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Receive message
(hardware filtering)
Hardware Level
Enter
Rx Interrupt Level StartReceive Interrupt
ApplCanMsgReceived
(CanRxInfoStructPtr)
SW Range
entered
yes
no
Queue
yes
configured
no
Normal receive-interrupt
Range Precopy
ApplCanPreRxQueue
with SW message search
Indexed,
Function
(CanRxInfoStructPtr)
Hash,
Linear
ApplCanPreRxQueue
(CanRxInfoStructPtr)
Return
kCanCopyData
Return
yes
yes
kCanCopyData
no
Write FIFOWrite FIFOHandle
Handle
normal receive-interrupt
no
Id
Id
with Message Precopy,
DLC
DLC
data copy mechanism,
Data
Data
Indication Function / Flags
yes
ExitRx Interrupt Level End Figure 6-1 Handling of the Rx queue within the receive routine.
6.2.2.2 Handling on Task Level
In order to process the messages pending in the Rx queue the application has to call the
function CanHandleRxMsg(). This function processes all messages in the queue. The
processing of the messages is done in the same way like in the Rx interrupt. That means
©2010, Vector Informatik GmbH
Version: 3.01.01
69 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
for each message the Generic Precopy and the UserPrecopy are called. After that the
message data are copied into the RAM buffer and than the Indication Flag is set and the
UserIndication function is called. The last step is to delete the processed message from
the Rx queue.
CanHandleRxMsg()
Task Level StartRead FIFOHandle
Id
DLC
Data
SW Range
no
entered
yes
normal receive-interrupt
Range Precopy
with Message Precopy,
Function
data copy mechanism
Clear FIFOClear FIFOHandle
Handle
Id
Id
DLC
DLC
Data
Data
Indication Function / Flags
ExitTask Level End Figure 6-2 Handling of the Rx queue on task level.
6.2.2.3 Resetting the Rx Queue
The CAN Driver provides the function CanDeleteRxQueue() to delete all messages
pending in the Rx Queue
©2010, Vector Informatik GmbH
Version: 3.01.01
70 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
6.3 Special Features 6.3.1 Individual Polling
Each mailbox (BasicCAN Rx, FullCAN Rx, FullCAN Tx, low level Tx and normal Tx) can be
selected to be polled or treat in interrupt context. This also provides the possibility to use
interrupt mode on one channel and polling mode on the other.
The polling tasks of the standard polling mode are still available. The CAN Driver provides
additional service functions to poll each mailbox individual.
void CanRxBasicCANObjTask ( ... );
void CanRxFullCANObjTask ( ... );
void CanTxObjTask ( ... );
These functions have the number of the mailbox and the hardware channel as parameter.
For both parameters, symbolic names are generated.
CanTask(), CanErrorTask() and CanWakeUpTask() are available in this polling
mode, too.
©2010, Vector Informatik GmbH
Version: 3.01.01
71 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
7 Feature List (Standard and High End) This general feature list describes the overall feature set of Vector CAN Drivers. Not all of
these features are mandatory for all CAN Drivers. Please refer to the CAN Controller
dependent CAN Driver manual for details TechnicalReference_CAN_<hardware>.pdf
[#hw_feature].
CAN Driver Functionality
Standard HighEnd Functions Initialization Power-On Initialization
CanInitPowerOn
Re-Initialization
CanInit
Transmission Transmit Request
CanTransmit
Transmit Request Queue
Internal data copy mechanism
Pretransmit functions
UserPreTransmit
Common confirmation function
ApplCanTxConfirmation
Confirmation flag
Confirmation function
UserConfirmation
Offline Mode
CanOnline, CanOffline
Partial Offline Mode
CanOnline, CanPartOffline,
CanGetPartMode
Passive-Mode
CanSetActive,
CanSetPassive
Tx Observe mode
ApplCanInit,
ApplCanTxObjStart,
ApplCanTxObjConfirmed
Dynamic TxObjects
ID
CanDynTxSet(Ext)Id
DLC
CanDynTxSetDlc
Data-Ptr
CanDynTxSetDataPtr
Full CAN Tx Objects
Cancellation in Hardware
CanCancelTransmit,
CanCancelMsgTransmit
Low Level Message Transmit
CanMsgTransmit
Reception Receive function
ApplCanMsgReceived
Search algorithms
Linear
Table
Index
Hash
©2010, Vector Informatik GmbH
Version: 3.01.01
72 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Range specific precopy functions
ApplCanRangeXxxPrecopy
4
4
Xxx .. 0,1,2,3
DLC check
ApplCanMsgDlcFailed
Internal data copy mechanism
Generic precopy function
ApplCanGenericPrecopy
Precopy function
UserPrecopy
Indication flag
Indication function
UserIndication
Message not matched function
ApplCanMsgNotMatched
Overrun Notification
ApplCanOverrun
Full-CAN overrun notification
ApplCanFullCanOverrun
Multiple Basic CAN
Rx Queue
CanHandleRxMsg,
CanDeleteRxQueue
Bus off Notification function
ApplCanBusOff
Nested Recovery functions
CanResetBusOffStart,
CanResetBusOffEnd
Sleep Mode Mode Change
CanSleep, CanWakeUp
Preparation
CanResetBusSleep
Notification function
ApplCanWakeUp
Special Feature Status
CanGetStatus
Security Level
Assertions
ApplCanFatalError
Hardware loop check
ApplCanTimerStart
ApplCanTimerLoop
ApplCanTimerEnd
Stop Mode
CanStart, CanStop
Support of OSEK operating system
Standard Polling Mode
Tx
CanTxTask
Rx(Full CAN objects)
CanRxFullCANTask
Rx(Basic CAN objects)
CanRxBasicCANTask
Error
CanErrorTask
Wakeup
CanWakeUpTask
Individual Polling
CanTxObjTask,
CanRxFullCANObjTask,
CanRxBasicCANObjTask
Multi-channel
Support extended ID addressing mode
Support mixed ID addressing mode
Support access to error counters
CanRxActualErrorCounter
CanTxActualErrorCounter
©2010, Vector Informatik GmbH
Version: 3.01.01
73 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Copy functions
CanCopyFromCan,
CanCopyToCan
CAN RAM check
ApplCanMemCheckFailed
Figure 2: Feature List
feature is supported in general (exceptions might be possible if a CAN controller is not able to support a
feature.
feature is not implemented for each hardware because different CAN controller doesn’t support this
feature.
©2010, Vector Informatik GmbH
Version: 3.01.01
74 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
8 Description of the API (Standard) The complete Standard CAN Driver API is described in this section.
8.1 API Categories Depending on the number of supported channels, i.e. the number of connected CAN
networks to one ECU, the API of the CAN Driver is realized as "Single Channel" or
"Multiple Channel" with additional channel specific information.
8.1.1 Single Receive Channel (SRC)
A “Single Receive Channel” CAN Driver supports one CAN channel.
8.1.2 Multiple Receive Channel (MRC)
A "Single Receive Channel" CAN Driver is typically extended for multiple channels by
adding an index to the function parameter list (e.g. CanOnline() becomes to
CanOnline(channel)) or by using the handle as a channel indicator (e.g.
CanTransmit(txHandle)).
©2010, Vector Informatik GmbH
Version: 3.01.01
75 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
8.2 Data Types The following general data types are defined by the CAN Driver:
vbittype
canbittype
Single bit information
vuint8
canuint8
unsigned 8 bit (byte) value
vuint16
canuint16
unsigned 16 bit (word) value
vuint32
canuint32
unsigned 32 bit (dword) value
vsint8
cansint8
signed 8 bit (byte) value
vsint16
cansint16
signed 16 bit (word) value
vsint32
cansint32
signed 32 bit (dword) value
There are special data types to reference specific generated data structures:
CanInitHandle Initialization
parameters
CanReceiveHandle Receive
parameters
CanTransmitHandle Transmit
parameters
CanChannelHandle
Channel parameters ( only available in indexed CAN Drivers )
Some data types are referencing the CAN Controller registers CanChipDataPtr
Receive and transmit data register of the CAN Controller
CanChipMsgPtr
Complete receive and transmit message objects including CAN
identifier and DLC
Some data types are only available in Single Receive Channel and Multiple Receive
Channel CAN Drivers typedef volatile struct
Structure with transmit information.
{
CanChipDataPtr pChipData;
pChipData is the pointer to the transmit data bytes
CanTransmitHandle Handle;
in the CAN controller.
} CanTxInfoStruct;
Handle of the transmit message.
typedef volatile struct
Structure with receive information:
{
Channel from which the precopy is called.
CanChannelHandle Channel;
pChipMsgObj is the pointer to the CAN Controller
CanChipMsgPtr pChipMsgObj;
Receive Register. If there are several receive
objects with different memory addresses available,
CanChipDataPtr pChipData;
pChipMsgObj contains the pointer to the dedicated
CanReceiveHandle Handle;
receive object to get some information like CAN
} tCanRxInfoStruct;
identifier or DLC of the received message directly
out of the CAN Controller registers.
pChipData is the pointer to the received data bytes.
©2010, Vector Informatik GmbH
Version: 3.01.01
76 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Handle of the received message.
CanRxInfoStructPtr
Pointer to structure with receive information.
8.3 Constants This information is stored in ROM.
8.3.1 Version Number
kCanMainVersion and kCanSubVersion contains the BCD coded version of the CAN
Driver:
kCanMainVersion
Main version of the CAN Driver (BCD coded in a vuint8 constant
variable)
kCanSubVersion
Sub version of the CAN Driver (BCD coded in a vuint8 constant
variable)
kCanBugFixVersion Release version of the CAN Driver (BCD coded in a vuint8
constant variable)
Example A version number 2.31.00 is coded as 0x02 in kCanMainVersion, 0x31 in
kCanSubVersion and 0x00 in kCanBugFixVersion.
8.4 Macros 8.4.1 Conversion between Logical and Hardware Representation of CAN Parameter DLC These macros are used to convert the CAN protocol specific parameter DLC between the
logical presentation (DLC: 0..8) and the CAN Controller dependent, internal register layout
of different CAN Controllers.
They are normally used by the Generation Tool for the initialization of the node specific
control structures but they are available also for the Application, if necessary.
The MK_... macros are converting from the logical to the CAN Controller dependent
representation:
MK_TX_DLC(dlc)
Conversion of transmit DLC, if associated CAN message has
standard identifier
The following macro is only allowed to be used if extended CAN identifiers are used:
MK_TX_DLC_EXT(dlc) Conversion of transmit DLC if associated CAN message has an
extended identifier
The XT_... macro is converting from the CAN Controller dependent to the logical
presentation:
©2010, Vector Informatik GmbH
Version: 3.01.01
77 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
XT_TX_DLC(dlc)
Conversion of transmit DLC independent of identifier type
8.4.2 Direct Access to the CAN Controller Registers
These macros are defined by the CAN Driver to provide the access on CAN protocol
specific parameters like CAN identifier and DLC currently available in the CAN Controller.
To assign these information to a previously received message they are only valid in the
callback function ApplCanMsgReceived() or in user specific precopy functions. Only in this
scope there is a clear reference on receive messages possible and data in the CAN
Controller receive registers are still locked. They are referencing either on the CAN
Controller register or on the software shadow buffer of the CAN Driver, if used. The
parameter rxStruct is only available for Single Receive Channel and Multiple Receive
Channel Drivers and is the pointer to the receive information structure.
CanRxActualId(rxStruct)
Read identifier in logical presentation (0h..7FFh for
standard identifier or 0h..1FFFFFFFh for extended
identifier).
In case of mixed identifier, the macro
CanRxActualIdType can be used to decide whether
the CAN identifier is in standard or extended
format.
CanRxActualIdType(rxStruct) Read the format type of the CAN identifier
kCanIdTypeStd standard
format
kCanIdTypeExt extended
format
CanRxActualDLC(rxStruct)
Read DLC in logical presentation (0..8)
CanRxActualData(rxStruct,i) Read Data in logical presentation. i is the position
of the byte (0..7).
CanRxActualErrorCounter(
Read current status of the receive error counter. In
channel)
use of microcontrollers without an readable error
counter, this macro returns always 0.
CanTxActualErrorCounter(
Read current status of the transmit error counter. In
channel)
use of microcontrollers without an readable error
counter, this macro returns always 0.
The following macros are only available if extended CAN identifiers are used:
CanRxActualIdExtHi(
Read the bit 24 to 29 of the extended identifier in
rxStruct)
logical presentation
CanRxActualIdExtMidHi(
Read the bit 16 to 23 of the extended identifier in
rxStruct)
logical presentation
CanRxActualIdExtMidLo(
Read the bit 8 to 15 of the extended identifier in
rxStruct)
logical presentation
CanRxActualIdExtLo(
Read the bit 0 to 7 of the extended identifier in
rxStruct)
logical presentation
To write CAN protocol specific parameters like CAN identifier and DLC the to the CAN
controller there are some macros available. The parameter txStruct is only available for
©2010, Vector Informatik GmbH
Version: 3.01.01
78 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Single Receive Channel and Multiple Receive Channel Drivers and is the pointer to the
transmit information structure.
CanTxWriteActId(txStruct,
Write the parameter id in standard format and in
id)
logical presentation to the hardware.
CanTxWriteActDLC(rxStruct, Write the DLC in logical presentation (0..8)
dlc)
The following macro is only available if extended CAN identifiers are used:
CanTxWriteActExtId(
Write the parameter id in extended format and in
txStruct,id)
logical presentation to the hardware.
8.4.3 Interpretation of the CAN Status
The following macros are used to decode the return code of CanGetStatus() (TRUE
means not equal to zero):
CanHwIsOk(state)
This macro returns TRUE, if the status of the CAN
Controller is Error-Active.
CanHwIsWarning(state) This macro returns TRUE, if the status of the CAN
Controller is Warning (at least one error counter is equal or
higher than 96).
CanHwIsPassive(state) This macro returns TRUE, if the status of the CAN
Controller is Error-Passive.
CanHwIsBusOff(state) This macro returns TRUE, if the status of the CAN
Controller is Bus-Off. This information is only temporary. The
time when this status changes from TRUE to FALSE
depends on the CAN controller. This could be after the CAN
controller has resynchronized on the bus regardless of the
Busoff recovery by the Application. This could also be after
CanResetBusoffStart() is called or after
CanResetBusoffEnd() is called.
Hint: Busoff detection has to be performed with
ApplCanBusoff().
CanHwIsWakeup(state) This macro returns TRUE, if the CAN Controller is not in
sleep mode.
CanHwIsSleep(state)
This macro returns TRUE, if the CAN Controller is in sleep
mode.
CanHwIsStart(state)
This macro returns TRUE, if the CAN Controller is not in
stop mode.
CanHwIsStop(state)
This macro returns TRUE, if the CAN Controller is in stop
mode.
CanIsOnline(state)
This macro returns TRUE, if the CAN Driver is online.
CanIsOffline(state)
This macro returns TRUE, if the CAN Driver is offline.
©2010, Vector Informatik GmbH
Version: 3.01.01
79 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Not all CAN Controllers support all of the hardware dependent states. Please refer to the
CAN Controller specific documentation TechnicalReference_CAN_<hardware>.pdf
[#hw_status] for details.
8.4.4 Access to low level transmit structure
These macros are defined by the CAN driver to fill the set the data to be transmitted with
CanMsgTransmit():
CanMsgTransmitSetStdId( Write the parameter id in standard format and in logical
tCanMsgTransmitStruct
presentation to the structure txData.
*txData, vuint16 id)
CanMsgTransmitSetExtId( Write the parameter id in extended format and in logical
tCanMsgTransmitStruct
presentation to the structure txData.
*txData, vuint32 id)
CanMsgTransmitSetDlc(
Write the DLC in logical presentation (0..8)
tCanMsgTransmitStruct
*txData, vuint8 dlc)
CanMsgTransmitSetData(
Write the data bytes to be transmitted to the structure
tCanMsgTransmitStruct
txData. nrDataBytes specifies the number of bytes to be
*txData, vuint8
copied (e.g. same as the DLC, max. 8). txDataBytes
nrDataByte, vuint8
points to the current location where the data has to be
*txDataBytes)
copied from.
8.5 Functions This chapter contains a description of the CAN Driver functions (services, callbacks and
user specifics) and the appropriate parameters and return codes. The function declarations
are given in C syntax as explained below:
vuint8 CanTransmit( CanTransmitHandle txObject );
vuint8 is the type of the return code
CanTransmit is the name of the function
CanTransmitHandle is the type of the function parameter
txObject is the function parameter.
©2010, Vector Informatik GmbH
Version: 3.01.01
80 / 149
based on template version 2.1





TechnicalReference Vector CAN Driver
8.5.1 Service Functions 8.5.1.1 CanInitPowerOn CanInitPowerOnPrototype
Single Receive Channel
void
CanInitPowerOn ( void )
Multiple Receive Channel
Parameter -
-
Return code -
-
Functional Description
The service function CanInitPowerOn() initializes the CAN Controller and the CAN Drivers internal
variables. The CAN Driver is always set to online mode and active operating state.
Particularities and Limitations
This service function has to be called before any other CAN Driver function. The interrupts have to
be disabled during this service function is called.
For indexed CAN Drivers every channel is initialized with kCanInitObj0.
8.5.1.2 CanInit CanInitPrototype
Single Receive Channel
void
CanInit ( CanInitHandle initObject )
Multiple Receive Channel
void
CanInit ( CanChannelHandle channel, CanInitHandle
initObject )
Parameter initObject
Handle of an initialization structure. The generated macros should be
used:
kCanInitObjX (with X = 1 ... Number of generated initialization structures)
channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
Initialization of the CAN Controller hardware. It is used to cancel pending transmit requests in the CAN
Controller transmit register and to change the baud rate or the hardware acceptance filters.
Online/Offline mode and Active/Passive state will not be changed.
Particularities and Limitations ©2010, Vector Informatik GmbH
Version: 3.01.01
81 / 149
based on template version 2.1







TechnicalReference Vector CAN Driver
During the call of CanInit(..), the CAN Driver has to be in offline mode.
CanInit(..) is not reentrant and therefore must not be called recursively.
CanInit(..) must not be interrupted by CanReset...(..), CanSleep(..), CanWakeUp(..)
or by any CAN interrupt service routine and vice versa.
CanInit(..) must not interrupt the confirmation interrupt and must not be called in the
confirmation or indication function.
8.5.1.3 CanTransmit CanTransmitPrototype
Single Receive Channel
vuint8
CanTransmit ( CanTransmitHandle txObject )
Multiple Receive Channel
Parameter txObject
Handle of the transmit object
Return code kCanTxOk
The transmit request was accepted by the CAN Driver
kCanTxFailed
Error code because one of the following conditions:
Transmit request could not be passed to the CAN Controller because
the transmit registers are busy (only if there is no transmit queue
used)
CAN Driver's transmit path is in offline mode
Special hardware conditions of the CAN Controller (e.g. the sleep
mode was entered; failed synchronization on the CAN bus)
kCanTxPartOffline
Error code because the transmit path of the CAN driver is in partial
offline mode for this transmit object.
Functional Description
The service function CanTransmit(..) checks if a transmit register in the CAN Controller is
available. If so, the transmit process is initiated in the CAN Controller and kCanTxOk is returned. If not
and if there is no transmit queue configured, the function call returns with the error code
kCanTxFailed or kCanTxPartOffline. For a CAN Driver with a configured transmit queue; the
transmit request is marked in the queue and kCanTxOk is returned. Only the transmit request is saved
but not the associated data. As soon as one of the CAN Controller transmit registers becomes
available (successful transmission of the previous transmit request), the next transmit request with the
highest priority (lowest CAN identifier) in the transmit queue will be serviced.
By the parameter txObject all information for transmission (CAN identifier, DLC, location and length
of data, etc...) can be taken from the CAN Driver description data. They will be copied to the CAN
Controller and the transmit process is started. The message will be actually transmitted on the CAN
bus after a successful arbitration of the CAN protocol.
After a successful transmission a CAN message (at least one other CAN bus node gives an
acknowledge) the confirmation notification (a flag will be set or a user specific function will be called)
are executed in the scope of the CAN transmit interrupt routine.
Particularities and Limitations ©2010, Vector Informatik GmbH
Version: 3.01.01
82 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
CanTransmit(..) supports the Network Management which can enable or disable the CAN
Driver's transmit path by means of the CAN Driver service functions CanOnline() and
CanOffline(). No distinction is made between Network Management and Application messages.
In the offline mode, the transmit request is rejected with an error code.
For CAN Controllers with priority controlled transmit queue (hardware or software) the sequence of
transmission may deviate from the call sequence of CanTransmit(..) because the transmit
queues are handled according to priorities (lowest CAN identifier first) and not according to the
chronological order of the entries in the queue (FIFO).
The generated handles should be used to reference the transmit objects. The names consist of the
message symbol, a prefix and a postfix. Fixed rules are used to build these names. For more
details please refer to the user manual of the Generation Tool
8.5.1.4 CanTask CanTaskPrototype
Single Receive Channel
void
CanTask ( void )
Multiple Receive Channel
Parameter -
-
Return code -
-
Functional Description
The service function CanTask() does polling of error events, receive objects, transmit objects and
wake-up events in the CAN Controller according to the configured polling mode. In multiple channel
drivers the CanTask() handles all channels.
Particularities and Limitations CanTask() must not run on higher priority than other CAN functions.
CanTask() is available, if any polling mode is configured for the CAN Driver
CanTask() is also available for some CAN Controllers if cancellation in hardware is configured.
See more about that in the CAN Controller specific documentation
TechnicalReference_CAN_<hardware>.pdf [#hw_cancel] .
8.5.1.5 CanTxTask CanTxTaskPrototype
Single Receive Channel
void
CanTxTask ( void )
Multiple Receive Channel
void
CanTxTask ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
©2010, Vector Informatik GmbH
Version: 3.01.01
83 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Functional Description
The service function CanTxTask() does polling of transmit objects in the CAN Controller.
Confirmation functions will be called and confirmation flags will be set. If the transmit queue is
configured, this service function additionally transmits the queued messages.
Particularities and Limitations CanTxTask() is available, if the general polling mode or the transmit polling mode is configured.
CanTxTask() is also available for some CAN Controllers if cancellation in hardware is configured.
See more about that in the CAN Controller specific documentation
TechnicalReference_CAN_<hardware>.pdf [#hw_cancel] .
8.5.1.6 CanRxFullCANTask CanRxFullCanTaskPrototype
Single Receive Channel
void
CanRxFullCANTask ( void )
Multiple Receive Channel
void
CanRxFullCANTask ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanRxFullCanTask() does polling of Full CAN receive objects (if available)
according to the configured polling mode.
Particularities and Limitations CanRxFullCanTask() must not run on higher priority than other CAN functions.
CanRxFullCanTask() is available if the Full CAN receive polling mode is configured.
8.5.1.7 CanRxBasicCANTask CanRxBasicCANTaskPrototype
Single Receive Channel
void
CanRxBasicCANTask ( void )
Multiple Receive Channel
void
CanRxBasicCANTask ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanRxBasicCANTask() does polling of Basic CAN receive objects according to
the configured polling mode.
©2010, Vector Informatik GmbH
Version: 3.01.01
84 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Particularities and Limitations CanRxBasicCANTask() must not run on higher priority than other CAN functions.
CanRxBasicCANTask() is available if the Basic CAN receive polling mode is configured.
8.5.1.8 CanErrorTask CanErrorTaskPrototype
Single Receive Channel
void
CanErrorTask ( void )
Multiple Receive Channel
void
CanErrorTask ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanErrorTask() does polling of error events in the CAN Controller. In case of a
BusOff, the callback function ApplCanBusOff() is called by this service function.
Particularities and Limitations CanErrorTask() is available if the error polling is enabled.
8.5.1.9 CanWakeUpTask CanWakeUpTaskPrototype
Single Receive Channel
void
CanWakeUpTask ( void )
Multiple Receive Channel
void
CanWakeUpTask ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanWakeUpTask() does polling of the wake-up events in the CAN Controller
according to the enabled polling mode. In case of a wake-up event on the CAN bus, the callback
function ApplCanWakeUp() will be called by this service function.
Particularities and Limitations CanWakeUpTask() is available if the wakeup polling is enabled.
A wake-up by the CAN bus is not supported by all CAN Controllers. Please refer to the CAN
controller specific documentation TechnicalReference_CAN_<hardware>.pdf [#hw_sleep].
©2010, Vector Informatik GmbH
Version: 3.01.01
85 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
8.5.1.10 CanOnline CanOnlinePrototype
Single Receive Channel
void
CanOnline ( void )
Multiple Receive Channel
void
CanOnline ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanOnline() enables the CAN Driver's transmit path for all subsequent transmit
requests of CanTransmit(..). This is prerequisite to transmit any CAN message.
The current status of the transmit path can be queried by CanGetStatus().
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations
If a Network Management is used, the service function CanOnline() may only be used by the
Network Management.
It is only allowed to call CanOnline() on Task level. No other CAN Driver service function is allowed
to be interrupted by CanOnline().
8.5.1.11 CanOffline CanOfflinePrototype
Single Receive Channel
void
CanOffline ( void )
Multiple Receive Channel
void
CanOffline ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanOffline() disables the CAN Driver's transmit path for all subsequent
transmit requests of CanTransmit(..).
While the transmit path is blocked, transmit requests by CanTransmit(..) are rejected with an
error. This can be determined by evaluating the return code.
The current status of the transmit path can be queried by CanGetStatus().
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations ©2010, Vector Informatik GmbH
Version: 3.01.01
86 / 149
based on template version 2.1







TechnicalReference Vector CAN Driver
If the CAN Driver is configured to use a transmit queue, all queue entries will be cleared, i.e. transmit
requests will be lost.
If a Network Management is used, the service functions CanOffline() may only be used by the
Network Management.
8.5.1.12 CanPartOnline CanPartOnlinePrototype
Single Receive Channel
void
CanPartOnline ( vuint8 sendGroup )
Multiple Receive Channel
void
CanPartOnline ( CanChannelHandle channel, vuint8
sendGroup )
Parameter sendGroup
Send group or groups to be switched to online.
channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanPartOnline() enables the CAN Driver's transmit path for the selected send
groups.
The current status of the partial offline mode can be queried by CanGetPartMode().
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations
8.5.1.13 CanPartOffline CanPartOfflinePrototype
Single Receive Channel
void
CanPartOffline ( vuint8 sendGroup )
Multiple Receive Channel
void
CanPartOffline ( CanChannelHandle channel, vuint8
sendGroup )
Parameter sendGroup
Send group or groups to be switched to offline.
channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description ©2010, Vector Informatik GmbH
Version: 3.01.01
87 / 149
based on template version 2.1



TechnicalReference Vector CAN Driver
The service function CanPartOffline() disables the CAN Driver's transmit path for the selected
send groups.
While the transmit path is blocked for a selected group, transmit requests of a message assigned to
this group by CanTransmit(..) are rejected with kCanPartOffline. This can be determined by
evaluating the return code.
The current status of the partial offline mode can be queried by CanGetPartMode().
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations A queued message will be still send after the function CanPartOffline() was called.
8.5.1.14 CanGetPartMode CanGetPartModePrototype
Single Receive Channel
vuint8
CanGetPartMode ( void )
Multiple Receive Channel
vuint8
CanGetPartMode ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code vuint8
Send groups which are in partial offline mode.
C_SEND_GRP_NONE (if the partial mode is inactive)
C_SEND_GRP_ALL (if the partial mode is active for all groups.)
NOTE: predefined macros can be used to check for all or none
send groups.
For indexed CAN Driver, this functionality is related to the specified CAN
channel.
See also 5.2.6 Partial Offline Mode page
35 Functional Description
Reads the current partial offline status of the CAN Driver.
Particularities and Limitations
8.5.1.15 CanGetStatus CanGetStatusPrototype
Single Receive Channel
vuint8
CanGetStatus ( void )
Multiple Receive Channel
vuint8
CanGetStatus ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
©2010, Vector Informatik GmbH
Version: 3.01.01
88 / 149
based on template version 2.1









TechnicalReference Vector CAN Driver
Return code vuint8
Software status of the CAN Driver. The following information is coded in
the return code:
CAN Driver is offline (CanOffline() was called)
If extended status is enabled, this function also returns the hardware
status of the CAN Controller. The following additional information are
coded in the return code:
Warning level, Error-Active/-Passive state and Bus-Off of the CAN
Controller
CAN Controller is in sleep mode (CanSleep() was called)
CAN Controller is in stop mode (CanStop() was called)
There are special macros to get this information in the return code.
These macros are TRUE (not equal to 0) if the specific condition is valid
and FALSE (equal to 0) if not. The parameter of these macros is the
status, i.e. the return code of CanGetStatus():
CanHwIsWarning(..), CanHwIsPassive(..),
CanHwIsBusOff(..),
CanHwIsOk(..)
CanHwIs Sleep(..), CanHwIsWakeup(..)
CanHwIsStop(..), CanHwIsStart(..)
CanIsOffline(..), CanIsOnline(..)
For indexed CAN Driver, this functionality is related to the specified CAN
channel.
Functional Description
Reads the current status of the CAN Driver and the CAN Controller.
Particularities and Limitations
8.5.1.16 CanSleep CanSleepPrototype
Single Receive Channel
vuint8
CanSleep (void )
Multiple Receive Channel
vuint8
CanSleep ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code
Result of the sleep request:
kCanFailed
Sleep mode not entered
kCanOk
Sleep mode entered
kCanNotSupported
The function CanSleep is not supported by this driver
Functional Description
The service function CanSleep() puts the CAN Controller into sleep mode. This reduces the power
©2010, Vector Informatik GmbH
Version: 3.01.01
89 / 149
based on template version 2.1









TechnicalReference Vector CAN Driver
consumption of the CAN Controller and enables the wake up behavior if the CAN Controller supports
this functionality. For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations
This functionality is not supported for all CAN Controllers. In such case the function is provided by
the CAN Driver but without any effect on the CAN Controller. This is done to enable the Application
to realize an orthogonal software structure.
If it is supported by the CAN Controller, on a wake-up by the CAN bus, the callback function
ApplCanWakeUp() is called.
If a message is currently transmitted or received during the call of this service function, a direct
wake-up interrupt occurs or the CAN Driver remains in this function until the sleep mode is entered.
This behavior of the CAN Controller has to be considered in implementing the Application or the
Network Management. (This behavior is hardware dependent and described more detailed in the
CAN controller specific documentation TechnicalReference_CAN_<hardware>.pdf [#hw_sleep])
If the sleep mode is not entered, no CAN wake-up interrupt occurs on the detection of any
message on the CAN bus. The callback function ApplCanWakeUp() will not be called and in
consequence the bus transceiver will not be initialized. This leads to CAN bus errors. Therefore it is
necessary to call a set of functions to realize a wake-up capable system. The order of the function
calls is very important.
more… During the call of CanSleep() the CAN Driver has to be offline.
CanSleep() must not be interrupted by CanInit(), CanReset...(), CanWakeUp() or any
CAN interrupt routine and vice versa.
CanSleep(..) is not reentrant and therefore must not be called recursively.
It isn’t allowed to call CanSleep() out of any callback function.
CAN Interrupts should be disabled during the call of CanSleep(). To disable the Can Interrupts
the function CanCanInterruptDisable() should not be used. If this function is used no CAN
wake-up interrupt occurs on the detection of any message on the CAN bus. The callback function
ApplCanWakeUp() will not be called.
In Sleep mode the service functions CanGetStatus(), CanWakeUp(), CanTransmit(),
CanTask() and all Can...Task() are allowed to be called.
8.5.1.17 CanWakeUp CanWakeUpPrototype
Single Receive Channel
vuint8
CanWakeUp ( void )
Multiple Receive Channel
vuint8
CanWakeUp ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code
Result of the wakeup request
kCanFailed
wakeup was not successful
kCanOk
Sleep mode left
kCanNotSupported
The function CanWakeUp is not supported by this driver.
Functional Description ©2010, Vector Informatik GmbH
Version: 3.01.01
90 / 149
based on template version 2.1









TechnicalReference Vector CAN Driver
The service function CanWakeUp() enters the normal operating mode of the CAN Controller.
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations
This functionality is not supported for all CAN Controllers. In such case the function is provided by
the CAN Driver but without any effect on the CAN Controller. This is done to enable the Application
to realize an orthogonal software structure.
During the call of CanWakeUp() the CAN Driver has to be offline.
No wake-up interrupt is generated by the call of CanWakeUp().
CanWakeUp() must not be interrupted by CanInit(), CanReset...(), CanSleep() or any
CAN interrupt routine and vice versa.
CanWakeUp(..) is not reentrant and therefore must not be called recursively.
8.5.1.18 CanStart CanStartPrototype
Single Receive Channel
vuint8
CanStart ( void )
Multiple Receive Channel
vuint8
CanStart ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code
Result of the stop request
kCanFailed
Restart of the CAN controller was not successful.
kCanOk
Stop mode left
kCanNotSupported
The function CanStart() is not supported by this driver.
Functional Description
The service function CanStart() enters the normal operating mode of the CAN Controller.
CanStart() may not be called in sleep mode.
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations
This functionality is not supported for all CAN Controllers. In such case the function is provided by
the CAN Driver but without any effect on the CAN Controller. This is done to enable the Application
to realize an orthogonal software structure.
During the call of CanStart() the CAN Driver has to be offline.
CanStart() must not be interrupted by CanInit(), CanReset...(), CanWakeUp() or any
CAN interrupt routine and vice versa.
CanStart(..) is not reentrant and therefore must not be called recursively.
©2010, Vector Informatik GmbH
Version: 3.01.01
91 / 149
based on template version 2.1









TechnicalReference Vector CAN Driver
8.5.1.19 CanStop CanStopPrototype
Single Receive Channel
vuint8
CanStop ( void )
Multiple Receive Channel
vuint8
CanStop ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code
Result of the stop request:
kCanFailed
Stop mode not entered
kCanOk
Stop mode entered
kCanNotSupported
The function CanStop is not supported by this driver.
Functional Description
The service function CanStop() puts the CAN Controller into stop or hold mode. This does not
reduces the power consumption of the CAN Controller. The stop mode can only be left by calling
CanStart(). CanStop() must not be called in sleep mode.
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations
This functionality is not supported for all CAN Controllers. In such case the function is provided by
the CAN Driver but without any effect on the CAN Controller. This is done to enable the Application
to realize an orthogonal software structure.
During the call of CanStop() the CAN Driver has to be offline.
CanStop() must not be interrupted by CanInit(), CanReset...(), CanWakeUp() or any
CAN interrupt routine and vice versa.
CanStop(..) is not reentrant and therefore must not be called recursively.
8.5.1.20 CanGlobalInterruptDisable CanGlobalInterruptDisablePrototype
Single Receive Channel
void
CanGlobalInterruptDisable ( void )
Multiple Receive Channel
Parameter -
-
Return code -
-
Functional Description
The service function CanGlobalInterruptDisable() disables interrupts, either by changing the
global interrupt control flag of the microprocessor or the interrupt level of the interrupt controller. In the
later case, the interrupt level is configurable. All levels where the CAN API (CAN interrupt, Flags,
service functions) is used have to be disabled.
©2010, Vector Informatik GmbH
Version: 3.01.01
92 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Particularities and Limitations
This function has been moved to VstdLib. For more information refer to Application note-ISC-2-
1050_VstdLibIntegration.pdf
8.5.1.21 CanGlobalInterruptRestore CanGlobalInterruptRestorePrototype
Single Receive Channel
void
CanGlobalInterruptRestore ( void )
Multiple Receive Channel
Parameter -
-
Return code -
-
Functional Description
The service function CanGlobalInterruptRestore() restores the initial interrupt state which was
saved temporarily by CanGlobalInterruptDisable(). If CanGlobalInterruptDisable() is
called in a nested way, the initial interrupt state is not restored until
CanGlobalInterruptRestore() has been called as many times.
Particularities and Limitations
This function has been moved to VstdLib. For more information refer to Application note AN-ISC-2-
1050_VstdLibIntegration.pdf
8.5.1.22 CanCanInterruptDisable CanCanInterruptDisablePrototype
Single Receive Channel
void
CanCanInterruptDisable ( void )
Multiple Receive Channel
void
CanCanInterruptDisable ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanCanInterruptDisable() disables all CAN interrupts of one CAN channel,
either by changing the CAN interrupt control flags of the interrupt controller or of the CAN controller. In
case of separately implemented wake-up interrupt routines they have to be disabled by the
application. Therefore the callback function ApplCanAddCanInterruptDisable() can be
activated.
Particularities and Limitations ©2010, Vector Informatik GmbH
Version: 3.01.01
93 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
The CAN Drivers differ in the implementation of this service function. Please refer to the CAN
Controller specification documentation TechnicalReference_CAN_<hardware>.pdf [#hw_int] for
details.
This service function is not allowed to be called during Sleep-Mode.
8.5.1.23 CanCanInterruptRestore CanCanInterruptRestorePrototype
Single Receive Channel
void
CanCanInterruptRestore ( void )
Multiple Receive Channel
void
CanCanInterruptRestore ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanCanInterruptRestore() restores the initial interrupt state which was
saved temporarily by CanCanInterruptDisable(). If CanCanInterruptDisable() is called in
a nested way, the initial interrupt state is not restored until CanCanInterruptRestore() has been
called as many times. In case of separately implemented wake-up interrupt routines they have to be
restored by the application. Therefore the callback function ApplCanAddCanInterruptRestore()
can be activated.
Particularities and Limitations
The CAN Drivers differ in the implementation of this service function. Please refer to the CAN
Controller specification documentation TechnicalReference_CAN_<hardware>.pdf [#hw_int] for
details.
This service function is not allowed to be called during Sleep-Mode.
8.5.1.24 CanSetPassive CanSetPassivePrototype
Single Receive Channel
void
CanSetPassive ( void )
Multiple Receive Channel
void
CanSetPassive ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanSetPassive(..) switches the CAN Driver to the passive state.
For indexed CAN Driver, this functionality is related to the specified CAN channel.
©2010, Vector Informatik GmbH
Version: 3.01.01
94 / 149
based on template version 2.1





TechnicalReference Vector CAN Driver
Particularities and Limitations
If the CAN Driver is configured to use a transmit queue, all queue entries will be cleared, i.e.
transmit requests and subsequent confirmations will be lost.
The passive state of the CAN Driver will have an effect only if it is enabled by the CAN Driver
configuration. Nevertheless this service function is available at any time
8.5.1.25 CanSetActive CanSetActivePrototype
Single Receive Channel
void
CanSetActive ( void )
Multiple Receive Channel
void
CanSetActive ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanSetActive() switches the CAN Driver back to the active state.
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations
The passive state of the CAN Driver will have an effect only if it is enabled by the CAN Driver
configuration. Nevertheless this service function is available at any time.
8.5.1.26 CanResetBusOffStart CanResetBusOffStartPrototype
Single Receive Channel
void
CanResetBusOffStart ( CanInitHandle initObject )
Multiple Receive Channel
void
CanResetBusOffStart ( CanChannelHandle channel,
CanInitHandle initObject )
Parameter initObject
Handle of an initialization structure. The generated macros should be
used:
kCanInitObjX (with X = 1 ... Number of generated initialization structures)
channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description ©2010, Vector Informatik GmbH
Version: 3.01.01
95 / 149
based on template version 2.1




TechnicalReference Vector CAN Driver
This service function starts error recovery of the CAN Controller directly after BusOff. Usually a re-
initialization of the CAN Controller is done. The correct handling of a BusOff depends on the used
CAN Controller. Please refer to the CAN Controller specification documentation
TechnicalReference_CAN_<hardware>.pdf [#hw_busoff] for details.
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations During the call of CanResetBusOffStart(..), the CAN Driver has to be in offline mode.
CanResetBusOffStart(..) is not reentrant and therefore must not be called recursively.
CanResetBusOffStart() must not be interrupted by CanInit(), CanResetBusOffEnd(),
CanResetBusSleep(), CanSleep(), CanWakeUp() or by any CAN interrupt service routine
and vice versa.
This service function can be realized as a preprocessor macro.
8.5.1.27 CanResetBusOffEnd CanResetBusOffEndPrototype
Single Receive Channel
void
CanResetBusOffEnd ( CanInitHandle initObject )
Multiple Receive Channel
void
CanResetBusOffEnd ( CanChannelHandle channel,
CanInitHandle initObject )
Parameter initObject
Handle of an initialization structure. The generated macros should be
used:
kCanInitObjX (with X = 1 ... Number of generated initialization structures)
channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
Completes the error recovery after BusOff. For most of the CAN Drivers this service function has no
effect.
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations During the call of CanResetBusOffEnd(..), the CAN Driver has to be in offline mode.
CanResetBusOffEnd(..) is not reentrant and therefore must not be called recursively.
CanResetBusOffEnd() must not be interrupted by CanInit(), CanResetBusOffStart(),
CanResetBusSleep(), CanSleep(), CanWakeUp() or by any CAN interrupt service routine
and vice versa.
This service function can be realized as a preprocessor macro.
8.5.1.28 CanResetBusSleep CanResetBusSleepPrototype ©2010, Vector Informatik GmbH
Version: 3.01.01
96 / 149
based on template version 2.1




TechnicalReference Vector CAN Driver
Single Receive Channel
void
CanResetBusSleep ( CanInitHandle initObject )
Multiple Receive Channel
void
CanResetBusSleep ( CanChannelHandle channel,
CanInitHandle initObject )
Parameter initObject
Handle of an initialization structure. The generated macros should be
used:
kCanInitObjX (with X = 1 ... Number of generated initialization structures)
channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
This service function aborts pending transmit requests in the CAN Controller before the sleep mode of
the CAN Controller is entered. This can be done by different ways, depending on CAN Controller
specific features:
Complete re-initialization of the CAN Controller (using the service function CanInit() )
Cancel of the transmit requests
Please refer to the CAN Controller specific documentation for details.
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations During the call of CanResetBusSleep(..), the CAN Driver has to be in offline mode.
CanResetBusSleep(..) is not reentrant and therefore must not be called recursively.
CanResetBusSleep() must not be interrupted by CanInit(), CanResetBusOffStart(),
CanResetBusOffEnd(), CanSleep(), CanWakeUp() or by any CAN interrupt service routine
and vice versa.
This service function can be realized as a preprocessor macro.
8.5.1.29 CanGetDynTxObj CanGetDynTxObjPrototype
Single Receive Channel
CanTransmitHandle
CanGetDynTxObj ( CanTransmitHandle
Multiple Receive Channel
txObject )
Parameter txObject
Handle of the dynamic transmit object.
Return code CanTransmitHandle
Handle of the dynamic transmit object or kCanNoTxDynObjAvailable
if no dynamic transmit object is available or the specific dynamic object
is already used.
Functional Description ©2010, Vector Informatik GmbH
Version: 3.01.01
97 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Reserves a dynamic transmit object.
To use dynamic transmit objects an Application must reserve a dynamic transmit object from the CAN
Driver.
Before transmission, the Application must set all configured dynamic parameters of the dynamic
transmit object.
The Application can use a dynamic transmit object for one or many transmissions, but finally it must
release the dynamic transmit object by calling CanReleaseDynTxObj(..).
Particularities and Limitations This service function is only available, if dynamic transmit objects are configured.
The generated handles should be used to reference the transmit objects. The names consist of the
message symbol, a prefix and a postfix. Fixed rules are used to build these names. For more
details please refer to the online help of the Generation Tool.
©2010, Vector Informatik GmbH
Version: 3.01.01
98 / 149
based on template version 2.1







TechnicalReference Vector CAN Driver
8.5.1.30 CanReleaseDynTxObj CanReleaseDynTxObjPrototype
Single Receive Channel
vuint8
CanReleaseDynTxObj ( CanTransmitHandle txObject )
Multiple Receive Channel
Parameter txObject
Handle of the dynamic transmit object which was returned by
CanGetDynTxObj(..)
Return code kCanDynReleased
Dynamic object is released
kCanDynNotReleased
Dynamic transmit object couldn’t be released because the object is still
in the transmit queue or in the transmit register of the CAN Controller.
CanReleaseDynTxObj(..) has to be called later again.
Functional Description
Release a dynamic transmit object, which was reserved before by calling CanGetDynTxObj(..).
The dynamic transmit object is referenced by txObject.
After a transmission of one or more messages is finished, the Application has to release the reserved
resource, because the number of dynamic transmit objects is limited and the Application should not
keep reserved dynamic transmit objects for a longer time.
Particularities and Limitations This service function is only available, if dynamic transmit objects are configured.
The parameter txObject was reserved before by a call to CanGetDynTxObj(..).
8.5.1.31 CanDynTxObjSetId CanDynTxObjSetIdPrototype
Single Receive Channel
void
CanDynTxObjSetId ( CanTransmitHandle txObject, vuint16
Multiple Receive Channel
id )
Parameter txObject
Handle of the dynamic transmit object which was returned by
CanGetDynTxObj(..).
id
CAN identifier in standard format
Return code -
-
Functional Description
Sets the CAN identifier in standard format of a dynamic transmit object. The dynamic transmit object is
referenced by txObject.
Particularities and Limitations
This service function is only available, if dynamic transmit objects are configured.
The parameter txObject was reserved before by a call to CanGetDynTxObj(..).
©2010, Vector Informatik GmbH
Version: 3.01.01
99 / 149
based on template version 2.1










TechnicalReference Vector CAN Driver
8.5.1.32 CanDynTxObjSetExtId CanDynObjSetExtIdPrototype
Single Receive Channel
void
CanDynTxObjSetExtId ( CanTransmitHandle txObject,
Multiple Receive Channel
vuint16 idExtHi,
vuint16 idExtLo)
Parameter txObject
Handle of the dynamic transmit object which was returned by
CanGetDynTxObj(..)
idExtHi
Upper 16 bit of the CAN identifier in extended format
idExtLo
Lower 16 bit of the CAN identifier in extended format
Return code -
-
Functional Description
Sets the CAN identifier in extended format of a dynamic transmit object. The dynamic transmit object
is referenced by txObject
Particularities and Limitations
This service function is only available, if dynamic transmit objects are configured.
The parameter txObject was reserved before by a call to CanGetDynTxObj(..).
8.5.1.33 CanDynTxObjSetDlc CanDynTxObjSetDlcPrototype
Single Receive Channel
void
CanDynTxObjSetDlc ( CanTransmitHandle txObject,
Multiple Receive Channel
vuint8 dlc )
Parameter txObject
Handle of the dynamic transmit object which was returned by
CanGetDynTxObj(..)
dlc
Data Length Code of the dynamic transmit object
Return code -
-
Functional Description
Sets the Data Length Code of a dynamic transmit object. The dynamic transmit object is referenced by
txObject.
Particularities and Limitations This service function is only available, if dynamic transmit objects are configured.
The parameter txObject was reserved before by a call to CanGetDynTxObj(..).
©2010, Vector Informatik GmbH
Version: 3.01.01
100 / 149
based on template version 2.1




TechnicalReference Vector CAN Driver
8.5.1.34 CanDynTxObjSetDataPtr CanDynTxObjSetDataPtrPrototype
Single Receive Channel
void
CanDynTxObjSetDataPtr ( CanTransmitHandle txObject,
Multiple Receive Channel
vuint8 *pData )
Parameter txObject
Handle of the dynamic transmit object which was returned by
CanGetDynTxObj(..)
*pData
Data reference of the application specific data buffer referenced by the
dynamic transmit object
Return code -
-
Functional Description
Sets the data pointer of a dynamic transmit object. The dynamic transmit object is referenced by
txObject.
Particularities and Limitations This service function is only available, if dynamic transmit objects are configured.
The parameter txObject was reserved before by a call to CanGetDynTxObj(..).
8.5.1.35 CanCancelTransmit CanCancelTransmitPrototype
Single Receive Channel
void
CanCancelTransmit ( CanTransmitHandle txObject )
Multiple Receive Channel
Parameter txObject
Handle of the transmit object
Return code -
-
Functional Description
The call of the confirmation function resp. setting of the confirmation flag associated with txObject are
suppressed, if this message is already in the transmit buffer of the CAN controller.
If the transmit queue is enabled, a pending transmit request in the queue is canceled.
Particularities and Limitations
The function call of CanCancelTransmit() must not interrupt the transmit ISR, CanTransmit() or
the CanTxTask().
Though a transmission is canceled it will be sent if the request has been already in the hardware
object. Only if activated and highly dependent on hardware and vehicle manufacturer the transmit
request can be deleted in the hardware transmit object, too.
8.5.1.36 CanCopyFromCan CanCopyFromCan©2010, Vector Informatik GmbH
Version: 3.01.01
101 / 149
based on template version 2.1













TechnicalReference Vector CAN Driver
Prototype
Single Receive Channel
void
CanCopyFromCan (void *dst, CanChipDataPtr src, vuint8
Multiple Receive Channel
len)
Parameter dst
Pointer to the destination in default memory. This pointer is available in
the Precopy Function.
src
Pointer to the source CAN buffer or temporary buffer
len
number of bytes which have to be copied
Return code -
-
Functional Description
This function copies data from the CAN data buffer to the RAM.
Particularities and Limitations
This function can only be used within precopy functions.
8.5.1.37 CanCopyToCan CanCopyToCanPrototype
Single Receive Channel
void
CanCopyToCan ( CanChipDataPtr dst, void *src, vuint8
Multiple Receive Channel
len)
Parameter dst
Pointer to the destination CAN buffer or temporary buffer. This pointer is
available in the Pretransmit Function.
src
Pointer to the source in default memory.
len
number of bytes which have to be copied
Return code -
-
Functional Description
This function copies data from the RAM into the CAN data buffer.
Particularities and Limitations
This function can only be used within pretransmit functions.
8.5.1.38 CanTxGetActHandle CanTxGetActHandlePrototype
Single Receive Channel
CanTransmitHandle
CanTxGetActHandle (CanObjectHandle
Multiple Receive Channel
logTxHwObject)
Parameter ©2010, Vector Informatik GmbH
Version: 3.01.01
102 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
logTxHwObject
Handle of the CAN hardware transmit object. For indexed drivers this is
a unique number over all CAN channels.
Return code txObject
Handle of the transmit object which is currently in the hardware transmit
object. In case of enabled LowLevelMessageTransmit, this could also be
a handle of such a message
kCanBufferMsgTransmit: CanCancelMsgTransmit
kCanTxHandleNotUsed: Handle is not valid
Functional Description
This service functions returns the handle of the transmit message, which has been transmitted in a
certain CAN hardware transmit object. The return value can be used as a parameter for
CanCancelTransmit(). If the return value is kCanBufferMsgTransmit,
CanCancelMsgTransmit() has to be called in stead of CanCancelTransmit().
CanCancelTransmit() ignores invalid handle and kCanBufferMsgTransmit.
Particularities and Limitations
This function is only allowed to be called in or after ApplCanTxObjStart() and before
ApplCanTxObjConfirmed() of a certain CAN buffer.
8.5.1.39 CanResetMsgReceivedCondition CanResetMsgReceivedConditionPrototype
Single Receive Channel
void
CanResetMsgReceivedCondition ( void )
Multiple Receive Channel
void
CanResetMsgReceivedCondition ( CanChannelHandle
channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanResetMsgReceivedConditional() disables the calling of
ApplCanMsgCondReceived().
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations
8.5.1.40 CanSetMsgReceivedCondition CanSetMsgReceivedConditionPrototype
Single Receive Channel
void
CanSetMsgReceivedCondition ( void )
Multiple Receive Channel
void
CanSetMsgReceivedCondition ( CanChannelHandle channel
)
Parameter ©2010, Vector Informatik GmbH
Version: 3.01.01
103 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanSetMsgReceivedConditional() enables the calling of
ApplCanMsgCondReceived().
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations
8.5.1.41 CanGetMsgReceivedCondition CanGetMsgReceivedConditionPrototype
Single Receive Channel
void
CanGetMsgReceivedCondition ( void )
Multiple Receive Channel
void
CanGetMsgReceivedCondition ( CanChannelHandle channel
)
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The service function CanGetMsgReceivedConditional()returns the status of the condition for
calling ApplCanMsgCondReceived().
For indexed CAN Driver, this functionality is related to the specified CAN channel.
Particularities and Limitations
©2010, Vector Informatik GmbH
Version: 3.01.01
104 / 149
based on template version 2.1






TechnicalReference Vector CAN Driver
8.5.2 User Specific Functions
The user specific functions listed in this section are called by the CAN Driver and provided
by the Application when certain events occur. The user can define user specific functions
specifically for each message. The names in this section are only placeholders. The name
could be set in the generation tool. The type of the particular user specific message must
agree with the function types listed here.
8.5.2.1 UserPrecopy UserPrecopyPrototype
Single Receive Channel
vuint8
UserPrecopy ( CanRxInfoStructPtr rxStruct )
Multiple Receive Channel
Parameter rxStruct
Pointer to the receive structure
Return code kCanCopyData
Received data will be copied using the CAN Driver 's internal copy
mechanism
kCanNoCopyData
CAN Driver doesn’t copy data and doesn’t perform indication
Functional Description
User specific function of the CAN Driver, which is called in the receive interrupt of a CAN message
before copying the data from the CAN Controller receive register to the application specific global data
buffer.
Depending on the function's return code, the CAN Driver will either terminate the processing of the
received message (kCanNoCopyData) or resume normal processing (kCanCopyData).
Particularities and Limitations
For each CAN message a separate precopy function may be defined.
8.5.2.2 UserIndication UserIndicationPrototype
Single Receive Channel
void
UserIndication( CanReceiveHandle rxObject)
Multiple Receive Channel
Parameter rxObject
Handle of the received message
Return code -
-
Functional Description
User specific function which is called in the receive interrupt of a CAN message after data has been
copied and the CAN Controller receive register have been released.
Particularities and Limitations
For each CAN message a separate indication function may be defined.
©2010, Vector Informatik GmbH
Version: 3.01.01
105 / 149
based on template version 2.1






TechnicalReference Vector CAN Driver
8.5.2.3 UserPreTransmit UserPreTransmitPrototype
Single Receive Channel
vuint8
UserPreTransmit( CanTxInfoStruct txStruct )
Multiple Receive Channel
Parameter txStruct
Transmit structure
Return code
kCanCopyData
After the return of this user specific function, the CAN Driver copies the
data to be transmitted from the application specific global data buffer
associated to the corresponding message to the CAN Controller transmit
register
kCanNoCopyData
The CAN Driver does not copy data but starts the transmit request in the
CAN Controller immediately
Functional Description
User specific function which is called before the message is copied from the application specific data
buffer to the transmit register of the CAN Controller. This is done in the scope of the Tx interrupt or the
CanTxTask() via CanTransmit(..). The usage of the internal copy mechanism of the CAN Driver
is controlled by the return code.
A possible usage is the acquiring and copying of existing data which are spread in the Application.
Particularities and Limitations For each CAN message a separate pretransmit function may be defined.
8.5.2.4 UserConfirmation UserConfirmationPrototype
Single Receive Channel
void
UserConfirmation( CanTransmitHandle txObject )
Multiple Receive Channel
Parameter txObject
Handle of the transmit object
Return code -
-
Functional Description
User specific function which is called in the scope of the CAN transmit interrupt routine or the
CanTxTask() after the message has been sent on the CAN bus successfully
Particularities and Limitations For each CAN message a separate confirmation function may be defined.
©2010, Vector Informatik GmbH
Version: 3.01.01
106 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
8.5.3 Callback Functions
Callback functions are called by the CAN Driver on certain events and have to be provided
by the Application. In contrast to the user specific functions in the section before the
callback functions are not message related but only event related. Their name can also be
reconfigured.
8.5.3.1 ApplCanBusOff ApplCanBusOffPrototype
Single Receive Channel
void
ApplCanBusOff ( void )
Multiple Receive Channel
void
ApplCanBusOff ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
This callback function is called if the CAN Controller enters BusOff state. The function is called in the
error interrupt, CanTask() or CanErrorTask().
Particularities and Limitations
If no Network Management is used which provides a BusOff error handling, the Application has to do
the subsequent error handling (usually the re-initialization of the CAN Controller) by the CAN Driver
service function CanResetBusOffStart() and CanResetBusOffEnd() itself.
8.5.3.2 ApplCanWakeUp ApplCanWakeUpPrototype
Single Receive Channel
void
ApplCanWakeUp ( void )
Multiple Receive Channel
void
ApplCanWakeUp ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
This callback function is called if a wake-up condition on the CAN bus is detected during sleep mode
of the CAN Controller. The function is called in the wakeup interrupt, in the CanTask() or in the
CanWakeupTask().
Particularities and Limitations ©2010, Vector Informatik GmbH
Version: 3.01.01
107 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
If the CAN Controller was put into sleep mode by calling the service function CanSleep(), and
afterwards there is a dominant level at the receive input of the CAN Controller, CAN Controller
generates a wake-up interrupt. The CAN Driver calls the callback function ApplCanWakeUp() to
handle further wake-up call activities, e.g. starting the Network Management.
The Application must assure that the CAN transmit path is restored to its normal operating state,
typically by the activation of the bus transceiver.
This wake-up functionality is not supported by all CAN Controllers. If there is no power-down mode
of the CAN Controller or if the microprocessor cannot detect an external wake-up condition by the
CAN bus, this callback function will never be called.
8.5.3.3 ApplCanOverrun ApplCanOverrunPrototype
Single Receive Channel
void
ApplCanOverrun ( void )
Multiple Receive Channel
void
ApplCanOverrun ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
This callback function is called if an overrun in a Basic CAN receive object was detected. It indicates a
possible loss of receive data. The function is called in the error interrupt, in the receive interrupt, in the
CanTask(), in the CanRxTask(), or in the CanErrorTask().
Particularities and Limitations
The overrun is completely handled by the CAN Driver. This callback function only notifies the
Application about such a condition.
8.5.3.4 ApplCanFullCanOverrun ApplCanFullCanOverrunPrototype
Single Receive Channel
void
ApplCanFullCanOverrun ( void )
Multiple Receive Channel
void
ApplCanFullCanOverrun ( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
This callback function is called if an overrun of a Full CAN receive object was detected. It indicates a
possible loss of receive data. The function is called in the error interrupt, in the receive interrupt, in the
CanTask(), in the CanRxTask() or in the CanErrorTask().
©2010, Vector Informatik GmbH
Version: 3.01.01
108 / 149
based on template version 2.1









TechnicalReference Vector CAN Driver
Particularities and Limitations
The overrun is completely handled by the CAN Driver. This callback function only notifies the
Application about an overrun.
8.5.3.5 ApplCanMsgReceived ApplCanMsgReceivedPrototype
Single Receive Channel
vuint8
ApplCanMsgReceived( CanRxInfoStructPtr rxStruct )
Multiple Receive Channel
Parameter rxStruct
Pointer to receive information structure
Return code kCanCopyData
Receive processing will be continued
kCanNoCopyData
Receive processing will be terminated
Functional Description
This callback function is called on every reception of a CAN message when the hardware acceptance
filter is passed. The function is called in the receive interrupt, in the CanTask() or in the
CanRxTask().
Particularities and Limitations
The callback function may be used for gateway functionality or any other purpose.
There are preprocessor macros available to read the CAN identifier, the Data Length Code and the
data in the CAN Controller receive register.
8.5.3.6 ApplCanRangePrecopy ApplCanRangePrecopyPrototype
Single Receive Channel
vuint8
ApplCanRangePrecopy( CanRxInfoStructPtr rxStruct)
Multiple Receive Channel
Parameter rxStruct
Pointer to the receive structure
Return code kCanCopyData
The CAN receive interrupt routine is continued with verifying a match to
the next range and ID search.
kCanNoCopyData
The CAN receive interrupt routine is terminated immediately after the
CAN Controller is serviced
Functional Description ©2010, Vector Informatik GmbH
Version: 3.01.01
109 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
This precopy function is not called on a specific message CAN identifier but on a complete CAN
identifier range. The function is called in the receive interrupt, in the CanTask(), in the
CanRxTask() or in CanHandleRxMsg(). The return code is not taken into account, if the range is
handled via the RX Queue. In this case, the handling of the received message will be terminated after
calling the range specific precopy function.
The name of this function is only a placeholder. The name could be set in the generation tool.
Up to four ranges with individual precopy functions can be specified per CAN channel.
Particularities and Limitations Ranges are normally used for Network Management or Transport Protocol services only
In case a range configured to be handled via the Rx Queue, the return code of this function is
ignored.
8.5.3.7 ApplCanAddCanInterruptDisable ApplCanAddCanInterruptDisablePrototype
Single Receive Channel
void
ApplCanAddCanInterruptDisable ( CanChannelHandle
Multiple Receive Channel
channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
In case of Single Receive Channel channel is always 0.
Return code -
-
Functional Description
Disabling of additional CAN interrupts (like separately implemented Wake-Up interrupts and Polling
Tasks) can be added to the standard mechanism of the CAN by this callback function. The function is
called on interrupt and task level.
Particularities and Limitations ApplCanAddCanInterruptDisable() is only called if configured
8.5.3.8 ApplCanAddCanInterruptRestore ApplCanAddCanInterruptRestorePrototype
Single Receive Channel
void
ApplCanAddCanInterruptRestore ( CanChannelHandle
Multiple Receive Channel
channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
In case of Single Receive Channel channel is always 0.
Return code -
-
Functional Description ©2010, Vector Informatik GmbH
Version: 3.01.01
110 / 149
based on template version 2.1




TechnicalReference Vector CAN Driver
Complementary callback function for ApplCanAddCanInterruptDisable().The function is called
on interrupt and task level.
Particularities and Limitations ApplCanAddCanInterruptRestore() is only called if configured.
8.5.3.9 ApplCanFatalError ApplCanFatalErrorPrototype
Single Receive Channel
void
ApplCanFatalError ( vuint8 errorNumber )
Multiple Receive Channel
void
ApplCanFatalError ( CanChannelHandle channel, vuint8
errorNumber )
Parameter errorNumber
Error identification: There is a predefined list with supported assertion
checks for each CAN Driver. All the function parameters starting with
kError.... Please refer to chapter
Assertions and the CAN Controller
Specific documentation TechnicalReference_CAN_<hardware>.pdf
[#hw_assert] for details.
channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
If assertions are configured, the callback function ApplCanFatalError(..) is called in case of
invalid user conditions (Application interface, reentrance), inconsistent generated data, hardware
errors or internal errors (queue). An error number is passed by the parameter. The function is called on
interrupt and task level.
Particularities and Limitations This callback function does not have to return to the CAN Driver.
8.5.3.10 ApplCanMsgNotMatched ApplCanMsgNotMatchedPrototype
Single Receive Channel
void
ApplCanMsgNotMatched ( CanRxInfoStructPtr rxStruct )
Multiple Receive Channel
Parameter rxStruct
Pointer to the receive structure
Return code -
-
Functional Description
This callback function is called if a CAN message passes the hardware acceptance filter, but not the
software filter (inclusive the identifier specific predefined ranges). The function is called in the receive
interrupt, in the CanTask() or in the CanRxTask().
©2010, Vector Informatik GmbH
Version: 3.01.01
111 / 149
based on template version 2.1









TechnicalReference Vector CAN Driver
Particularities and Limitations
8.5.3.11 ApplCanInit ApplCanInitPrototype
Single Receive Channel
void
ApplCanInit( CanObjectHandle logTxHwObjectFirstUsed,
CanObjectHandle logTxHwObjectFirstUnused)
Multiple Receive Channel
void
ApplCanInit( CanChannelObject channel,
CanObjectHandle logTxHwObjectFirstUsed,
CanObjectHandle logTxHwObjectFirstUnused)
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
logTxHwObjectFirstUsed
Handle of the first CAN hardware transmit object of the current channel.
logTxHwObjectFirstUnused Handle of the first unused CAN hardware transmit object of the current
channel.
example:
for ( i = logTxHwObjectFirstUsed; i <
logTxHwObjectFirstUnused; i++)
{
/* loop over all used hardware transmit buffer of
the current
channel */
}
Return code -
-
Functional Description
This callback function is called in CanInit() for general purposes. In CanInit() transmit requests in
the CAN Controller are canceled. This means the corresponding confirmation notification will never
occur. User defined actions started in ApplCanTxObjStart() have to be stopped in
ApplCanInit().The function is called on interrupt and task level.
Particularities and Limitations
This callback is active only if ‘Tx observe’ functionality is activated.
©2010, Vector Informatik GmbH
Version: 3.01.01
112 / 149
based on template version 2.1











TechnicalReference Vector CAN Driver
8.5.3.12 ApplCanTxObjStart ApplCanTxObjStartPrototype
Single Receive Channel
void
ApplCanTxObjStart( CanObjectHandle logTxHwObject)
Multiple Receive Channel
void
ApplCanTxObjStart( CanChannelHandle channel,
CanObjectHandle logTxHwObject)
Parameter
channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
logTxHwObject
Handle of the CAN buffer transmit object. For indexed drivers this is a
unique number over all CAN channels.
Return code -
-
Functional Description
This callback function is called every time, a transmit request is initiated in the CAN Controller. This is
done in the service CanTransmit(..).The function is called in the transmit interrupt, in the
CanTask() or in the CanTxTask(), if the transmit queue is enabled.
Particularities and Limitations
This callback is active only if ‘Tx observe’ functionality is activated.
8.5.3.13 ApplCanTxObjConfirmed ApplCanTxObjConfirmedPrototype
Single Receive Channel
void
ApplCanTxObjConfirmed( CanObjectHandle logTxHwObject)
Multiple Receive Channel
void
ApplCanTxObjConfirmed (CanChannelHandle channel,
CanObjectHandle logTxHwObject)
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
logTxHwObject
Handle of the CAN buffer transmit object. For indexed drivers this is a
unique number over all CAN channels.
Return code -
-
Functional Description
This callback function is called every time, a successful transmission is confirmed by the CAN
Controller in the scope of a transmit interrupt, in the CanTask() or in the CanTxTask().
Particularities and Limitations
This callback is active only if ‘Tx observe’ functionality is activated.
©2010, Vector Informatik GmbH
Version: 3.01.01
113 / 149
based on template version 2.1














TechnicalReference Vector CAN Driver
8.5.3.14 ApplCanTimerStart ApplCanTimerStartPrototype
Single Receive Channel
void
ApplCanTimerStart(vuint8 timerIdentification)
Multiple Receive Channel
void
ApplCanTimerStart(CanChannelObject channel, vuint8
timerIdentification)
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
timerIdentification
Identifier for the hardware dependent loop timer
Return code -
-
Functional Description
This callback function is called before a CAN Controller dependent loop is started.
Particularities and Limitations
8.5.3.15 ApplCanTimerLoop ApplCanTimerLoopPrototype
Single Receive Channel
vuint8
ApplCanTimerLoop(vuint8 timerIdentification)
Multiple Receive Channel
vuint8
ApplCanTimerLoop(CanChannelObject channel, vuint8
timerIdentification)
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
timerIdentification
Identifier for the hardware dependent loop timer
Return code FALSE (equal to 0)
Exit loop, even if hardware is not correct
TRUE (not equal to 0)
Continue with waiting for hardware condition
Functional Description
This callback function is called once in every loop cycle, i.e. multiple times for a specific condition.
Particularities and Limitations
©2010, Vector Informatik GmbH
Version: 3.01.01
114 / 149
based on template version 2.1











TechnicalReference Vector CAN Driver
8.5.3.16 ApplCanTimerEnd ApplCanTimerEndPrototype
Single Receive Channel
void
ApplCanTimerEnd(vuint8 timerIdentification)
Multiple Receive Channel
void
ApplCanTimerEnd(CanChannelObject channel, vuint8
timerIdentification)
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
timerIdentification
Identifier for the hardware dependent loop timer
Return code -
-
Functional Description
This callback function is called after a hardware dependent loop is finished, due to return value also of
ApplCanTimerLoop or hardware condition met.
Particularities and Limitations
8.5.3.17 ApplCanGenericPrecopy ApplCanGenericPrecopyPrototype
Single Receive Channel
vuint8
ApplCanGenericPrecopy(CanRxInfoStructPtr rxStruct)
Multiple Receive Channel
Parameter rxStruct
Pointer to the receive structure
Return code kCanCopyData
The UserPrecopy function will be called and the Received data will be
copied using the CAN Driver’s internal copy mechanism.
kCanNoCopyData
CAN Driver doesn’t copy data and doesn’t perform indication
Functional Description
This precopy function is common to all receive messages. It will be called immediately after the DLC-
check. The call of the UserPrecopy functions or copy of data are influenced by
ApplCanGenericPrecopy(). The function is called in the receive interrupt, in the CanTask() or in
the CanRxTask().
Particularities and Limitations
8.5.3.18 ApplCanPreWakeup ApplCanPreWakeupPrototype ©2010, Vector Informatik GmbH
Version: 3.01.01
115 / 149
based on template version 2.1





TechnicalReference Vector CAN Driver
Single Receive Channel
void
ApplCanPreWakeUp( void )
Multiple Receive Channel
void
ApplCanPreWakeUp(CanChannelHandle channel)
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
Is called just after the activation of the wakeup interrupt.
Particularities and Limitations
8.5.3.19 ApplCanTxConfirmation ApplCanTxConfirmationPrototype
Single Receive Channel
void
ApplCanTxConfirmation( CanTxInfoStructPtr txStruct)
Multiple Receive Channel
Parameter txStruct
Pointer to transmit structure
typedef struct
{
CanChannelHandle Channel;
CanTransmitHandle Handle;
} tCanTxConfInfoStruct;
typedef tCanTxConfInfoStruct
*CanTxInfoStructPtr;
Handle:
- 0 ... (kCanNumberOfTxMessages-1): the handle of the Tx message.
- kCanBufferMsgTransmit, in case the message was sent via
CanCancelMsgTransmit().
- ((CanTransmitHandle)0xFFFFFFFEU)
in case the message was cancel by CanCanTransmit() or
CanCancelMsgTransmit() but sent on the bus
Return code -
-
Functional Description
This confirmation function is common to all transmit messages. It will be called after the successful
transmission. The function is called in the transmit interrupt, in the CanTask() or in the
CanTxTask().
Particularities and Limitations
©2010, Vector Informatik GmbH
Version: 3.01.01
116 / 149
based on template version 2.1





TechnicalReference Vector CAN Driver
8.5.3.20 ApplCanMsgDlcFailed ApplCanMsgDlcFailedPrototype
Single Receive Channel
void
ApplCanMsgDlcFailed( CanRxInfoStructPtr rxStruct )
Multiple Receive Channel
Parameter rxStruct
Pointer to the receive structure
Return code -
-
Functional Description
This callback function is called, if the DLC check fails. To activate this callback function the switch
C_ENABLE_DLC_FAILED_FCT has to be set in a user configuration file. The function is called in the
receive interrupt, in the CanTask() or in the CanRxTask().
Particularities and Limitations
It depends on the OEM if ApplCanMsgDlcFailed() is available.
8.5.3.21 ApplCanCancelNotification ApplCanCancelNotificationPrototype
Single Receive Channel
void
ApplCanCancelNotification(CanTransmitHandle txHandle)
Multiple Receive Channel
Parameter txHandle
Handle of cancelled transmit object
Return code -
-
Functional Description
This function will be called if a transmit message is deleted (
CanCancelTransmit, CanOffline or
CanInit). This function could be called in Interrupt or Task context.
Particularities and Limitations
ApplCanCancelNotification() is only called if configured.
©2010, Vector Informatik GmbH
Version: 3.01.01
117 / 149
based on template version 2.1









TechnicalReference Vector CAN Driver
8.5.3.22 ApplCanOnline ApplCanOnlinePrototype
Single Receive Channel
void
ApplCanOnline(CanChannelHandle channel)
Multiple Receive Channel
Parameter channel
CAN Channel on which the CAN driver was switched to online mode.
Return code -
-
Functional Description
This callback function indicates that the CAN driver is switched to online mode. This function is called
by the CAN Driver if the mode change is initiated via CanOnline().
Particularities and Limitations
Call context: This function is called within CanOnline(). This service function is only allowed to be
called on task level.
8.5.3.23 ApplCanOffline ApplCanOfflinePrototype
Single Receive Channel
void
ApplCanOffline(CanChannelHandle channel)
Multiple Receive Channel
Parameter channel
CAN Channel on which the CAN driver was switched to offline mode.
Return code -
-
Functional Description
This callback function indicates that the CAN driver is switched to offline mode. This function is called
by the CAN Driver if the mode change is initiated via CanOffline().
Particularities and Limitations
Call context: This function is called within CanOffline(). This service function is allowed to be
called on task level or on interrupt level.
8.5.3.24 ApplCanMsgCondReceived ApplCanMsgCondReceivedPrototype
Single Receive Channel
void
ApplCanMsgCondReceived (CanRxInfoStructPtr rxStruct)
Multiple Receive Channel
Parameter rxStruct
Pointer to the receive information structure
©2010, Vector Informatik GmbH
Version: 3.01.01
118 / 149
based on template version 2.1







TechnicalReference Vector CAN Driver
Return code -
-
Functional Description
This callback function is conditionally called on every reception of a CAN message when the hardware
acceptance filter is passed.
There are preprocessor macros available to read the CAN identifier, the Data Length Code and the
data in the CAN Controller receive register.
Particularities and Limitations
Call context: The function is called in the receive interrupt, in the CanTask() or in the
CanRxTask().
8.5.3.25 ApplCanMemCheckFailed ApplCanMemCheckFailedPrototype
Single Receive Channel
vuint8
ApplCanMemCheckFailed ( void )
Multiple Receive Channel
vuint8
ApplCanMemCheckFailed ( CanChannelHandle channel )
Parameter Channel
Handle of the CAN channel on which the check failed. The generated
macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code kCanEnableCommunication Allow communication.
kCanDisableCommunication Disable communication, no reception and no transmission is performed.
Functional Description
This callback function is called if the CAN driver has found at least one corrupt memory bit within the
CAN mailboxes. The application can decide if the CAN driver allows further communication by means
of the return value.
Particularities and Limitations
Call context: This function is called on task level or within the busoff interrupt.
8.5.3.26 ApplCanCorruptMailbox ApplCanCorruptMailboxPrototype
Single Receive Channel
void
ApplCanCorruptMailbox ( CanObjectHandle hwObjHandle )
Multiple Receive Channel
void
ApplCanCorruptMailbox ( CanChannelHandle channel,
CanObjectHandle hwObjHandle )
Parameter hwObjHandle
The index of the corrupt mailbox.
channel
Handle of the CAN channel on which the corrupt mailbox is located. The
generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
©2010, Vector Informatik GmbH
Version: 3.01.01
119 / 149
based on template version 2.1



TechnicalReference Vector CAN Driver
Return code -
-
Functional Description
This callback function is called if the CAN driver has found a corrupt mailbox.
Particularities and Limitations
Call context: This function is called on task level or within the busoff interrupt.
©2010, Vector Informatik GmbH
Version: 3.01.01
120 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
9 Description of the API (High End extension) 9.1 Functions 9.1.1 Service Functions 9.1.1.1 CanTxObjTask CanTxObjTaskPrototype
Single Receive Channel
void
CanTxObjTask ( CanObjectHandle txObjHandle )
Multiple Receive Channel
void
CanTxObjTask ( CanChannelHandle canHwChannel,
CanObjectHandle txObjHandle )
Parameter canHwChannel
Handle of a CAN Hardware channel. The generated macros should be
used:
Normal Tx Object:
C_TX_NORMAL_<channel>_HW_CHANNEL (with <channel> = 0 ... Number
of logical channel)
Full CAN Tx Object:
<message name>_HW_CHANNEL (with <message name> = Name of the
Message with pre and postfixes generated in “can_par.h”t)
Low Level Tx Object:
C_TX_LL_<channel>_HW_CHANNEL (with <channel> = 0 ... Number of logical
channel)
txObjHandle
Handle of a Tx mailbox. The generated macros should be used:
Normal Tx Object:
C_TX_NORMAL_<channel>_HW_OBJ (with <channel> = 0 ... Number of
logical channel)
Full CAN Tx Object:
<message name>_HW_OBJ (with <message name> = Name of the Message with
pre and postfixes generated in “can_par.h”)
Low Level Tx Object:
C_TX_LL_<channel>_HW_OBJ (with <channel> = 0 ... Number of logical
channel)
Return code -
-
Functional Description
The service function CanTxObjTask() does polling of specified transmit hardware objects in the
CAN controller. Confirmation functions will be called and confirmation flags will be set. If the transmit
queue is configured, this service function additionally transmits the queued messages.
Particularities and Limitations CanTxObjTask() is available, if the individual polling mode and at least one mailbox is configured
for polling.
©2010, Vector Informatik GmbH
Version: 3.01.01
121 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
9.1.1.2 CanRxFullCANObjTask CanRxFullCANObjTaskPrototype
Single Receive Channel
void
CanRxFullCANObjTask (CanObjectHandle rxObjHandle )
Multiple Receive Channel
void
CanRxFullCANObjTask ( CanChannelHandle canHwChannel,
CanObjectHandle rxObjHandle )
Parameter canHwChannel
Handle of a CAN Hardware channel. The generated macros should be
used:
<message name>_HW_ CHANNEL (with <message name> = Name of the
Message with pre and postfixes generated in “can_par.h”)
rxObjHandle
Handle of an Rx mailbox. The generated macros should be used:
<message name>_HW_OBJ (with <message name> = Name of the Message
with pre and postfixes generated in “can_par.h”t)
Return code -
-
Functional Description
The service function CanRxFullCANObjTask() does polling of specified Full CAN receive objects
according to the configured objects in polling mode.
Particularities and Limitations CanRxFullCANObjTask() must not run on higher priority than other CAN functions.
CanRxFullCANObjTask() is available, if the individual polling mode and at least one mailbox is
configured for polling.
9.1.1.3 CanRxBasicCANObjTask CanRxBasicCANObjTaskPrototype
Single Receive Channel
void
CanRxBasicCANObjTask ( void )
Multiple Receive Channel
void
CanRxBasicCANObjTask (CanChannelHandle canHwChannel,
CanObjectHandle rxObjHandle )
Parameter canHwChannel
Handle of a CAN Hardware channel. The generated macros should be
used:
C_BASIC<number_of_the_BasicCAN>_<channel>HW_CHANNEL
(with <number_of_the_BasicCAN>= the logical number of the Basic CAN on this
channel
<channel> = 0 ... Number of logical channel)
txObjHandle
Handle of a Rx mailbox. The generated macros should be used:
C_BASIC<number_of_the_BasicCAN>_<channel>_HW_OBJ
(with
<number_of_the_BasicCAN>= the logical number of the Basic CAN on this channel
<channel> = 0 ... Number of logical channel)
Return code -
-
Functional Description ©2010, Vector Informatik GmbH
Version: 3.01.01
122 / 149
based on template version 2.1









TechnicalReference Vector CAN Driver
The service function CanRxBasicCANObjTask() does polling of specified Basic CAN receive
objects according to the configured objects in polling mode.
Particularities and Limitations CanRxBasicCANObjTask() must not run on higher priority than other CAN functions.
CanRxBasicCANObjTask() is available, if the individual polling mode and at least one mailbox is
configured for polling.
9.1.1.4 CanMsgTransmit CanMsgTransmitPrototype
Single Receive Channel
vuint8
CanMsgTransmit ( tCanMsgTransmitStruct *txData )
Multiple Receive Channel
vuint8
CanMsgTransmit ( CanChannelHandle channel,
tCanMsgObject *txData )
Parameter *txData
Pointer to the structure with ID, DLC and data to send
channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code kCanTxOk
if the message-buffer is free and the data could be copied to the CAN-
data-buffer or if passive mode (CanSetPassive()) is active.
kCanTxFailed
if offline mode is active, the CAN buffer is not free.
Functional Description
This function is called by the application. The function sends the message which is defined in the
txData (Id, DLC, Data) to the CAN-Bus which is defined in the channel.
Particularities and Limitations the contents of txData may not be changed while CanMsgTransmit() is running
9.1.1.5 CanCancelMsgTransmit CanCancelMsgTransmitPrototype
Single Receive Channel
void
CanCancelMsgTransmit( void )
Multiple Receive Channel
void
CanCancelMsgTransmit( CanChannelHandle channel )
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
The call of ApplCanMsgTransmitConf() is suppressed, if a message is already in the transmit
buffer of the CAN controller associated with CanMsgTransmit(). Dependent on the configuration
this function cancels a message in the CAN hardware.
©2010, Vector Informatik GmbH
Version: 3.01.01
123 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Particularities and Limitations
The function call of CanCancelTransmit() must not interrupt the transmit ISR,
CanMsgTransmit() or the CanTxTask().
Though a transmission is canceled it will be sent if the request has been already in the hardware
object. Only if activated and highly dependent on hardware and vehicle manufacturer the transmit
request which is initiated with CanMsgTransmit() can be deleted in the hardware transmit object,
too. The function CanCancelMsgTranmit() is only available if the confirmation
ApplCanMsgTransmitConf() is configured.
9.1.1.6 CanHandleRxMsg CanHandleRxMsgPrototype
Single Receive Channel
void
CanHandleRxMsg ( void )
Multiple Receive Channel
Parameter -
-
Return code -
-
Functional Description
The service function CanHandleRxMsg() handles the received messages which are stored in the Rx
Queue. The standard mechanism (GenericPrecopy, UserPrecopy, copy of data, Indication Flag and
UserIndication) is started for each stored message.
Particularities and Limitations
This function is only allowed to be called on task level.
9.1.1.7 CanDeleteRxQueue CanDeleteRxQueuePrototype
Single Receive Channel
void
CanDeleteRxQueue ( void )
Multiple Receive Channel
Parameter -
-
Return code -
-
Functional Description
The service function CanDeleteRxQueue() clears all pending messages in the Rx Queue.
Particularities and Limitations
This function is only allowed to be called on task level.
©2010, Vector Informatik GmbH
Version: 3.01.01
124 / 149
based on template version 2.1









TechnicalReference Vector CAN Driver
9.1.2 Callback Functions 9.1.2.1 ApplCanMsgTransmitConf ApplCanMsgTransmitConfPrototype
Single Receive Channel
void
ApplCanMsgTransmitConf( void )
Multiple Receive Channel
void
ApplCanMsgTransmitConf(CanChannelHandle channel)
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
This function will be called from the CAN Driver after sending the message. It is called directly in the
transmit Interrupt (Confirmation) from the CAN-Controller. On task level it is called in the CanTask()
or in the CanTxTask(). With this callback function it is possible to implement a queue-functionality.
Particularities and Limitations ApplCanMsgTransmitConf() is only called if configured.
9.1.2.2 ApplCanMsgTransmitInit ApplCanMsgTransmitInitPrototype
Single Receive Channel
void
ApplCanMsgTransmitInit( void )
Multiple Receive Channel
void
ApplCanMsgTransmitInit(CanChannelHandle channel)
Parameter channel
Handle of a CAN channel. The generated macros should be used:
kCanIndexX (with X = 0 ... Number of generated channel index)
Return code -
-
Functional Description
This function will be called from the CAN Driver after a possible cancel of a transmit request in
CanInit().
Particularities and Limitations ApplCanMsgTransmitInit() is only called if ApplCanMsgTransmitConf() is configured.
9.1.2.3 ApplCanMsgCancelNotification ApplCanMsgCancelNotificationPrototype
Single Receive Channel
void
ApplCanMsgCancelNotification( void )
©2010, Vector Informatik GmbH
Version: 3.01.01
125 / 149
based on template version 2.1






TechnicalReference Vector CAN Driver
Multiple Receive Channel
void
ApplCanMsgCancelNotification( CanChannelHandle channel
)
Parameter Channel
CAN Channel on which the Tx Object was cancelled.
Return code -
-
Functional Description
This function will be called if a transmit message is deleted (
CanCancelMsgTransmit). It applies only
to Tx messages that have been transmitted via
CanMsgTransmit. This function could be called in
Interrupt or Task context.
Particularities and Limitations
ApplCanMsgCancelNotification() is only called if configured.
9.1.2.4 ApplCanPreRxQueue ApplCanPreRxQueuePrototype
Single Receive Channel
vuint8
ApplCanPreRxQueue( CanRxInfoStructPtr rxStruct )
Multiple Receive Channel
Parameter rxStruct
Pointer to receive information structure
Return code kCanCopyData
The data of the received message will be stored in the Rx Queue.
kCanNoCopyData
The data of the received message are not stored in the Rx Queue. The
reception is handled within the receive interrupt.
Functional Description
This precopy function is called if a message is received which is a valid message in the receive
structures or has to be handled via a range (in case the use of the Rx Queue is configured for this
range ). The application can decide whether to handle the message via the Rx Queue or the standard
CAN Driver mechanism within the receive interrupt.
Particularities and Limitations
Call context: This function is called within the receive interrupt.
9.1.2.5 ApplCanRxQueueOverrun ApplCanRxQueueOverrunPrototype
Single Receive Channel
void
ApplCanRxQueueOverrun( void )
Multiple Receive Channel
Parameter -
-
Return code -
-
©2010, Vector Informatik GmbH
Version: 3.01.01
126 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Functional Description
This callback function indicates an overrun of the Rx Queue. This function is called by the CAN Driver,
in case a new message has to be stored in the Rx Queue, but the Queue if full. This new message will
be lost.
Particularities and Limitations
Call context: This function is called within the receive interrupt.
©2010, Vector Informatik GmbH
Version: 3.01.01
127 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
10 Configuration (Standard and High End) This chapter describes the common options for configuring (customizing) the CAN Driver.
CAN Controller dependent configuration is described in the CAN Controller specific
documentation TechnicalReference_CAN_<hardware>.pdf [#hw_conf]. The configuration
can be done by the Generation Tool automatically.
10.1 Network Database – Attribute Definition Caution
Attribute names in CANgen are case sensitive and not evaluated, if the name case is
incorrect.
Name GenMsgMinAcceptLength Description The DLC check can be configured to verify the received DLC against the value
given by this attribute (Against minimum acceptance length). The value can be
smaller than the Application receive buffer of this message.
Value “-1” means the DLC of the received message will be compared to the
length of the Application receive buffer of this message.
Type Of Object Message
Value Type Integer
Default -1
Minimum -1
Maximum 8
10.2 Automatic Configuration by GENy
Using the Generation Tool GENy the configuration can be done by the tool. The
configuration options common to all CAN Drivers is described here. The CAN Controller
dependent options are described in the CAN Controller specific user manual. The following
dialog describes the CAN Driver common options. The configuration data is stored by the
tool in the file can_cfg.h for GENy.
©2010, Vector Informatik GmbH
Version: 3.01.01
128 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Figure 10-1 Configuration of the common CAN Driver options with GENy
Feature Explanation Common Driver Parameters
Online/Offline Callback
If CanOnline() or CanOffline() is called the Application is notified that
Functions
a certain CAN driver state was entered.
DLC check
The DLC check can be configured to “disabled”, comparison of received
DLC “against data length” or “against minimum acceptance length”.
“against data length” means the number of bytes necessary for the ECU
and is equal to the length of the application data buffer.
The minimum acceptance length can be configured message specific via
database or on the Rx message view.
If DLC check is used, received Data messages with smaller DLC than
expected for this ID are ignored.
Data Copy Mechanism
The Data Copy Mechanism can be configured to “copy number of
needed bytes” or “copy all received bytes”.
“copy number of needed bytes” means the CAN driver copies always the
number of bytes which is equal to the length of the application data
buffer.
“copy all received bytes” means if the number of received bytes is less
than the size of the application data buffer only the received bytes are
copied. Otherwise the number of bytes which is equal to the length of the
application data buffer will be copied.
RAM check
The CAN driver supports a RAM check of the CAN controller mailboxes.
Sleep / Wakeup
If this field is checked, the CAN controller can be switched to sleep
mode.
©2010, Vector Informatik GmbH
Version: 3.01.01
129 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Feature Explanation Cancel in Hardware
CanCancelTransmit() and CanCancelMsgTransmit() will delete a
pending request in the CAN controller hardware.
FullCAN Overrun
If checked an overrun in the receive FullCAN objects will be signaled to
Notification
the Application.
Receive Function
The receive function ApplCanMsgReceived() is called by the CAN
Driver on every reception of a CAN message after the hardware
acceptance filter is passed. Within this callback function the Application
may preprocess the received message in any way (ECU specific
dynamic filtering mechanisms, preprocessing of the messages, gateway
functionality...).
If the callback function ApplCanMsgReceived() returns kCanCopyData,
the CAN Driver continues to work on the message received.
If the callback function returns kCanNoCopyData, the CAN finishes
working on the message received.
The callback function has to be defined by the application.
Active / Passive State
If this field is checked, the CAN Driver's transmit path can be switched to
the "Passive" state. In this state no CAN messages are sent to the CAN
bus. The transmit request always returns with ”OK”.
This ”passive” state functionality may be used to localize errors in a CAN
bus: If there are errors in a CAN bus, and the errors disappear when a
particular node is switched to passive state, the scapegoat is found. The
Application must be switched to the passive state and back to active
state by an external tester.
If active/passive state is enabled, the CAN Driver is in active state after
initialization.
If this field is not selected, the corresponding service functions are
available but without any effect on the CAN Driver status.
Extended Status
This is the global checkbox for using hardware status information in the
CAN Driver service CanGetStatus() or not.
Transmit Queue
If this field is checked the CAN Driver is configured to use a transmit
queue.
If no transmit queue is used, the Application is responsible to restart a
transmit request if it wasn’t accepted by the CAN Driver. In the case of
using a transmit queue, a transmit request is almost accepted. But the
queue does only store the transmit request of a message. It doesn’t
store the data to be sent in any case. The CAN Driver inserts a transmit
request to the queue, if no hardware object is available when
CanTransmit() is called. On a transmit interrupt, this means a former
requested message is transmitted, the CAN Driver checks whether
transmit requests are stored in the queue. If so, these requests are
removed from the queue and the transmit request is executed. The
search algorithm in the queue is priority based, there is no FIFO
strategy. This means the identifier with the lowest number is removed
first from the queue.
Tx observation
This is the global switch for using the Tx observe functionality of the
CAN Driver or not.
©2010, Vector Informatik GmbH
Version: 3.01.01
130 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Feature Explanation Message-Not-Matched
This is the global switch for using the MsgNotMatched function of the
Function
CAN Driver or not.
Overrun Notification
If this field is checked the CAN Driver is configured to notify the
Application in case of an overrun.
The Application has to provide an Overrun callback function:
void ApplCanOverrun(void) /* Overrun in the CAN Controller */
The overrun handling itself is done by the CAN Driver.
Hardware Loop Check
This is the global switch for using the hardware loop check of the CAN
Driver or not.
Partial Offline Mode
If the checkbox “Use PartOffline Functionality” is checked, the partial
offline mode is available.
Generic Pre-copy
This checkbox enables the use of the generic precopy function –
ApplCanGenericPrecopy(). This precopy function is common to all
receive messages. it will be called as soon as the receive handle is
determined.
CAN Copy from & to CAN This checkbox enables the use of copy functions CopyFromCan() and
CopyToCan().
CAN cancel Notification
The application will be notified via ApplCanCancelNotification() if a
message is canceled and therefore confirmation will occur. This is valid
for messages which have been requested via CanTransmit().
CAN Interrupt Control
There are two call back functions for the application. Within
Callbacks
CanCanInterruptDisable() the function
ApplCanAddCanInterruptDisable() is called and within
CanCanInterruptRestore() the function
ApplCanAddCanInterruptRestore() is called.
These two functions have to be used to handle the wake-up interrupt if
the hardware treats this interrupt separately or if the Driver runs in
Polling Mode the polling tasks have to be disabled.
Common Confirmation
If this field is checked the common confirmation function of the CAN
Function
Driver is enabled.
Offline Modes
Name of Mode X
with X = 0..7.
If the partial Offline Mode is enabled the name of each send group can
be configured here.
more... Default Mapping
Message Class 0
All messages with don’t belong to an other class are assigned to this
class.
OfflineModeX
with X = 0..7.
The message class 0 can be assigned to certain Offline Modes (send
goups) by selecting the check box.
Message Class 1 (Appl)
All application messages are assigned to this message class.
OfflineModeX
with X = 0..7.
The message class 1 can be assigned to certain Offline Modes (send
goups) by selecting the check box.
©2010, Vector Informatik GmbH
Version: 3.01.01
131 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Feature Explanation Message Class 2 (NM)
All network mangement messages are assigned to this message class.
OfflineModeX
with X = 0..7.
The message class 2 can be assigned to certain Offline Modes (send
goups) by selecting the check box.
Message Class 3 (TP)
All transport layer messages are assigned to this message class.
OfflineModeX
with X = 0..7.
The message class 3 can be assigned to certain Offline Modes (send
goups) by selecting the check box.
Message Class 4 (Diag)
All diagnostic messages are assigned to this message class.
OfflineModeX
with X = 0..7.
The message class 4 can be assigned to certain Offline Modes (send
goups) by selecting the check box.
Message Class 5 (IL)
All interaction layer messages are assigned to this message class.
OfflineModeX
with X = 0..7.
The message class 5 can be assigned to certain Offline Modes (send
goups) by selecting the check box.
OSEK OS
Use OsekOS Interrupt Cat In case of using OSEK-OS the interrupt category of the CAN Driver
2
interrupts have to be defined. Normally category 1 is used. Instead of
this category 2 can be selected.
OSEK OS
If this field is checked the CAN Driver is configured to support OSEK-
OS. The kind of OSEK-OS depends on the specific microprocessor.
Polling
Polling type
The polling type can be switched between “None”, “Type specific” and
“individual”.
Individual: If enabled, each BasicCAN, Normal Tx, Low level Tx and
FullCAN can be selected to be polled individual
Rx Basic CAN Polling
Normally the CAN driver works interrupt driven. To use the reception via
Basic CAN objects in polling mode, check this field. This field is available
in “Type specific polling mode”.
Rx Full CAN Polling
Normally the CAN driver works interrupt driven. To use the reception via
Full CAN objects in polling mode, check this field. This field is available
in “Type specific polling mode”.
Tx Polling
Normally the CAN driver works interrupt driven. To use the transmission
in polling mode, check this field. This field is available in “Type specific
polling mode”.
Wakeup Polling
Normally the CAN driver works interrupt driven. To use the wake up
detection in polling mode, check this field.
CAN Status Polling
Normally the CAN driver works interrupt driven. To use the Status and
Error detection in polling mode, check this field.
Low Level Transmission
©2010, Vector Informatik GmbH
Version: 3.01.01
132 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Feature Explanation Cancel Notification
The application will be notified if a message is canceled and therefore
Function
confirmation will occur. This is valid if the transmission has been
requested via CanMsgTransmit().
Enable Low Level
If the checkbox “Use Low Level Message Transmit” is checked, the
Transmission
function CanMsgTransmit() can be used.
Confirmation Function
This checkbox is only available, if “use Low Level Message Transmit” is
active. The confirmation and init callback functions of low level transmit
functionality can be activated by this checkbox.
API
Symbolic Names for
If the database allows the assignment of value tables to individual
Signal Values
signals, this feature is selectable. If this functionality is enabled, symbolic
names for values are generated for all signals that have an associated
value table
Indexed Component
This switch determines whether the component should configure the
indexed or non-indexed version of the driver component.
General Settings
Security level
This is the define value to configure the security level. Valid values are 0,
10, 20 or 30
. more... User Config File
The CAN Driver configuration file (can_cfg.h) is generated. If the user
wants to overwrite this automatically generated configuration file, the
user is able to define the name of a user defined configuration file which
is included at the end of the generated file can_cfg.h. This means entries
in the user defined configuration file overwrite the entries in can_cfg.h.
Debug Suport
Assertions
There are different groups of assertions supported by the CAN Driver.
They can be selected depending of the development phase:
None: No debug functionality active.
User: User API is debugged. The CAN Driver service function
parameters are checked.
Hardware: The CAN Controller interface is checked. Depends on CAN
Controller.
Gen: The configuration data are checked.
Internal: CAN Driver internal checking.
Dynamic Tx Objects
ID
If the checkbox “ID” is checked, the IDs of the dynamic transmit objects
can be changed by the service function CanDynTxObjSetId() and/or by
the service function CanDynTxObjSetExtId(). The last mentioned
service function is only available if extended ID addressing is checked in
the Generation Tool.
DLC
If the checkbox “DLC” is checked, the DLC of the dynamic transmit
objects can be changed by the service function CanDynTxObjSetDlc.
Data Pointer
If the checkbox “Data Pointer” is checked, the data pointers of the
dynamic transmit objects can be changed by the service function
CanDynTxObjSetDataPtr().
©2010, Vector Informatik GmbH
Version: 3.01.01
133 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Feature Explanation Confirmation
If the checkbox “Confirmation” is checked, the confirmation function of
the dynamic transmit objects can be changed by the service function
CanDynTxObjSetConfirmationFct(). The occurrence of this switch is
CAN Controller dependent.
Pre-transmit
If the checkbox “Pre-transmit” is checked, the pretransmit function of the
dynamic transmit objects can be changed by the service function
CanDynTxObjSetPreTransmitFct().The occurrence of this switch is
CAN Controller dependent.
ID Search Algorithm
Search Algorithm
For a Basic CAN Controller or the Basic CAN object of a Full CAN
Controller the hardware acceptance filtering provided by the CAN
Controller is not sufficient. Therefore a software acceptance filtering has
to be supported by comparing the incoming message identifier with the
complete list of all relevant message identifier. Here could the way how
to search in the table of the receive messages be defined. The optimum
algorithm depends on the number of the received messages to search in
and their identifier structure. The supported search algorithms are
dependent of the CAN Driver and the hardware. Refer to the CAN
controller specific documenation
TechnicalReference_CAN_<hardware>.pdf [#hw_feature] for more
information.
linear
hash search
index search
table search
Additional Memory [Byes] This shows the byte consumption when
hash search is selected. It is
just for information.
Maximum Search Steps
This is only activated when
hash search is selected. Enter here the
amount of maximum search steps that are necessary to find the received
message ID in the list of to be received messages. The little this value
the greater the additional memory bytes and the faster the receive ISR.
Rx Queue
Overrun Notification
The Application is informed, if the Rx Queue is full and a new message
should be copied into the Queue. The new message will be lost.
Enable Rx Queue
If the checkbox “Enable Rx Queue” is checked, the RX Queue is
enabled. Else the Rx Queue is disabled.
Pre Rx Queue Function
If the checkbox “Pre Rx Queue Function” is checked, a Callback function
is enabled where the application could decide what should happen with
the CAN Message which was received. The two possibilities are to store
the message in the queue, or to process the message in the interrupt.
Number of queued Rx
Specifies the depth of the queue ("Number of queued Rx messages").
Messages
©2010, Vector Informatik GmbH
Version: 3.01.01
134 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Figure 10-2 Channel Specific Configuration for GENy
Features Explanation Configuration Options
General Settings
Bus System Type
Each channel is configured for a specific type of bus
system. The bus system is always CAN for CAN Driver.
Manufacturer
Manufacturer with is specified in the database file for this
channel.
Common Driver Parameters
Multiple Basic CAN
Enable Multiple Basic
If checked, the number of Basic CAN objects can be
CAN
selected. The deselecting of this checkbox resets the
number of Basic CAN objects to the default.
Number Of BasicCAN
Enter number of needed Basic CAN objects. Each Basic
Objects
CAN object may consist of 2 hardware mailboxes. This
depends on the CAN controller.
Ranges / Range Precopy Functions
Range
Ranges are normally used for Network Management,
Transport Protocol and so on. There are in maximum 4
ranges configurable.
Mask
Acceptance mask of this identifier range.
Code
Acceptance code of this identifier range.
Precopy function
Specific precopy function for this range.
Extended IDs
The range can be specified to receive extended IDs. If not
selected, this range will receive standard IDs.
©2010, Vector Informatik GmbH
Version: 3.01.01
135 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Use Own Filter
If there are enough Basic CAN filters available, one Basic
CAN filter can be used exclusive for this range.
Use Rx Queue
All messages which are received by this range can be
configured to be handled via the Rx Queue. This is only
possible, if the feature Rx Queue is activated.
Dynamic Tx objects
Number of dynamic Tx
Maximum number of dynamic send objects which are
objects
available at run time.
Figure 10-3 Configuration of individual polling with GENy
Features Explanation Configuration Options
Enable Polling
If checked, the associated mailbox will be handled in
polling mode. This is only selectable, if the polling mode is
configured to individual polling.
©2010, Vector Informatik GmbH
Version: 3.01.01
136 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Figure 10-4 Configuration of a Tx message with GENy
Features Explanation Configuration Options
Message / Frame Properties
Generate
If unchecked, the generation of this message will be
suppressed.
Common Driver Parameters
Signal Access Macros
Signal access macros can be used by the application for
an easy access to signals specified within a message.
Offline Modes
<Part offline group>/<Mode X name>
Usage
Standard: configuration via default mapping
User Defined: the user can set or reset the “Real Value”
Real Value
It set, the message belongs to this group and the
transmission of this message will be disabled if this group
is switched offline.
Flags
Confirmation Flag
After successful transmission of a message the driver sets
the confirmation flag of the message.
Functions
Confirmation Function
After successful transmission of a message the driver call
the user defined confirmation function of the message. The
name of this function has to be specified in this field.
Pretransmit Function
The used defined pretransmit function can be called before
the transmission of a message is started. The name of this
function has to be specified in this field.
©2010, Vector Informatik GmbH
Version: 3.01.01
137 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Full CAN Tx
Tx FullCAN
A Tx message can be assigned to a Full CAN objects.
Figure 10-5 Configuration of an Rx message with GENy
Features Explanation Configuration Options
Message / Frame Properties
Generate
If unchecked, the generation of this message will be
suppressed.
Common Driver Parameters
Minimum Data Length
Signal Access Macros
Signal access macros can be used by the application for
an easy access to signals specified within a message.
Flags
Indication Flag
After successful reception of a message the driver sets the
indication flag of the message
Functions
Indication Function
The name of the used defined indication function can be
specified in this field.
Precopy Function
The name of the used defined precopy function can be
specified in this field.
Full CAN
Full CAN
An Rx message can be assigned to a Full CAN objects.
Lock Full CAN
If set, the assignment of a Rx message to a Full CAN
©2010, Vector Informatik GmbH
Version: 3.01.01
138 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
object cannot be changes by the filter optimization.
Hardware Channel
In case a receive message is configured to be ‘FullCAN’
and Common CAN is activated then the user can configure
this message to be received on the first (Channel A) or the
second (Channel B) CAN controller on this channel.
10.3 Automatic Configuration by CANgen
Using the Generation Tool CANgen the configuration can be done by the tool. The
configuration options common to all CAN Drivers is described here. The CAN Controller
dependent options are described in the CAN Controller specific user manual. The following
dialog describes the CAN Driver common options. The configuration data is stored by the
tool in the file can_cfg.h for CANgen.
Figure 10-6 CAN Driver configuration tab
©2010, Vector Informatik GmbH
Version: 3.01.01
139 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Feature Explanation Path of the CAN config file The CAN Driver configuration file (can_cfg.h) is generated. If the user
wants to overwrite this automatically generated configuration file, the
user is able to define the name of a user defined configuration file which
is included at the end of the generated file can_cfg.h. This means entries
in the user defined configuration file overwrite the entries in can_cfg.h.
Use Receive Function
The receive function ApplCanMsgReceived() is called by the CAN
(ApplCanMsgReceived)
Driver on every reception of a CAN message after the hardware
acceptance filter is passed. Within this callback function the Application
may preprocess the received message in any way (ECU specific
dynamic filtering mechanisms, preprocessing of the messages, gateway
functionality...).
If the callback function ApplCanMsgReceived() returns kCanCopyData,
the CAN Driver continues to work on the message received.
If the callback function returns kCanNoCopyData, the CAN finishes
working on the message received.
Support Active/Passive
If this field is checked, the CAN Driver's transmit path can be switched to
State
the "Passive" state. In this state no CAN messages are sent to the CAN
bus. The transmit request always returns with ”OK”.
This ”passive” state functionality may be used to localize errors in a CAN
bus: If there are errors in a CAN bus, and the errors disappear when a
particular node is switched to passive state, the scapegoat is found. The
Application must be switched to the passive state and back to active
state by an external tester.
If active/passive state is enabled, the CAN Driver is in active state after
initialization.
Use Transmit Queue
If this field is checked the CAN Driver is configured to use a transmit
queue.
If no transmit queue is used, the Application is responsible to restart a
transmit request if it wasn’t accepted by the CAN Driver. In the case of
using a transmit queue, a transmit request is almost accepted. But the
queue does only store the transmit request of a message. It doesn’t
store the data to be sent in any case. The CAN Driver inserts a transmit
request to the queue, if no hardware object is available when
CanTransmit() is called. On a transmit interrupt, this means a former
requested message is transmitted, the CAN Driver checks whether
transmit requests are stored in the queue. If so, these requests are
removed from the queue and the transmit request is executed. The
search algorithm in the queue is priority based, there is no FIFO
strategy. This means the identifier with the lowest number is removed
first from the queue.
Support for OSEK OS
If this field is checked the CAN Driver is configured to support OSEK-
OS. The kind of OSEK-OS depends on the specific microprocessor.
Use OsekOS Interrupt Cat In case of using OSEK-OS the interrupt category of the CAN Driver
2
interrupts have to be defined. Normally category 1 is used. Instead of
this category 2 can be selected.
©2010, Vector Informatik GmbH
Version: 3.01.01
140 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Feature Explanation Support Overrun
If this field is checked the CAN Driver is configured to notify the
Notification
Application in case of an overrun.
The Application has to provide an Overrun callback function:
void ApplCanOverrun(void) /* Overrun in the CAN Controller */
The overrun handling itself is done by the CAN Driver:
Security Level
This is the define value to configure the security level. Valid values are
0,10, 20 or 30.
Extended Status
This is the global checkbox for using hardware status information in the
CAN Driver service CanGetStatus() or not.
Debug level
There are different Debug Levels supported by the CAN Driver:
None: No debug functionality active.
User: User API is debugged. The CAN Driver service function
parameters are checked.
Hardware: The CAN Controller interface is checked. Depends on CAN
Controller.
Gen: The configuration data are checked.
Internal: CAN Driver internal checking (consistency of transmit queue).
Extended IDs
This checkbox is available only if extended CAN identifiers are selected
in the channel configuration dialog. It has to be enabled if extended CAN
identifiers have to be received by the range specific acceptance filtering
and the appropriate precopy function has to be called. In such case no
standard identifiers can be received by any acceptance range.
Use Range X
This is the global switch to select identifier range specific precopy
functions. These ranges are normally used for Network Management,
Transport Protocol and so on. There are in maximum 4 ranges
configurable, where ‘X’ is the number of the specified range. If a range is
enabled, the following additional settings has to be done:
Range X mask
Acceptance code of the identifier range X.
Range X ID
Acceptance mask of the identifier range X.
Range X precopy function Specific precopy function for range X.
Tx observe
This is the global switch for using the tx observe functionality of the CAN
Driver or not.
Use MsgNotMatched
This is the global switch for using the MsgNotMatched function of the
function
CAN Driver or not.
Hardware Loop Check
This is the global switch for using the hardware loop check of the CAN
Driver or not.
Number of dynamic tx
Maximum number of dynamic send objects which are available at run
objects
time.
Dynamic TxId
If the checkbox “DynamicTxId” is checked, the IDs of the dynamic
transmit objects can be changed by the service function
CanDynTxObjSetId() and/or by the service function
CanDynTxObjSetExtId(). The last mentioned service function is only
available if extended ID addressing is checked in the Generation Tool.
©2010, Vector Informatik GmbH
Version: 3.01.01
141 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
Feature Explanation Dynamic TxDLC
If the checkbox “DynamicTxDLC” is checked, the DLCs of the dynamic
transmit objects can be changed by the service function
CanDynTxObjSetDlc().
Dynamic TxDataPtr
If the checkbox “DynamicTxDataPtr” is checked, the data pointers of the
dynamic transmit objects can be changed by the service function
CanDynTxObjSetDataPtr(). The occurrence of this switch is CAN
Controller dependent.
Dynamic TxConfirmation
If the checkbox “DynamicTxConfirmation” is checked, the confirmation
function of the dynamic transmit objects can be changed by the service
function CanDynTxObjSetConfirmationFct(). The occurrence of this
switch is CAN Controller dependent.
Dynamic TxPreTransmit
If the checkbox “DynamicTxPretransmit” is checked, the pretransmit
function of the dynamic transmit objects can be changed by the service
function CanDynTxObjSetPreTransmitFct().The occurrence of this
switch is CAN Controller dependent.
Use Low Level Message
If the checkbox “Use Low Level Message Transmit” is checked, the
Transmit
function CanMsgTransmit() can be used.
Use Low Level Message
This checkbox is only available, if “use Low Level Message Transmit” is
Transmit Confirmation
active. The confirmation and init callback functions of low level transmit
functionality can be activated by this checkbox.
Use PartOffline
If the checkbox “Use PartOffline Functionality” is checked, the partial
Functionality
offline mode is available.
Use Generic Precopy
This checkbox enables the use of the generic precopy function –
ApplCanGenericPrecopy(). This precopy function is common to all
receive messages. It will be called as soon as the receive handle is
determined.
The next figure shows the Configuration of the partial offline mode. Every transmit
message can be assigned to up to eight partial offline groups.
©2010, Vector Informatik GmbH
Version: 3.01.01
142 / 149
based on template version 2.1


TechnicalReference Vector CAN Driver
Figure 10-7 Configuration of Partial Offline Mode
Feature Explanation Edit part offline mode
this button can be used to change the names of the eight partial offline
names
groups
The following features cannot be configured by the Application. They are set automatically
depending on the used OEM:
DLC check
Data Copy Mechanism
Cancel in Hardware
©2010, Vector Informatik GmbH
Version: 3.01.01
143 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
10.4 Manual configuration via user configuration file
This chapter describes additional configuration options for special features which can only
be configured via user configuration file.
In the following table you will find a list of configuration switches, used to control the
functional units of the CAN Driver:
Switch Value / Range Use of ... C_xxx_APPLCANPREWAKEUP_FCT ENABLE, DISABLE
Activate call of ApplCanPreWakeUp() if
an WakeUp Interrupt occurs.
C_xxx_NOTIFY_CORRUPT_MAILBOX ENABLE,
DISABLE Activate call of ApplCanCorruptMailbox()
in case the CAN RAM Check fails for a
certain mailbox.
If the Generation Tool CANgen is used, some additional configurations can only be due via
user configuration file:
Switch Value / Range Use of ... C_xxx_ONLINE_OFFLINE_CALLBACK ENABLE, DISABLE
Activate call of ApplCanOnline() and
_FCT
ApplCanOffline() if the associated CAN
driver state was entered.
C_xxx_INTCTRL_ADD_CAN_FCT ENABLE,
DISABLE
Activate call of
ApplCanAddCanInterruptDisable()
and
ApplCanAddCanInterruptRestore().
These two functions have to be used to
handle the wake-up interrupt if the
hardware treats this interrupt separately
or if the Driver runs in Polling Mode the
polling tasks have to be disabled.
©2010, Vector Informatik GmbH
Version: 3.01.01
144 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
11 Glossary Abbreviations and Expressions Explanation Acceptance filtering
Mechanism which decides whether each received protocol frame is
to be taken into account by the local Node or ignored.
API Application
Program
Interface.
Application Interface
An application interface is the prescribed method of a SW
component for using the available functionality.
Arbitration
Mechanism which guarantees that a simultaneous access made by
multiple stations results in a contention where one frame will
survive uncorrupted.
ASAP Arbeitskreis
zur
Standardisierung von Applikationssystemen.
Standardization of Application and Calibration system task force
BCD
Binary Coded Decimal
Buffer
A buffer in a memory area normally in the RAM. It is an area, the
application reserved for data storage
Bus
Defines what we call internal as channel or connection.
BusOff
A node is in the state bus off when it is switched off from the bus
due to a request of fault confinement entity. In the bus off state, a
node can neither send nor receive any frames. A node can start the
recovery from bus off state only upon a user request.A node is in
the state BusOff when it is switched off from the bus. In the state
BusOff a node can neither send nor receive any protocol frames.
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 influence the work of
the Driver.
CAN
Controller Area Network protocol originally defined for use as a
communication network for control applications in vehicles.
CAN Controller
A hardware unit integrated into a micro controller (or as a separate
unit) handling the CAN protocol.
CAN Driver
The CAN driver encapsulates a specific CAN controller handling. It
consists of algorithms for HW initialization, CAN message
transmission and reception. The application interface supports both
event and polling notification and WR/RD access to the message
buffers.
Channel
A channel defines the assignment (1:1) between a physical
communication interface and a physical layer on which different
modules are connected to (either CAN or LIN). 1 channel consists
of 1..X network(s).
Configuration
The communication configuration adapts the communication stack
to the specific component requirements by means of the
Generation Tool.
Confirmation
A service primitive defined in the ISO/OSI Reference model (ISO
©2010, Vector Informatik GmbH
Version: 3.01.01
145 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
7498). With the service primitive 'confirmation' a service provider
informs a service user about the result of a preceding service
request of the service user. Notification by the CAN Driver on
asynchronous successful transmission of a CAN message.
Data consistency
Data consistency means that the content of a given application
message correlates unambiguously to the operation performed
onto the message by the application. This means that no
unforeseen sequence of operations may alter the content of a
message hence rendering a message inconsistent with respect to
its allowed and expected value.
DBC
CAN database format of the Vector company which is used by
Vector tools
DLC
Data Length CodeNumber of data bytes of a CAN message
ECU
Electronic Control Unit
Error
Error is a local problem which could be solved locally. If not, the
error will be given as an exception to the application. An error is not
the specification conform misbehavior of a system (e.g. a not
responded diagnostic request after three requests without
response is no error). Discrepancy between a computed, observed
or measured value or condition and the true, specified or
theoretically correct value or condition (IEC 61508-4).
FIFO
First In First Out
FILO
First In Last Out
Gateway
A gateway is designed to enable communication between different
bus systems, e.g. from CAN to LIN.
Generation Tool
See CANgen, DBKOMGen and GENy. The generation tool
configures the communication stack based on database attributes
(vehicle manufacturer), project settings (module supplier) and
license information (Vector).
HIS Hersteller-Initiative
Software
HW Hardware
ID
Identifier (e.g. Identifier of a CAN message)
Indication
A service primitive defined in the ISO/OSI Reference Model (ISO
7498). With the service primitive 'indication' a service provider
informs a service user about the occurrence of either an internal
event or a service request issued by another service user.
Notification of application in case of events in the Vector software
components, e.g. an asynchronous reception of a CAN message.
Interrupt
Processor-specific event which can interrupt the execution of a
current program section.
Interrupt level
Processing level provided for time-critical activities. To keep the
interrupt latency brief, only absolutely indispensable actions should
be effected in the Interrupt Service Routine, which ensures
reception of the interrupt and trigger its (post) processing within a
task. Other processing levels are: Operating System Level and
Task Level.
ISO
International Standardization Organization
©2010, Vector Informatik GmbH
Version: 3.01.01
146 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
ISR
Interrupt Service Routine
LIN
Local Interconnect Network
Manufacturer Vehicle
manufacturer
Message
A message is responsible for the logical transmission and reception
of information depending on the restrictions of the physical layer.
The definition of the message contents is part of the database
given by the vehicle manufacturer.
MISRA
Motor Industry Software Reliability Association
MRC
Multiple Receive Channel
Network
A network defines the assignment (1:N) between a logical
communication grouping and a physical layer on which different
modules are connected to (either CAN or LIN). 1 network consists
of 1 channel, Y networks consists of 1..Z channel(s). We say
network if we talk about more than 1 bus.
NM Network
Management
Node
A network topological entity. Nodes are connected by data links
forming the network. Each node is separately addressable on the
network.
OEM
Original Equipment Manufacturer
Offline
State of the data link layer. In the Offline state, no application
communication is possible. Only the network management is
allowed to communicate.
Online
(Normal) state of the data link layer. Application and Network
Management communication are possible.
OS Operating
System
OSEK
Name of the overall project: Abbreviation of the German term
"Offene Systeme und deren Schnittstellen für die Elektronik im
Kraftfahrzeug" - Open Systems and the Corresponding Interfaces
for Automotive Electronics.
Overrun
Overwriting data in a memory with limited capacity, e.g. Queued
message object
Platform
The sum of micro controller derivative, communication controller
implementation and compiler is called platform.
RAM Random
Access
Memory
Register
A register is a memory area in the controller, e.g. in the CAN
Controller. Distinguish Register from Buffer
RI Reference
Implementation
ROM Read-Only
Memory
Signal
A signal is responsible for the logical transmission and reception of
information depending on the restrictions of the physical layer. The
definition of the signal contents is part of the database given by the
vehicle manufacturer. Signals describe the significance of the
individual data segments within a message. Typically bits, bytes or
words are used for data segments but individual bit combinations
are also possible. In the CAN data base, each data segment is
assigned a symbolic name, a value range, a conversion formula
©2010, Vector Informatik GmbH
Version: 3.01.01
147 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
and a physical unit, as well as a list of receiving nodes.
SRC
Single Receive Channel
Status
A status describes the properties (parameters) of an entity. A state
is interpreted as an information, e.g. an error, by the entity which
uses a status, and is frequently determined by the history.
Task Level
Processing level where the actual application software, is
executed. Tasks are executed according to the priority assigned to
them, and to the selected scheduling policy. Other processing
levels are: Interrupt level and Operating System Level.
Transceiver
A transceiver adapts the physical layer to the communication
interface.
Vehicle Manufacturer
We use this instead of OEM
Watchdog
A monitoring entity.
©2010, Vector Informatik GmbH
Version: 3.01.01
148 / 149
based on template version 2.1

TechnicalReference Vector CAN Driver
12 Contact Visit our website for more information on
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector-informatik.com ©2010, Vector Informatik GmbH
Version: 3.01.01
149 / 149
based on template version 2.1
Document Outline
1.1.39 - TechnicalReference_GENy_InteractionLayer
YourTopic1.1.41 - TechnicalReference_GENy_InteractionLayers
Vector Interaction Layer
Technical Reference
Il_Vector
Version 2.10.03
Authors
Klaus Emmert, Gunnar Meiss, Heiko Hübler
Status
Released

Technical Reference Vector Interaction Layer
1 Document Information 1.1 History Author Date Version Remarks P. Jost
2000-05-05 1.0
creation
P. Jost
2000-06-29 1.1
some corrections
P. Jost
2000-07-13 1.2
changes in Figure 4 and some further corrections
P. Jost
2000-08-06 1.3
correction of the First-Value Class
P. Jost
2000-09-13 1.4
little corrections in the description of the TxTask and IlInit
P. Jost
2001-03-01 1.5
message related transmission modes
example for timeout monitoring
multi channel support
known problems
integration example
P. Jost
2001-06-22 1.6
some names of attributes changed
DataChanged flag
Tx timeout monitoring
Rx and Tx default values
new screen shots of the current Gentool
changes in the state machine
and further little corrections
S. Hoffmann
2001-07-05 1.61
some corrections and branch for an OEM
P. Jost
2001-07-13 1.62
adapted the corrections of version 1.61 for general IL
P. Jost
2002-04-05 1.63
Signal groups
Multiple physical and virtual ECU support
Multiplex Signals
Rx timeout monitoring: reload of timer and message
related notification
Notification in interrupt and task context (IL Polling)
IL<Tx/Rx>StateTask
Attributes for Rx timeout monitoring updated
Configuration Tool pictures updated
P. Jost
2002-08-16 1.7
Name of this document changed from User Manual to
Technical Reference
Multiple Indication Flags per Signal
Macro to Get and Clear at once
Chapter for Configuration Tool updated
”New Style” API
Data Type Prefix for Signal Access
Further Callbacks for State Machine
Initialization – IlInitPowerOn
ECU Timeout
H. Hörner
2003-06-16 1.8
Several wording and spelling issues corrected
List of abbreviations and glossary removed, replaced by
an own document
Implementation details moved to an Annex
2013, Vector Informatik GmbH
Version: 2.10.03
2 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
K. Emmert
2003-09-02 1.9
Some design and link modifications.
H. Hörner
2004-05-14 2.0
Add usage of VStdLib
Documented return value of flag get macros
Difference between GenMsgDelayTime and
GenMsgStartDelayTime clarified
Some clarifications about signal groups
Wording enhanced for multiplexed signals
Klaus Emmert 2005-06-10 2.01
Added support for GENy
Gunnar Meiss
Added new feature dynamic timeout handling
Added raw API for multiplex signals
Reworked dbc attributes chapter
Added matrix with transmission modes
Gunnar Meiss 2005-08-02 2.02
Adapted GenMsgFastOnStart
Added GENy Multiplex Support
Klaus Emmert 2005-11-04 2.03
Added AUTOSAR API for GENy, configuration and signal
Gunnar Meiss
access.
Added GenMsgFastOnStart for multiplex messages in
GENy
Added ESCAN00014120 CANGen
Added ESCAN00008602 CANGen
Added ESCAN00008604 CANGen
Reworked ESCAN00010718
Gunnar Meiss 2006-02-16 2.04
Added GENy Multiple ECU Reference
Added ESCAN00013633
DynRxTimeout API postfix and data types have changed.
Klaus Emmert 2006-03-13 2.05
Signal Groups for GENy
Gunnar Meiss 2006-04-06 2.06
Added Indexed API discontinuation for GENy.
Corrected ApplIlFatalError Prototype
Improved GenSigTimeoutMsg_<ECU>
Corrected GenSigSendType description
Removed GenSigTimeoutMsg_<ECU> for GENy
Gunnar Meiss 2007-05-16 2.07
Opaque Data Types ESCAN00016935 GENy
Improved documentation of call contexts of API functions
ESCAN00017472, ESCAN00018014, ESCAN00014156,
ESCAN00013962, ESCAN00013423, ESCAN00008047,
ESCAN00008755
Gunnar Meiss 2007-12-17 2.08
Added GenSigSuprvResp, GenSigSuprvRespSubValue
and GenSigTimeoutMsg_<ECU> for GENy
Updated API descriptions
Updated GenMsgStartDelayTime
Updated GenMsgIlSupport
ESCAN00024092
Gunnar Meiss 2008-04-21 2.08.01 ESCAN00024091
Gunnar Meiss 2008-07-17 2.09.00 Reworked Document Structure
ESCAN00024902 Added Node Mapped dbc Attributes
2013, Vector Informatik GmbH
Version: 2.10.03
3 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Updated Abbreviations and Glossary with CIWI
ESCAN00028781 Added IlTxRepetitionsAreActive and
IlTxSignalsAreActive
ESCAN00028787 Reset Timeout Flags On Release
Added Geny attribute descriptions
ESCAN00023799 Added Limitation
ESCAN00025371 Updated Dynamic Timeout Monitoring
ESCAN00029109 Added Documentation of Generated
APIs
Gunnar Meiss 2008-10-17 2.09.01 ESCAN00030172 The description of IlRxWait()
is incorrect
Gunnar Meiss 2011-05-19 2.09.02 ESCAN00049272 OnChangeAndIfActive and
OnChangeAndIfActiveWithRepetition is described
incorrect in Table 3-6 "Send Type Matrix"
ESCAN00049615 Incorrect Enumeration Values of the
dbc attribute "ILUsed"
ESCAN00048272 Incorrect Timing Diagram of the
Transmit Fast if Signal Active Transmission Mode
Heiko Hübler 2012-03-13 2.10.00 Added
Signal status information (UpdateBits)
Heiko Hübler 2012-05-14 2.10.00 Added description for the GENy GUI attribute “timeout
time”
Heiko Hübler 2012-09-13 2.10.01 Added description for PreConfig Switch “Enable
UpdateBit Support”
Changed “Send on Init” description
Heiko Hübler 2012-11-07 2.10.02 ESCAN00041782: One 'e' too much in Technical
Reference
ESCAN00062898: Adapted description of
Delimitation of
the Bus Load Heiko Hübler 2013-05-13 2.10.03 ESCAN00052197: The OnChange Event is triggered if
the value for IlPut changes out of the range
Table 1-1 History of the Document
2013, Vector Informatik GmbH
Version: 2.10.03
4 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
1.2 Reference Documents No. Source Title Version [1]
Vector
Vector CAN driver. Technical Reference
[2]
Vector
Vector Multiple ECUs. Technical Reference
1.00.00
[3]
Vector
Vector Configuration Tool. Online Documentation.
(no printed manual available)
[4]
OSEK
OSEK/COM, Version 3.0.3
3.00.03
[5]
Z.120 (1996). Message Sequence Chart (MSC).
April.1996
ITU-T, Geneva
[6]
Vector
Interaction Layer User Manual
[7]
AUTOSAR AUTOSAR Specification of Module COM 2.0.0
2.00.00
[8]
AUTOSAR AUTOSAR Specification of Module COM 3.1.0
3.1.0
Table 1-2 Reference Documents
Please note
We have configured the programs in accordance with your specifications in the
questionnaire. Whereas the programs do support other configurations than the one
specified in your questionnaire, Vector´s release of the programs delivered to your
company is expressly restricted to the configuration you have specified in the
questionnaire.
2013, Vector Informatik GmbH
Version: 2.10.03
5 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Contents 1 Document Information ................................................................................................. 2
1.1 History ............................................................................................................... 2 1.2 Reference Documents ....................................................................................... 5 2 Introduction................................................................................................................. 11
2.1 Architecture Overview ...................................................................................... 12 2.2 Data Access Concept ....................................................................................... 13 2.3 Adapt the Vector Interaction Layer ................................................................... 15 3 Functional Description ............................................................................................... 17
3.1 Features .......................................................................................................... 17 3.2 Initialization ...................................................................................................... 17 3.3 Interaction Layer State Machine ....................................................................... 18
3.3.1 States .............................................................................................. 19
3.3.1.1 Uninit ............................................................................. 19 3.3.1.2 Running ......................................................................... 19 3.3.1.3 Waiting ........................................................................... 19 3.3.2 State Transitions .............................................................................. 19
3.3.2.1 Init .................................................................................. 19 3.3.2.2 Start ............................................................................... 19 3.3.2.3 Stop ............................................................................... 20 3.3.2.4 Wait ............................................................................... 20 3.3.2.5 Release ......................................................................... 21 3.4 Main Functions ................................................................................................ 21 3.5 Interaction Layer Communication Concept....................................................... 23
3.5.1 Interface Concept ............................................................................. 23 3.5.2 Notification Mechanisms .................................................................. 23 3.6 Data Access ..................................................................................................... 23
3.6.1 Data Consistency ............................................................................. 23 3.6.2 Signal Interface ................................................................................ 24 3.6.3 AUTOSAR Signal Interface .............................................................. 25 3.6.4 Example: Writing and reading a signal value .................................... 26 3.6.5 Signal Groups .................................................................................. 27
3.6.5.1 Il API .............................................................................. 27 3.6.5.2 AUTOSAR API ............................................................... 28 3.6.5.3 GENy configuration ........................................................ 29 3.6.6 Default Values .................................................................................. 29 3.7 Data Transmission ........................................................................................... 30 2013, Vector Informatik GmbH
Version: 2.10.03
6 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
3.7.1 Transmission Concept...................................................................... 30 3.7.2 Signal Related Transmission Modes ................................................ 33
3.7.2.1 Cyclic Transmission ....................................................... 34 3.7.2.2 OnEvent (OnWrite, OnChange) ..................................... 34 3.7.2.3 OnEvent with Repetition (OnWrite, OnChange) ............. 35 3.7.2.4 Transmit Fast if Signal is Active ..................................... 36 3.7.2.5 Transmit Fast if Signal is Active with Repetition ............. 38 3.7.3 Mixed Transmission Mode................................................................ 39
3.7.3.1 Cyclic (Message) Transmission OR Cyclic (Signal)
Transmission ................................................................. 39 3.7.3.2 Cyclic (Message) Transmission OR OnEvent [Write] ..... 39 3.7.3.3 Cyclic (Message) Transmission OR OnEvent [Write]
with Repetition ............................................................... 39 3.7.3.4 Cyclic (Message) Transmission OR OnEvent [Change] . 40 3.7.3.5 Cyclic (Message) Transmission OR OnEvent [Change]
with Repetition ............................................................... 40 3.7.3.6 Cyclic (Message) Transmission OR Transmit Fast If
Signal is Active ............................................................... 40 3.7.3.7 Cyclic (Message) Transmission OR Transmit Fast If
Signal is Active with Repetition ...................................... 41 3.7.3.8 Cyclic (Message) Transmission OR NoSigSendType ..... 42 3.7.4 Advanced Transmission Modes ....................................................... 42 3.7.5 Notification Classes.......................................................................... 42 3.7.6 Reduction of Transmission Bursts .................................................... 43 3.7.7 Delimitation of the Bus Load ............................................................ 43 3.7.8 Transmission Timeout Monitoring ..................................................... 44 3.7.9 Transmission of Initialization Messages ........................................... 44 3.8 Data Reception ................................................................................................ 45
3.8.1 Reception Concept .......................................................................... 45 3.8.2 Notification Classes.......................................................................... 45 3.8.3 Timeout Monitoring .......................................................................... 46 3.8.4 Dynamic Timeout Monitoring ............................................................ 47 3.9 Signal status information (UpdateBits) ............................................................. 48
3.9.1 Configuration.................................................................................... 48
3.9.1.1 DBC File ........................................................................ 49 3.9.2 UpdateBit Transmission ................................................................... 49 3.9.3 UpdateBit Reception ........................................................................ 49
3.9.3.1 Timeout .......................................................................... 49 3.10 Multiple Channel Support ................................................................................. 50
3.10.1 Overview .......................................................................................... 50 3.10.2 Idx (Indexed) Interaction Layer ......................................................... 50 3.11 Advanced Communication Features ................................................................ 50 2013, Vector Informatik GmbH
Version: 2.10.03
7 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
3.11.1 Physical Multiple and Multiple Configuration ECU ............................ 50 3.11.2 Multiplexed Signals .......................................................................... 50
3.11.2.1 Standard API.................................................................. 50 3.11.2.2 Raw API ......................................................................... 51 3.11.3 Manipulation of the Notification Frequency ....................................... 53 4 Integration ................................................................................................................... 54
4.1 Include structure .............................................................................................. 54 4.2 Scope of Delivery ............................................................................................. 54
4.2.1 Static Files ....................................................................................... 54 4.2.2 Dynamic Files .................................................................................. 54 4.3 Operating Systems Requirements ................................................................... 55 5 Configuration .............................................................................................................. 56
5.1 Configuration in Data Base .............................................................................. 56
5.1.1 Send Type ........................................................................................ 57 5.1.2 Send Type Dependent ..................................................................... 58 5.1.3 Advanced Attributes ......................................................................... 60 5.1.4 Timeout Supervision Attributes ......................................................... 61 5.1.5 Former Attributes ............................................................................. 63 5.1.6 Example ........................................................................................... 63 5.2 Configuration with GENy .................................................................................. 65 6 API Description ........................................................................................................... 81 6.1.1 TypeDefinitions ................................................................................ 81 6.1.2 Services provided by Interaction Layer............................................. 82
6.1.2.1 IlInitPowerOn ................................................................. 82 6.1.2.2 IlInit ................................................................................ 82 6.1.2.3 IlRxStart ......................................................................... 83 6.1.2.4 IlTxStart ......................................................................... 83 6.1.2.5 IlRxStop ......................................................................... 84 6.1.2.6 IlTxStop ......................................................................... 84 6.1.2.7 IlRxWait ......................................................................... 85 6.1.2.8 IlTxWait .......................................................................... 86 6.1.2.9 IlRxRelease ................................................................... 86 6.1.2.10 IlTxRelease .................................................................... 87 6.1.2.11 IlRxTask ......................................................................... 87 6.1.2.12 IlTxTask ......................................................................... 88 6.1.2.13 IlRxStateTask ................................................................. 88 6.1.2.14 IlTxStateTask ................................................................. 89 6.1.2.15 IlSendOnInitMsg ............................................................ 89 2013, Vector Informatik GmbH
Version: 2.10.03
8 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
6.1.2.16 IlGetStatus ..................................................................... 90 6.1.2.17 IlTxRepetitionsAreActive ................................................ 90 6.1.2.18 IlTxSignalsAreActive ...................................................... 91 6.1.3 Generated Services provided by the Interaction Layer ..................... 92
6.1.3.1 Read and Write Signals and Signal Groups ................... 92 6.1.3.2 Read and Write Signals and SignalGroups in the RDS
Buffer. ............................................................................ 98 6.1.3.3 Notification Flags of Signals, Signal Groups and
Grouped Signals .......................................................... 100 6.1.3.4 Dynamic Rx Timeout .................................................... 102 6.1.4 Callback Functions ......................................................................... 104
6.1.4.1 ApplIlInit ....................................................................... 104 6.1.4.2 ApplIlRxStart ................................................................ 105 6.1.4.3 ApplIlTxStart ................................................................ 105 6.1.4.4 ApplIlRxStop ................................................................ 106 6.1.4.5 ApplIlTxStop ................................................................ 106 6.1.4.6 ApplIlFatalError ............................................................ 107 6.1.5 Generated Callback Functions ....................................................... 107 7 Limitations ................................................................................................................ 110
7.1 CANgen Compatibility .................................................................................... 110
7.1.1 Database attributes ........................................................................ 110 7.1.2 Application Code ............................................................................ 110 7.1.3 Generator ....................................................................................... 110 8 Glossary and Abbreviations .................................................................................... 112
8.1 Glossary ........................................................................................................ 112 8.2 Abbreviations ................................................................................................. 114 9 Contact ...................................................................................................................... 115 2013, Vector Informatik GmbH
Version: 2.10.03
9 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Illustrations Figure 2-1 Example for Some ECU’s in a Modern Vehicle ......................................... 11 Figure 2-2 Layer model of the Vector CAN communication components
CANbedded .............................................................................................. 13 Figure 2-3 Signal-oriented Access to Data provided by the Interaction Layer ............. 14 Figure 2-4 Usage of the network database to generate parts of the Interaction Layer 15 Figure 3-1 Rx and Tx State Machines ........................................................................ 18 Figure 3-2 State Machine of the Interaction Layer...................................................... 18 Figure 3-3 Call of the Interaction Layer cyclic function ............................................... 22 Figure 3-4 Synchronization Problem of Data Access ................................................. 24 Figure 3-5 Timing Diagram of the Periodic Transmission Mode ................................. 34 Figure 3-6 Timing Diagram of the Transmission Mode OnEvent – OnWrite................ 35 Figure 3-7 Timing Diagram of OnEvent with Repetition - OnWrite ............................. 36 Figure 3-8 Timing Diagram of the Transmit Fast if Signal Active Transmission Mode . 37 Figure 3-9 Example for Combining Signals Related of the Send Fast if Signal Active
Mode to the Same Message ..................................................................... 38 Figure 3-10 Timing Diagram of the Transmit Fast if Signal Active Transmission Mode . 38 Figure 3-11 Mixed Transmission Mode – Cyclic OR OnEvent [Write] ........................... 39 Figure 3-12 Mixed Transmission Mode – Cyclic OR OnEvent [Change] ....................... 40 Figure 3-13 Mixed Transmission Mode – Cyclic OR Fast If Signal is Active ................. 41 Figure 3-14 Mixed Transmission Mode – Cyclic OR Fast If Signal is Active with
Repetition ................................................................................................. 42 Figure 3-15 Delay Time to Delimit Bus Load ............................................................... 44 Figure 4-1 Including Interaction Layer ........................................................................ 54 Figure 5-1 A Signal with the Periodic Transmission Mode and one with the Direct
Transmission Mode Combined to a message. .......................................... 65 Figure 5-2 OnScreen Help View for fast information .................................................. 65 Figure 5-3 Overview of Vector Interaction Layer Configuration in GENy .................... 66 Tables
Table 1-1 History of the Document ............................................................................. 4 Table 1-2 Reference Documents ................................................................................ 5 Table 3-1 Supported features ................................................................................... 17 Table 3-2 Start transition events ............................................................................... 20 Table 3-3 Stop transition events ............................................................................... 20 Table 3-4 Wait transition events................................................................................ 21 Table 3-5 Release transition events ......................................................................... 21 Table 3-6 Send Type Matrix ...................................................................................... 33 Table 4-1 Static files ................................................................................................. 54 Table 4-2 Generated files ......................................................................................... 55 Table 5-1 GENy attributes ........................................................................................ 80 Table 6-1 Type definitions ......................................................................................... 81 2013, Vector Informatik GmbH
Version: 2.10.03
10 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
2 Introduction Nowadays cars are growing to become more and more complex systems. The functionality
of a modern car is not dominated by mechanical components anymore. Electrical Control
Units (ECU), sensors and actors became irreplaceable parts of a car. They are responsible
for the reasonable functions of the power train, the chassis and the body of a car. An
example for some ECUs is shown in
Figure 2-1 Example for Some ECU’s in a Modern
Vehicle. In many ways the functionality of an ECU in a car depends on information provided by
other ECUs. For example the ECU of the dashboard needs the number of revolutions per
time of the wheels to display the car’s speed. As a result communication between the
ECUs is a significant component of a modern vehicle.
The communication between ECUs should essentially remain encapsulated. The
application working on an ECU should not need to know how to transmit or receive data
from other ECUs. Therefore Vector Informatik GmbH provides a set of components for the
communication of ECUs by the CAN bus.
uc Ecu Use Casesdashboardseatair conditioningengine controlcentral lockingw heel pr essure light c ontroldoorcontrol Figure 2-1
Example for Some ECU’s in a Modern Vehicle
These communication components are called CANbedded. They relieve the application of
its communication assignment including the exchange of simple data, diagnostic data,
2013, Vector Informatik GmbH
Version: 2.10.03
11 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
network management data, calibration data and more. This document is concerned with
the data exchange via an Interaction Layer.
The Vector Interaction Layer hides all the communication related parameters and physical
values from the application to ease the workload of the application. In case of transmission
the application just needs to pass data to be transmitted to the Interaction Layer. The
Interaction Layer decides when to transmit the data. Because the transmission depends of
the chosen Transmission Mode which defines for example a periodic or an event triggered
transmission of data. The other way round, in case of reception of data the Interaction
Layer will notify the application about the arrival of data. Then the application could decide
whether to read the updated data.
In any case the application does not need to know how the data is transmitted or received
by the lower communication layers. It follows that the data structures of the application will
be independent of the communication data structures (e.g. bus frames). The result is a
higher reusability of the application software.
To control the Interaction Layer by the means of starting, suspending or deactivating a
further API is provided. It is intended to be used for example by the Network Management.
By this API it is possible to realize some CAN related modes like Sleep Mode, Bus-off
Mode or Low-Voltage-Mode.
This manual is divided into three main chapters. The Overview introduces the features and
concepts of the Interaction Layer. Next, the Functional Description explains the state
machine, the communication flow, the data access and the transmission and reception of
data. Technical Description, the last of the main chapters concerns with details of code
generation, the API of the Interaction Layer and the usage or the Interaction Layer with or
without an operating system.
2.1 Architecture Overview The implementation of the Interaction Layer is intended to relieve the application of
communication tasks. The Interaction Layer is one of the communications components of
CANbedded offered by Vector Informatik GmbH. In
Figure 2-2 Layer model of the Vector
CAN communication components CANbedded it is shown how the Interaction Layer is
embedded in the CANbedded protocol stack.
The communication software user has to be supplied with suitable access mechanisms to
permit the adaptation of the ECU's behaviour to the network. Furthermore, the application
needs mechanisms which permit a structured access to the data of the network. Such
mechanisms are provided by the Interaction Layer of Vector Informatik GmbH and will be
described in this manual. The Interaction Layer is responsible for separation of the Data
Link Layer dependent low-level driver (CAN driver) and the application task which is
independent of the underlying bus system.
2013, Vector Informatik GmbH
Version: 2.10.03
12 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
Figure 2-2
Layer model of the Vector CAN communication components CANbedded
The CAN Driver provides a mostly hardware independent interface to the higher
communication layers. This enables the hardware independent implementation of the latter
components and the target platform independent reuse of them.
2.2 Data Access Concept The CAN bus uses messages to transmit user data. A message is 0 to 8 bytes long. The
user information often does not match exactly 1, 2, 3 ... or 8 bytes. For example to transmit
the state of a switch only 1 bit will be needed. This single bit has to be send in a 1 byte
CAN frame. The 7 remaining bits will be left blank. To prevent such an overhead the
remaining bits could be used to transmit other short user information. The user information
combined to a message is called signa
ls. Figure 2-3 Signal-oriented Access to Data provided by the Interaction Layer shows the combination of signals in the transmit section
2013, Vector Informatik GmbH
Version: 2.10.03
13 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
and the splitting of messages in the receive section of the Interaction Layer. This
mechanism, of cause, also lowers the bus load and raises the efficiency of data exchange.
The key aspect of the Interaction Layer is the transmission and the reception of data.
Therefore the Interaction Layer provides a signal oriented data interface called Signal
Interface. The Signal Interface offers an API to write and read data. If data was written by
the application, the Signal Interface decides depending on the Transmission Mode whether
to transmit the data. The Signal Interface is located on the top of the Message Manager
which is responsible for the transmission and reception of messages. By these options the
application will be relieved of this area of responsibility.
Application
Write data
Read data
Signal Interface
Signal Interface
Interaction Layer
Transmit Message
Receive Message
CAN Driver
Figure 2-3
Signal-oriented Access to Data provided by the Interaction Layer
To transmit a signal the application just needs to write it to the Interaction Layer by calling
ILPut. The Interaction Layer will decide what to do with the updated data. The decision
depends on the chosen Transmission Mode and the delay timer. More information about
Transmission Modes and delay timer could be found in chapter 3.7 Data Transmission.
However, the application does not need to care about any further steps. The Vector
Interaction Layer results in a supplementary support for the application.
For data exchange the Interaction Layer and the Data Link Layer need to copy the data
several times. For example in case of reading a signal by the application the data has to
be copied to the application’s memory. But the reception of messages is handled by an
interrupt which could intermit the copying of data. In case of reception, for example, the
data has to be copied from the receive buffer of the CAN interface to the memory of the
ECU by the interrupt handler. However, the Interaction Layer guarantees the consistency
of any transmitted or received data and relieves the application of this area of
responsibility, too. A further description of this problem will follow in chapter 3.6.1 Data
Consistency.
2013, Vector Informatik GmbH
Version: 2.10.03
14 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
2.3 Adapt the Vector Interaction Layer To allow the application to access data in a signal-oriented manner, the Signal Interface
provides macros and functions. The macro and function names are derived directly from
the signal short names in the network database (also known as data dictionary or
communication database). The signal names have prefixes and suffixes which can be
defined by the user.
CANdela
Network
Database
Database
Application
Configuration Tool
Specific
Data
Generation
Configuration
Signal
Interface
Header
Includes
CANbedded
CANdesc
Software
Application
Parameters
Source
Components
Compiler, Linker
Executable
Figure 2-4
Usage of the network database to generate parts of the Interaction Layer
These functions and macros will be generated by the Configuration Tool using the network
database related to a project. For this purpose, the car manufacturer makes the latest
version of the network database available to all suppliers. Each ECU producer receives -
in addition to the network component implementation for "her/his" processor - the
Configuration Tool by which the supplier generates the parts of the communication
components that are relevant to the particular ECU.
All application specific data which are made available by the supplier is saved in a
separate file to preserve this information in the case of a network database update. The
Configuration Tool checks for consistency of application specific data and the network
database.
Figure 2-4 Usage of the network database to generate parts of the Interaction Layer shows the usage of the Configuration Tool.
2013, Vector Informatik GmbH
Version: 2.10.03
15 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
If the communication components use more than one CAN-channel, the macros and
functions have to be generated for each CAN-channel with the corresponding network
database. In the Configuration Tool, a channel-index must be chosen that indicates on
which CAN-channel the data dictionary is used.
Syntactically, data is always accessed by a function. Nevertheless, this might actually
involve a macro. Whether there is a function call or a macro for direct access to the data
buffer underlying the command will depend on the signal's data type. This will make it
possible to change the implementation between functions and macros without having to
change the syntax in the source code of the application. The use of macros is preferable
with regard to run time. However, if two or more bytes have to be read for the signal
access a function has to be used. This would allow including synchronization mechanisms
(see section
3.6.1) for the data access within these functions. For reasons of efficiency,
values with more than 32 bits are passed by data pointers, i.e. if the function is called the
application passes a pointer to a memory location where the function stores the signal
value. The application is responsible for providing sufficient memory space. If a signal is
entered in the network database, e.g. as a 34 bit signal, the application must pass a
pointer to a memory area with 5 bytes. When signals are transmitted compressed in a
message, i.e. they only use a few bits within a byte, the Signal Interface expands
appropriately for reading by the application and compresses appropriately for writing by
the application. For example, reading of compressed signals take up 1 to 7 bits, the
signals are mapped to one byte each for the application. Internally the Signal Interface
continues to store these data in its memory in compressed form.
2013, Vector Informatik GmbH
Version: 2.10.03
16 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
3 Functional Description 3.1 Features The interface is divided into different communication layers. The Interaction Layer
including the Signal Interface and the Message Manager put on the Data Link Layer
represented by the Vector CAN driver. These layers, as described in chapter
2.1
Architecture Overview, are responsible for a number of tasks listed below.
The following features are supported:
Supported Feature
Receive Messages:
Provide signal-oriented access to data which arrived over the CAN bus.
Notify the application on signal level, if a message has arrived (indication).
Monitors receive messages to determine whether they arrive periodically (timeout monitoring).
Use default values in case of timeout or when the reception was stopped.
Transmit Messages: Provide signal-oriented access to data to be sent over the CAN bus.
Provide different Transmission Modes to offer the application various mechanisms to transmit
data.
Notify the application on signal level, if a message was transmitted (confirmation).
Monitor transmit messages to determine whether they had been actually transmitted (timeout
monitoring).
Always keep a delay time between send requests of a message. This should delimit the bus
load.
Use default values in case of timeout or when the transmission was stopped.
Table 3-1
Supported features
3.2 Initialization If the CCL is not used in the software stack, the application has to initialize the
components.
Example Here is an example, if the initialization has to be implemented by the application.
/* Disable interrupts during the initialization of the
Components */
DisableInterrupts();
/* Initialize all components */
CanInitPowerOn();
IlInitPowerOn();
TpInitPowerOn();
2013, Vector Informatik GmbH
Version: 2.10.03
17 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
DiagInit();
/* Enable interrupts */
EnableInterrupts();
3.3 Interaction Layer State Machine An ECU can be in several states. These are normal-operation, sleep mode, bus-off mode
and others. In different states the communication components have to meet different
requirements. Therefore a state machine is defined for the Interaction Layer which
consists of the states uninit, running, waiting and suspended (See in Figure 3-2 State
Machine of the Interaction Layer). The state machine is instantiated per channel and for
each communication direction (See in Figure 3-1 Rx and Tx State Machines).
Figure 3-1
Rx and Tx State Machines
stm State MachineRunningWait
Rele ase
Start
St op
WaitingSuspe ndedSt op
IlIn it,
IlInitP owerOn
Figure 3-2
State Machine of the Interaction Layer
2013, Vector Informatik GmbH
Version: 2.10.03
18 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
3.3.1 States 3.3.1.1 Uninit After power-on the Interaction Layer will be in the uninit-state. Initializing the Interaction
Layer will lead to a state transition to the state suspended.
3.3.1.2 Running The running state is used for normal operation.
Receive Section
Reception of data is enabled as well as timeout monitoring and notification.
Transmit Section
Transmission of data is enabled. Signal Interface and Message Manager are working.
The notification and the timeout monitoring are activated.
3.3.1.3 Waiting This state was designed for example to support bus-off mode or low-voltage mode.
Receive Section
Reception of data is enabled as well as the notification for indication. The timeout
monitoring will be turned off to prevent timeout detection of messages from an ECU
which is in bus-off mode and does not transmit data.
Transmit Section
Transmission of data and the timeout monitoring will be disabled and the API will keep
on working. So the application could request the transmission of data, but the
Interaction Layer won’t follow immediately. The transmit requests will be stored and
executed, when the state transits to Running. Transmission bursts are avoided if
GenMsgStartDelay timings are defined, if this state is used in the bus-off mode.
3.3.2 State Transitions The transitions of the state machine are divided into transmit and receive sections of the
Interaction Layer and will usually be initiated by the Network Management. The application
does not need to get involved here.
3.3.2.1 Init The component variables are initialized. There is an option for initializing the transmit
buffer and/or the receive buffer with default values. If no default value was configured, the
buffers will be initialized with 0. The content of the default values is defined at compile time
within the Configuration Tool. The flags will all be reset. If configured in the Configuration
Tool, the application will be notified by invoking signal related callback functions.
3.3.2.2 Start The receive section and the transmit section respectively are started within this transition.
Communication Description Section
Receive Section
> The flags used for notification will be reset. These are in particular: the
first value flag, the data changed flag, the indication flag and the Rx
timeout flag.
> Timeout monitoring will be started by a reload of the timers.
> The values of the messages will be set to their default values, if defined at
2013, Vector Informatik GmbH
Version: 2.10.03
19 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Communication Description Section compile time.
> If configured in the Configuration Tool, the application will be notified by
invoking ApplIlRxStart() and/or signal related callback functions.
Transmit Section
> The flags used for notification will be reset. These are in particular: the
confirmation flag and the Tx timeout flag.
> The timers used for cycle times (e.g. for Send Periodic) will be initialized
and started after the start delay time.
> Timeout monitoring will be enabled by a reset of the timers.
> The values of the signals will be set to their default values, if defined at
compile time.
> If configured in the Configuration Tool, the application will be notified by
invoking ApplIlTxStart() and/or signal related callback functions.
Table 3-2
Start transition events
3.3.2.3 Stop The reception and the transmission of messages respectively are stopped within this
transition.
Communication Description Section
Receive Section
> The flags used for notification won’t be changed.
> The timer used for timeout monitoring will be stopped.
> If configured, the values of the signals will be set to their default values.
Otherwise they won’t be changed.
> If configured in the Configuration Tool, the application will be notified by
invoking ApplIlRxStop() and/or signal related callback functions.
Transmit Section
> The flags used for notification won’t be changed.
> If configured, the values of the messages will be set to their default
values. Otherwise they won’t be changed.
> Transmission and timeout monitoring will be stopped.
> If configured in the Configuration Tool, the application will be notified by
invoking ApplIlTxStop() and/or signal related callback functions.
Table 3-3
Stop transition events
3.3.2.4 Wait The receive section and the transmit section respectively are deactivated within this
transition.
Communication Description Section
Receive Section
> Timeout monitoring will be stopped.
Transmit Section
> The flags used for notification won’t be changed.
> The values of the messages won’t be changed but could be updated by
the application.
> Transmission and timeout monitoring will be stopped.
> Requests for direct transmissions are stored in the waiting state. The
2013, Vector Informatik GmbH
Version: 2.10.03
20 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Communication Description Section related messages are transmitted after leaving the waiting state (release).
Table 3-4
Wait transition events
3.3.2.5 Release The receive section respectively the transmit section are activated again within this
transition.
Communication Description Section
Receive Section
> The timeout monitoring will be restarted by reloading the timers.
> The timeout flags are cleared, if configured (only GENy).
Transmit Section
> The timers used for cycle times and timeout monitoring will be continued.
The values won’t be changed to avoid interference between periodic
transmitted messages on the bus (bursts). Pending requests for direct
transmissions are performed. This can lead to a burst of messages after
leaving the waiting state.
Table 3-5
Release transition events
3.4 Main Functions The Interaction Layer provides two functions (IlRxTask and IlTxTask) that have to be called
cyclically as configured in GENy by the Application, OS or CCL.
2013, Vector Informatik GmbH
Version: 2.10.03
21 / 115
based on template version 3.7



Technical Reference Vector Interaction Layer
Figure 3-3 Call of the Interaction Layer cyclic function
Example Here is an example, if the task calls have to be implemented by the application.
for(;;)
{
/* periodic call of IlRxTask() and IlTxTask() */
if (flag_10ms)
{
IlRxTask();
IlTxTask();
flag_10ms = 0; /* clear flag which was set by a timer
*/
}
}
2013, Vector Informatik GmbH
Version: 2.10.03
22 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
3.5 Interaction Layer Communication Concept 3.5.1 Interface Concept The Interaction Layer as placed in the layer model has got two interfaces - one to the
upper layer represented by the application and one to the layer below, the Data Link Layer.
The receipt and the transmission of data is the main task of the Interaction Layer. To fulfil
both of these tasks the Interaction Layer represented by its interfaces need to interact in
different ways with its communication partners. Therefore different techniques like
functions, interrupts and periodic tasks are used.
To enable the transmission of data for the application, functions and macros are provided
by the Interaction Layer. The application could call these functions and macros whenever it
needs to. The Interaction Layer usually copies the data to be transmitted to its local
memory, sets a transmit request and leaves the processor to the application. The data
actually will be transmitted later by a periodic task. This task checks at a defined period of
time for transmit requests and executes them by calling the Data Link Layer. However, the
application does not need to know anything about the process of transmission. It just
needs to call the function respectively macro related to a signal to start the transmission
process. A detailed description of this proceeding is given in chapter 3.7 Data
Transmission.
The received data has to be treated immediately when arrived. This will be done by a
receive interrupt. Inside the interrupt handler only the time critical work is done. The
remaining not time critical work will be done by a periodic task which for example is
responsible for the notification of the application. To get the signal values the application
has to poll these values by calling functions respectively macros related to the signals. To
decide whether to get new data the application will be notified about the arrival of new
data. The reception is described more detailed in chapter 3.8 Data Reception.
3.5.2 Notification Mechanisms Two mechanisms are provided for the notification of the application. These are: flag-
interface and function-interface.
If the flag interface is used, the application has to poll the flags which were set by the
Interaction Layer. To maintain as much separation as possible between a message and
the signals of a message each signal can have its own flags or functions. Parameterization
for this is performed in the Configuration Tool. Flag access is done by C macros. The
macro name is comprised of the signal name and a postfix.
If the function interface is used, the application has to provide callback functions which are
called by the Interaction Layer. The function name comprises the signal name and its
indication-function’s pre- and postfixes.
3.6 Data Access 3.6.1 Data Consistency Since the Data Link Layer operates interrupt-driven, the read and write access to CAN
data can be interrupted by a write or read request of the Data Link Layer. Under some
circumstances this can lead to incorrect data if the data access in the Interaction Layer
involves multiple bytes.
Figure 3-4 Synchronization Problem of Data Access describes a write operation of two
bytes performed by the application. After the first byte is read (r 0x01) from the memory the
2013, Vector Informatik GmbH
Version: 2.10.03
23 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
read operation was interrupted by the write operation (w 0xAB and w 0xFF) of the IRQ of a
receive message. However, the application continues reading the second byte (r 0xAB)
after the interrupt routine finished. This causes an inconsistency of data read by the
application. The same problem could occur during any access to shared memory.
Interrupted Read Operation
read operation interrupted0xAB 0x01
ApplicationR
R
0
0
x
x
0
A
1
In
B
0x02 0x01
te
0x02 0xFF
0xAB 0xFF
R
Signal memoryrr
T
u
W
W
I
low byte
p
high byte
2 byte value
t
0
0
x
x
F
A
F
B
Interaction Layerm
e
s
s
a
g
e
0xAB 0xFF
Data Link Layer Figure 3-4
Synchronization Problem of Data Access
To prevent this, synchronization mechanisms were inserted for read/write into the
Interaction Layer. Accesses on signals which do not need any synchronization (e.g. bit
signals) could be executed as macros. The access to other signals must be routed through
functions, because suitable synchronization mechanisms can be inserted there. The signal
functions are generated by the Configuration Tool, where suitable synchronization
mechanisms are included.
The choice of the synchronization method depends on the particular processor type and
will be made by the Configuration Tool. One possibility for example is to disable interrupts
while reading or writing data. So the interrupts can’t disturb the access mechanism.
3.6.2 Signal Interface The Signal Interface provides functions/macros for read access and writes access to the
shared CAN data memory. Each signal has its own function/macro whose argument is the
signal value or a data pointer. The function name comprises the signal name from the
network database and suitable application-specific prefixes and suffixes. The data access
functions can be implemented as macros or as actual functions as receive functions can
be. The two variants do not differ syntactically. The implementation reserves the option of
implementing signal access as a macro or as a function.
For read access to the transmit buffer and write access to the receive buffer, respectively,
macros are provided. E.g. the usual operation on a receive signal is reading new data.
2013, Vector Informatik GmbH
Version: 2.10.03
24 / 115
based on template version 3.7



Technical Reference Vector Interaction Layer
Therefore, a function or a macro will be provided. Additionally a macro for write access to
this receive signal can be configured. By default these macros are switched off, but can be
configured by the Configuration Tool. If not needed, we recommend not switch the macros
on, because of the resources functions need.
Depending on the size of the signal, the type of argument for data access can differ. If the
signal length is lower than or equal to 8 bit, the signal argument is treated as a vuint8 (8-bit
unsigned char). Signals, which are between 9 bit and 16 bit are treated as vuint16 (16-bit
unsigned short) values. If the signal size is between 17 bit and 32 bit a vuint32 (unsigned
long) will be used as signal argument. For signals greater than 32 bit, the function requests
a pointer to the source data buffer. I.e. the Application has to pass a data pointer to a
memory area of sufficient size.
3.6.3 AUTOSAR Signal Interface The Vector Interaction Layer can be configured to support the signal access as defined in
the AUTOSAR COM specification Version 2.0 [8].
The signal access is realized by using one function for write access and one function for
read access. The signal that has to be written or read is given as parameter, as well as the
value for a write access. The signal that is read is stored to the location given with the
second parameter. See in the API below and the examples in chapter 3.6.4 Example:
Writing and reading a signal value.
Example A signal is written using
Com_ReturnType Com_SendSignal (Com_SignalIdType SignalId,
Com_ApplicationDataRefType SignalDataPtr);
A signal is read using
Com_ReturnType Com_ReceiveSignal(Com_SignalIdType SignalId,
Com_ApplicationDataRefType SignalDataPtr);
The AUTOSAR signal access is implementation via efficient macros. Due to this, the
SignalId is the unique name of the signal as displayed by GENy and not an own data type
as specified by [8]. The
SignalDataPtr is a vuint8 pointer to the location where the
received signal should be written to.
Please note
Signals defined in the dbc file can be accessed.
No local communication is supported.
The return value is always E_OK.
Restrictions of the standard API are inherited.
Opaque Data types are mapped to unit data types according to the following list:
Bit length 1..8 -> vuint8
Bit length 9..16 -> vuint16
Bit length 17..32 -> vuint32
.
2013, Vector Informatik GmbH
Version: 2.10.03
25 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
3.6.4 Example: Writing and reading a signal value The database contains the signals "EngineSpeed" (36 bit), "InteriorLight" (1 bit signal),
"NewTemperature" (36 bit), “NewWindowPos” (16bit) and “EngineRPM” (30bit). The user
configures the prefixes "ILPut" and “ILGet” and the suffix "_Sig”. By this configuration the
Configuration Tool derives the functions shown below.
/* Application makes memory space available */
/* -------------------------------------------------- */
unsigned char EngineSpeed [5];
unsigned char InteriorLight;
unsigned char NewTemperature [5];
unsigned short NewWindowPos;
unsigned long EngineRPM;
/* Receive and transmit signals */
/* --------------------------------------------------- */
ILGetRxEngineSpeed_Sig( &EngineSpeed ); /* Signal value > 32 Bit
*/
InteriorLight = ILGetRxInteriorLight_Sig(); /* Signal value <= 8
Bit */
ILPutTxTemperature_Sig( &NewTemperature); /* Signal value > 32
Bit */
ILPutTxWindowPos_Sig( NewWindowPos ); /* Signal value <= 16 Bit
*/
EngineRPB = ILGetRxEngineRPM_Sig(); /* Signal value <= 32 Bit */
/* Receive and transmit signals using
AUTOSAR API */
/* --------------------------------------------------- */
Com_
ReceiveSignal(EngineSpeed_Sig, EngineSpeed ); /* Signal value
> 32 Bit */
Com_
ReceiveSignal(InteriorLight_Sig, &InteriorLight) /* Signal
value <= 8 Bit */
Com_
SendSignal(Temperature_Sig, NewTemperature); /* Signal value
> 32 Bit */
Com_
SendSignal(WindowPos_Sig, &NewWindowPos); /* Signal value
<= 16 Bit */
Com_
ReceiveSignal(EngineRPM_Sig, &EngineRPB); /* Signal value
<= 32 Bit */
Caution
All generated signal access only provides
unsigned integer values. Signed, float and
the scaling factors (as adjustable in CANdb++) are not supported and have to be
interpreted by the application.
2013, Vector Informatik GmbH
Version: 2.10.03
26 / 115
based on template version 3.7



Technical Reference Vector Interaction Layer
3.6.5 Signal Groups Physically dependent signals often need to be transmitted together. Therefore, the
Interaction Layer provides the possibility to combine signals to a signal group. With a
signal group the application can collect the data of dependent signals and invoke the
transmission when the group is complete. The definition of the groups is done in the data
base file (DBC), the data collection in a reserved buffer.
With the configuration tool GENy settings for a whole group can be done, e.g. the way of
how to react in case of a group reception or the usage of a buffer provided by the
application.
The strategy for transmitting a signal group is to update all group signals and then sending
the group.
And vice versa is the strategy for receiving a signal group. The group is updated and then
every signal can be read.
There must be distinguished between two different APIs:
IL API (with data buffer provided by the application or data buffer provided by the IL)
AUTOSAR API
3.6.5.1 Il API The IL API can be used with a buffer provided by the application or the buffer provided by
the IL. This can be selected on the configuration view of each signal group in GENy.
IL Buffer used If the GENy checkbox
Use Appl SignalGroupBuffer on the configuration view of the
single groups is
not checked the standard buffer defined by the IL is used. The Interaction
Layer provides a structure in which the related signals are combined.
Example Transmission of a signal group with IL API.
IlGetTx<groupname>();
IlPutTx<signalname>(data)
…
IlPutTx<groupname>();
Example Reception of a signal group with IL API.
IlGetRx<groupname>()
value = IlGetRx<signalname>(dataPtr);
…
2013, Vector Informatik GmbH
Version: 2.10.03
27 / 115
based on template version 3.7




Technical Reference Vector Interaction Layer
Appl SignalGroupBuffer used With the GENy checkbox
Use Appl SignalGroupBuffer on the configuration view of the
single groups the usage of the buffer provided by the application is activated. You have to
provide this buffer.
Example Transmission of a signal group with IL API and buffer provided by the application.
/* declare the buffer */
V_MEMRAM0 V_MEMRAM1 _c_<groupname>_buf V_MEMRAM2
<groupname>;
/* initialize the buffer */
IlGetTx<groupname>ShadowBuffer(&<groupname>);
IlPutTx<signalname>SigShadowBuffer(&<groupname>, data);
…
IlPutTx<groupname>ShadowBuffer(&<groupname>);
Example Reception of a signal group with AUTOSAR API and buffer provided by the application.
/* declare the buffer */
V_MEMRAM0 V_MEMRAM1 _c_IlRxGroup00_buf V_MEMRAM2
<groupname>;
/* initialize the buffer */
IlGetRx<groupname>ShadowBuffer(&<groupname>);
value = IlGetRx<groupname>SigShadowBuffer(&<groupname>,
dataPtr);
3.6.5.2 AUTOSAR API Using the AUTOSAR API there is no way to define an own shadow buffer for the storage of
the signal groups. The predefined shadow buffer is used.
Updating the buffer for transmission:
Example Transmission of a signal group with AUTOSAR API.
Com_UpdateShadowSignal(<signalname>, &data);
2013, Vector Informatik GmbH
Version: 2.10.03
28 / 115
based on template version 3.7



Technical Reference Vector Interaction Layer
…
Com_SendSignalGroup(<groupname>);
Example Reception of a signal group with AUTOSAR API.
Com_ReceiveSignalGroup(<groupname>);
Com_ReceiveShadowSignal(<signalname>, &ret);
…
3.6.5.3 GENy configuration Almost any setting that is available for a single signal also is available for a signal group
and can be selected on the configuration view of the signal group in GENy. In detail this is:
Put and get macros
Indication flag and function
Confirmation flag and function
Timeout flag and function
Notification in case of state machine transition: init, start, stop
Default values
Caution
Signal groups and multiplex messages cannot be combined in one message!.
3.6.6 Default Values Each signal may have a default value which is defined in the Configuration Tool at compile
time. These default values are used for
Initializing the Interaction Layer (IlInitPowerOn)
Starting the receive section (IlRxStart)
Suspending the receive section (IlRxStop)
Starting the transmit section (IlTxStart)
Suspending the transmit section (IlTxStop)
Replacing signal values in the case of receive errors (time out)
By initializing the Interaction the signal values will be set to 0 (zero), if no default values
were defined. The user can define a single default value for each signal and configure, if it
should be used when the Interaction Layer is initialized or when the receive section or the
transmit section were started or stopped.
2013, Vector Informatik GmbH
Version: 2.10.03
29 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
At compile time the user could define what the Interaction Layer should do, if a receive
error occurred. It is possible to keep the old signal values or to replace them by a default
value (only if defined).
The largest default value which can be set in the configuration tool is 0xffffffff (32 Bit). If
signals greater than 32 Bits are used, they have to be set by the application e.g. in
ApplIlTxStart().
3.7 Data Transmission There are many ways data could be sent e.g. cyclic or triggered by a change of an initial
value, etc. The concept behind transmitting data with the Vector Interaction Layer is
explained in the following.
3.7.1 Transmission Concept The Vector Interaction Layer offers a set of so-called transmission modes. According to
these modes the signals and messages are being sent. The setting of the modes has to be
done in the DBC file using the CANdb++ editor for any signal.
The following
signal transmission modes are selectable:
Cyclic
OnWrite
OnWriteWithRepetition
OnChange
OnChangeWithRepetition
IfActive
IfActiveWithRepetition
NoSigSendType
OnChangeAndIfActive
OnChangeAndIfActiveWithRepetition
Additionally there are also transmission modes for
messages:
Cyclic
IfActive
NoMsgSendType
The resulting transmission mode is an OR between the message and the signal
transmission mode. The greyed fields describe the attribute to be set to for this specific
transmission mode.
Signal Related Mixed Advanced Transmission Transmission Transmission 2013, Vector Informatik GmbH
Version: 2.10.03
30 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
MessageNoMsgSendType Cyclic IfActive Signal CyclicTransmit fast if signal is Cyclic Transmission active (automatically set for all
signals in this message)
or
Cyclic Transmission GenMsgCycleTime
GenMsgCycleTime
GenMsgCycleTimeFast
GenSigInactiveValue
OnWriteCyclic Transmit fast if signal is OnEvent [Write]
Will be sent immediately
Transmission active after a write access.
or (automatically set for all
OnEvent [Write]
signals in this message)
(immediately)
or
OnEvent [Write]
Will be sent immediately after
a write access.
GenMsgCycleTime
GenMsgCycleTimeFast
GenSigInactiveValue
OnWriteWithRepetitionCyclic Transmit fast if signal is OnEvent [Write]
with
RepetitionTransmission active or (automatically set for all
OnEvent [Write]
signals in this message)
with Repetition or
OnEvent [Write]
with
Repetition GenMsgCycleTimeFast
GenMsgCycleTime
GenMsgCycleTimeFast
GenMsgNrOfRepetition
GenMsgCycleTimeFast GenSigInactiveValue
GenMsgNrOfRepetition
GenMsgNrOfRepetition
OnChangeCyclic Transmit fast if signal is OnEvent [Change]
Will be sent immediately
Transmission active after value changed.
or (automatically set for all
OnEvent [Change]
signals in this message)
Will be sent
or immediately after value
OnEvent [Change]
changed.
Will be sent immediately after
value changed.
GenMsgCycleTime
GenMsgCycleTimeFast
GenSigInactiveValue
2013, Vector Informatik GmbH
Version: 2.10.03
31 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
OnChangeWithRepetitionCyclic Transmit fast if signal is OnEvent [Change]
with RepetitionTransmission active or (automatically set for all
OnEvent [Change]
signals in this message)
with Repetition or
OnEvent [Change]
with
Repetition GenMsgCycleTimeFast
GenMsgCycleTime
GenMsgCycleTimeFast
GenMsgNrOfRepetition
GenMsgCycleTimeFast
GenSigInactiveValue
GenMsgNrOfRepetition
GenMsgNrOfRepetition
IfActiveCyclic Transmit fast if signal is Transmit fast if signal
is active.
Transmissionactive or (automatically set for all
Transmit fast if signals in this message)
signal is active.
GenMsgCycleTimeFast
GenMsgCycleTime
GenMsgCycleTimeFast
GenSigInactiveValue
GenMsgCycleTimeFast
GenSigInactiveValue
GenSigInactiveValue
IfActiveWithRepetitionCyclic Transmit fast if signal is Transmit fast if signal
is active with Transmission active with Repetition Repetitionor(automatically set for all
Transmit fast if signals in this message)
signal is active with
Repetition GenMsgCycleTimeFast
GenMsgCycleTime
GenMsgCycleTimeFast
GenSigInactiveValue
GenMsgCycleTimeFast
GenSigInactiveValue
GenMsgNrOfRepetition
GenSigInactiveValue
GenMsgNrOfRepetition
GenMsgNrOfRepetition
NoSigSendTypeCyclic Transmit fast if signal is No Transmission Transmission active (GenMsgCycleTime
(automatically set for all
must be set)
signals in this message,
GenMsgCycleTimeFast must
be set)
GenMsgCycleTime
GenMsgCycleTimeFast
GenSigInactiveValue
OnChangeAndIfActiveCyclic Transmit fast if signal is Transmit fast if signal
is activeTransmissionactive oror(automatically set for all
Transmit fast if signals in this message)
OnEvent [Change]
signal is active with Will be sent immediately
Repetition after value changed.
or
OnEvent [Change]
Will be sent
immediately
after value changed.
2013, Vector Informatik GmbH
Version: 2.10.03
32 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
GenMsgCycleTimeFast
GenMsgCycleTime
GenMsgCycleTimeFast
GenSigInactiveValue
GenMsgCycleTimeFast
GenSigInactiveValue
GenSigInactiveValue
OnChangeAndIfActiveWiTransmit fast if signal Cyclic Transmit fast if signal is thRepetitionTransmissionactive with Repetition is active with Repetitionor(automatically set for all
orTransmit fast if signals in this message
)
signal is active with OnEvent [Change]
Repetition Will be sent immediately
or after value changed.
OnEvent [Change]
Will be sent
immediately
after value changed.
GenMsgCycleTimeFast
GenMsgCycleTime
GenMsgCycleTimeFast
GenSigInactiveValue
GenMsgCycleTimeFast
GenSigInactiveValue
GenMsgNrOfRepetition
GenMsgNrOfRepetition
GenSigInactiveValue
GenMsgNrOfRepetition
Table 3-6
Send Type Matrix
Caution
OnChange parameters will always trigger a send event if an overlapping bit of the value
written is equals one.
For the correct OnChange behaviour the application must cast the value of a signal to
the signal bit length on the bus, before the IlPut macro is called.
It is the job of the data base engineer (or a suitable program) to assign the signals to the
messages to get the desired transmission modes for any message and signal.
The application does not need to know the transmission mode of the signals. It just calls
the function to write or read the signal value (ILPutTx
signalname or
ILGetRx
signalname). Everything else will be done by the Signal Interface.
In case of periodic transmission modes only two different cycle times could be chosen for
signals combined in the same message. Therefore, the cycle time of a periodically
transmitted signal depends on the cycle time of other signals defined for periodic
transmission related to the same message. The application developer is responsible for
choosing sensible combinations of signals for a message. She/He will be supported by the
Configuration Tool.
The transmission modes resulted from the combinations as shown in the table above are
explained in detail in chapter 3.7.2 Signal Related Transmission Modes.
3.7.2 Signal Related Transmission Modes This summarizes the first column of the table above. The message send type is set to
NoMsgSendType.
2013, Vector Informatik GmbH
Version: 2.10.03
33 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
3.7.2.1 Cyclic Transmission A static period is used to transmit the signals cyclically using this transmission mode. This
mode could be used to transmit signals which are frequently changing their values like the
rpm of an engine for example. The period should be adapted to the speed the signals are
changing their values. Short periods causes high bus load.
As shown in Figure 3-5 Timing Diagram of the Periodic Transmission Mode signals could
be updated asynchronously to the period of transmission. Each time the transmission
takes place the Interaction Layer checks for the current value of the message. This, of
cause, could lead into the loss of data, if a signal was updated two or more times within a
period.
This Cyclic Transmission Mode actually just copies the signal data. The cyclic transmission
of the messages is done using the
GenMsgSendType.
Cyclic Transmission Mode
Application
IlPu
asynchronous
t
(5writing
)Signal memory
periodical
polling
Interaction Layer
IlTask
t
IlTask
IlTask
IlTask
m
IlTask
IlTask
IlTask
m
e
e
s
s
s
s
a
a
g
g
e
e
(5)Data Link Layer
GenMsgCycleTime
Figure 3-5
Timing Diagram of the Periodic Transmission Mode
3.7.2.2 OnEvent (OnWrite, OnChange) Signals using this transmission mode will be transmitted once each time the IlPut-
function was called. The transmission of the signals may be delayed by the delay timer
(see chapter 3.7.6 Reduction of Transmission Bursts and 3.7.7 Delimitation of the Bus
Load) to delimit the bus load. This transmission mode, for example, could be used for
event triggered signals as the state of a switch.
Figure 3-6
Timing Diagram of the Transmission Mode OnEvent – OnWrite shows the
timing diagram of the event triggered transmission mode.
Writing a signal which is related to the
OnWrite transmission mode causes the
transmission of the message which contains this signal.
2013, Vector Informatik GmbH
Version: 2.10.03
34 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Changing a signal which is related to the
OnChange transmission mode causes the
transmission of the message which contains this signal.
The TxTask checks if the delay time elapsed and decides whether to transmit the message
immediately or to delay the transmission until the delay time elapsed. This could cause the
loss of data, if the signal was updated two or more times while delay time.
Send OnEvent - OnWrite
Application
lo
sIL
tIL
IL
P
sP
P
u
iu
u
t
g_
t_
t_
(na(ab(a)l))IlTask
IlTask
IlTask
Interaction Layer
t
m
IlTask
IlTask
IlTask
m
IlTask
e
e
s
s
s
s
a
a
g
g
e
e
( a(a))Data Link Layer
GenMsgDelayTime
Figure 3-6
Timing Diagram of the Transmission Mode OnEvent – OnWrite
The Diagram for
OnEvent – OnChange looks like the same way but the decision on
whether to send or not is met by a comparison between the old and the new signal value.
It will only be sent if the value changes.
3.7.2.3 OnEvent with Repetition (OnWrite, OnChange) The transmission of the signals using this transmission mode will be repeated n-times after
the ILPut-function was called once. For example, this mode could be used to transmit
important signals which have not to be missed like safety critical information.
Each call of the ILPut-function sets the repeat counter (
repeat_counter
[GenMsgNrOfRepetitions] = n). The repeat counter is decremented with each
transmission of the signal. The transmission takes place each time the delay timer elapses
and the repeat counter is still greater than 0. After the ILPut-function the message will be
sent
n times.
2013, Vector Informatik GmbH
Version: 2.10.03
35 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
OnEvent with Repetition - OnWrite
Application
IlPu
t
(5)Signal memory
IlTask
IlTask
IlTask
Interaction Layer
t
IlTask IlTask IlTask IlTask
m
IlTask
m
IlTask
m
IlTask IlTask IlTask IlTask
e
e
e
s
s
s
s
s
s
a
a
a
g
g
g
e
e
e
( 5((55)))Data Link Layer
GenMsgCycleTimeFast
GenMsgNrOfRepetitions = 3
Figure 3-7
Timing Diagram of OnEvent with Repetition -
OnWrite The Diagram for
OnEvent – OnChange looks like the same way but the decision on
whether to send or not is met by a comparison between the old and the new signal value.
It will only be sent if the value changes.
3.7.2.4 Transmit Fast if Signal is Active This transmission mode is a Cyclic Transmission Mode with a trigger condition. If the
decision is met that the signal is active, the message will be send cyclically with the period
GenMsgCycleTimeFast.
In the Example in Figure 3-8 Timing Diagram of the Transmit Fast if Signal Active
Transmission Mode the condition is defined as x!=10. This will cause the transmission
mode to transmit the signal with the period GenMsgCycleTimeFast. If the signal value is
equal to 10 the signal is not sent.
2013, Vector Informatik GmbH
Version: 2.10.03
36 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Transmission Fast if Signal Active
the signal is active if its value is not 10.
Application
I
I
I
l
l
l
P
P
P
u
u
u
t
t
t
(((521)00))DecisionIf(x!=10)
IlTask
IlTask IlTask IlTask IlTask IlTask
IlTask IlTask
IlTask IlTask IlTask IlTask
Interaction Layer
t
IlTask IlTask
m
m
m
IlTask
IlTask
e
e
e
s
s
s
s
s
s
a
a
a
g
g
g
e
e
e
( (5(22)00))Data Link Layer
GenMsgCycleTime
Fast Figure 3-8
Timing Diagram of the Transmit Fast if Signal Active Transmission Mode
If two or more signals using this transmission mode are combined to the same message, a
rule is needed to regulate switching between the periods.
Figure 3-9
Example for Combining Signals Related of the Send Fast if Signal Active
Mode to the Same Message shows an example where three signals (A, B and C) are
combined to the same message. If signal A was written and meet the defined condition,
the transmission starts with the fast period. This state is stored in a flag presented by the
three squares (grey = set, white = not set). The switch will cause the fast transmission of
all signals combined to this message. A second write command for signal A won’t cause
anything, if the value of A still meets the condition. If signal B was written and meet its
condition the flag for signal B will be set. This should cause the transmission mode to
switch to the fast period. But this was already done so nothing will happen. The signal
value for B which is written next does not meet the condition so the transmission should
stop. This won’t happen, because the flag for signal A is still set. To switch the transmission
off all flags need to be reset. This is shown by setting the flag for signal C, reset the flag for
signal A and reset the flag for signal C. After no set flag remains, the transmission stops.
Short: If signals using the Transmit Fast if Signal Active Mode are combined to the same
message, the message will be transmitted fast if one ore more of them meets its condition.
It will not be transmitted if none of them meet its condition.
2013, Vector Informatik GmbH
Version: 2.10.03
37 / 115
based on template version 3.7





























Technical Reference Vector Interaction Layer
Multiple Signals in Transmit Fast if Signal Active Mode
Application
A
A
B
B
C
A
C
Signal Interface
S
S
S
S
S
S
S
e
e
e
to
e
to
to
t
t
t
p
t
p
p
IlTask
IlTask
Interaction Layer
IlTask
m
e
s
s
a
g
e
Data Link Layer
GenMsgCycleTimeFast
Figure 3-9
Example for Combining Signals Related of the Send Fast if Signal Active Mode to the Same Message
3.7.2.5 Transmit Fast if Signal is Active with Repetition This is the same mode as above with the exception that the last transmission after the
signal became inactive will be sent n times.
Transmission Fast if Signal Active with Repetition
the signal is active if its value is not 10.
Application
I
I
I
l
l
l
P
P
P
u
u
u
t
t
t
(((521)00))DecisionIf(x!=10)
IlTask
IlTask IlTask IlTask IlTask IlTask
IlTask IlTask
IlTask IlTask IlTask IlTask
Interaction Layer
t
IlTask IlTask
m
m
m
m
m
IlTask
IlTask
e
e
e
e
e
s
s
s
s
s
s
s
s
s
s
a
a
a
a
a
g
g
g
g
g
e
e
e
e
e
( (((5(2211)0000))))Data Link Layer
GenMsgCycleTime
FastGenMsgCycleTime
FastGenMsgNrOfRepetitions = 2
Figure 3-10
Timing Diagram of the Transmit Fast if Signal Active Transmission Mode
2013, Vector Informatik GmbH
Version: 2.10.03
38 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
3.7.3 Mixed Transmission Mode The mixed transmission modes are represented of the second column in the table above.
This is a combination of the already shown signal oriented transmission modes and the
cyclic transmission mode for the message the signals are assigned to.
3.7.3.1 Cyclic (Message) Transmission OR Cyclic (Signal) Transmission This is absolutely the same as already described in
3.7.2.1, see there for more
information.
3.7.3.2 Cyclic (Message) Transmission OR OnEvent [Write] The signal is sent cyclically with the period GenMsgCycleTime and additionally after an
IlPut-function call.
Mixed Transmission Mode - Cyclic OR OnEvent [Write]
Application
2
0Interaction Layer
m
m
m
m
e
e
m
e
e
s
s
e
s
s
s
s
s
s
s
a
a
s
a
a
g
g
a
g
g
e
e
g
e
e
(
e
c
(c
(
c
(c
y
y
(2y
y
c
c
0c
c
le
le
l
)e
le
)
)
)
)
Data Link Layer
GenMsgDelayTime
GenMsgDelayTime
GenMsgDelayTime GenMsgDelayTime
GenMsgCycleTime
GenMsgCycleTime
GenMsgCycleTime
Figure 3-11
Mixed Transmission Mode – Cyclic OR OnEvent [Write]
The cyclic transmission is delayed because of the GenMsgDelayTime that has to be
waited until the next transmission is possible. As a result two cyclic messages can have a
distance that is smaller than GenMsgCycleTime.
3.7.3.3 Cyclic (Message) Transmission OR OnEvent [Write] with Repetition The same behaviour as above but the event triggered message transmission will be
performed GenMsgNrOfRepetitions times with the period of GenMsgCycleTimeFast.
The delay times are taken into account.
2013, Vector Informatik GmbH
Version: 2.10.03
39 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
3.7.3.4 Cyclic (Message) Transmission OR OnEvent [Change] This is the same transmission mode as shown
in 3.7.3.2 with the exception that the trigger
for sending the event message is a change of the signal value. In the example below the
message value changes from 5 to 20. This change is the trigger for the transmission.
Mixed Transmission Mode - Cyclic OR OnEvent [Change]
Application
5
2
0Decision
If(x>10)
Interaction Layer
m
m
m
m
m
e
e
e
e
e
s
s
s
s
s
s
s
s
s
s
a
a
a
a
a
g
g
g
g
g
e
e
e
e
e
(
((
(
5
(5
22
2
)
)
00
0
))
)
Data Link Layer
GenMsgDelayTime
GenMsgDelayTime
GenMsgDelayTime GenMsgDelayTime
GenMsgCycleTime
GenMsgCycleTime
GenMsgCycleTime
Figure 3-12
Mixed Transmission Mode – Cyclic OR OnEvent [Change]
3.7.3.5 Cyclic (Message) Transmission OR OnEvent [Change] with Repetition The same behaviour as above but the event triggered message transmission will be
performed GenMsgNrOfRepetitions times with the period of GenMsgCycleTimeFast.
The delay times are taken into account.
3.7.3.6 Cyclic (Message) Transmission OR Transmit Fast If Signal is Active Choosing this combination, the signal is transmitted cyclically with the GenMsgCycleTime
until the signal becomes active. Then the signal is transmitted with the
GenMsgCycleTimeFast until the signal becomes inactive. The period changes then back
to GenMsgCycleTime.
2013, Vector Informatik GmbH
Version: 2.10.03
40 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Transmission Fast if Signal Active Mode
the signal is active if its value is not 10.
Application
I
I
I
l
l
l
P
P
P
u
u
u
t
t
t
(((521)00))DecisionIf(x!=10)
IlTask
IlTask IlTask IlTask IlTask IlTask
IlTask
IlTask
Interaction Layer
t
m
IlTask IlTask
m
m
m
m
m
e
IlTask
IlTask IlTask
e
e
e
e
e
s
s
s
s
s
s
s
s
s
s
s
s
a
a
a
a
a
a
g
g
g
g
g
g
e
e
e
e
e
e
(
1
( (((5(22210
)0000)
))))Data Link Layer
GenMsgCycleTime
GenMsgCycleTime
FastGenMsgCycleTime
Figure 3-13
Mixed Transmission Mode – Cyclic OR Fast If Signal is Active
3.7.3.7 Cyclic (Message) Transmission OR Transmit Fast If Signal is Active with
Repetition The same behaviour as above but the last message of the fast transmission phase is sent
GenMsgNrOfRepetions times before switching to the GenMsgCycleTime sending
period.
2013, Vector Informatik GmbH
Version: 2.10.03
41 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
Mixed Transmission Mode - Cyclic OR
the signal is active if its value is not 10.
Transmission Fast if Signal Active with Repetition
Application
I
I
I
l
l
l
P
P
P
u
u
u
t
t
t
(((521)00))DecisionIf(x!=10)
IlTask
IlTask IlTask IlTask IlTask IlTask
IlTask IlTask
IlTask IlTask IlTask IlTask
Interaction Layer
t
m
m
IlTask IlTask
m
m
m
m
m
e
IlTask
IlTask
e
e
e
e
e
e
s
s
s
s
s
s
s
s
s
s
s
s
s
s
a
a
a
a
a
a
a
g
g
g
g
g
g
g
e
e
e
e
e
e
e
(
1
( ((((5(221110
)00000)
)))))Data Link Layer
GenMsgCycleTime
FastGenMsgCycleTime
GenMsgCycleTime
FastGenMsgNrOfRepetitions = 2
Figure 3-14
Mixed Transmission Mode – Cyclic OR Fast If Signal is Active with Repetition
3.7.3.8 Cyclic (Message) Transmission OR NoSigSendType The message is sent cyclically with GenMsgCycleTime and with it all signals.
3.7.4 Advanced Transmission Modes These combinations are only used by a few OEMs and described in the OEM-specific
Interaction Layer documentation.
3.7.5 Notification Classes Two types of notification classes are available which cause the notification of the
application by flag or function. The flags are all set to 0 at the start of transmission
(Function IlTxStart() ).
The Configuration Tool can be used to assign a separate
Confirmation Class for each
signal. This event will be set by the Data Link Layer if the particular message was sent
on the bus.
If a flag is used for notification, the application is responsible for clearing this flag.
Caution
This callback function is called in interrupt context! Reduce the runtime of this function to
a minimum
The time between a transmit request and the actual transmission of a signal can be
supervised by timeout monitoring. A
Timeout Class will be set, if the signals were not
transmitted within a defined period of time.
2013, Vector Informatik GmbH
Version: 2.10.03
42 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
3.7.6 Reduction of Transmission Bursts To prevent transmission bursts caused by interference the start of periodic transmission
could be delayed. Therefore, a start delay time related to a message could be defined at
compile time. Take e.g. three periodically transmitted messages. If the transmission of the
three messages would be started at the same time, the simultaneous transmission of two
or three messages will take place at same points in time. To delay the beginning of the
periodic transmission of some messages is an appropriate way to reduce these
simultaneous transmissions.
3.7.7 Delimitation of the Bus Load To delimit the bus load a delay time will be inserted after each transmission of data. A
defined delay time is related to a message. This means that delay time will be inserted no
matter what transmission mode was used or by which signal the transmission of the
message was caused.
The usage of a delay time may cause the delay of the transmission. For example the
combination of a periodically transmitted message and a directly transmitted message
could cause a delay as shown in Figure 3-15 Delay Time to Delimit Bus Load. The dashed
arrows stand for periodically transmitted messages. If the direct transmission of a signal
was requested by calling ILPut while the timer GenMsgDelayTime was not elapsed yet, the
transmission of the signal will be delayed till the timer GenMsgDelayTime is elapsed.
To ensure that the message is minimum delayed the GenMsgDelayTime, one tx task cycle
is added to the delay counter, so a message is delayed for GenMsgDelayTime + a time <
tx task cycle.
This ensures that the message is never transmitted before the expiration of
GenMsgDelayTime.
2013, Vector Informatik GmbH
Version: 2.10.03
43 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Delay Time
Application
IL
IL
P
P
u
u
t
t
Interaction Layer
T
_
m
c
y
e
c
s
le
s
a
e
g
la
e
p
s
e
d
Data Link Layer
GenMsgDelayTime
GenMsgDelayTime
GenMsgCycleTime
GenMsgCycleTime
Figure 3-15
Delay Time to Delimit Bus Load
3.7.8 Transmission Timeout Monitoring The Interaction Layer provides a feature to monitor the transmission of signals. The
timeout monitoring for transmitted signals was intended to supervise the time between a
transmit request and the actual transmission of the signal. Therefore, a timer will be
activated, after a transmission was requested. If the successful transmission was notified
(confirmation), the timer will be deactivated. If the timer elapsed before the confirmation,
the application will be notified about the timeout.
To configure timeout monitoring for a signal the flag or function for the notification needs to
be chosen in the Configuration Tool. If no notification was chosen, the timeout monitoring
will be deactivated for this signal.
3.7.9 Transmission of Initialization Messages The Interaction Layer provides a function to transmit a set of messages, called
IlSendOnInitMsg(). This function is intended to be used at initialization time. It will
transmit each of the messages in the set only once. The transmission modes of the signals
and messages will be ignored. The messages belonging to the set can be configured at
compile time by using the Configuration Tool.
2013, Vector Informatik GmbH
Version: 2.10.03
44 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
3.8 Data Reception 3.8.1 Reception Concept To receive new data the Interaction Layer has to process the messages immediately.
Therefore all tasks will be interrupted to copy the new data to the RAM. On the other hand
the time of interrupt should be as short as possible. By that reason all the jobs which are
not time critical like for example the notification of the application are done by a periodic
task. Therefore the Interaction Layer provides several functions and an interrupt handler.
Further, the Interaction Layer provides several notification classes for example to notify the
application about updated values. The usual response of the application is to read the
updated signal values by calling functions or macros provided by the Signal Interface
(ILGetRx
signalname). Everything else will be done by the Signal Interface and the
underlying Message Manager.
3.8.2 Notification Classes Four types of notification classes are available which cause the notification of the
application by flag or function. The flags are all set to 0 at the start of receiving ( Function
IlRxStart() ). All classes are optional and in order to save code and run time they can
be removed by a configuration switch at compile time, set in the Configuration Tool.
1) If a message was received an
Indication Class will be set by the Interaction Layer. By
this event the application can determine whether a new message has arrived.
If a flag is used for notification, the application can always check the message contents
for changes and perform tasks accordingly, if the flag is set. The application is
responsible to clear the flag which was set by the Interaction Layer.
If needed, multiple indication flags for a single signal can be configured. By this feature
several parts of the application can be notified independently.
2) For periodic receive messages the Interaction Layer takes care of timeout monitoring. A
Timeout Class is set, if a message which should be received periodically arrives too
late. Too late means that a new message with the same ID was not received after
timeout time (Example: timeout time = 2.5x cycle time) elapsed. The timeout time of a
CAN-message is defined at compile time. All timeout functions are running in the same
context as the IlRxTask() does.
If a flag is used for notification, the flag will be set and cleared by the Interaction Layer.
The application is also allowed to clear the flag, but the Interaction Layer will always
overwrite it, if an event occurred.
3) The
First-Value Class notifies the application about the first reception of a signal. This
is done by setting an event each time a signal has been received. Actually, the First-
Value Class and the Indication Class are working the same way.
Only a flag could be used as notification mechanism for this class. The flag will be set
by the Interaction Layer. The application is responsible to clear the flag. The flag will be
reset by IlRxStart to recognize for example the first received message after power-
on or bus-off.
4) A
Data-Changed Class is provided for ECUs with processors of a higher performance
class. This event is set if the message contents of an incoming CAN message differs
from the contents of the memory in the controller's CAN buffer. For Full-CAN objects
this requires a copy of the message in RAM (increased RAM requirement in the
2013, Vector Informatik GmbH
Version: 2.10.03
45 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
controller). Using a mask, portions of the message can be masked out for the
comparison. Since the mask is applied to the message bit wise, changes involving
partial information of a signal can be used (e.g. only the upper 12 bits of a 16 bit
signal).
Only a flag can be used as notification mechanism for this class. The flag will be set by
the Interaction Layer. The application is responsible to clear the flag.
3.8.3 Timeout Monitoring The periodic receipt of messages which are periodically transmitted by another network
node could be overseen by timeout monitoring. For this purpose a time-out timer is
provided by the Interaction Layer. This timer will be restarted each time the related
message was received. If the timeout timer elapses before the next related message was
received, the application will be notified (see chapter 3.8.2 Notification Classes). When a
timeout occurs the current value of the message is not valid anymore. In this case the
message's memory area in the controller can be pre-filled with 0 (zero) or with a default
value (if defined) in order to preserve emergency operation of the application.
The attribute GenSigTimeoutTime_<ECU> in the network database needs to be set to
activate the timeout monitoring. The attribute GenSigTimeoutMsg_<ECU> may be set to
the default value. Then the message, which contains the current signal, will be monitored.
In the following example the configuration of the attributes in the network database will be
shown. A network node A transmits a signal to network node B by the Periodic
Transmission Mode. Network node B as the receiver of the signal wants to monitor the
periodic reception. Therefore, the attributes GenSigTimeoutMsg_<ECU> and
GenSigTimeoutTime_<ECU> needs to be adapted for this signal. For the timeout
monitoring by the network node B the name of the two attributes must be changed to
GenSigTimeoutMsg_
B and GenSigTimeoutTime_
B. If another network node, for example
network node XY, wants to monitor the reception of this signal, too, the attributes
GenSigTimeoutMsg_
XY and GenSigTimeoutTime_
XY have to be added. Further the
values need to be defined for the attributes. For the attribute GenSigTimeoutMsg_B we
need to fill in the message ID of the message which includes the signal to be monitored.
The attribute GenSigTimeoutTime_B contains the timeout time. If the signal was not
received within this time, the application will be notified.
The value of the dbc attribute GenSigTimeoutTime_<ECU> is displayed on each rx signal
in the GENy GUI.
2013, Vector Informatik GmbH
Version: 2.10.03
46 / 115
based on template version 3.7




Technical Reference Vector Interaction Layer
Caution
If the Timeout Time is editable the value is
not derived from the dbc attribute
GenSigTimeoutTime_<ECU>, in this case the timeout time can only be edited in the
GENy GUI.
For diagnosis efforts the Interaction Layer provides an advanced timeout monitoring for
messages. This includes the possibility to reload the timeout timer and the message
related notification of the application when this timer elapsed again. I.e. after the first
timeout occurred the Interaction Layer will notify the application about the timeout of each
signal included in the message. Then the application can reload the timeout timer. After
this timer elapsed again, the Interaction Layer will notify the application about the timeout
of the whole message. After the reload of the timer the application won’t be notified about
the signal’s timeout again.
3.8.4 Dynamic Timeout Monitoring If it is required to assign different timeout values to a timer or to start and stop at timer at
run-time, a special API can be activated for each signal. The change of one signal of a
message influences all signal timers of a message. The dynamic timeout counters are
treated by the state machine in the same way as normal timeout events. The timeout
defined in the database is the initial timer, which is set on IlInitPowerOn.
Example You have to supervise a signal, which is received every 200 ms. If a first timeout after
500 ms is detected, another timeout is started. After the following timeout of 4 s, a fault
memory entry has to be logged.
/* check timeout flag */
if (IlGetRxGwDataTimeout())
{
/* clear timeout flag */
2013, Vector Informatik GmbH
Version: 2.10.03
47 / 115
based on template version 3.7




Technical Reference Vector Interaction Layer
IlClrRxGwDataTimeout();
/* read current timeout value */
if (
IlGetRxGwDataDynRxTimeout() == 500)
{
/* First Timeout Level */
IlSetRxGwDataDynRxTimeout(4000); /* assign new timeout value */
IlStartRxGwDataDynRxTimeout();/* start timer */
ToggleEcuState();
}else
{
/* Second Timeout Level */
IlStopRxGwDataDynRxTimeout();/* stop timer */
SetErrorMemoryEvent();
/* Reset the timeout start,
if the signal is received the next time */
IlSetRxGwDataDynRxTimeout(500); }
}
Caution
The timeout value access is implemented as macro. The parameter
IlSetRx<SignalName>DynRxTimeout and the return value of
IlGetRx<SignalName>DynRxTimeout is always IltRxTimeoutCounter which is defined to
vuint16. Due to this, the maximum timeout counter is 65535.
3.9 Signal status information (UpdateBits) The UpdateBit Support is used to indicate whether the application has updated the Signal
value
.[8] Only Signals and Signal Groups can have UpdateBits. A partial signal cannot
have an UpdateBit. Multiplexed Signals can have UpdateBits if the UpdateBit is
multiplexed with the same multiplexor value.
Info
For detailed information see AUTOSAR Specification of Module COM
[8] 3.9.1 Configuration An UpdateBit has no configurable attributes in GENy. There is
no special switch in GENy
to enable UpdateBit support.
Caution
UpdateBits cannot be used in combination with Multiplex API Raw.
UpdateBit Support needs the CanCopyToCan Driver API
.[1]
UpdateBit cannot be used in combination with dynamic DLC.
GroupSignals (partial signals) cannot have UpdateBits.
UpdateBit cannot be used if common buffer is used without identity manager.
2013, Vector Informatik GmbH
Version: 2.10.03
48 / 115
based on template version 3.7



Technical Reference Vector Interaction Layer
3.9.1.1 DBC File In the DBC file an UpdateBit has the size of one Bit and the postfix “_UB”. The UpdateBit
name is a combination between the UpdateBit Signal name and the postfix “_UB” e.g. the
Signal <SignalName> has the UpdateBit <SignalName>_UB.
UpdateBit dbc file attributes:
GenSigSendType
Fix: NoSigSendType
GenSigTimeoutTime_<ECU>
Message specific timeout time
Signal with UpdateBit attributes:
GenSigTimeoutTime_<ECU>
UpdateBit specific timeout time
3.9.2 UpdateBit Transmission If the application writes via a Put Macro a Signal with an UpdateBit, the UpdateBit will be
set to one. The UpdateBit is reset to zero after the message is transmitted once.
Info If a message has signals with UpdateBits the PreTransmitt function is used
by the Il_Vector.
RDS macros can’t be used in combination with UpdateBits.
It is possible to use the
AUTOSAR Signal Interface in combination with
UpdateBits.
3.9.3 UpdateBit Reception The Indication Flag/Function of a Signal with UpdateBit will only be set/called if the
UpdateBit of the Signal is set.
3.9.3.1 Timeout A Signal with an UpdateBit can have a Signal specific timeout. The Signal specific timeout
monitors the time between two UpdateBits equal 1. The value of the DBC Attribute
“GenSigTimeoutTime” on the Signal with the UpdateBit is the UpdateBit specific timeout
time.
The value of the DBC Attribute “GenSigTimeoutTime” is displayed as timeout time on each
RxSignal in the GENy GUI. If the timeout time is editable in the GENy GUI the value is
not derived from the DBC Attribute “GenSigTimeoutTime” and must be configured in the GUI.
Info The UpdateBit specific timeout can be used in combination with
Dynamic Timeout Monitoring. 2013, Vector Informatik GmbH
Version: 2.10.03
49 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
3.10 Multiple Channel Support 3.10.1 Overview
Sometimes two or more CAN Controllers are used on the same CAN bus. Therefore, the
CAN Driver and the Interaction Layer have to be adapted to multi channel support. This
could be done in two ways. First, the whole source code could be doubled. We will refer to
this as Crx (Code replicated) Interaction Layer. Second, a single source code could work
with doubled data buffers. We will refer to this as Idx (Indexed) Interaction Layer because
the access to the data buffers will be controlled by an index. The following two sections will
describe these two possibilities.
Note that only API services which relate to one specific channel, i.e. one physical medium
have to distinguish between different channels. Signal access services are not channel
related.
3.10.2 Idx (Indexed) Interaction Layer
An Idx Interaction Layer will work on two or more CAN busses without doubling of code. It
will work with multiple data buffers which can be accessed by an index. This results in a
kind of array. And even the access by the application will be similar to an array. Function
names won’t get a suffix as for the Crx Interaction Layer. The access to the different
buffers will be done by a parameter. We will refer to this parameter as index.
For example the function call IlTxTask() of a single channel Interaction Layer will result
in IlTxTask(
0 ) for channel number 0 and IlTxTask(
1 ) for channel number 1 of
an Idx Interaction Layer. However, the initialization of all the channels will be handled by
the single function IlInitPowerOn().
3.11 Advanced Communication Features 3.11.1 Physical Multiple and Multiple Configuration ECU
Please see in [2].
3.11.2 Multiplexed Signals
To save message IDs the Interaction Layer supports the use of several message layouts
for a single message. The signals combined in this several layouts are called multiplexed
signals. The current message layout will be indicated by a multiplexor signal (mode
signal).
3.11.2.1 Standard API
The Interaction Layer will provide data access and notification mechanisms for all
multiplexed signals. I.e. multiplexed signals will be encapsulated by the Interaction Layer.
However, here are some restrictions and some helpful information for the use of
multiplexed signals:
The several layouts are defined in the network database
The current layout will be chosen by the use of a multiplexor signal (mode signal)
With multiplexed signals only the Cyclic transmission modes can be used
2013, Vector Informatik GmbH
Version: 2.10.03
50 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
The actual cycle time of a multiplexed signal can be calculated by the following formula:
Message Cycle Time * Number of Message Layouts = Multiplexed Signal Cycle Time
A delay time has to be specified for messages with multiplexed signals by means of the
attribute GenMsgDelayTime.
Data changed flags are not supported for multiplexed signals
Note that multiplexed signals are provided by the Interaction Layer in version 3.27 and
higher.
3.11.2.2 Raw API
The Interaction Layer provides a raw interface for multiplex signals. The advantage is
runtime improvement, reduction of Ram and Rom requirements.
Example The following code example demonstrates the implementation of a reception of a
multiplexed signal.
Configure a PreCopy function for the multiplex message in the CAN Driver.
Configure RDS access to the signals multiplexor signal and multiplexed signals, of
the message MultiplexMessage. MultiplexedSignal is for example valid, if the
MultiplexorSignal is 0x10
vuint16 MyMultiplexedSignal;
/* Implementation of the reserved indication function */
void ApplRawApiMultiplexMessagePrecopy(CanReceiveHandle
rxObject)
{
/* Get the multiplexor value */
vuint8 MyMultiplexorSignal;
MyMultiplexorSignal = IlGetRxCANMultiplexorSignal();
/* Check for the correct multiplexor */
if ( MyMultiplexorSignal == 0x10 )
{
/* Get the multiplexed signal */
MyMultiplexedSignal = IlGetRxCANMultiplexedSignal();
}
if ( MyMultiplexorSignal == 0xA3 )
{
/*
Implement the reception of other Multiplexed Signals
for the Multiplexorvalue 0xA3 here
*/
}
…………
/* The returnvalue kCanNoCopyData is mandatory */
return kCanNoCopyData;
}
2013, Vector Informatik GmbH
Version: 2.10.03
51 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
Example The following code example shows the implementation of a transmission of a
multiplexed signal.
Configure a Pretransmit function for the multiplex message in the Can Driver.
Configure Rds access to write the Multiplexor signal and multiplexed signals, of the
message multiplex message. MultiplexedSignal for example is valid, if the
MultiplexorSignal is 0x10
vuint16 MyMultiplexedSignal;
vuint16 MyMultiplexorValue;
void
ApplRawApiMultiplexMessagePretransmit(CanTransmitHandle
txObject)
{
/* Implementation of the Multiplexor toggle mechanism */
if ( MyMultiplexorValue == 0x43 )
{
IlPutTxCANMultiplexorSignal(0x10);
IlPutTxCANMultiplexedSignal(MyMultiplexedSignal);
/*
Implement here the transmission of other signals for the
multiplexor 0x10
*/
MyMultiplexorValue = 0x10;
}
else if ( MyMultiplexorValue == 0x10 )
{
IlPutTxCANMultiplexorSignal(0x43);
/*
Implement here the transmission of other signals for the
multiplexor 0x43
*/
MyMultiplexorValue = 0x43;
}
…………
/* The returnvalue kCanNoCopyData is mandatory */
return kCanNoCopyData;
}
2013, Vector Informatik GmbH
Version: 2.10.03
52 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
3.11.3 Manipulation of the Notification Frequency
The periodic tasks for transmission and reception (See 3.4 Main Functions) are
responsible for all the cyclic tasks the Interaction Layer has to do. Both need runtime and
for this reason the application developer wants to set the cycle time to invoke the tasks as
high as possible. A high cycle time has the major drawback that the notification about
urgent events will slow down, too. This is because the events will be checked within these
tasks. I.e. they are checked in the same cycle time.
To solve this problem the Interaction Layer provides a function called
IL<Tx/Rx>StateTask. This function is responsible for the notification of the application.
It will check, if there was any event the application wants to be notified about and notifies
the application. The function will be invoked by the IL<Tx/Rx>Task in the defined cycle
time. Further this function can be invoked by the application any time it is necessary. So
the developer can shorten the time between checking for new events and for notification.
To reduce the time between an event and the notification even more, the application can
be notified in interrupt context. This feature can be configured by the Configuration Tool for
each message and will have effect on each signal the message contains. Checking for
events in interrupt context means checking for events each time a message was
transmitted or received, respectively. This is the fastest way to be notified by the
Interaction Layer.
It’s recommended to think about the consequences of using the StateTask or the
notification in interrupt context, respectively. Both ways to speed up the notification has
pros and cons.
2013, Vector Informatik GmbH
Version: 2.10.03
53 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
4 Integration This chapter gives necessary information for the integration of the Interaction Layer into an
application environment of an ECU.
4.1 Include structure To use the Vector Interaction Layer, only the file il_inc.h must be included in all application
components that want to use Interaction Layer functionality. The file can_inc.h (which
provides the CAN Driver interface and data buffers) must not be included separately, it is
automatically included by il_inc.h.
Figure 4-1 Including Interaction Layer
4.2 Scope of Delivery The delivery of the Interaction Layer contains the files which are described in the chapters
4.2.1 and
4.2.2: 4.2.1 Static Files File Name Description il_inc.h
This is the header file to be included by other components to use the Interaction
Layer.
il_def.h
This is the header file of the Interaction Layer.
il.c
This is the source file of the Interaction Layer.
Table 4-1
Static files
4.2.2 Dynamic Files The dynamic files are generated by the configuration tool GENy.
File Name Description il_cfg.h
This is the generated header file containing pre-compile switches.
2013, Vector Informatik GmbH
Version: 2.10.03
54 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
File Name Description il_par.h
This is the generated header file providing symbolic defines, macros and
prototypes.
il_par.c
This is the generated source file containing generated parameters and functions.
Table 4-2
Generated files
4.3 Operating Systems Requirements The CAN communication components are designed and programmed to work with or
without operating systems. Since the components have to work without an operating
system, resource locking mechanisms are not handled. To lock critical resources,
interrupts will be disabled and restored. The CAN driver (Data Link Layer) provides
functions to fulfil this task.
Each component has one or two functions (tasks) which have to be called periodically. For
operating systems it is advisable to create one task and call all the Interaction Layer
component functions subsequently. To implement different periods of time, the OS task
could have a counter to implement this.
Data consistency issues: Cyclic IL tasks are not allowed to interrupt signal accesses. This has the following
consequences:
> No cyclic IL task shall be called on Interrupt level e.g. directly in a timer ISR.
> In a priority driven multitasking operating system with preemptive scheduling such as
OSEK-OS cyclic IL tasks should have a lower priority than the tasks performing signal
accesses.
To ensure data consistency on pre-emptive multi-tasking operating systems or when using
IL signal access services on interrupt level, there are two things to keep in mind.
> The Interaction Layer provides mechanisms to keep data consistency on multi-byte
signals. That means, reading multi-byte data is always done while interrupts are locked.
In that case, no task switch can occur. The disadvantage to that mechanism is a longer
interrupt latency time. If your system is critical to long latency times, ensure that your
system works properly in all cases.
> Bit field manipulation is done by macros. Some compilers and processors realize bit
field manipulation by read-modify-write accesses. If data access to bit fields in the same
byte is used in pre-emptive tasks or on interrupt level, a problem could be caused. Try
to avoid this or make resource locking to such accesses.
These issues can be circumvented by using the Interaction Layer API only in non-
preemptive tasks.
2013, Vector Informatik GmbH
Version: 2.10.03
55 / 115
based on template version 3.7




Technical Reference Vector Interaction Layer
5 Configuration In the Interaction Layer the attributes can be configured with the following methods:
> Configuration in GENy for a detailed description see 5.2 Configuration with GENy
> Configuration in Database, for a detailed description see chapte
r 5.1 Configuration in
Data Base
5.1 Configuration in Data Base The following attributes can be used to configure the Interaction Layer in the DBC file.
Info Bold Value Types should be Used as default. Value Types marked with * are available
for CANgen compatibility reasons.
Caution
Don’t mix up the order of enumeration values. Not the value of the attribute is
interpreted, the position of the selected value.
Caution
The “Type of Object” can be configured in the dbc file for some attributes as “Signal” or
“Node – Mapped Rx Signal”. Use only one “Type of Object” in a single dbc file. If the
“Type of Object” is “Signal”, the attribute must be defined in the dbc file for each Ecu.
Due to this, replace <ECU> in the attribute name by the Node name.
Name ILUsed Description This attribute must be defined, to use the Vector Interaction Layer with this
node.
0 : The node is cannot be used with the Interaction Layer
1 : The node is can be used with the Interaction Layer
Type Of Object Node
Value Type Enumeration
Default No
Values No, Yes
2013, Vector Informatik GmbH
Version: 2.10.03
56 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
Name GenMsgILSupport Description Configurate the usage of the Interaction Layer for this message
0 : The message is not used by the Interaction Layer
1 : The message is used by the Interaction Layer
Type Of Object Message
Value Type Enumeration
Default Yes
Values No, Yes
5.1.1 Send Type Info The strings used for the GenMsgSendType is often OEM-specific and can differ from
here.
Name GenMsgSendType Description Message related transmission mode.
Use only Cyclic for messages with multiplexed signals.
Type Of Object Message
Value Type Enumeration
Default NoMsgSendType (Use only signal related transmission modes.)
Values Cyclic, NotUsed, NotUsed, NotUsed, NotUsed, NotUsed, NotUsed, IfActive,
NoMsgSendType
Name GenSigSendType Description Signal related transmission mode.
Use only NoSigSendType for messages with multiplexed signals.
Type Of Object Signal
Value Type Enumeration
Default NoSigSendType
Values Cyclic, OnWrite, OnWriteWithRepetition, OnChange,
OnChangeWithRepetition, IfActive, IfActiveWithRepetition, NoSigSendType,
OnChangeAndIfActive, OnChangeAndIfActiveWithRepetition
2013, Vector Informatik GmbH
Version: 2.10.03
57 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
5.1.2 Send Type Dependent Name GenMsgCycleTime Description Time in ms between each cyclic transmission of a message.
Type Of Object Message
Value Type Integer
Default 0
Minimum 0
Maximum 65535
Name GenMsgCycleTimeFast Description Value of the second cycle time, if the GenMsgSendType/GenMsgSendType
IfActive or GenMsgFastOnStart is configured.
Type Of Object Message
Value Type Integer
Default 0
Minimum 0
Maximum 65535
Name GenMsgNrOfRepetition Description Number of repetitions used if the GenSigSendType is
OnChangeWithRepetition, OnWriteWithRepetition, IfActiveWithRepetition or
OnChangeAndIfActiveWithRepetition is defined.
The number of repetitions can be configured separately for each message. To
reduce Rom and Ram requirements configure the same number for each
message.
This value defines how often a message is sent before its transmission is
stopped. See e.g. Figure 3-7 Timing Diagram of OnEvent with Repetition -
OnWrite.
Type Of Object Message
Value Type Integer
Default 0
Minimum 0
Maximum 65535
Caution
Please note, the attribute GenSigStartValue sets the Default value at initialization time,
not if IlRxStart or IlTxStart is called. Due to historical and compatibility reasons, this
confusing definition cannot be changed any more.
2013, Vector Informatik GmbH
Version: 2.10.03
58 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Name GenSigStartValue Description This Value is the default value for the signal, if IlInitPowerOn is called.
The string value type can represent hexadecimal and integer values.
Type Of Object Signal
Value Type String, Integer*, Float*
Default 0x0
Minimum 0x0
Maximum 0xffffffffffffffff
Name GenSigInactiveValue Description Value for which Transmit Fast If Active will be set inactive. It is not
recommended to use Hex values, due to the range restriction.
The string value type can represent hexadecimal and integer values. The
usage of the hex value is not recommended, because it cannot represent
values greater than 0x7fffffff.
Type Of Object Signal
Value Type String, Hex*
Default 0x0
Minimum 0x0
Maximum 0xffffffffffffffff Hex : 0x7fffffff
Name GenSigTimeoutValue Description This Value is the timeout default value for the signal, if a timeout occurs.
The integer value allows the definition of timeout values for signals with a
maximum Length of 4 Bytes.
Type Of Object Signal
Value Type Integer
Default 0x0
Minimum 0x0
Maximum 4294967296
2013, Vector Informatik GmbH
Version: 2.10.03
59 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
5.1.3 Advanced Attributes Name GenMsgDelayTime Description This is the minimum time in ms between the transmissions of messages with
the same identifier.
Type Of Object Message
Value Type Integer
Default 0
Minimum 0
Maximum 65535
Name GenMsgStartDelayTime Description This is the time in ms after IlTxStart has been called, when the cyclic
transmission event starts.
If a transmission is triggered by OnEvent, OnEventWithRepetition, IfActive,
IfActiveWithRepetition within the MsgStartDelayTime, the transmission is not
performed within the GenMsgStartDelayTime.
Type Of Object Message
Value Type Integer
Default 0
Minimum 0
Maximum 65535
Name GenMsgFastOnStart Description This is the time in ms after IlTxStart has been called, where the message is
transmitted cyclic with GenMsgCycleTimeFast.
The value has to be an integer multiple of GenMsgCycleTimeFast.
Type Of Object Message
Value Type Integer
Default 0
Minimum 0
Maximum 65535
2013, Vector Informatik GmbH
Version: 2.10.03
60 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
5.1.4 Timeout Supervision Attributes Name ILTxTimeout Description Value of the timeout time in ms for Tx used for all messages within the
channel. To use the timeout monitoring it must be activated for each signal in
the Configuration Tool.
Type Of Object Network
Value Type Integer
Default 0
Minimum 0
Maximum 65535
Name GenSigTimeoutMsg_<ECU> Description Message ID to enable the timeout monitoring for signals which are not
transmitted periodically by the receiver <ECU>. If this attribute is set to default
the message will chosen, which contains the current signal.
If you must reference extended IDs, use the following representation format,
where the CAN identifier is combined with 0x80000000 by a logical or.
Example: ID 0x208 is used for the standard ID and ID 0x80000208 for the
extended ID.
Type Of Object Signal
Value Type Hex
Default 0
Minimum 0x80000000
Maximum 0xfffffff
Name GenSigTimeoutMsg Description Message ID to enable the timeout monitoring for signals which are not
transmitted periodically by the receiver Ecu. If this attribute is set to default the
message will chosen, which contains the current signal.
If you must reference extended IDs, use the following representation format,
where the CAN identifier is combined with 0x80000000 by a logical or.
Example: ID 0x208 is used for the standard ID and ID 0x80000208 for the
extended ID.
Type Of Object Node – Mapped Rx Signal
Value Type Hex
Default 0
Minimum 0x80000000
Maximum 0xfffffff
2013, Vector Informatik GmbH
Version: 2.10.03
61 / 115
based on template version 3.7



Technical Reference Vector Interaction Layer
Please note
The database attribute GenSigTimeoutMsg has the following limitations:
Relations to messages containing multiplexed signals are not supported.
Relations from messages containing multiplexed signals are not supported.
Name GenSigTimeoutTime_<ECU> Description Timeout time in ms used for this signal received by <ECU>.
If different GenSigTimeoutTime_<ECU> values are configured for a message,
the lowest timeout time (strongest definition) is used for timeout monitoring.
The value of the attribute is displayed as Timeout Time on each RxSignal in
the GENy GUI.
Type Of Object Signal
Value Type Integer
Default 0
Minimum 0
Maximum 65535
Please note
If the timeout time on a RxSignal is editable, the value is not derived from the
database attribute GenSigTimeoutTime_<ECU>.
Name GenSigTimeoutTime Description Timeout time in ms used for this signal received by Ecu.
If different GenSigTimeoutTime values are configured for a message, the
lowest timeout time (strongest definition) is used for timeout monitoring.
Type Of Object Node – Mapped Rx Signal
Value Type Integer
Default 0
Minimum 0
Maximum 65535
2013, Vector Informatik GmbH
Version: 2.10.03
62 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Name GenSigSuprvResp Description This value preconfigurates the timeout flag and timeout default value.
0 : Preconfigurate nothing
1 : A timeout flag is configured for the signal
2 : A timeout default value is configured for the signal
3 : A timeout flag and timeout default value is configured for the signal
Type Of Object Node – Mapped Rx Signal
Value Type Enumeration
Default None
Values None, TimeoutFlag, TimeoutDefaultValue, TimeoutFlag and
TimeoutDefaultValue
Name GenSigSuprvRespSubValue Description This Value is the timeout default value for the signal, if a timeout occurs.
The integer value allows the definition of timeout values for signals with a
maximum Length of 4 Bytes.
Type Of Object Node – Mapped Rx Signal
Value Type Integer
Default 0x0
Minimum 0x0
Maximum 4294967296
5.1.5 Former Attributes The following attributes are not supported any more.
Name GenMsgNoIalSupport Replaced by GenMsgILSupport
Description GenMsgILSupport is the inverted view of the attribute GenMsgNoIalSupport.
5.1.6 Example A signal A and a signal B are included in the message XY. Signal A should be transmitted
periodically by the cycle time of 50ms. Signal B should be transmitted each time an event
occurs.
For signal A we chose the Periodic Transmission Mode (Transmission Modes see chapter
3.7.2). For the event driven transmission of signal B, the Direct Transmission Mode will fit
best.
Next step is to choose the attributes for this constellation. To chose the Periodic
Transmission Mode for signal A we need to set the GenSigSendType to Cyclic and the
GenMsgCycleTime to 200 [ms]. To choose the Direct Transmission Mode for signal B we
need to set the GenSigSendType to OnWrite. This will result to the attributes listed in the
table below.
2013, Vector Informatik GmbH
Version: 2.10.03
63 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Node Attribute Value Comment ILUsed Yes
Yes, use the Interaction Layer within
this network node.
Attribute for Message XY Value Comment GenMsgDelayTime Yes
not necessary for this example
GenMsgCycleTime 50 [ms]
Value of the cycle time of the
message. There can’t be signals with
different cycle times combined in one
message. Therefore this is the cycle
time of signal A.
GenMsgCycleTimeFast not necessary for this example
GenMsgStartDelayTime not necessary for this example
GenMsgILSupport Yes
Enable the usage of the Interaction
Layer for this message (for messages
used by diagnosis, network
management ...).
GenMsgNrOfRepetition not necessary for this example
GenMsgSendType NoMsgSendType
We use only signal related
transmission modes within this
example. Therefore, see
GenSigSendType.
Attribute for Signal A Value Comment GenSigSendType Cyclic
Use the Periodic Transmission Mode
for signal A.
GenSigInactiveValue not necessary for this example
GenSigTimeoutMsg_<ECU> not necessary for this example
GenSigTimeoutTime_<ECU> not necessary for this example
Attribute for Signal B Value Comment GenSigSendType OnWrite
Use the Direct Transmission Mode for
signal B.
GenSigInactiveValue not necessary for this example
GenSigTimeoutMsg_<ECU> not necessary for this example
GenSigTimeoutTime_<ECU> not necessary for this example
The result of combining signal A and signal B with different Transmission Modes to one
message XY will be shown in the timing diagram below. The dashed lines are used in
consideration of signal A. The solid lines are used in consideration of signal B.
2013, Vector Informatik GmbH
Version: 2.10.03
64 / 115
based on template version 3.7



Technical Reference Vector Interaction Layer
Message XY
Application
IL
IL
I
I
I
L
L
L
IL
IL
IL
P
P
P
P
P
P
P
P
u
u
u
u
u
u
u
u
tA
tB
t
t
t
A
A
A
tB
tB
tB
Interaction Layer
M
e
s
s
a
g
e
X
Y
Data Link Layer
GenMsgCycleTime
50ms
signal A
50ms
50ms
50ms
Figure 5-1
A Signal with the Periodic Transmission Mode and one with the Direct Transmission Mode Combined to a message.
5.2 Configuration with GENy Info The detailed information for all checkboxes and settings is given in the so-called
OnScreen Help view of GENy just by clicking the checkbox or the name of the switch.
This is activated via
View | OnScreen Help.
Information about how to work with GENy can be found in the OnlineHelp of GENy
opened via
Help | Help topics.
Figure 5-2
OnScreen Help View for fast information
In the Configuration Tool GENy all settings for the Vector Interaction Layer are done via
the marked tree items.
2013, Vector Informatik GmbH
Version: 2.10.03
65 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
Figure 5-3
Overview of Vector Interaction Layer Configuration in GENy
2013, Vector Informatik GmbH
Version: 2.10.03
66 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
IL Vector Configure the basic settings for the Vector Interaction Layer. Use the OnScreen Help View
of GENy to get more information about each option.
Support for AUTOSAR The Vector Interaction Layer can be configured to support a signal API according to the
AUTOSAR Specification of Module COM [8]. This has effects on the signal API, see
more there…
Channels Define the task call cycle times.
Tx/Rx Messages Most of those entries are fixed and already set in the DBC file and explained for
information only.
Tx/Rx Signals This is where to configure the settings for the signals, its access macros, the way of
notification, etc.
Attribute Name Value Default Description Type Value ModuleInstance > Il_Vector
User Config File
String
N.a.
The Interaction Layer configuration file (il_cfg.h) is
generated by GENy. If you want to overwrite settings in the
generated Il_Vector configuration file (il_cfg.h), you can
specify a path to a user defined configuration file.
The user defined configuration file will be included at the
end of the generated file il_cfg.h. Therefore definitions in
the user defined configuration file can overwrite definitions
in the generated configuration file.
Start/Stop API
Boolean
false
The two API functions 'IlStartCycle' and 'IlStopCycle' are
enabled which enable or disable the transmission of one
single cyclic message. This option is necessary for
software tests or special use cases. It is recommended not
to use this option.
Timeout Monitoring on Boolean false
If this option is enabled timeout monitoring of a message is
first Reception
started when this message is received for the first time.
Normally timeout monitoring starts after the Rx part of the
Interaction Layer is started or resumed.
ModuleInstance > Il_Vector > Notification Classes > State Machine Transition
Init
Boolean
false
This callback function is called after the Interaction Layer
has been initialized. The callback function itself
(ApplIlInit()) must be provided by the application.
Rx Start
Boolean
false
This callback function is called if the Rx branch of the
Interaction layer is started. The callback function
(ApplIlRxStart()) itself must be provided by the application.
Tx Start
Boolean
false
This callback function is called if the Tx branch of the
Interaction layer is started. The callback function itself
2013, Vector Informatik GmbH
Version: 2.10.03
67 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value (ApplIlTxStart()) must be provided by the application.
Rx Stop
Boolean
false
This callback function is called if the Rx branch of the
Interaction layer is stopped. The callback function itself
(ApplIlRxStop()) must be provided by the application.
Tx Stop
Boolean
false
This callback function is called if the Tx branch of the
Interaction layer is stopped. The callback function itself
(ApplIlTxStop()) must be provided by the application.
ModuleInstance > Il_Vector > Debug Support
Argument Check
Boolean
false
Used to enable extended checks of the arguments passed
to functions of the Interaction Layer. If an error was
detected, the return value of the functions will contain an
error code. This option should be used for debugging
purposes only and not in production code.
Assertion Handling
Boolean
false
The SW component provides built-in debug support
(assertion) to ease up the integration and test into the
user's project.
Please see the technical reference for detailed information
on the available options and how to use them.
In general, the usage of assertions is recommended during
the integration and pre-test phases. It is not recommended
to enable the assertions in production code due to
increased runtime and ROM needs.
The assertion checks the correctness of the assigned
condition and calls an error handler in case this fails. The
error handler is called with an error number. Information
about the defined error numbers is given in the technical
reference.
ModuleInstance > Il_Vector
AUTOSAR Signal API Boolean
false
Configure the Vector Interaction Layer to support the signal
access as defined in the AUTOSAR Specification of
Module COM Version 1.0.0.
Efficient macros are additionally generated if Put/Get
signal access is configured.
A signal is written using:
Com_ReturnType Com_SendSignal(<SigName>,
&<data>);
A signal is read using
Com_ReturnType Com_ReceiveSignal(<SigName>,
&<data>);
Please see the documentation chapter 'AUTOSAR Signal
Interface'.
AUTOSAR
Enum
N.a.
Select the AUTOSAR COM interface that shall be provided
Specification Version
by the Il_Vector.
Detect Active
Boolean false
If this option is enabled an API is activated, to detect, if
Repetitions API
messages are transmitted with repetitions and the
repetitions are active.
API:
1 Channel :Il_Boolean IlTxRepetitionsAreActive()
2013, Vector Informatik GmbH
Version: 2.10.03
68 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value 2..N Channels :Il_Boolean
IlTxRepetitionsAreActive(<channel>)
Detect Active Signals Boolean false
If this option is enabled an API is activated, to detect, if
API
signals are active and transmitted with the fast cycle time.
API:
1 Channel :Il_Boolean IlTxSignalsAreActive()
2..N Channels :Il_Boolean
IlTxSignalsAreActive(<channel>)
Reset Rx Timeout
Boolean false
If this option is enabled and the transition IlRxRelease is
Flags On IlRxRelease
performed all rx timeout flags on the channel are cleared.
Boolean
Enable
false
This option enables UpdateBit Support
UpdateBit Support
Channel > Il_Vector > Task Call Cycle Time
IlRxTask [ms]
Integer
10
This is the time base of the receive branch of the
Interaction Layer.
Make sure that the value you enter here in the Generation
Tool is the same as the cycle time for calling the function
'IlRxTask'. If it is not, the timing of the receive branch in the
IL will not work properly (e.g. for timeout monitoring). All
timings of the Rx branch (e.g. timeouts) must be a multiple
of this cycle time.
If you enter e.g. 10 [ms] in the Generation Tool the function
'IlRxTask' must be called every 10ms.
IlTxTask [ms]
Integer
10
This is the time base of the transmit branch of the
Interaction Layer.
Make sure that the value you enter here in the Generation
Tool is the same as the cycle time for calling the function
'IlTxTask'. If it is not, the timing of the transmit branch in
the IL will not work properly (e.g. wrong timing of cylic send
messages). All timings of the Tx branch (e.g. cycle times of
transmit messages) must be a multiple of this cycle time.
If you enter e.g. 10 [ms] in the Generation Tool the function
'IlTxTask' must be called every 10ms.
Message > Il_Vector > Database Attributes
CycleTime [ms]
Integer
0
The CANdb attribute 'GenMsgCycleTime' is displayed as
defined in the dbc file. This value is only relevant for
messages with a cyclic transmission mode. For other
messages '0' is displayed.
CycleTimeFast [ms]
Integer
0
The CANdb attribute 'GenMsgCycleTimeFast' is displayed
as defined in the dbc file. This value is only relevant for
messages with a transmission mode including a fast cyclic
rate. For other messages '0' is displayed.
DelayTime [ms]
Integer
0
The CANdb attribute 'GenMsgDelayTime' is displayed as
defined in the dbc file. This attribute defines the minimum
transmit delay between two subsequent messages of the
same ID.
FastOnStart [ms]
Integer
0
The CANdb attribute 'GenMsgFastOnStart' is displayed as
defined in the dbc file. 'GenMsgFastOnStart' is the duration
2013, Vector Informatik GmbH
Version: 2.10.03
69 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value in ms of a startup phase in which the message is
transmitted with a higher rate (GenMsgCycleTimeFast).
NrOfRepetition
Integer
0
The CANdb attribute 'GenMsgNrOfRepetition' is displayed
as defined in the dbc file. This attribute defines the number
of repetitions of a message caused by signal updates of
signals which have transmission modes with repetition.
TxMessage > Il_Vector
Polling
Boolean
true
The Interaction Layer confirmation of the sent message is
handled in the CAN driver confirmation context. This
context depends on the CAN driver Tx polling
configuration. For details please see the CAN driver
documentation.
CAN driver Tx polling is activated
===========================
If IL polling is activated, the message confirmation is
handled via the CAN driver confirmation flag that is polled
in the 'IlTxTask'. The Interaction Layer notification is
separated from the initial event.
If IL polling is deactivated, the message confirmation is
handled via the CAN driver confirmation function that is
called directly by the CAN driver in its own polling context.
CAN driver Tx polling is deactivated
=============================
If IL polling is activated, the message confirmation is
handled via the CAN driver confirmation flag that is polled
in the 'IlTxTask'. This is to minimize the interrupt load.
If IL polling is deactivated, the message confirmation is
handled via the CAN driver confirmation function that is
called directly by the CAN driver in the interrupt context.
Disabling the polling results in longer ISR run times.
PLEASE NOTE:
The implemented application code in this context must be
programmed interrupt context secure.
It's recommended to use the default.
Send on Init
Boolean
false
If you enable the attribute 'Send on Init' the selected Tx
message is added to the set of messages which will be
transmitted when 'IlSendOnInitMsg()' is called.
If the DBC attribute "NetworkInitialization” is available at a
message, the value of “Send on Init” is derived of this dbc
attribute.
TxMessage > Il_Vector > Database Attributes
StartDelayTime [ms]
Integer
0
The CANdb attribute 'GenMsgStartDelayTime' is displayed
as defined in the dbc file. This attribute defines the time
between 'IlTxStart()' and the begin of the cyclic
transmission of a message.
RxMessage > Il_Vector
2013, Vector Informatik GmbH
Version: 2.10.03
70 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value Polling
Boolean
false
The Interaction Layer indication of the receive message is
handled in the CAN driver indication context. This context
depends on the CAN driver Rx polling configuration. For
details please see the CAN driver documentation.
CAN driver Rx polling is activated
===========================
If IL polling is activated, the message indication is handled
via the CAN driver indication flag that is polled in the
'IlRxTask'. The Interaction Layer notification is separated
from the initial event.
If IL polling is deactivated, the message indication is
handled via the CAN driver indication function that is called
directly by the CAN driver in its own polling context.
CAN driver Rx polling is deactivated
=============================
If IL polling is activated, the message indication is handled
via the CAN driver indication flag that is polled in the
'IlRxTask'. This is to minimize the interrupt load.
If IL polling is deactivated, the message indication is
handled via the CAN driver indication function that is called
directly by the CAN driver in the interrupt context.
PLEASE NOTE:
The implemented application code in this context must be
programmed interrupt context secure.
It's recommended to use the default.
RxMessage > Il_Vector > Notification Classes
Timeout Function
String
If a valid function name is defined in the IL 'Timeout
Function' field, this function is called by the Interaction
Layer when a timeout of this receive message occurs. The
timeout time for this message is defined in the data base
file (dbc).
API: void Appl<MsgName>MsgTimeout(void)
MsgSignal > Il_Vector > Database Attributes
InactiveValue
String
0
The CANdb attribute 'GenSigInactiveValue' is displayed as
defined in the dbc file. This attribute is relevant for signals
with the transmission mode 'IfActive'.
RxSignal > Il_Vector > Signal Access
Put
Boolean
false
The generation of signal value write access macros and -
functions for receive signals can be enabled or disabled. If
enabled, the Generation Tool will generate macros and
functions for signal access using the signal names in the
network data base (macros or functions, depending on the
type of the signal).
API:
Length <=1Byte void IlPutRx<SigName>(vuint8 data)
1Byte< Length <=2Byte void IlPutRx<SigName>(vuint16
2013, Vector Informatik GmbH
Version: 2.10.03
71 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value data)
2Byte< Length <=4Byte void IlPutRx<SigName>(vuint32
data)
4Byte< Length void IlPutRx<SigName>(vuint8*
pData)
If the AUTOSAR signal API is enabled, set the signal value
via
Com_ReturnType Com_SendSignal(<SigName>,
&<data>);
Please see the documentation of Il_Vector, chapter
'AUTOSAR Signal Interface'.
Get
Boolean
true
The generation of signal value read access macros and -
functions for receive signals can be enabled or disabled. If
enabled, the Generation Tool will generate macros and
functions for signal access using the signal names in the
network data base (macros or functions, depending on the
type of the signal).
API:
Length <=1Byte vuint8 IlGetRx<SigName>(void)
1Byte< Length <=2Byte vuint16
IlGetRx<SigName>(void)
2Byte< Length <=4Byte vuint32
IlGetRx<SigName>(void)
4Byte< Length void IlGetRx<SigName>(vuint8*
pData)
If the AUTOSAR signal API is enabled, read the signal
value via
Com_ReturnType Com_ReceiveSignal(<SigName>,
&<data>)
Please see the documentation of Il_Vector, chapter
'AUTOSAR Signal Interface'.
RDS
Boolean
false
Enable macros to read from the Rx register of the CAN
controller. This switch will be used for example by the
'DataChanged' flag.
CAUTION:
Use these macros in a PreCopy function only!
API:
Length <=1Byte vuint8 IlGetRxCAN<SigName>(void)
1Byte< Length <=2Byte vuint16
IlGetRxCAN<SigName>(void)
2Byte< Length <=4Byte vuint32
IlGetRxCAN<SigName>(void)
4Byte< Length void IlGetRxCAN<SigName>(vuint8*
pData)
RxSignal > Il_Vector > Notification Classes > Indication
Flag
Pool
N.a.
If this signal is received, one or more flags with the same
names plus pre- and postfix from the name decorator
configuration view will be set.
2013, Vector Informatik GmbH
Version: 2.10.03
72 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value CAUTION:
The flag(s) must be reset by the application. It is
recommended to use the macros for flag manipulation.
API:
vuint8 IlGetRx<SigName>SigIndication(void)
void IlSetRx<SigName>SigIndication(void)
void IlClrRx<SigName>SigIndication(void)
vuint8 IlGetClrRx<SigName>SigIndication(void)
Function
Pool
N.a.
If this signal is received, one or more functions with these
names plus pre- and postfix from the name decorator
configuration view will be called.
CAUTION:
- The function(s) may run in interrupt context (if polling is
not activated), so keep action short within.
- If you use more than one indication function they are
called in the order they are displayed in GENy.
API: void ApplIl<SigName>SigIndication(void)
RxSignal > Il_Vector > Notification Classes > Firstvalue
Flag
Pool
N.a.
If this signal is received for the first time after the system
startup the 'FirstValue' flag will be set. This flag can not
and should not be reset. The only reset is a restart of the
Interaction Layer.
API:
vuint8 IlGetRx<SigName>SigFirstvalue(void)
void IlSetRx<SigName>SigFirstvalue(void)
void IlClrRx<SigName>SigFirstvalue(void)
RxSignal > Il_Vector > Notification Classes > DataChanged
Flag
Pool
N.a.
If this signal is received and the new signal value differs
from the current signal value, the 'DataChanged' flag(s)
are set. The name of the flags are built-up using this name
plus pre- and postfixes from the name decorator
configuration view.
CAUTION:
The flag(s) must be reset by the application. It is
recommended to use the macros for flag manipulation.
API:
vuint8 IlGetRx<SigName>SigDataChanged(void)
void IlSetRx<SigName>SigDataChanged(void)
void IlClrRx<SigName>SigDataChanged(void)
RxSignal > Il_Vector > Notification Classes > Timeout
Flag
Pool
N.a.
The interaction layer is able to supervise receive signals. If
the message containing the signal is not received within a
(in data base file dbc) predefined time one ore more
timeout flags are set. The name of the flags are built-up
using this name plus pre- and postfixes from the name
decorator configuration view.
2013, Vector Informatik GmbH
Version: 2.10.03
73 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value CAUTION:
The flag(s) must be reset by the application. It is
recommended to use the macros for flag manipulation.
API:
vuint8 IlGetRx<SigName>SigTimeout(void)
void IlSetRx<SigName>SigTimeout(void)
void IlClrRx<SigName>SigTimeout(void)
Function
Pool
N.a.
The interaction layer is able to supervise receive signals. If
the message containing the signal is not received within a
(in data base file dbc) predefined time one ore more
timeout functions are called. The name of the functions are
built-up using these names plus pre- and postfixes from
the name decorator configuration view.
CAUTION:
- The function(s) may run in interrupt context (if polling is
not activated), so keep action short within.
- If you use more than one indication function they are
called in the order they are displayed in GENy.
API: void ApplIl<SigName>SigTimeout(void)
RxSignal > Il_Vector > Notification Classes > State Machine Transition
Init
String
If you enter a function name you determine for this receive
signal that an init function shall be called after the
Interaction Layer was initialized. The default is the name of
the signal, but you can change this name. The final name
of the function will be determined out of the defined pre-
and postfixes on the name decorator configuration view
and the specified name.
API: void ApplIl<SigName>RxInit(void)
Start
String
If you enter a function name you determine for this receive
signal that this start function shall be called after the
Interaction Layer was switched to the running state. The
default is the name of the signal, but you can change this
name. The final name of the function will be determined
out of the defined pre- and postfixes on the name
decorator configuration view and the specified name.
API: void ApplIl<SigName>RxStart(void)
Stop
String
If you enter a function name you determine for this receive
signal that this stop function shall be called after the
Interaction Layer was suspended. The default is the name
of the signal, but you can change this name. The final
name of the function will be determined out of the defined
pre- and postfixes on the name decorator configuration
view and the specified name.
API: void ApplIl<SigName>RxStop(void)
RxSignal > Il_Vector > Default Value
Init
Boolean
false
Use the default values below at initialization time to
initialize the signal buffer. If you enable this feature, the
fields
2013, Vector Informatik GmbH
Version: 2.10.03
74 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value - Start default
- Stop default
- Default value
will be activated and can be configured, too.
Start
Boolean
false
Use the default value to initialize the signal buffer within
the callcontext of 'IlRxStart()'. To use this option the default
of 'Init' must be used, too.
Stop
Boolean
false
Use the default value, which is set in the callcontext
'IlRxStop()' to initialize the signal buffer. To use this option
the default at 'IlInit()' must be used, too.
Value
String
0
Use the default value within 'IlInit()', 'IlRxStart()' and
'IlRxStop()' to initialize the signal buffer. The data type of
the default value depends on the data type of the related
signal.
RxSignal > Il_Vector > Default Value > Timeout
Enable
Boolean
false
Use the default value to replace the signal value in case of
a timeout.
Value
String
0x0
Default value to replace the signal value in case of timeout.
The data type of the default value depends on the data
type of the related signal. The attribute in the data base file
must be set to be able to set the wanted default value.
RxSignal > Il_Vector > API
Dynamic Timeout
Boolean
false
The timeout of the receive signals can be set dynamically.
If enabled an additional API to access the timer is
provided. This functionality is required for special use
cases and should normally be disabled.
API:
* IlGetRx<SigName>DynRxTimeout (void)
void IlSetRx<SigName>DynRxTimeout(*)
void IlStartRx<SigName>DynRxTimeout(void)
void IlStopRx<SigName>DynRxTimeout(void)
* This type depends on the configuration.
TxSignal > Il_Vector > Signal Access
Put
Boolean
true
The generation of signal value write access macros and
functions for send signals can be enabled or disabled. If
enabled, the Generation Tool will generate macros and
functions for signal access using the signal names in the
network data base (macros or functions, depending on the
type of the signal).
API:
Length <=1Byte void IlPutTx<SigName>(vuint8 data)
1Byte< Length <=2Byte void IlPutTx<SigName>(vuint16
data)
2Byte< Length <=4Byte void IlPutTx<SigName>(vuint32
data)
4Byte< Length void IlPutTx<SigName>(vuint8* pData)
If the AUTOSAR signal API is enabled, set the signal value
via
Com_ReturnType Com_SendSignal(<SigName>,
&<data>);
2013, Vector Informatik GmbH
Version: 2.10.03
75 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value For details please see the documentation of Il_Vector,
chapter 'AUTOSAR Signal Interface'.
Get
Boolean
false
The generation of signal value read access macros and
functions for send signals can be enabled or disabled. If
enabled, the Generation Tool will generate macros and
functions for signal access using the signal names in the
network data base (macros or functions, depending on the
type of the signal).
API:
Length <=1Byte vuint8 IlGetTx<SigName>(void)
1Byte< Length <=2Byte vuint16
IlGetTx<SigName>(void)
2Byte< Length <=4Byte vuint32
IlGetTx<SigName>(void)
4Byte< Length void IlGetTx<SigName>(vuint8* pData)
If the AUTOSAR signal API is enabled, read the signal
value via
Com_ReturnType Com_ReceiveSignal(<SigName>,
&<data>)
For details please see the documentation of Il_Vector,
chapter 'AUTOSAR Signal Interface'.
RDS
Boolean
false
Macros to write and read the Tx register of the CAN
controller. These macros can only be used in the context of
the PreTransmit function.
Set API:
Length <=1Byte void IlPutTxCAN<SigName>(vuint8
data)
1Byte< Length <=2Byte void
IlPutTxCAN<SigName>(vuint16 data)
2Byte< Length <=4Byte void
IlPutTxCAN<SigName>(vuint32 data)
4Byte< Length void IlPutTxCAN<SigName>(vuint8*
pData)
TxSignal > Il_Vector > Notification Classes > Confirmation
Flag
Boolean
false
After successful transmission of a signal, the Interaction
Layer sets the confirmation flag.
API:
vuint8 IlGetIlTx<SigName>SigConfirmation()
void IlSetIlTx<SigName>SigConfirmation()
void IlClrIlTx<SigName>SigConfirmation()
Function
String
If you enter a function name you determine for this transmit
signal that a confirmation function shall be called after
transmission of this signal. The default is the name of the
signal, but you can change this name. The final name of
the function will be determined out of the defined pre- and
postfixes on the name decorator configuration view and
the specified name.
API: void ApplIl<SigName>SigConfirmation(void)
2013, Vector Informatik GmbH
Version: 2.10.03
76 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value TxSignal > Il_Vector > Notification Classes > Timeout
Flag
Boolean
false
To supervise the actual transmission of signals, a timeout
flag can be configured. If a signal is sent and the
confirmation is not received until timeout, the application
will be notified by this timeout flag.
API:
vuint8 IlGetIlTx<SigName>SigTimeout()
void IlSetIlTx<SigName>SigTimeout()
void IlClrIlTx<SigName>SigTimeout()
Function
String
If you enter a function name you determine for this transmit
signal that a timeout function shall be called if the
confirmation will not occur in time. The default is the name
of the signal, but you can change this name. The final
name of the function will be determined out of the defined
pre- and postfixes on the name decorator configuration
view and the specified name.
API: void ApplIl<SigName>SigTimeout(void)
TxSignal > Il_Vector > Notification Classes > State Machine Transition
Init
String
If you enter a function name you determine for this transmit
signal that an init function shall be called after the
Interaction Layer was initialized. The default is the name of
the signal, but you can change this name. The final name
of the function will be determined out of the defined pre-
and postfixes on the name decorator configuration view
and the specified name.
API: void ApplIl<SigName>TxInit(void)
Start
String
If you enter a function name you determine for this transmit
signal that a start function shall be called after the
Interaction Layer was switched to the running state. The
default is the name of the signal, but you can change this
name. The final name of the function will be determined
out of the defined pre- and postfixes on the name
decorator configuration view and the specified name.
API: void ApplIl<SigName>TxStart(void)
Stop
String
If you enter a function name you determine for this transmit
signal that a stop function shall be called after the
Interaction Layer was suspended. The default is the name
of the signal, but you can change this name. The final
name of the function will be determined out of the defined
pre- and postfixes on the name decorator configuration
view and the specified name.
API: void ApplIl<SigName>TxStop(void)
TxSignal > Il_Vector > Default Value
Init
Boolean
false
Use the default value at initialization time to initialize the
signal buffer. If you activate the initialization default value
handling, the following fields (Start, Stop and Value) will be
enabled and can be configured, too.
Start
Boolean
false
Use the default value to initialize the signal buffer within
the callcontext of 'IlTxStart()'. To use this option 'Init' in
2013, Vector Informatik GmbH
Version: 2.10.03
77 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value 'Default Value' must be activated, too.
Stop
Boolean
false
Use the default value with 'IlTxStop' to initialize the signal
buffer. To use this option 'Init' in 'Default Value' must be
activated, too.
Value
String
0
Use the default value within 'IlInit()', 'IlTxStart()' and
'IlTxStop()' to initialize the signal buffer. The data type of
the default value depends on the data type of the related
signal. To use this option 'Init' in 'Default Value' must be
activated, too.
MsgSignalContainer > Il_Vector > Signal Access
Shadow Buffer
Boolean
false
If this option is enabled, the appplication has to provide the
shadow buffer for signal groups.
Due to this setting, the signal group API changes. For
detailed information please see the technical reference of
IL_Vector.
ModuleInstance > Il_Vector > Notification Mechanism > Functions > Confirmation
Prefix
String
Appl
Specify the prefix for the signal confirmation function.
Postfix
String
Specify the postfix for the signal confirmation function.
SigConfir
mation
ModuleInstance > Il_Vector > Notification Mechanism > Functions > Indication
Prefix
String
Appl
Specify the prefix for the signal indication function.
Postfix
String
Specify the postfix for the signal indication function.
SigIndica
tion
ModuleInstance > Il_Vector > Notification Mechanism > Functions > Tx Timeout
Signal Prefix
String
Appl
Specify the prefix for the signal based timeout function.
ModuleInstance > Il_Vector > Notification Mechanism > Functions > Rx Timeout
Signal Prefix
String
Appl
Specify the prefix for the signal based timeout function.
ModuleInstance > Il_Vector > Notification Mechanism > Functions > Tx Timeout
Signal Postfix
String
Specify the postfix for the signal based timeout function.
TxSigTim
eout
ModuleInstance > Il_Vector > Notification Mechanism > Functions > Rx Timeout
Signal Postfix
String
Specify the postfix for the signal based timeout function.
RxSigTi
meout
Message Prefix
String
Appl
Specify the prefix for the message based timeout function.
Message Postfix
String
Specify the postfix for the message based timeout
MsgTime
out
function.
ModuleInstance > Il_Vector > Notification Mechanism > Functions > State Machine Transition > Rx Init
Prefix
String
Appl
Specify the prefix for the Rx signal init callback function.
Postfix
String
RxInit
Specify the postfix for the Rx signal init callback function.
ModuleInstance > Il_Vector > Notification Mechanism > Functions > State Machine Transition > Tx Init
Prefix
String
Appl
Specify the prefix for the Tx signal init callback function.
Postfix
String
TxInit
Specify the postfix for the Tx signal init callback function.
ModuleInstance > Il_Vector > Notification Mechanism > Functions > State Machine Transition > Rx Start
Prefix
String
Appl
Specify the prefix for the Rx signal start callback function.
Postfix
String
RxStart
Specify the postfix for the Rx signal start callback function.
2013, Vector Informatik GmbH
Version: 2.10.03
78 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value ModuleInstance > Il_Vector > Notification Mechanism > Functions > State Machine Transition > Tx Start
Prefix
String
Appl
Specify the prefix for the Tx signal start callback function.
Postfix
String
TxStart
Specify the postfix for the Tx signal start callback function.
ModuleInstance > Il_Vector > Notification Mechanism > Functions > State Machine Transition > Rx Stop
Prefix
String
Appl
Specify the prefix for the Rx signal stop callback function.
Postfix
String
RxStop
Specify the postfix for the Rx signal stop callback function.
ModuleInstance > Il_Vector > Notification Mechanism > Functions > State Machine Transition > Tx Stop
Prefix
String
Appl
Specify the prefix for the Tx signal stop callback function.
Postfix
String
TxStop
Specify the postfix for the Tx signal stop callback function.
ModuleInstance > Il_Vector > Signal Access > Rx
Get Prefix
String
IlGetRx
Specify the prefix for the Rx signal read access functions
and macros.
Put Prefix
String
IlPutRx
Specify the prefix for the Rx signal write access functions
and macros.
ModuleInstance > Il_Vector > Signal Access > Tx
Get Prefix
String
IlGetTx
Specify the prefix for the Tx signal read access functions
and macros.
Put Prefix
String
IlPutTx
Specify the prefix for the Tx signal write access functions
and macros.
ModuleInstance > Il_Vector > RDS Signal Access
Rx Get Prefix
String
Specify the prefix for the Rx signal read access functions
IlGetRxC
AN
and macros.
Tx Put Prefix
String
Specify the prefix for the Tx signal write access functions
IlPutTxC
AN
and macros.
ModuleInstance > Il_Vector > Signal Access > Rx
SignalGroup Get
String
IlGetRx
Specify the prefix for the Rx signal group read access
Prefix
functions and macros.
SignalGroup Put
String
IlPutRx
Specify the prefix for the Rx signal group write access
Prefix
functions and macros.
ModuleInstance > Il_Vector > Signal Access > Tx
SignalGroup Get
String
IlGetTx
Specify the prefix for the Tx signal group read access
Prefix
functions and macros.
SignalGroup Put
String
IlPutTx
Specify the prefix for the Tx signal group write access
Prefix
functions and macros.
ModuleInstance > Il_Vector > Dynamic Rx Timeout API
Get Prefix
String
IlGetRx
Specify a prefix for the user defined
IlGetRxDynamicTimeout function.
Set Prefix
String
IlSetRx
Specify a prefix for the user defined
IlSetRxDynamicTimeout function.
Start Prefix
String
IlStartRx Specify a prefix for the user defined
IlStartRxDynamicTimeout function.
Stop Prefix
String
IlStopRx Specify a prefix for the user defined
IlStopRxDynamicTimeout function.
Postfix
String
Specify a postfix for the generated DynamicApi
DynRxTi
meout
macros/functions.
2013, Vector Informatik GmbH
Version: 2.10.03
79 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Attribute Name Value Default Description Type Value ModuleInstance > Il_Vector > Notification Mechanism > Flags > Prefixes
Get
String
IlGet
Specify the prefix for macros to read flags.
Set
String
IlSet
Specify the prefix for macros to write flags.
Clear
String
IlClr
Specify the prefix for macros to clear flags.
Get + Clear
String
IlGetClr
Specify the prefix for macros to read and clear flags.
ModuleInstance > Il_Vector > Notification Mechanism > Flags > Postfixes
Indication
String
Specify the postfix for indication flag macros.
Indicatio
n
Confirmation
String
Specify the postfix for confirmation flag macros.
Confirma
tion
FirstValue
String
Specify the postfix for FirstValue flag macros.
Firstvalu
e
Tx Timeout
String
Specify the postfix for Tx timeout flag macros.
TxTimeo
ut
Rx Timeout
String
Specify the postfix for Rx timeout flag macros.
RxTimeo
ut
DataChanged
String
Specify the postfix for DataChanged flag macros.
DataCha
nged
MsgSignal > Il_Vector > Database Attributes
MsgSendType
Object
N.a.
CANdb attribute 'GenMsgSendType'
SigSendType
Object
N.a.
CANdb attribute 'GenSigSendType'
Message > Il_Vector > Database Attributes
SendType
Object
N.a.
CANdb attribute 'GenMsgSendType'
Table 5-1
GENy attributes
2013, Vector Informatik GmbH
Version: 2.10.03
80 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
6 API Description 6.1.1 TypeDefinitions The types defined by the Interaction Layer are described in this chapter.
Type Name C-Type Description Value Range CanChannelHandle
c-type
Can Driver channel object
0..<ChannelIdmax>
identifier.
Zero-based integer number
IlReceiveHandle
c-type
Interaction Layer Rx message
0..<RxMessageIdmax>
object identifier.
Zero-based integer number
IlTransmitHandle
c-type
Interaction Layer Tx message
0..<TxMessageIdmax>
object identifier.
Zero-based integer number
Il_Status
c-type
Il_Status : the value must be
decoded with the following set
of macros.
The macros will return 0 (false)
or 1 (true).
- IlIsTxRun(state) : Tx is
running
- IlIsTxWait(state) : Tx is
waiting
- IlIsTxSuspend(state) : Tx is
suspended
- IlIsRxRun(state) : Rx is
running
- IlIsRxWait(state) : Rx is
waiting
- IlIsRxSuspend(state) : Rx is
suspended
Il_Boolean
c-type
A boolean result defined by the IL_FALSE
Interaction Layer.
IL_TRUE
"_c_" and
c-type
The SignalGroupBufferType is
the network signal group
a generated data type for each
name
signal group.
and the postfix "_buf".
tIlModuleContextStructPtr c-type
pointer to a
tIlModuleContextStruct struct
Table 6-1
Type definitions
2013, Vector Informatik GmbH
Version: 2.10.03
81 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
6.1.2 Services provided by Interaction Layer Caution
The APIs of the IL do not support reentrant calls and must not interrupt each other.
Exceptions are described in the API description. See also chapter
4.3 Operating Systems Requirements. 6.1.2.1 IlInitPowerOn IlInitPowerOn Prototype
void
IlInitPowerOn (void)
Parameter void
none
Return code void
none
Functional Description This method initializes the Il_Vector on all channels.
IlInit is called for every channel.
Particularities and Limitations The function is called by the Application or Ccl (Communication Control Layer).
Call context
The function must be called with disabled interrupts.
The function must not interrupt IlRxTask, IlRxStateTask, IlTxTask, IlTxStateTask, IlInit, IlRxStart, IlTxStart,
IlRxStop, IlTxStop.
6.1.2.2 IlInit IlInit Prototype
Single Channel
Single Receive Channel
void
IlInit (void)
Multi Channel
Indexed (MRC)
void
IlInit (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
2013, Vector Informatik GmbH
Version: 2.10.03
82 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Functional Description This method initializes the Il_Vector on a channel.
Rx and Tx data buffers and flags are set to the initial state. If no default value for a message is defined, the
data buffer is set to 0x00.
Particularities and Limitations The function is called by the Application, Ccl (Communication Control Layer) or IlInitPowerOn.
Call context
The function must be called with disabled interrupts.
The function must not interrupt IlRxTask, IlRxStateTask, IlTxTask, IlTxStateTask, IlInitPowerOn, IlRxStart,
IlTxStart, IlRxStop, IlTxStop.
6.1.2.3 IlRxStart IlRxStart Prototype
Single Channel
Single Receive Channel
void
IlRxStart (void)
Multi Channel
Indexed (MRC)
void
IlRxStart (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method enables the reception of messages. The transition "start" of the Rx state machine is
performed.
Particularities and Limitations The function is called by the Application or Nm (Network Management).
Call context
The function must be called on task level.
The function must not interrupt IlRxTask, IlRxStateTask, IlTxTask, IlTxStateTask, IlInitPowerOn, IlInit,
IlTxStart, IlRxStop, IlTxStop.
6.1.2.4 IlTxStart IlTxStart Prototype
Single Channel
Single Receive Channel
void
IlTxStart (void)
Multi Channel
Indexed (MRC)
void
IlTxStart (CanChannelHandle channel)
2013, Vector Informatik GmbH
Version: 2.10.03
83 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method enables the transmission of messages and starts the transmission of periodic messages. The
transition "start" of the Tx state machine is performed.
Particularities and Limitations The function is called by the Application or Nm (Network Management).
Call context
The function must be called on task level.
The function must not interrupt IlRxTask, IlRxStateTask, IlTxTask, IlTxStateTask, IlInitPowerOn, IlInit,
IlTxStart, IlRxStop, IlTxStop.
6.1.2.5 IlRxStop IlRxStop Prototype
Single Channel
Single Receive Channel
void
IlRxStop (void)
Multi Channel
Indexed (MRC)
void
IlRxStop (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method disables the reception of messages. The transition "stop" of the Rx state machine is
performed. The method is used for example to enter the Sleep Mode of an ECU.
Particularities and Limitations The function is called by the Application or Nm (Network Management).
Call context
The function must be called on task level.
The function must not interrupt IlRxTask, IlRxStateTask, IlTxTask, IlTxStateTask, IlInitPowerOn, IlInit,
IlTxStart, IlRxStop, IlTxStop.
6.1.2.6 IlTxStop IlTxStop Prototype
Single Channel
Single Receive Channel
void
IlTxStop (void)
2013, Vector Informatik GmbH
Version: 2.10.03
84 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Multi Channel
Indexed (MRC)
void
IlTxStop (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method disables the transmission of messages (Sleep Mode). The transition "stop" of the Tx state
machine is performed. The method is used for example to enter the Sleep Mode of an ECU.
Particularities and Limitations The function is called by the Application or Nm (Network Management).
Call context
The function must be called on task level.
The function must not interrupt IlInitPowerOn, IlInit, IlRxTask, IlRxStateTask, IlRxTimerTask, IlTxTask,
IlTxStateTask, IlTxTimerTask, IlRxStart, IlTxStart, IlRxStop
6.1.2.7 IlRxWait IlRxWait Prototype
Single Channel
Single Receive Channel
void
IlRxWait (void)
Multi Channel
Indexed (MRC)
void
IlRxWait (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method halts the timeout monitoring of reception messages. The transition "wait" of the Rx state
machine is performed. The method is used for example when the bus-off mode of an ECU was entered.
Particularities and Limitations The function is called by the Application or Nm (Network Management).
Call context
The function can be called on task and interrupt level.
2013, Vector Informatik GmbH
Version: 2.10.03
85 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
6.1.2.8 IlTxWait IlTxWait Prototype
Single Channel
Single Receive Channel
void
IlTxWait (void)
Multi Channel
Indexed (MRC)
void
IlTxWait (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method halts the transmission of messages. The transition "wait" of the Tx state machine is
performed. The method is used for example when the bus-off mode of an ECU was entered.
Particularities and Limitations The function is called by the Application or Nm (Network Management).
Call context
The function can be called on task and interrupt level.
6.1.2.9 IlRxRelease IlRxRelease Prototype
Single Channel
Single Receive Channel
void
IlRxRelease (void)
Multi Channel
Indexed (MRC)
void
IlRxRelease (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description The transition "release" of the Rx state machine is performed.
-Restart the Rx Timeout Monitoring
-Clear the timeout flags if IL_ENABLE_SYS_RX_RESET_TIMEOUT_FLAGS_ON_ILRXRELEASE is
defined.
Particularities and Limitations The function is called by the Application or Nm (Network Management).
Call context
The function can be called on task and interrupt level.
2013, Vector Informatik GmbH
Version: 2.10.03
86 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
6.1.2.10 IlTxRelease IlTxRelease Prototype
Single Channel
Single Receive Channel
void
IlTxRelease (void)
Multi Channel
Indexed (MRC)
void
IlTxRelease (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method resumes the transmission of messages from the "Waiting" state. The transition "release" of the
Tx state machine is performed.
Particularities and Limitations The function is called by the Application or Nm (Network Management).
Call context
The function can be called on task and interrupt level.
6.1.2.11 IlRxTask IlRxTask Prototype
Single Channel
Single Receive Channel
void
IlRxTask (void)
Multi Channel
Indexed (MRC)
void
IlRxTask (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method must be called periodically in the Rx task cycle time configured in the generation tool. The
IlRxTimerTask and IlRxStateTask are called by this method.
Particularities and Limitations The function is called by the Application or Ccl (Communication Control Layer).
Call context
2013, Vector Informatik GmbH
Version: 2.10.03
87 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
The function must be called on task level.
The function must not interrupt IlRxStateTask, IlTxTask, IlTxStateTask, IlInitPowerOn, IlInit, IlRxStart,
IlTxStart, IlRxStop, IlTxStop
6.1.2.12 IlTxTask IlTxTask Prototype
Single Channel
Single Receive Channel
void
IlTxTask (void)
Multi Channel
Indexed (MRC)
void
IlTxTask (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method must be called periodically in the Tx task cycle time configured in the generation tool. The
IlTxTimerTask and IlTxStateTask are called by this method.
Particularities and Limitations The function is called by the Application or Ccl (Communication Control Layer).
Call context
The function must be called on task level.
The function must not interrupt IlRxStateTask, IlTxTask, IlTxStateTask, IlInitPowerOn, IlInit, IlRxStart,
IlTxStart, IlRxStop, IlTxStop
6.1.2.13 IlRxStateTask IlRxStateTask Prototype
Single Channel
Single Receive Channel
void
IlRxStateTask (void)
Multi Channel
Indexed (MRC)
void
IlRxStateTask (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method is called periodically by the IlRxTask. The function can be called in a faster rate than the
IlRxTask to check additionally for polled indication events. The usage of the IlRxTask shall be preferred.
2013, Vector Informatik GmbH
Version: 2.10.03
88 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Particularities and Limitations The function is called by the Application or IlRxTask.
Call context
The function must be called on task level.
The function must not interrupt IlRxStateTask, IlTxTask, IlTxStateTask, IlInitPowerOn, IlInit, IlRxStart,
IlTxStart, IlRxStop, IlTxStop
6.1.2.14 IlTxStateTask IlTxStateTask Prototype
Single Channel
Single Receive Channel
void
IlTxStateTask (void)
Multi Channel
Indexed (MRC)
void
IlTxStateTask (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method is called periodically by the IlTxTask. The function can be called in a faster rate, than the
IlTxTask, to check additionally for polled confirmation events. The usage of the IlTxTask shall be preferred.
Particularities and Limitations The function is called by the Application or IlTxTask.
Call context
The function must be called on task level.
The function must not interrupt IlRxStateTask, IlTxTask, IlTxStateTask, IlInitPowerOn, IlInit, IlRxStart,
IlTxStart, IlRxStop, IlTxStop
6.1.2.15 IlSendOnInitMsg IlSendOnInitMsg Prototype
Single Channel
Single Receive Channel
void
IlSendOnInitMsg (void)
Multi Channel
Indexed (MRC)
void
IlSendOnInitMsg (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
2013, Vector Informatik GmbH
Version: 2.10.03
89 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Functional Description This method serves to set a transmission request flag for all messages configured as SendOnInit
messages.
Particularities and Limitations The function is called by the Application.
Call context
The function must be called on task level.
6.1.2.16 IlGetStatus IlGetStatus Prototype
Single Channel
Single Receive Channel
Il_Status
IlGetStatus (void)
Multi Channel
Indexed (MRC)
Il_Status
IlGetStatus (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code Il_Status
Il_Status : the value must be decoded with the following set of macros.
The macros will return 0 (false) or 1 (true).
- IlIsTxRun(state) : Tx is running
- IlIsTxWait(state) : Tx is waiting
- IlIsTxSuspend(state) : Tx is suspended
- IlIsRxRun(state) : Rx is running
- IlIsRxWait(state) : Rx is waiting
- IlIsRxSuspend(state) : Rx is suspended
Functional Description Gets the current state of the Interaction Layer state machine.
Particularities and Limitations The function is called by the Application.
Call context
The function can be called on task and interrupt level.
6.1.2.17 IlTxRepetitionsAreActive IlTxRepetitionsAreActive Prototype
Single Channel
Single Receive Channel
Il_Boolean
IlTxRepetitionsAreActive (void)
Multi Channel
2013, Vector Informatik GmbH
Version: 2.10.03
90 / 115
based on template version 3.7



Technical Reference Vector Interaction Layer
Indexed (MRC)
Il_Boolean
IlTxRepetitionsAreActive
(CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code Il_Boolean
IL_TRUE : Messages with repetitions are queued for transmission.
IL_FALSE : No message with repetitions is queued for transmission.
Functional Description This method can be used to detect if messages with repetitions are queued for transmission on a channel.
Particularities and Limitations The function is called by the Application.
Caution The function does not support Virtual Networks.
Call context
The function can be called on task and interrupt level.
6.1.2.18 IlTxSignalsAreActive IlTxSignalsAreActive Prototype
Single Channel
Single Receive Channel
Il_Boolean
IlTxSignalsAreActive (void)
Multi Channel
Indexed (MRC)
Il_Boolean
IlTxSignalsAreActive (CanChannelHandle
channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code Il_Boolean
IL_TRUE : Signals are in the active state.
IL_FALSE : No signal is in the active state.
Functional Description This method can be used to detect if signals are active on a channel.
Particularities and Limitations The function is called by the Application.
Caution The function does not support Virtual Networks.
Call context
The function can be called on task and interrupt level.
2013, Vector Informatik GmbH
Version: 2.10.03
91 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
6.1.3 Generated Services provided by the Interaction Layer Info The generated service declarators in this chapter are depending on the configuration.
6.1.3.1 Read and Write Signals and Signal Groups WriteSignalByValue Prototype
void
WriteSignalByValue (vuintx sigData)
Parameter sigData
new value of the signal.
(vuint8) : The length of the network signal is between 1 and 8 bits.
(vuint16) : The length of the network signal is between 9 and 16 bits.
(vuint32) : The length of the network signal is between 17 and 32 bits.
Return code void
none
Functional Description Write a signal value to the message buffer and evaluate the transmission mode for Tx signals. The function
is generated optimized for the configuration and can be a function like macro or generated function. The
generated prototype declarator is composed of
- a configurable prefix for writing signals and
- the network signal name
e.g. <IlPutTx><NetworkSignalName>.
Particularities and Limitations The function is called by the application.
Call context
The function can be called on task and interrupt level.
WriteSignalByReference Prototype
void
WriteSignalByReference (vuint8 *pData)
Parameter pData
pointer to a vuint8 array with the new value of the signal. The length of the
network signal is between 33 and 64 bits.
Return code void
none
2013, Vector Informatik GmbH
Version: 2.10.03
92 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Functional Description Write a signal value to the message buffer and evaluate transmission mode for Tx signals. The function is
generated optimized for the configuration and can be a function like macro or generated function. The
generated prototype declarator is composed of
- a configurable prefix for writing signals and
- the network signal name
e.g. <IlPutTx><NetworkSignalName>.
Particularities and Limitations The function is called by the application.
Call context
The function can be called on task and interrupt level.
ReadSignalByValue Prototype
vuintx
ReadSignalByValue (void)
Parameter void
none
Return code vuintx
(vuint8) : The length of the network signal is between 1 and 8 bits.
(vuint16) : The length of the network signal is between 9 and 16 bits.
(vuint32) : The length of the network signal is between 17 and 32 bits.
Functional Description Read a signal value from the message buffer. The function is generated optimized for the configuration and
can be a function like macro or generated function. The generated prototype declarator is composed of
- a configurable prefix for writing signals and
- the network signal name
e.g. <IlGetRx><NetworkSignalName>.
Particularities and Limitations The function is called by the application.
Call context
The function can be called on task and interrupt level.
ReadSignalByReference Prototype
void
ReadSignalByReference (vuint8 *pData)
Parameter pData
pointer to a vuint8 array where the value of the signal shall be stored. The
length of the network signal is between 33 and 64 bits.
Return code void
none
2013, Vector Informatik GmbH
Version: 2.10.03
93 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Functional Description Read a signal value from the message buffer. The generated prototype declarator is composed of
- a configurable prefix for writing signals and
- the network signal name
e.g. <IlGetRx><NetworkSignalName>.
Particularities and Limitations The function is called by the application.
Call context
The function can be called on task and interrupt level.
WriteGroupedSignalByValue Prototype
void
WriteGroupedSignalByValue (SignalGroupBufferType pBuffer, vuintx
sigData)
Parameter pBuffer
pointer to the signal group buffer.
(SignalGroupBufferType) : the generated data type for each signal group.
->"Shadow Buffer" is enabled in the configuration for the signal group:
The application has to provide a shadow buffer with the generated type.
The generated data type name can be identified by the prefix "_c_" and the
network signal group name and the postfix "_buf".
->"Shadow Buffer" is disabled in the configuration for the signal group:
The parameter is omitted and the IL provides the shadow buffer.
sigData
new value of the signal.
(vuint8) : The length of the network signal is between 1 and 8 bits.
(vuint16) : The length of the network signal is between 9 and 16 bits.
(vuint32) : The length of the network signal is between 17 and 32 bits.
Return code void
none
Functional Description Write a grouped signal value to the signal group buffer. The function is generated optimized for the
configuration and can be a function like macro or generated function. The generated prototype declarator is
composed of
- a configurable prefix for writing signals and
- the network signal name and
- "ShadowBuffer" e.g. <IlPutTx><NetworkSignalName>ShadowBuffer.
Particularities and Limitations The function is called by the application.
Call context
The function can be called on task and interrupt level.
WriteGroupedSignalByReference 2013, Vector Informatik GmbH
Version: 2.10.03
94 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Prototype
void
WriteGroupedSignalByReference (SignalGroupBufferType pBuffer,
vuint8 *pData)
Parameter pBuffer
pointer to the signal group buffer.
(SignalGroupBufferType) : the generated data type for each signal group.
->"Shadow Buffer" is enabled in the configuration for the signal group:
The application has to provide a shadow buffer with the generated type.
The generated data type name can be identified by the prefix "_c_" and the
network signal group name and the postfix "_buf".
->"Shadow Buffer" is disabled in the configuration for the signal group:
The parameter is omitted and the IL provides the shadow buffer.
pData
pointer to a vuint8 array with the new value of the signal. The length of the
network signal is between 33 and 64 bits.
Return code void
none
Functional Description Write a grouped signal value to the signal group buffer. The function is generated optimized for the
configuration and can be a function like macro or generated function. The generated prototype declarator is
composed of
- a configurable prefix for writing signals and
- the network signal name and
- "ShadowBuffer"
e.g. <IlPutTx><NetworkSignalName>ShadowBuffer.
Particularities and Limitations The function is called by the application.
Call context
The function can be called on task and interrupt level.
ReadGroupedSignalByValue Prototype
vuintx
ReadGroupedSignalByValue (SignalGroupBufferType pBuffer)
Parameter pBuffer
pointer to the signal group buffer.
(SignalGroupBufferType) : the generated data type for each signal group.
->"Shadow Buffer" is enabled in the configuration for the signal group:
The application has to provide a shadow buffer with the generated type.
The generated data type name can be identified by the prefix "_c_" and the
network signal group name and the postfix "_buf".
->"Shadow Buffer" is disabled in the configuration for the signal group:
The parameter is omitted and the IL provides the shadow buffer.
Return code vuintx
(vuint8) : The length of the network signal is between 1 and 8 bits.
(vuint16) : The length of the network signal is between 9 and 16 bits.
(vuint32) : The length of the network signal is between 17 and 32 bits.
2013, Vector Informatik GmbH
Version: 2.10.03
95 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Functional Description Read a signal value from the message buffer. The function is generated optimized for the configuration and
can be a function like macro or generated function. The generated prototype declarator is composed of
- a configurable prefix for writing signals and
- the network signal name and
- "ShadowBuffer"
e.g. <IlGetRx><NetworkSignalName>ShadowBuffer.
Particularities and Limitations The function is called by the application.
Call context
The function can be called on task and interrupt level.
ReadGroupedSignalByReference Prototype
void
ReadGroupedSignalByReference (SignalGroupBufferType pBuffer,
vuint8 *pData)
Parameter pBuffer
pointer to the signal group buffer.
(SignalGroupBufferType) : the generated data type for each signal group.
->"Shadow Buffer" is enabled in the configuration for the signal group:
The application has to provide a shadow buffer with the generated type.
The generated data type name can be identified by the prefix "_c_" and the
network signal group name and the postfix "_buf".
->"Shadow Buffer" is disabled in the configuration for the signal group:
The parameter is omitted and the IL provides the shadow buffer.
pData
pointer to a vuint8 array where the value of the signal shall be stored. The
length of the network signal is between 33 and 64 bits.
Return code void
none
Functional Description Read a signal value from the message buffer. The generated prototype declarator is composed of
- a configurable prefix for writing signals and
- the network signal name and
- "ShadowBuffer"
e.g. <IlGetRx><NetworkSignalName>ShadowBuffer.
Particularities and Limitations The function is called by the application.
Call context
The function can be called on task and interrupt level.
WriteSignalGroup 2013, Vector Informatik GmbH
Version: 2.10.03
96 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Prototype
void
WriteSignalGroup (SignalGroupBufferType pBuffer)
Parameter pBuffer
pointer to the signal group buffer.
(SignalGroupBufferType) : the generated data type for each signal group.
->"Shadow Buffer" is enabled in the configuration for the signal group:
The application has to provide a shadow buffer with the generated type.
The generated data type name can be identified by the prefix "_c_" and the
network signal group name and the postfix "_buf".
->"Shadow Buffer" is disabled in the configuration for the signal group:
The parameter is omitted and the IL provides the shadow buffer.
Return code void
none
Functional Description Write a signal group from the signal group buffer to the message buffer and evaluate the transmission
mode for Tx signals. The generated prototype declarator is composed of
- a configurable prefix for writing signals and
- the network signal group name and
- "ShadowBuffer" e.g. <IlPutTx><NetworkSignalGroupName>ShadowBuffer.
Particularities and Limitations The function is called by the application.
Call context
The function can be called on task and interrupt level.
ReadSignalGroup Prototype
void
ReadSignalGroup (SignalGroupBufferType pBuffer)
Parameter pBuffer
pointer to the signal group buffer.
(SignalGroupBufferType) : the generated data type for each signal group.
->"Shadow Buffer" is enabled in the configuration for the signal group:
The application has to provide a shadow buffer with the generated type.
The generated data type name can be identified by the prefix "_c_" and the
network signal group name and the postfix "_buf".
->"Shadow Buffer" is disabled in the configuration for the signal group:
The parameter is omitted and the IL provides the shadow buffer.
Return code void
none
Functional Description Read a signal group from the message buffer to the signal group buffer. The generated prototype
declarator is composed of
- a configurable prefix for writing signals and
- the network signal group name and
- "ShadowBuffer"
e.g. <IlGetRx><NetworkSignalGroupName>ShadowBuffer.
2013, Vector Informatik GmbH
Version: 2.10.03
97 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Particularities and Limitations The function is called by the application.
Call context
The function can be called on task and interrupt level.
6.1.3.2 Read and Write Signals and SignalGroups in the RDS Buffer. WriteSignalByValue2RDS Prototype
void
WriteSignalByValue2RDS (vuintx sigData)
Parameter sigData
new value of the signal.
(vuint8) : The length of the network signal is between 1 and 8 bits.
(vuint16) : The length of the network signal is between 9 and 16 bits.
(vuint32) : The length of the network signal is between 17 and 32 bits.
Return code void
none
Functional Description Write a signal or grouped signal value to the register of the CAN controller. The function is generated
optimized for the configuration and can be a function like macro or generated function. The generated
prototype declarator is composed of
- a configurable prefix for writing signals and
- the network signal name
e.g. <IlPutTx><NetworkSignalName>.
Particularities and Limitations The function is called by the application.
Call context
The function must be called in the context of the signals message specific CAN Driver PreTransmit
function.
WriteSignalByReference2RDS Prototype
void
WriteSignalByReference2RDS (vuint8 *pData)
Parameter pData
pointer to a vuint8 array with the new value of the signal. The length of the
network signal is between 33 and 64 bits.
Return code void
none
2013, Vector Informatik GmbH
Version: 2.10.03
98 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Functional Description Write a signal or grouped signal value to the register of the CAN controller. The function is generated
optimized for the configuration and can be a function like macro or generated function. The generated
prototype declarator is composed of
- a configurable prefix for writing signals and
- the network signal name
e.g. <IlPutTx><NetworkSignalName>.
Particularities and Limitations The function is called by the application.
Call context
The function must be called in the context of the signals message specific CAN Driver PreTransmit
function.
ReadSignalByValueFromRDS Prototype
vuintx
ReadSignalByValueFromRDS (void)
Parameter void
none
Return code vuintx
(vuint8) : The length of the network signal is between 1 and 8 bits.
(vuint16) : The length of the network signal is between 9 and 16 bits.
(vuint32) : The length of the network signal is between 17 and 32 bits.
Functional Description Read a signal or grouped signal value from the register of the CAN controller. The function is generated
optimized for the configuration and can be a function like macro or generated function. The generated
prototype declarator is composed of
- a configurable prefix for writing signals and
- the network signal name
e.g. <IlGetRx><NetworkSignalName>.
Particularities and Limitations The function is called by the application.
Call context
The function must be called within the context of the signals message specific CAN Driver PreCopy
function.
ReadSignalByReferenceFromRDS Prototype
void
ReadSignalByReferenceFromRDS (vuint8 *pData)
Parameter pData
pointer to a vuint8 array where the value of the signal shall be stored. The
length of the network signal is between 33 and 64 bits.
2013, Vector Informatik GmbH
Version: 2.10.03
99 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Return code void
none
Functional Description Read a signal or grouped signal value from the register of the CAN controller. The length of the network
signal is between 33 and 64 bits. The generated prototype declarator is composed of
- a configurable prefix for writing signals and
- the network signal name
e.g. <IlGetRx><NetworkSignalName>.
Particularities and Limitations The function is called by the application.
Call context
The function must be called within the context of the signals message specific CAN Driver PreCopy
function.
6.1.3.3 Notification Flags of Signals, Signal Groups and Grouped Signals GetNotificationFlag Prototype
vuint8
GetNotificationFlag (void)
Parameter void
none
Return code vuint8
(vuint8) 0 : The notification is NOT set.
> 0 : The notification is set.
Functional Description This macro is used to detect the notification of a signal, signal group or grouped signal. The generated
prototype declarator is composed of
- a configurable prefix for the notification flag to get flags and
- the network signal, signal group or grouped signal name and
- a configurable postfix for the notification flag.
e.g. <IlGet><NetworkSignalName><Indication>.
Particularities and Limitations The macro is called by the application.
Call context
The macro can be called on task and interrupt level.
SetNotificationFlag Prototype
void
SetNotificationFlag (void)
2013, Vector Informatik GmbH
Version: 2.10.03
100 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Parameter void
none
Return code void
none
Functional Description This macro sets the notification flag of a signal, signal group or grouped signal. The generated prototype
declarator is composed of
- a configurable prefix for the notification flag to set flags and
- the network signal, signal group or grouped signal name and
- a configurable postfix for the notification flag.
e.g. <IlSet><NetworkSignalName><Indication>.
Particularities and Limitations The macro is called by the application.
Call context
The macro must be called with disabled interrupts or in a non-preemptive task.
ClearNotificationFlag Prototype
void
ClearNotificationFlag (void)
Parameter void
none
Return code void
none
Functional Description This macro clears the notification flag of a signal, signal group or grouped signal. The generated prototype
declarator is composed of
- a configurable prefix for the notification flag to clear flags and
- the network signal, signal group or grouped signal name and
- a configurable postfix for the notification flag.
e.g. <IlClr><NetworkSignalName><Indication>.
Particularities and Limitations The macro is called by the application.
Call context
The macro must be called with disabled interrupts or in a non-preemptive task.
GetAndClearNotificationFlag Prototype
vuint8
GetAndClearNotificationFlag (void)
2013, Vector Informatik GmbH
Version: 2.10.03
101 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
Parameter void
none
Return code vuint8
(vuint8) 0 : The notification is NOT set
> 0 : The notification is set.
Functional Description This macro is used to determine and clear the notification of a signal, signal group or grouped signal. The
generated prototype declarator is composed of
- a configurable prefix for the notification flag to get and clear flags
- and the network signal, signal group or grouped signal name and
- a configurable postfix for the notification flag.
e.g. <IlGetClr><NetworkSignalName><Indication> The get and clear macro is only provided for the signal,
signal group or grouped signal indication flag.
Particularities and Limitations The macro is called by the application.
Call context
The macro can be called on task and interrupt level.
6.1.3.4 Dynamic Rx Timeout GetDynamicRxTimeout Prototype
IltRxTimeoutCounter
GetDynamicRxTimeout (void)
Parameter void
none
Return code IltRxTimeoutCounter
(IltRxTimeoutCounter) The current Rx timeout counter in milliseconds with the
maximum value 65535.
Functional Description This method is used to receive the timeout counter in milliseconds for a message. The generated prototype
declarator is composed of
- a configurable prefix for the reception of the dynamic timeout counter and
- the network signal, signal group or grouped signal name and
- a configurable postfix for the dynamic timeout.
e.g. <IlGetRx><NetworkSignalName><DynRxTimeout>.
Particularities and Limitations The macro is called by the application.
Caution This API is signal oriented, but the effect will take place for all signals in the message.
Call context
The macro can be called on task and interrupt level.
2013, Vector Informatik GmbH
Version: 2.10.03
102 / 115
based on template version 3.7



Technical Reference Vector Interaction Layer
SetDynamicRxTimeout Prototype
void
SetDynamicRxTimeout (IltRxTimeoutCounter msTimer)
Parameter msTimer
The new Rx timeout counter in milliseconds with the maximum value 65535.
Return code void
none
Functional Description This method is used to set the timeout counter in milliseconds for a message. The generated prototype
declarator is composed of
- a configurable prefix for setting the dynamic timeout counter and
- the network signal, signal group or grouped signal name and
- a configurable postfix for setting the dynamic timeout.
e.g. <IlSetRx><NetworkSignalName><DynRxTimeout>.
Particularities and Limitations The macro is called by the application.
Caution This API is signal oriented, but the effect will take place for all signals in the message.
Call context
The macro must be called with disabled interrupts or in a non-preemptive task.
StartDynamicRxTimeout Prototype
void
StartDynamicRxTimeout (void)
Parameter void
none
Return code void
none
Functional Description This method is used to start a stopped timeout counter for a message. The generated prototype declarator
is composed of
- a configurable prefix for starting the dynamic timeout counter and
- the network signal, signal group or grouped signal name and
- a configurable postfix for starting the dynamic timeout.
e.g. <IlSetRx><NetworkSignalName><DynRxTimeout>.
Particularities and Limitations The macro is called by the application.
Caution This API is signal oriented, but the effect will take place for all signals in the message.
2013, Vector Informatik GmbH
Version: 2.10.03
103 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
Call context
The macro can be called on task and interrupt level.
StopDynamicRxTimeout Prototype
void
StopDynamicRxTimeout (void)
Parameter void
none
Return code void
none
Functional Description This method is used to stop the timeout counter for a message. The generated prototype declarator is
composed of
- a configurable prefix for stopping the dynamic timeout counter and
- the network signal, signal group or grouped signal name and
- a configurable postfix for stopping the dynamic timeout.
e.g. <IlSetRx><NetworkSignalName><DynRxTimeout>.
Particularities and Limitations The macro is called by the application.
Caution This API is signal oriented, but the effect will take place for all signals in the message.
Call context
The macro can be called on task and interrupt level.
6.1.4 Callback Functions All callback functions can be activated or deactivated by a switch in the Configuration Tool.
If a callback function is activated by the user, the application has to provide this function.
6.1.4.1 ApplIlInit ApplIlInit Prototype
Single Channel
Single Receive Channel
void
ApplIlInit (void)
Multi Channel
Indexed (MRC)
void
ApplIlInit (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
2013, Vector Informatik GmbH
Version: 2.10.03
104 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Functional Description This method is called to indicate the performed initialization.
Particularities and Limitations none
Call context
The function is called by the IL in the context of IlInit.
6.1.4.2 ApplIlRxStart ApplIlRxStart Prototype
Single Channel
Single Receive Channel
void
ApplIlRxStart (void)
Multi Channel
Indexed (MRC)
void
ApplIlRxStart (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method is called to indicate the performed transition start for the Rx state machine.
Particularities and Limitations none
Call context
The function is called by the IL in the context of IlRxStart.
6.1.4.3 ApplIlTxStart ApplIlTxStart Prototype
Single Channel
Single Receive Channel
void
ApplIlTxStart (void)
Multi Channel
Indexed (MRC)
void
ApplIlTxStart (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
2013, Vector Informatik GmbH
Version: 2.10.03
105 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Functional Description This method is called to indicate the performed transition start for the Tx state machine.
Particularities and Limitations none
Call context
The function is called by the IL in the context of IlTxStart.
6.1.4.4 ApplIlRxStop ApplIlRxStop Prototype
Single Channel
Single Receive Channel
void
ApplIlRxStop (void)
Multi Channel
Indexed (MRC)
void
ApplIlRxStop (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
Functional Description This method is called to indicate the performed transition stop for the Rx state machine.
Particularities and Limitations none
Call context
The function is called by the IL in the context of IlRxStop.
6.1.4.5 ApplIlTxStop ApplIlTxStop Prototype
Single Channel
Single Receive Channel
void
ApplIlTxStop (void)
Multi Channel
Indexed (MRC)
void
ApplIlTxStop (CanChannelHandle channel)
Parameter channel (Indexed)
Handle of the logical Can Driver channel.
Return code void
none
2013, Vector Informatik GmbH
Version: 2.10.03
106 / 115
based on template version 3.7


Technical Reference Vector Interaction Layer
Functional Description This method is called to indicate the performed transition stop for the Tx state machine.
Particularities and Limitations none
Call context
The function is called by the IL in the context of IlTxStop.
6.1.4.6 ApplIlFatalError ApplIlFatalError Prototype
void
ApplIlFatalError (vuint8 errorNumber)
Parameter errorNumber
numeric error code
Return code void
none
Functional Description If assertions are configured, this function is called to indicate invalid user conditions (API, reentrance),
inconsistent generated data, hardware errors and internal errors.
Particularities and Limitations none
Call context
The function is be called by the IL on task and interrupt level.
6.1.5 Generated Callback Functions All callback functions can be activated or deactivated by a switch in the Configuration Tool.
If a callback function is activated by the user, the application has to provide this function.
Info The generated callback declarators in this chapter are depending on the configuration.
NotificationFunction Prototype
void
NotificationFunction (void)
Parameter void
none
Return code void
none
2013, Vector Informatik GmbH
Version: 2.10.03
107 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Functional Description This function is used to determine the notification of a signal, signal group or grouped signal. The
generated prototype declarator is composed of
a configurable prefix for the notification and
the network signal, signal group or grouped signal name and
a configurable postfix for the notification.
e.g. <ApplIl><NetworkSignalName><SigIndication>.
Particularities and Limitations The function is called by the IL and implemented by the application.
Call context
The function is called notification class and configuration dependent:
- Indication :
->Il polling is enabled in the configuration for the message:
The function is called in the context of the IlRxTask or IlRxStateTask.
->Il polling is disabled in the configuration for the message:
The function is called in the context of the CAN Driver message indication function.
- Confirmation :
->Il polling is enabled in the configuration for the message:
The function is called in the context of the IlTxTask or IlTxStateTask.
->Il polling is disabled in the configuration for the message:
The function is called in the context of the CAN Driver message confirmation function.
- RxTimeout :
->The function is called in the context of the IlRxTask or IlRxTimerTask.
- TxTimeout :
->The function is called in the context of the IlTxTask or IlTxTimerTask.
TransitionChangeNotificationFunction Prototype
void
TransitionChangeNotificationFunction (void)
Parameter void
none
Return code void
none
Functional Description This function is used to determine the transition change of a signal, signal group or grouped signal. The
generated prototype declarator is composed of
- a configurable prefix for the transition notification and
- the network signal, signal group or grouped signal name and
- a configurable postfix for the transition notification.
e.g. <ApplIl><NetworkSignalName><TxStart>.
Particularities and Limitations The function is called by the IL and implemented by the application.
Call context
The function is called in the context of IlInitPowerOn, IlInit, IlRxStart, IlTxStart, IlRxStop, IlTxStop.
2013, Vector Informatik GmbH
Version: 2.10.03
108 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
RxMessageTimeoutFunction Prototype
void
RxMessageTimeoutFunction (void)
Parameter void
none
Return code void
none
Functional Description This function is used to determine the Rx timeout of a message. The generated prototype declarator is
composed of
- a configurable prefix for the Rx message timeout and
- the network message name and
- a configurable postfix for the Rx message timeout.
e.g. <ApplIl><NetworkMessageName><MsgTimeout>.
Particularities and Limitations The function is called by the IL and implemented by the application.
Call context
The function is called in the context of the IlRxTask or IlRxTimerTask.
2013, Vector Informatik GmbH
Version: 2.10.03
109 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
7 Limitations 7.1 CANgen Compatibility 7.1.1 Database attributes Signal value definitions are defined sometimes as decimal or hexadecimal value. Due to
this signal values can be defined as string attribute in the database. Both value
representations are interpreted by GENy. GENy is fully compatible to attributes used with
CANGen. Deviations are described in chapter
5.1.5 Former Attributes. 7.1.2 Application Code If you want to use your existing application with generated GENy code, pay attention to:
Rx Rds Write access and Tx Rds Read access is not supported any more.
The IlOldstyleAPI is not supported any more.
A strict Naming concept is introduced with GENy. The default Pre- and Postfixes have
changed. (The prefix „_a_“ is now „Appl“) It is possible for you, to restore the CANGen
compatible Pre- and Postfixes in the NameDecorator.
Data Type Prefixes are not supported any more.
The Prefixes of Signal Handles have been changed to „IlTxSigHnd“ and „IlRxSigHnd“
instead of „ILTx“.
The Can Driver Interface is in GENy strictly separated from the Interaction Layer. Due to
this, a used Appl message must be adapted.
> The Can Driver message Indication flag postfix is now separately configurable from
the IL Indication Flag.
> If Can Driver Signal access macros are used for signals <= 1 Byte, the function style
interface is not supported any more. The signal value is assigned like a value to a
variable
CANGen supported a configuration switch, to activate the multiple channel interfaces in
single channel configurations. This feature is discontinued in GENy.
7.1.3 Generator > ESCAN00024091
If “Common Buffer” is configured between Rx or Tx messages which are used in
different identities of the ECU, configure both messages in the CAN Driver as Basic
CAN message and use the same Basic CAN object.
> ESCAN00017472
Do not configure Common Buffer for messages containing multiplexed signals.
> ESCAN00023799
2013, Vector Informatik GmbH
Version: 2.10.03
110 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Do not configure Common Buffer for tx messages which are used in the same identitiy
containing signals the GenSigSendType OnChange or OnChangeWithRepetition.
2013, Vector Informatik GmbH
Version: 2.10.03
111 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
8 Glossary and Abbreviations 8.1 Glossary Term Description API
Application Program Interface, for OSEK: The description of the user
interface to the operating system, communications and network
management functions.
AUTOSAR
Automotive Open System Architecture
bus
Defines what we call internal as channel or connection.
CAN
Controller Area Network protocol originally defined for use as a
communication network for control applications in vehicles.
CANGen
Generation tool for CANbedded components
configuration
The communication configuration adapts the communication stack to the
specific component requirements by means of the Generation Tool.
DBC
CAN data base format of the Vector company which is used by Vector
tools
ESCANXXXXXXXX
Vector PES Clearquest Database ID. Replace XXXXXXXX by the
numeric identifier.
generation tool
See CANgen, DBKOMGen and GENy. The generation tool configures the
communication stack, Flash Bootloader, etc. based on database
attributes (vehicle manufacturer), project settings (module supplier) and
license information (Vector).
GENy
Generation tool for CANbedded and MICROSAR components
ID
Identifier (e.g. Identifier of a CAN message)
manufacturer
Vehicle manufacturer
message
A message is responsible for the logical transmission and reception of
information depending on the restrictions of the physical layer. The
definition of the message contents is part of the data base given by the
vehicle manufacturer.
module
A module designates a controller (Identical with ECU).
MRC
Multiple Receive Channel
MSC
Message Sequence Chart
Mutual exclusion
To modify shared data, a task must be able to get exclusive access for a
limited time, i.e. all other tasks must be excluded to access this data. All
tasks modifying shared data must be able to do this exclusion. Therefore
this exclusion is called mutual exclusion.
Node
A network topological entity. Nodes are connected by data links forming
the network. Each node is separately addressable on the network.
Online
(Normal) state of the data link layer. Application and Network
Management communication are possible.
OSEK
Name of the overall project: Abbreviation of the German term "Offene
Systeme und deren Schnittstellen für die Elektronik im Kraftfahrzeug" -
Open Systems and the Corresponding Interfaces for Automotive
Electronics.
2013, Vector Informatik GmbH
Version: 2.10.03
112 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
Protocol
A formal set of conventions or rules governing the exchange of
information between protocol entities. Protocol comprises syntax and
semantics of the protocol messages as well as the instructions on how to
react to them.
Register
A register is a memory area in the controller, e.g. in the CAN controller.
Distinguish register from Buffer.
Release
State transition of a task from waiting to ready. At least one event has
occurred which a task has waited on.
Request
A service primitive in compliance with the ISO/OSI Reference Mode (ISO
7498). With the service primitive 'request' a service user requests a
service from a service provider.
Resource
Generally, resources are hardware or software components which are
managed by the operating system. The OSEK operating system provides
resources to support task coordination by mutual exclusion of critical
sections. As an example, the scheduler is treated like a resource. A task
which holding the scheduler cannot be interrupted by all other tasks.
Resource Management. Access control for inseparable operations to
jointly used (logic) resources or devices, or for control of a program flow.
Response
A service primitive defined in the ISO/OSI Reference Model (ISO 7498).
The service primitive 'response' is used by a service user in order to reply
to a preceding indication from service provider.
Running
A task state. In the running state, the CPU is assigned to the task, so that
its instructions can be executed. Only one task can be in this state at any
point in time. The state is entered by the state transition start and can be
exited via the state transitions Wait, Preempt or Terminate.
Safety
A situation in which the risk is equal or lower than the limit risk. Risk is a
measure which considers both the probability of an accident and the
expected extend of damage in the case of an accident. The limit risk is
the highest risk which is still justifiable.
Software specification A software specification is a set of requirements that can be of different
types, as behavior, interfaces, timing constraints, needed resources,
safety, etc.
Start
State transition of a task from ready to running. A ready task selected by
the scheduler is executed.
SWC
Software Component, application software entity in AUTOSAR
Task
A task provides the framework for the execution of functions. Therefore a
task has a context of its own, i.e. a stack, a register retrieval range and a
memory of its own. A task can be executed in principle on a processor
concurrently with other tasks. A task is executed under the control of the
scheduler according to the task priority assigned to it, and to the selected
scheduling policy. A distinction is made between basic tasks and
extended task.
Task level
Processing level where the actual application software, is executed.
Tasks are executed according to the priority assigned to them, and to the
selected scheduling policy. Other processing levels are: Interrupt level
and operating system level.
Task priority
The priority of a task is a measure for the precedence with which the task
is to be executed. In principle, priorities are defined statically. However, in
particular cases (see Priority Ceiling Protocol) a task can be processed
2013, Vector Informatik GmbH
Version: 2.10.03
113 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
by the operating system with a defined higher priority. As a capability of
the CC, tasks of the same priority are admissible within a system. Tasks
of equal priority are started according to the order in which they are
called. To this effect, extended tasks which change from the waiting state
into the ready state are treated like new tasks.
Validation
Confirmation by examination and provision of objective evidence that the
particular requirements for a specific intended use are fulfilled. Ensuring
the correctness of a specification.
wait
State transition of a task from running to waiting. The running task
requires an event to continue operation. It causes its transition into the
waiting state by using a system service.
Window
Communication object of the data link layer for sending and receiving NM
messages.
8.2 Abbreviations Abbreviation Description API
Application Programming Interface
AUTOSAR
Automotive Open System Architecture
BSW
Basis Software
CCL
Communication Control Layer
COM
Communication Layer
CPU
Central Processing Unit
DM
Deadline Monitoring
ECU
Electronic Control Unit
IL
Interaction Layer
IRQ
Interrupt Request
ISO
International Standardization Organization
ISR
Interrupt Service Routine
MICROSAR
Microcontroller Open System Architecture (the Vector AUTOSAR
solution)
NM
Network Management
OEM
Original Equipment Manufacturer
OS
Operating System
OSI
Open Systems Interconnection
RAM
Random Access Memory
RDS
Read Data Segment
ROM
Read-Only Memory
SRS
Software Requirement Specification
SWC
Software Component
SWS
Software specification
2013, Vector Informatik GmbH
Version: 2.10.03
114 / 115
based on template version 3.7

Technical Reference Vector Interaction Layer
9 Contact Visit our website for more information on
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector-informatik.com 2013, Vector Informatik GmbH
Version: 2.10.03
115 / 115
based on template version 3.7
Document Outline
1.1.42 - TechnicalReference_Nm_IndOsek
TechnicalReference1.1.44 - TechnicalReference_Nm_IndOseks
Nm_IndOsek Technical Reference
Indirect Network Management
Version 1.12
Authors: Markus Schwarz
Version: 1.12
Status: released (in preparation/completed/inspected/released)

TechnicalReference Nm_IndOsek
1 Document Information 1.1 History Author Date Version Remarks Ralf Fritz
21.06.2001
1.00
Creation of this document
Ralf Fritz
01.10.2001
1.01
User value support added,
Multiple ECU added
Dieter Schaufelberger
2002-02-28
1.02
ApplInmNmInitVolatileCounters(
) and Macros added
Dieter Schaufelberger
2002-08-15
1.03
Adoptions to new system
structure
Dieter Schaufelberger
2002-09-11
1.04
Description of the database
attributes revised
Dieter Schaufelberger
2002-10-22
1.05
Revision
Inserted new chapter:
Particularities of RENAULT Bus
Off supervision
Dieter Schaufelberger
2002-11-28
1.06
Revision
New configuration features
Dieter Schaufelberger
2003-07-31
1.07
Correction in the attribute part
Dieter Schaufelberger
2004-04-05
1.08
Inserted Support of LEVEL 3
Dieter Schaufelberger
2004-10-20
1.09
New OSEK_INM Version 2.0
Markus Schwarz
2006-09-12
1.10
Changed chapter 1.1, new
layout
Markus Schwarz
2006-12-19
1.11
Revision and rework
Markus Schwarz
2008-01-21
1.12
added chapter on configuration
with GENy
Table 1-1
History of the Document
1.2 Reference Documents Index Document [UR_01]
OSEK/VDX Network Management 2.53
[UR_02]
Specification of the generic communication layers for CAN embedded networks
at RENAULT & PSA
Version 2.1 dated 04/01/98
referenced RENAULT: DIV/D3E/60601/98/032gb
Table 1-2
References Documents
©2008, Vector Informatik GmbH
Version: 1.12
2 / 55
based on template version 1.9


TechnicalReference Nm_IndOsek
1.3 Abbreviations & Acronyms Abbreviation Complete expression CAN Controller
Area
Network
ECU Electronic
Control
Unit
IL Interaction
Layer
NM Network
Management
Note: Within this document, NM refers to Nm_IndOsek
OEM
Original Equipment Manufacturer
Table 1-3
Abbreviations & acronyms
1.4 Naming Convention Naming Description Nm_IndOsek
Refers to the Vector CANbedded software component that handles the
indirect network management.
Table 1-4
Naming convention
Please note
We have configured the programs in accordance with your specifications in the
questionnaire. Whereas the programs do support other configurations than the one
specified in your questionnaire, Vector’s release of the programs delivered to your
company is expressly restricted to the configuration you have specified in the
questionnaire.
©2008, Vector Informatik GmbH
Version: 1.12
3 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
Contents 1 Document Information ............................................................................................... 2 1.1 History .......................................................................................................... 2 1.2 Reference Documents ................................................................................. 2 1.3 Abbreviations & Acronyms ........................................................................... 3 1.4 Naming Convention...................................................................................... 3 2 Overview ..................................................................................................................... 9 2.1 Delivery Package ......................................................................................... 9 2.2 Concept...................................................................................................... 10 3 Features .................................................................................................................... 11 3.1 General .......................................................................................................11 3.1.1 Overview .....................................................................................................11 3.1.2 Control.........................................................................................................11 3.1.3 Event Notification ........................................................................................11 3.1.4 Event Processing ........................................................................................11 3.1.5 Status Information ...................................................................................... 12 3.2 RX Supervision .......................................................................................... 13 3.2.1 Overview .................................................................................................... 13 3.2.2 Control........................................................................................................ 13 3.2.3 Event Notification ....................................................................................... 13 3.2.4 Status Information ...................................................................................... 13 3.3 TX Supervision........................................................................................... 14 3.3.1 Overview .................................................................................................... 14 3.3.2 Control........................................................................................................ 14 3.3.3 Event Notification ....................................................................................... 14 3.3.4 Status Information ...................................................................................... 14 3.4 BusOff Supervision .................................................................................... 15 3.4.1 Overview .................................................................................................... 15 3.4.2 Control........................................................................................................ 15 3.4.3 Event Notification ....................................................................................... 15 3.4.4 Status Information ...................................................................................... 15 3.4.5 Others ........................................................................................................ 15 3.5 Generic Supervision................................................................................... 16 3.5.1 Overview .................................................................................................... 16 3.5.2 Control........................................................................................................ 16 3.5.3 Event Notification ....................................................................................... 16 3.5.4 Status Information ...................................................................................... 16 ©2008, Vector Informatik GmbH
Version: 1.12
4 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
3.5.5 Others ........................................................................................................ 16 4 Integration................................................................................................................. 17 4.1 Involved Files ............................................................................................. 17 4.2 Include Structure ........................................................................................ 17 4.3 Necessary Steps to Integrate the NM in Your Project ................................ 18 4.4 Necessary Steps to Run the NM ................................................................ 18 5 Configuration............................................................................................................ 19 6 Integration Hints ....................................................................................................... 22 6.1 CANbedded stack ...................................................................................... 22 6.1.1 Vector Station Manager .............................................................................. 22 6.2 Special use-cases ...................................................................................... 22 6.2.1 Multiple ECUs ............................................................................................ 22 7 Related Files ............................................................................................................. 23 7.1 Static Files.................................................................................................. 23 7.2 Dynamic Files............................................................................................. 23 8 API Description......................................................................................................... 24 8.1 General ...................................................................................................... 24 8.1.1 Multi channel usage ................................................................................... 24 8.2 API ............................................................................................................. 25 8.2.1 NM Handler ................................................................................................ 26 8.2.2 RX Supervision .......................................................................................... 30 8.2.3 TX Supervision........................................................................................... 33 8.2.4 BusOff Supervision .................................................................................... 36 8.2.5 User-specific Supervision........................................................................... 39 8.3 Callbacks.................................................................................................... 42 8.3.1 NM Handler ................................................................................................ 43 8.3.2 RX Supervision .......................................................................................... 44 8.3.3 TX Supervision........................................................................................... 46 8.3.4 BusOff Supervision .................................................................................... 48 8.3.5 Generic Supervision................................................................................... 50 8.4 Other Interfaces ......................................................................................... 52 8.4.1 Version Information .................................................................................... 52 9 Working with the Code............................................................................................. 53 9.1 Version Information .................................................................................... 53 9.2 Application Interface................................................................................... 53 ©2008, Vector Informatik GmbH
Version: 1.12
5 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
10 CANdb Attributes ..................................................................................................... 54 ©2008, Vector Informatik GmbH
Version: 1.12
6 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
Illustrations Figure 2-1 Concept of NM within the CANbedded stack.................................................. 10 Figure 4-1 Include structure ............................................................................................. 17 Figure 5-1 System-specific configuration ......................................................................... 19 Figure 5-2 Channel-specific configuration........................................................................ 21 Tables Table 1-1 History of the Document .................................................................................. 2 Table 1-2 References Documents ................................................................................... 2 Table 1-3 Abbreviations & acronyms ............................................................................... 3 Table 1-4 Naming convention .......................................................................................... 3 Table 3-1 Description of supervision error states........................................................... 12 Table 5-1 System-specific configuration ........................................................................ 20 Table 5-2 Channel-specific configuration....................................................................... 21 Table 8-1 Overview API ................................................................................................. 25 Table 8-2 Overview callbacks ........................................................................................ 42 Table 10-1
CANdb attributes ........................................................................................... 55
©2008, Vector Informatik GmbH
Version: 1.12
7 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
Introduction This document describes the software component that implements the indirect network
management.
The functionality of this NM is handled by the Vector CANbedded component
“Nm_IndOsek”.
This document contains
A brief description of the NM (chapter “
3 Features”) A description of how to integrate the NM (chapter “
4 Integration”) A description of how to configure the NM (chapter “
5 Configuration”) A description of the API of the NM (chapter “
8 API Description”) Hints on integration (chapter “
6 Integration Hints“)
©2008, Vector Informatik GmbH
Version: 1.12
8 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
2 Overview The component Nm_IndOsek provides network services for an application operating on a
CAN bus. These services are mainly:
Supervision of one TX message for each channel
Supervision of multiple RX messages
Supervision of BusOff events for each channel
Supervision of user-specific events for each channel
The overall task of the Nm_IndOsek is to detect communication problems and to inform
the application about these problems.
2.1 Delivery Package The delivery package includes:
source code and header files (see chapter “
7 Related Files”) technical reference (this document)
DLL for configuration tool GENy
©2008, Vector Informatik GmbH
Version: 1.12
9 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
2.2 Concept ApplicationInteraction
Nm_IndOsek
Layer
CAN Driver
CAN Con
N Co troller
Tra
Tr nscei
sc ver
Figure 2-1 Concept of NM within the CANbedded stack
The Nm_IndOsek supervises events. These events can be signaled from the CAN driver,
the IL and/or the application.
The NM is initialized and controlled by the application. Status changes are signalized with
the help of callback functions. These callback functions have to be provided by the
application (see chapter “8.3 Callbacks”).
The Nm_IndOsek can be used in following configurations
Single channel ECUs
Multi channel ECUs
Multiple ECUs (refer to chapter “
6.2.1 Multiple ECUs”) ©2008, Vector Informatik GmbH
Version: 1.12
10 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
3 Features 3.1 General The Nm_IndOsek is an NM that uses periodic application messages to determine the
network state.
It is a de-central NM. There is no NM master.
3.1.1 Overview The Nm_IndOsek is an event manager that can handle the following events
RX messages
TX messages
BusOff events
User-specific events (=”Generic”)
The Nm_IndOsek does not monitor/detect the events itself. Instead, it only supervises and
manages the state of these events.
It is up the IL and/or the application to inform the Nm_IndOsek about the occurrence/non-
occurrence (=timeout) of an event.
If an event is absent for approx. 2 seconds, the event-related system part is confirmed
absent.
If an event occurs again, the event-related system part is present again.
The Nm_IndOsek informs higher layers about the status of the supervised event. The
higher layers can use this information to store diagnostic entries in non-volatile memory.
3.1.2 Control The Nm_IndOsek can be started/sopped by the application (
InmNmStart(), InmNmStop()).
Any supervision is only possible when the NM is running.
The Nm_IndOsek can start/stop all supervisions globally (
InmNmDiagOn(),
InmNmDiagOff()) as well as individually for each event handler.
3.1.3 Event Notification The Nm_IndOsek offers an interface for each event handler that allows the components
that detect an event (e.g. IL) to notify an event and/or an event timeout.
3.1.4 Event Processing When an event or an event timeout is notified, the Nm_IndOsek updates the status for this
event. The status consists of a supervision counter and a related error state.
The supervision counter is incremented upon an event timeout and decremented upon an
event notification. The values for the increment/decrement are mostly generated by the
©2008, Vector Informatik GmbH
Version: 1.12
11 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
configuration tool. In case of RX or TX message events, these values are derived from the
message attributes in the DBC file (see chapter “10 CANdb Attributes”).
The values are chosen in a way that any event is reported confirmed absent approx. 2
seconds after its last occurrence.
The error state is related to the supervision counter (see
Table 3-1).
State Description OK
This state is entered when an event is notified.
Note: This state can occur even if the supervision counter is not 0.
Failure
This state is entered when an event timeout is notified.
Confirmed Failure
This state is entered when there is no notification of the event for approx. 2
seconds, i.e. the supervision counter reaches its upper limit (0xFF).
Table 3-1
Description of supervision error states
3.1.5 Status Information The Nm_IndOsek offers an interface that can be used to retrieve the current status of each
event handler individually.
The application is also notified about any status change with the help of a callback that is
unique for each event type.
©2008, Vector Informatik GmbH
Version: 1.12
12 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
3.2 RX Supervision The Nm_IndOsek implements a supervision for RX messages.
3.2.1 Overview The RX supervision is a message-specific event supervision. The RX supervision is
always enabled.
There can be multiple supervised RX messages. These messages are marked in the DBC
file (see chapter “10 CANdb Attributes”).
There should be only one supervised RX message for each network node that is meant to
be supervised.
All APIs related to RX supervision have a parameter “index”. This parameter is a handle of
the relevant RX message that has to be supervised. The index itself is provided by the
ECU configuration file (e.g. board1.h).
3.2.2 Control The RX supervision gets activated/de-activated together with the NM generic supervision
(InmNmDiagOn(),InmNmDiagOff()). There is an API that activates/de-activates the RX supervision individually, independent of
the NM generic supervision st
ate (InmNmRxDiagOn(), InmNmRxDiagOff()). 3.2.3 Event Notification The Nm_IndOsek offers an interface that allows the system to notify a RX event
(InmNmRxOk()) and a RX timeout event (InmNmRxTimeOut()).
3.2.4 Status Information The application can retrieve the current status of the TX supervision
(InmNmRxTimeOut()).The status information contains the error state and the value of the
supervision counter.
The application is also notified about any status change with the help of callback
ApplInmNmStatusIndicationRx().
©2008, Vector Informatik GmbH
Version: 1.12
13 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
3.3 TX Supervision The Nm_IndOsek implements a supervision for TX messages.
3.3.1 Overview The TX supervision is a channel-specific event supervision. The TX supervision is always
enabled.
There can be only one supervised TX message for each channel. This message is marked
in the DBC file (see chapter “10 CANdb Attributes”).
3.3.2 Control The TX supervision gets activated/de-activated together with the NM generic supervision
state (
InmNmDiagOn(),InmNmDiagOff()). There is an API that activates/de-activates the TX supervision individually, independent of
the NM generic supervision (InmNmTxDiagOn(), InmNmTxDiagOff()). 3.3.3 Event Notification The Nm_IndOsek offers an interface that allows the system to notify a TX event
(InmNmTxOk()) and a TX timeout event (
InmNmTxTimeOut()).
3.3.4 Status Information The application can retrieve the current status of the TX supervision
(InmNmGetTxCondition()).The status information contains the error state and the value of
the supervision counter.
The application is also notified about any status change with the help of callback
ApplInmNmStatusIndicationTx(). ©2008, Vector Informatik GmbH
Version: 1.12
14 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
3.4 BusOff Supervision The Nm_IndOsek implements a BusOff supervision and a notification mechanism for
BusOff recovery.
The Nm_IndOsek does not do any BusOff recovery itself!
3.4.1 Overview The BusOff supervision is a channel-specific event supervision. This supervision can be
enabled/disabled within the component configuration, i.e. during configuration time.
Any data or API is only available and relevant if this feature is enabled.
3.4.2 Control The BusOff supervision gets activated/de-activated together with the NM generic
supervision (InmNmDiagOn(),InmNmDiagOff()). There is an API that can activate/de-activate the BusOff supervision individually,
independent of the NM generic supervision st
ate (InmNmBusOffDiagOn(),
InmNmBusOffDiagOff()).
3.4.3 Event Notification The Nm_IndOsek offers an interface that allows the system to notify a BusOff event
(InmNmBusOff()). This event is typically signaled by the CAN driver and can occur on
interrupt level.
There is no API to indicate a non-BusOff. The disappearance of the BusOff is detected
within the component Nm_IndOsek as soon as successful RX or TX event is reported.
3.4.4 Status Information The application can retrieve the current status of the BusOff supervision
(InmNmGetBusOffStatus()). The application is also notified about any status change with the help of callback
ApplInmNmStatusIndicationBusOff(). 3.4.5 Others As the BusOff supervision is based on a timer and not directly on an event counter, the
Nm_IndOsek needs a constant time base. This time base is provided by the cyclic task
function
InmNmTask(). This function has to be called cyclically by the application with the
constant period defined within th
e configuration (see chapter “5 Configuration”).
©2008, Vector Informatik GmbH
Version: 1.12
15 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
3.5 Generic Supervision The Nm_IndOsek implements a supervision for a user-specific event. This user-specific
event is called “GenericUser”
3.5.1 Overview The GenericUser supervision is a channel-specific event supervision. This supervision can
be enabled/disabled within the component configuration, i.e. during configuration time.
Any data or API is only available and relevant if this feature is enabled.
3.5.2 Control The GenericUser supervision gets activated/de-activated together with the NM generic
supervision (InmNmDiagOn(),InmNmDiagOff()). There is an API that can activate/de-activate the GenericUser supervision individually,
independent of the NM generic supervision (
InmNmGenericDiagOn(),
InmNmGenericDiagOff()). 3.5.3 Event Notification The Nm_IndOsek offers an interface that allows the system to notify a GenericUser event
(InmNmGenericOk(), InmNmGenericTimeOut()). 3.5.4 Status Information The application can retrieve the current status of the GenericUser supervision
(InmNmGetGenericCondition()). The status information contains the error state and the
value of the supervision counter.
The application is also notified about any status change with the help of callback
ApplInmNmStatusIndicationGeneric(). 3.5.5 Others The GenericUser supervision has to be configured by the application.
The application has to provide the following arrays:
V_MEMROM0 extern V_MEMROM1 inmNmCounterType V_MEMROM2
inmkIncGeneric[INM_CHANNELS];
V_MEMROM0 extern V_MEMROM1 inmNmCounterType V_MEMROM2
inmkDecGeneric[INM_CHANNELS];
These arrays must contain the channel-specific values that are used to
increment/decrement the supervision counter in case the application reports an event or a
timeout of the event.
©2008, Vector Informatik GmbH
Version: 1.12
16 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
4 Integration 4.1 Involved Files To integrate the NM in your project, you need the files that are lis
ted in chapter “7 Related
Files”. 4.2 Include Structure The include structure of the
involved files is shown in Figure 4-1.
id IncludeStructureApplicationSystemHeaderNm_IndOsekv _cfg.hv _def.hinm_osek.cinm_osek.hCANdriv erHeadercan_inc.hinm_cfg.hinm_par.cboard1.hdynam ic fi les
stati c fi les
user-specific fil e
generated by
=> do not m odify
=> all owed to
configuration tool
m odify
=> do not m odify
Figure 4-1 Include structure
©2008, Vector Informatik GmbH
Version: 1.12
17 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
4.3 Necessary Steps to Integrate the NM in Your Project Following steps may be necessary to integrate the NM in your project:
Copy the NM related files into your project tree.
Make these files available in your project settings, e.g. set the correct paths in your
makefile.
In order to make the NM available to your application, include the component header
file (inm_osek.h) into all files that make use of NM services and functions.
Configure the NM according to your needs (see chapter “5 Configuration”). Implement all necessary callbacks in your applic
ation (see chapter “8.3 Callbacks”). Build your project (compile & link).
4.4 Necessary Steps to Run the NM The NM should already have been integrated in your project and the building process
should complete without any errors.
There are two main steps that have to be performed:
Initialization
Initialize the CAN Driver by calling CanInitPowerOn() after each reset during start-up
and before initializing the NM. Interrupts have to be disabled until the complete
initialization procedure is done.
Initialize the NM by calling
InmNmInit() during start-up. This API has to be called for
each NM channel separately.
Cyclic call of task functions
If you are using the BusOff supervision, add a cyclic function call of
InmNmTask() to your runtime environment. Ensure that the call cycle matches the value that is
configured in the configuration file.
Add the required NM services to your application.
Especially use the
API InmNmStart()and
InmNmStop() to start and stop the Nm_IndOsek.
©2008, Vector Informatik GmbH
Version: 1.12
18 / 55
based on template version 1.9


TechnicalReference Nm_IndOsek
5 Configuration The configuration data is stored in the following files:
Inm_cfg.h contains
system-specific
value definitions and defines that
enable/disable system-specific features
Inm_par.c contains channel-specific value definitions
These files are created with the help of a PC-based configuration tool.
Settings for the NM can be selected in the GUI. These settings are used to generate the
configuration files, which are needed to compile the component.
The configuration options for Nm_IndOsek are mainly derived from the settings in the DBC
file. There are not much options in the GUI.
Note: The Nm_IndOsek is configured together with an OEM-specific station manager.
Figure 5-1 System-specific configuration
There are some configurations options that are directly related to the attribute definitions in
the DBC file, mostly the used OEM. These configuration options can’t be changed in the
GUI of the configuration tool.
©2008, Vector Informatik GmbH
Version: 1.12
19 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
Attribute Description User Configuration File
A configuration file is generated by GENy. If you want to overwrite settings in the
generated configuration file, you can specify a path to a user defined
configuration file. The user defined configuration file will be included at the end of
the generated file. Therefore definitions in the user defined configuration file can
overwrite definitions in the generated configuration file.
Callback for
Enables/disables a feature that reports the presence of a supervised event not
ConfirmedPresent
before it gets” confirmed present”, i.e. the supervision counter reaches 0.
If enabled, the callback for status indication is only executed when the
corresponding error counter reaches 0.
If disabled, the callback is executed each time when the corresponding error
counter is decremented.
Init on DiagOn
Enables/disables a feature that re-initializes the status of a supervised event
when the supervision for this event is started.
Init on DiagOff
Enables/disables a feature that re-initializes the status of a supervised event
when the supervision for this event is stopped.
Clear Counter
Enables/disables a feature that confirms the presence of an event upon the first
detection of that event, i.e. the event supervision counter is immediately set to 0
when the event happens.
If enabled, the error counter of the sub module (RX, TX, Generic) is reset when
the message/event is reported present the first time.
If disabled, the error counter is decremented upon each reported presence.
User-specific
Enables/disables a feature that lets the application set the (re-)initialization status
initialization
of the supervised events. Instead of using the internal default values, the
application is notified to set the initial status within callbacks ApplInm…UserInit()
and ApplInmNm…UserReInit()
If enabled, the initialization and re-initialization of the sub modules (RX, TX,
Generic, BusOff) can be done by the application. The application is notified by
callbacks about the need for the corresponding (re-)initialization.
If disabled, the Nm_IndOsek (re-)initializes the status itself to the (internal) default
values.
Assertions
The SW component provides built-in debug support (assertion) to ease up the
integration and test into the user's project. Please see the technical reference for
detailed information on the available options and how to use them.
In general, the usage of assertions is recommended during the integration and
pre-test phases. It is not recommended to enable the assertions in production
code due to increased runtime and ROM needs.
The assertion checks the correctness of the assigned condition and calls an error
handler in case this fails. The error handler is called with an error number.
Information about the defined error numbers is given in the technical reference.
User Event Supervision
Enables/disables a feature to supervise user-specific events. The
increment/decrement values for event occurrence are channel-specific, i.e. they
are configured within the channel-specific settings.
BusOff Supervision
Enables/disables a feature to supervise BusOff events.
Table 5-1
System-specific configuration
©2008, Vector Informatik GmbH
Version: 1.12
20 / 55
based on template version 1.9


TechnicalReference Nm_IndOsek
Figure 5-2 Channel-specific configuration
Attribute Description Increment
Defines the increment value that is used when the user-specific event is detected
as absent (timeout of event).
This value can be calculated with the folllowing formula:
(<Time_EventTimeout> / 2000) * 255
This value is only configurable if the system-specific NM attribute 'User Event
Supervision' is enabled.
Decrement
Defines the increment value that is used when the user-specific event is detected
as present (occurrence of event).
This value can be calculated with the following formula:
(<Time_EventCycle> / 2000) * 255
This value is only configurable if the system-specific NM attribute 'User Event
Supervision' is enabled.
Cycle Time [ms]
Defines the cycle time of the NM task function in [ms].
This value is only configurable when the system-specific NM attribute 'BusOff
Supervision' is enabled, as task is only required for BusOff supervision.
Please ensure that the configured value matches the actual call cycle of the task
function in your system.
Table 5-2
Channel-specific configuration
©2008, Vector Informatik GmbH
Version: 1.12
21 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
6 Integration Hints 6.1 CANbedded stack 6.1.1 Vector Station Manager The Vector Station Manager uses the Nm_IndOsek.
The Station Manager completely covers the necessary interfaces and control methods for
the Nm_IndOsek. The Station Manager
Handles the RX timeout monitoring
Handles the TX timeout monitoring
Handles the initialization and the re-initialization
Handles the start/stop of the Nm_IndOsek
6.2 Special use-cases 6.2.1 Multiple ECUs The Nm_IndOsek supports multiple ECUs. A multiple ECU contains more than one ECU.
The currently active ECU can be determined dynamically at power-on.
The Nm_IndOsek of multiple ECUs handles the RX and TX messages of all ECU
instances in a common algorithm.
The Nm_IndOsek uses only one TX supervision. As there are multiple supervised TX
messages when using multiple ECUs, the Nm_IndOsek would react on all event
notifications of any supervised TX message. Therefore the IL has to ensure that the
timeout notifications of all TX messages that are not relevant for the current ECU are not
processed.
Please refer to the documentation of the IL for more details.
However, it is not necessary to stop the event notification of irrelevant RX messages within
the IL. These RX messages might still be processed by the Nm_IndOsek. It is up to the
application to ignore the related status indications of those RX messages.
©2008, Vector Informatik GmbH
Version: 1.12
22 / 55
based on template version 1.9



TechnicalReference Nm_IndOsek
7 Related Files 7.1 Static Files Inm_osek.c
This is the source file of the NM. It contains all API and
algorithms.
Inm_osek.h
This is the header file of the NM. It contains all static prototypes
for the API and definitions, such as symbolic constants.
Caution
It is not allowed to change the NM source code during the integration into the
application. Please contact the Vector hotline if any problems arise.
7.2 Dynamic Files The dynamic files are created by the configurati
on tool (see chapter “5 Configuration”).
inm_cfg.h
This is the configuration file for system-specific items of the NM.
It defines features and certain values of the NM.
inm_par.c
This is the configuration file for channel-specific items of the
NM. It defines features and certain values of the NM.
Caution
Do not change anything within the dynamic files, as the changes will be overwritten
when the configuration tool generates these files the next time.
©2008, Vector Informatik GmbH
Version: 1.12
23 / 55
based on template version 1.9




TechnicalReference Nm_IndOsek
8 API Description The API of the NM consists of services that are realized by function calls. These services
can be called whenever they are required. They transfer information to the NM or take over
information from the NM.
If not stated otherwise, the API of the NM is not re-entrant.
Info A function is re-entrant if it can be safely called recursively or from multiple processes.
Note The application functions must match the required interfaces.
This can be ensured by including the header file *.h in the modules which provide the
required application functions. If these interfaces do not match, unexpected run-time
behavior may occur.
These functions are not allowed to change the interrupt status.
8.1 General 8.1.1 Multi channel usage Most API functions of multi-channel systems require a channel parameter.
The channel parameter inm_channel represents an NM-internal channel. Possible values
are: 0…max(NM channel).
Note The Nm_IndOsek uses internal NM channels within the parameter list.
©2008, Vector Informatik GmbH
Version: 1.12
24 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.2 API NM RX TX BusOff User-specific supervision supervision supervision supervision Init
InmNmInit()
InmNmReInit() Control
InmNmStart()
InmNmStop() Control
InmNmDiag
InmNmRxDia
InmNmTxDia
InmNmBusOf
InmNmGenersupervision
On() gOn() gOn() fDiagOn() icDiagOn()
InmNmDiag
InmNmRxDia
InmNmTxDia
InmNmBusOf
InmNmGenerOff() gOff() gOff() fDiagOff() icDiagOff() Status
InmNmGetSt
InmNmGetR
InmNmGetTx
InmNmGetB
InmNmGetGinformation
atus() xCondition() Condition() usOffStatus() enericConditi
on() Event
InmNmRxOk
InmNmTxOk(
InmNmBusOf
InmNmGenernotification
() ) f() icOk()
InmNmRxTi
InmNmTxTim
InmNmGenermeOut() eOut() icTimeOut() Others
InmNmTask() Table 8-1
Overview API
©2008, Vector Informatik GmbH
Version: 1.12
25 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.2.1 NM Handler InmNmInit()Prototype Single channel
void
InmNmInit ( void )
Multi channel
void
InmNmInit ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
---
Functional Description This function initializes the component Nm_IndOsek.
All internal states and variables are initialised.
This function has to be called once after power-on reset, while interrupts are disabled.
This function initializes all available sub-components.
Particularities and Limitations Has to be called with disabled CAN interrupts.
InmNmReInit()Prototype Single channel
void
InmNmReInit ( void )
Multi channel
void
InmNmReInit ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
---
Functional Description This function re-initializes the Nm_IndOsek.
Only some internal states and variables are re-initialised.
A re-initialization does not affect the status of the NM handler, i.e. the NM itself stays in the same state as
before (started or stopped).
This function re-initializes all available sub-components.
Particularities and Limitations The NM has to be initialized before.
©2008, Vector Informatik GmbH
Version: 1.12
26 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
InmNmStart()Prototype Single channel
void
InmNmStart ( void )
Multi channel
void
InmNmStart ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
---
Functional Description This function starts the Nm_IndOsek if it is not already running.
The application is informed about the current status of all available sub-components with the help of the
corresponding callback functions.
The application is informed about the start of the NM with the help of callback
ApplInmNmStartCanIl().
Particularities and Limitations The NM has to be initialized before.
InmNmStop()Prototype Single channel
void
InmNmStop ( void )
Multi channel
void
InmNmStop ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
---
Functional Description This function stops the Nm_IndOsek if it is not already stopped.
The supervision of all available sub-components is stopped.
The application is informed about the stop of the NM with the help of callbac
k ApplInmNmStopCanIl(). Particularities and Limitations The NM has to be initialized before.
©2008, Vector Informatik GmbH
Version: 1.12
27 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
InmNmDiagOn()Prototype Single channel
void
InmNmDiagOn ( void )
Multi channel
void
InmNmDiagOn ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
---
Functional Description This function starts the network supervision for all available sub-components.
Starting the supervision is only possible if the NM is started.
Particularities and Limitations The NM has to be started before (=>
InmNmStart() has to be called before)
InmNmDiagOff()Prototype Single channel
void
InmNmDiagOff ( void )
Multi channel
void
InmNmDiagOff ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
---
Functional Description This function stops the network supervision for all available sub-components.
Stopping the supervision is only possible if the NM is started. If the NM gets stopped (
InmNmStop()), the
supervision is also stopped automatically.
Particularities and Limitations The NM has to be started before (=>
InmNmStart() has to be called before)
©2008, Vector Informatik GmbH
Version: 1.12
28 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
InmNmGetStatus()Prototype Single channel
inmNmStatusType
InmNmGetStatus ( void )
Multi channel
inmNmStatusType
InmNmGetStatus ( inmNmChannelType
inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code inmNmStatusType
Status of NM:
INM_NM_ON : NM is running
INM_NM_OFF: NM is not running
Functional Description This function returns the current status of the NM.
Particularities and Limitations The NM has to be initialized before.
©2008, Vector Informatik GmbH
Version: 1.12
29 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.2.2 RX Supervision InmNmRxDiagOn()Prototype Single channel
void
InmNmRxDiagOn ( const inmNmIndexType index )
Multi channel
void
InmNmRxDiagOn ( const inmNmIndexType index )
Parameter index
Handle of the supervised RX message.
Return code ---
Functional Description This function starts the supervision of the RX message that is given by parameter <index>.
This message is under supervision until the supervision is stopp
ed (InmNmRxDiagOff() or InmNmDiagOff()) or the
NM is stopped (
InmNmStop()). This function has only effect if the NM is runn
ing, i.e. InmNmStart() has been called. It is not possible to enable the
supervision when the NM is stopped.
Particularities and Limitations Dependent on the OEM, the supervision status gets re-initialized when supervision is started.
InmNmRxDiagOff()Prototype Single channel
void
InmNmRxDiagOff ( const inmNmIndexType index )
Multi channel
void
InmNmRxDiagOff ( const inmNmIndexType index )
Parameter index
Handle of the supervised RX message.
Return code ---
Functional Description This function stops the supervision of the RX message that is given by parameter <index>.
The supervision is automatically stopped when all supervisions are stoppe
d (InmNmDiagOff())) or when the NM is
stoppe
d (InmNmStop()). Particularities and Limitations Dependent on the OEM, the supervision status gets re-initialized when supervision is stopped.
©2008, Vector Informatik GmbH
Version: 1.12
30 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
InmNmRxOk()Prototype Single channel
void
InmNmRxOk ( const inmNmIndexType index )
Multi channel
void
InmNmRxOk ( const inmNmIndexType index )
Parameter index
Handle of the supervised RX message.
Return code ---
Functional Description Successful RX notification
This function is normally called by the interaction layer. It informs the INM OSEK about an successfully reception of an
observed message. In this function the volatile and non volatile reception and Bus-Off counter are reduced depending
on the current state.
Particularities and Limitations
InmNmRxTimeOut()Prototype Single channel
void
InmNmRxTimeOut ( const inmNmIndexType index )
Multi channel
void
InmNmRxTimeOut ( const inmNmIndexType index )
Parameter index
Handle of the supervised RX message.
Return code ---
Functional Description This function is normally called by the interaction layer. It informs the INM OSEK that an observed message can’t be
received during a certain time. In this function the volatile and non volatile reception counter are reduced depending on
the current state.
Particularities and Limitations
©2008, Vector Informatik GmbH
Version: 1.12
31 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
InmNmGetRxCondition()Prototype Single channel
inmNmConditionType *
InmNmRxTimeOut ( const inmNmIndexType
index )
Multi channel
inmNmConditionType *
InmNmRxTimeOut ( const inmNmIndexType
index )
Parameter index
Handle of the supervised RX message.
Return code inmNmConditionType
Reference to condition struct
inmNmConditionType Functional Description This function returns the current condition of the supervised ECU. The values can be modified by the application.
Particularities and Limitations
©2008, Vector Informatik GmbH
Version: 1.12
32 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.2.3 TX Supervision InmNmTxDiagOn()Prototype Single channel
void
InmNmTxDiagOn ( void )
Multi channel
void
InmNmTxDiagOn ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description This function starts the supervision of the TX message.
This message is under supervision until the supervision is stopp
ed (InmNmTxDiagOff()or
InmNmDiagOff()) or the
NM is stopped (
InmNmStop()). This function has only effect if the NM is runn
ing, i.e. InmNmStart() has been called. It is not possible to enable the
supervision when the NM is stopped.
Particularities and Limitations Dependent on the OEM, the supervision status gets re-initialized when supervision is started.
InmNmTxDiagOff()Prototype Single channel
void
InmNmTxDiagOff ( void )
Multi channel
void
InmNmTxDiagOff ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description This function stops the supervision of the TX message.
The supervision is automatically stopped when all supervisions are stoppe
d (InmNmDiagOff())) or when the NM is
stoppe
d (InmNmStop()). Particularities and Limitations Dependent on the OEM, the supervision status gets re-initialized when supervision is stopped.
©2008, Vector Informatik GmbH
Version: 1.12
33 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
InmNmTxOk()Prototype Single channel
void
InmNmTxOk ( void )
Multi channel
void
InmNmTxOk ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code Functional Description Transmit successful notification
This function will normally called by the interaction layer. It informs the INM OSEK about an successfully transmission of
the message which should be observed.
Particularities and Limitations
InmNmTxTimeOut()Prototype Single channel
void
InmNmTxTimeout ( void )
Multi channel
void
InmNmTxTimeout ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description Transmit time out notification
This function is normally called by the interaction layer. It informs the INM OSEK that the observed message couldn’t be
send at the moment.
The volatile counter is incremented to his maximum and state NM_FAILURE is set. If maximum is reached state
NM_CONFIRMED_FAILURE is entered and the non volatile counter is set to his maximum.
This function must be called cyclically if the message could not be sent. The cycle time of calling this function is the
cycle time of the observed message.
Particularities and Limitations
©2008, Vector Informatik GmbH
Version: 1.12
34 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
InmNmGetTxCondition()Prototype Single channel
inmNmConditionType *
InmNmGetTxCondition ( void )
Multi channel
inmNmConditionType *
InmNmGetTxCondition (
inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code inmNmConditionType
Reference to condition struct
inmNmConditionType Functional Description Transmit time out notification
This function is normally called by the interaction layer. It informs the INM OSEK that the observed message couldn’t be
send at the moment.
The volatile counter is incremented to his maximum and state NM_FAILURE is set. If maximum is reached state
NM_CONFIRMED_FAILURE is entered and the non volatile counter is set to his maximum.
This function must be called cyclically if the message could not be sent. The cycle time of calling this function is the
cycle time of the observed message.
Particularities and Limitations
©2008, Vector Informatik GmbH
Version: 1.12
35 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.2.4 BusOff Supervision InmNmBusOffDiagOn()Prototype Single channel
void
InmNmBusOffDiagOn ( void )
Multi channel
void
InmNmBusOffDiagOn ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description This function starts the channel-specific supervision of the BusOff event.
This supervision runs until the supervision is stoppe
d (InmNmBusOffDiagOff() or InmNmDiagOff()) or the NM is
stoppe
d (InmNmStop()). This function has only effect if the NM is runn
ing, i.e. InmNmStart() has been called. It is not possible to enable the
supervision when the NM is stopped.
Particularities and Limitations Dependent on the OEM, the supervision status gets re-initialized when supervision is started.
InmNmBusOffDiagOff()Prototype Single channel
void
InmNmBusOffDiagOff ( void )
Multi channel
void
InmNmBusOffDiagOff ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description This function stops the channel-specific supervision of the BusOff event.
The supervision is automatically stopped when all supervisions are stoppe
d (InmNmDiagOff())) or when the NM is
stoppe
d (InmNmStop()). Particularities and Limitations Dependent on the OEM, the supervision status gets re-initialized when supervision is stopped.
©2008, Vector Informatik GmbH
Version: 1.12
36 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
InmNmBusOff()Prototype Single channel
void
InmNmBusOff ( void )
Multi channel
void
InmNmBusOff ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description Bus Off notification form CAN driver
This function is called by the CAN-Driver if an Bus-Off happened. The application is informed about this by calling the
function ApplInmNmBusOffIndication(...). The volatile Bus-Off counter will be incremented until the maximal value is
reached. If the maximal value is reached the state NM_CONFIRMED_FAILURE will be entered and the non volatile
counter will be set to his maximum.
Particularities and Limitations
InmNmTask()Prototype Single channel
void
InmNmTask ( void )
Multi channel
void
InmNmTask ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description Cyclic Task for timeout supervision of Bus Off
Particularities and Limitations Call context:
Availability:
©2008, Vector Informatik GmbH
Version: 1.12
37 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
InmNmGetBusOffStatus()Prototype Single channel
inmNmStatusType *
InmNmGetBusOffStatus ( void )
Multi channel
inmNmStatusType *
InmNmGetBusOffStatus ( inmNmChannelType
inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code inmNmStatusType
Reference to condition struct
inmNmStatusType Functional Description This function returns the current state of the Network status. The values can be modified by the application.
For bus off Supervision no counter is used. Therefore only the states
OK, Failure and Confirmed Failure are handled.
Particularities and Limitations
©2008, Vector Informatik GmbH
Version: 1.12
38 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.2.5 User-specific Supervision InmNmGenericDiagOn()Prototype Single channel
void
InmNmGenericDiagOn ( void )
Multi channel
void
InmNmGenericDiagOn ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description This function starts the supervision of the user-specific event.
This event is under supervision until the supervision is stopped (
InmNmGenericDiagOff() or
InmNmDiagOff()) or the
NM is stopped (
InmNmStop()). This function has only effect if the NM is runn
ing, i.e. InmNmStart() has been called. It is not possible to enable the
supervision when the NM is stopped.
Particularities and Limitations Dependent on the OEM, the supervision status gets re-initialized when supervision is started.
InmNmGenericDiagOff()Prototype Single channel
void
InmNmGenericDiagOff ( void )
Multi channel
void
InmNmGenericDiagOff ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description This function stops the supervision of the user-specific event.
The supervision is automatically stopped when all supervisions are stoppe
d (InmNmDiagOff())) or when the NM is
stoppe
d (InmNmStop()). Particularities and Limitations Dependent on the OEM, the supervision status gets re-initialized when supervision is stopped.
©2008, Vector Informatik GmbH
Version: 1.12
39 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
InmNmGenericOk()Prototype Single channel
void
InmNmGenericOk ( void )
Multi channel
void
InmNmGenericOk ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code Functional Description Transmit successful notification
This function will normally called by the interaction layer. It informs the INM OSEK about an successfully transmission of
the message which should be observed.
Particularities and Limitations
InmNmGenericTimeOut()Prototype Single channel
void
InmNmGenericTimeout ( void )
Multi channel
void
InmNmGenericTimeout ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description Transmit time out notification
This function is normally called by the interaction layer. It informs the INM OSEK that the observed message couldn’t be
send at the moment.
The volatile counter is incremented to his maximum and state NM_FAILURE is set. If maximum is reached state
NM_CONFIRMED_FAILURE is entered and the non volatile counter is set to his maximum.
This function must be called cyclically if the message could not be sent. The cycle time of calling this function is the
cycle time of the observed message.
Particularities and Limitations
©2008, Vector Informatik GmbH
Version: 1.12
40 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
InmNmGetGenericCondition()Prototype Single channel
inmNmConditionType *
InmNmGetGenericCondition ( void )
Multi channel
inmNmConditionType *
InmNmGetGenericCondition (
inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code inmNmConditionType
Reference to condition struct
inmNmConditionType Functional Description Transmit time out notification
This function is normally called by the interaction layer. It informs the INM OSEK that the observed message couldn’t be
send at the moment.
The volatile counter is incremented to his maximum and state NM_FAILURE is set. If maximum is reached state
NM_CONFIRMED_FAILURE is entered and the non volatile counter is set to his maximum.
This function must be called cyclically if the message could not be sent. The cycle time of calling this function is the
cycle time of the observed message.
Particularities and Limitations
©2008, Vector Informatik GmbH
Version: 1.12
41 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.3 Callbacks The Nm_IndOsek uses callback functions to inform the application about an event. It is up
to the application to react on this event.
The application has to implement the necessary callbacks. The prototypes of the callbacks
are listed in the NM *.h-file.
There are following types
of callbacks (also see Table 8-2):
Callbacks that are used to inform the application that a certain event supervision has
to be (re-)initialized. These callbacks require actions by the application: The
application has to set the initial values, i.e. the value of the supervision counter and
the supervision state. These callbacks are only available if the user-specific
configuration is enabled in the configuration.
Callbacks that are used to inform the application about status changes. These
callbacks are only meant for notification/information. The application might use these
callbacks to e.g. store the current status in non-volatile memory. The NM does
depend on the actions done by the application. These callbacks are always available.
Callbacks that are meant to be used to control other CANbedded modules. These
callbacks are always available.
Initialization Status information Others NM
ApplInmNmStartCanIl() handler
ApplInmNmStopCanIl() RX
ApplInmNmRxUserInit()
ApplInmNmStatusIndication super-
Rx() ApplInmNmRxUserReInit() vision
TX
ApplInmNmTxUserInit()
ApplInmNmStatusIndication super-
Tx() ApplInmNmTxUserReInit() vision
BusOff
ApplInmNmBusOffUserInit()
ApplInmNmStatusIndication super-
BusOff() ApplInmNmBusOffUserReInvision
it() Generic
ApplInmNmGenericUserInit
ApplInmNmStatusIndication super-
() Generic() vision
ApplInmNmGenericUserReInit() Table 8-2
Overview callbacks
©2008, Vector Informatik GmbH
Version: 1.12
42 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.3.1 NM Handler ApplInmNmStartCanIl()Prototype Single channel
void
ApplInmNmStartCanIl ( void )
Multi channel
void
ApplInmNmStartCanIl ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description This callback informs the application that the Nm_IndOsek has been started.
This callback can be used to start the CAN driver and the IL.
Particularities and Limitations Call context: task level
ApplInmNmStopCanIl()Prototype Single channel
void
ApplInmNmStopCanIl ( void )
Multi channel
void
ApplInmNmStopCanIl ( inmNmChannelType inm_channel )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
Return code ---
Functional Description This callback informs the application that the Nm_IndOsek has been stopped.
This callback can be used to stop the CAN driver and the IL.
Particularities and Limitations Call context: task level
©2008, Vector Informatik GmbH
Version: 1.12
43 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.3.2 RX Supervision ApplInmNmStatusIndicationRx()Prototype Single channel
void
ApplInmNmStatusIndicationRx ( inmNmIndexType index,
inmNmStatusType status )
Multi channel
void
ApplInmNmStatusIndicationRx ( inmNmIndexType index,
inmNmStatusType status )
Parameter index
handle of related RX message
status
status of the RX supervision
INM_OK
INM_FAILURE
INM_CONFIRMED_FAILURE
INM_SPV_ACTIVE
Return code ---
Functional Description This callback is executed when the status of the supervision for the RX message with handle <index>
changes, i.e. when the call of
InmNmRxOk() or InmNmRxTimeOut() leads to a change of the supervision
state.
This callback is also executed during system initialization and re-initialization.
The new status is contained in the parameter <status>.
Particularities and Limitations Call context: maybe in IR context, depending on call context of
InmNmRxOk() and InmNmRxTimeOut(). ©2008, Vector Informatik GmbH
Version: 1.12
44 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
ApplInmNmRxUserInit()Prototype Single channel
void
ApplInmNmRxUserInit ( inmNmIndexType index,
inmNmConditionType *condition )
Multi channel
void
ApplInmNmRxUserInit ( inmNmIndexType index,
inmNmConditionType *condition )
Parameter index
handle of related RX message
*condition
pointer to the status data
Return code ---
Functional Description This callback is executed within
InmNmInit() and requests the user to initially configure the status data given
by the pointer. It is up to the application to set the supervision counter and the supervision status.
This callback is meant to configure the supervision state with values that are e.g. stored in non-volatile
memory.
Particularities and Limitations Call context: during system initialization; task level; while interrupts are locked
This callback is only necessary if the user-specific initialization is enabled (see chapter
“5 Configuration”). ApplInmNmRxUserReInit()Prototype Single channel
void
ApplInmNmRxUserReInit ( inmNmIndexType index,
inmNmConditionType *condition )
Multi channel
void
ApplInmNmRxUserReInit ( inmNmIndexType index,
inmNmConditionType *condition )
Parameter index
handle of related RX message
*condition
pointer to the status data
Return code ---
Functional Description This callback is executed within
InmNmReInit() and requests the user to configure the status data given by
the pointer. It is up to the application to set the supervision counter and the supervision status.
This callback is meant to configure the supervision state with values that are e.g. stored in non-volatile
memory.
Particularities and Limitations Call context: during re-initialization; typically on task level
This callback is only necessary if the user-specific initialization is enabled (see chapter
“5 Configuration”). ©2008, Vector Informatik GmbH
Version: 1.12
45 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.3.3 TX Supervision ApplInmNmStatusIndicationTx()Prototype Single channel
void
ApplInmNmStatusIndicationTx ( inmNmStatusType status
)
Multi channel
void
ApplInmNmStatusIndicationTx ( inmNmChannelType
inm_channel, inmNmStatusType status )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
status
status of the TX supervision
INM_OK
INM_FAILURE
INM_CONFIRMED_FAILURE
INM_SPV_ACTIVE
Return code ---
Functional Description This callback is executed when the status of the supervision for the channel-specific TX message changes,
i.e. when a call of InmNmTxOk() or
InmNmTxTimeOut() leads to a change of the supervision state.
This callback is also executed during system initialization and re-initialization.
The new status is contained in the parameter <status>.
Particularities and Limitations Call context: maybe in IR context, depending on call context of
InmNmTxOk() and InmNmTxTimeOut().
©2008, Vector Informatik GmbH
Version: 1.12
46 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
ApplInmNmTxUserInit()Prototype Single channel
void
ApplInmNmTxUserInit ( inmNmConditionType *condition
)
Multi channel
void
ApplInmNmTxUserInit ( inmNmChannelType inm_channel,
inmNmConditionType *condition )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
*condition
pointer to the status data
Return code ---
Functional Description This callback is executed within
InmNmInit() and requests the user to initially configure the status data given
by the pointer. It is up to the application to set the supervision counter and the supervision status.
This callback is meant to configure the supervision state with values that are e.g. stored in non-volatile
memory.
Particularities and Limitations Call context: during system initialization; task level; while interrupts are locked
This callback is only necessary if the user-specific initialization is enabled (see chapter
“5 Configuration”). ApplInmNmTxUserReInit()Prototype Single channel
void
ApplInmNmTxUserReInit ( inmNmConditionType
*condition )
Multi channel
void
ApplInmNmTxUserReInit ( inmNmChannelType
inm_channel, inmNmConditionType *condition )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
*condition
pointer to the status data
Return code ---
Functional Description This callback is executed within
InmNmReInit() and requests the user to configure the status data given by
the pointer. It is up to the application to set the supervision counter and the supervision status.
This callback is meant to configure the supervision state with values that are e.g. stored in non-volatile
memory.
Particularities and Limitations Call context: during re-initialization; typically on task level
This callback is only necessary if the user-specific initialization is enabled (see chapter
“5 Configuration”). ©2008, Vector Informatik GmbH
Version: 1.12
47 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.3.4 BusOff Supervision ApplInmNmStatusIndicationBusOff()Prototype Single channel
void
ApplInmNmStatusIndicationBusOff ( inmNmStatusType
status )
Multi channel
void
ApplInmNmStatusIndicationBusOff ( inmNmChannelType
inm_channel, inmNmStatusType status )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
status
status of the TX supervision
INM_OK
INM_FAILURE
INM_CONFIRMED_FAILURE
INM_SPV_ACTIVE
Return code ---
Functional Description This callback is executed when the status of the channel-specific BusOff supervision changes, i.e. when a
call of InmNmBusOff() or a notification of a TX/RX event leads to a change of the supervision state.
This callback is also executed during system initialization and re-initialization.
The new status is contained in the parameter <status>.
Particularities and Limitations Call context: maybe in IR context, depending on the way CAN TX/RX/error interrupts are used in the
system.
©2008, Vector Informatik GmbH
Version: 1.12
48 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
ApplInmNmBusOffUserInit()Prototype Single channel
void
ApplInmNmBusOffUserInit ( inmNmConditionType
*condition )
Multi channel
void
ApplInmNmBusOffUserInit ( inmNmChannelType
inm_channel, inmNmConditionType *condition )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
*condition
pointer to the status data
Return code ---
Functional Description This callback is executed within
InmNmInit() and requests the user to initially configure the status data given
by the pointer. It is up to the application to set the supervision counter and the supervision status.
This callback is meant to configure the supervision state with values that are e.g. stored in non-volatile
memory.
Particularities and Limitations Call context: during system initialization; task level; while interrupts are locked
This callback is only necessary if the user-specific initialization is enabled (see chapter
“5 Configuration”). ApplInmNmBusOffUserReInit()Prototype Single channel
void
ApplInmNmBusOffUserReInit ( inmNmConditionType
*condition )
Multi channel
void
ApplInmNmBusOffUserReInit ( inmNmChannelType
inm_channel, inmNmConditionType *condition )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
*condition
pointer to the status data
Return code ---
Functional Description This callback is executed within
InmNmReInit() and requests the user to configure the status data given by
the pointer. It is up to the application to set the supervision counter and the supervision status.
This callback is meant to configure the supervision state with values that are e.g. stored in non-volatile
memory.
Particularities and Limitations Call context: during re-initialization; typically on task level
This callback is only necessary if the user-specific initialization is enabled (see chapter
“5 Configuration”). ©2008, Vector Informatik GmbH
Version: 1.12
49 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.3.5 Generic Supervision ApplInmNmStatusIndicationGeneric()Prototype Single channel
void
ApplInmNmStatusIndicationGeneric ( inmNmStatusType
status )
Multi channel
void
ApplInmNmStatusIndicationGeneric ( inmNmChannelType
inm_channel, inmNmStatusType status )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
status
status of the TX supervision
INM_OK
INM_FAILURE
INM_CONFIRMED_FAILURE
INM_SPV_ACTIVE
Return code ---
Functional Description This callback is executed when the status of the channel-specific Generic supervision changes, i.e. when a
call of InmNmGenericOk() or InmNmGenericTimeOut() leads to a change of the supervision state.
This callback is also executed during system initialization and re-initialization.
The new status is contained in the parameter <status>.
Particularities and Limitations Call context: maybe in IR context, depending on the call context of
InmNmGenericOk() and InmNmGenericTimeOut() ©2008, Vector Informatik GmbH
Version: 1.12
50 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
ApplInmNmGenericUserInit()Prototype Single channel
void
ApplInmNmGenericUserInit ( inmNmConditionType
*condition )
Multi channel
void
ApplInmNmGenericUserInit ( inmNmChannelType
inm_channel, inmNmConditionType *condition )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
*condition
pointer to the status data
Return code ---
Functional Description This callback is executed within
InmNmInit() and requests the user to initially configure the status data given
by the pointer. It is up to the application to set the supervision counter and the supervision status.
This callback is meant to configure the supervision state with values that are e.g. stored in non-volatile
memory.
Particularities and Limitations Call context: during system initialization; task level; while interrupts are locked
This callback is only necessary if the user-specific initialization is enabled (see chapter
“5 Configuration”). ApplInmNmGenericUserReInit()Prototype Single channel
void
ApplInmNmGenericUserReInit ( inmNmConditionType
*condition )
Multi channel
void
ApplInmNmGenericUserReInit ( inmNmChannelType
inm_channel, inmNmConditionType *condition )
Parameter inm_channel
Handle of the NM-internal channel. Range: 0…max(NM channels)
*condition
pointer to the status data
Return code ---
Functional Description This callback is executed within
InmNmReInit() and requests the user to configure the status data given by
the pointer. It is up to the application to set the supervision counter and the supervision status.
This callback is meant to configure the supervision state with values that are e.g. stored in non-volatile
memory.
Particularities and Limitations Call context: during re-initialization; typically on task level
This callback is only necessary if the user-specific initialization is enabled (see chapter
“5 Configuration”). ©2008, Vector Informatik GmbH
Version: 1.12
51 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
8.4 Other Interfaces 8.4.1 Version Information The version of the source code of the component Nm_IndOsek is stored in three BCD-
coded constants within the NM source file:
V_MEMROM0 V_MEMROM1 vuint8 V_MEMROM2 kNmMainVersion =
(vuint8)(NM_INDOSEK_VERSION >> 8);
V_MEMROM0 V_MEMROM1 vuint8 V_MEMROM2 kNmSubVersion =
(vuint8)(NM_INDOSEK_VERSION & 0xFF);
V_MEMROM0 V_MEMROM1 vuint8 V_MEMROM2 kNmReleaseVersion =
(vuint8)(NM_INDOSEK_RELEASE_VERSION);
Example - Version 1.24.03 is registered as:
kNmMainVersion = 0x01;
kNmSubVersion = 0x24;
kNmReleaseVersion = 0x03;
This information can be accessed by the application at any time.
©2008, Vector Informatik GmbH
Version: 1.12
52 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
9 Working with the Code 9.1 Version Information The version information and the version changes of the NM component are listed in the
history section at the beginning of the header and source code files.
9.2 Application Interface The application uses the API of the NM. The necessary interfaces can be looked up in the
NM header file. This file contains
pre-processor definitions
type definitions
prototypes for API functions
prototypes for necessary callback function
©2008, Vector Informatik GmbH
Version: 1.12
53 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
10 CANdb Attributes The configuration tool needs additional information to handle the configuration options for
the NM. These information are stored in attributes within the CAN database (DBC-file).
Please refer to the online help system of the CANdb editor to learn how to define and set
these attributes.
An attribute can belong to the database, to a node, to a message or to a signal.
There are different types of attributes: String, Hex, Integer-Values or Enumeration. When
enumerations are used, please take care of the order (e.g. “No”, “Yes”).
The DBC attributes are normally provided by the OEM. The user does not have to change
them.
©2008, Vector Informatik GmbH
Version: 1.12
54 / 55
based on template version 1.9

TechnicalReference Nm_IndOsek
Attribute Name Valid for Type Value Description Manufacturer Database
String
PSA,
This attribute defines the OEM.
Renault
NmType Database
String
PSA-
This attribute defines the OEM-specific type of the
Indirect- NM.
OSEK.
Renault-
Indirect-
OSEK
NmNode
Node
Enumer “No”,”Yes This attribute defines if the corresponding node uses
ation
”
the NM (“Yes"”) or not (“No”).
NmStationAddress Node
Hex
range:
This attribute defines the station address of the
0x00…0x ECU. The station address has to be unique within
FF
the system.
NmMessage
Message
Enumer “No”,”Yes This attribute defines the TX message that will be
ation
”
used for TX supervision.
Note: There may be only one TX message of each
node which has this attribute set to “Yes”.
NmMessage_<nod Message
Enumer “No”,”Yes This attribute defines the RX message(s) that will be
e>
ation
”
used for RX supervision by node <node>.
<node> represents the node name of the node of
interest.
This attribute may only be set to “Yes” for messages
that are received by the own node.
GenMsgCycleTime Message Integer 1…2000 This attribute defines the cycle time for the
supervised RX and TX messages.
This value is used for the present detection of the
supervised RX nodes, as well as for the
absent/present detection of the supervised TX
message.
Note: The value range may not be exceeded for
messages that are used for RX or TX supervision.
GenMsgTimeoutTi
Message Integer
1..667 This attribute defines the timeout for the supervised
me_<node>
RX messages.
This value is used for the absent detection of the
supervised RX nodes.
Table 10-1
CANdb attributes
©2008, Vector Informatik GmbH
Version: 1.12
55 / 55
based on template version 1.9
Document Outline
1.1.45 - TechnicalReference_Stationmanager
Nm_Stmgr_Ls1.1.47 - TechnicalReference_Stationmanagers
Nm_StMgrIndOsek_Ls Technical Reference Station Manager (Low Speed) Version 3.05
Date 2011-07-29
File TechnicalReference_Stationmanager.doc
Number of Pages 35
Station manager for PSA Technical Reference
1
1 History ............................................................................................................ 5 1.1 SM Version................................................................................................ 5 2 Introduction.................................................................................................... 5 2.1 Reference Documents............................................................................... 5 2.2 Abbreviations ............................................................................................ 5 2.3 Tasks and Aims......................................................................................... 6 3 Network management states ........................................................................ 6 3.1 Organ Type 1 ............................................................................................ 6 3.1.1 Description of internal States for organ type 1: ................................... 6 3.2 Organ Type 2 ............................................................................................ 7 3.2.1 Description of internal States for organ type 2 : .................................. 7 3.3 Organ Type 3 ............................................................................................ 7 3.3.1 Description of internal States for organ type 3 : .................................. 7 3.4 Organ Type 4 ............................................................................................ 8 3.4.1 Description of internal States for organ type 4 : .................................. 8 4 Integration into the application .................................................................... 8 4.1 Delivery Items ........................................................................................... 8 4.2 Version Changes....................................................................................... 9 4.3 Handling of the station-manager ............................................................... 9 4.4 Particularities if there is no Interaction Layer in the system....................... 9 4.4.1 Event transmission of the supervised Tx message............................. 9 4.5 Start delay time of Tx messages ............................................................... 9 4.5.1 Start delay time without Interaction Layer........................................... 9 4.6 Reading of Nerr state .............................................................................. 10 4.7 Handling of the signal Interd_Memo_Def ................................................ 10 4.8 Handling of Lmin ..................................................................................... 10 4.8.1 First value and Indication flags ......................................................... 11 4.8.2 Timeout flags and functions .............................................................. 11 4.8.3 Impact on the application .................................................................. 11 4.8.4 Access to the actual DLC ................................................................. 12 4.9 Cancel of pending transmit messages .................................................... 12 ©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
2
4.9.1 Configuration of the TP when using CanCanelTransmit()................. 14 4.9.2 Example Code .................................................................................. 14 4.10 Handling of the version message......................................................... 14 4.11 Configuring the Part Offline mode....................................................... 14 4.12 Supervision Reset on Request of the Diagnosis .................................. 15 5 Sleep and Wake Up sequence PSA ............................................................ 15 5.1 Transition from Sleep ( Veille ) to WakeUp ( Reveil ) .............................. 15 5.1.1 External event ( Organ type 1, 2 and 4 ):.......................................... 16 5.1.2 Bus event ( Organ type 1, 2 and 4 )................................................. 16 5.1.3 +CAN activation Organ type 1 and 2 ................................................ 17 5.1.4 +CAN activation Organ type 3 .......................................................... 17 5.2 Transition to Veille................................................................................... 18 5.2.1 Organ type 1,2 and 4 ........................................................................ 18 5.2.2 Organ type 3 ..................................................................................... 18 5.3 Setting and Releasing a Request for the network ................................... 19 5.4 Indication of the +CAN signal to the Station manager............................. 19 6 API of the station-manager ......................................................................... 19 6.1 Version of the source code...................................................................... 19 6.2 station-manager services called by the application ................................. 20 6.2.1 SmInitPowerOn: Initialisation of the station-manager ....................... 20 6.2.2 SmTask: cyclic Task ......................................................................... 20 6.2.3 SmGetStatus: Read the internal status of ECU ................................ 20 6.2.4 SmGetVolCNerr: Read the Value of the volatile Nerr Counter (Macro) 20 6.2.5 SmSetVolCNerr: Set the Value of the volatile Nerr Counter (Macro) 21 6.2.6 SmGetVolCPerteCom: Read the Value of the volatile PerteCom Counter (Macro)............................................................................................. 21 6.3 SmSetVolCPerteCom: Set the Value of the volatile PerteCom Counter (Macro).............................................................................................................. 21 6.3.1 SmGetVolCBoff: Read the Value of the volatile BusOff Counter (Macro) 21 6.3.2 SmSetVolCBoff: Set the Value of the volatile BusOff Counter (Macro) 22 ©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
3
6.3.3 SmSetWakeUpRequest: A CAN frame was received and woke up the ECU 22 6.3.4 SmSetNetworkRequest: Release a Network Request to the network management.................................................................................................. 22 6.3.5 SmReleaseNetworkRequest: Release a Network Request to the network management .................................................................................... 22 6.3.6 SmSetPlusCanState(state) ............................................................... 23 6.3.7 SmTransmitNmMessage: Tranmsit the supervised Tx message on next call of SmTask() ..................................................................................... 23 6.4 Application functions required by the station-manager............................ 24 6.4.1 ApplSmStatusIndicationTx: Status of transmission indication .......... 24 6.4.2 ApplSmStatusIndicationRx: Status of reception indication ............... 24 6.4.3 ApplSmStatusIndicationNerr: Status of Nerr Pin indication .............. 24 6.4.4 ApplSmStatusIndication: State of ECU has changed ....................... 25 6.4.5 ApplCanErrorPin: Get Status of Transceiver Error Pin ..................... 25 6.4.6 ApplSmGetInterdMemoDef: Get Status of filtered Interd_Memo_Def Bit 25 6.4.7 ApplSmSetNVAbsentCount: Set the non volatile Rx counter ........... 25 6.4.8 ApplSmSetNVMuteCount: Set the non volatile Tx counter ............... 26 6.4.9 ApplSmSetNVNerrCount: Set the non volatile Nerr counter ............. 26 6.4.10 ApplSmGetNVAbsentCount: Get the non volatile Rx counter ....... 26 6.4.11 ApplSmGetNVMuteCount: Get the non volatile Tx counter ........... 26 6.4.12 ApplSmGetNVNerrCount: Get the non volatile Nerr counter ......... 27 6.4.13 ApplSmTrcvOn: Switch on the transceiver .................................... 27 6.4.14 ApplSmTrcvOff: Switch off the transceiver .................................... 27 6.4.15 ApplNwmBusOff: Bus off indication ............................................... 27 6.4.16 ApplNwmBusOffEnd: Bus off recovery ended ............................... 28 6.4.17 ApplSmFatalError: Error in assertion occurred.............................. 28 7 Configuration of the station-manager........................................................ 29 7.1 General Configuration ............................................................................. 29 7.2 Status Callback functions ........................................................................ 29 7.2.1 ECU StateChange Callback: ............................................................ 29 7.2.2 Fault State Support:.......................................................................... 29 ©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
4
7.2.3 Fault Storage Support:...................................................................... 30 7.2.4 Bus Off Callback Support : ............................................................... 30 7.2.5 Bus Off End Callback Support: ......................................................... 30 7.2.6 Use Flag InterdMemoDef.................................................................. 30 7.2.7 ECU State Change in Task Context ................................................. 30 7.2.8 N_as Timeout Handling .................................................................... 30 7.2.9 Sleep Management........................................................................... 30 7.2.10 Task cycle ..................................................................................... 30 7.2.11 Debug Support .............................................................................. 31 8 Database attributes ..................................................................................... 32 8.1 Receive Message Attribute ..................................................................... 32 8.2 Signal Attribute ........................................................................................ 33 9 Precautions .................................................................................................. 34 9.1 Calling CanSleep(…); within status callback ........................................... 34 ©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
5
1 History Author Date Version Remarks Dieter Schaufelberger 2008-01-29 3.00
creation of this document
Dieter Schaufelberger 2008-02-12 3.01
Firest corrections
Dieter Schaufelberger 2008-03-14 3.02
Added new API, modify Sleep/WakeUp
Dieter Schaufelberger 2008-06-25 3.03
Minor corrections
Dieter Schaufelberger 2008-07-11 3.04
Added support of start delay time
Marco Pfalzgraf
2011-07-28 3.05
Update of user specification [INM PSA]
1.1 SM Version This document refers to version 3.03.00 of the station-manager for the PSA Low Speed
Fault Tolerant bus.
2 Introduction The aim of this document is to describe the handling of the station-manager for PSA.
This document contains
a short description of the station-manager
the condition for using the station-manager
the interfaces of the user program for the station-manager
This chapter gives a brief overview of the tasks and aims of the station-manager.
Please refer also to the specification of the Indirect Network Management [INM PSA].
2.1 Reference Documents For understanding and using this manual, it is very important to know the listed docu-
ments.
Abbreviation Document Document [INM PSA]
96 649 896 99 Ind[OR] Phases de vie reseau
96 649 897 9B Ind[OR] Specification de regles communication
[CANdriver]
User manual of the Vector CAN Driver
[INM_OSEK]
User manual of the Vector OSEK_INM
2.2 Abbreviations Instead of using complete expressions, the following abbreviations are used in the text.
Abbreviation Complete expression ECU
Electronic Control Units
INM
Indirect Network Management
IL Interaction
Layer
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
6
SM station-manager
2.3 Tasks and Aims The SM provides services for a user program operating on a CAN-Bus.
These services contain:
Handling of network management states
Handling of states of the supervised ECU’s
Handling of non volatile storage of error counters/states
Monitoring and handling of “Perte_Com” situation (Limp Home)
3 Network management states This chapter gives a brief description about the different ECU states and the ECU behav-
iour in those states according to [INM PSA].
3.1 Organ Type 1 Organ Type 1 is able to wake up the CAN communication in case of an external event
(e.g. door control ). In case of Limp Home ( non reception of message “Commande_BSI”)
it enters state “Perte Com”.
3.1.1 Description of internal States for organ type 1: State Description VEILLE Physical Layer in Sleep mode. Detection of Bus activity.
No transmission possible.
REVEIL Transient state in which the communication is initialised.
If the organ itself wakes up the bus a periodic wake up message
must be send.
Supervision of the Commande_BSI.
NORMAL Transmission of the wake up message is stopped.
Transmission of the version message.
Transmission and reception of functional messages.
Netmanagement diagnosis.
Supervision of the Commande_BSI.
MIS EN VEILLE Transmission of functional messages interrupted.
Supervision of the Commande_BSI.
COM OFF Transmission of functional messages interrupted.
Supervision of the Commande_BSI.
Perte Com Transmission of functional messages.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
7
3.2 Organ Type 2 Organ Type 2 is able to wake up the CAN communication in case of an external event
(e.g. door control ). In case of Limp Home ( non reception of message “Commande_BSI”)
it enters state “MIS EN VEILLE”.
3.2.1 Description of internal States for organ type 2 : State Description VEILLE Physical Layer in Sleep mode. Detection of Bus activity.
No transmission possible.
REVEIL Transient state in which the communication is initialised.
If the organ itself wakes up the bus a periodic wake up message
must be send.
Supervision of the Commande_BSI.
NORMAL Transmission of the wake up message is stopped.
Transmission of the version message.
Transmission and reception of functional messages.
Netmanagement diagnosis.
Supervision of the Commande_BSI.
MIS EN VEILLE Transmission of functional messages interrupted.
Supervision of the Commande_BSI.
COM OFF Transmission of functional messages interrupted.
Supervision of the Commande_BSI.
3.3 Organ Type 3 ECUs Organ Type 3 are supplied by +CAN which is switched off by the BSI when going
into the state VEILLE. Therefore these ECUs aren’t able to wake up the CAN communica-
tion. In case of Limp Home ( non reception of message “Commande_BSI”) it enters state
“Perte Com”.
3.3.1 Description of internal States for organ type 3 : State Description VEILLE +CAN absent => no power supply
Detection of Bus activity not possible.
Transmission of any message impossible.
REVEIL Transient state in which the communication is initialised.
Supervision of the Commande_BSI.
NORMAL Transmission of the wake up message is stopped.
Transmission of the version message.
Transmission and reception of functional messages.
Netmanagement diagnosis.
Supervision of the Commande_BSI.
MIS EN VEILLE Transmission of functional messages interrupted.
Supervision of the Commande_BSI.
COM OFF Transmission of functional messages interrupted.
Supervision of the Commande_BSI.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
8
Perte Com Transmission of functional messages.
3.4 Organ Type 4 Organ Type 4 is able to wake up the CAN communication in case of an external event
(e.g. door control ). In case of Limp Home ( non reception of message “Commande_BSI”)
it enters state “MIS EN VEILLE”.
3.4.1 Description of internal States for organ type 4 : State Description VEILLE Physical Layer in Sleep mode. Detection of Bus activity.
No transmission possible.
REVEIL Transient state in which the communication is initialised.
Supervision of the Commande_BSI.
NORMAL Transmission of the wake up message is stopped.
Transmission of the version message.
Transmission and reception of functional messages.
Netmanagement diagnosis.
Supervision of the Commande_BSI.
MIS EN VEILLE Transmission of functional messages interrupted.
Supervision of the Commande_BSI.
COM OFF Transmission of functional messages interrupted.
Supervision of the Commande_BSI.
4 Integration into the application This chapter describes the steps for the integration of the SM in the application of an
ECU.
4.1 Delivery Items The SM is always combined with the indirect network management OSEK_INM. Never-
theless it is an own module which could be used stand-alone ( not recommended ).
The delivery includes
-
Header files
Stat_mgr.h -
Source code file (includes the SM itself)
Stat_mgr.c - Source code file
GenericPrecopy.c this user manual
Technical Reference station-manager. ©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
9
4.2 Version Changes Changes and bug fixes in the SM are listed at the beginning of the header and source
code file.
4.3 Handling of the station-manager Please include the header file of the SM in all modules in which you require services of
the SM. In this file all available services including prototypes of the required interfaces and
symbolic constants are defined.
Add
Stat_mgr.c ,
GenericPrecopy.c and the generated file
StMgrLs_par.c to your make
file/project file.
Before the SM can be used, it must be initialised once after power on reset. Therefore the
function
SmInitPowerOn() has to be called.
After the SM was initialized, the function
SmTask(…) must be called cyclically with the
period time defined in the Generation tool.
All other services of the SM have to be called by the application when they are required. A
more detailed description of every function is found in the chapter “API of the station-
manager”.
4.4 Particularities if there is no Interaction Layer in the system If there is no Interaction Layer present in the system, the Station manager takes care
about the cyclic sending of the supervised Tx message.
4.4.1 Event transmission of the supervised Tx message On some systems this message has to be send also on event. Therefore an interface is
provided to handle this:
SmTransmitNmMessage: Tranmsit the supervised Tx message on next call of
SmTask() Prototype Void SmTransmitNmMessage( channel) Parameter Channel
Channel on which the supervised message must be sent
Return code Function de-This function checks for the minimum send delay and sets the internal Tx cycle counter
scription to the appropriate value to transmit the supervised Tx message as soon as possible
(keeping the minimum send delay).
Particularities and Limitations 4.5 Start delay time of Tx messages If the Tx messages have to keep a defined start delay time, the database attribute
GenMsgStartDelayTime has to be set for each Tx message to the corresponding delay
time.
4.5.1 Start delay time without Interaction Layer If there is no Interaction Layer in the system, the start delay time has to be kept by the
application.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
10
For the supervised Tx messages, which is transmitted by the Station manager (s. chap.
4.4), the start delay time has to be provided by the application using the following array:
V_MEMROM0 V_MEMROM1 vuint16 V_MEMROM2 bSmInmMsgDelayTime[SM_CHANNELS]= {x};
The delay time “x” has to be given normalized, which means “Delay Time / Task cycle”.
A delay time of 25ms using a task cycle of the Stationmanager of 5ms gives x= 25/5 = 5.
V_MEMROM0 V_MEMROM1 vuint16 V_MEMROM2 bSmInmMsgDelayTime[SM_CHANNELS]= {5};
4.6 Reading of Nerr state The state of the Bit Nerr is read by the station-manager using the callback function
ApplCanErrorPin(). In this callback function the application has to read the Nerr pin of the
transceiver. According to the requirement GEN-RESEAU-ST-RCCANLS.0095 (1) the state of
the Bit Nerr must be read maximum 88μs after the reception of the Commande_BSI. This require-
ment can not be met under all circumstances. Depending on the system design (platform, hard-
ware clock, polling mode, … ) this time may be exceeded. Therefore this timing ** must ** be
measured using the real target on customer side.
If the requirement isn’t met, the following solution has to be implemented:
Activate callback function ApplCanMsgReceived in the CanDriver folder of the Gentool. In this call-
back function the application has to read the state of the Nerr pin and store it in a variable. If later
on the callback function ApplCanErrorPin() is called, return the stored value.
This will ensure that the Nerr pin is read immediately after the reception of the message.
Disadvantage:
State of Nerr pin is read with every message not only Commande_BSI.
4.7 Handling of the signal Interd_Memo_Def To activate the handling of the signal Interd_Memo_Def select the switch
InterdMemoDef
support in the Generation tool.
If the handling is activated, the application has to provide the callback function
ApplSmGetInterdMemoDef( ) which return 0 if the signal is not set and >0 if the signal is
set.
If the signal is set, the SM keeps all volatile counters unchanged ( absent, mute, nerr,)
when in mode
Normal or
ComOff.
The PerteCom supervision is still active.
4.8 Handling of Lmin If there are messages where the Lmin value is smaller as the specified DLC, special care
has to be taken when reading signals of those messages. Lmin gives the minimal length
of a message until its still accepted by the ECU. Lmin can be equal to message DLC or
smaller. To ensure the correct functionality of the stack please set the database message
attribute
GenMsgMinAcceptLength to Lmin or DLC if there is no Lmin value given ( s.
6.1 )
For messages with Lmin < DLC special care has to be taken by the application. First of all
a short description how the available signal flags are handled by the IL.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
11
4.8.1 First value and Indication flags If the received DLC is >= Lmin the
firstvalue, and indication flags are only set for the
signals which are entirely contained in the message. Also the
indication function is only
called for these signals.
4.8.2 Timeout flags and functions If the message is missing but was received before with a DLC > Lmin,
timeout flags and
functions are only called for the signals entirely contained in the DLC received last time. If
the message was never received, the flags and functions are set and called for all signals.
4.8.3 Impact on the application Before accessing a signal the application has to prove if the signal was received by check-
ing the corresponding indication flag. If the indication flag is set, the signal was entirely
received and can be used. Otherwise the default value must be used. For the further han-
dling two cases must be treated:
1. The DLC will not change during a session ( Init -> Stop ) This means the message is always received with the same DLCmessage where Lmin <=
DLCmessage <= DLC. In this case the indication flags are set once and don’t need to be
cleared by the application. The signal can be accessed whenever needed (of course the
indication flag still has to be checked !).
2. The DLC may change with every message This means the message may have a different DLC on every reception. In this case the
application must clear the indication flags when a new message is received before they
are set by the IL. This ensures that the indication flags are set correctly on every reception
and no invalid signals are read by the application.
To do so the application has to define a message precopy function for this message
where all the indication flags are cleared. Additionally IL polling must be inactive for this
message.
Example: Message name :
message_1
Precopy function:
message_1_precopy (the name is assigned in the generation tool )
Signal names:
signal_1, signal_2, signal_3
Data Access in the application
***********************************************
/* DATA Access signal_1*/
if( ILGetsignal_1Ind() ) /* Signal valid? */
{
/* Access of the data via IL macro */
variable_1 = ILGetRxsignal_1();
}
else
{
variable_1 = <Default> /* Default value */
}
***********************************************
/* DATA Access signal_2*/
if( ILGetsignal_2Ind() ) /* Signal valid? */
{
/* Access of the data via IL macro */
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
12
variable_2 = ILGetRxsignal_2();
}
else
{
variable_2 = <Default> /* Default value */
}
***********************************************
/* DATA Access signal_3*/
if( ILGetsignal_1Ind() ) /* Signal valid? */
{
/* Access of the data via IL macro */
variable_3 = ILGetRxsignal_3();
}
else
{
variable_3 = <Default> /* Default value */
}
***********************************************
message precopy function
***********************************************
vuint8 message_1_precopy(…)
{
/* clear all indication flags via IL macros*/
ILClrsignal_1Ind();
ILClrsignal_2Ind();
ILClrsignal_3Ind();
return
kCanCopyData;
}
***********************************************
4.8.4 Access to the actual DLC The actual received DLC of a message is written to the variable
canVariableRxDataLen[index] where index is the receive handle of the message. This
message handles are defined in the <board1.h> file which is generated by the Generation
tool. In the example above the handle would be defined as
CanRxmessage_1 /* get the actual DLC */
actual_dlc = canVariableRxDataLen[CanRxmessage_1];
4.9 Cancel of pending transmit messages For PSA the application has to cancel a transmit message as soon as there is no confir-
maition for 15ms-20ms (N_as time).
Depending on the configuration, the supervision of the N_as time and the removing of the
messages from the transmit buffer can be handled by the station-manger. In this case
also the actual value of the N_as counter is written to the corresponding signal.
Prerequisite is a call of the SmTask() function in a cycle time not greater 5ms. This is due
to the granularity of the counter and must be kept to fulfil the timing constraint of 15-20
ms.
The TxObserve functionality must be activated in the CAN driver configuration.
Additionally a special Attribute must be set in the database for the signal containing the
value of the N_as counter:
Attribute:
Name GenSigSpecialFunction
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
13
Type String
Elements -
Value NmOsekI_Nas ( attention: letter after Osek is not minor
L but major
i )
Particularities This attribute has to be set for the signal containing the value of the N_as counter to be
transmitted to the BSI ECU
Note: Also if N_as supervision is performed by the station-manager chapt
er 4.9.1 has to be
taken into account.
If SmTask() can’t be called in a cycle time of less or equal 5ms, the supervision of the
N_as time has to be done by the application. To do so, you have to activate the TxOb-
serve functionality in the GenTool-> CAN Driver page. Every time a message is copied
into the transmit buffer the Callback funtion
void ApplCanTxObjStart ( CanObjectHandle txHwObject ) is called. Now a timer can be started. If the message was transmitted successful, the call-
back function
void ApplCanTxObjConfirmed ( CanObjectHandle txHwObject ) is called and the corresponding timer is cancelled.
If the timer isn’t cancelled in time,
void CanCancelTransmit ( txHandle ) has to be called. To get the txHandle from the txHwObject the function
txHandle = CanTxGetActHandle(CanObjectHandle txHwObject ) is provided. Since in most systems the transmission is running in interrupt context
whereas the application runs in task context, it is possible that while the timeout N_as is
detected the message is transmitted. Therefore the value returned from this function
must be checked by the application to avoid calling CanCanceltTransmit (..) with a invalid
txHandle.
If ( txHandle < kCanNumberOfTxObjects ) { /* txHandle is valid */
Message was not sent, increment N_as counter
}
else
{
/* txHandle invalid */
Message was sent, don’t increment N_as counter
}
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
14
Note: The return value must be checked! Otherwise data may be overwritten by the function
CanCancelTransmit(..).
In case the Can driver is reinitialised, the callback function
void ApplCanInit (CAN_CHANNEL_CANTYPE_FIRST CanObjectHandle txHwObjectFirstUsed, CanObjectHandle txHwObjectFirstUnused ) is called. In this case all pending N_as timers must be stopped.
After the cancellation of a transmit message, the transmit object of the CAN driver is not
released automatically because dependent on the hardware platform, internal states have
to be checked. To release the transmit object the function
CanTxTask() or
CanTask() must be called by the application
periodically. The period time should be as short as pos-
sible as the transmit object will be blocked until it is released by
CanTxTask(). Note: Since the transmit object is only released if internal states are met, it is not sure that it is
released with the first call of
CanTxTask(). Therefore it is not sufficient to call it once after
you called
CanCancelTransmit(). It must be called periodically!
4.9.1 Configuration of the TP when using CanCanelTransmit() If the N_as time is supervised by the application special care has to be taken when con-
figuring the TP. The TP also provides a supervision of the N_as time for the TP mes-
sages. These messages are now also supervised by the application. To avoid unexpected
behaviours caused by interferences of TP and application, make sure that the N_as time
configured in the TP is at least double the time of the N_as time supervised by the appli-
cation. In case of PSA this means 2*15ms = 30ms.
4.9.2 Example Code An example code how to implement the N_as supervision is given in the file demo_nas.c
which is part of the delivery.
4.10 Handling of the version message The version message is transmitted by the station-manger in case of a state change from
state
Reveil to Normal. The version message must be indicated to the Stationmanager by
setting the signal attribute
GenSigSpecialFunction in the database to
NmOsekI_Version for one of the signals contained in the version message.
4.11 Configuring the Part Offline mode To provide a correct handling of the transmit messages the user has to set up the part
offline modes for the transmit messages. Using the Part Offline functionality of he CAN
driver, the station manager controls the transmit permissions for the transmit messages.
E.g. the wake up message must only be transmitted in state wake up ( reveil ).
There are 4 different Offline groups: FUNCTIONAL, WAKEUP, JDD and DIAG.
By assigning the corresponding messages to these 4 groups they are only transmitted in
the state they are allowed. The wakeup message to the WAKEUP group, the functional
messages to the FUNCTIONAL group, the JDD message to the JDD group and the diag-
nosis messages to the DIAG group.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
15
The configuration of the offline groups is done in the TxMessages section on each mes-
sage ( s.below an example for the WakeUpMessage ).
4.12 Supervision Reset on Request of the Diagnosis On request of the diagonsis, the network supervision must be reset. Therefore a specific
API is provided which performs the reset of counters and states of the supervision:
SmResetSupervision(); When this API is called the Supervision is reset to the follwing values:
Volatiler counters State Supervison BSI
not confirmed
0 Confirmed
OK
Active/deactive
(as
absent
before reset)
BSI confirmed ab-
0 Confirmed
OK
Active
sent
5 Sleep and Wake Up sequence PSA 5.1 Transition from Sleep ( Veille ) to WakeUp ( Reveil ) After a nominal transition to sleep or after the initialization of the station-manager, it is in
state
sleep. Depending on the Sleep management type (Organ type) configured in the
Generation tool, there are 1-3 events which will start the wake up sequence of the ECU:
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
16
5.1.1 External event ( Organ type 1, 2 and 4 ): In case of an external event, the application has a request to wake up the network. To
indicate the need of the network communication the API function
SmSetNetworkRe-
quest() is called. Within the next call of SmTask(), SM and INM are started and the call-
back function
ApplSmTrcvOn() is called. This callback can be used to wake up the CAN
driver and start the IL ( if present ):
ApplSmTrcvOn()
{…
CanWakeUp();
IlTxStart();
IlRxStart();
…
}
The SM enters state wakeup (reveil) and starts to transmit the Wakeup message.
Note: As long as the NetworkRequest is active, the Station-manager will not enter sleep
mode. Due to this it is required that the application releases the network request if network
communication is not required anymore. This can be done by the API SmReleaseNet-
workRequest() If the Request isn’t released, the Nm will try to wake up the network as soon as “MODE
NORMAL” is left. This function isn’t a trigger to have a single WakeUp event! If set
the Nm will try to wake Up the network until the maximum number of allowed at-
tempts is exceeded! If a single Wake Up is required, the Request must be released using SmReleaseNet-
workRequest() as soon as the Wake up attempt failed ( no state change to normal ) Note: The SM only takes control about offline groups (thus if the message is allowed to be
sent in this ECU state or not ). If there is an IL in the system and the Wakeup message is
configured as cyclic message, the application doesn’t have to take care about the trans-
mission of it. If there is no IL in the system, the application has to take care about the transmission and
the transmit cycle of the Wakeup message
. 5.1.2 Bus event ( Organ type 1, 2 and 4 ) In case of a Bus event ( reception of a CAN message ) the callback
ApplCanWakeUp() is
called in the application, which indicates the wake up interrupt. To start up the networ-
management the API
SmSetWakeUpRequest() has to be called.
Within the next call of SmTask(), SM and INM are started and the callback function
ApplSmTrcvOn() is called. This callback can be used to wake up the CAN driver and
start the IL ( if present ):
ApplSmTrcvOn()
{…
CanWakeUp();
IlTxStart();
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
17
IlRxStart();
…
}
The SM enters state wakeup (reveil) and starts to transmit the Wakeup message.
Note: even so the CAN cell is already awake, the call of CanWakeUp() doesn’t cause a
malfunction. In case of Bus event, no wake up message is transmitted.
5.1.3 +CAN activation Organ type 1 and 2 In case of a +CAN event ( +CAN line changes to active ), the new state of the +CAN line
has to be indicated to the network management by using the API
SmSetPlusCan-
State(kSmPlusCanActive). If in state sleep, the wake up sequence is started and the
callback function
ApplSmTrcvOn() is called. This callback can be used to wake up the
CAN driver and start the IL ( if present ):
ApplSmTrcvOn()
{…
CanWakeUp();
IlTxStart();
IlRxStart();
…
}
The SM enters state wakeup (reveil) and starts to transmit the Wakeup message.
No wake up message must be transmitted in this case.
5.1.4 +CAN activation Organ type 3 For organ type 3 two different situations have to be distinguished:
ECU is powered by the +CAN line only In case the ECU is only powered by the +CAN line, the ECU is powered up as soon as
+CAN line is present. After initialization the application has to call the API
SmSetPlus-
CanState(kSmPlusCanActive) to put the SM into state “Reveil”. The callback function
ApplSmTrcvOn() is called and can be used to start the IL ( if present ):
ApplSmTrcvOn()
{…
IlTxStart();
IlRxStart();
…
}
The CAN driver don’t have to be started in this use case.
ECU is powered by an additional power supply ©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
18
If the ECU is powered by a different power supply as +CAN, the +CAN behaviour has to
be simulated. This means that during the absence of +CAN the ECU must not acknowl-
edge any CAN frame. Therefore the CAN driver must be stopped when +CAN is absent.
For the wake up sequence the application has to supervise the +CAN signal. If +CAN is
switched on, the API
SmSetPlusCanState(kSmPlusCanActive) has to be called. The
callback function
ApplSmTrcvOn() is called and can be used to start the CAN driver and
IL ( if present ):
ApplSmTrcvOn()
{…
CanStart();
IlTxStart();
IlRxStart();
…
}
In this case the CAN driver must be started with the API
CanStart() as it is in stop mode
for organ type 3 with additional power supply.
5.2 Transition to Veille 5.2.1 Organ type 1,2 and 4 Whenever there is a request (either by BSI or the netmanagement ) to switch to the state
VEILLE , the SM waits for one seoncd ( as specified ) and enters the state “Veille”. The
INM is stopped and the callback function
ApplSmTrcvOff() is called. This callback can be
used to stop the IL ( if present ) and put the CAN driver into sleep mode:
ApplSmTrcvOff()
{…
IlTxStop();
IlRxStop();
CanSleep();
…
}
The required calls to
CanOffline() and
CanResetBusSleep() (s. Driver manual ) are per-
formed by the SM already.
5.2.2 Organ type 3 ECU is powered by the +CAN line only In this case no action is required by the application as the power supply is switched off
during transition to state “Veille” by the the BSI ECU.
ECU is powered by the +CAN line only If the ECU is powered by an additional power supply, the application has to call the API
SmSetPlusCanState(kSmPlusCanDeactive). This will stop the SM and INM immediately
and the callback function
ApplSmTrcvOff() called. This callback can be used to stop the
IL ( if present ) and put the CAN driver into stop mode:
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
19
ApplSmTrcvOff()
{…
IlTxStop();
IlRxStop();
CanStop ();
…
}
Note: In this use case the CAN driver must be put into stop mode as to avoid that the
CAN driver is woken up by a frame during a deactivated +CAN line. 5.3 Setting and Releasing a Request for the network To avoid that the ECU enters sleep mode because the application needs the network, the
network must set a request to the network management. On the other hand side if the
application is able to sleep ( doesn’t need the network at the moment ) the application
must release the request to the network management as well.
If a request isn’t released, the ECU will never enter the sleep mode! To set and release a request two macros are provided :
SmSetWakeUpRequest( ) to set
SmReleaseWakeUpRequest( ) to release
5.4 Indication of the +CAN signal to the Station manager As the internal state transition of the SM depends also on the +CAN signal, the state of
the +CAN line has to be indicated to the SM whenever the state changes. To indicate the
state the API
SmSetPlusCanState(state) is provided.
In case of organ type 3 with additional power supply, calling this API with state
kSmPlus-
CanDeactive will put the SM into Sleep mode immediately.
6 API of the station-manager The SM application program interface consists of services, which are realised by function
calls. The services are called wherever they are required. They transfer information to the
SM or take over information from the SM. This information is saved in the SM until it is
not required anymore, respectively until it is changed by other operations.
6.1 Version of the source code The source code version of the SM is provided by three BDC coded constants:
kStatMgrMainVersion = (uint8)((STATION_MANAGER_VERSION >> 8) );
kStatMgrSubVersion = (uint8)(STATION_MANAGER_VERSION );
kStatMgrBugFixVersion = (uint8)(STATION_MANAGER_BUGFIX_VERSION);
Example :
Version 3.20 is registered as (Bugfix Version 0):
kStatMgrMainVersion = 0x03;
kStatMgrSubVersion = 0x20;
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
20
kStatMgrBugfixVersion = 0x00;
This information can be read by the application at any time.
6.2 station-manager services called by the application 6.2.1 SmInitPowerOn: Initialisation of the station-manager Prototype void
SmInitPowerOn ( void )
Parameter Return code Functional Both the indirect OSEK network management and the station manager are initialized.
description - variables are set to default values
- internal/external state: “VEILLE”
- reset BusOff recovery algorithm
- initialise NM
Particularities The CAN interrupts (Tx, Rx, Error) have to be disabled.
and Limitations 6.2.2 SmTask: cyclic Task Prototype void
SmTask(void / channel )
Parameter Channel If
multichannel
system
Return code Functional The complete polling handling is done in this function:
description - network state transitions by slave/master ECU
- diagnostic handling for (non-)volatile counters
- Tx and Rx timeout observation
- different BusOff recovery algorithms (MEDIUM, SLOW)
- wakeup request to force state “MODE NORMAL”
- sending of network management message
Particularities The SM must be initialised when this function is called.
and Limitations 6.2.3 SmGetStatus: Read the internal status of ECU Prototype vuint 8
SmGetStatus(void / channel)
Parameter Channel If
multichannel
system
Return code Internal Status of ECU (variable “bSmIntState “)
Functional This function returns the current status of the ECU (e.g. to suppress the timeout obser-
description vation.
Particularities The SM must be initialised when this function is called.
and Limitations 6.2.4 SmGetVolCNerr: Read the Value of the volatile Nerr Counter (Macro) ©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
21
Prototype SmGetVolCNerr(void / channel
) Parameter Channel If
multichannel
system
Return code Macro descrip-This macro returns the current value of the volatile Nerr counter
tion Particularities and Limitations 6.2.5 SmSetVolCNerr: Set the Value of the volatile Nerr Counter (Macro) Prototype SmSetVolCNerr (void / channel
, val
) Parameter Val
Vuint8 Value to be set
Channel If
multichannel
system
Return code Macro descrip-This macro sets the current value of the volatile Nerr counter
tion Particularities and Limitations 6.2.6 SmGetVolCPerteCom: Read the Value of the volatile PerteCom Counter (Macro) Prototype SmGetVolCPerteCom(void / channel
) Parameter Channel If
multichannel
system
Return code Macro descrip-This macro returns the current value of the volatile PerteCom counter
tion Particularities and Limitations 6.2.7 SmSetVolCPerteCom: Set the Value of the volatile PerteCom Counter (Macro) Prototype SmSetVolCPerteCom (void / channel
, val
) Parameter Val
Vuint8 Value to be set
Channel If
multichannel
system
Return code Macro descrip-This macro sets the current value of the volatile PerteCom counter
tion Particularities and Limitations 6.2.8 SmGetVolCBoff: Read the Value of the volatile BusOff Counter (Macro) Prototype SmGetVolCBoff (void / channel
) Parameter Channel If
multichannel
system
Return code Macro descrip-This macro returns the current value of the volatile BusOff counter
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
22
tion Particularities and Limitations 6.2.9 SmSetVolCBoff: Set the Value of the volatile BusOff Counter (Macro) Prototype SmSetVolCBoff (void / channel
, val
) Parameter Val
Vuint8 Value to be set
Channel If
multichannel
system
Return code Macro descrip-This macro sets the value of the volatile BusOff counter
tion Particularities and Limitations 6.2.10 SmSetWakeUpRequest: A CAN frame was received and woke up the ECU Prototype Void
SmSetWakeUpRequest(void / channel
) Parameter Channel If
multichannel
system
Return code Functional A CAN frame was received by the ECU and the NM must be started.
description Particularities This function is only available for Organtyp 1, 2 and 4
and Limitations 6.2.11 SmSetNetworkRequest: Release a Network Request to the network management Prototype SmSetNetworkRequest(void / channel
) Parameter Channel If
multichannel
system
Return code Functional The application needs the CAN network. Therefore a network request is set. If the ECU
description isn’t in application mode a specific wakeup message is sent periodically to force the
master ECU to change the state of all slave ECUs to “MODE NORMAL”.
Particularities This macro is only available for Organtyp 1, 2 and 4.
and Limitations If the Request isn’t released, the Nm will try to wake up the network as soon as
“MODE NORMAL” is left.
This function isn’t a trigger to have a single WakeUp
event! If set the Nm will try to wake Up the network until the maximum number of
allowed attempts is exceeded! If a single Wake Up
is required, the Request mus be released using
SmReleaseNet-
workRequest() as soon as the Wake up attempt failed ( no state change to normal )
6.2.12 SmReleaseNetworkRequest: Release a Network Request to the network management Prototype SmReleaseNetworkRequest(void / channel
) Parameter Channel If
multichannel
system
Return code ©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
23
Functional The application doesn’t need the CAN network anymore. Therefore the network re-
description quest is released and the ECU can enter Sleep mode
Particularities This macro is only available for Organtyp 1, 2 and 4.
and Limitations 6.2.13 SmSetPlusCanState(state) Prototype SmSetPlusCanState(void / channel, state
) Parameter State
State of the +CAN signal: 1 +CAN active; 0 +CAN not active
(vuint8)
Channel If
multichannel
system
Return code Functional The application indicates the state of the +CAN line to the station manager
description This function is also called to wake up the ECU in case of a +CAN Wake Up event.
Particularities This macro is only available for Organtyp 1+ 2 and 3.
and Limitations 6.2.14 SmTransmitNmMessage: Tranmsit the supervised Tx message on next call of SmTask() Prototype SmTransmitNmMessage(void / channel
) Parameter Channel
Channel on which the supervised message must be sent
Return code Macro descrip-This macro sets the internal Tx cycle counter to 1, so on the next call of SmTask() the
tion supervised Tx message is sent.
Particularities and Limitations ©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
24
6.3 Application functions required by the station-manager The prototypes of the functions required by the SM are defined in the header.
Note: The application functions must match the required interfaces. This can be ensured by in-
cluding the SM header file in the modules which provide the required application func-
tions. If these interfaces do not match, unexpected run-time behaviour may occur. These functions are not allowed to change the interrupt status. This is expected by the
corresponding functions of the SM. 6.3.1 ApplSmStatusIndicationTx: Status of transmission indication Prototype void
ApplSmStatusIndicationTx( inmNmStatusType status)
Parameter status
Status of transmission.
Return code Functional User specific function which is called if the state of transmission will be changed. The
description state which will be entered is passed as parameter.
Particularities This function will only be called if configured. Please refer to the chapter about configu-
and Limitations ration.
6.3.2 ApplSmStatusIndicationRx: Status of reception indication Prototype void
ApplSmStatusIndicationRx( inmNmIndexType index, inmNmStatusType
status )
Parameter index
Handle of the monitored receive message. Handle can be 0 to r-1 (r
= number of all monitored receive messages) starting with 0.
status
Status of reception.
Return code Functional User specific function which is called if the state of reception will be changed. The state
description which will be entered is passed as parameter.
6.3.3 ApplSmStatusIndicationNerr: Status of Nerr Pin indication Prototype void
ApplSmStatusIndicationNerr( inmNmStatusType status )
Parameter status
Status of reception.
Return code Functional User specific function which is called if the state of Nerr will be changed. The state
description which will be entered is passed as parameter.
Particularities This function will only be called if configured. Please refer to the chapter about configu-
and Limitations ration.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
25
6.3.4 ApplSmStatusIndication: State of ECU has changed Prototype void
ApplSmStatusIndication( inmNmStatusType status)
Parameter status
Status of transmission.
Return code Functional User specific function which is called if the state of transmission will be changed. The
description state which will be entered is passed as parameter.
Particularities This function will only be called if configured. Please refer to the chapter about configu-
and Limitations ration.
6.3.5 ApplCanErrorPin: Get Status of Transceiver Error Pin Prototype canuint8
ApplCanErrorPin( void )
Parameter Return code Status of Error Pin. Encoding: 0 no Error , 1 Error
Functional User specific function which is called when the SmCanNerrAccess ( ) function is exe-
description cuted. It returns the Status of the Error Pin of the transceiver, if available.
Particularities This function will only be called if configured. Please refer to the chapter about configu-
and Limitations ration.
6.3.6 ApplSmGetInterdMemoDef: Get Status of filtered Interd_Memo_Def Bit Prototype canuint8
ApplSmGetInterdMemoDef( void )
Parameter Return code Filtered state of the Interd_Memo_Def signal ( 0 signal is not set , >0 signal is
present )
Functional This function returns the filtered state of the signal Interd_Memo_Def. While this bit is
description set, the values of the volatile counters aren’t changed. If this signal isn’t provided, the
function must return 0.
Particularities and Limitations 6.3.7 ApplSmSetNVAbsentCount: Set the non volatile Rx counter Prototype void
ApplSmSetNVAbsentCount( inmNmIndexType index, canunint8 value )
Parameter index
Handle of the monitored receive message. Handle can be 0 to r-1 (r
= number of all monitored receive messages) starting with 0.
value
Value of counter
Return code Functional User specific function which is called if the state of reception will be changed (in Ap-
description plInmNmSetNVAbsentCount) and the non volatile storage of error counters is activated
.
Particularities This function will only be called if configured. Please refer to the chapter about configu-
and Limitations ration.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
26
6.3.8 ApplSmSetNVMuteCount: Set the non volatile Tx counter Prototype void
ApplSmSetNVMuteCount( canunint8 value )
Parameter value
Value of counter
Return code Functional User specific function which is called if the state of transmission will be changed (in
description ApplInmNmSetNVMuteCount) and the non volatile storage of error counters is acti-
vated .
Particularities This function will only be called if configured. Please refer to the chapter about configu-
and Limitations ration.
6.3.9 ApplSmSetNVNerrCount: Set the non volatile Nerr counter Prototype void
ApplSmSetNVNerrCount( canunint8 value )
Parameter value
Value of counter
Return code Functional User specific function which is called if the state of the Nerr supervision will be
description changed and the non volatile storage of error counters is activated .
Particularities This function will only be called if configured. Please refer to the chapter about configu-
and Limitations ration.
6.3.10 ApplSmGetNVAbsentCount: Get the non volatile Rx counter Prototype Canuint8
ApplSmGetNVAbsentCount (
inmNmIndexType index )
Parameter Index
Handle of the monitored receive message. Handle can be 0 to r-1 (r
= number of all monitored receive messages) starting with 0.
Return code Value of non volatile Rx counter.
Functional User specific function which is called when the non volatile counters are initialised in
description ApplInmNmInitVolatileCounters( ) and is called in ApplInmNmGetNVAbsentCount to
get the absent counter value.
Particularities This function will only be called if the storage of error counters is activated. Please
and Limitations refer to the chapter about configuration.
6.3.11 ApplSmGetNVMuteCount: Get the non volatile Tx counter Prototype Canuint8
ApplSmGetNVMuteCount ( void )
Parameter Return code Value of non volatile Tx counter.
Functional User specific function which is called when the non volatile counters are initialised in
description ApplInmNmInitVolatileCounters( ).
Particularities This function will only be called if the storage of error counters is activated. Please
and Limitations refer to the chapter about configuration.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
27
6.3.12 ApplSmGetNVNerrCount: Get the non volatile Nerr counter Prototype Canuint8
ApplSmGetNVNerrCount ( void )
Parameter Return code Value of non volatile Nerr counter.
Functional User specific function which is called when the non volatile counters are initialised in
description ApplInmNmInitVolatileCounters( ).
Particularities This function will only be called if the storage of error counters is activated. Please
and Limitations refer to the chapter about configuration.
6.3.13 ApplSmTrcvOn: Switch on the transceiver Prototype Void
ApplSmTrcvOn ( void )
Parameter Return code Functional User specific function which is called when the Netmanagement is switched on. Calls
description the hardware specific routines to activate the transveiver.
Particularities and Limitations 6.3.14 ApplSmTrcvOff: Switch off the transceiver Prototype Void
ApplSmTrcvOff ( void )
Parameter Return code Functional User specific function which is called when the Netmanagement is switched off. Calls
description the hardware specific routines to deactivate the transveiver.
Particularities and Limitations 6.3.15 ApplNwmBusOff: Bus off indication Prototype Void
ApplNwmBusOff ( void )
Parameter Return code Functional User specific function which is called when a Bus Off situation is detected.
description Particularities and Limitations ©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
28
6.3.16 ApplNwmBusOffEnd: Bus off recovery ended Prototype Void
ApplNwmBusOffEnd ( void )
Parameter Return code Functional User specific function which is called when the Bus Off recovery is finished.
description Particularities and Limitations 6.3.17 ApplSmFatalError: Error in assertion occurred Prototype Void
ApplSmFatalError ( canuint8 errorcode)
Parameter errorcode
Error code for SM assertion (defined in header file)
Return code Functional The code contains self testing code sequences which check necessary preconditions
description of states, parameters, … during runtime. If an unexpected value is detected this func-
tion is called.
Particularities The function is only used if runtime checks (debug switch) are activated in the genera-
and Limitations tion tool.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
29
7 Configuration of the station-manager The complete configuration can be done by using the generation tool
CANGen. The op-
tions are described below. The configuration data is generated into the file stat_cfg.h.
The Station-manager configuration dialog
7.1 General Configuration User Config File:
If in any case you need some special configuration, you can create a user specific con-
figuration file and enter the path here. The Generation Tool inserts the file automatically
to the normal configuration.
7.2 Status Callback functions The following callback functions can be activated:
7.2.1 ECU StateChange Callback: Whenever the state of the ECU is changing (wakeup, sleep, normal,…) the application is
notified by the
ApplSmStatusIndication callback function.
7.2.2 Fault State Support: This switch enables the callback functions
ApplSmStatusIndicationRx
ApplSmStatusIndicationTx
ApplSmStatusIndicationNerr
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
30
Whenever the state of a supervised ECU, the Mute state of the own ECU or the Nerr su-
pervision state changes the corresponding callback function is called with the states OK,
Failure, Confirmed Failure
7.2.3 Fault Storage Support: Enables the non volatile storage support for network errors. If enabled, the station man-
ager indicates to the application that for a supervised ECU, the Mute state or the Nerr
state a non volatile error must be stored due to a confirmed failure detection. The follow-
ing callbackfunctions are called in the application:
ApplSmSetXXXAbsentCount
ApplSmGetXXXAbsentCount
where XXX is either
Absent, Mute or Nerr.
7.2.4 Bus Off Callback Support : Enable or disable the notification of the application about the beginning of the Bus Off
recovery sequence. If this switch is active, the function
ApplNwmBusoff() is called by
the Station Manager.
7.2.5 Bus Off End Callback Support: Enable or disable the notification of the application about the end of the Bus Off recovery
sequence. If this switch is active, the function.
ApplNwmBusoffEnd() is called by the Sta-
tion Manager.
7.2.6 Use Flag InterdMemoDef Enables the handling of the InterdMemoDef flag. The application has to provide the func-
tion
ApplSmGetInterdMemoDef (…) where it returns the current state of the signal Int-
edMemoDef.
7.2.7 ECU State Change in Task Context This switch is enabled by default. With this setting the state change requested by the BSI
ECU by the message Commande_BSI is performed on task level and the transition time
thus dependent on the cycle time of the SmTask().
IF the switch is disabled, the transition is performed immediately when receiving the
Commande_BSI message. If the system is runnging in interrupt mode, be aware that the
state change callback ( if configured ) is executed in interrupt context.
7.2.8 N_as Timeout Handling If enabled the N_as timeout handling is supported by the station manager.
This is only possible if the task cycle time is less or equal 5ms.
7.2.9 Sleep Management Select the Organ type of your ECU. Please note that “No Sleep management” is not sup-
ported!
7.2.10 Task cycle Adjust the task cycle time of SmTaski() in ms.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
31
7.2.11 Debug Support If enabled Station manager specific assertions are activated.
If activated, the callback function ApplSmFatalError must be provided by the Application.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
32
8 Database attributes Some supplementary data and configurations are stored in the database as attributes of
specific objects. To provide a correct generation of configuration files, these attributes
have to be set to specific values.
8.1 Receive Message Attribute Name NmInmMaster
Type Enum
Elements No, Yes
Value No, Yes
Particularities Set this attribute to yes for the message containing the signal containing the ECU state
request ( e. g. /RCSM/: Master_WakeUpSleepCmd ; [INM PSA]: Phases_de_vie )
Name NmMessage
Type Enum
Elements No, Yes
Value No, Yes
Particularities Set this attribute to yes for the messages where the Mode Degrade Fonctionnel has to
be supervised ( s. chapter 3.5 )
Name GenMsgMinAcceptLength
Type Integer
Elements -
Value 0--8
Particularities Set this value to Lmin of the specific message. If no Lmin value is given set it to DLC
Name GenMsgTimeoutTime_<ECU>
Type Integer
Elements -
Value 0—10000
Particularities If the message is supervised by your ECU ( in terms of NM ), set this attribute to the
timeout time of the supervised message (in general it’s 3 times the cycle time).
<ECU> is the name of the ECU you develop.
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
33
Name GenMsgStartDelayTime
Type Integer
Elements -
Value 0—10000
Particularities This attribute gives the delay time in ms before the message is transmitted the first
time after enabling the IL TX path by function ILTxStart()
8.2 Signal Attribute Name GenSigSpecialFunction
Type String
Elements -
Value NmOsekI_Version ( attention: letter after Osek is not minor
L but major
i )
Particularities This attribute has to be set for at least one signal of the version
Name GenSigSpecialFunction
Type String
Elements -
Value NmOsekI_Nas ( attention: letter after Osek is not minor
L but major
i )
Particularities This attribute has to be set for the signal containing the value of the N_as counter to be
transmitted to the BSI ECU
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Station manager for PSA Technical Reference
34
9 Precautions This chapter describes specific precautions which have to be taken into account.
9.1 Calling CanSleep(…); within status callback Some specific CAN drivers may run into a endless loop or a hardware trap when calling
CanSleep(..); inside a CAN interrupt. The callback function
ApplSmStatusIndication(…); is called in a CAN interrupt context if the feature <ECU state change in Task context>
(ref.chapter
7.2.7) is deactivated.
Please make sure not to call
CanSleep(…); inside this callback function if the state
change is not in task context!
©2011, Vector Informatik GmbH
TechnicalReference_Stationmanager.doc Version
3.05
Document Outline
1.1.48 - TechnicalReference_TransportProtocolMultiConnection
YourTopic1.1.50 - TechnicalReference_TransportProtocolMultiConnections

Technical Reference Transport Protocol ISO15765-2
Transport Protocol ISO15765-2
Technical Reference
Single/Multiple Connection
Version 3.14.00
Authors
Oliver Garnatz, Andreas Pick, Peter Herrmann,
Thomas Dedler
Status
Released
2013, Vector Informatik GmbH
Version: 3.14.00
1 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Document Information History Author Date Version Remarks Rein
1999-06-22
1.0
File created
Baeuerle
1999-11-02
1.42
Description of connection
specific timing parameters
added
Ebner
2000-07-17
1.51
Single connection version
removed; documents only
contains multiple connection
extensions
Garnatz
2000-09-19
2.03
Adaptation to new
MultiConnection TP
Garnatz
2001-02-09
2.07
Added new functionality
Garnatz
2001-05-11
2.10
Update new Generation Tool
versions
Garnatz
2001-09-14
2.17
General improvement;
Update to version 2.17 of
tpmc.c module
Garnatz
2002-01.24
2.27
SingleConnection version is
added; Protocol-Overview is
added
Garnatz
2002-06-18
2.33
Added restrictions for data
consistency
Pick / Garnatz
2002-10-16
2.36
Update: CAN Driver in polling
mode
Added: Fast transmission of
ConsecutiveFrames
Update: Usage of TransmitCF
parameter
Garnatz
2002-11-29
2.37
General rework
Garnatz
2003-01-16
2.39
Update:
TpTransmit/CopyToCan/Appl
TpCheckTA
Garnatz
2004-01-13
2.44
Update: ApplTpCopyToCAN
Pick
2004-03-01
2.52
Update: Mixed 29-bit ID
addressing
TpRxGetCanBuffer
TpRxSetBufferOverrun
TpRxGetAddressExtension
TpTxSetAddressExtension
Pick
2004-05-14
2.60
Multiple ECUs example
Restriction on
TpTxStateTask/TpRxStateTas
k
Tx/Rx message buffer
2013, Vector Informatik GmbH
Version: 3.14.00
2 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
consistency clarification
Return value of
ApplTpPreCopyCheck
Mixed 11-bit ID addressing
TpTransmit() return values
Added TpCanChannelInit()
Added TpRxSetTransmitID()
Changed
TpRxSetBufferOverrun
Changed
ApplTpTxCopyToCAN
Changes in chapter ‘How to
serve Different
Connections (only
dynamic channels)’.
Pick
2004-12-01
2.68
Added description for GENy
configuration tool
(ESCAN00008734).
Update of API description
(ESCAN00008314).
Feature list added
(ESCAN00008315).
Prototype parameter
corrected (ESCAN00009965)
Pick
2005-04-07
2.72.00
Added description for multiple
addressing systems.
C++ access to TPMC.
Pick
2005-07-14
2.73.00
Added description for GENy
configuration
Herrmann
2005-07-19
2.73.00
Added new API functions:
TpRxSetWaitCorrectSN,
TpTxSetStrictFlowControlChe
ck
Herrmann
2005-08-11
2.73.00
Added new API functions:
TpRxSetTimeoutConfirmation
,
TpTxSetTimeoutConfirmation,
TpRxSetTimeoutCF,
TpTxSetTimeoutCF
Garnatz
2006-01-13
2.80.00
Added deviation to ISO
15765-2
Herrmann
2006-02-08
2.82.00
ISO 15765-2 deviations
elaborated
Herrmann
2006-03-03
2.86.00
Cleanup (ESCAN15514)
Herrmann
2006-03-23
2.86.00
ISO 15765-2 deviations
elaborated
Herrmann
2006-04-11
2.87.00
General rework after review
Herrmann
2006-07-03
2.89.00
Added WaitFrame handling.
2013, Vector Informatik GmbH
Version: 3.14.00
3 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Herrmann
2007-02-01
2.90.00
Added OEM feature
TP_ENABLE_STRICT_DL_C
HECK
Herrmann
2007-02-23
2.91.00
Added feature
TP_DISABLE_MF_RECEPTI
ON
Herrmann
2007-03-14
2.92.00
Added ApplFuncTpPrecopy
callback description and
reduced TpRxResetChannel
API usage to indication point
in time or after.
Herrmann
2007-09-20
2.93.00
Completed Multiple ECU
description (see chapter
7.3.1). Added TpRxGet-
AddressingFormat /
AssignedDestination
description.
VERSION 3.xx
Herrmann
2007-10-15
3.00.00
Added description for new
TpClass
“Dispatched<AddressingType>”
Herrmann
2007-11-20
3.01.00
Cosmetics / Syntax
Herrmann
2008-01-14
3.02.00
New API:
TpTxGetTargetAddress
Herrmann
2008-02-12
3.03.00
Minor corrections within API
descriptions
(ApplTpTxErrorIndication,
TpRxGetCanBuffer)
Herrmann
2008-04-17,
3.04.00
Added description for
TP_ENBLE_DYN_CHANNEL_TIM
ING.
2008-07-17
Added description for the usage
of extended identifiers for
normal addressing as well at
configuration time as also
dynamically at runtime
(TP_USE_EXT_IDS_FOR_NO
RMAL).
Herrmann
2008-12-10
3.05.00
Added description for
GenMsgDelay attribute in
chapter
3.4.1 Herrmann
2009-01-25
3.07.00
Adapted version number to
ALM package number (3.06.00
skipped)
Herrmann
2009-11-25
3.08.00
Added description for reception
and transmission without flow
control frames for dyn.
(TpRxWithoutFC,
TpTxWithoutFC) and static
2013, Vector Informatik GmbH
Version: 3.14.00
4 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
(TpTxFlowControl,
TpRxFlowControl
) Tp classes.
Herrmann
2010-01-12
3.09.00
Enhanced description for DLC
checks on the Rx side (see
2.4.2.5). Added API functions for 29-Bit
ext. Id dynamic handling.
Heil
2010-11-08
3.10.00
Added more flexibility for DLC
checks on the Rx side (see
2.4.2.5) Herrmann
2011-01-19
3.11.00
Moved
TP_MEMORY_MODEL_DATA
from user config file to GENy
Herrmann
2011-04-05
3.12
ESCAN00051019: Added new
(customer specific) pre-compile
switches:
TP_ENABLE_IGNORE_FC_RE
S_STMIN,
TP_ENABLE_IGNORE_FC_OV
FL (see
3.2.3). Herrmann
2011-07-11
3.13
ESCAN00051019: Added
support for the dynamic setting
of 29-bit CAN-IDs (see
Dedler
2011-09-21
4.2.2.31, 4.2.2.32, 4.2.3.29,
4.2.3.30). Added new pre-compile switch:
TP_USE_UNEXPECTED_FC_
CANCELATION (see
3.2.3). Dedler
2012-04-10
3.13.01
Description of
TpRxGetCanBuffer modified
according to ESCAN00057225
Dedler
2013-04-30
3.14.00
Description for non-standard
flow control handling updated
(3.2.3) Reference Documents No. Title [1] /ISO/TF2/: ISO FDIS 15765-2; Road vehicles — Diagnostics on CAN — Part 2: Network
layer services;
Date 2004-07-16
[2] /OSEK-COM/: OSEK/VDX Communication Version 2.1, revision 1 17th June 1998
[3] /CANDrv/: Manual for CAN Driver in used version
[4] ISO15765-2: ISO TC 22/SC 3; ISO 15765-2:2003(E); Road vehicles — Diagnostics on
controller area network (CAN) — Part 2: Part 2: Network layer services
2013, Vector Informatik GmbH
Version: 3.14.00
5 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
Caution
We have configured the programs in accordance with your specifications in the
questionnaire. Whereas the programs do support other configurations than the one
specified in your questionnaire, Vector´s release of the programs delivered to your
company is expressly restricted to the configuration you have specified in the
questionnaire.
2013, Vector Informatik GmbH
Version: 3.14.00
6 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Contents 1 Introduction .................................................................................................................. 15 1.1 Relation between general component and shipped version capability .................... 15 1.2 Name Conventions ................................................................................................. 16 1.3 Abbreviations ......................................................................................................... 17 1.4 Channel vs. Connection ......................................................................................... 17 1.5 TP classes.............................................................................................................. 18 1.5.1 SingleTP classes ........................................................................................... 18 1.5.2 Static MultiTP classes ................................................................................... 18 1.5.3 Dynamic MultiTP classes .............................................................................. 18 1.5.4 Dispatched MultiTP classes .......................................................................... 18 1.6 SingleConnection vs. MultipleConnection ............................................................... 19 1.7 Features ................................................................................................................. 19 1.7.1 Feature List ................................................................................................... 19 2 Architecture Overview ................................................................................................. 23 2.1 Requirements ......................................................................................................... 23 2.1.1 Protocol-Overview ......................................................................................... 23 2.1.1.1 Construction of unsegmented messages ................................................ 23 2.1.1.2 Construction of segmented messages .................................................... 23 2.1.2 Addressing modes ........................................................................................ 24 2.1.2.1 Normal Addressing ................................................................................. 25 2.1.2.2 Mixed 11-bit ID Addressing ..................................................................... 25 2.1.2.3 Normal Fixed Addressing ....................................................................... 25 2.1.2.4 Extended Addressing.............................................................................. 25 2.1.2.5 Mixed 29-bit ID Addressing ..................................................................... 26 2.1.2.6 Structure of TPCI-Byte ........................................................................... 26 2.2 Transmission .......................................................................................................... 28 2.3 Reception ............................................................................................................... 29 2.4 Working behaviors .................................................................................................. 30 2.4.1 Timings ......................................................................................................... 30 2.4.2 Error detection............................................................................................... 31 2.4.2.1 Reception of a SingleFrame ................................................................... 31 2.4.2.2 Reception of a FirstFrame ...................................................................... 31 2.4.2.3 Reception of a FlowControl .................................................................... 31 2.4.2.4 Reception of a ConsecutiveFrame.......................................................... 32 2.4.2.5 Observing CAN frame DLC (Data Length Code) .................................... 32 2.4.3 Buffer consistency ......................................................................................... 33 2.4.4 Function re-entrancy ..................................................................................... 33 2.5 Restriction .............................................................................................................. 34 2013, Vector Informatik GmbH
Version: 3.14.00
7 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
2.5.1 Restrictions to ISO/TF2 specification ............................................................. 34 2.5.2 Limitations of Transport Protocol Implementation .......................................... 34 2.5.3 Deviations to ISO/TF2 specification ............................................................... 37 2.5.3.1 Handling of unexpected FlowControl / ConsecutiveFrame frames .......... 37 3 Settings for the MultiTP & SingleTP (multi-based) .................................................... 38 3.1 General settings with CANgen / DBKOMgen / GENy ............................................. 38 3.1.1 Timing ........................................................................................................... 39 3.1.1.1 Transmission timing ................................................................................ 39 3.1.1.2 Reception timing ..................................................................................... 39 3.1.1.3 Common timing ...................................................................................... 40 3.1.2 Flow Control .................................................................................................. 40 3.1.2.1 Transmission .......................................................................................... 40 3.1.2.2 Reception ............................................................................................... 40 3.1.3 Misc .............................................................................................................. 41 3.2 General settings with Generation Tool GENy .......................................................... 43 3.2.1 Configuration of Addressing Information ........................................................ 44 3.2.2 Usage of Far RAM buffers ............................................................................. 44 3.2.3 Non standard handling of Flow Control frames .............................................. 44 3.2.3.1 Reserved STmin Handling ...................................................................... 44 3.2.3.2 Ignore Flow Control Overflow ................................................................. 45 3.2.3.3 Do not ignore unexpected Flow Control frames ...................................... 45 3.2.3.4 Use STmin of FC .................................................................................... 45 3.2.3.5 Analyze first FC only .............................................................................. 45 3.3 Additional settings via user-configuration file .......................................................... 45 3.3.1 Dynamic Timing API ...................................................................................... 45 3.4 TP classes: SingleTP (multi-based) ........................................................................ 46 3.4.1 Database Attributes ....................................................................................... 46 3.4.2 TP class SingleTP (multi-based): Normal Addressing .................................... 47 3.4.3 TP class SingleTP (multi-based): Extended Addressing ................................ 47 3.4.4 TP class SingleTP (multi-based):Normal Fixed Addressing ........................... 47 3.4.4.1 Database Attributes ................................................................................ 47 3.5 TP classes Static MultiTP ....................................................................................... 47 3.5.1 Database Attributes ....................................................................................... 47 3.5.2 TP class specific settings .............................................................................. 48 3.5.3 Connection specific timing parameters .......................................................... 48 3.5.4 Functions ...................................................................................................... 49 3.6 TP classes Dynamic MultiTP .................................................................................. 49 3.6.1 Properties ...................................................................................................... 49 3.6.2 Hook Functions ............................................................................................. 50 3.6.3 Dynamic Objects ........................................................................................... 50 2013, Vector Informatik GmbH
Version: 3.14.00
8 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
3.6.4 TP class Dynamic MultiTP: Normal Addressing ............................................. 51 3.6.4.1 CANdriver settings ................................................................................. 51 3.6.5 TP class Dynamic MultiTP: Extended Addressing ......................................... 51 3.6.5.1 TP class specific settings........................................................................ 51 3.6.5.2 Database Attributes ................................................................................ 52 3.6.5.3 Multiple Base Addresses ........................................................................ 52 3.6.6 TP class Dynamic MultiTP: Normal Fixed Addressing ................................... 52 3.6.6.1 Database Attributes ................................................................................ 52 3.6.7 TP class Dynamic MultiTP: Mixed 29-bit Addressing ..................................... 53 3.6.8 TP class Dynamic MultiTP: Multiple Addressing ............................................ 53 3.6.8.1 Addressing mode ................................................................................... 53 3.6.8.2 CAN Driver settings ................................................................................ 53 3.7 TP class Dispatched MultiTP .................................................................................. 55 3.7.1 “Dynamic MultiTP” versus “Dispatched MultiTP” – a short analogy ............... 56 3.7.1.1 Solution based on “Dynamic MultiTP”: .................................................... 56 3.7.1.2 Solution based on “Dispatched MultiTP” ................................................. 57 3.7.2 Dispatched MultiTP API ................................................................................. 60 3.7.2.1 Reception side........................................................................................ 60 3.7.2.2 Transmission side ................................................................................... 61 4 API ................................................................................................................................. 63 4.1 Use of ISO15765-Transport Protocol ...................................................................... 63 4.2 Functions of the Transport Protocol ........................................................................ 63 4.2.1 Administrative Functions ............................................................................... 64 4.2.1.1 TpInitPowerOn: Initialization ................................................................... 64 4.2.1.2 TpInit: Re-initialization ............................................................................ 65 4.2.1.3 TpTask: Observing timing conditions ..................................................... 65 4.2.1.4 TpCanChannelInit: CAN channel specifiic re-initialization ....................... 66 4.2.1.5 TpRxTask: time base for reception timeouts ........................................... 67 4.2.1.6 TpTxTask: time base for timeouts/transmission ...................................... 68 4.2.1.7 TpRxStateTask: optional transmission retry ............................................ 69 4.2.1.8 TpRxAllStateTask: optional transmission retry ........................................ 69 4.2.1.9 TpTxStateTask: optional transmission retry ............................................ 70 4.2.1.10 TpTxAllStateTask: optional transmission retry ........................................ 71 4.2.2 Receive Functions ......................................................................................... 72 4.2.2.1 TpRxSetConnectionNumber: Assign a Connection-Number to a
channel .................................................................................................. 72 4.2.2.2 TpRxGetConnectionNumber: Get the Corresponding Connection-
Number .................................................................................................. 72 4.2.2.3 TpRxGetAddressingFormat: Get the current addressing type ................ 73 4.2.2.4 TpRxGetAssignedDestination: Get the currently assigned destination .. 74 2013, Vector Informatik GmbH
Version: 3.14.00
9 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.2.5 TpRxResetChannel: Free Rx-TpChannel ............................................... 75 4.2.2.6 TpRxGetStatus: Rx-Channel Status ....................................................... 76 4.2.2.7 TpRxSetBS: Setting up BlockSize on Reception Side ............................ 77 4.2.2.8 TpRxGetBS: Get BlockSize on Reception Side ...................................... 78 4.2.2.9 TpRxSetSTMIN: Setting up STMin time on Reception Side .................... 78 4.2.2.10 TpRxGetSTMIN: Get STMin time on Reception Side.............................. 79 4.2.2.11 TpRxGetChannelID: Get Received CAN-Id ............................................ 80 4.2.2.12 TpRxGetChannelExtID: Get Received Extended CAN-Id ....................... 81 4.2.2.13 TpRxGetCanChannel: Get physical CAN channel .................................. 81 4.2.2.14 TpRxGetSourceAddress: Get received Source Address ......................... 82 4.2.2.15 TpRxGetReceivedTargetAddress: Get received Target Address ............. 83 4.2.2.16 TpRxGetEcuNumber: Get ECU Number................................................. 84 4.2.2.17 TpRxGetParameterGroupIdentification: Get Identification of PGN .......... 84 4.2.2.18 TpRxSetBufferOverrun: Enable partial acceptance............................... 85 4.2.2.19 TpRxSetTransmitID: Set transmission CAN-Id...................................... 86 4.2.2.20 TpRxSetTransmitExtID: Set transmission Extended CAN-Id................. 87 4.2.2.21 TpRxGetChannelIDType: Get the type of the received CAN-Id ............. 88 4.2.2.22 TpRxGetAddressExtension: Get address extension information ............ 88 4.2.2.23 TpRxGetCanBuffer: Get CAN buffer pointer .......................................... 89 4.2.2.24 TpRxSetWaitCorrectSN: Force to wait for a correct sequence number ................................................................................................... 90 4.2.2.25 TpRxSetTimeoutConfirmation: Set CAN confirmation timeout ............... 91 4.2.2.26 TpRxSetTimeoutCF: Set Consecutive Frame confirmation timeout ....... 92 4.2.2.27 TpRxSetFCStatus: set up Flow Control on reception side ..................... 92 4.2.2.28 TpRxGetFCStatus: get the Flow Control setup on reception side .......... 93 4.2.2.29 TpRxSetClearToSend: proceed with the transmission after FC wait frames .................................................................................................... 94 4.2.2.30 TpRxWithoutFC: suppress FC frame usage at the Rx side .................... 95 4.2.2.31 TpRxSetPGN: Set Parameter Group Number ........................................ 96 4.2.2.32 TpRxSetPriorityBits: Set Priority, Data Page and Reserved bits ............. 97 4.2.3 Transmit Functions ........................................................................................ 98 4.2.3.1 TpTxGetFreeChannel: Assign Channel to Connection ........................... 98 4.2.3.2 TpTxGetConnectionNumber: Get the assigned Connection-Number ...... 99 4.2.3.3 TpTxGetConnectionStatus: Get the Connection Status .......................... 99 4.2.3.4 TpTxGetTargetAddress: Get the target address used for transmission 100 4.2.3.5 TpTxGetDataBuffer: Get the assigned Data Buffer ............................... 101 4.2.3.6 TpTxGetDataIndex: Get the assigned Data Index ................................ 102 4.2.3.7 TpTxSetChannelID: Set the CAN Transmit Id ....................................... 102 4.2.3.8 TpTxSetChannelExtID: Set the CAN Transmit Extended Id ................. 103 4.2.3.9 TpTxSetCanChannel: Set physical CAN Channel ................................ 104 4.2.3.10 TpTxSetTargetAddress: Set Target Address ......................................... 105 2013, Vector Informatik GmbH
Version: 3.14.00
10 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.3.11 TpTxSetEcuNumber: Set ECU Number ................................................ 106 4.2.3.12 TpTxSetBaseAddress: Set Base Address............................................. 106 4.2.3.13 TpTxSetParameterGroupIdentification: Set Identification of PGN ......... 107 4.2.3.14 TpTxSetPriority: Set Priority of the CAN-Frame .................................... 108 4.2.3.15 TpTxSetResponse: Assemble a Response ........................................... 109 4.2.3.16 TpTransmit: Send a Message ............................................................... 110 4.2.3.17 TpTxLockChannel: Lock Channel ......................................................... 111 4.2.3.18 TpTxUnlockChannel: Unlock TX Channel ............................................. 111 4.2.3.19 TpTxResetChannel: Free TX-Channel.................................................. 112 4.2.3.20 TpTxSetAddressExtension: Set Address Extension information .......... 113 4.2.3.21 TpTxGetSTminInFrame: Get STmin from FC frame ........................... 114 4.2.3.22 TpTxPrepareSendImmediate: Prepare CF transmission by application ............................................................................................ 115 4.2.3.23 TpTxSendImmediate: Start CF transmission by application ................ 115 4.2.3.24 TpTxSetAddressingFormat: Store the current addressing type ............ 116 4.2.3.25 TpTxSetStrictFlowControl: Enable/Disable ISO conformant FC handling ............................................................................................... 117 4.2.3.26 TpTxSetTimeoutConfirmation: Set the CAN confirmation timeout ........ 118 4.2.3.27 TpTxSetTimeoutFC: Set the FC confirmation timeout .......................... 119 4.2.3.28 TpTxWithoutFC: suppress FC frame usage at the Tx side ................... 120 4.2.3.29 TpTxSetPGN: Set Parameter Group Number ....................................... 121 4.2.3.30 TpTxSetPriorityBits: Set Priority, Data Page and Reserved bits ............ 122 4.3 Dispatched Multi TP class API .............................................................................. 123 4.3.1 TpGetConnectionGroup: Get the connection group identification ............... 123 4.3.2 TpGetAddressingType: Get the addressing type identification .................... 124 4.3.3 TpGetCanChannel: Get the CAN channel .................................................. 125 4.3.4 TpGetRxId: Get the received CAN-Id ......................................................... 126 4.3.5 TpGetTxId: Get the CAN-Id to be used for transmission ............................. 126 4.3.6 TpGetBaseAddress: Get the Base Address ................................................ 127 4.3.7 TpGetAddressOffest: Get the Address Offset ............................................. 128 4.3.8 TpGetPriority: Get the priority info from a 29 bit CAN-Id ............................. 129 4.3.9 TpGetPGN: Get the parameter group identification from a 29 bit CAN-Id ... 129 4.3.10 TpGetEcuNumber: Get the ECU number ................................................... 130 4.3.11 TpTransmit .................................................................................................. 131 4.3.11.1 TpTransmit connection specific macros ................................................ 131 4.3.11.2 TpTransmitNormal: transmit function for normal addressing ................ 131 4.3.11.3 TpTransmitExtended: transmit function for extended addressing ......... 132 4.3.11.4 TpTransmitNormalFixed: transmit function for NormalFixed addressing ............................................................................................ 133 4.3.11.5 TpTransmitMixed29: transmit function for Mixed-29 addressing .......... 134 4.3.11.6 TpTransmitMixed29: transmit function for Mixed-29 addressing .......... 135 2013, Vector Informatik GmbH
Version: 3.14.00
11 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
4.3.11.7 TpTransmitMixed11: transmit function for Mixed-11 addressing ........... 136 4.4 Application callback functions ............................................................................... 137 4.4.1 Reception side ............................................................................................ 137 4.4.1.1 ApplTpPrecopyCheck: Reception of TP-Frame .................................... 137 4.4.1.2 ApplTpCheckTA: Check if Target Address is valid (version <=
2.72.00) ................................................................................................ 139 4.4.1.3 ApplTpCheckTA: Check if Target Address is valid (since version
2.73.00) ................................................................................................ 140 4.4.1.4 ApplTpRxSF: Reception of Single Frame ........................................... 141 4.4.1.5 ApplTpRxFF: Reception of First Frame .............................................. 142 4.4.1.6 ApplTpRxCF: Reception of Consecutive Frame ................................. 142 4.4.1.7 ApplTpRxCanMessageReceived: Reception of CAN-Frame .............. 143 4.4.1.8 ApplTpRxGetBuffer: Assign a buffer to a channel ............................... 144 4.4.1.9 ApplTpRxCopyFromCAN: Application Copy Function ......................... 145 4.4.1.10 ApplTpRxIndication: Reception closed successful ............................. 146 4.4.1.11 ApplTpRxErrorIndication: Reception closed with error ........................ 147 4.4.1.12 ApplTpRxGetTxID: Get CAN Transmit Id ............................................. 148 4.4.2 Reception side for functional messages ...................................................... 149 4.4.2.1 ApplFuncTpPrecopy: Check if Target Address is valid ......................... 149 4.4.3 Transmission side ....................................................................................... 150 4.4.3.1 ApplTpTxFC: Reception of a Flow Control Frame .............................. 150 4.4.3.2 ApplTpTxCanMessageTransmitted: CAN-Message transmitted .......... 151 4.4.3.3 ApplTpTxNotification: CAN-Frame transmitted ................................... 151 4.4.3.4 ApplTpTxCopyToCAN: Application Copy Function ( 16BIT
Controller) ............................................................................................ 152 4.4.3.5 ApplTpTxCopyToCAN: Application Copy Function (8BIT Controller) ... 153 4.4.3.6 ApplTpTxConfirmation: Transmission closed successful ..................... 155 4.4.3.7 ApplTpTxErrorIndication: Transmission closed with error .................... 156 4.4.4 Administrative Functions ............................................................................. 157 4.4.4.1 ApplTpFatalError: Fatal Error ............................................................... 157 5 Transmission Attributes & Callback functions ......................................................... 159 6 Integration of CANbedded Components into a Customer Project .......................... 160 6.1 Requirements to the Customer System Environment ........................................... 160 6.2 Component Integration to the Customer Project ................................................... 160 6.2.1 Requirements to the Component Initialization in a Customer Project .......... 160 6.2.2 Requirements to Component API Usage in a Customer Project .................. 161 6.2.3 Requirements to the Customer Project Operating System .......................... 161 6.2.3.1 Common Requirements ........................................................................ 161 6.2.3.2 Round-Robin-Scheduler and Comparable OS Approaches .................. 162 6.2.3.3 Usage of OSEK/OS .............................................................................. 162 2013, Vector Informatik GmbH
Version: 3.14.00
12 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
6.2.3.4 Non-Preemptive Operating System ...................................................... 163 6.2.3.5 Preemptive Operating System .............................................................. 163 7 Advanced usage ......................................................................................................... 164 7.1 Separation of TimerTask and TransmissionTask (StateTask) ................................ 164 7.2 Fast transmission of ConsecutiveFrames ............................................................. 164 7.2.1 Usage ......................................................................................................... 165 7.2.2 Application example .................................................................................... 165 7.3 Normal Fixed Addressing ..................................................................................... 166 7.3.1 Multiple ECU’s ............................................................................................. 166 7.3.1.1 Using the CANgen configuration tool .................................................... 166 7.3.1.2 Using the GENy configuration tool ........................................................ 167 7.4 Extended- and Normal Fixed Addressing ............................................................. 168 7.4.1 Virtual ECU’s / ‘Multiple EcuNumber’ feature ............................................... 168 7.5 Using different CAN-Identifiers ............................................................................. 169 7.5.1 Statically configured CAN-Ids ...................................................................... 169 7.5.2 Dynamically configured CAN-Ids ................................................................. 169 7.5.3 Additional API functions ............................................................................... 169 7.6 Transmissions without Flow Control frames ......................................................... 170 8 Example for the user .................................................................................................. 171 8.1 Administrative usage ............................................................................................ 171 8.2 How to Transmit a Tp-Frame? .............................................................................. 171 8.2.1 Static Normal Addressing ............................................................................ 171 8.2.2 Dynamic Addressing ................................................................................... 171 8.3 How to Receive a Tp-Frame ................................................................................. 172 8.4 How to Send a Response on a Received Transport-Frame .................................. 172 8.5 How to serve Different Connections (only dynamic channels) .............................. 173 8.5.1 How to serve the diagnostic connection ...................................................... 173 8.6 How to Lock a Tx-Channel and Why? (only dynamic channels) ........................... 175 8.7 How to transmit a ConsecutiveFrame as quick as possible .................................. 176 9 Contact........................................................................................................................ 177
2013, Vector Informatik GmbH
Version: 3.14.00
13 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Illustrations Figure 1-1 SingleConnection vs. MultipleConnection ................................................. 19 Figure 2-1 Example of unsegmented message .......................................................... 23 Figure 2-2 Construction of segmented message ........................................................ 24 Figure 2-3 Transmission Architecture ......................................................................... 28 Figure 2-4 Reception Architecture .............................................................................. 29 Figure 2-5 Transmission timings. ............................................................................... 30 Figure 2-6 Single Frame TPCI ................................................................................... 31 Figure 2-7 First Frame TPCI ...................................................................................... 31 Figure 2-8 FlowFrameTPCI ....................................................................................... 31 Figure 2-9 Consecutive Frame TPCI .......................................................................... 32 Figure 2-10 Accumulation of events during CAN Driver polling .................................... 35 Figure 3-1 General settings in Generation Tools ........................................................ 38 Figure 3-2 Timing settings in Generation Tools .......................................................... 39 Figure 3-3 Flow control settings in Generation Tools .................................................. 40 Figure 3-4 Misc. settings in Generation Tools ............................................................ 41 Figure 3-5 Main window of component TPMC within configuration tool GENy. ........... 43 Figure 3-6 Main window of component TPMC within configuration tool GENy. ........... 44 Figure 3-7 Database Attributes for Single/Static TP classes ....................................... 46 Figure 3-8 Additional TP settings (Static MultiTP) in Generation Tool......................... 48 Figure 3-9 Connection specific timing parameters ..................................................... 48 Figure 3-10 Hook-Functions (Static MultiTP) ............................................................... 49 Figure 3-11 Mandatory functions for the usage of the CANdesc diagnostic
component ................................................................................................ 50 Figure 3-12 Optional functions (example for the usage of the CANdesc diagnostic
component) .............................................................................................. 50 Figure 3-13 Misc (Extended Addressing) ..................................................................... 51 Figure 3-14 Database attributes for ‘Normal Fixed Addressing’.................................... 52 Figure 3-15 Addressing mode (Multiple Addressing) .................................................... 53 Figure 3-16 Dedicated call of Precopy functions in TPMC by the driver. ...................... 54 Figure 3-17 Dedicated call of application callback functions in TPMC by the internal
dispatcher. ................................................................................................ 55 Figure 5-1 Transmission attributes and callback functions ....................................... 159 Tables Table 1-1 Name Conventions .................................................................................. 16 Table 1-2 Abbreviations ........................................................................................... 17 Table 1-3 Feature List ............................................................................................. 22 Table 2-1 Addressing Modes ................................................................................... 24 Table 2-2 Frame size on normal addressing ............................................................ 25 Table 2-3 CAN ID normal fixed addressing .............................................................. 25 Table 2-4 Frame size extended addressing ............................................................. 26 Table 2-5 Frame size extended addressing ............................................................. 26 Table 2-6 Structure of TPCI-bytes ........................................................................... 27 Table 2-7 Frames .................................................................................................... 27 Table 2-8 Transmission timings ............................................................................... 30 Table 2-9 CAN frame DLC ....................................................................................... 32 Table 3-1 Usage of TpTxIndex database attribute ................................................... 47 Table 3-2 Data Base Attributes ................................................................................ 52 2013, Vector Informatik GmbH
Version: 3.14.00
14 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
1 Introduction 1.1 Relation between general component and shipped version capability We have configured the programs in accordance with your specifications in the
questionnaire. Whereas the programs do support other configurations than the one
specified in your questionnaire, Vector’s release of the programs delivered to your
company is expressly restricted to the configuration you have specified in the
questionnaire.
This implementation and this user manual are based on the documents, listed above.
It is important to know the documents above-mentioned for a better understanding
and the use of this manual.
/OSEK-COM/ defines different kinds of transmissions. One of them is the USDT (Unack-
nowledged Unsegmented Data Transfer). It is standardized together with ISO/TC22/SC3
„Diagnostics on CAN“. The result of this standardization is the ISO Spezification15765-2.
The presented Vector-Implementation is based on the harmonized specification between
OSEK-COM and ISO. The implementation is suitable for diagnostic purposes (KWP2000)
as well as for „long“ messages in „normal“ use.
Task of the transport layer is to transmit messages, which might be longer than a CAN-
message. If messages do not fit into a CAN-message, they will be segmented by the
transport protocol to be transmitted.
Today the ISO/TF2-transport protocol is mainly used for diagnosis applications in motor
vehicle. Most of all KWP2000 is used as a diagnosis protocol.
The introduction is followed by a brief overview of the architecture in the third chapter. On
one side the most important points of the specification can be seen there (see also
/ISO/TF2 and /OSEK-COM/) and on the other side this explains the main ideas of this
implementation.
The fourth chapter presents how to set up the transport protocol in the “Generation Tool”.
The fifth chapter contains a description of user interfaces of implementation.
Transmission attributes and callback functions are presented in a table in chapte
r 5. Rules to integrate CANbedded modules in customer projects are content of chapte
r 5, 6. Chapte
r 7 is introducing a more advanced usage of the TP.
The last chapter contains an example for the user.
2013, Vector Informatik GmbH
Version: 3.14.00
15 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
1.2 Name Conventions The prefix of a function name determines the module to which it belongs.
Prefix Remark ApplTp...
These functions must be defined within the customer’s application and were called
by the Transport Layer module. The modules, which use functions of the Transport
Layer, are always called application in this manual.
ApplTpRx
Hook-Functions which belong to the “reception part” of the TP.
…
ApplTpTx
Hook-Functions which belong to the “transmission part” of the TP.
…
Can...
Functions belong to the CAN-Driver.
TpRx...
Functions belong to the “reception part” of the Transport Layer.
TpTx…
Functions belong to the “transmission part” of the Transport Layer.
Table 1-1 Name Conventions
2013, Vector Informatik GmbH
Version: 3.14.00
16 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
1.3 Abbreviations List of abbreviations in use:
AE Address Extension
AI Address Information
AK Acknowledge
AR Acknowledge Request
ASDT Acknowledged Segmented Data Transfer
BS Block Size
CF Consecutive Frame
CTS Clear To Send
DL Data Length
FC Flow Control
FF First Frame
FS Flow Status Control
ID Identifier
SF Single Frame
SN Sequence Number
ST Separation Time
TA Target Address
TP Transport Protocol
TPCI Transport Protocol Control Information
USDT Unacknowledged Segmented Data Transfer
UUDT Unacknowledged Unsegmented Data Transfer
WT Wait
XDL extended Data Length
Table 1-2 Abbreviations
1.4 Channel vs. Connection A (transport)
channel is the physical part of the communication link, containing the
reception-/transmission mechanism. It can be understood as an instance of TPMC in an
object oriented meaning. Each channel can handle one connection at one point in time.
A
connection describes a logical communication link between two ECU’s. In the
communication matrix it is a fixed assignment between these ECU’s to interchange data
(e.g. the diagnostic request and response message between the Tester and an ECU).
A connection includes all necessary communication parameters for the used addressing
mode (e.g. CAN-channel, CAN-IDs, Source-and Target Addresses, Base-Addresses, etc).
2013, Vector Informatik GmbH
Version: 3.14.00
17 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
1.5 TP classes 1.5.1 SingleTP classes In a Single TP class only one connection is possible, which is using the only available
TpChannel.
1.5.2 Static MultiTP classes While using Static TP classes every connection is fixed assigned to a TpChannel.
1.5.3 Dynamic MultiTP classes The idea of dynamic TP classes is to use the circumstances that not all connections are
used at the same time. Therefore a connection is necessary allocating a TpChannel at run-
time.
1.5.4 Dispatched MultiTP classes The “Dispatched” MultiTP class was introduced to disburden the application from the
dispatching job.
Using the “Dynamic MultiTP” classes, which support only one single set of callback
functions for all connections together, the dispatching of the actual destination has to be
performed by the application.
Using the “Dispatched MultiTP” classes all of the dispatching work is done within the
TPMC.
“Dispatched MultiTP” is located between static and dynamic TP classes.
Transmission The new allocated TpChannel has included blank communication parameters only, except
for the connection-handle (tpChannel = TpTxGetFreeChannel(connection)). To
establish the connection it is necessary to assign the connection parameters to the
TpChannel. The TpChannel is always used to refer to the connection (like a handle). Every
callback- or API-function has the tpChannel as a parameter.
Reception If a Single- or FirstFrames is received the Transport Protocol is searching internally for a
free TpChannel. If a free TpChannel is found a data buffer will be requested by calling
ApplTpRxGetBuffer() from the application. Within this function the application has also
to decide to which connection the received TP frame belongs.
2013, Vector Informatik GmbH
Version: 3.14.00
18 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
1.6 SingleConnection vs. MultipleConnection The TPMC component has two different operation modes: a SingleConnection and a
MultipleConnection mode. The MultipleConnection mode has the capability to handle
different transmissions and receptions at the same time like ECU 1 in figure 1. If
SingleConnection mode is used only one transmission and one reception (one full-duplex
connection) can be performed at the same time (ECU 3 and ECU 4). A typical usage for
the SingleConnection mode is a diagnostic connection.
The SingleConnection mode needs lower resources (ROM and runtime), than the
MultipleConnection mode.
ECU 2ECU 41
1
2
n
n
n
o
o
o
C
C
Con 3
C
ECU 1Con 4
ECU 3Con 4
Figure 1-1 SingleConnection vs. MultipleConnection
1.7 Features The main focus while the development of the Transport Layer is an easy to handle and
flexible application interface.
> Therefore the buffer handling should be done by the application itself. This is more
flexible than a static buffer handling internally by the Transport Layer.
> Each accepted order to the TP will be acknowledged only once – positive or
negative.
> Full-duplex capability - every reception is independent from every transmission and
the other way round.
> The static MultipleConnection TP supports connection-specific callback functions.
> SingleConnection mode with lower resource demands.
> Full ISO compliance
> Non-ISO extensions like ‘zero-padding’; ‘connections without FlowControls’
> Multiple addressing mode support (Normal- and Extended Addressing at the same
time in the same ECU)
1.7.1 Feature List Not any version of TPMC offers any mentioned feature
2013, Vector Informatik GmbH
Version: 3.14.00
19 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Feature Short Description ) f
of / ytiloni( abli
vaefaultADGeneral Features Normal Addressing
Liz
11bit CAN ID Addressing, CAN ID identifies TP
-
message
Extended Addressing
Liz
11bit CAN ID Addressing, Source Address in CAN ID
-
and Target Address in first data byte
Normal Fixed
Liz
29bit CAN ID Addressing, Source and Target Address in -
Addressing
CAN ID
Mixed 11bit CAN ID
Liz
11bit CAN ID Addressing, CAN ID identifies TP
-
Addressing
message, first data byte used for AddressExtension
Gateway
Mixed 29bit CAN ID
Liz
29bit CAN ID Addressing, Source and Target Address in -
Addressing
CAN ID, first data byte used for AddressExtension
Gateway
Multiple Addressing
Liz
Combination of former mentioned addressing types
-
Static channel
Assignment between channel and connection is fixed at
assignment
compile time.
Advantage in opposite to dynamic assignment is better
efficiency (code + runtime)
Dynamic channel
Flexible pool of channels, which can be assigned to
assignment
connections at runtime. If no channel is free the request
is rejected. Nr of channels can be <= connections.
(Time division multiplexing)
C++ access to TPMC
C++ applications can access TPMC. Header declared
as extern C.
Additional OBD
Additional receive path to handle OBD requests at any
reception capability
time, independent to allocated channel resources.
Receiving Features Extended API STmin
Enables functions to set and get the STmin value for a
Off
TpChannel.
Extended API
Enables functions to set and get the BS value for a
Off
BlockSize
TpChannel.
Precopy check / Check
Forwards CAN Driver Precopy callback from TPMC to
Off
TA function
application. Used for special purposes.
Check Target Address
Mixed29, Forwards CAN Driver Precopy callback from TPMC to
Off
former called:
Normal
application. Parameter TargetAddress is evaluated by
Application Precopy
Fixed
application. Return value 0xFF rejects reception.
Channel specific timing
Static
Assigns individual timing values to each channel.
Off
TPMC
2013, Vector Informatik GmbH
Version: 3.14.00
20 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Custom Rx Memcopy
TP calls ApplTpRxCopyFromCAN callback function to
Off
enable the application copying the CAN frame data
itself.
Rx Channel without FC Multi
No FC used in transport protocol communication.
Off
TPMC
Fast Precopy
Extended Target Address is not evaluated when receiving a TP
Off
,
frame.
Mixed29,
Normal
Fixed
Transmission of FC in
The FC is sending in CAN RX IRQ forced from FF and
On
ISR
last CF out of a block.
Fix Rx DLC Check
Check compares actual DLC with expected frame
Off
length (CAN: 8).
Variable Rx DLC Check
Check compares actual DLC with minimum expected
On
frame length. Check is TPMC frame type depending.
Functional FC Wait
Non ISO feature: A functional FC with flow status wait is Off
supported to reload with functional addressing the
timeout timer awaiting physical FC.
Strict length check
If variable Rx Dlc is enabled then the minimum byte
Off
count is checked. If more bytes than announced in the
PCI byte (SF and last CF) are received then the frame
is accepted nevertheless. When the strict length check
feature is enabled (#define
TP_ENABLE_STRICT_DL_CHECK) then all frames which do
not exactly match the PCI-DL value are ignored.
Suppress Multi - frame
For some applications, which use only Single Frames
Off
reception
on the Rx side, the reception of Multi Frames can be
disabled by setting the TP_DISABLE_MF_RECEPTION
switch via a user configuration file.
The benefit is the smaller resource consumption. The
remaining Single Frame reception is unaffected.
Transmission Features Use STmin of FC
The STmin value is used from the FC.
Off
See also TxTransmitCF.
Analyze first FC only
Only first FC values are analyzed to set STmin and
Off
BlockSize.
Custom TX Memcopy
TP calls ApplTpTxCopyToCAN callback function to
Off
enable the application copying the TX data to the CAN
frame.
TX Channel without FC Multi
Transmission without waiting for a FC. In dynamic TP
Off
TPMC
classes this feature can be activated for each channel.
Fast TX Transmission
Enables the application to send TP frames in cycle time Off
faster than TpTxTask() cycle time.
Transmission of FC in
Directly response with FC in IRQ context of received FF On
ISR
or CF.
Variable DLC
The DLC is adapted for SF, FC and last CF as indicated Off
by addressing type and data amount.
2013, Vector Informatik GmbH
Version: 3.14.00
21 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Ignore FC content
FC is required for proceeding but standard values are
Off
used instead of received ones.
TX Handle Changeable
The used CAN Driver handle can be changed while
Off
runtime – has to be used with special care
No STmin after FC
No STmin time is kept after receiving a FC before
Off
sending next CF.
TX min timer
If the database attribute ‘GenMsgDelayTime’ has a
Off
value unequal to zero, the TP observes this minimum
time between two transmissions.
Special Features Gateway API
Extended API to support Gateway requirements (TP
message routing)
Multiple ECU NR
Source- and TargetAddress can be modified while
runtime
Multiple ECU
Optimized support for physical multiple ECU
configurations.
Multiple Base Address
Extended More than one Base Address can be used
BufferOverrun
If the request size exceeds the buffer size, this feature
off
Indication
can be used to receive the request anyway, without
copy the CF data.
Queue in ISR
Dynamic The next queued element (if available) will be
on
TP-
transmitted within TX-ISR.
classes
ISO Compliancy
Distinguish between early ISO spec drafts and newer
on
ones concerning STmin interpretation, DataLength = 0
behavior and CF sequence error treatment.
Frame Padding
SF and last CF frame are padded out with a pattern
oem
given in the generation tool.
, off
Priority inversion
Prevents TPMC to interrupt a multi frame
on
protect
transmission/reception when transmission and
reception events are in wrong order processed (RX
event with higher priority than Tx event).
See als
o “2.5.1”. Runtime checks
Runtime condition checks
off
Strict message flow
Illegal FlowControl frames will suspend a running
on
check
transmission – with same addressing information
Diag Functional
CANDes
Capability to handle functional diagnostic requests
on
channel
c (basic) within TPMC (only for Vector Diag components e.g.:
CANDesc)
Table 1-3 Feature List
2013, Vector Informatik GmbH
Version: 3.14.00
22 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
2 Architecture Overview This chapter describes the basic functionality of the Transport Protocol and its main ideas
applying to the Vector implementation of the Transport Protocol. Particular functions of the
Transport Protocol modules, as well as its configuration are described in later chapters.
The main idea of the Vector implementation is to provide an interface, which is easy in
operation and adequate for most applications. The implementation is quite efficient
regarding ROM and RAM as well as run-time requirements.
2.1 Requirements This chapter shows basic requirements of the implementation of the Transport Protocol.
2.1.1 Protocol-Overview The Task of the transport protocol is to transmit messages, which are generally longer than
a CAN message. If a message is very short, it is transmitted unsegmented within TP.
2.1.1.1 Construction of unsegmented messages Sender
Receiver
DataLength = 2, DL=$2;
SingleFrame(SF)[(PCI.DL=2,xx.. ]
DataLength = 2
DL=$2
Figure 2-1 Example of unsegmented message
Unsegmented messages are transmitted by a SingleFrame message. SingleFrame
messages can have a length of 7 data bytes at a maximum (normal addressing s.b.)
respectively 6 data bytes (extended addressing, s.b.). There is no Flow-Control (s.b.).
2.1.1.2 Construction of segmented messages Messages, which do not fit into a SingleFrame are sent by a sequence of single CAN
frames. The receiver is informed of the length of the whole message in the FirstFrame by
the sender. ISO/TF2 defines here a maximum length of 4095 bytes for user data. The
receiver answers with a FlowControl. The receiver gives the BlockSize and the
SeparationTime STmin to the sender in this FlowControl. The BlockSize controls the
number of ConsecutiveFrames, which might be sent by the sender before waiting for the
receivers’ FlowControl (status). The minimum value of the SeparationTime STmin describes
the minimum sending distance between two ConsecutiveFrames, which can be processed
by the receiver. The sender transmits the maximum BlockSize ConsecutiveFrames
after
the reception of the FlowControl. The receiver does not answer it with a FlowControl, if all
data has been transmitted.
2013, Vector Informatik GmbH
Version: 3.14.00
23 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Sender
Receiver
First Frame[(PCI.XDL=$
DataLength = 36
0, DL=$24,xx.. ]
XDL = $0, DL = $24
DL=$2
Flow Control frame
with impicite
Flow Control[PCI.FS, FC.BSmax=$3,FC,STmin, xx]
connection set-up
Consecutive Frame[PCI.SN=1, xx,xx..
Multiple
.]
consecutive
Consecutive Frame[
frames
PCI.SN=2, xx,xx...]
Consecutive Frame[PCI.SN=3, xx,xx...]
Flow Control frame
because
Flow Control[PCI.FS, FC.BSmax=$3,FC,STmin, xx]
SN=BSmax
The last
Conse
consecutive
cutive Frame[PCI.SN
frame include
=4, xx,xx...]
2 valid user
Conse
data bytes
cutive Frame[PCI.SN=5, xx,xx...]
End of multiple
frame
Figure 2-2 Construction of segmented message
2.1.2 Addressing modes To handle the communication the Transport Protocol is using a Point-to-Point connection.
To establish a Point-to-Point transfer on a broadcast protocol like CAN additional address
information is needed (a source address for the transmit node and a target address for the
receive node).
The ISO/TF2 transport protocol defines four modes of addressing:
„Normal“ addressing The CAN ID contains the complete addressing information (to each
source- and target address combination a unique CAN ID is assigned)
„Extended“ addressing The CAN ID contains only the source address and the first data byte
contains the target addressing information.
“Normal fixed” The extended CAN ID contains the complete addressing information
addressing according J1939
“Mixed” addressing Additionally to the extended CAN ID, according J1939, the first data
byte contains a second target address information.
Since ISO15765-2: 2003 the additional addressing mode mixed
addressing on 11-bit CAN IDs is defined. The address extension is
stored in the first byte followed by the TPCI information.
Table 2-1 Addressing Modes
2013, Vector Informatik GmbH
Version: 3.14.00
24 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
The Vector TP implementation supports all addressing mode. The used addressing
method is normally determined at compile-time regarding ROM and RAM as well as run-
time requirements. For special purpose it is also possible to determine the used
addressing method at run-time (special version of the TPMC-module is needed).
2.1.2.1 Normal Addressing The address information is coded in a unique CAN Identifier.
The Transport Protocol uses the 1st and sometimes 2nd data byte. The data length is
coded in 12bits. Therefore the maximum length of a message is limited to 4095 bytes. The
receivers’ control information (maximum block size and minimum SeparationTime) is
transmitted to the sender within a FlowControl.
TypeByte 0Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7TPCI
SingleFrame
DataDataDataDataDataDataDataType
Length
TPCI
DataLength
FirstFrame
DataDataDataDataDataDataType
Length
Length
Consecutive
TPCI
DataDataDataDataDataDataDataFrame
Type
SN
TPCI
FlowControl
BS
ST
max
min
Type
FS
Table 2-2 Frame size on normal addressing
2.1.2.2 Mixed 11-bit ID Addressing Mixed 11-bit addressing is a sub-format of normal addressing (refer above) where the
mapping of the address information is further defined (see ISO 15765-2:2004).
The target
address extension information is placed in the first data byte of the CAN frame
(see ISO 15765-2:2004) followed by the TPCI information in byte two.
2.1.2.3 Normal Fixed Addressing Normal fixed addressing is a sub-format of normal addressing (refer above) where the
mapping of the address information into the (extended) CAN-Identifier is further defined
(see ISO 15765-2).
J1939 namePR/DPPFPSSAData fieldBits3
2
8
8
8
64
ProtocolGroup
Target-
Source-
ContentPriority Reserved
TPCI/Data
Identification
Address
Address
CAN Id Bits26-28
24-25
16-23
8-15
0-7
CAN data bytes
CAN FieldIdentifier
Data
Table 2-3 CAN ID normal fixed addressing
For information about the “data field” see
2.1.2.1. 2.1.2.4 Extended Addressing The source address is coded into the CAN ID by adding the address to a base CAN ID
(e.g.: with a base CAN ID 0x600 and a source address of 0x10 the used CAN ID are
0x610)
2013, Vector Informatik GmbH
Version: 3.14.00
25 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
The target address information is placed in the first data byte of the CAN frame (see ISO
15765-2).
TypeByte 0Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7TPCI
SingleFrame
ext AddrDataDataDataDataDataDataType
Length
TPCI
DataLength
FirstFrame
ext AddrDataDataDataDataDataType
Length
Length
Consecutive
TPCI
ext AddrDataDataDataDataDataDataFrame
Type
SN
TPCI
FlowControl
ext AddrBS
ST
max
min
Type
FS
Table 2-4 Frame size extended addressing
2.1.2.5 Mixed 29-bit ID Addressing Mixed 29-bit ID addressing is a sub-format of normal fixed addressing (refer above) where
the mapping of the address information into the (extended) CAN-Identifier is further
defined (see ISO 15765-2).
The target address extension information is placed in the first data byte of the CAN frame
(see ISO 15765-2).
TypeByte 0Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7AddressTPCI
SingleFrame
DataDataDataDataDataDataExtensionType
Length
AddressTPCI
DataLength
FirstFrame
DataDataDataDataDataExtensionType
Length
Length
Consecutive
AddressTPCI
DataDataDataDataDataDataFrame
ExtensionType
SN
AddressTPCI
FlowControl
BS
ST
max
min
ExtensionType
FS
Table 2-5 Frame size extended addressing
2.1.2.6 Structure of TPCI-Byte The coding of the TPCI of each frame type is shown in Table 2-6 Structure
of
TPCI-
bytes.
Encoding of Protocol Control Information (PCI) 2013, Vector Informatik GmbH
Version: 3.14.00
26 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
1. Network Protocol Control Information (N_PCI) bytes 2. Byte #1 Byte #2 Byte #3 N_PDU name Bits 7-4 Bits 3-0 SingleFrame
N_PCItype = 0
SF_DL
N/A
N/A
FirstFrame
N_PCItype = 1
FF_DL
N/A
ConsecutiveFrame
N_PCItype = 2
SN
N/A
N/A
FlowControl
N_PCItype = 3
FS
BS
STmin
Table 2-6 Structure of TPCI-bytes
Hex value Description 0
SingleFrame For unsegmented message, the network layer protocol provides an optimised implementation of the
network protocol with the message length embedded in the PCI byte only. SingleFrame (SF) shall be
used to support the transmission of messages that can fit in a single CAN frame.
1
FirstFrame A first frame (FF) shall only be used to support the transmission of messages that cannot fit in a single
CAN frame, i.e. segmented message. The first frame of a segmented message is encoded as a
FirstFrame (FF). On receipt of a FirstFrame the receiving network layer entity shall start assembling the
segmented message.
2
ConsecutiveFrame When sending segmented data, all consecutive frames following the first frame (FF) are encoded as
ConsecutiveFrames (CF). On receipt of a Consecutive Frame (CF) the receiving network layer entity
shall assemble the received data bytes until the whole message is received. The receiving entity shall
pass the assembled message to the adjacent upper protocol layer after the last frame of the message
has been received without error.
3
FlowControl The purpose of Flow Control is to regulate the rate at which Consecutive Frame network protocol data
unit are sent to the receiver. Three distinct types of Flow Control protocol control information are
specified to support this function. The type is indicated by a field of the protocol control information called
Flow Status (FS) as defined hereafter.
4 - F
Reserved This range of values is reserved by this document.
SF_DL on SingleFrame Contains the data length of the message (up to 7 bytes with normal
resp. up to 6 bytes with extended addressing).
FF_DL on FirstFrame Contains the data length of the message. The most significant 4 bit
of the data length in byte #1, the remaining 8 bits are transmitted in
byte #2.
SN on ConsecutiveFrame The Sequence Number is used to discover a doubling or the loss of
a data frame. The SN starts with ‘1’ and is calculated modulo ‘16’ (4
bit calculation).
FS on FlowControlFrame ‘0’ means CTS (ClearToSend): sender can continue sending
’1’ means WT (Wait): sender is not allowed to continue sending, it
has to wait until FC.CTS is received
‘2’ means OVF (Overflow): sender is not allowed to continue
sending, the transfer is stopped.
Table 2-7 Frames
2013, Vector Informatik GmbH
Version: 3.14.00
27 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
IDLE
2.2 Transmission only dynamic classes TpTxGetFreeChannel: Associate channel
TpGetFreeChannelto connection (only for dynamic classes)
The application has to allocate a free
transport channel.
Reserve and block
es
s
the channel to this
connection
asl
c
c
TpTxSet...: Adjust transmit state
mi
(only for dynamic classes)
Wait for adjusting the
na
The new allocated TpChannel has only
transmit state
dy
Adjustable transmit states
y
blank communication parameters included,
nl
which await to be adjusted by the
TpTxSetCanChannelO
application. Which parameters have to be
TpTxSetChannelID
TpTxSetTargetAddressattuned depends on the used TpClass (see
TpTxSet...TpTxSetEcuNumberchapter
4.2 Functions of the Transport
Protocol) TpTransmit: Start the transmission
Wait for Transmission
ApplTpTxCopyToCan: Copy data to CAN
The
Transport
Layer
supports
two
copy
mechanisms: an internal and an application specific
copy mechanism.
TpTransmitWith the application specific copy mechanism the
Transport Layer will call a callback function to
request data each time data has to be transmitted.
Wait for Transmission
Event
ApplTpTxNotification / -CanMessageTransmitted Each time a transport frame (every frame or only
with pay load) will be transmitted, the Transport
Transmission Event
Layer notifies the application.
TpTxTask
for data segment
ApplTpTxConfirmation: Confirm the transmission
After a successful transmission the application will
be notified. This would be a good point in time to
ApplTpTx-CopyToCanrelease unused resources / buffers for example.
Transmit a CAN-
CanTransmit
Frame
LegendLast
Get external event
Get internal event
Yes
Frame?
No
(TP API call)
Set external event
Set internal event
(Application call)
ApplTpTx-ApplTpTx-Set external event
Internal state
ConfirmationNotification(Application call)
only used for special effortsApplTpTxCan-ApplTpTxCan-Message-Message-2013, Vector Informatik GmbH
Version:
T 3
ra.14.
nsm0
it0
t edTransmitted28 / 177
Figure 2-3 Transmission Architecture
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
2.3 Reception Wait for nextIDLE CFApplTpPrecopyCheck: Should receive or not?
The ApplTpPrecopy will be called immediately after the
reception of each TP-Frame. The return value of the function
TpPrecopy
CanDriver
TpPrecopy
CanDriver
determines whether or not the TP-Frame is received
ApplTpRxGetBuffer: Associate a buffer
ApplTp-ApplTp-The Transport Layer asks the application for a buffer. The
PrecopyCheckPrecopyCheckapplication has to return a valid buffer, in which the received
data will be stored. If the buffer is not valid, the reception will
be abort.
False '0'
Return Value
Return Value
False '0'
ApplTpRxCopyFromCan: Copy data from CAN
True '1'
The Transport Layer supports two copy mechanisms: an
True '1'
internal and an application specific copy mechanism.
ConnectionSearch
Failed
DLC-checks
Frame checks
The internal copy mechanism can only be used with a flat-
ConnectionSearch
buffer-model.
DLC-checks
Failed
Frame checks
With the application specific copy mechanism the Transport
Is SF or
FF ?
Layer will invoke a callback function each time data were
CF
FF
received.
SF
ApplTpRxGetTxId: Get FlowControl ID
(only with Dynamic Normal Addressing)
ConsecutiveSingle FrameFirst FrameFrameA corresponding transmit ID for a FlowControl is needed.
ApplTpRxIndication: Indicate a reception
ApplTpRx-ApplTpRx-A complete block of transport frames is received.
GetBufferGetBuffer Is
Important: The Transport Layer blocks the receive channel
Yes
NULL
to prevent a double occupancy of this channel. To free the
?
Is
receive channel the application can call
TpRxResetChannel Yes
NULL
No
().
?
No
ApplTpRx-ApplTpRxSFApplTpRxFFCFApplTpRx-ApplTpRx-ApplTpRx-CopyFrom-CopyFrom-CopyFrom-CanCanCanApplTpRx-Last
No
GetTxIDCF ?
(depends onconfiguration)Yes
ApplTpRx-ApplTpRx-IndicationIndicationFigure 2-4 Reception Architecture
2013, Vector Informatik GmbH
Version: 3.14.00
29 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
2.4 Working behaviors 2.4.1 Timings TpTransmit.FFN_AsFFApplTpTxCanMsgTransmittedApplTpRxGetBufferN_BrN_BsFCN_ArApplTpTxFCApplTpRxCanMessageTransmittedN_CsN_CrN_AsCFApplTpTxCanMsgTransmittedApplTpRxCFN_CsN_CrN_AsCFApplTpTxCanMsgTransmittedApplTpRxCFN_BrN_BsFCN_ArApplTpTxFCApplTpRxCanMessageTransmittedN_BrN_BsFCN_ArApplTpTxFCApplTpRxCanMessageTransmittedN_CsN_CrN_AsCFApplTpTxConfirmationApplTpRxIndication Figure 2-5 Transmission timings.
N_As CAN message confirmation
N_Ar CAN message confirmation timeout
timeout
N_Bs Timeout FC
N_Br Always zero (0)
N_Cs STmin (from FlowControl)
N_Cr Timeout CF
But not lower than Transmit CF
Table 2-8 Transmission timings
The TP needs the timings normalized to call cycles. Therefore all timings will be rounded
up to an integer multiple of call cycles.
The timings have an inaccuracy while runtime (based on the technical concept where
timers are set on interrupt level and decremented on task level). The jitter is either plus a
call cycle or minus a call cycle.
In general the ‘Timings’ are calculated with a jitter plus a call cycle – that means the value
of the timing is the first possible time after i.e. a timeout can occur.
2013, Vector Informatik GmbH
Version: 3.14.00
30 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
The TP uses the following algorithm for calculation:
> Timings: (STmin-Value + (TpCallCycle-1)) / TpCallCycle + 1
2.4.2 Error detection 2.4.2.1 Reception of a SingleFrame 765432100
0
0
0
DL
Single Frame
Data Lenth
Figure 2-6 Single Frame TPCI
A SingleFrame will be ignored if the DataLength exceeds the maximum length of a
SingleFrame (6 / 7 bytes).
2.4.2.2 Reception of a FirstFrame 765432100
0
0
1
XDL
First Frame
High Nibble of Data Length
Figure 2-7 First Frame TPCI
A FirstFrame will be ignored (until version 2.28) if the TPCIlength is lower than the
maximum length of a SingleFrame (6 / 7 bytes).
2.4.2.3 Reception of a FlowControl A FlowControl will be ignored if no suitable transmission is running (suitable means: the
Source- and TargetAddresses must fit). It will be also ignored if the TPCIbyte misfit the
valid values.
765432100
0
1
1
FS
Flow Control
Flow State
0
Continue To Send
1
Wait
2
Overflow (15765:2003)
Figure 2-8 FlowFrameTPCI
If a suitable transmission is found the state machine is checked for waiting for a
FlowControl (except CAN Driver polling mode is used).
2013, Vector Informatik GmbH
Version: 3.14.00
31 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
2.4.2.4 Reception of a ConsecutiveFrame A ConsecutiveFrame will be ignored if no suitable reception is running (suitable means: the
Source- and TargetAddresses must fit).
765432100
0
1
0
SN
ConsecutiveFrame
Sequence Number
Figure 2-9 Consecutive Frame TPCI
If a suitable reception is found the state machine is checked for waiting of a
ConsecutiveFrame (except CAN Driver polling mode is used). If the estimated Sequence
Number does not fit the current reception will be stopped.
2.4.2.5 Observing CAN frame DLC (Data Length Code) The CAN frame DLC should be set by the sender to a value greater than or equal to the
values indicated in the table below.
Frame Type Normal (fixed) Addressing Extended/Mixed Addressing SingleFrame
SF_DL+1
SF_DL+2
FirstFrame
8
8
FlowControl
3
4
ConsecutiveFrame
(except the last
8
8
ConsecutiveFrame)
Last
1+ ((FF_DL-6) mod[7])
2+ ((FF_DL-5) mod[6])
ConsecutiveFrame
Table 2-9 CAN frame DLC
The CAN frame DLC check can be configured for the following different ways:
none:
CAN frames are accepted if they are 8 bytes or less.
The frames are NOT checked against a minimum length.
only DLC 8:
CAN frames are ONLY accepted if they are exactly 8 bytes long.
variable DLC:
CAN frames are accepted if they are 8 bytes or less.
2013, Vector Informatik GmbH
Version: 3.14.00
32 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
The frames are also checked against the required minimum length.
depend on driver:
CAN frames are accepted if they pass the DLC check configured on driver level. Refer
to
[3] on how to set up the DLC check.
2.4.3 Buffer consistency The application programmer has to guarantee consistency of transmission and reception
buffers.
Transmission Between
the
call
of
TpTransmit()
and
ApplTpTxConfirmation()
or
ApplTpTxErrorIndication() writing access to the transmission data buffer must be
blocked (except the ApplTpCopyToCan() function is used to copy the data).
Reception Between the call of ApplTpRxGetBuffer() and ApplTpRxIndication() or
ApplTpRxErrorIndication() writing access to the reception data buffer must be
blocked (except the ApplTpCopyFromCan() function is used to copy the data).
2.4.4 Function re-entrancy The TP re-entrancy is based on the different tpChannels. So for static TP classes, with
separate resources for each single connection, there is no re-entrancy problem. For
dynamic TP classes the re-entrancy is guaranteed too from the viewpoint of TP, as long as
the application handles the connection specific API properly.
2013, Vector Informatik GmbH
Version: 3.14.00
33 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
2.5 Restriction 2.5.1 Restrictions to ISO/TF2 specification In this chapter you will find the restrictions of the current implementation relative to the
ISO/TF2-specification:
Timing parameter:
> Timing Parameter N_Br is always zero (0)
> Timing Parameter N_As and N_Ar can only be defined by a common constant
WaitFrame support:
For versions until version 2.73.00:
> The reception of WaitFrames is supported. The transmission of WaitFrames is not
supported, N_WFTmax is always zero (0).
For versions until version 2.88.00:
> Commencing with version 2.73.00 the transmission of WaitFrames is supported but
N_WFTmax is not considered. The periodical transmission must be stopped by the
application and does not stop by itself.
From version 2.89.00:
> Commencing with version 2.89.00 the maximal number of WaitFrames to be
transmitted (N_WFTmax) is supported and the transmission of WaitFrames stops
automatically when this limit is exceeded.
From version 3.01.00:
> Commencing with version 3.01.00 the maximal number of WaitFrames to be received
(N_TxWFTmax) is supported and the reception of WaitFrames stops automatically
when this limit is exceeded.
2.5.2 Limitations of Transport Protocol Implementation The Transport Protocol is a complex state machine, which is triggered by external events
like requests by the application, receive indications and transmit confirmations by the CAN
driver.
The state machine expects those events in the order they appear in the “real world” to
decide the next step to be performed. The state machine performs one event after the
other and each decision is based on the current state.
Under some very specific conditions, events may be given to the Transport Protocol state
machine in the incorrect order what can cause wrong decisions.
One requirement to the TP is that unexpected frames are to be ignored. Therefore it is
important to discard e.g. received FlowControl frames before the FirstFrame or
2013, Vector Informatik GmbH
Version: 3.14.00
34 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
ConsecutiveFrame has been sent. It may now happen that the transmit confirmation and
the receive indication event occur “at the same time”. In such a situation the concrete
behaviour depends on the sequence the underlying CAN driver handles such events.
Unfortunately this sequence depends on the hardware implementation of the CAN
controller and the interrupt concept of the µC. Usually RX handling is done first to prevent
loss of incoming data whereas TX handling has a lower priority. Most CAN controllers do
not support means to handle such events in the “real world order” later, if an immediate
handling is not possible due to e.g. an long lasting ISR lock or the CAN driver polling is
executed too slow.
Example:
The TP transmits its FirstFrame successfully to the bus and the tester answers very fast
with the FlowControl and the notification of the FirstFrame transmit event is delayed due to
(a) an ISR lock or (b) a too slow polling sequence, both events are valid at the same time.
Now it is up to the CAN driver how the notification sequence is performed.
If TX is handled first, TP is in a state to accept the FlowControl and everything went well. If
RX is handled first, TP is not aware that the FirstFrame has been already sent and will
ignore the incoming FlowControl. In that case, the TP runs in a timeout due to the partner
has sent its frame correctly but it was assigned to the wrong event sequence and was
therefore ignored.
TX
RX
CAN driver polling
First Frame
TX event: acknowledge
Acknowledge
Flow Control
RX event: FC received
Ack
CAN RX task:
CAN driver polling
FC received.
Error: Awaited FF
ackowledge.
Consecutive Frame
Reject FC.
Ack
Consecutive Frame
CAN TX task:
Acknowledge on FF
Ack
Regulare proceeding
(set timer, change
Consecutive Frame
state)
Ack
TP task:
Flow Control
Timeout on FC.
Ack
Free TP channel.
Figure 2-10 Accumulation of events during CAN Driver polling
Implemented solution 1:
The TP can be configured to handle the event sequence always in the way it is notified by
the underlying driver. In that case it is fully compliant to the requirement that (timely)
2013, Vector Informatik GmbH
Version: 3.14.00
35 / 177
based on template version 5.1.0



Technical Reference Transport Protocol ISO15765-2
incorrect frames are rejected. Unfortunately, the rejection can happen in a short time
period also for correct transmitted frames. The time period where this can happen is equal
to the runtime of the e.g. FlowControl frame on the bus (e.g. for DLC=8 and 500kBd this is
approx. 200µs for an interrupt driven CAN driver or the CAN driver polling rate). Timely
incorrect received frames outside of this time window are correctly handled/rejected.
As a result, the correctly transmitted TP sequence might be aborted by a timeout on the
sender side and the tester has to repeat its request.
The configuration switch TP_HIGH_RX_LOW_TX_PRIORITY has to be kTpOff to select
the implementation 1.
Implemented solution 2:
The TP can be configured to accept FlowControl frames also in the time window after the
successful ECU internal FirstFrame transmit request till the frame is really on the bus. In
that case it is not fully compliant to the requirement that (timely) incorrect frames are
rejected. The length of the time period depends on the baudrate (message runtimes), the
busload and if the CAN driver is used in ISR or polling mode. The shortest time range is
some few 10µs up to a multiple of the CAN driver polling rate. Timely incorrect received
frames outside of this time window are correctly handled/rejected.
As a result of this behaviour, a too early (timely incorrect) received FlowControl frame will
be accepted by the TP and the transport layer continues to transmit its data.
Because this scenario does usually not or only rarely happen in the field but the
performance of the whole diagnostic process is higher, the selection of that configuration is
highly recommended.
The configuration switch TP_HIGH_RX_LOW_TX_PRIORITY has to be kTpOn to select
the implementation 2.
Info Please note that the content of the received frame is always analyzed and illegal frames
are discarded as required. All above discussed issues are only valid if the frame is timely
incorrect but all other facts are correct concerning the current TP status.
Caution
Implementation solution 2 is automatically activated since version 2.36 of TPMC
component while the CAN Driver is used in polling mode. It is activated as default for
interrupt driven systems since version 2.63..
2013, Vector Informatik GmbH
Version: 3.14.00
36 / 177
based on template version 5.1.0




Technical Reference Transport Protocol ISO15765-2
2.5.3 Deviations to ISO/TF2 specification In this chapter you will find the deviations of the current implementation compared to the
ISO/TF2-specification.
2.5.3.1 Handling of unexpected FlowControl / ConsecutiveFrame frames Caution
This deviation is only in effect if the TP_HIGH_RX_LOW_TX_PRIORITY feature is
kTpOn.
The normal operation assumes that a transmit is followed first by its confirmation
interrupt and after that the next receive interrupt appears.
With a tester reacting very fast and simultaneously a controller that has a higher priority
for Rx interrupts than for Tx interrupts the Rx interrupt may be detected before the Tx
confirmation interrupt:
Without the HighRx-LowTx feature the transmission stops at this point.
With the activation of the HighRx-LowTx feature the TP implementation tries to
clear this unexpected sequence and to proceed with the transmission.
Nevertheless there are still some special situations left (see the description
above) that can not be cleared by the TP and so the transmission might be
stopped anyway.
Conclusion:
The HighRx-LowTx feature is activated by default to get a minimum of transmissions
being stopped.
You can deactivate the feature e.g. if your configuration does not require the feature or if
you prefer that the tester explicitly repeats requests after stopped transmissions.
Please see the description below to get an idea in which special situations some
malfunction is still possible.
See also chapter
2.5.2 ‘Limitations of Transport Protocol ’ for further details.
2013, Vector Informatik GmbH
Version: 3.14.00
37 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
3 Settings for the MultiTP & SingleTP (multi-based) To use the MultiConnection or the SingleConnection (multi-based) TP with the GENy
CANGen or the DBKOMGen tool the “Manufacture” attribute in the database has to be set.
Additionally a License File for GENy and CANGen tool is needed, which includes a
clearing for the MultiConnection Tp.
3.1 General settings with CANgen / DBKOMgen / GENy In the following descriptions examples from the CANGen / DBKOMGen generation tool
GUI are used.
Figure 3-1 General settings in Generation Tools
2013, Vector Informatik GmbH
Version: 3.14.00
38 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
3.1.1 Timing Figure 3-2 Timing settings in Generation Tools
3.1.1.1 Transmission timing Tx call cycle Together with this period, the function TpTxTask() has to be called periodically by the
application
TxTimeoutFC In the Timeout FC edit field, the FlowControl timeout value is specified. Within this time,
the expected FC frame has to be received by the transmitting ECU.
TxTransmitCF The Transmit CF time is the interval for the transmission of ConsecutiveFrames. This
value is used as a constant in ECUs that don’t use the STmin value from FlowControl
frame.
If this time should be defined as a constant at compile time the configuration switch “Use
STMin from flow control frame” should be set to Off.
If the time STMin from the FlowControl message should be calculated, the configuration
switch “Use STMin from flow control frame” has to be selected. Due to the problem to
handle a non-linear buffer (e.g. ring-buffer mechanism) in the application (usage of
ApplTpCopyToCAN or Vector Diagnostic Layer) the Transmit CF parameter set the fastest
possible transmission.
Transmit CF set the lowest possible separation time.
Example: The Diagnostic Tester set the STmin value to zero. Which will mean to the ECU
to transmit as fast as possible. If the application uses in this case a ring-buffer mechanism
it has to fill the ring-buffer in the same fast way as the TP transmits the data. To prevent in
such a case a buffer under-run it is possible to limit the TP, by setting the lowest possible
separation time value, so that the calculated STmin cannot be smaller than the Transmit
CF value.
3.1.1.2 Reception timing Rx call cycle Together with this period, the function TpRxTask() has to be called periodically by the
application
2013, Vector Informatik GmbH
Version: 3.14.00
39 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
RxTimeoutCF After the Timeout CF time expires, a time-out occurs with the transport layer between the
receptions of two ConsecutiveFrames.
3.1.1.3 Common timing CAN message confirmation timeout Maximum time between a transmission request and the confirmation interrupt, indicating
that the frame is sent successfully (it is at least accepted by one net node).
3.1.2 Flow Control Figure 3-3 Flow control settings in Generation Tools
3.1.2.1 Transmission Use STMin from flow control frame If the “Flow control” time STMin was defined as constant at compile time for the whole
system, it won’t be necessary to calculate it at runtime. Setting the configuration switch
„Use STMin from FlowControl frame“ to Off can parameterize this.
If the time STMin from the FlowControl message should be calculated, the configuration
switch “Use STMin from FlowControl frame” has to be selected.
3.1.2.2 Reception STMin The STmin edit field contains the minimum separation time between two consecutive
frames. The separation time will be at least as long as configured or longer. The value in
this edit field will be transmitted to the sender ECU in the FlowControl frame from the
current ECU. The STmin value can either be defined at compile time or changed at
runtime (see a
lso 3.1.3 Extended API STmin).
BlockSize requested The BlockSize specifies the number of ConsecutiveFrames until a FlowControl is needed.
The receiver defines the BlockSize. The sender always uses the BlockSize of the receiver.
The BlockSize value can either be defined at compile time or changed at runtime (see also
3.1.3 Extended API BlockSize).
2013, Vector Informatik GmbH
Version: 3.14.00
40 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
3.1.3 Misc Figure 3-4 Misc. settings in Generation Tools
Extended API (variable BlockSize) API extension, which can adjust the BlockSize value.
If the feature is enabled the BlockSize can be set at run-time by using the functions
TpRxSetBS() and TpRxGetBS().
Default value after initializations: “BlockSize requested” (Section ‘Flow Control’)
Extended API(variable STmin) API extension, which can adjust the STmin value.
If the feature is enabled the STmin value can be set at run-time by using the functions
TpRxSetSTMIN() and TpRxGetSTMIN().
Default value after initializations: “STmin” (Section ‘Flow Control’)
Use fast RAM The RAM demand and run-time can be reduced on some implementations, if some
frequently used variables of the Transport Protocol are put into the „near“ memory.
If the feature is enabled (default) the less used variables are also set into the „near“-
memory. The code is smaller and faster.
Otherwise less used variables are not set into the „near“-memory. The code is a little bit
bigger and slower.
Use Gateway API API extension, which was implemented for Gateway purpose, but it is also possible to use
it in other fields of applications.
If the feature is enabled the API of ‘ApplTpRxGetBuffer’ and ‘ApplTpRxCheckTA’ is
extended with the CanRxInfoStructPtr from the CAN Driver Precopy functions API (see
/CANDrv/ manual).
Within this CanRxInfoSturctPtr parameter the CAN ID, pointer to the CAN data, etc. is
included.
Assertions To detect some incorrect internal conditions of the Transport Protocol during development,
integration and software test, there are different categories of so called assertions
configurable:
1. User interface (for example input parameters, reentrance if not allowed)
2013, Vector Informatik GmbH
Version: 3.14.00
41 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
2. Generated data
3. Internal software errors (for example inconsistent internal states)
Each type of assertion can be configured independently.
These assertions will help in different development phases to deal with unexpected
problems, which cannot be handled by the Transport-Protocol internally. In such case the
following callback function will be called by the Transport-Protocol:
void
ApplTpFatalError( vuint8 errorNumber );
This callback function has to be provided by the Application. The function parameter
errorNumber gives more detailed information about the kind of error, which is occurred
(see a
lso 4.4.4.1 ApplTpFatalError: Fatal Error for the different error-codes).
Generally, the error number has to be checked to solve the underlying problem. The
recovery strategy is application dependent, but mostly there is a complete reset necessary
to set up the software correctly again.
Caution
This callback function must not return to the Transport-Protocol afterwards.
assert user User assertion will be activated.
Should be used while development of Application software
assert internal Internal assertions will be activated.
Should be used for tests of software changes in the Transport-Protocol
(Vector internal)
assert generated Internal assertions will be activated.
Should be used if a new version of the Generation Tool is used
runtime checks Runtime checks will be activated.
In contrast to the assertions the ‘runtime checks’ can also be used after the development
phase and should guarantee a more reliable run. Checks for parameter plausibility,
overwriting of memory like beyond access of tables, etc..
2013, Vector Informatik GmbH
Version: 3.14.00
42 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
3.2 General settings with Generation Tool GENy General settings can be done under the TPMC tree element. Most important is the
selection of TpClass in the upper right window. Some online help is provided for the most
settings in the OnScreenHelp window. Section “Advanced Configuration” is providing
special features like Gateway APIs or padding of TP frames. Some features might be
greyed which means that this features are preconfigured based on OEM or other
constraints. It is necessary to configure for each Tp class at least one “TP Connection
Group” object. Some static configured TP classes like “Static Normal Multi TP” require one
Connection Group object for each TP connection whereas dynamic TP classes have
always only one object. A Connection Group object represents a set of call back functions
for the application to notify successful transmission or reception.
Figure 3-5 Main window of component TPMC within configuration tool GENy.
2013, Vector Informatik GmbH
Version: 3.14.00
43 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
3.2.1 Configuration of Addressing Information The addressing information is configured for each channel. The provided addressing
elements like TpTxMessage (for NormalAddressing) depend on the selected TP class. It is
required to assign a TpConnectionGroupObj for each Addressing information. In Dynamic
Multiple Addressing Tp Classes any Addressing Information is assigned to only one TP
Connection Group Object.
Figure 3-6 Main window of component TPMC within configuration tool GENy.
3.2.2 Usage of Far RAM buffers Due to reasons of RAM resource availability it may be necessary to locate the receive and
transmit buffers handed to the TP in a far memory location. All message buffer related
types and callbacks will then use far pointers.
To enable this option the “Use far RAM buffers” option within the “Advanced Configuration”
tab must be enabled.
If that option does not suffice for your integration the “Memory Model Override” option can
be used alternatively supporting the usage of a special qualification string that can be
entered as plain text (e.g.:
@page @far).
3.2.3 Non standard handling of Flow Control frames 3.2.3.1 Reserved STmin Handling According to ISO 15765-2 the STmin values 0x80-0xF0 and 0xFA-0xFF are reserved.
If a received FC.CTS frame nevertheless uses one of these reserved values, it shall be
interpreted from the TP as the maximum STmin time (0x7F) which is defined.
The TP supports two additional possibilities to handle reserved STmin values:
> If the switch ‘TP_ENABLE_IGNORE_FC_RES_STMIN’ is defined, then a FC frame
with a reserved STmin value is silently ignored.
> If the switch ‘TP_ENABLE_CANCEL_FC_RES_STMIN is defined, then a FC frame
with a reserved STmin value will lead to the cancellation of the Tx connection.
Note that each switch has only an effect if the STmin is evaluated at all. For cases where
STmin might not be evaluated, please refer to
3.2.3.4 and
3.2.3.5. 2013, Vector Informatik GmbH
Version: 3.14.00
44 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
3.2.3.2 Ignore Flow Control Overflow According to ISO 15765-2 a received FC.OVFLW (0x32) will abort the ongoing
transmission due to the lack of reception buffer at the receiver side.
If the switch ‘TP_ENABLE_IGNORE_FC_OVFL’ is defined then a FC.OVFLW frame is
silently ignored instead.
3.2.3.3 Do not ignore unexpected Flow Control frames According to ISO 15765-2 any unexpected FC frame shall be ignored.
If the switch TP_USE_UNEXPECTED_FC_CANCELATION is set to kTp_On, this behavior
is changed. Then every unexpected FC frame will cancel the current transmission.
3.2.3.4 Use STmin of FC According to ISO 15765-2, the STmin from an FC.CTS shall be used as separation time
between two consecutive frames.
If the switch TP_USE_STMIN_OF_FC is set to kTp_Off, the STmin of the FC is ignored.
Instead, the configured N_Cs timeout (TxTransmitCF parameter, see
3.1.1.1) is used as
STmin.
3.2.3.5 Analyze first FC only According to ISO 15765-2, the contents of each expected and received FC.CTS shall be
evaluated by a transmitter in order to adjust its BS and STmin values.
If the switch TP_USE_ONLY_FIRST_FC is set to kTp_On, only the BS and the STmin of
the first received FC.CTS are evaluated. These values are then used for the complete
transmission. Further received FC.CTS are only used for synchronization and not to adjust
BS and STmin.
3.3 Additional settings via user-configuration file 3.3.1 Dynamic Timing API Using this feature the application can dynamically change connection specific timing
values for:
> CAN confirmation timeout (N_Ar, N_As)
> Consecutive Frame timeout (N_Cr)
> Flow Control timeout (N_Bs).
The dynamic channel timing feature can be enabled via a user configuration file. If the
pre-processor switch “TP_ENABLE_DYN_CHANNEL_TIMING” is included in this way then
the TP takes the timing values from the following application provided variables:
tTpEngineTimer tpRxConfirmationTimeout [kTpRxChannelCount];
tTpEngineTimer tpTxConfirmationTimeout [kTpTxChannelCount];
2013, Vector Informatik GmbH
Version: 3.14.00
45 / 177
based on template version 5.1.0





Technical Reference Transport Protocol ISO15765-2
tTpEngineTimer tpRxTimeoutCF [kTpRxChannelCount];
tTpEngineTimer tpTxTimeoutFC [kTpTxChannelCount];
tTpEngineTimer is usually of type canuint16, for 8-bit CPUs it might also be defined as
canuint8.
These variables are initialized internally from the TP with the constant values that are
configured in the generation tool. So all connection specific timing are equal after TP
initialization.
Please note that the TP expects these variables, containing the connection
specific timing values, to be supplied by the application.
For the further dynamic adaptation and differentiation of these connection specific values
the following API functions are available in addition:
> TpRxSetTimeoutConfirmation
(see 4.2.2.25 )
> TpTxSetTimeoutConfirmation
(see 4.2.3.26) > TpRxSetTimeoutCF
( see 4.2.2.26 )
> TpTxSetTimeoutFC
(see 4.2.3.27) With these functions the belonging timeout values of the TP can be changed dynamically
during runtime.
3.4 TP classes: SingleTP (multi-based) These TP classes are based on the MultiTP core but running only with one connection and
are optimized to consume a minimum of resources.
3.4.1 Database Attributes Following Database attributes are needed:
Figure 3-7 Database Attributes for Single/Static TP classes
2013, Vector Informatik GmbH
Version: 3.14.00
46 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
DiagRequest / DiagResponse: Used for diagnostic request messages to make special
pre-settings for the Vector diagnosis’s layers.
(Only available for some car-manufactures)
TpTxIndex:
Used for application TP messages.
TP connections with FlowControl: bi-directional transmissions according to ISO 15765
standard
TP-connections without FlowControl: unidirectional transmissions nonconformance to the
ISO 15765 standard
conventions to read a connection out of the database
bidirectional with FC (standard) The TX-Node and the RX-Node includes each a TX-TP-message
with the same TpTxIndex value {Broadcast not possible}.
bidirectional without FC
not supported
unidirectional with FC
not supported
unidirectional without FC
The RX-Node do not include a TX-TP-message with a same
(not supported in SingleTP
TpTxIndex as the TX-TP-msg. of the TX-Node {Broadcast is
classes)
possible - TX-msg. can have more than one receiver}.
Table 3-1 Usage of TpTxIndex database attribute
GenMsgDelayTime: If the database attribute ‘GenMsgDelayTime’ has a value unequal to zero, then the TP
observes this time between two transmissions as a minimum time distance.
3.4.2 TP class SingleTP (multi-based): Normal Addressing No special settings needed
3.4.3 TP class SingleTP (multi-based): Extended Addressing No special settings needed
3.4.4 TP class SingleTP (multi-based):Normal Fixed Addressing 3.4.4.1 Database Attributes Refer to chapter 3.6.6.1 Database Attributes
3.5 TP classes Static MultiTP For each TP-communication between two ECUs static defined connections are available.
3.5.1 Database Attributes Refer to chapter 3.4.1 Database Attributes
2013, Vector Informatik GmbH
Version: 3.14.00
47 / 177
based on template version 5.1.0



Technical Reference Transport Protocol ISO15765-2
3.5.2 TP class specific settings Figure 3-8 Additional TP settings (Static MultiTP) in Generation Tool
Connection specific timing parameters If ‘Connection specific timing parameters’ are activated the timing parameters of each
connection can override the global timing values for this connection.
TpPreCopyCheck Just enter a function name to use this hook function.
3.5.3 Connection specific timing parameters Figure 3-9 Connection specific timing parameters
The following parameters can be configured individually for each connection:
Timings > TxTimeoutFC
> TxTimeoutCF
> RxTransmitCF
FlowControl > STMin
> Requested BlockSize
For detailed descriptions refer chapte
r 3.1.1 Timing and the following
2013, Vector Informatik GmbH
Version: 3.14.00
48 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
3.5.4 Functions Figure 3-10 Hook-Functions (Static MultiTP)
Just enter a suitable function name to use the hook function in your application.
For a detailed description of each function refer chapte
r 4.4. 3.6 TP classes Dynamic MultiTP In opposite to the static MultiTP there are no fix connections available. All connections are
built-on during runtime and released after the transmission is complete. So the resources
used per connection can be reused by other applications.
3.6.1 Properties Tx channel count Maximum possible number of parallel used TpChannel(s) for transmissions.
Rx channel count Maximum possible number of parallel used TpChannel(s) for receptions.
Use Tx channels without FC Enable the feature to use the non-ISO implementation ‘without FC’ for transmission.
Use Rx channels without FC Enable the feature to use the non-ISO implementation ‘without FC’ for reception.
2013, Vector Informatik GmbH
Version: 3.14.00
49 / 177
based on template version 5.1.0




Technical Reference Transport Protocol ISO15765-2
3.6.2 Hook Functions In opposite to the static MultiTP, where all hook functions are available once for each
statically configured connection, here this set of hook functions is available only once for
all connections. This means that all messages have to be dispatched to the belonging
destination by the application for each connection.
These hook functions we recommend to use.
Figure 3-11 Mandatory functions for the usage of the CANdesc diagnostic component
Just enter a suitable function name to use the hook function in your application.
For a detailed description of each function refer to chapte
r 4.4. These hook functions are optional.
Figure 3-12 Optional functions (example for the usage of the CANdesc diagnostic component)
Be careful
while using a Vector Diagnostic Layer it is necessary to hand over only the function calls
to the Diagnostic Layer, which belong to the diagnostic connection(s). An application
example is present, see chapter
8.5.1. 3.6.3 Dynamic Objects The MultiConnection Tp uses the “dynamic TxID” functionality (Dynamic TxID On) of the CAN-
Driver. However, you can specify additional dynamic objects for your application.
2013, Vector Informatik GmbH
Version: 3.14.00
50 / 177
based on template version 5.1.0




Technical Reference Transport Protocol ISO15765-2
Important
If you want to add dynamic objects for your application you have just to enter your count
of dynamic objects. The Generation Tool adds the usage of dynamic objects for the
MultiConnection Tp automatically.
3.6.4 TP class Dynamic MultiTP: Normal Addressing 3.6.4.1 CANdriver settings Important
Actually the Generation Tool will not setup the reception messages automatically. The
user itself has to insert for each message, which should be processed by the TP (or for
a range of messages) a ‘TpPrecopy’-function. Please refer the CAN-driver manual
/CANdrv/ how to insert a Precopy-function.
3.6.5 TP class Dynamic MultiTP: Extended Addressing 3.6.5.1 TP class specific settings Figure 3-13 Misc (Extended Addressing)
Own ECU number It will be read out from the database attribute ‘TpOwnSystemEcuNumber’.
Lowest functional address The value should define the lowest value of an additional range of receivable
TargetAddresses.
Not supported – use instead the hook function ApplTpCheckTA()
Highest functional address The value should define the highest value of an additional range of receivable
TargetAddresses.
Not supported – use instead the hook function ApplTpCheckTA()
2013, Vector Informatik GmbH
Version: 3.14.00
51 / 177
based on template version 5.1.0



Technical Reference Transport Protocol ISO15765-2
3.6.5.2 Database Attributes Name Default No TP used Normal Extended
(example) TpNodeBaseAddress
FFFF
Default
Default
0x600
TpOwnSystemEcuNumber
FF
Default
Default
0x01
TpNodeMesageCount
FF
Default
Default
0xff
Table 3-2 Data Base Attributes
TpNodeBaseAddress The not valid value FFFF indicates, that there is no base address necessary.
TpOwnSystemEcuNumber This value provides the own ECU Number, necessary for setting up the transmit identifier.
TpNodeMessageCount This value determines how many messages are assigned to the ‘range’ together with the
base address. This is necessary for the TP to calculate to which base the received CAN ID
is assigned.
The values for extended addressing are just an example:
The CAN ID for this node is 0x600 + 0x01 = 0x601.
3.6.5.3 Multiple Base Addresses For each connection a dedicated base address including an address offset and a message
count can be specified.
3.6.6 TP class Dynamic MultiTP: Normal Fixed Addressing 3.6.6.1 Database Attributes Figure 3-14 Database attributes for ‘Normal Fixed Addressing’
TpOwnSystemEcuNumber Each ECU is represented in the network by an address / EcuNumber. If the EcuNumber
0xff is used the TP activates the ‘Multiple EcuNumber’ feature (refe
r 7.4.1 Virtual ECU’s). 2013, Vector Informatik GmbH
Version: 3.14.00
52 / 177
based on template version 5.1.0



Technical Reference Transport Protocol ISO15765-2
TpNodeBaseAddress This attribute includes the upper 13 bits (like priority, PGN) of the CAN-ID.
3.6.7 TP class Dynamic MultiTP: Mixed 29-bit Addressing Currently open – support is only for generation tool GENy requested
3.6.8 TP class Dynamic MultiTP: Multiple Addressing In this TP class it is possible to change the addressing mode in run-time.
3.6.8.1 Addressing mode Figure 3-15 Addressing mode (Multiple Addressing)
Only the checked addressing modes will be supported.
3.6.8.2 CAN Driver settings To distinguish the addressing mode while the reception different Precopy-functions will
exist for each mode. It is possible to insert the Precopy-function for a message or for a
range of messages (CAN-Driver Ranges).
> NormalAddressing: TpPrecopyNormal<DESTINATION>
> NormalFixedAddressing: TpPrecopyNormalFixed<DESTINATION>
> ExtendedAddressing: TpPrecopyExtended<DESTINATION>
> Mixed29Addressing: TpPrecopyMixed29<DESTINATION>
> Mixed11Addressing: TpPrecopyMixed11<DESTINATION>
Caution
Actually the Generation Tool will not setup the reception messages automatically.
<DESTINATION> is replaced by on of the following strings:
> Appl
> DiagFunc
> DiagPhys
These destinations identify the purpose of a given connection. DiagFunc will identify a
functional Diagnostic message (1:n). DiagPhys is representing the standard physical
diagnostic message (1:1) and Appl a standard TPMC connection used for application
purpose (1:1).
E.g.: NormalFixedAddressing range 18DA0500 with mask 0xFF which is specified by the
ISO standard as physical range would be configured in the CAN Driver as:
2013, Vector Informatik GmbH
Version: 3.14.00
53 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
TpPrecopyNormalFixedDiagPhys
Using a dispatcher in combination with two macro functions it is possible to distinguish
inside the TPMC callback function set between a diagnostic or applicational request
message and direct it to the correct component like CANdesc.
TpRxGetAddressingFormat(tpChannel) can be used to check against
#define kTpNormalAddressing
#define kTpExtendedAddressing
#define kTpNormalFixedAddressing
#define kTpMixed29Addressing
#define kTpMixed11Addressing
TpRxGetAssignedDestination( tpChannel) can be used to check against
#define kTpRequestAppl
#define kTpRequestDiagFunctional
#define kTpRequestDiagPhysical
Figure 3-16 Dedicated call of Precopy functions in TPMC by the driver.
2013, Vector Informatik GmbH
Version: 3.14.00
54 / 177
based on template version 5.1.0

















Technical Reference Transport Protocol ISO15765-2
3.7 TP class Dispatched MultiTP With the release version 3.00.00 of TPMC the “Dispatched” MultiTP class was introduced
to disburden the application from the dispatching job.
Using the “Dynamic MultiTP” classes, which support only one single set of callback
functions for all connections together, the dispatching of the actual destination has to be
performed by the application.
Using the “Dispatched MultiTP” classes all of the dispatching work is done within the
TPMC.
“Dispatched MultiTP” is located between static and dynamic TP classes. As well as Static
TP it supports connection specific sets of callback functions and dispatches all
connections, regarding the Address Information (AI), to these callback functions. Just as
Dynamic TP resources are shared among the connections.
Diag
Appl_1
Appl_n
All connection specific attributes like timeouts,
max. tpChannels, callback function set, etc. are
Dispatched TPMC
kept internally in the TPMC.
The configured address information (AI) is
linked (via a TPMC internal Precopy function)
AI_0
AI_1
AI_2
directly to the destination application.
Can Driver
CAN 2
CAN 1
Figure 3-17 Dedicated call of application callback functions in TPMC by the internal dispatcher.
Info Please note that all existing applications are unaffected unless the new class is actually
selected in the generation tool.
2013, Vector Informatik GmbH
Version: 3.14.00
55 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
3.7.1 “Dynamic MultiTP” versus “Dispatched MultiTP” – a short analogy 3.7.1.1 Solution based on “Dynamic MultiTP”: Here all dynamic TpChannels are provided as a global resource and shared by all
connections. So, if no Rx channel is currently available then the incoming message is
simply discarded by the TPMC, no reception will occur and the application will not be
notified. Otherwise the primal callback function to map an incoming request to a
connection, the ‘ApplTpRxGetBuffer’ function, is called. The addressing data statically
configured in GENy is not present for the dispatching application. There is no consistency
provided by the TPMC.
To perform this mapping the addressing information statically configured has to be
compared to the currently received CAN message. The scope of the addressing
information to be compared can be different and depends on the used addressing type.
If a valid connection is found within the ‘ApplTpRxGetBuffer’ function then a valid pointer to
the application buffer is handed to the TPMC, the FC status can be set and the FC
addressing information must be set for usage by the TPMC. The identified reception is
marked while using the ‘TpRxSetConnectionNumber’ API function with a unique number
defined by the application. To distinguish the connections in later callbacks (e.g.
ApplTpRxIndication(tpChannel)), the API TpRxGetConnectionNumber(tpChannel) must be
used to get an application relevant handle. The tpChannel handle can and will be different
for each reception.
Receive Example: (see also chapt
er 8.5) /* get CAN-Id */
requestId = TpRxGetChannelID(channel);
if(requestId == MY_RECEIVE_ID) {
/* store connection number */
TpRxSetConnectionNumber(channel, kMyConnectionNo);
/* set CAN-Id for response */
TpRxSetTransmitID(channel, MY_TRANSMIT_ID);
pBuf = myTpGetRxBuffer(channel, dataLength);
/* handle FC status properly */
if(pBuf == V_NULL) {
TpRxSetFCStatus(channel, kTpFCStatusOverflow);
}
else {
TpRxSetFCStatus(channel, kTpFCClearToSend);
}
}
For the transmission a Tx channel has to be allocated, a connection number has to be
assigned and the connection parameters have to be set according to the addressing type
before the transmission can be started.
Transmit Example: (see also chapt
er 8.5) /* acquire a tx channel */
vuint8 channel = TpTxGetFreeChannel(kMyConnection0);
if(channel != kTpNoChannel ) {
/* set CAN channel */
2013, Vector Informatik GmbH
Version: 3.14.00
56 / 177
based on template version 5.1.0




Technical Reference Transport Protocol ISO15765-2
TpTxSetCanChannel(channel, kMyCanNo);
/* set CAN identifiers */
TpTxSetChannelID(channel, myTxCANId, myRxCANId); /* precalculated CAN Ids */
TpTxSetTargetAddress(channel, target_address); /* extended addressing */
/* trigger the transmission */
TpTransmit(channel, data, length);
}
For all this topics several API functions must be used in a correct manner what may result
in a pretty complex dispatcher to be handled by the application.
3.7.1.2 Solution based on “Dispatched MultiTP” Each connection group has a configurable number of TpChannels reserved for its own.
This offers an improved availability for concurrent receptions with no interference to other
TpChannel resources availability.
All Tp callbacks are dispatched internally in the TPMC. In addition to the passing of a raw
tpChannel a connection handle ‘addrInfoHandle’ is handed to the application. Behind this
‘addrInfoHandle’ all address information is available based on the static configuration
information. Only dynamic runtime address information (e.g. target address in case of
Extended- or NormalFixed- addressing) has to be handled extra.
Info Please note that all application callback functions do not change their API.
Additional API functions are provided to get the ‘addressInfoHandle’ from the
corresponding tpChannel :
TpRxGetAddressInfoHandle(tpChannel): within reception callbacks
TpTxGetAddressInfoHandle(tpChannel): within transmission callbacks
A connection specific precopy function is introduced which is called when the dispatching
is already completed and resulted in exactly the call of this connection specific function. To
identify the connection later on just the ‘addressInfoHandle’ has to be stored by the
application.
The handles are provided in the form “kTp<Addressing Info Name>” in the generated
code. So the application can easily differentiate within the callback functions which
connection is present just by checking the ‘addressInfoHandle’ using the API
‘TpRxGetAddressInfoHandle()’. Please note that the differentiation in the callback
functions is only necessary if more than one AI is configured for one connection or if the
same callback functions are configured for more than one connection. Otherwise the
corresponding callback function is dedicated unambiguously to one connection.
Of course also here free TpChannels must be available (per connection group) or the
reception (transmission) will fail.
2013, Vector Informatik GmbH
Version: 3.14.00
57 / 177
based on template version 5.1.0



Technical Reference Transport Protocol ISO15765-2
Example:
The following example shows a “Dispatched Multiple Addressing Multi TP” configuration
containing 3 connections (TpConnection000/001/002).
One AI is configured per connection and each connection uses a different addressing type
(Normal-, Extended-, NormalFixed- addressing).
2013, Vector Informatik GmbH
Version: 3.14.00
58 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
Each connection has an appropriate
connection specific set of callback
functions beneath some other
connection specific attributes.
In the generated code the following constants are available for usage by the application.
The connections groups:
#define kTpGroupTpConnection000 0
#define kTpGroupTpConnection001 1
#define kTpGroupTpConnection002 2
The connection handles:
#define kTpConn0_AI1 0
#define kTpConn1_AI2 1
#define kTpConn2_AI3 2
The connection specific transmit macros:
#define TpTransmit_Conn0_AI1( data ,length) \
TpTransmitNormal( kTpConn0_AI1, data, length)
#define TpTransmit_Conn1_AI2( TA ,data ,length) \
TpTransmitExtended( kTpConn1_AI2, TA, data, length)
#define TpTransmit_Conn2_AI3( TA ,data ,length) \
TpTransmitNormalFixed(kTpConn2_AI3, TA, data, length)
2013, Vector Informatik GmbH
Version: 3.14.00
59 / 177
based on template version 5.1.0



Technical Reference Transport Protocol ISO15765-2
Now the application can easily differentiate within the connection specific callback
functions and decide how to proceed:
if(TpRxGetAddressInfoHandle(tpChan) == kTpConn1_AI2) {
...
TpTransmit_Conn1_AI2( TA ,data ,length);
...
}
3.7.2 Dispatched MultiTP API Caution
To avoid collisions it is prohibited to use API-functions from the application site that are
used internally by the TPMC dispatcher.
This means that all API functions marked as “done internally by TP” in the tables below
are neither necessary nor available anymore!
3.7.2.1 Reception side Dynamic MultiTP class Dispatched MultiTP class Since version 3.00.00 TpRxSetConnectionNumber
done internally by TP
TpRxGetConnectionNumber
done internally by TP
TpRxGetAddressingFormat
done internally by TP
TpRxGetAssignedDestination
TpRxResetChannel
available for application usage
TpRxSetTransmitID
TpRxGetStatus
TpRxSetBS
TpRxGetBS
TpRxSetSTMIN
TpRxGetSTMIN
TpRxGetChannelID
TpRxGetCanChannel
TpRxGetSourceAddress
TpRxGetReceivedTargetAddress
TpRxGetEcuNumber
TpRxSetBufferOverrun
TpRxGetAddressExtension
TpRxGetCanbuffer
TpRxSetWaitCorrectSN
TpRxSetTimeoutConfirmation
TpRxSetTimeoutCF
TpRxSetFCStatus
TpRxGetFCStatus
TpRxSetClearToSend
New API functions for Dispatched classes:
2013, Vector Informatik GmbH
Version: 3.14.00
60 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
Please find a more detailed description in chapte
r 4. TpGetConnectionGroup(AI_handle)
Get the connection group
(kTpGroup<ConnectionName>)
TpGetAddressingType (AI_handle)
Get the addressing type info (only for multiple
addressing class):
kTpNormalAddressing,
kTpExtendedAddressing,
kTpNormalFixedAddressing,
kTpMixed11Addressing,
kTpMixed29Addressing
TpGetCanChannel(AI_handle)
Get the pertaining CAN channel (only for multiple
CAN channels)
TpGetRxId( AI_handle)
Get the Rx CAN-Identifier (only for normal
addressing)
TpGetTxId( AI_handle)
Get the Tx CAN-Identifier (only for normal
addressing)
TpGetBaseAddress( AI_handle)
Get the base address (only for extended
addressing)
TpGetAddressOffset( AI_handle)
Get the address offset pertaining to a base
address (only for extended addressing)
TpGetPriority( AI_handle)
Get the priority info from a 29-bit CAN
identifier (only for NormalFixed or Mixed29
addressing)
TpGetPGN( AI_handle)
Get the parameter group identification from a
29-bit CAN identifier (only for NormalFixed or
Mixed29 addressing)
TpGetEcuNumber( AI_handle)
Get the ECU address (only for NormalFixed or
Mixed29 addressing)
3.7.2.2 Transmission side Info Please note that the TpTransmit function is the only API that has to be adapted in the
application code.
Dynamic MultiTP class Dispatched MultiTP class Since version 3.00.00 TpTxSetChannelID
done internally by TP
TpTxSetCanChannel
done internally by TP
TpTxSetTargetAddress
done internally by TP
TpTxSetEcuNumber
done internally by TP
TpTxSetBaseAddress
done internally by TP
TpTxGetFreeChannel
done internally by TP
TpTxSetAddressingFormat
done internally by TP
TpTxGetConnectionNumber
done internally by TP
TpTxGetConnectionStatus
done internally by TP
TpTxSetAddressExtension
done internally by TP
TpTxSetResponse
done internally by TP
TpTxLockChannel
done internally by TP
TpTxUnlockChannel
(see note 1.) below)
TpTransmit
Either you can use the generated connection
specific macros:
TpTransmit_<ConnectionName>(data,len),
2013, Vector Informatik GmbH
Version: 3.14.00
61 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
TpTransmit_<ConnectionName>(TA,data,len),
TpTransmit_<ConnectionName>(AE,data,len),
TpTransmit_<ConnectionName>(TA,AE,data,len),
or directly the referenced functions:
TpTransmitNormal (AI, data, len),
TpTransmitExtended (AI, TA, data, len),
TpTransmitNormalFixed(AI, TA, data, len),
TpTransmitMixed11 (AI, AE, data, len),
TpTransmitMixed29 (AI, TA, AE, data, len).
Please refer to the API description in
chapter 4. TpTxGetDataBuffer
available for application usage
TpTxGetDataIndex
TpTxResetChannel
TpTxGetSTminInFrame
TpTxPrepareSendImmediate
TpTxSendImmediate
TpRxSetStrictFlowControl
1.) Note: The Locking and Unlocking of tpChannels is no longer necessary. Due to the possibility to configure
a connection with a dedicated exclusive tpChannel the tpChannel resource is ‘locked’ implicitly.
New API functions for Dispatched classes:
Please find a more detailed description in chapte
r 4. TpTransmitNormal( AI_handle,data,len) Instead of using the addressing type
specific transmit functions we recommend
TpTransmitExtended( AI_handle,data,len) to use the connection specific macros
TpTransmitNormalFixed( AI_handle,data,len) which are generated.
TpTransmitMixed11( AI_handle,data,len
TpTransmitMixed29( AI_handle,data,len
2013, Vector Informatik GmbH
Version: 3.14.00
62 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4 API 4.1 Use of ISO15765-Transport Protocol Please use the services of the ISO15765 Transport Protocol in your application according
to the instructions in this manual.
Please include the tpmc.h definition file in all modules requiring Transport Protocol
Services. All available services, the types for the interface, and symbolic constants are
defined in this file.
After a power on reset and before any other call of the Transport Protocol the function void
TpInitPowerOn(void) has to be called. The main program of the Transport Protocol
TpTxTask() and TpRxTask()
has to be called periodically by the application.
All other services of the Transport Protocol are called on those points in your application
where services are required.
4.2 Functions of the Transport Protocol Field description of the following tables
Name of the function Prototype SingleConnectionTp
Function prototype for SingleConnectionTP
MultipeConnectionTP
Function prototype for MultipleConnectionTP
Parameter Name of the parameter
Description of the parameter
Return code
name
Meaning of the return code
Availability The API is included in all versions, except a restriction is given here
Description Explanation of the functionality
Pre-condition(s) Required preconditions before the function can be used.
Post-condition(s) If a state change was done, it will be described here
Call context The restrictions from where the function can be used are described here.
2013, Vector Informatik GmbH
Version: 3.14.00
63 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Please note Some additional notes
Examples A short code example is given
4.2.1 Administrative Functions 4.2.1.1 TpInitPowerOn: Initialization TpInitPowerOn Prototype SingleConnectionTp
void
TpInitPowerOn ( void )
MultipeConnectionTP
void
TpInitPowerOn ( void )
Parameter -
-
Return code
-
-
Availability No restrictions
Description Power On Initialization of the TP. This function has to be called before all other functions of the Transport
Protocol once after Power On.
Pre-condition(s) Global interrupts are disabled and CAN-driver with function CanInitPowerOn() and are initialized
correctly.
Post-condition(s) The Transport Layer is ready for reception after calling TpInitPowerOn().
Call context Background-loop level with global disabled interrupts
Please note Call the TpInitPowerOn() before the application wants to reserve own dynamic transmission objects.
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
64 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.1.2 TpInit: Re-initialization TpInit Prototype SingleConnectionTp
void
TpInit ( void )
MultipeConnectionTP
void
TpInit ( void )
Parameter -
-
Return code
-
-
Availability No restrictions
Description The Transport Layer is re-initialized after calling TpInit()
. Pre-condition(s) TpInitPowerOn()
was called before. No TP functionality is used at this time.
Post-condition(s) The Transport Layer is re-initialized after calling TpInit().
Call context Background-loop level with global disabled interrupts
Please note -
Examples -
4.2.1.3 TpTask: Observing timing conditions TpTask Prototype SingleConnectionTp
void TP_API_CALL_TYPE
TpTask(void)
MultipeConnectionTP
void TP_API_CALL_TYPE
TpTask(void)
Parameter -
-
2013, Vector Informatik GmbH
Version: 3.14.00
65 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Return code
-
-
Availability No restrictions
Description Function calls both TpRxTask and TpTxTask in correct order.
Pre-condition(s) TpInitPowerOn()
was called before.
Post-condition(s) -
Call context Cyclic task base.
Please note -
Examples -
4.2.1.4 TpCanChannelInit: CAN channel specifiic re-initialization TpCanChannelInit Prototype SingleConnectionTp
void TP_API_CALL_TYPE
TpCanChannelInit(canuint8
canChannel)
MultipeConnectionTP
void TP_API_CALL_TYPE
TpCanChannelInit(canuint8
canChannel)
Parameter
canChannel
-
Return code
-
-
Availability Since TPMC version 2.41
Description Any reception / transmission on this CAN channel will be stopped. If a connection was running the
application will be informed by calling the function ApplTpXxErrorIndication().
Pre-condition(s) TpInitPowerOn() was called before. No TP functionality is used at this time.
2013, Vector Informatik GmbH
Version: 3.14.00
66 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Post-condition(s) All running TP channels on this CAN channel are re-initialized.
Call context Background-loop level with global disabled interrupts
Please note -
Examples -
4.2.1.5 TpRxTask: time base for reception timeouts TpRxTask Prototype SingleConnectionTp
void
TpRxTask(void)
MultipeConnectionTP
void
TpRxTask(void)
Parameter -
-
Return code
-
-
Availability No restrictions
Description The function TpRxTask() has to be called periodically (cycle time TTpRxCallCycle) by the application. This
function performs all Rx-Tasks of the Transport Layer and monitors the timings.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context Background-loop level or OSEK-osTask with low priority.
Important note: This function
must not be called in interrupt context!
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
67 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.1.6 TpTxTask: time base for timeouts/transmission TpTxTask Prototype SingleConnectionTp
void
TpTxTask(void)
MultipeConnectionTP
void
TpTxTask(void)
Parameter -
-
Return code
-
-
Availability No restrictions
Description The function TpTxTask() has to be called periodically (cycle time TTpTxCallCycle) by the application. This
function performs all Tx-Tasks of the Transport Layer and monitors the timings.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context Background-loop level or OSEK-OSTask with low priority.
Important note: This function
must not be called in interrupt context!
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
68 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.1.7 TpRxStateTask: optional transmission retry TpRxStateTask Prototype SingleConnectionTp
void
TpRxStateTask(void)
MultipeConnectionTP
void
TpRxStateTask(vuint8 tpChannel)
Parameter
tpChannel
-
Return code
-
-
Availability Since TPMC version 2.35
Description The function TpRxStateTask() can be called optionally by the application. This function performs the link
from the Transport Layer to the CAN-Driver.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note Examples -
R
4.2.1.8 TpRxAllStateTask: optional transmission retry TpRxAllStateTask Prototype SingleConnectionTp
void
TpRxAllStateTask (void)
MultipeConnectionTP
void
TpRxAllStateTask (void)
Parameter
-
-
2013, Vector Informatik GmbH
Version: 3.14.00
69 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Return code
-
-
Availability Since TPMC version 2.35
Description The function TpRxAllStateTask() can be called optionally by the application. This function performs the
link from the Transport Layer to the CAN-Driver for all running Rx-connections.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note - Examples -
4.2.1.9 TpTxStateTask: optional transmission retry TpTxStateTask Prototype SingleConnectionTp
void
TpTxStateTask (void)
MultipeConnectionTP
void
TpTxStateTask (vuint8 tpChannel)
Parameter
tpChannel
-
Return code
-
-
Availability Since TPMC version 2.35
Description The function TpTxStateTask() can be called optionally by the application. This function performs the link
from the Transport Layer to the CAN-Driver.
Pre-condition(s) The TP is initialized with TpInitPowerOn ().
2013, Vector Informatik GmbH
Version: 3.14.00
70 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Post-condition(s) -
Call context -
Please note It is prohibited to call TpTxStateTask () nested. Examples -
4.2.1.10 TpTxAllStateTask: optional transmission retry TpTxAllStateTask Prototype SingleConnectionTp
void
TpTxAllStateTask (void)
MultipeConnectionTP
void
TpTxAllStateTask (void)
Parameter
tpChannel
-
Return code
-
-
Availability Since TPMC version 2.35
Description The function TpTxAllStateTask() can be called optionally by the application. This function performs the
link from the Transport Layer to the CAN-Driver for all running Tx-connections.
Pre-condition(s) The TP is initialized with TpInitPowerOn ().
Post-condition(s) -
Call context -
Please note - Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
71 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.2 Receive Functions 4.2.2.1 TpRxSetConnectionNumber: Assign a Connection-Number to a channel TpRxSetConnectionNumber Prototype SingleConnectionTp
-
MultipeConnectionTP
void
TpRxSetConnectionNumber(vuint8 tpChannel,
void connection)
Parameter
tpChannel
Underlying tpChannel used for this connection.
connection
Connection number that shall be assigned to this tpChannel.
Return code
void
-
Availability Only for dynamic TP classes
Description This function assigns an application specific connection-number to this tpChannel.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context Use this function only inside the callback function
ApplTpRxGetBuffer() !
Please note - Examples -
4.2.2.2 TpRxGetConnectionNumber: Get the Corresponding Connection-Number TpRxGetConnectionNumber Prototype SingleConnectionTp
-
MultipeConnectionTP
vuint8
TpRxGetConnectionNumber(vuint8 tpChannel)
2013, Vector Informatik GmbH
Version: 3.14.00
72 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Parameter
tpChannel
-
Return code
vuint8
-
Availability Only for dynamic TP classes
Description This function returns the connection-number, which is assigned to this tpChannel.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
This tpChannel is not reset and a connection-number was previously assigned to it by the application.
(See TpRxSetConnectionNumber())
Post-condition(s) -
Call context -
Please note A correct value will only be returned, if a connection number was set previously in the callback function
ApplTpRxGetBuffer() with TpRxSetConnectionNumber().
Examples -
4.2.2.3 TpRxGetAddressingFormat: Get the current addressing type TpRxGetAddressingFormat Prototype SingleConnectionTp
-
MultipeConnectionTP
canbittype
TpRxGetAddressingFormat(canuint8
tpChannel)
Parameter
tpChannel
Underlying TP channel
Return code
One of the following constants (canbittype:3):
#define kTpNormalAddressing
#define kTpExtendedAddressing
#define kTpNormalFixedAddressing
#define kTpMixed29Addressing
#define kTpMixed11Addressing
2013, Vector Informatik GmbH
Version: 3.14.00
73 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Availability Only for Multiple Addressing TP
Description This macro is used to retrieve the required addressing information in a multiple addressing environment.
Using a dispatcher in combination with the macro function it is possible to distinguish inside the TPMC
callback function set between the different addressing types and handle additional pertaining information.
Pre-condition(s) A TP Channel is successful allocated.
Post-condition(s) -
Call context -
Please note - Examples -
4.2.2.4 TpRxGetAssignedDestination: Get the currently assigned destination TpRxGetAssignedDestination Prototype SingleConnectionTp
-
MultipeConnectionTP
canbittype
TpRxGetAssignedDestination(canuint8
tpChannel)
Parameter
tpChannel
Underlying tp channel
Return code
One of the following constants (canbittype:3):
#define kTpRequestAppl // Application
#define kTpRequestDiagFunctional // Functional Diag.
#define kTpRequestDiagPhysical // Physical Diag.
is delivered to differentiate between application, functional or physical diagnostic
requests.
Availability Only for Multiple Addressing TP
2013, Vector Informatik GmbH
Version: 3.14.00
74 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Description This macro is used to retrieve the required destination information in a multiple addressing environment.
Using a dispatcher in combination with the macro function it is possible to distinguish inside the TPMC
callback function set between the different destinations and handle the correct dispatching of the message
to the pertaining destination.
Pre-condition(s) A tpChannel is successful allocated.
Post-condition(s) -
Call context -
Please note - Examples -
4.2.2.5 TpRxResetChannel: Free Rx-TpChannel TpRxResetChannel Prototype SingleConnectionTp
void TP_API_CALL_TYPE
TpRxResetChannel(void)
MultipeConnectionTP
void TP_API_CALL_TYPE
TpRxResetChannel(canuint8
tpChannel)
Parameter
tpChannel
-
Return code
-
-
Availability No restriction
Description Each time a transport-frame was received the used channel is blocked. To receive another transport-frame
on this channel the application has to free this channel.
This is, in case of an erroneous reception, not required for the TpRxErrorIndication() callback.
The function is called within or after the Rx-Indication - callback.
If the application calls the reset-function then the application itself is also responsible to handle the reset
values inside the application in further processing steps.
2013, Vector Informatik GmbH
Version: 3.14.00
75 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context Background-loop level or OSEK-OSTask with lower or same priority as TpTasks.
Please note - Examples -
4.2.2.6 TpRxGetStatus: Rx-Channel Status TpRxGetStatus Prototype SingleConnectionTp
vuint8
TpRxGetStatus(void)
MultipeConnectionTP
vuint8
TpRxGetStatus(vuint8 channel)
Parameter
channel
-
Return code
vuint8
kTpChannelInUse = 0x01
kTpChannelNotInUse =0x00
Availability No restriction
Description This function returns the actual status of the Rx-Channel.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note The returned status can have more than two values!
The InUse-Flag is always coded in the lowest bit (0x01)
2013, Vector Informatik GmbH
Version: 3.14.00
76 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Examples Because it is a status-field there are two possibilities for checking if the channel is InUse:
if ( TpRxGetStatus(user_channel) != kTpChannelNotInUse )
{
...
or:
if ( TpRxGetStatus(user_channel) & kTpChannelInUse )
{
...
4.2.2.7 TpRxSetBS: Setting up BlockSize on Reception Side TpRxSetBS Prototype SingleConnectionTp
void
TpRxSetBS(vuint8 newBlockSize)
MultipeConnectionTP
void
TpRxSetBS(vuint8 channel, vuint8
newBlockSize)
Parameter
newBlockSize
-
channel
Return code
-
Availability Extended API-BS must be activated
Description The BlockSize-Value within the FlowControl can be adjusted by this function.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
77 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.2.8 TpRxGetBS: Get BlockSize on Reception Side TpRxGetBS Prototype SingleConnectionTp
vuint8
TpRxGetBS(void)
MultipeConnectionTP
vuint8
TpRxGetBS(vuint8 channel)
Parameter
channel
-
Return code
-
Availability Extended API-BS must be activated
Description The BlockSize-Value within the FlowControl can be read by this function.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.2.9 TpRxSetSTMIN: Setting up STMin time on Reception Side TpRxSetSTMIN Prototype SingleConnectionTp
void
TpRxSetSTMIN(vuint8 newSTMinSize)
MultipeConnectionTP
void
TpRxSetSTMIN(vuint8 channel, vuint8
newSTMinSize)
Parameter
Channel
-
2013, Vector Informatik GmbH
Version: 3.14.00
78 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
newSTMinSize
Return code
-
Availability Extended API-STMIN must be activated
Description The STmin-Value within the FlowControl can be adjusted by this function.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.2.10 TpRxGetSTMIN: Get STMin time on Reception Side TpRxGetSTMIN Prototype SingleConnectionTp
vuint8
TpRxGetSTMIN(void)
MultipeConnectionTP
vuint8
TpRxGetSTMIN(vuint8 channel)
Parameter
Channel
-
Return code
-
Availability Extended API-STMIN must be activated
Description The STmin-Value within the FlowControl can be read by this function.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
2013, Vector Informatik GmbH
Version: 3.14.00
79 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.2.11 TpRxGetChannelID: Get Received CAN-Id TpRxGetChannelID Prototype SingleConnectionTp
-
MultipeConnectionTP
vuint16
TpRxGetChannelID(vuint8 channel)
Parameter
Channel
-
Return code
CAN-ID
Availability Only for dynamic TP class: Normal Addressing.
Description This function returns the CAN-Identifier, of the last transport-frame
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
80 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.2.12 TpRxGetChannelExtID: Get Received Extended CAN-Id TpRxGetChannelExtID Prototype SingleConnectionTp
-
MultipeConnectionTP
vuint32
TpRxGetChannelExtID(vuint8 channel)
Parameter
Channel
-
Return code
Extended CAN-ID
Availability For
- Dynamic TP class Normal Addressing and
- Dispatched Normal Multi TP
Description This function returns the extended CAN-Identifier, of the last transport-frame
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.2.13 TpRxGetCanChannel: Get physical CAN channel TpRxGetCanChannel Prototype SingleConnectionTp
-
MultipeConnectionTP
vuint8
TpRxGetCanChannel(vuint8 channel)
Parameter
Channel
-
2013, Vector Informatik GmbH
Version: 3.14.00
81 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Return code
-
Availability Only multiple CAN-channel systems
Description This function returns the (physical) CAN-channel, through which the last transport-frame has been received.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.2.14 TpRxGetSourceAddress: Get received Source Address TpRxGetSourceAddress Prototype SingleConnectionTp
vuint8
TpRxGetSourceAddress(void)
MultipeConnectionTP
vuint8
TpRxGetSourceAddress(vuint8 channel)
Parameter
Channel
-
Return code
-
Availability Only for dynamic TP classes: Extended- and Normal Fixed Addressing
Description This function returns the destination address, which has been received in the last transport-frame.
Pre-condition(s) The TP is initialized with TpInitPowerOn()
Post-condition(s) -
2013, Vector Informatik GmbH
Version: 3.14.00
82 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Call context -
Please note -
Examples -
4.2.2.15 TpRxGetReceivedTargetAddress: Get received Target Address TpRxGetReceivedTargetAddress Prototype SingleConnectionTp
vuint8
TpRxGetReceivedTargetAddress(void)
MultipeConnectionTP
vuint8
TpRxGetReceivedTargetAddress(vuint8
channel)
Parameter
Channel
Return code
TargetAddress
Availability Only for TP classes: Extended-, Normal Fixed-, and Mixed addressing with the extended gateway API
enabled.
Description This function returns the destination address, which has been received in the last transport-frame. Normally
it is only used for gateway applications.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
83 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.2.16 TpRxGetEcuNumber: Get ECU Number TpRxGetEcuNumber Prototype SingleConnectionTp
vuint8
TpRxGetEcuNumber(void)
MultipeConnectionTP
vuint8
TpRxGetEcuNumber(vuint8 channel)
Parameter
Channel
-
Return code
-
Availability Multiple EcuNumber feature must be activated
Description This function returns the ECU Number, which has been received in the last transport-frame.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.2.17 TpRxGetParameterGroupIdentification: Get Identification of PGN TpRxGetParameterGroupIdentification Prototype SingleConnectionTp
vuint8
TpRxGetParameterGroupIdentification(void)
MultipeConnectionTP
vuint8
TpRxGetParameterGroupIdentification(vuint8
channel)
2013, Vector Informatik GmbH
Version: 3.14.00
84 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
Parameter
Channel
-
Return code
-
Availability Caution
Currently not available.
Only for dynamic TP class: Normal Fixed Addressing with extended API
Description This function returns the Identification of the Parameter Group, which has been received in the last
transport-frame.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.2.18 TpRxSetBufferOverrun: Enable partial acceptance TpRxSetBufferOverrun Prototype SingleConnectionTp
void TP_API_CALL_TYPE
TpRxSetBufferOverrun(void)
MultipeConnectionTP
void TP_API_CALL_TYPE
TpRxSetBufferOverrun(canuint8 tpChannel)
Parameter
Channel
-
Return code
-
Availability Since TPMC version 2.41.00. The buffer overrun feature must be enabled
2013, Vector Informatik GmbH
Version: 3.14.00
85 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Description A reception can be received without copying the received data. This could be useful if the reception buffer is
too small, but the request must be received to reject it by a special response. The data of a Single- or
FirstFrame are copied, but no data are copied for ConsecutiveFrames. Due to this a buffer must be provided
with at least the maximum length of Single- or FirstFrame.
Pre-condition(s) Only useful if a FF has been received
Post-condition(s) -
Call context Within function ApplTpRxGetBuffer()
Please note -
Examples -
4.2.2.19 TpRxSetTransmitID: Set transmission CAN-Id TpRxSetTransmitID Prototype SingleConnectionTp
-
MultipeConnectionTP
void TP_API_CALL_TYPE
TpRxSetTransmitID (canuint8 tpChannel, canuint16 transmitID)
Parameter
tpChannel
-
transmitID
CAN-ID
Return code
-
Availability Only TP-class ‘Dynamic NormalAddressing MultiTP’
Description While receiving a multiple frame request the TP needs the CAN-ID for the transmission of the FlowControl
message. Additionally the Diagnostic/TP will need it to calculate the response transmission
(TpTxSetResponse()), why it is necessary to set it each time ApplTpRxGetBuffer() gets called.
Pre-condition(s) -
Post-condition(s) Response can be calculated automatically by the Function TpTxSetResponse().
2013, Vector Informatik GmbH
Version: 3.14.00
86 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Call context Within function ApplTpRxGetBuffer()
Please note -
Examples -
4.2.2.20 TpRxSetTransmitExtID: Set transmission Extended CAN-Id TpRxSetTransmitExtID Prototype SingleConnectionTp
-
MultipeConnectionTP
void TP_API_CALL_TYPE
TpRxSetTransmitExtID (canuint8 tpChannel, canuint32 transmitID)
Parameter
tpChannel
-
transmitID
Extended CAN-ID (29 bits)
Return code
-
Availability Only TP-class ‘Dynamic NormalAddressing MultiTP’ and
TP-class ‘Dispatched NormalAddressing MultiTP’
Description While receiving a multiple frame request the TP needs the CAN-ID for the transmission of the FlowControl
message. Additionally the Diagnostic/TP will need it to calculate the response transmission
(TpTxSetResponse()), why it is necessary to set it each time ApplTpRxGetBuffer() gets called.
Pre-condition(s) -
Post-condition(s) Response can be calculated automatically by the Function TpTxSetResponse().
Call context Within function ApplTpRxGetBuffer()
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
87 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.2.21 TpRxGetChannelIDType: Get the type of the received CAN-Id TpRxGetChannelIDType Prototype SingleConnectionTp
-
MultipeConnectionTP
canuint8 TP_API_CALL_TYPE
TpRxGetChannelIDType (canuint8 tpChannel)
Parameter
tpChannel
-
Return code
canuint8
Either kTpCanIdTypeStd (11-Bit) or kTpCanIdTypeExt (29-Bit).
Availability Only TP-class ‘Dynamic NormalAddressing MultiTP’.
Description If mixed CAN-IDs, as well 11-Bit identifiers as also 29-Bit identifiers are used during runtime then this API
can be used to get the type of the identifier.
Pre-condition(s) -
Post-condition(s) Response can be calculated automatically by the Function TpTxSetResponse().
Call context Within function ApplTpRxGetBuffer()
Please note -
Examples -
4.2.2.22 TpRxGetAddressExtension: Get address extension information TpRxGetAddressExtension Prototype SingleConnectionTp
canuint8 TP_API_CALL_TYPE
TpRxGetAddressExtension(void)
MultipeConnectionTP
canuint8 TP_API_CALL_TYPE
TpRxGetAddressExtension(canuint8 tpChannel)
2013, Vector Informatik GmbH
Version: 3.14.00
88 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Parameter
tpChannel
-
Return code
canuint8
Availability For mixed 29-bit ID and 11-bit ID addressing
Description This function returns the address extension information from the first byte.
Pre-condition(s) Running reception. Valid after callback function ApplTpRxGetBuffer().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.2.23 TpRxGetCanBuffer: Get CAN buffer pointer TpRxGetCanBuffer Prototype SingleConnectionTp
CanChipDataPtrTP_API_CALL_TYPE
TpRxGetCanBuffer(void);
MultipeConnectionTP
CanChipDataPtr TP_API_CALL_TYPE
TpRxGetCanbuffer(canuint8 tpChannel);
Parameter
tpChannel
-
Return code
-
Availability Since TPMC version 2.41.00
Description Returns a pointer to the first payload byte of the last received CAN frame in the hardware data buffer
2013, Vector Informatik GmbH
Version: 3.14.00
89 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Pre-condition(s) Reception must be in progress
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.2.24 TpRxSetWaitCorrectSN: Force to wait for a correct sequence number TpRxSetWaitCorrectSN Prototype SingleConnectionTp
void TP_API_CALL_TYPE
TpRxSetWaitCorrectSN (tpBool wait);
MultipeConnectionTP
void TP_API_CALL_TYPE
TpRxSetWaitCorrectSN (canuint8 tpChannel, tpBool wait);
Parameter
tpChannel
-
wait
kTpTrue, kTpFalse
Return code
-
Availability Since TPMC version 2.73.00.
Only for Dynamic TP.
The following constant must be defined via a user-config file:
#define TP_ENABLE_DYN_AWAIT_CORRECT_SN
Description The behaviour of the TPMC component in case of a wrong or missing sequence number can be changed:
By default (wait = kTpFalse) the TPMC behaviour is like described in ISO 15765-2.
By setting the ‘wait’ parameter to ‘kTpTrue’ the behaviour can be changed in the way that TPMC does not
re-init the connection, but ignores the current frame and continues waiting for the correct sequence number.
Pre-condition(s) -
Post-condition(s) -
2013, Vector Informatik GmbH
Version: 3.14.00
90 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Call context Within function ApplTpRxGetBuffer().
Please note -
Examples -
4.2.2.25 TpRxSetTimeoutConfirmation: Set CAN confirmation timeout TpRxSetTimeoutConfirmation Prototype SingleConnectionTp
MultipeConnectionTP
void TP_API_CALL_TYPE
TpRxSetTimeoutConfirmation(canuint8 tpChannel,
tTpEngineTimer time);
Parameter
tpChannel
-
time
In timer ticks. The TpTask cycle time is equivalent to one timer tick.
Return code
-
Availability Since TPMC version 2.73.00.
Only for Dynamic Multi TP.
The following constant must be defined via a user-config file:
#define TP_ENABLE_DYN_CHANNEL_TIMING.
Description The CAN message confirmation timeout value (N_Ar) can be changed dynamical.
Pre-condition(s) A tpChannel is successful allocated.
Post-condition(s) -
Call context Within function ApplTpRxGetBuffer().
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
91 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.2.26 TpRxSetTimeoutCF: Set Consecutive Frame confirmation timeout TpRxSetTimeoutCF Prototype SingleConnectionTp
MultipeConnectionTP
void TP_API_CALL_TYPE
TpRxSetTimeoutCF(canuint8
tpChannel, tTpEngineTimer time);
Parameter
tpChannel
-
time
In timer ticks. The TpTask cycle time is equivalent to one timer tick.
Return code
-
Availability Since TPMC version 2.73.00.
Only for Dynamic Multi TP.
The following constant must be defined via a user-config file:
#define TP_ENABLE_DYN_CHANNEL_TIMING.
Description The CF timeout value (N_Cr) can be changed dynamical.
Pre-condition(s) A tpChannel is successful allocated.
Post-condition(s) -
Call context Within function ApplTpRxGetBuffer().
Please note -
Examples -
4.2.2.27 TpRxSetFCStatus: set up Flow Control on reception side TpRxSetFCStatus Prototype SingleConnectionTp
void TpRxSetFCStatus(canuint8 FCStatus)
MultipeConnectionTP
2013, Vector Informatik GmbH
Version: 3.14.00
92 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
void TpRxSetFCStatus(canuint8 tpChannel,
canuint8 FCStatus)
Parameter
FCStatus
KTpFCClearToSend
kTpFCStatusWait
kTpFCSupressFrame
kTpFCStatusOverflow
tpChannel
Return code
None
Availability Only available with at least one of the following switches defined:
#define TP_ENABLE_FC_WAIT
#define TP_ENABLE_FC_SUPRESS
#define TP_ENABLE_FC_OVERFLOW
Each of these defines corresponds to the belonging status.
Description The Flow Control content and also the further behaviour can be adjusted by this function.
By default the FC status is set to ‘kTpFCClearToSend’.
In case of ‘kTpFCStatusWait’ WaitFrames are sent until an explicit clear to send is initiated with the
corresponding API function ‘TpRxSetClearToSend()’.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May only be used within the application callback ‘ApplTpRxGetBuffer()’.
Please note -
4.2.2.28 TpRxGetFCStatus: get the Flow Control setup on reception side TpRxGetFCStatus Prototype SingleConnectionTp
canuint8 TpRxGetFCStatus(void)
MultipeConnectionTP
canuint8 TpRxGetFCStatus(canuint8 tpChannel)
Parameter
tpChannel
2013, Vector Informatik GmbH
Version: 3.14.00
93 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Return code
canuint8
One of the possible status constants:
o kTpFCClearToSend,
o kTpFCStatusWait,
o kTpFCSupressFrame,
o kTpFCStatusOverflow
Availability Only available with at least one of the following switches defined:
#define TP_ENABLE_FC_WAIT
#define TP_ENABLE_FC_SUPRESS
#define TP_ENABLE_FC_OVERFLOW
Each of these defines corresponds to the belonging status.
Description The Flow Control content and also the further behaviour of the TP component depends on the FC status.
With this function the effective FC status can be questioned.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Please note -
Examples -
4.2.2.29 TpRxSetClearToSend: proceed with the transmission after FC wait frames TpRxSetClearToSend Prototype SingleConnectionTp
void TpRxSetClearToSend(canuint8 *pBuffer)
MultipeConnectionTP
void TpRxSetClearToSend(canuint8 tpChannel,
canuint8 *pBuffer)
Parameter
tpChannel
Return code
None
2013, Vector Informatik GmbH
Version: 3.14.00
94 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Availability Only available with the following switch defined:
#define TP_ENABLE_FC_WAIT
Description When a request that was delayed previously by sending WaitFrames is now ready for reception, then the
reception can be started with this function.
The already received data is handed to the application buffer passed as parameter and the transmission of
a FC(CTS) is initiated.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
An activation of the WaitFames with a previous call of ‘TpRxSetFCStatus(kTpFCStatusWait)’ must have be
done and must still be active (the effective FC status delivered by TpRxGetFCStatus() is
‘kTpFCStatusWait’.), otherwise this function has no effect.
Post-condition(s) -
Call context May be used in application context.
Please note -
Examples -
4.2.2.30 TpRxWithoutFC: suppress FC frame usage at the Rx side TpRxWithoutFC Prototype SingleConnectionTp
MultipeConnectionTP
void TP_API_CALL_TYPE TpRxWithoutFC(canuint8 tpChannel)
Parameter
tpChannel
Return code
None
Availability Only available for dynamic Tp classes and with the following switch set to kTpOn:
#define TP_USE_RX_CHANNEL_WITHOUT_FC kTpOn
2013, Vector Informatik GmbH
Version: 3.14.00
95 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Description If the usage of Flow Control frames on the Rx side shall be avoided then the enabling of this feature can be
used to suppress all further FC frames within a distinct reception.
In this case the suppression of FC frames must be disabled for each new reception by calling this API
function for the belonging tpChannel within the ApplTpRxGetBuffer() callback function.
For the reception of Single Frames this aspect is irrelevant.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context Use this function only inside the callback function
ApplTpRxGetBuffer() !
Please note -
Examples -
4.2.2.31 TpRxSetPGN: Set Parameter Group Number TpRxSetPGN Prototype SingleConnectionTp
void
TpRxSetPGN(vuint8 pgn)
MultipeConnectionTP
void
TpRxSetPGN(vuint8 tpChannel, vuint8 pgn)
Parameter
tpChannel
-
pgn
Parameter Group Number to be used
Return code
-
Availability Only for dynamic TP class Normal Fixed or Mixed-29 addressing.
Description This function sets the Parameter Group Number (bit no. 16 - 23) within an extended 29 bit CAN-Identifer to
be used for the re-transmission of Flow Control frames for the current reception channel in case of a multi
frame reception.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
2013, Vector Informatik GmbH
Version: 3.14.00
96 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Call context -
Please note -
Examples -
4.2.2.32 TpRxSetPriorityBits: Set Priority, Data Page and Reserved bits TpRxSetPriorityBits Prototype SingleConnectionTp
void
TpRxSetPriorityBits(vuint8 prio,
vuint8 res,
vuint8 dataPage)
MultipeConnectionTP
void
TpRxSetPriorityBits(vuint8 tpChannel,
vuint8 prio,
vuint8 res,
vuint8 dataPage)
Parameter tpChannel
-
prio
Priority bits to be used (3 bits from bit position 26-28)
res
Reserved bit to be used (1 bit on bit position 25)
dataPage
Data Page bit to be used (1 bit on bit position 24)
Return code
-
Availability Only for dynamic TP class Normal Fixed or Mixed-29 addressing.
Description This function sets beside the Priority Bits (bit no. 26,27,28) also the bits for the ‘Reserved’ bit position (no.
25) and the ‘Data Page’ bit position (no. 24) within an extended 29 bit CAN-Identifer to be used for the
retransmission of Flow Control frames for the current reception channel in case of a multi frame reception.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
2013, Vector Informatik GmbH
Version: 3.14.00
97 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Please note -
Examples -
4.2.3 Transmit Functions 4.2.3.1 TpTxGetFreeChannel: Assign Channel to Connection TpTxGetFreeChannel Prototype SingleConnectionTp
-
MultipeConnectionTP
vuint8
TpTxGetFreeChannel(vuint8 connection)
Parameter
connection
-
Return code
vuint8
Availability Only for dynamic TP classes.
Description This function returns a free channel handle, if possible. If no channel was free the return value will be
kTpNoChannel. The Transport Layer assigns the connection-number to the channel.
The application has got the possibility to get the connection-number by using the function
TpTxGetConnectionNumber(channel)
. Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context Within function ApplTpRxGetBuffer().
Please note The connection-numbers starting at
0xf0 are reserved for internal usage.
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
98 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.3.2 TpTxGetConnectionNumber: Get the assigned Connection-Number TpTxGetConnectionNumber Prototype SingleConnectionTp
-
MultipeConnectionTP
vuint8
TpTxGetConnectionNumber(vuint8 channel)
Parameter
channel
-
Return code
vuint8
Availability Only for dynamic TP classes.
Description This function returns the connection-number which is assigned to this channel.
The application has got the possibility to assign the connection-number by using the function
TpTxGetFreeChannel(connectionNumber)
. Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.3.3 TpTxGetConnectionStatus: Get the Connection Status TpTxGetConnectionStatus Prototype SingleConnectionTp
-
MultipeConnectionTP
vuint8
TpTxGetConnectionStatus(vuint8
connection)
2013, Vector Informatik GmbH
Version: 3.14.00
99 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Parameter
connection
-
Return code
vuint8
Availability Only for dynamic TP classes.
Description This function returns the corresponding channel-number if it exits. If no channel is assigned to this
connection the return value is kTpNoChannel.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.3.4 TpTxGetTargetAddress: Get the target address used for transmission TpTxGetTargetAddress Prototype TpTxGetTargetAddress(canuint8 tpChannel)
Parameter
tpChannel
Return code
canuint8
Target address.
Availability Only available for “Dispatched Multi TP” classes and NormalFixed-, Extended- or Mixed- Addressing type.
One of the following switches must be defined:
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_FIXED_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_EXTENDED_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_MIXED_29_ADDRESSING
Description This API function enables the application to appoint confirmations to previously issued transmissions.
Without this API the appointment of confirmations with parallel transmissions and Normal Fixed, Mixed or
Extended addressing is not possible with “Dispatched Multi TP”.
2013, Vector Informatik GmbH
Version: 3.14.00
100 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Typically used in the application callback functions.
Please note -
Examples -
4.2.3.5 TpTxGetDataBuffer: Get the assigned Data Buffer TpTxGetDataBuffer Prototype SingleConnectionTp
vuint8
TpTxGetDataBuffer (void)
MultipeConnectionTP
vuint8
TpTxGetDataBuffer (vuint8 channel)
Parameter
channel
-
Return code
vuint8
Availability Only for dynamic TP classes.
Description This function returns the pointer to the buffer which is assigned to this channel.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
101 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.3.6 TpTxGetDataIndex: Get the assigned Data Index TpTxGetDataIndex Prototype SingleConnectionTp
vuint8
TpTxGetDataIndex (void)
MultipeConnectionTP
vuint8
TpTxGetDataIndex (vuint8 channel)
Parameter
channel
-
Return code
vuint8
Availability No restrictions
Description This function returns the current offset into the buffer which is assigned to this channel.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.3.7 TpTxSetChannelID: Set the CAN Transmit Id TpTxSetChannelID Prototype SingleConnectionTp
-
MultipeConnectionTP
void
TpTxSetChannelID(vuint8 channel,
vuint16 transmitID,
vuint16 receiveID)
2013, Vector Informatik GmbH
Version: 3.14.00
102 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Parameter
Channel
-
transmitID
receivedID
Return code
-
Availability Only for dynamic TP class: Normal Addressing
Description This function sets the transmit CAN-Identifier for the next call of TpTransmit(). Also the receive CAN-
Identifier (must be unique) to the corresponding FlowControl is set.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.3.8 TpTxSetChannelExtID: Set the CAN Transmit Extended Id TpTxSetChannelExtID Prototype SingleConnectionTp
-
MultipeConnectionTP
void
TpTxSetChannelExtID(vuint8 channel,
vuint32 transmitID,
vuint32 receiveID)
Parameter
Channel
-
transmitID
receivedID
Return code
-
2013, Vector Informatik GmbH
Version: 3.14.00
103 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Availability For
- Dynamic TP class Normal Addressing and
- Dispatched Normal Multi TP
Description This function sets the transmit extended CAN-Identifier (29 bits) for the next call of TpTransmit(). Also
the receive extended CAN-Identifier (must be unique) to the corresponding FlowControl is set.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.3.9 TpTxSetCanChannel: Set physical CAN Channel TpTxSetCanChannel Prototype SingleConnectionTp
void
TpTxSetCanChannel( vuint8 canChannel)
MultipeConnectionTP
void
TpTxSetCanChannel(vuint8 channel,
vuint8 canChannel)
Parameter
Channel
-
canChannel
Return code
-
Availability Only for multiple CAN-channel systems and dynamic TP class.
Description This function sets the (physical) CAN-channel for the next call of TpTransmit().
Pre-condition(s) The TP is initialized with TpInitPowerOn().
2013, Vector Informatik GmbH
Version: 3.14.00
104 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.3.10 TpTxSetTargetAddress: Set Target Address TpTxSetTargetAddress Prototype SingleConnectionTp
void
TpTxSetTargetAddress(vuint8 targetaddress)
MultipeConnectionTP
void
TpTxSetTargetAddress(vuint8 channel,
vuint8 targetaddress)
Parameter
Channel
-
targetaddress
Return code
-
Availability Only for dynamic TP classes: Extended- and Normal Fixed Addressing
Description This function sets the destination address for the next call of TpTransmit().
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
105 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.3.11 TpTxSetEcuNumber: Set ECU Number TpTxSetEcuNumber Prototype SingleConnectionTp
void
TpTxSetEcuNumber(vuint8 ecuNr)
MultipeConnectionTP
void
TpTxSetEcuNumber(vuint8 channel,
vuint8 ecuNr)
Parameter
Channel
-
ecuNr
Return code
-
Availability Only for dynamic TP classes: Extended- and Normal Fixed Addressing
‘Multiple EcuNumber’ feature must be activated
Description This function sets the ECU Number for the next call of TpTransmit().
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.3.12 TpTxSetBaseAddress: Set Base Address TpTxSetEcuNumber Prototype SingleConnectionTp
MultipeConnectionTP
void
TpTxSetBaseAddress(vuint8 channel,
vuint8 baseAddress)
2013, Vector Informatik GmbH
Version: 3.14.00
106 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Parameter
Channel
-
baseAddress
Return code
-
Availability Only for dynamic TP classes: Extended Addressing
‘Multiple EcuNumber’ feature must be activated.
Description This function sets the base address for the next call of TpTransmit().
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.3.13 TpTxSetParameterGroupIdentification: Set Identification of PGN TpTxSetParameterGroupIdentification Prototype SingleConnectionTp
-
MultipeConnectionTP
void
TpTxSetParameterGroupIdentification(vuint8
channel,
vuint8
identification)
Parameter
Channel
-
identification
Return code
-
2013, Vector Informatik GmbH
Version: 3.14.00
107 / 177
based on template version 5.1.0



Technical Reference Transport Protocol ISO15765-2
Availability Caution
Currently not available.
Only for dynamic TP class: Normal Fixed Addressing with extended API
Description This function sets the Identification of the ParameterGroup for the next call of
TpTransmit(). Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.3.14 TpTxSetPriority: Set Priority of the CAN-Frame TpTxSetPriority Prototype SingleConnectionTp
-
MultipeConnectionTP
void
TpTxSetPriority(vuint8 channel,
vuint8 priority)
Parameter
Channel
-
priority
Return code
-
Availability Caution
Currently not available.
Only for dynamic TP class: Normal Fixed Addressing with extended API
Description This function sets the Priority of the CAN-Frame for the next call of TpTransmit().
Pre-condition(s) The TP is initialized with TpInitPowerOn().
2013, Vector Informatik GmbH
Version: 3.14.00
108 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Post-condition(s) -
Call context -
Please note -
Examples -
4.2.3.15 TpTxSetResponse: Assemble a Response TpTxSetResponse Prototype SingleConnectionTp
-
MultipeConnectionTP
void
TpTxSetResponse(vuint8 rxChannel,
vuint8 txChannel)
Parameter
rxChannel
-
txChanel
Return code
-
Availability Only for dynamic TP classes.
Description This function assembles a Response based on a received transport-frame for the next call of
TpTransmit().
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
109 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.3.16 TpTransmit: Send a Message TpTransmit Prototype SingleConnectionTp
vuint8
TpTransmit(vuint8* data,
vuint16 count)
MultipeConnectionTP
vuint8
TpTransmit (vuint8 tpChannel,
vuint8* data,
vuint16 count)
Parameter
tpChannel
Data
Pointer to the data buffer that shall be transmitted.
count
Number of bytes to be transmitted.
Return code
vuint8
kTpSuccess: No transmission in progress (ready to send)
kTpBusy: Transmission in progress
kTpFailed: If the data length is zero or the tpChannel is not allocated.
Availability No restrictions
Description Send a message.
The Transport Layer decides which transmission protocol (SingleFrame with up to 6/7 data bytes depending
on the addressing type) is used by checking the given count.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note After a transmission the channel is released, except the channel is explicitly locked.
Since version 2.35 the transmission request will be only queued within the context of TpTransmit. The
transmission to the bus starts within the TpTxStateTask (TpTxTask) calls.
kTpFailed: In previous versions (2.34.xx and earlier) it is possible that TpTransmit returns ‘kTpFailed’,
because the CANdriver (CanTransmit returns failed) is busy. Starting with version 2.35.00 only dynamic TP-
classes return this value in case of wrong attributes/parameters.
kTpBusy: A transmission is already running or GenMsgDelayTime is not kept.
kTpSuccess: Successful queued message that will be transmitted with the next task cycle.
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
110 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.3.17 TpTxLockChannel: Lock Channel TpTxLockChannel Prototype SingleConnectionTp
-
MultipeConnectionTP
void
TpTxLockChannel(vuint8 channel)
Parameter
channel
-
Return code
-
Availability Only for dynamic TP classes.
Description If a channel is locked, it will not be released after a transmission.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note - Examples -
4.2.3.18 TpTxUnlockChannel: Unlock TX Channel TpTxUnlockChannel Prototype SingleConnectionTp
-
MultipeConnectionTP
void
TpTxUnlockChannel(vuint8 channel)
Parameter
channel
-
2013, Vector Informatik GmbH
Version: 3.14.00
111 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Return code
-
Availability Only for dynamic TP classes.
Description Unlock the lock of the channel. The channel will be released with the next call of TpTxResetChannel() or
TpTransmit().
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note - Examples -
4.2.3.19 TpTxResetChannel: Free TX-Channel TpTxResetChannel Prototype SingleConnectionTp
void TP_API_CALL_TYPE
TpTxResetChannel(void)
MultipeConnectionTP
void TP_API_CALL_TYPE
TpTxResetChannel(canuint8
tpChannel)
Parameter
tpChannel
-
Return code
-
Availability No rectrictions
Description The channel will be released by the Transport Layer. At the next call of TpTxGetFreeChannel() it can be
assigned to another connection.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
2013, Vector Informatik GmbH
Version: 3.14.00
112 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Post-condition(s) -
Call context Background-loop level or OSEK-OSTask with lower priority as TpTasks.
Please note The tpChannel will be released in any case and immediately.
If a transmission is in progress the application will be informed by calling the function
ApplTpTxErrorIndication().
Examples -
4.2.3.20 TpTxSetAddressExtension: Set Address Extension information TpTxSetAddressExtension Prototype SingleConnectionTp
void TP_API_CALL_TYPE
TpTxSetAddressExtension(canuint8
addressExtension);
MultipeConnectionTP
void TP_API_CALL_TYPE
TpTxSetAddressExtension(canuint8 tpChannel,
canuint8 addressExtension);
Parameter
adressExtension
-
tpChannel
Return code
-
Availability For mixed 29-bit ID and mixed 11-bit ID addressing
Description This function is used to set the address extension information.
Pre-condition(s) This function must be called in advance of calling TpTransmit().
Post-condition(s) -
Call context -
2013, Vector Informatik GmbH
Version: 3.14.00
113 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Please note - Examples -
4.2.3.21 TpTxGetSTminInFrame: Get STmin from FC frame TpTxGetSTminInFrame Prototype SingleConnectionTp
canuint8 TP_API_CALL_TYPE
TpTxGetSTminInFrame(void)
MultipeConnectionTP
canuint8 TP_API_CALL_TYPE
TpTxGetSTminInFrame(canuint8 tpChannel)
Parameter
tpChannel
-
Return code
canuint8
STmin value
Availability The STmin value must be taken out of the received FC frames (TP_USE_STMIN_OF_FC == kTpOn) and
the fast transmission feature (TP_USE_FAST_TX_TRANSMISSION == kTpOn) must be activated.
Description Function is returning the STmin value of the last FC frame.
Pre-condition(s) This function must be called in advance of calling TpTransmit().
Post-condition(s) -
Call context -
Please note - Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
114 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.3.22 TpTxPrepareSendImmediate: Prepare CF transmission by application TpTxPrepareSendImmediate Prototype SingleConnectionTp
TP_EXTERNAL_INLINE canuint8 TP_API_CALL_TYPE
TpTxPrepareSendImmediate(void)
MultipeConnectionTP
TP_EXTERNAL_INLINE canuint8 TP_API_CALL_TYPE
TpTxPrepareSendImmediate(canuint8 tpChannel)
Parameter
tpChannel
-
Return code
canuint8
kTpSuccess, kTpFailed
Availability The fast transmission feature (TP_USE_FAST_TX_TRANSMISSION) must be set to kTpOn.
Description If the TP is not in the state for preparing a new CF-Frame (i.e. it is waiting for a FC) the function will return a
‘kTpFailed’. Otherwise if the preparation is successful it will return a ‘kTpSuccess’.
Note: In the case of ‘kTpSuccess’ the application is responsible for the transmission of the next
ConsecutiveFrame. If the application does not call TpTxSendImmediate() the TP stays blocked.
Pre-condition(s) -
Post-condition(s) -
Call context The call of this function is only allowed in the context of the TpTxCanMessageTransmitted() / ApplTpTxFC()
Hook-function.
Please note - Examples -
4.2.3.23 TpTxSendImmediate: Start CF transmission by application TpTxSendImmediate Prototype SingleConnectionTp
TP_EXTERNAL_INLINE void TP_API_CALL_TYPE
TpTxSendImmediate(void)
MultipeConnectionTP
2013, Vector Informatik GmbH
Version: 3.14.00
115 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
TP_EXTERNAL_INLINE void TP_API_CALL_TYPE
TpTxSendImmediate(canuint8 tpChannel)
Parameter
-
Return code
Availability The fast transmission feature (TP_USE_FAST_TX_TRANSMISSION) must be set to kTpOn.
Description Prepares the ConsecutiveFrame and calls the TpTxStateTask() to transmit the frame.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note - Examples -
4.2.3.24 TpTxSetAddressingFormat: Store the current addressing type TpTxSetAddressingFormat Prototype MultipeConnectionTP
void TP_API_CALL_TYPE
TpTxSetAddressingFormat(canuint8 tpChannel,
SupportInfoStruct supportInfo)
Parameter
tpChannel
-
supportInfo
Return code
-
Availability Multiple Addressing TP
2013, Vector Informatik GmbH
Version: 3.14.00
116 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Description This function is used to prepare the required addressing information in a multiple addressing environment
and internally to assign a given connection to the right component.
#define kTpNormalAddressing
#define kTpExtendedAddressing
#define kTpNormalFixedAddressing
#define kTpMixed29Addressing
#define kTpMixed11Addressing
#define kTpRequestAppl // Application connection
#define kTpRequestDiagFunctional // Functional Diag connect.
#define kTpRequestDiagPhysical // Physical Diag connection
SupportInfoStruct supportInfo;
supportInfo.addressingFormat = kTpNormalAddressing;
supportInfo.assignedDestination = kTpRequestDiagPhysical;
TpTxSetAddressingFormat(DiagPhysChannel, supportInfo);
Pre-condition(s) A tpChannel is successful allocated.
Post-condition(s) -
Call context -
Please note - Examples -
4.2.3.25 TpTxSetStrictFlowControl: Enable/Disable ISO conformant FC handling TpTxSetStrictFlowControl Prototype SingleConnectionTp
void TP_API_CALL_TYPE
TpTxSetStrictFlowControl (tpBool strict)
MultipeConnectionTP
void TP_API_CALL_TYPE
TpRxSetStrictFlowControl (canuint8 tpChannel, tpBool strict)
Parameter
tpChannel
-
strict
kTpTrue, kTpFalse
Return code
-
2013, Vector Informatik GmbH
Version: 3.14.00
117 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Availability Since TPMC version 2.73.00.
Only for Dynamic TP.
The following constant must be defined via a user-config file:
#define TP_ENABLE_FC_MSG_FLOW_DYN_CHECK.
Description The behaviour of the TPMC component in case of a missing FC frame can be changed:
By default (strict = kTpTrue) the TPMC behaviour is like described in ISO 15765-2.
By setting the ‘strict’ parameter to ‘kTpFalse’ the behaviour can be changed in the way that TPMC does
not re-init the connection, but ignores the current frame in case of a missing FC.
Pre-condition(s) A tpChannel is successful allocated.
Post-condition(s) -
Call context Call before TpTransmit()
Please note - Examples -
4.2.3.26 TpTxSetTimeoutConfirmation: Set the CAN confirmation timeout TpTxSetTimeoutConfirmation Prototype SingleConnectionTp
MultipeConnectionTP
void TP_API_CALL_TYPE
TpTxSetTimeoutConfirmation(canuint8 tpChannel,
tTpEngineTimer time)
Parameter
tpChannel
-
Time
In timer ticks. The TpTask cycle time is equivalent to one timer tick.
Return code
-
2013, Vector Informatik GmbH
Version: 3.14.00
118 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Availability Since TPMC version 2.73.00.
Only for Dynamic Multi TP.
The following constant must be defined via a user-config file:
#define TP_ENABLE_DYN_CHANNEL_TIMING.
Description The CAN message confirmation timeout (N_As) value can be changed dynamical.
Pre-condition(s) A tpChannel is successful allocated.
Post-condition(s) -
Call context Call before TpTransmit().
Please note - Examples -
4.2.3.27 TpTxSetTimeoutFC: Set the FC confirmation timeout TpTxSetTimeoutFC Prototype SingleConnectionTp
MultipeConnectionTP
void TP_API_CALL_TYPE
TpTxSetTimeoutFC(canuint8
tpChannel, tTpEngineTimer time)
Parameter
tpChannel
-
Time
In timer ticks. The TpTask cycle time is equivalent to one timer tick.
Return code
-
Availability Since TPMC version 2.73.00.
Only for Dynamic Multi TP.
The following constant must be defined via a user-config file:
#define TP_ENABLE_DYN_CHANNEL_TIMING.
Description The FC timeout value (N_Bs) can be changed dynamical per channel.
2013, Vector Informatik GmbH
Version: 3.14.00
119 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Pre-condition(s) A tpChannel is successful allocated.
Post-condition(s) -
Call context Call before TpTransmit().
Please note - Examples -
4.2.3.28 TpTxWithoutFC: suppress FC frame usage at the Tx side TpTxWithoutFC Prototype SingleConnectionTp
MultipeConnectionTP
void TP_API_CALL_TYPE TpTxWithoutFC(canuint8 tpChannel)
Parameter
tpChannel
Return code
None
Availability Only available for dynamic Tp classes and with the following switch set to kTpOn:
#define TP_USE_TX_CHANNEL_WITHOUT_FC kTpOn
Description If the usage of Flow Control frames on the Tx side shall be avoided then the enabling of this feature can be
used to suppress all further FC frames within a distinct transmission.
In this case the suppression of FC frames must be disabled for each new transmission by calling this API
function for the belonging tpChannel before calling TpTransmit.
For the transmission of Single Frames this aspect is irrelevant.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context Call from task context before calling TpTransmit.
2013, Vector Informatik GmbH
Version: 3.14.00
120 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Please note -
Examples -
4.2.3.29 TpTxSetPGN: Set Parameter Group Number TpTxSetPGN Prototype SingleConnectionTp
void
TpTxSetPGN(vuint8 pgn)
MultipeConnectionTP
void
TpTxSetPGN(vuint8 tpChannel, vuint8 pgn)
Parameter tpChannel
-
pgn
Parameter Group Number to be used
Return code
-
Availability Only for dynamic TP class Normal Fixed or Mixed-29 addressing.
Description This function sets the parameter group number (bit no. 16 - 23) within an extended 29 bit CAN-Identifer for
the next call of
TpTransmit(). Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
121 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.2.3.30 TpTxSetPriorityBits: Set Priority, Data Page and Reserved bits TpTxSetPriorityBits Prototype SingleConnectionTp
void
TpTxSetPriorityBits(vuint8 prio,
vuint8 res,
vuint8 dataPage)
MultipeConnectionTP
void
TpTxSetPriorityBits(vuint8 tpChannel,
vuint8 prio,
vuint8 res,
vuint8 dataPage)
Parameter tpChannel
-
prio
Priority bits to be used (3 bits from bit position 26-28)
res
Reserved bit to be used (1 bit on bit position 25)
dataPage
Data Page bit to be used (1 bit on bit position 24)
Return code
-
Availability Only for dynamic TP class Normal Fixed or Mixed-29 addressing.
Description This function sets beside the Priority Bits (bit no. 26,27,28) also the bits for the ‘Reserved’ bit position (no.
25) and the ‘Data Page’ bit position (no. 24) within an extended 29 bit CAN-Identifer for the next call of
TpTransmit(). Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context -
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
122 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.3 Dispatched Multi TP class API 4.3.1 TpGetConnectionGroup: Get the connection group identification TpGetConnectionGroup Prototype TpGetConnectionGroup(canuint8 addressInfoHandle)
Parameter
addressInfoHandle
Return code
canuint8
kTpGroup<ConnectionName> constant
Availability Only available for “Dispatched Multi TP” classes.
One of the following switches must be defined:
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_EXTENDED_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_FIXED_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_MIXED_29_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_MULTIPLE_ADDRESSING
Description Deliver the appropriate connection group identification as a constant.
Pre-condition(s) -
Post-condition(s) -
Call context May be used in application context.
Typically used in the application callback functions.
Please note The TP is initialized with TpInitPowerOn().
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
123 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.3.2 TpGetAddressingType: Get the addressing type identification TpGetAddressingType Prototype TpGetAddressingType(canuint8 addressInfoHandle)
Parameter
addressInfoHandle
Return code
canuint8
One of the possible status constants:
kTpNormalAddressing,
kTpExtendedAddressing,
kTpNormalFixedAddressing,
kTpMixed29Addressing
Availability Only available for “Dispatched Multi TP” classes and “Multiple Addressing” type.
The following switch must be defined:
#define TP_TYPE_MULTI_DISPATCHED_MULTIPLE_ADDRESSING
Description Deliver the appropriate addressing type as a constant.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Typically used in the application callback functions.
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
124 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.3.3 TpGetCanChannel: Get the CAN channel TpGetCanChannel Prototype TpGetCanChannel(canuint8 addressInfoHandle)
Parameter
addressInfoHandle
Return code
canuint8
Number of the CAN channel.
Availability Only available for “Dispatched Multi TP” classes and multiple CAN channels configured.
One of the following switches must be defined:
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_EXTENDED_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_FIXED_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_MIXED_29_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_MULTIPLE_ADDRESSING
Description Deliver the appropriate CAN channel.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Typically used in the application callback functions.
Please note -
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
125 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.3.4 TpGetRxId: Get the received CAN-Id TpGetRxId Prototype TpGetRxId(canuint8 addressInfoHandle)
Parameter
addressInfoHandle
Return code
canuint8
CAN identifier.
Availability Only available for “Dispatched Multi TP” classes and “Normal Addressing” type.
The following switches must be defined:
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_ADDRESSING
Description Deliver the appropriate Rx CAN identifier.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Typically used in the application callback functions.
Please note -
Examples -
4.3.5 TpGetTxId: Get the CAN-Id to be used for transmission TpGetTxId Prototype TpGetTxId(canuint8 addressInfoHandle)
Parameter
addressInfoHandle
Return code
canuint8
CAN identifier.
2013, Vector Informatik GmbH
Version: 3.14.00
126 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Availability Only available for “Dispatched Multi TP” classes and “Normal Addressing” type.
The following switches must be defined:
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_ADDRESSING
Description Deliver the appropriate Tx CAN identifier.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Typically used in the application callback functions.
Please note -
Examples -
4.3.6 TpGetBaseAddress: Get the Base Address TpGetBaseAddress Prototype TpGetBaseAddress(canuint8 addressInfoHandle)
Parameter
addressInfoHandle
Return code
canuint8
Base address.
Availability Only available for “Dispatched Multi TP” classes and “Extended Addressing” type.
The following switches must be defined:
#define TP_TYPE_MULTI_DISPATCHED_EXTENDED_ADDRESSING
Description Deliver the appropriate base address.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
2013, Vector Informatik GmbH
Version: 3.14.00
127 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Call context May be used in application context.
Typically used in the application callback functions.
Please note -
Examples -
4.3.7 TpGetAddressOffest: Get the Address Offset TpGetAddressOffset Prototype TpGetAddressOffset(canuint8 addressInfoHandle)
Parameter
addressInfoHandle
Return code
canuint8
Address offset.
Availability Only available for “Dispatched Multi TP” classes and “Extended Addressing” type.
The following switches must be defined:
#define TP_TYPE_MULTI_DISPATCHED_EXTENDED_ADDRESSING
Description Deliver the appropriate address offset.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Typically used in the application callback functions.
Please note -
Examples The address 0x06F0 is separated in 2 parts:
- base address 0x0600 and
- address offset 0x00F0
2013, Vector Informatik GmbH
Version: 3.14.00
128 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.3.8 TpGetPriority: Get the priority info from a 29 bit CAN-Id TpGetPriority Prototype TpGetPriority(canuint8 addressInfoHandle)
Parameter
addressInfoHandle
Return code
canuint8
Priority value (0..7)
Availability Only available for “Dispatched Multi TP” classes and “NormalFixed Addressing” or “Mixed29” addressing
type.
The following switches must be defined:
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_FIXED_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_MIXED_29_ADDRESSING
Description Deliver the appropriate address offset.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Typically used in the application callback functions.
Please note -
Examples -
4.3.9 TpGetPGN: Get the parameter group identification from a 29 bit CAN-Id TpGetPGN Prototype TpGetPGN(canuint8 addressInfoHandle)
Parameter
addressInfoHandle
Return code
canuint8
PGN value.
2013, Vector Informatik GmbH
Version: 3.14.00
129 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Availability Only available for “Dispatched Multi TP” classes and “NormalFixed Addressing” or “Mixed29” addressing
type.
The following switches must be defined:
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_FIXED_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_MIXED_29_ADDRESSING
Description Deliver the appropriate address offset.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Typically used in the application callback functions.
Please note -
Examples -
4.3.10 TpGetEcuNumber: Get the ECU number TpGetEcuNumber Prototype TpGetEcuNumber(canuint8 addressInfoHandle)
Parameter
addressInfoHandle
Return code
canuint8
ECU number.
Availability Only available for “Dispatched Multi TP” classes and “NormalFixed Addressing” or “Mixed29” addressing
type.
The following switches must be defined:
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_FIXED_ADDRESSING
#define TP_TYPE_MULTI_DISPATCHED_MIXED_29_ADDRESSING
Description Deliver the appropriate ECU number.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
2013, Vector Informatik GmbH
Version: 3.14.00
130 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Post-condition(s) -
Call context May be used in application context.
Typically used in the application callback functions.
Please note -
Examples -
4.3.11 TpTransmit There are two alternatives available to transmit data. Either you use the generated
connection specific TpTransmit macros or you use the addressing type specific functions
behind the macros.
4.3.11.1 TpTransmit connection specific macros The data pointer (type canuint8) and the data length (type canuint16) are always
necessary. Depending on the addressing type additional information like the Target
Address (TA) for Extended / NormalFixed addressing or the Address Extension (AE) for
Mixed addressing is necessary.
Addressing Macro name Type
Normal
TpTransmit_<ConnectionName>(canuint8 data,
canuint16 len)
Extended
TpTransmit_<ConnectionName>(canuint8 TA,
NormalFixed
canuint8 data,
canuint16 len)
Mixed29
TpTransmit_<ConnectionName>(canuint8 TA,
canuint8 AE,
canuint8 data,
canuint8 len)
4.3.11.2 TpTransmitNormal: transmit function for normal addressing TpTransmitNormal Prototype TpTransmitNormal(canuint8 addressInfoHandle,
canuint8 data,
canuint16 length)
2013, Vector Informatik GmbH
Version: 3.14.00
131 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Parameter
addressInfoHandle
data
Pointer to the transmit data.
length
Length of the transmit data (in bytes).
Return code
canuint8
kTpSuccess: No transmission in progress (ready to send)
kTpBusy: Transmission in progress
kTpFailed: Data length is zero
kTpNoChannel: No TP channel available
Availability Only available for “Dispatched Multi TP” classes.
The following switch must be defined:
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_ADDRESSING
Description Send the data with the given length to the CAN bus.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Please note -
Examples -
4.3.11.3 TpTransmitExtended: transmit function for extended addressing TpTransmitExtended Prototype TpTransmitExtended(canuint8 addressInfoHandle,
canuint8 TA,
canuint8 data,
canuint16 length)
Parameter
addressInfoHandle
TA
Target Address.
data
Pointer to the transmit data.
2013, Vector Informatik GmbH
Version: 3.14.00
132 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
length
Length of the transmit data (in bytes).
Return code
canuint8
kTpSuccess: No transmission in progress (ready to send),
kTpBusy: Transmission in progress,
kTpFailed: Data length is zero,
kTpNoChannel: No TP channel available.
Availability Only available for “Dispatched Multi TP” classes.
The following switch must be defined:
#define TP_TYPE_MULTI_DISPATCHED_EXTENDED_ADDRESSING
Description Send the data with the given length to the CAN bus.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Please note -
Examples -
4.3.11.4 TpTransmitNormalFixed: transmit function for NormalFixed addressing TpTransmitNormalFixed Prototype TpTransmitNormalFixed(canuint8 addressInfoHandle,
canuint8 TA,
canuint8 data,
canuint16 length)
Parameter
addressInfoHandle
TA
Target Address.
data
Pointer to the transmit data.
length
Length of the transmit data (in bytes).
2013, Vector Informatik GmbH
Version: 3.14.00
133 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Return code
canuint8
kTpSuccess: No transmission in progress (ready to send)
kTpBusy: Transmission in progress
kTpFailed: Data length is zero
kTpNoChannel: No tpChannel available
Availability Only available for “Dispatched Multi TP” classes.
The following switch must be defined:
#define TP_TYPE_MULTI_DISPATCHED_NORMAL_FIXED_ADDRESSING
Description Send the data with the given length to the CAN bus.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Please note -
Examples -
4.3.11.5 TpTransmitMixed29: transmit function for Mixed-29 addressing TpTransmitMixed29 Prototype TpTransmitMixed29(canuint8 addressInfoHandle,
canuint8 TA,
canuint8 AE,
canuint8 data,
canuint16 length)
Parameter addressInfoHandle
TA
Target Address.
AE
Address Extension.
data
Pointer to the transmit data.
length
Length of the transmit data (in bytes).
2013, Vector Informatik GmbH
Version: 3.14.00
134 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Return code
canuint8
kTpSuccess: No transmission in progress (ready to send),
kTpBusy: Transmission in progress,
kTpFailed: Data length is zero,
kTpNoChannel: No TP channel available.
Availability Only available for “Dispatched Multi TP” classes.
The following switch must be defined:
#define TP_TYPE_MULTI_DISPATCHED_MIXED_29_ADDRESSING
Description Send the data with the given length to the CAN bus.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Please note -
Examples -
4.3.11.6 TpTransmitMixed29: transmit function for Mixed-29 addressing TpTransmitMixed29 Prototype TpTransmitMixed29(canuint8 addressInfoHandle,
canuint8 TA,
canuint8 AE,
canuint8 data,
canuint16 length)
Parameter
addressInfoHandle
TA
Target Address.
AE
Address Extension.
data
Pointer to the transmit data.
length
Length of the transmit data (in bytes).
2013, Vector Informatik GmbH
Version: 3.14.00
135 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Return code
canuint8
kTpSuccess: No transmission in progress (ready to send),
kTpBusy: Transmission in progress,
kTpFailed: Data length is zero,
kTpNoChannel: No TP channel available.
Availability Only available for “Dispatched Multi TP” classes.
The following switch must be defined:
#define TP_TYPE_MULTI_DISPATCHED_MIXED_29_ADDRESSING
Description Send the data with the given length to the CAN bus.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Please note -
Examples -
4.3.11.7 TpTransmitMixed11: transmit function for Mixed-11 addressing TpTransmitMixed29 Prototype TpTransmitMixed11(canuint8 addressInfoHandle,
canuint8 AE,
canuint8 data,
canuint16 length)
Parameter
addressInfoHandle
AE
Address Extension.
data
Pointer to the transmit data.
length
Length of the transmit data (in bytes).
2013, Vector Informatik GmbH
Version: 3.14.00
136 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Return code
canuint8
kTpSuccess: No transmission in progress (ready to send)
kTpBusy: Transmission in progress
kTpFailed: Data length is zero
kTpNoChannel: No TP channel available
Availability Only available for “Dispatched Multi TP” classes and at least one AI with mixed-11 as addressing type
The following switch must be defined:
#define TP_TYPE_MULTI_DISPATCHED_MULTIPLE_ADDRESSING
Description Send the data with the given length to the CAN bus.
Pre-condition(s) The TP is initialized with TpInitPowerOn().
Post-condition(s) -
Call context May be used in application context.
Please note -
Examples -
4.4 Application callback functions In the Generation Tool the user can define which callback functions he would like to use
from the Transport Protocol. The names can be adjusted by the user. E.g. the prefix
User can be used instead of
Appl. These functions will only be provided, if they were configured
in the Generation Tool what can be done by entering a function name.
4.4.1 Reception side 4.4.1.1 ApplTpPrecopyCheck: Reception of TP-Frame ApplTpPrecopyCheck Prototype Single Channel
Single Receive Channel
canuint8
ApplTpPrecopyCheck ( CanRxInfoStructPtr rxStruct )
Single Receive Buffer
canuint8
ApplTpPrecopyCheck ( CanReceiveHandle rxObject )
Multiple Receive Buffer
canuint8
ApplTpPrecopyCheck ( CanChipDataPtr rxRegPtr )
Multi Channel
Indexed (MRC)
canuint8
ApplTpPrecopyCheck ( CanRxInfoStructPtr rxStruct
)
2013, Vector Informatik GmbH
Version: 3.14.00
137 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Code replicated (SRB)
canuint8
ApplTpPrecopyCheck ( CanReceiveHandle rxObject )
Code replicated (MRB)
canuint8
ApplTpPrecopyCheck ( CanChipDataPtr rxRegPtr )
Parameter
rxObject
Handle of received object
rxRegPtr
Pointer to the received data in the CAN Controller receive register
rxStruct
Pointer to the receive structure
Return code
kCanCopyData
Received data will be copied using the CAN Driver 's internal copy mechanism
kCanNoCopyData
CAN Driver doesn’t copy data and doesn’t perform indication
Availability since versions: TPMC: 2.35.00 | CANgen: 3.88.02 | DBKOMgen: 2.37.01
Description Special functions for the application, which is immediately called after the reception of a TP-CAN-message.
If e.g. several CAN-Ids are defined in an ECU for the TP (gateway or multiple ECU) it has to be decided,
before the TP is able to make use of the CAN-message, whether the current CAN-message should be
processed or not depending on the CAN-ID. This user- check function can be used for it, which is called by
the TP on each data reception.
If this function returns „1“, the CAN-message is processed by the TP.
If this function returns „0“, the CAN- message is dismissed by the TP and the process is finished.
The name of this callback-function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note - Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
138 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.4.1.2 ApplTpCheckTA: Check if Target Address is valid (version <= 2.72.00) ApplTpCheckTA Prototype SingleConnectionTp
vuint8
ApplTpCheckTA (vuint8 tpCurrentTargetAddress)
MultipeConnectionTP
vuint8
ApplTpCheckTA (vuint8 tpCurrentTargetAddress)
SingleConnectionTp GATEWAY API
vuint8
ApplTpCheckTA (vuint8 tpCurrentTargetAddress,
CanRxInfoStructPtr infoStruct)
MultipeConnectionTP GATEWAY API
vuint8
ApplTpCheckTA (vuint8 tpCurrentTargetAddress,
CanRxInfoStructPtr infoStruct)
Parameter
tpCurrentTargetAddress -
infoStruct
Return code
vuint8
-
Availability Only for TP versions less than or equal to 2.72.00. See also chapter
4.4.1.3 for the changed API description
available since version 2.73.00.
Only for dynamic TP classes: Extended- and Normal Fixed Addressing
Description This function will be called for every reception of a TP-CAN-message. Within this function the application has
to decide, if the TargetAddress in the received CAN-frame is valid. If the TargetAddress is not valid and
should not be received the return value must be ‘kTpNoChannel’. If it should be received the TargetAddress
should be returned. See also chapt
er 7.4.1 Virtual ECU’s / ‘Multiple EcuNumber’ feature. The name of this callback-function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note Until versions: TPMC: 2.35.00 | CANgen: 3.88.02 | DBKOMgen: 2.37.01the function name was called
ApplTpPrecopy()
Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
139 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.4.1.3 ApplTpCheckTA: Check if Target Address is valid (since version 2.73.00) ApplTpCheckTA Prototype SingleConnectionTp
t_ta_type
ApplTpCheckTA (vuint8 tpCurrentTargetAddress)
MultipeConnectionTP
t_ta_type
ApplTpCheckTA (vuint8 tpCurrentTargetAddress)
SingleConnectionTp GATEWAY API
t_ta_type
ApplTpCheckTA (vuint8 tpCurrentTargetAddress,
CanRxInfoStructPtr infoStruct)
MultipeConnectionTP GATEWAY API
t_ta_type
ApplTpCheckTA (vuint8 tpCurrentTargetAddress,
CanRxInfoStructPtr infoStruct)
Parameter
tpCurrentTargetAddress -
infoStruct
Return code
t_ta_type
typedef enum
{
kTpNone = 0,
kTpPhysical = 1,
kTpFunctional = 2
} t_ta_type;
Availability Only for TP versions greater than or equal to 2.73.00. See also the former API description in chapter
4.4.1.2 Only for dynamic TP classes: Extended- and Normal Fixed Addressing
Description This function will be called for every reception of a TP-CAN-message. Within this function the application has
to decide, if the TargetAddress in the received CAN-frame is valid and if it is a physical or functional identifer..
If the TargetAddress is not valid and should not be received the return value must be ‘kTpNone’.
If the TargetAddress is identified as a physical identifier then ‘kTpPhysical’ should be returned.
If the TargetAddress is identified as a functional identifier then ‘kTpFunctional’ should be returned.
See also chapt
er 7.4.1 Virtual ECU’s / ‘Multiple EcuNumber’ feature. The name of this callback-function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
2013, Vector Informatik GmbH
Version: 3.14.00
140 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Please note Until versions: TPMC: 2.35.00 | CANgen: 3.88.02 | DBKOMgen: 2.37.01the function name was called
ApplTpPrecopy()
Examples -
4.4.1.4 ApplTpRxSF: Reception of Single Frame ApplTpRxSF Prototype SingleConnectionTp
void
ApplTpRxSF(void)
MultipeConnectionTP
void
ApplTpRxSF(vuint8 channel)
Parameter channel
-
Return code
-
Availability No restriction
Description This function is called after the reception of a single-frame. ApplTpRxGetBuffer() will be called before.
The name of this callback-function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note - Examples -
2013, Vector Informatik GmbH
Version: 3.14.00
141 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.4.1.5 ApplTpRxFF: Reception of First Frame ApplTpRxFF Prototype SingleConnectionTp
void
ApplTpRxFF (void)
MultipeConnectionTP
void
ApplTpRxFF(vuint8 channel)
Parameter channel
-
Return code
-
Availability No restriction
Description This function is called after the reception of a first-frame. ApplTpRxGetBuffer() will be called before.
The name of this callback function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note - Examples -
4.4.1.6 ApplTpRxCF: Reception of Consecutive Frame ApplTpRxCF Prototype SingleConnectionTp
void
ApplTpRxCF(void)
MultipeConnectionTP
void
ApplTpRxCF(vuint8 channel)
Parameter channel
-
2013, Vector Informatik GmbH
Version: 3.14.00
142 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Return code
-
Availability No restriction
Description This function is called after the reception of a consecutive-frame.
The name of this callback function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note - Examples -
4.4.1.7 ApplTpRxCanMessageReceived: Reception of CAN-Frame ApplTpRxCanMessageReceived Prototype SingleConnectionTp
void
ApplTpRxCanMessageReceived(void)
MultipeConnectionTP
void
ApplTpRxCanMessageReceived(vuint8 channel)
Parameter channel
-
Return code
-
Availability until versions: TPMC: 2.35.00 CANgen: 3.88.02 DBKOMgen: 2.37.01
Will be not supported in the future.
Description This function is called after the reception of a CAN-frame and is normally used only in gateways.
The name of this callback function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
2013, Vector Informatik GmbH
Version: 3.14.00
143 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Post-condition(s) -
Call context -
Please note - Examples -
4.4.1.8 ApplTpRxGetBuffer: Assign a buffer to a channel TpTxSetStrictFlowControl Prototype SingleConnectionTp
unsigned char*
ApplTpRxGetBuffer(vuint16 dataLength)
MultipeConnectionTP
unsigned char*
ApplTpRxGetBuffer(vuint8 channel,
vuint16 dataLength)
SingleConnectionTp GATEWAY API
unsigned char*
ApplTpRxGetBuffer(vuint16 dataLength
CanRxInfoStructPtr rxStruct)
MultipeConnectionTP GATEWAY API
unsigned char*
ApplTpRxGetBuffer(vuint8 channel,
vuint16 dataLength
CanRxInfoStructPtr rxStruct)
Parameter
dataLength
-
channel
rxStruct
Return code
usigned char
-
Availability No restriction
Description This function is called after reception of the first data to get a buffer with a minimum length of dataLength
from the application. The application has to return a pointer to this buffer. If the returned pointer is NULL, the
transport-message will not be received anymore.
The name of this callback function can be adjusted as desired in the Generation Tool.
2013, Vector Informatik GmbH
Version: 3.14.00
144 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note -
Examples -
4.4.1.9 ApplTpRxCopyFromCAN: Application Copy Function ApplTpRxCopyFromCAN Prototype SingleConnectionTp
void
ApplTpRxCopyFromCan(vuint8 * source,
vuint16 count)
MultipeConnectionTP
void
ApplTpRxCopyFromCan(vuint8 channel,
vuint8 * source,
vuint16 count)
Parameter Source
-
Count
channel
Return code
-
Availability No restriction
Description The buffer management is done by the application. This function is always called by the Transport Protocol
while receiving a TP-CAN-message.
The argument
source points to the receive buffer of the CAN-controller; the argument
count determines
number of data, which has to be copied by the application function.
The name of this callback-function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
2013, Vector Informatik GmbH
Version: 3.14.00
145 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Call context -
Please note - Examples
void ApplTpRxCopyFromCan(vuint8 channel, vuint8 * source, vuint16 count)
{
(void)memcpy(&(TpRxGetDataBuffer(channel)[TpRxGetDataIndex(channel)]),
source, count);
}
4.4.1.10 ApplTpRxIndication: Reception closed successful ApplTpRxIndication Prototype SingleConnectionTp
void
ApplTpRxIndication(vuint16 dataLength)
MultipeConnectionTP
void
ApplTpRxIndication(vuint8 channel,
vuint16 dataLength)
Parameter dataLength
-
channel
Return code
-
Availability No restriction
Description This function is called after the completely reception of a single frame message or a multiple frame
message. dataLength is the number of received bytes in the reception buffer.
The name of this callback function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note - Examples
-
2013, Vector Informatik GmbH
Version: 3.14.00
146 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.4.1.11 ApplTpRxErrorIndication: Reception closed with error ApplTpRxErrorIndication Prototype SingleConnectionTp
void
ApplTpRxErrorIndication(vuint8 errorCode)
MultipeConnectionTP
void
ApplTpRxErrorIndication(vuint8 channel,
vuint8 errorCode)
Parameter errorCode
> kTpRxErrFF_SfreceivedAgain: While a reception is in progress a
new
> Single- or FirstFrame is received, because the running reception will
be canceled and set up new.
> KTpRxErrWrongSNreceived: A ConsecutiveFrame with a wrong
SequenceNumber is received, because of the current reception will
be canceled.
> KTpRxErrCFTimeout: An awaited ConsecutiveFrame is not
received in the right time and a timeout occurs.
> KTpRxErrConfIntTimeout: The FlowControl could not
transmitted within the necessary time and a (confirmation) timeout
occurs.
channel
Return code
-
Availability No restriction
Description This function will be called if an error occurs on the channel. The channel will be reinitialized afterwards.
The name of this callback function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note - Examples
-
2013, Vector Informatik GmbH
Version: 3.14.00
147 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.4.1.12 ApplTpRxGetTxID: Get CAN Transmit Id ApplTpRxGetTxID Prototype SingleConnectionTp
-
MultipeConnectionTP
vuint16
ApplTpRxGetTxID(vuint16 receiveId)
Parameter receiveId
Return code
-
Availability Only for dynamic TP classes: Normal Addressing
Insert:
#define TP_USE_TX_ID_APPL_CHECK kTpOn
in a user-config file to use this feature.
!!! Attention: Only until TPMC version 2.60.00
Description This function is called after reception of a First-Frame, to get the Transmit-ID for the FlowControl.
The name of this callback function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note - Examples
-
2013, Vector Informatik GmbH
Version: 3.14.00
148 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.4.2 Reception side for functional messages Only available if a functional connection group exists.
4.4.2.1 ApplFuncTpPrecopy: Check if Target Address is valid ApplFuncTpPrecopy Prototype Normal Fixed addressing, Extended addressing:
vuint8
ApplFuncTpPrecopy (vuint8 tpCurrentTargetAddress)
Normal Fixed addressing, Extended addressing with GATEWAY - API:
vuint8
ApplFuncTpPrecopy (vuint8 tpCurrentTargetAddress,
CanRxInfoStructPtr infoStruct)
Mixed addressing:
vuint8
ApplFuncTpPrecopy (vuint8 tpCurrentTargetAddress,
vuint8 tpCurrentAddressExtension)
Mixed addressing with GATEWAY - API:
vuint8
ApplFuncTpPrecopy (vuint8 tpCurrentTargetAddress,
vuint8 tpCurrentAddressExtension,
CanRxInfoStructPtr infoStruct)
Parameter tpCurrentTargetAddress
Contains the N_TA byte of the received message.
tpCurrentAddressExtension
Contains the N_AE byte of the received message.
infoStruct
Pointer to a data structure containing more information concerning the
received message (e.g. Raw Id, DLC).
Return code
vuint8
-
Availability For TP classes: Extended-, Normal Fixed- and Mixed- Addressing.
If a functional connection groups exists and a callback name is configured. The default callback name used
is “TpFuncCheckTA”.
Description This function will be called for every reception of a functional TP-CAN-message. Within this function the
application has to decide, if the TargetAddress / AddressExtension in the received CAN-frame is valid.
If the TargetAddress/AddressExtension is not valid and should not be received the return value must be
‘kTpNoChannel’. If it should be received the TargetAddress should be returned.
If the Multiple EcuNumber feature is used, then the concerning EcuNumber must be returned.
The name of this callback-function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
2013, Vector Informatik GmbH
Version: 3.14.00
149 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Call context -
Please note Examples -
4.4.3 Transmission side 4.4.3.1 ApplTpTxFC: Reception of a Flow Control Frame ApplTpTxFC Prototype SingleConnectionTp
void
ApplTpTxFC(void)
MultipeConnectionTP
void
ApplTpTxFC(vuint8 channel)
Parameter receiveId
Return code
-
Availability since versions: TPMC: 2.35.00 CANgen: 3.88.02 DBKOMgen: 2.37.01
Description This function is called after the reception of a FlowControl-frame.
The name of this callback-function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note - Examples
-
2013, Vector Informatik GmbH
Version: 3.14.00
150 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.4.3.2 ApplTpTxCanMessageTransmitted: CAN-Message transmitted ApplTpTxCanMessageTransmitted Prototype SingleConnectionTp
void
ApplTpTxCanMessageTransmitted(void)
MultipeConnectionTP
void
ApplTpTxCanMessageTransmitted(vuint8 channel)
Parameter channel
Return code
-
Availability No description
Description This function is called each time after a successful transmission of an CAN-message / frame (only for TX
connections - .this will mean for SF; FF; CF and not for FC messages)
The name of this callback function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note - Examples
-
4.4.3.3 ApplTpTxNotification: CAN-Frame transmitted ApplTpTxNotification Prototype SingleConnectionTp
void
ApplTpTxNotification(vuint8 count)
MultipeConnectionTP
void
ApplTpTxNotification(vuint8 channel,
vuint8 count)
Parameter channel
2013, Vector Informatik GmbH
Version: 3.14.00
151 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
count
Return code
-
Availability No restriction
Description This function is called each time after sending Tp-Frames except “Single-Frames” and the “last
Consecutive-Frame”. Count
is the number of transmitted data.
The name of this callback function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note - Examples
-
4.4.3.4 ApplTpTxCopyToCAN: Application Copy Function ( 16BIT Controller) ApplTpTxCopyToCAN Prototype SingleConnectionTp
vuint8
ApplTpTxCopyToCAN(TpCopyToCanInfoStructPtr infoStruct)
MultipeConnectionTP
vuint8
ApplTpTxCopyToCAN(TpCopyToCanInfoStructPtr infoStruct)
Parameter infoStruct
Return code
vuint8
If everything is fine return ‘kTpSucces
’ otherwise
‘kTpFailed’
. Availability No restriction
2013, Vector Informatik GmbH
Version: 3.14.00
152 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Description The buffer management is done by the application. This function is always called by the Transport Protocol
before sending a TP-CAN-message.
The parameter is a pointer to the following structure:
struct tTpCopyToCanInfoStruct_s
{
canuint8 Channel; /* TP Channel*/
canuint8* pDestination; /* Pointer to destination buffer */
canuint8* pSource; /*Pointer to linear source buffer*/
canuint16 Length; /* The maximum length to copy */
};
The name of this callback-function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note Since version 2.35 the TPMC component tries to call ApplTpCopyToCAN() again and again until
kTpSuccess is returned or ‘CAN message confirmation timeout’ occurs.
Examples vuint8 ApplTpCopyToCan(TpCopyToCanInfoStructPtr infoStruct)
{
(void)memcpy( infoStruct->pDestination, infoStruct->pSource,
infoStruct->Length);
return kTpSuccess;
}
4.4.3.5 ApplTpTxCopyToCAN: Application Copy Function (8BIT Controller) ApplTpTxCopyToCAN Prototype SingleConnectionTp
vuint8
ApplTpTxCopyToCAN(vuint8 offset,
vuint8 count)
MultipeConnectionTP
vuint8
ApplTpTxCopyToCAN(vuint8 channel,
vuint8 offset,
vuint8 count)
Parameter Offset
2013, Vector Informatik GmbH
Version: 3.14.00
153 / 177
based on template version 5.1.0




Technical Reference Transport Protocol ISO15765-2
Count
channel
Return code
vuint8
If everything is fine return kTpSuccess
otherwise
kTpFailed
. Availability Caution
Only until TPMC version 2.49.00.
Since TPMC version 2.50.00 the API described i
n 4.4.3.4 “ApplTpTxCopyToCAN: Application Copy
Function ( 16BIT Controller)” is used instead.
Description The buffer management is done by the application. This function is always called by the Transport Protocol
before sending a TP-CAN-message.
The argument offset determines the offset into the sending buffer of CAN Driver (Offset=0..7); the
argument “count” determines number of data, which has to be copied by the application function.
The name of this callback function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note Since version 2.35 the TPMC component tries to call ApplTpCopyToCAN() again and again until
kTpSuccess is returned or ‘CAN message confirmation timeout’ occurs.
TpTxData(channel)
can be used to access the transmit buffer of the CAN-driver.
Caution
Do not access the transmit buffer of the CAN-driver elsewhere
Examples
vuint8 ApplTpCopyToCan(vuint8 channel,
vuint8 offset,
vuint8 length)
{
(void)memcpy( &TpTxData(channel)[ offset ],
&TpTxGetDataBuffer(channel)[TpTxGetDataIndex(channel)],
length);
return kTpSuccess;
}
2013, Vector Informatik GmbH
Version: 3.14.00
154 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.4.3.6 ApplTpTxConfirmation: Transmission closed successful ApplTpTxConfirmation Prototype SingleConnectionTp
void
ApplTpTxConfirmation(vuint8 state)
MultipeConnectionTP
void
ApplTpTxConfirmation(vuint8 channel,
vuint8 state)
Parameter State
cannel
Return code
-
Availability No description
Description This function is called after a single- or a multiple-frame message is transmitted completely.
The state condition is given as a parameter and can be analyzed by the application. Please note that this
is intended for further usage, currently the delivered state is always kTpSuccess.
The name of this callback-function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note Currently the ‘state’ parameter is not used. So the default of this parameter is ‘kTpSuccess’.
Examples vuint8 ApplTpCopyToCan(TpCopyToCanInfoStructPtr infoStruct)
{
(void)memcpy( infoStruct->pDestination, infoStruct->pSource,
infoStruct->Length);
return kTpSuccess;
}
2013, Vector Informatik GmbH
Version: 3.14.00
155 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
4.4.3.7 ApplTpTxErrorIndication: Transmission closed with error ApplTpTxErrorIndication Prototype SingleConnectionTp
vuint8
ApplTpTxErrorIndication(vuint8 errorCode)
MultipeConnectionTP
vuint8
ApplTpTxErrorIndication(vuint8 channel,
vuint8 errorCode)
Parameter errorCode
> kTpTxErrFCTimeout: An awaited FlowControl timed out
> kTpTxErrConfIntTimeout: A TP-CAN-massage could not transmitted
within the necessary time and a (confirmation) timeout occurs.
> kTpTxErrFCWrongFlowStatus: An invalid FlowControl-frame is
received. Only with activated strict message flow
checking (TP_USE_STRICT_MSG_FLOW_CHECKING must be set
to kTpOn in a user-config file to activate this feature).
> kTpTxErrWFTmaxOverrun: WFTmax wait frames are received now
(only for MCAN, if TP_ENABLE_MCAN is defined)
> kTpTxErrFCOverrun: the receiver reported an Overrun, channel is
terminated
Old error codes Old error codes since TPMC version 2.35
> kTpTxErrBufferUnderrun: Within the ApplTpCopyToCAN function a
buffer-underrun occurs.
cannel
Return code
Hold the channel: kTpHoldChannel
Reinitializing / free the channel: kTpFreeChannel
Availability No description
Description This function will be called if an error occurs on the channel. The application has now to decide if the
channel should be reinitialized or hold for reusing it (only for dynamic TP classes necessary).
The name of this callback-function can be adjusted as desired in the Generation Tool.
Pre-condition(s) -
Post-condition(s) -
Call context -
2013, Vector Informatik GmbH
Version: 3.14.00
156 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
Please note Currently the ‘state’ parameter is not used. So the default of this parameter is ‘kTpSuccess’.
Examples vuint8 ApplTpCopyToCan(TpCopyToCanInfoStructPtr infoStruct)
{
(void)memcpy( infoStruct->pDestination, infoStruct->pSource,
infoStruct->Length);
return kTpSuccess;
}
4.4.4 Administrative Functions 4.4.4.1 ApplTpFatalError: Fatal Error ApplTpFatalError Prototype SingleConnectionTp
void
ApplTpFatalError(vuint8 errorCode)
MultipeConnectionTP
void
ApplTpFatalError(vuint8 errorCode)
Parameter errorCode
User assertions:
> KTpErrNoDynObjAtTpInit: Within TpInitPowerOn() it is not possible
to allocate the necessary transmit-objects from CAN-driver – please
check initialization order
> KTpErrChannelNrTooHigh: Possible access of a invalid tpChannel –
please check your application calls of the TP-API.
> KTpRxErrFcCanIdIsMissing: The CAN-ID of the FlowControl was
not set within the ApplTpRxGetBuffer() function for dynamic
NormalAddressing – please check your application.
> KtpTxErrDatalengthTooHigh: The application tried to transmit more
than 4095 bytes of data – please check your application.
> KTpTxErrWrongFrameAtPretransmitSpecified: Internal state-
machine check – please get in contact with us.
> KTpTxErrNoStateSpecified: Internal state-machine check – please
get in contact with us.
> kTpRxErrNoStateSpecified: Internal state-machine check – please
get in contact with us.
> kTpErrChannelNotInPreTransmitState: The application tried to
configure a not assigned tpChannel in a dynamic TP class – please
check your application.
2013, Vector Informatik GmbH
Version: 3.14.00
157 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
> KTpErrWrongAddressingFormat: The application tried to configure a
tpChannel for a wrong AddressingMode (e.g.
TpTxSetTargetAddress for NormalAddressing configured
tpChannel) in a dynamic TP class – please check your application -
please check your application.
> KTpRxErrSetResponseWithoutFc: The function TpTxSetResponse()
is called for without-FC configured tpChannel - please check your
application.
> KTpTxErrSetResponseWithoutFc: The function TpTxSetResponse()
is called for without-FC configured tpChannel - please check your
application.
> KTpErrChannelNotInUse: The application tried to get information
about an unused tpChannel – please check your application.
Internal assertions:
> KTpErrChannelNrTooHigh: Possible access of a invalid tpChannel –
please check the stack-usage.
> KTpRxErrNotInWaitCFState: Internal state-machine check – please
get in contact with us.
> KTpErrChannelNotInUse: Internal state-machine check – please get
in contact with us.
> KTpErrNoCanChannelFound: The CAN-driver confirmation function
is called with a wrong Handle, because it is not possible to calculate
the corresponding CAN-channel – please get in contact with us.
Return code
-
Availability Until versions CANgen: 3.88.02 DBKOMgen: 2.37.01 TP-assertions are activated if the “Debug level” in
CAN-Driver includes “User”/”Internal”
Description This function will be called if a fatal error occurs.
The name of this callback function is not changeable
Pre-condition(s) -
Post-condition(s) -
Call context -
Please note -
Examples
-
2013, Vector Informatik GmbH
Version: 3.14.00
158 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
5 Transmission Attributes & Callback functions Figure 5-1 Transmission attributes and callback functions
2013, Vector Informatik GmbH
Version: 3.14.00
159 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
6 Integration of CANbedded Components into a Customer Project 6.1 Requirements to the Customer System Environment A customer system environment from the CANbedded component point of view is the
environment (system architecture) where the component together with other CANbedded
components, an operation system, startup code, system control software and the
application is running.
To full fill the different requirements to the component architecture like small ROM and
RAM footprint, short API runtime and short interrupt lock times (global and only
CAN/LIN/others bus interrupts) during the API execution, some requirements to the
customer’s system environment and the component usage in that system has to be given
to and kept by the user.
The requirements and needs to use CANbedded components in a customer specific
project are listed in this chapter. It is necessary to check the requirements, preconditions
and needs carefully to guaranteed the correct and consistent usage of the software in the
resulting system and to prevent malfunction and data consistency problems during the
system execution (in the vehicle in the field).
6.2 Component Integration to the Customer Project 6.2.1 Requirements to the Component Initialization in a Customer Project The correct sequence for all CANbedded component initialization calls (e.g. CAN Driver,
network management, interaction layer …) depends on the needs for the whole, vehicle
manufacturer specific integration package. Therefore the correct call location in the context
to the other (CANbedded) power up initialization calls for this component is just a example.
The following rules are valid for each use case of a CANbedded component in a customer
project and must be guaranteed to prevent faulty situations:
1) The component must be initialized after the primary CAN Driver initialization via
CanInitPowerOn().
2) The component must be initialized during the global interrupt is locked, to prevent
any interrupt occurrences during the initialization sequence of this and ALL other
CANbedded modules. Therefore the requirement is to make sure the global
interrupt is disabled during the whole initialization sequence of all CANbedded
components (driver, IL, NM, TP, diagnostics …).
3) Please note, that the usage of CanDisableInterrupt and CanRestoreInterrupt is
incorrect to lock the global interrupt during the CANbedded initialization sequence.
A customer project specific global interrupt lock and unlock is necessary.
4) The customer system architecture must guarantee that all CANbedded modules are
initialized before the first usage of any API or variable access in the customer’s
application software is performed.
5) The call to the component initialization function TpInitPowerOn() will reset the
component state to the initial state. Therefore it is NOT recommended to call the
component initialization function during the system runtime to e.g. terminate
2013, Vector Informatik GmbH
Version: 3.14.00
160 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
something. Please check carefully, if the call to this API is valid (and helpful) in the
planned application context.
6) Please note, that the call to the component initialization function may be runtime
consuming, especially if there are additional callbacks to the application are
performed and that the global interrupts are locked during that time, too.
7) If an OSEK/OS is used, the basic initialization sequence has to be performed in the
startup-hook or, alternatively in an task used to initialized the whole system. Please
check, that the global interrupt is locked during the startup hook execution to ensure
the required data consistency. This is true for all osCAN OSEK but not for each
OSEK/OS on the market. If the initialization is performed in a task, the interrupt
must be locked by the user for each OSEK/OS implementation.
6.2.2 Requirements to Component API Usage in a Customer Project 1) The CANbedded component needs a first initialization of all internal variables and
states via the call of the initialization API function TpInitPowerOn(). It is not allowed
to use any API or data structure of the component before the primary initialization
has been performed. See chapter
6.2.1 Requirements to the Component
Initialization in a Customer Project for details to the component needs according to
the initialization sequence.
2) The cyclic function(s) (e.g. TpRxTask()/TpTxTask()) of a component must not be
called on interrupt level (e.g. the timer interrupt). It is strictly forbidden, that the
cyclic called component API interrupts the component’s API functions running in the
(CAN/LIN) interrupt context or an other component API’s. See chapter
6.2.3.1
Common Requirements for details.
3) It is not allowed to call any CANbedded API function in the context of an interrupt, if
this is not explicitly allowed or required in this documentation.
4) Please refer to chapter
6.2.3 Requirements to the Customer Project Operating System for the component requirements to the operating system.
6.2.3 Requirements to the Customer Project Operating System The operating system used in the customer project has to fulfill the rules listed in chapter
6.2.3.1 Common Requirements to guarantee data consistency of the internal and external
component states and values.
6.2.3.1 Common Requirements The component offers different API functions and global variable/state access to the
application program. Some of these API functions are necessary to fulfill the basic
functionality of the component. This is e.g. the initialization and the cyclic called function to
realize the internal time base and the state handling.
The cyclic called API function TpRxTask()/TpTxTask() is also called TASK in the context of
this chapter. Due to the need for fast (1 - 10ms) cyclic calls, this tasks are often called
erroneously by calling this API function in an timer interrupt context. This is STRICTLY
forbidden.
2013, Vector Informatik GmbH
Version: 3.14.00
161 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
The list below describes the common rules for all component API calls. The documentation
of the API functions and the component callback functions describes the deviations from
this rules if, e.g. the API is allowed to be called during the TASK is running.
Please check carefully, if this restrictions are valid in your system: > API functions must not interrupt the (CAN/LIN) RX/TX interrupt service functions
> API functions must not interrupt the TASK functions
> API functions must not interrupt other API functions of the same component
> TASK functions must not interrupt API functions of the same component
> If there are multiple TASK functions for a component: TASK function must not interrupt
other TASK functions of the same component
> TASK functions must not interrupt the (CAN/LIN) RX/TX interrupt service functions
Info > API and TASK functions are protected against interruption by the (CAN/LIN) RX/TX
interrupt service functions
> There are no limitations for interruptions of the component API’s with other,
independent interrupt service functions (e.g. A/D converter, SIO lines, ...)
6.2.3.2 Round-Robin-Scheduler and Comparable OS Approaches If the used operating system works like a round-robin scheduler or comparable and there
is only one common call level for application and CANbedded APIs with additional, small
interrupt handlers, the preconditions as described in chapte
r 6.2.3.4 should be valid.
6.2.3.3 Usage of OSEK/OS The component can be used together with an OSEK operating system. The component
itself is operating system independent and can therefore be used together with an
OSEK/OS, if the rules listed in chapte
r 6.2.3.1 are fulfilled.
OSEK/OS can be configured to 4 different setups (BCC1 to ECC2). Depending on the
selected setup, OSEK/OS is non-preemptive or (full-)preemptive. The preemptive setups
are able to run non-preemptive and preemptive tasks. Please refer to the chapte
rs 6.2.3.4
and 6.2.3.5 for further details.
If an OSEK/OS is used, the basic initialization sequence has to be performed in the
startup-hook or, alternatively in an task used to initialized the whole system. Please check,
that the global interrupt is locked during the startup hook execution to ensure the required
data consistency. This is true for all osCAN OSEK but not for each OSEK/OS on the
market. If the initialization is performed in a task, the interrupt must be locked by the user
for each OSEK/OS implementation.
2013, Vector Informatik GmbH
Version: 3.14.00
162 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
6.2.3.4 Non-Preemptive Operating System If an non-preemptive OS is used, there are no limitations to the usage of CANbedded
component API’s on task/main level due to an task change is started by an OS-API call or
by exiting a function called directly by the OS scheduler. Due to this there is no situation
with possible dangerous interruptions of component API executions in this environment.
Non-preemptive approaches are using also interrupt handlers for e.g. CAN, LIN, A/D and
D/A conversion and other things. Until the requirements listed in chapter
6.2.3.1 are
fulfilled, no critical situation according to data consistency and the CANbedded component
usage occurs. The CANbedded component itself is able to cope with the interruption via
the internal connection to the CAN/LIN driver.
6.2.3.5 Preemptive Operating System If the CANbedded component has to be used in a full-preemptive environment, some
additional restrictions have to be kept in mind. If this is not explicitly allowed, please check
carefully, that the restrictions listed in chapte
r 6.2.3.1 are fulfilled by the system setup.
Possible solutions for a save usage of the CANbedded component may be calling the
cyclic functions and API’s in non-preemptive tasks or to lock task changes during the
execution of the cyclic function calls and the component APIs.
It is not recommended to solve the restrictions via a special task priority setup due to
possible maintenance issues when changing and extending the software system in the
future.
2013, Vector Informatik GmbH
Version: 3.14.00
163 / 177
based on template version 5.1.0


Technical Reference Transport Protocol ISO15765-2
7 Advanced usage 7.1 Separation of TimerTask and TransmissionTask (StateTask) Until TPMC version 2.35 there is a combination of a timer observation and the handling of
transmission requests in one task function. By the demand of faster TP transmission the
most popular possibility is to separate the transmission mechanism from the timer task.
Since TPMC version 2.35 TimerTask and TransmissionTask are separated.
The ‘TimerTask’ includes the time observation. The ‘StateTask’ includes the transmission
handling of the CAN-frames. Especially the retry of the transmission while CanTransmit()
cannot accept the message, because the (all) TX registers are currently in use.
Like the former ‘Task’ function (TpXxTask()) the current ‘Task’ function (TpXxTask())
includes the call of both tasks to have a full compatibility. So it must be called further on
periodically. The ‘StateTask’ can be called out of a fixed time periods in addition.
Caution
It is not necessary to call the ‘StateTask’, if the CAN Driver queue is enabled.
void TpTxTask(void)
> static void TpTxTimerTask(void) (not visible for the application)
> void TpTxStateTaskAllChannels(void)
void TpRxTask(void) > void TpRxTimerTask(void) (not visible for the application)
> void TpRxStateTaskAllChannels(void)
The ‘StateTaskAllChannels’ iterates over all tpChannels. To speed up only one connection.
a ‘StateTask’ is provided, which is handles the transmission of this connection.
void TpTxStateTask(vuint8 tpChannel)
void TpRxStateTask(vuint8 tpChannel) 7.2 Fast transmission of ConsecutiveFrames Available since TPMC version 2.35.
The TP-layer calculates the STmin time based on the CallCycle of the TpTimerTask().To
guarantee that a under run of the STmin is not possible, one CallCycle is added. This
conservative way of calculation do not fit the demand of a fast transmission.
The added feature includes a possibility to transmit a TP-frame as quick as possible.
Typically this feature can be used for a fast re-programming of ECU’s through Gateways or
Testers.
2013, Vector Informatik GmbH
Version: 3.14.00
164 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
The feature can’t be enabled through the GenTools. A user-config file has to be used,
including following define:
#define TP_USE_FAST_TX_TRANSMISSION kTpOn
7.2.1 Usage The TP provides a special API function which assembles and transmits the next CF-frame
by skipping the internal timer for the minimum sending distance (STmin). This means the
application has the possibility to transmit the next CF frame faster than the calculated
minimum sending distance of the TP module allows.
Normally the timer will be reloaded with the value of the minimum sending distance and is
observed in the TpTxTimerTask(). By calling the function TpTxPrepareSendImmediate()
the timer of the TP is stopped. If the preparation returns a ‘kTpSuccess’ the application
gets the responsibility of transmitting the next ConsecutiveFrame. The application can
reload an (application) alarm-timer with the STmin value of the FlowControl-frame by
calling the function TpTxGetSTminInFrame(). If the alarm occurs (timer is decremented to
zero) the application can transmit the ConsecutiveFrame by calling the function
TpTxSendImmediate(), which prepares the CF-frame and calls the TpTxStateTask() to
transmit the frame immediately.
7.2.2 Application example For non-zero STmins: void ApplTpTxFC(canuint8 channel)
{
if(kTpSuccess == TpTxPrepareSendImmediate(channel))
{
TpTxSendImmediate(channel);
}
}
void ApplTpTxCanMessageTransmitted(canuint8 channel)
{
canuint8 stminTime;
if(kTpSuccess == TpTxPrepareSendImmediate(channel))
{
stminTime = TpTxGetSTminInFrame(channel);
/* load an OSEK-OS alarm (in ms) */
SetRelAlarm(TpSepAlarm, MSEC(stminTime),0);
/* after alarm time expires: TpTxSendImmediate(channel); */
}
}
For zero STmins (fast as possible): Attention: Due to the current priority rules it could be possible that no real parallel
transmission is possible. All other channels are not handled anymore while
another transmission is running.
void ApplTpTxFC(canuint8 channel)
{
if(kTpSuccess == TpTxPrepareSendImmediate(channel))
{
TpTxSendImmediate(channel);
}
}
void ApplTpTxCanMessageTransmitted(canuint8 channel)
{
if(kTpSuccess == TpTxPrepareSendImmediate(channel))
{
2013, Vector Informatik GmbH
Version: 3.14.00
165 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
TpTxSendImmediate(channel);
}
}
7.3 Normal Fixed Addressing 7.3.1 Multiple ECU’s Multiple ECU’ s are control units which are assembled several times within the CAN
network with the same software (example: seat in the front on the left hand side and on the
right hand side). In this case, the application has to decide at run-time, which ECU is
actually installed and has to set-up these parameters dynamically.
7.3.1.1 Using the CANgen configuration tool The configuration tool does not apply the ECU information but it provides all possible
values for the application as constants in the generated code.
E.g.: In the generated tp_cfg.h file you will find constants for all existing ECU numbers:
#define kTpEcuNumber0 0x10
#define kTpEcuNumber1 0x11
#define kTpEcuNumber2 0x12
#define kTpEcuNumber3 0x13
…
2013, Vector Informatik GmbH
Version: 3.14.00
166 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
In case of using the CANgen configuration tool the application must accomplish two things
now at Power On time:
a) The actual ECU number must be set using the ComSetCurrentECU() API.
b) The actual ECU number must be provided to the TPMC.
Code example:
extern canuint8 tpEcuNumber;
canuint8 tpEcuNumber;
void main(void)
{
CanInitPowerOn();
ComSetCurrentECU(currentECU);
...
if ( FirstECUis selected) {
tpEcuNumber = kTpEcuNumber0;
}
else if (SecondECU is selcted) {
tpEcuNumber = kTpEcuNumber1; }
TpInitPowerOn(); /* For some configuration it could be also
DiagInitPowerOn() with implicit TPMC initialization */
...
<EnableCAN_ISR>
}
7.3.1.2 Using the GENy configuration tool The configuration tool does not apply the ECU information completely but it provides all
possible values for the application as constants in the generated code.
E.g.: In the generated tp_par.c file a kTpEcuNumber_field[] is provided for all existing ECU
numbers:
vuint8 kTpEcuNumber_field [4] = {
0x10,
0x11,
0x12,
0x13
}
2013, Vector Informatik GmbH
Version: 3.14.00
167 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
In case of using the GENy configuration tool there is left one thing now the application
must accomplish at Power On time:
a) The actual ECU number must be set using the ComSetCurrentECU() API.
Code example:
void main(void)
{
CanInitPowerOn();
ComSetCurrentECU(currentECU);
...
TpInitPowerOn(); /* For some configuration it could be also
DiagInitPowerOn() with implicit TPMC initialization */
...
<EnableCAN_ISR>
}
7.4 Extended- and Normal Fixed Addressing 7.4.1 Virtual ECU’s / ‘Multiple EcuNumber’ feature ‘Virtual ECU’s’ are control units which include the logic of more than one ECU. In the
network they have to react for more than one ECU number. The application has to decide
which ECU number should be received and which not.
For versions < 2.73.00:
All TargetAddresses (except the functional TargetAddress 0xFF ) will be received through
the Transport Layer. Following the reception of a TP-frame the application callback
ApplTpPrecopy() is called by the Transport Layer. In this function the application has to
decide which TargetAddress should be received and which not. In this function the
application gets the received TargetAddress and has to return the TargetAddress itself to
receive TransportFrames. To not receive the following TransportFrames the return value
has to be ‘kTpNoChannel’ (0xff).
If the received TargetAddress e.g. is a part of a functional range, the application can
modify the received TargetAddress by returning another TargetAddress in the
ApplTpPrecopy function. If the returned value is unequal to the received the Transport
Layer will receive the TransportFrames with this TargetAddress and not with the received
(the responded FlowControl is also modified).
canuint8 ApplTpCheckTA(vuint8 targetAddress)
{
vuint8 result;
switch(targetAddress)
{
case TargetAddress_0:
case TargetAddress_1:
...
case TargetAddress_n:
result = targetAddress;
break;
default:
result = kTpNoChannel;
}
return result;
}
2013, Vector Informatik GmbH
Version: 3.14.00
168 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
For versions >= 2.73.00:
All TargetAddresses are received through the Transport Layer. Following the reception of a
TP-frame the application callback ApplTpPrecopy() is called by the Transport Layer. In this
function the application has to decide which TargetAddress should be received and which
not. The application gets the received TargetAddress and has to return either
‘kTpPhysical’ or ‘kTpFunctional’. To not receive any subsequent TP Frames the
application returns ‘kTpNone’.
t_ta_type ApplTpCheckTA(vuint8 targetAddress)
{
t_ta_type result;
if(targetAddress == MY_ECU_NUMBER)
{
result = kTpPhysical;
}
else if((targetAddress >= TP_LOWEST_FUNCTIONAL_ADDRESS ) &&
(targetAddress <= TP_HIGHEST_FUNCTIONAL_ADDRESS))
result = kTpFunctional;
}
else
{
result = kTpNone;
}
return result;
}
7.5 Using different CAN-Identifiers For some purposes different CAN-Ids, as well 11-Bit standard as also 29-Bit extended
identifiers shall be used for the Normal Addressing type. If so, the TPMC provides two
configuration opportunities to handle this requirement either statically at configuration time
or dynamically at runtime.
7.5.1 Statically configured CAN-Ids By default 11-Bit standard Ids are used with Normal Addressing. If 29-Bit extended Ids are
requested by the user and thus also entered as Addressing Information in the GENy
generation tool, then the preprocessor switch TP_USE_EXT_IDS_FOR_NORMAL is generated
with the value kTpOn. The code is now applicable to be used with 29-Bit CAN-Ids.
7.5.2 Dynamically configured CAN-Ids If the user has the necessity to handle both kinds of CAN-Ids during runtime, then in the
GENy generation tool different CAN-Ids can be entered for different Addressing
Informations. Now the preprocessor switch TP_USE_MIXED_IDS_FOR_NORMAL is generated
with the value kTpOn in addition and the code is now applicable to be used simultaneously
with 11- and 29- Bit CAN-Ids.
7.5.3 Additional API functions If both kinds of CAN-Ids are used then the additional API function
canuint8 TpRxGetChannelIDType(canuint8 tpChannel) is provided.
This function either returns kTpCanIdTypeStd for 11-Bit or kTpCanIdTypeExt for 29-Bit
identifiers.
2013, Vector Informatik GmbH
Version: 3.14.00
169 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
7.6 Transmissions without Flow Control frames For some purposes the usage of FC frames might be omitted. Please note that this feature
is not supported for single connection TP.
If using a dynamic Tp Class then the provided API functions TpRxWithoutFC resp.
TpTxWithoutFC can be used (see
0, 4.2.3.28) to control the FC usage.
If using a static Tp Class then a channel specific FC control information must be provided
at compile time for the TP containing the information if FC frames shall be used or not for a
specific channel either on the Rx- and/or on the Tx- side.
The definition and usage of the FC control array must be as described below:
vuint8 TpRxFlowControl[kTpRxChannelCount];
vuint8 TpTxFlowControl[kTpTxChannelCount];
In the default case, if the usage of FC frames is required, then the FC control array
contains a value of “1” for the belonging Rx- or Tx- channel. If FC frames shall be
suppressed, then the FC control array contains a value of “0” for the belonging Rx- or Tx-
channel.
Example:
vuint8 TpRxFlowControl[3] =
{ 1, // use FC frames
1, // use FC frames
0 // use no FC frames
}; //
vuint8 TpTxFlowControl[3] =
{ 1, // use FC frames
1, // use FC frames
0 // use no FC frames
};
2013, Vector Informatik GmbH
Version: 3.14.00
170 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
8 Example for the user 8.1 Administrative usage The Transport Protocol has to be initialized before all other functions were called. This
initialization has to be done after initializing the CAN-driver (
CanInitPowerOn()), possibly
if the interrupts are still locked. The Transport Layer is ready for reception after calling
TpInitPowerOn(). To perform the state machine the functions
TpRxTask() and
TpTxTask() have to be called
periodically.
If the application wants to have access to the API of the TPMC-component it has to include
the “tpmc.h” file after including of the “can_inc.h” file.
8.2 How to Transmit a Tp-Frame? 8.2.1 Static Normal Addressing First you need an own buffer with your data which should be transmitted. To start the
transmission simply call
TpTransmit(). if (TpTransmit(tpChannel, appl-buffer, appl-data-length) != kTpSuccess)
{
/* Error case – transmission was not successful */
}
A confirmation function is called after the complete transmission. It can be used to release
buffers...
void ApplTpTxConfirmation(vuint8 tpChannel, vuint8 state)
{
If you want an own copy mechanism to move the data from your buffer into CAN buffer you
have to use the function
ApplTpTxCopyToCan() (This can be configured in the
Generation Tool).
8.2.2 Dynamic Addressing (Normal- / Normal Fixed- / Extended- / Multiple-Addressing)
Before the application can call
TpTransmit() (refer 8.2 How to Transmit a Tp-Frame?) a
transport channel has to be requested. The function
TpTxGetFreeChannel() returns a
free transport channel or – if no channel is available at the moment –
kTpNoChannel.
After a channel is assigned, the channel has to parameterized by the application. In the
example below, the application will set the Transmit ID and Receive ID (Dynamic Normal
Addressing) before sending the data.
Important: replace the cursive words by your own
tpChannel = TpTxGetFreeChannel(connection-number);
if(tpChannel != kTpNoChannel)
{
/* normal addressing */
TpTxSetChannelID(tpChannel, TransmitID, ReceiveID);
if (TpTransmit(tpChannel, appl-buffer, appl-data-length) != kTpSuccess)
{
/* Error case – transmission was not successful */
2013, Vector Informatik GmbH
Version: 3.14.00
171 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
}
}
The callback functions provide only the tpChannel as a parameter. To get the unique
connection-number out of this tpChannel the function
TpTxGetConnectionNumber(tpChannel) is provided
void ApplTpTxConfirmation(vuint8 tpChannel, vuint8 state)
{
switch(TpTxGetConnectionNumber(tpChannel))
.
.
8.3 How to Receive a Tp-Frame It is only possible to get an Indication by a function callback. The reception progress is
completed by the Transport Layer.
Important: The Transport Layer blocks the receive tpChannel as long as the application
desires. To free the receive channel call
TpRxResetChannel().
void ApplTpRxIndication ( vuint8 tpChannel, vuint16 dataLength)
{
...
...
TpRxResetChannel(tpChannel);
...
...
}
The Transport Layer supports only buffer-management by the application. If data will be
received, it is important to the Transport Layer to get a buffer into which the data can be
moved.
vuint8 * ApplTpRxGetBuffer (vuint8 tpChannel, vuint16 length)
{
if (Is_ReceiveDataBuffer_free)
{
Set_ReceiveDataBuffer_Used;
if (length <= MaxLength)
{
/* return a valid data buffer */
return ReceiveDataBuffer;
} else {
/* length is too big for the ReceiveDataBuffer – do not receive the data */
return NULL;
} else {
/* ReceiveDataBuffer is not free – do not receive the data */
return NULL;
}
}
8.4 How to Send a Response on a Received Transport-Frame Normally the application has to set transmission attributes like TargetAddress,
TargetIdentifier or physical CanChannel (depending on the addressing mode and
configuration). So if the application want to send a response to the sender of a received
transport-frame it has to set these transmission attributes. For this case it can do it easily
by using the function TpTxSetResponse(). The Preconditions are only the Rx-Channel -
which is still blocked - from the sender and a free Tx-Channel for the transmission.
if ( (txTpChannel = TpTxGetFreeChannel(user_connection)) != kTpNoChannel )
{
TpTxSetResponse(rxTpChannel, txTpChannel);
TpRxResetChannel(rxTpChannel);
TpTransmit(txTpChannel, ...);
}
2013, Vector Informatik GmbH
Version: 3.14.00
172 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
8.5 How to serve Different Connections (only dynamic channels) The dynamic TP classes does not support connection specific callback functions.
Therefore the application needs an easy handling between the different connections with
less resource requirements. Especially the diagnostic-layer must be handled
8.5.1 How to serve the diagnostic connection This is also an example to serve different connections in your own application! I.e. you can
derive from the diagnosis example to your own.
Reception part: Within the ‘ApplTpRxGetBuffer()’ the application is responsible to distinguish between the
different connections. If the right connection is found a connection-number can be set to
have in the later callbacks a faster decision.
(Dynamic Normal Addressing) The received CAN-ID (for the diagnosis) is unique (get it
with: TpRxGetChannelID(tpChannel))
Transmission part: At the transmission the connection-number is unique. The diagnosis uses the connection-
numbers “kDiagConnection” and “kDiagAddConnection”.
2013, Vector Informatik GmbH
Version: 3.14.00
173 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
unsigned char* ApplTpRxGetBuffer(vuint8 tpChannel, vuint16 tpRxDataLength)
{
switch(TpRxGetChannelID(tpChannel))
{
case DIAG_RECEIVE_ID:
TpRxSetConnectionNumber(tpChannel, kDiagConnection);
return DiagTpGetRxBuffer(tpChannel, tpRxDataLength);
case APPL_RECEIVE_ID:
TpRxSetConnectionNumber(tpChannel, CONNECTION_0);
/* Check for an valid application buffer */
return APPLICATION_BUFFER;
default:
return NULL;
break;
}
}
void ApplTpRxIndication(vuint8 tpChannel, vuint16 tpRxDataLength)
{
switch(TpRxGetConnectionNumber(tpChannel))
{
case kDiagConnection:
DiagPhysReception(tpChannel, tpRxDataLength);
break;
case CONNECTION_0:
UserTpRxIndication(tpRxDataLength);
break;
default:
break;
}
}
void ApplTpRxErrorIndication(vuint8 tpChannel, vuint8 status)
{
switch(TpRxGetConnectionNumber(tpChannel))
{
case kDiagConnection:
DiagRxErrorIndication(tpChannel, status);
case CONNECTION_0:
UserTpRxErrorIndication(status);
default:
break;
}
}
void ApplTpRxFF(vuint8 tpChannel)
{
if (TpRxGetConnectionNumber( tpChannel ) == kDiagConnection )
{
DiagRestartS1TimerInternal( tpChannel );
}
}
void ApplTpRxCF(vuint8 tpChannel)
{
if (TpRxGetConnectionNumber( tpChannel ) == kDiagConnection )
{
DiagRestartS1TimerInternal( tpChannel );
}
}
void ApplTpTxConfirmation(vuint8 tpChannel, vuint8 state)
{
switch(TpTxGetConnectionNumber(tpChannel))
{
case kDiagConnection:
DiagConfirmation( tpChannel, state);
case CONNECTION_0:
UserTpConfirmation(status);
default:
break;
}
}
2013, Vector Informatik GmbH
Version: 3.14.00
174 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
vuint8 ApplTxErrorIndication(vuint8 tpChannel, vuint8 status)
{
switch(TpTxGetConnectionNumber(tpChannel))
{
case kDiagConnection:
return DiagTxErrorIndication(tpChannel, status);
case CONNECTION_0:
UserTpTxErrorIndication(status);
default:
return kTpFreeChannel;
}
}
vuint8 ApplCopyToCAN(TpCopyToCanInfoStructPtr infoStruct)
{
switch(TpTxGetConnectionNumber(infoStruct->Channel))
{
case kDiagConnection:
return DiagCopyToCAN(infoStruct->Channel, kSFDataPos, tpTxDataLength);
default:
(void)memcpy( infoStruct->pDestination, infoStruct->pSource, infoStruct->Length);
break;
}
return 0;
}
void ApplTpTxNotification(vuint8 tpChannel, vuint8 DataLength)
{
switch(TpTxGetConnectionNumber(tpChannel))
{
case kDiagConnection:
DiagTpMsgTxReady(tpChannel, DataLength);
break;
default:
break;
}
}
8.6 How to Lock a Tx-Channel and Why? (only dynamic channels) Normally the application get a resource – use the resource – and release the resource. In
the current version the resource Transmit-tpChannel will be released by the Transport
Layer automatically after a transmission (for code optimization). If an application will use
the same channel more than one time (i.e. a periodically transmission) it has to lock the
channel.
...
...
TpTxLockChannel(channel);
TpTransmit(...)
...
TpTransmit(...)
...
TpTransmit(...)
The application has two possibilities to release the channel:
> unlock the channel using ‘
TpTxUnlockChannel ()’: i.e. only one transmission without
a release should be done...
TpTxLockChannel(user_channel);
TpTransmit(user_channel, ...)
...
>wait until confirmation occured<
TpTxUnlockChannel(user_channel);
TpTransmit(user_channel, ...)
/* After this transmission the channel will be released */
...
2013, Vector Informatik GmbH
Version: 3.14.00
175 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
> release the channel using ‘
TpTxResetChannel()’: Lock the resource for many
transfers as long as used
...
...
TpTxLockChannel(channel);
TpTransmit(...)
...
TpTransmit(...)
...
TpTxResetChannel(channel);
...
8.7 How to transmit a ConsecutiveFrame as quick as possible Typically this requirement is used for a fast re-programming of ECU’s through Gateways or
Testers.
How to do that, please refer to chapter 7.2 Fast transmission of ConsecutiveFrames.
2013, Vector Informatik GmbH
Version: 3.14.00
176 / 177
based on template version 5.1.0

Technical Reference Transport Protocol ISO15765-2
9 Contact Visit our website for more information on
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector.com 2013, Vector Informatik GmbH
Version: 3.14.00
177 / 177
based on template version 5.1.0
Document Outline
1.1.51 - TechnicalReference_VStdLib
VStdLib Technical Reference1.1.53 - TechnicalReference_VStdLibs
VStdLib
Technical Reference
Vector Standard Library
Version 1.6.2
Authors
Patrick Markl, Timo Vanoni
Status
Released


Technical Reference VStdLib
1 Document Information 1.1 History Author Date Version Remarks Patrick Markl
2008-02-06
1.0
Creation, merge from Application Note
Patrick Markl
2008-10-31
1.3
Fixed document version
Patrick Markl
2008-11-07
1.4
Added information about mixed VStdLib versions
Patrick Markl
2009-07-02
1.5
Updated assertion codes
Added chapter about QNX OS
Patrick Markl
2009-10-16
1.6
Described inclusion of OSEK OS header file
Timo Vanoni
2013-05-10
1.6.2
ESCAN00067020: The interrupt lock functions
do not work correctly for the user mode at
specific controller
Table 1-1 History of the Document
Please note
We have configured the programs in accordance with your specifications in the
questionnaire. Whereas the programs do support other configurations than the one
specified in your questionnaire, Vector’s release of the programs delivered to your
company is expressly restricted to the configuration you have specified in the
questionnaire.
2013, Vector Informatik GmbH
Version: 1.6.2
2 / 21
based on template version 3.7

Technical Reference VStdLib
Contents 1 Document Information ................................................................................................. 2
1.1 History ............................................................................................................... 2 2 Introduction................................................................................................................... 5 3 Functional Description ................................................................................................. 6 4 Integration ..................................................................................................................... 8
4.1 CANbedded Particularities ................................................................................. 8 4.2 MICROSAR Particularities ................................................................................. 8 4.3 Mixing VStdLib Versions .................................................................................... 8 5 Configuration ................................................................................................................ 9
5.1 Usage with OSEK OS ...................................................................................... 11 5.2 Usage with QNX OS ........................................................................................ 11 6 API Description ........................................................................................................... 13
6.1 Initialization ...................................................................................................... 13 6.2 Interrupt Control ............................................................................................... 14 6.3 Memory Functions ........................................................................................... 15 6.4 Callback Functions ........................................................................................... 17 7 Assertions ................................................................................................................... 18 8 Limitations .................................................................................................................. 19
8.1 Interrupt control does not work correctly in user mode ..................................... 19 9 Glossary and Abbreviations ...................................................................................... 20
9.1 Glossary .......................................................................................................... 20 9.2 Abbreviations ................................................................................................... 20 10 Contact ........................................................................................................................ 21
2013, Vector Informatik GmbH
Version: 1.6.2
3 / 21
based on template version 3.7

Technical Reference VStdLib
Illustrations Figure 5-1 VStdLib configuration dialog in GENy ......................................................... 9 Figure 5-2 VStdLib configuration dialog in CANGen .................................................... 9 Figure 5-3 Locking configuration in case CAN events are handled in an interrupt
thread ....................................................................................................... 11 Figure 5-4 Configuration of the VStdLib in case of handling CAN events on interrupt
level .......................................................................................................... 12 Tables
Table 1-1 History of the Document ............................................................................. 2 2013, Vector Informatik GmbH
Version: 1.6.2
4 / 21
based on template version 3.7

Technical Reference VStdLib
2 Introduction The basic idea of the VStdLib is to provide standard functionality to different Vector
components. This includes memory copy and interrupt locking functions. The VStdLib is
also a means to provide special memory copy functions, which are not available by
compiler libraries to the communication components.
The VStdLib is designed to be used by Vector communication components only. So the
customer integrating the communication stack will probably not notice the VStdLib at all.
The VStdLib is highly hardware specific. This means some functions are only available on
certain platforms. This includes special copy functions for far, near or huge memory. A
hardware specific VStdLib does not necessarily implement all possible copy function for
the corresponding hardware platform, but only the functions required by the Vector
software components.
The VStdLib also provides interrupt lock functions. This feature depends on the
CANbedded CAN driver’s Reference Implementation (RI). The RI defines a certain feature
set to be supported by the CAN driver. CAN drivers which implement RI1.5 and higher do
not provide an interrupt locking mechanism as previously implementations did
(CanGlobalInterruptDisable/CanGlobalInterruptRestore). These driver require a VStdLib to
provide this functionality, although the API CanGlobalInterruptDisable and
CanGlobalInterruptRestore remains for compatibility. Please refer to the CANbedded CAN
driver technical reference for more information about your specific CAN driver.
2013, Vector Informatik GmbH
Version: 1.6.2
5 / 21
based on template version 3.7

Technical Reference VStdLib
3 Functional Description The VStdLib provides basically two main functionalities to Vector communication stack
components.
> Functions to copy memory
> Functions to lock/unlock interrupts
Interrupt locking functionality is required for CAN drivers with a reference implementation
1.5 or higher or MICROSAR stacks. Functions to copy memory are always provided. The
following table describes the API of the VStdLib which is used internally.
API Function Description VStdMemSet
Initializes default RAM memory to a certain
character.
VStdMemNearSet
Initializes near RAM memory to a certain character.
VStdMemFarSet
Initializes far RAM memory to a certain character.
VStdMemClr
Clears default RAM to zero.
VStdMemNearClr
Clears near RAM to zero.
VStdMemFarClr
Clears far RAM to zero.
VStdMemCpyRamToRam
Copies default RAM to default RAM.
VStdMemCpyRomToRam
Copies default ROM to default RAM.
VStdMemCpyRamToNearRam
Copies default RAM to near RAM.
VStdMemCpyRomToNearRam
Copies default ROM to near RAM.
VStdMemCpyRamToFarRam
Copies default RAM to far RAM.
VStdMemCpyRomToFarRam
Copies default ROM to far RAM.
VStdMemCpy16RamToRam
Copies default RAM to default RAM. The copying is
performed 16 bit wise.
VStdMemCpy16RamToFarRam
Copies default RAM to far RAM. The copying is
performed 16 bit wise.
VStdMemCpy16FarRamToRam
Copies far RAM to default RAM. The copying is
performed 16 bit wise.
VStdMemCpy32RamToRam
Copies default RAM to default RAM. The copying is
performed 32 bit wise.
VStdMemCpy32RamToFarRam
Copies default RAM to far RAM. The copying is
performed 32 bit wise.
VStdMemCpy32FarRamToRam
Copies far RAM to default RAM. The copying is
performed 32 bit wise.
2013, Vector Informatik GmbH
Version: 1.6.2
6 / 21
based on template version 3.7



Technical Reference VStdLib
Info The API functions described in the following table contain “near” and “far” as parts of
the API names. The meaning of near and far depends on the platform and the functions
are not necessarily implemented to work on near or far memory.
The wording “default RAM” or “default ROM” means RAM or ROM data which is not
explicitly declared to be near or far. These data inherit the current compiler memory
model settings.
Caution
One cannot be sure that a far to near copy routine (for instance) implements really a
copying from far to near. This depends on the platform and the supported memory
models of the communication stack!
2013, Vector Informatik GmbH
Version: 1.6.2
7 / 21
based on template version 3.7

Technical Reference VStdLib
4 Integration The integration of the VStdLib is straightforward. As the other Vector components the
VStdLib is to be configured by means of the configuration tool. The configuration is
described in the next chapter. Chapte
r 6 describes some callback function which have to
be implemented by the application depending on the configuration.
In order to integrate the VStdLib simply add the file vstdlib.c as the other Vector software
components to the compile and link list.
4.1 CANbedded Particularities If the VStdLib is integrated as part of a CANbedded stack the initialization of the VStdLib is
performed by the CAN or LIN driver automatically.
4.2 MICROSAR Particularities If a MICROSAR stack is integrated the VStdLib is not initialized by any of the software
components. The application has to take care that the VStdLib’s initialization function is
called before any other MICROSAR API function is called. The following code example
shows how to initialize the VStdLib.
void InitRoutine(void)
{
...
/* Initialize the VstLib */
VStdInitPowerOn();
/* Perform initialization of the other software components */
...
}
4.3 Mixing VStdLib Versions If you receive different software component packages from Vector, it is possible that these
packages contain different VStdLib versions. A general rule is to use the VStdLib which
was received with the CAN driver package. In case you encounter any incompatibilities or
have questions, please contact the Vector support.
2013, Vector Informatik GmbH
Version: 1.6.2
8 / 21
based on template version 3.7



Technical Reference VStdLib
5 Configuration It depends on the used communication software if the VStdLib has configurable options.
The configuration tool provides options for the VStdLib if (as previously described) the
used CAN driver has RI1.5 or higher or a MICROSAR stack is used.
The VStdLib is configured by means of the configuration tool. CANGen provides an own
dialog named VStdLib to configure this component. In GENy these configuration options
are found in the hardware options dialog. The following two pictures show the
configuration dialogs in both tools. The first picture shows the dialog in GENy.
Figure 5-1 VStdLib configuration dialog in GENy
The next picture shows the configuration dialog of the VStdLib in the CANGen tool.
Figure 5-2 VStdLib configuration dialog in CANGen
2013, Vector Informatik GmbH
Version: 1.6.2
9 / 21
based on template version 3.7


Technical Reference VStdLib
The following table describes the different configuration items of the VStdLib dialogs.
Configuration Item Description Lock Mechanism
One can select the interrupt lock mechanism
used by the VStdLib. The VStdLib provides
four different types: Default, LockLevel, OSEK
and User.
The setting “OSEK” covers OSEK OS and
AUTOSAR OS.
Lock Level
If LockLevel was selected as Lock Mechanism
one can select the interrupt lock level used for
CANbedded components. The VStdLib will
lock interrupts up to the specified level. Higher
level interrupts remain unlocked.
Nested Disable
If “User” was selected as Lock Mechanism the
user can type in the name of the user defined
function which lock the interrupts.
Nested Restore
If “User” was selected as Lock Mechanism the
user can type in the name of the user defined
function which restores the interrupts to their
previous state.
Assertions
If this checkbox is enabled the VStdLib will call
an assertion function in case of a fatal error.
If one configures the option Lock Mechanism as “User” two function have to be provided.
The prototype of both functions is:
void UserFunction(void) The first function entered under the option “Nested Disable” is expected to disable
interrupts and store the current context of the interrupt state (Current I-Flag, Current
Interrupt Lock Level, etc.) to a global variable.
The second function entered under “Nested Restore” is expected to restore the interrupts
to the previous state using the value which was saved in the context of “Nested Disable”.
Caution
The two functions must not implement a disable/enable mechanism but a
disable/restore mechanism! Otherwise it may happen that interrupts remain locked until
the next Power On reset.
2013, Vector Informatik GmbH
Version: 1.6.2
10 / 21
based on template version 3.7


Technical Reference VStdLib
The configuration option “User” can be used instead of the previously known CAN driver
option “Interrupt Control by Application”.
5.1 Usage with OSEK OS If OSEK OS is configured as lock mechanism the VStdLib needs to include the header of
the OSEK OS. Since the header of the OSEK OS may have different names depending on
the OS supplier the VStdLib includes always the same header file. This header file has to
be provided by the user. The file’s name must be os.h. If the OSEK OS already provides a
file named like this nothing needs to be done (as long it provides the required prototypes).
Otherwise the user has to create a header file named os.h and include the corresponding
OSEK OS file.
If the VStdLib is configured to lock/unlock interrupts by means of OSEK OS the following
OSEK functions are called to implement the lock:
> SuspendAllInterrupts
> ResumeAllInterrupts
5.2 Usage with QNX OS In case the VStdLib is used in a QNX OS environment two options for interrupt locking are
available. Depending on the way CAN interrupts are handled (ISR, Interrupt Thread)
different locking mechanisms are needed.
In case the CAN interrupts are handled by an interrupt thread the locking is done by
means of mutexes. These are not implemented by the VStdLib but the QWrap component.
Please refer to
Figure 5-3 which shows the locking configuration in this case.
Figure 5-3 Locking configuration in case CAN events are handled in an interrupt thread
User defined locking is also required if the VStdLib is configured to run in the context of the
QNX startup code (minidriver). The MdWrap component provides the same callbacks as
shown
in Figure 5-3 also in that case. QWrap and MdWrap implement the same callback
names in case the same tool configuration is used to generate for the minidriver and the
fulldriver.
2013, Vector Informatik GmbH
Version: 1.6.2
11 / 21
based on template version 3.7


Technical Reference VStdLib
In case CAN interrupts are handled by a CAN interrupt routine the VStdLib locking
functions disable/restore the global interrupt flag. Mutexes are not used. In this case the
configuration of the VStdLib must be set to Default as shown in
Figure 5-4. Figure 5-4 Configuration of the VStdLib in case of handling CAN events on interrupt level
2013, Vector Informatik GmbH
Version: 1.6.2
12 / 21
based on template version 3.7

Technical Reference VStdLib
6 API Description This chapter describes the API of the VStdLib.
6.1 Initialization VStdInitPowerOn Prototype
void
VStdInitPowerOn(void)
Parameter None
-
Return code None
-
Functional Description Initializes the VStdLib component.
Particularities and Limitations > This function must be called once after PowerOn reset. This function must not be re-called
later.
> The application must not call any other Vector communication stack function before this
function. This includes also the other VStdLib functions. In other words: The function
VStdInitPowerOn must be the very first Vector function being called after startup. Depending
on the architecture the caller must take care about interruptions of the init function which may
violate this requirement (OS task which calls another Vector function).
> If the CANbedded stack is used this function is automatically called by the CAN or LIN driver.
> In a MICROSAR communication stack is integrated this function has to be called by the
application before any other MICROSAR API function is called.
Call context
> Task context
2013, Vector Informatik GmbH
Version: 1.6.2
13 / 21
based on template version 3.7

Technical Reference VStdLib
6.2 Interrupt Control VStdSuspendAllInterrupts Prototype
void
VStdSuspendAllInterrupts(void)
Parameter None
-
Return code None
-
Functional Description Disables all interrupts or locks interrupts to a certain lock level. This depends on the hardware platform.
The way interrupts are locked is to be configured in the configuration tool.
Particularities and Limitations > This function is designed to be called in a nested way (except User Interrupt Control is
configured).
> Every call to VStdSuspendAllInterrupts must have a corresponding call to
VStdResumeAllInterrupts.
> If User Interrupt Control is configured this function is redirected to the functions specified by
the user in the configuration tool. No nesting counter is implemented. The user may have to
take special care to handle this behavior.
> Depending on the used OS this function may use either a global lock or a mutex.
> Default implementation only works if corresponding flags can be modified (e.g. in privileged
mode).
Call context
> No limitation
VStdResumeAllInterrupts Prototype
void
VStdResumeAllInterrupts(void)
Parameter None
-
Return code None
-
Functional Description Resumes the interrupts which were locked using the API function VStdSuspendAllInterrupts.
2013, Vector Informatik GmbH
Version: 1.6.2
14 / 21
based on template version 3.7

Technical Reference VStdLib
Particularities and Limitations > This function must not be called without a corresponding call to VStdSuspendAllInterrupts.
> If User Interrupt Control is configured this function is redirected to the functions specified by
the user in the configuration tool. No nesting counter is implemented. The user may have to
take special care to handle this behavior.
> Depending on the used OS this function may use either a global lock or a mutex.
> Default implementation only works if corresponding flags can be modified (e.g. in privileged
mode).
Call context
> No limitation
6.3 Memory Functions This chapter describes not all functions, as they do all the same except for the memory
qualifiers of the source and destination locations.
VStdMemSet Prototype
void
VStdMemSet (void *pDest, vuint8 nPattern, vuint16 nCnt)
Parameter pDest
The start address in memory which is to be initialized using the given
character.
nPattern
The character to be used to fill nCnt Bytes starting at address pDest.
nCnt
The number of Bytes to be filled using the given character.
Return code None
-
Functional Description This function fills nCnt Bytes starting at address pDest in memory using the character nPattern.
Particularities and Limitations > This function exists in three variants (default, near and far memory). Depending on the
platform these function may be implemented differently
Call context
> No restriction
VStdMemSet 2013, Vector Informatik GmbH
Version: 1.6.2
15 / 21
based on template version 3.7

Technical Reference VStdLib
Prototype
void
VStdMemClr (void *pDest, vuint16 nCnt)
Parameter pDest
The start address in memory which is to be initialized to zero.
nCnt
The number of Bytes to be set to zero.
Return code None
-
Functional Description This function initializes nCnt Bytes starting at address pDest in memory to zero.
Particularities and Limitations > This function exists in three variants (default, near and far memory). Depending on the
platform these function may be implemented differently
Call context
> No restriction
VStdMemSet Prototype
void
VStdMemCpy (void *pDest, void *pSrc, vuint16 nCnt)
Parameter pDest
The destination address to which the data is copied.
pSrc
The source address from where the data is copied.
nCnt
The number of Bytes to be copied from start address pSrc to destination
address pDest.
Return code None
-
Functional Description This function copies a block of nCnt Bytes starting at memory location pSrc to another memory location
starting at address pDest.
Particularities and Limitations > This function exists in many variants. These variants implement different memory source and
destination locations.
> The implementation of these functions is highly platform dependent
> The memory blocks starting at pSrc and pDest must no overlap.
Call context
> No restriction
2013, Vector Informatik GmbH
Version: 1.6.2
16 / 21
based on template version 3.7

Technical Reference VStdLib
6.4 Callback Functions ApplVStdFatalError Prototype
void
ApplVStdFatalError (vuint8 nErrorNumber)
Parameter nErrorNumber
This parameter describes the reason which caused the assertion.
Return code None
-
Functional Description This function is called by the VStdLib in case an assertion fails.
Particularities and Limitations > This function is to be implemented by the application.
> If this function returns to the caller, it is not ensured that the calling functions finished
successfully. It has to be considered as a severe error if this function is called.
Call context
> No restriction
2013, Vector Informatik GmbH
Version: 1.6.2
17 / 21
based on template version 3.7



Technical Reference VStdLib
7 Assertions If the user enables the option “Assertions” the VStdLib component performs additional
checks. If a checked condition fails the assertion function ApplVStdFatalError is called.
The implementation of this function is to be provided by the application. This function has
an errorcode parameter which describes the reason which caused the assertion. The
following table describes these reasons.
Errorcode Description kVStdErrorIntDisableTooOften
The called VStdLib interrupt locking function
exceeded a nesting call depth of 127.
kVStdErrorIntRestoreTooOften
The number of calls of the VStdLib interrupt
unlocking function was higher than the number of
nested interrupt lock calls.
kVStdErrorMemClrInvalidParameter
A memclr function of the VStdLib was called with an
invalid pointer parameter
kVStdErrorMemCpyInvalidParameter
A memcpy function of the VStdLib was called with an
invalid pointer parameter
kVStdErrorMemSetInvalidParameter
A memset function of the VStdLib was called with an
invalid pointer parameter
kVStdErrorUnexpectedLockState
A interrupt restore function of the VStdLib is called
but the interrupts are already unlocked. This state is
not expected and must never occur.
Caution
Note that some of the assertions exist solely in case the VStdLib is configured to use
no library functions. In that case the missing library functionality is implemented directly
in the VStdLib source file.
Note
Not every assertion code is implemented on each hardware.
2013, Vector Informatik GmbH
Version: 1.6.2
18 / 21
based on template version 3.7

Technical Reference VStdLib
8 Limitations 8.1 Interrupt control does not work correctly in user mode For proper functionality it is required that the interrupt lock functions can modify the
relevant bits (e.g. Interrupt Level, Interrupt Enable) in the corresponding registers (e.g.
processor status word).
If the specific controller supports any non-privileged mode (e.g. user mode) that does not
allow access to the relevant registers and the interrupt lock APIs are called within this
context the interrupt lock may not work as expected.
2013, Vector Informatik GmbH
Version: 1.6.2
19 / 21
based on template version 3.7

Technical Reference VStdLib
9 Glossary and Abbreviations 9.1 Glossary Term Description User configuration file A text file which is appended by the configuration tool to the generated
source files. If a user configuration file is required the technical reference
describes it and the contents.
9.2 Abbreviations Abbreviation Description RI
Reference implementation of the CANbedded CAN driver. The reference
implementation defines the features a CAN driver must provide. From
Reference Implementation 1.5 (RI1.5) the interrupt locking functionality of
each CAN driver is moved to the VStdLib for the specific platform.
VStdLib
Vector Standard Library
2013, Vector Informatik GmbH
Version: 1.6.2
20 / 21
based on template version 3.7

Technical Reference VStdLib
10 Contact Visit our website for more information on
> News
> Products
> Demo software
> Support
> Training data
> Addresses
www.vector-informatik.com 2013, Vector Informatik GmbH
Version: 1.6.2
21 / 21
based on template version 3.7
Document Outline
1.1.54 - CAN-Architecture
PowerPoint-Präsentation1.1.56 - CAN-Architectures
insert picture8cm x 7cmCANbedded
Embedded Software for Automotive Applications
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
V2.04
2006-02-13


Introduction
Vehicle with different bus systems
(CAN Highspeed, CAN Lowspeed, LIN, FlexRay,
MOST …)
e.g. CAN Lowspeed:
Many ECUs participate in the
CAN Lowspeed
For communication the ECUs need:
Physical connection >> bus system
Logical connection >> data base file
>>© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 2
:
Introduction
The data base file is the basic element for ECU communication
fixed
e.g. DBC, FIBEX, LDF
defined by the OEM
ECUs, Signals, Messages
flexible
defined by the OEM
Attributes
and Vector
network wide
ECU-specific ECU1
ECU2
ECU3
settings done by suppliers
Assertions,
Assertions,
Assertions,
with configuration tool
Polling, Flags, Polling, Flags, Polling, Flags,
GENy/CANgen
Functions...
Functions...
Functions...
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 3
:
Introduction
Created by modification
the OEMDataissues
basethis DBC is distributed to the suppliers
Supplier 1
Supplier 2
Supplier 3
Supplier 4
(Appl, GENy
Data(Appl, GENy
Data(Appl, GENy
Data(Appl, GENy
DatabasebasebasebaseCANbedded)
CANbedded)
CANbedded)
CANbedded)
basis
basis
basis
basis
for ECU 1
for ECU 2
for ECU 3
for ECU 4
ECU1
ECU3
CAN
CANoeECU2
ECU4
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 4
:
Introduction
Almost the same communication / diagnostic tasks for all ECUs
T Save precious development time for your core application
T Avoid developing already existing solutions
>> use Standard Software Components
Application Software
(ECU-specific)
Software for Network
Communication and
Diagnostic
(Bus specific, same for all ECU
in one Bus system)
ECU1
ECU3
CAN
CANoeECU2
ECU4
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 5
:
Tool Chain – Software Components
Your Task- Vector’s SolutionsGenerationOILOIL ConfigurationOperating System
Application
osCAN
Application
CDDTCANdelaODXFlash Programming
Communication Stack
StudioCDDCAN
fblMessage
CAN han
bed dlin
ded gCAN Dia
bed gno
ded stics
LIN Communication
Re-Programming
Hardware control
CAN / LIN communication
GenerationToolCompiler
Linker
Customer specific
DatabaseExecutablehardware
CAN
db++CAN
fblCAN
alyzer
CAN
oeFlash
Code
CAN
apeCAN
LIN
Physical bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 6
:
Any ECU needs Communication Components
Application
EngineABSCANbedded Software
GearApplComponents
CAN Bus
RadioNavigationPowertrainMultimedia
DashboardGatewayCD-ChangerPhoneBody-CANDoorRoofSeatClimaComputerLINSensor 1Sensor 2Sensor 3© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 7
:
Any ECU needs Communication Components
Application
EngineABSCANbedded Software
GearComponents
RadioNavigationPowertrainMultimedia
DashboardGatewayCDPhoneChangerBody-CANDoorRoofSeatClimaComputerLINSensor 1Sensor 2Sensor 3© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 8
:
Inside The ECU
Application
Application
CANbedded Software Components
CAN Controller
Transceiver
CAN Bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 9
:
Inside The ECU
osCAN
Application
CANbedded Software Components
CAN Controller
Transceiver
CAN Bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 10
:
CAN Driver
osCAN
Application
CAN Driver
CAN Controller
Transceiver
CAN Bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 11
:


CAN Driver - detailed
Handling of Hardware Specific CAN Chip Characteristics and Provision of a Standardised Application InterfaceT
Initialisation
T
Transmission and Reception of Messages with Data-
and Functional Interface
T
Data- and Functional Notification
T
Indication
(Rx)
T
Confirmation
(Tx)
T
Overrun and Error Handling
T
Wakeup Detection
T
Efficient Search Algorithms for Software
Acceptance Filtering
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior wr
itten approval by Vector.
Slide 12
:
Interaction Layer
osCAN
Application
Interaction
Layer
CAN Driver
CAN Controller
Transceiver
CAN Bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 13
:


Interaction Layer - detailed
Interaction Layer with Signal InterfaceT
Sending of Messages According to the Specified
Transmission Types
T
Checking of Minimum Distances Between Transmit
Messages
T
Monitoring of Receive Messages
T
Setting of Default Values
T
Ensuring of Data Consistency
T
Signal Oriented Application Interface for Data
Exchange and Notification
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior wr
itten approval by Vector.
Slide 14
:
Transport Protocol
osCAN
Application
Interaction
Layer
Transport Protocol
CAN Driver
CAN Controller
Transceiver
CAN Bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 15
:


Transport Protocol - detailed
Transport Protocol for Data Exchange of Data Link Layer Independent InformationT
Segmentation of Data in Transmit Direction
T
Collection of Data in Receive Direction
T
Exchange of Communication Parameters
T
Control of Data Flow with Synchronisation of
Transmission and Reception
T
Detection of Errors
T
Message Loss
T
Message Doubling
T
Message Sequence
T
Additional Addressing Information (Normal,
Extended)
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior wr
itten approval by Vector.
Slide 16
:
Diagnostics Layer
osCAN
Application
Diagnostics
Layer
Interaction
Layer
Transport Protocol
CAN Driver
CAN Controller
Transceiver
CAN Bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 17
:


Diagnostics Layer - detailed
Diagnostics Layer According to ISO14229 / ISO14230 (Keyword Protocol 2000)T
Functional Interface for Diagnostic Services
T
Direct Processing of CAN Specific Diagnostic
Requests (Enable/Disable Normal Message
Transmission)
T
Negative Responses (e.g. Service not Available)
T
Exception Handling (e.g. Busy, Request Pending)
T
Address Handling (Detection of Response Service
Identification)
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior wr
itten approval by Vector.
Slide 18
:
Network Management
osCAN
Application
Diagnostics
Layer
Interaction
Network
Layer
Management
Transport Protocol
CAN Driver
CAN Controller
Transceiver
CAN Bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 19
:


Network Management - detailed
Network Management to Control the CAN BusT
Synchronized Transition to Bus Sleep
T
Determination of Net Configuration at Startup
T
Monitoring of Net Configuration During Operation
T
Error Recovery after Bus-Off
T
Provision of Network Status Information
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior wr
itten approval by Vector.
Slide 20
:
Measurement and Calibration Protocol - XCP
osCAN
Application
Diagnostics
Layer
Universal
Measure-
Interaction
Network
ment
Layer
Management
And
Calibration
Transport Protocol
Protocol
CAN Driver
CAN Controller
Transceiver
CAN Bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 21
:


Universal Measurement and Calibration Protocol - detailed
Universal Measurement and Calibration Protocol for Measurement and Calibration on various bus systemsT
Read and Write Access to Various Memory Locations
T
Different Data Access Methods (Polling, Cyclic and
Event-Triggered)
T
Flash Programming
T
Simultaneous Handling of Several Controls
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior wr
itten approval by Vector.
Slide 22
:
Communication Control Layer
osCAN
Application
Diagnostics
Layer
UniversalMeasure-Interaction
Network
mentLayer
Management
And Communication
CalibrationControl
Transport Protocol
ProtocolLayer
CAN Driver
CAN Controller
Transceiver
CAN Bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 23
:


Communication Control Layer
Communication Control LayerIntegration of the Software Components
T
CAN Driver,
T
Interaction Layer,
T
Network Management,
T
Transport Protocol
T
Diagnostics
Abstraction for different
T
Vehicle manufactureres
T
Microcontrollers
T
Compiler/linker
T
CAN Controllers / Transceivers
T
Configured via Generation Tool
T
Global Debug Mechanism
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior wr
itten approval by Vector.
Slide 24
:
Generation Tool
osCAN
Application
Diagnostics
Layer
Universal
Measure-
Interaction
Network
ment
Layer
Management
And
Communication
Calibration
Control
Transport Protocol
Protocol
Generation
Layer
Tool
CAN Driver
CAN Controller
Transceiver
CAN Bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 25
:


Generation Tool - detailed
Generation Tool for Parameters and ConfigurationT
Used for the Complete Set of Vector’s CAN Software
Components
T
Driven by Communication Matrix ( Network
Database)
T
User Specific Settings for Each Node (Application
Database)
T
Part of Vector’s Tool Chain
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior wr
itten approval by Vector.
Slide 26
:
CANbedded Software Components and Standards
/ISO OSEK os CAN
Application
ISO/ISO OSEKDiagnostics
/ISO OSEKASAMLayer
Universal
Measure-
Interaction
Network
ment
Layer
/ISO OSEKManagement
And
Communication
Calibration
Control
Transport Protocol
Protocol
Generation Layer
ToolHISCAN Driver
CAN Controller
Transceiver
CAN Bus© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 27
:

Generation Process
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 28
:
Document Outline
1.1.57 - Startup_PSA_CANbedded
User Manual <User Manual Titlel>1.1.59 - Startup_PSA_CANbeddeds







User Manual Startup with PSA A Step by Step Introduction
Version 1.0.0 English
Manual History Author Date Version Details Klaus Emmert
2009-07-24 0.1
Creation
Manuela Scheufele
Klaus Emmert
2009-10-01 1.0.0
Released
Manuela Scheufele
Reference Documents No. Source Title Version 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 Startup with PSA
Manual Information
Inhaltsverzeichnis
1 Manual Information 5 1.1 About this user manual 6 1.1.1 Certification 7 1.1.2 Warranty 7 1.1.3 Registered trademarks 7 1.1.4 Errata Sheet of manufacturers 7 2 Getting Started 8 2.1 How to use this Manual 9 2.2 Start immediately or need Basic Information? 9 3 A few STEPS to Basic ECU with PSA CANbedded 10 3.1 STEP What do you need before start? 11 3.2 STEP Installation 11 3.2.1 BSW folder 12 3.2.2 Installation GENy Framework 12 3.3 STEP Configuration Tool and DBC File 13 3.3.1 Start GENy with a Link or a Batch File 13 3.3.2 Preparations in GENy 14 3.3.3 Settings for the CANbedded Software Components 18 3.4 STEP Generate Files 23 3.5 STEP Add CANbedded to Your Project 24 3.6 STEP Adapt your Application Files 24 3.6.1 Including, Initialization and Cyclic Calls 25 3.6.2 Application Handling of User Requests and the Bus Communication 25 3.6.3 CANbedded Software Component Callback Functions 26 3.7 STEP Compile and Link your Project 27 3.8 STEP Test it via CANoe 27 3.9 STEP Test and Release Hints 28 4 Basic Information 29 4.1 Documentation Structure for CANbedded Components 30 4.1.1 Configuration Tools and Files 32 4.2 An Overall View 34 4.3 An ECU – a More Detailed View 35 4.3.1 Generic Usage of CANbedded Software Components 35 4.3.2 Independent Software Components in an ECU 36 4.3.3 Requesting and Releasing Bus Communication 36 4.3.4 Multiple Channel ECU 36 4.3.5 Availability and Usage of XCP within the CANbedded Stack 37 4.3.6 Start-up Time of the CANbedded Stack 37 4.3.7 Resources of the CANbedded Stack 37 5 Further Offers 38 5.1 Hotline 39 5.2 Training Classes 39 © Vector Informatik GmbH
Version 1.0.0
- 3 -
Manual Information
User Manual Startup with PSA
5.3 Integration Support 39 5.4 Integration Review 39 6 Additional Information 40 6.1 Persistors 41 6.1.1 Update Persistors – Install current Version 42 7 FAQs 45 7.1 Introduction 46 7.2 Frequently Asked Questions 46 8 Address table 47 9 Glossary 49 10 Index 50 - 4 -
Version 1.0.0
© Vector Informatik GmbH
User Manual Startup with PSA
Manual Information
1 Manual Information In this chapter you find the following information: 1.1 About this user manual page
6 Certification Warranty Registered trademarks Errata Sheet of manufacturers © Vector Informatik GmbH
Version 1.0.0
- 5 -







Manual Information
User Manual Startup with PSA
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.
- 6 -
Version 1.0.0
© Vector Informatik GmbH


User Manual Startup with PSA
Manual Information
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.
© Vector Informatik GmbH
Version 1.0.0
- 7 -
Getting Started
User Manual Startup with PSA
2 Getting Started In this chapter you find the following information: 2.1 How to use this Manual page
92.2 Start immediately or need Basic Information? page
9 - 8 -
Version 1.0.0
© Vector Informatik GmbH
User Manual Startup with PSA
Getting Started
2.1 How to use this Manual Step by Step
Just follow the description step by step.
Basic Information
To find basic information about CANbedded (see section
Basic Information on page
29). FAQ
To find answers to special questions without reading the whole document use the
FAQ list (see se
ction FAQs on page 45). 2.2 Start immediately or need Basic Information? You are Novice or
This User Manual is designed to fit the needs and expectations of the developers of
Expert?
the ECUs. Of course there are differences in planning the software architecture. But
the core is almost the same for all types of ECUs.
Your aim is to implement the CANbedded software components as fast as possible.
Perhaps you already know the basic concepts of CANbedded?
Then let’s start with the step-by-step introduction in how to startup with PSA
CANbedded software components regardless of the ECU type. You will find remarks
if the handling differs for a specific ECU type.
For more basic information about CANbedded refer to (see section
Basic Information
on pag
e 29). © Vector Informatik GmbH
Version 1.0.0
- 9 -
A few STEPS to Basic ECU with PSA CANbedded
User Manual Startup with PSA
3 A few STEPS to Basic ECU with PSA CANbedded In this chapter you find the following information: 3.1 STEP What do you need before start? page 113.2 STEP Installation page 11 BSW folder Installation GENy Framework 3.3 STEP Configuration Tool and DBC File page 13 Start GENy with a Link or a Batch File Preparations in GENy Settings for the CANbedded Software Components 3.4 STEP Generate Files page 233.5 STEP Add CANbedded to Your Project page 243.6 STEP Adapt your Application Files page 24 Including, Initialization and Cyclic Calls Application Handling of User Requests and the Bus Communication CANbedded Software Component Callback Functions 3.7 STEP Compile and Link your Project page 273.8 STEP Test it via CANoe page 273.9 STEP Test and Release Hints page 28 - 10 -
Version 1.0.0
© Vector Informatik GmbH


User Manual Startup with PSA
A few STEPS to Basic ECU with PSA CANbedded
3.1 STEP What do you need before start? CANbedded
Did you get the CANbedded delivery?
3.2 STEP Installation The following list shows the tools and software (C Code or Library) that are included
in the CANbedded delivery and what has to be installed further on.
¼
Vector CANbedded SIP CBDxxxxxxx Rxx <name>_Setup.exe BSW modules, exact content depends on your delivery, the details are outlined in
the following illustration.
¼
GENyFramework_<version>-PGP-sda.exe downloaded from the FTP server. The framework of the configuration tool GENy.
Your Delivery from
Unpack the Delivery Vector
Start the
Setup.exe and follow the installation dialogs.
Situation after
Use the
Start|Programme|Vector CANbedded …| to find the installation.
installation
Try to keep a proper You will find the software components in the following file structure or in a similar one.
file structure to keep
the overall view
throughout the
complete
development process
Example File
Structure after
Installation
© Vector Informatik GmbH
Version 1.0.0
- 11 -



A few STEPS to Basic ECU with PSA CANbedded
User Manual Startup with PSA
Info: It is up to you to use a different file structure. This is merely a recommendation
and the result of the installation process.
3.2.1 BSW folder You will find the following files in the BSW folder:
CAN Driver
CAN - CAN Driver can_drv.c – can_def.h – can_inc.h – cancel_in_hw_user_cfg.cfg
(delete underscore for usage)
Info: Dependent on the CAN Driver there could be additional files.
Network
NM – Network Management Management
Generic_precopy.c – INM_Osek.c – INM_Osek.h – Stat_Mgr.c – Stat_Mgr.h
Interaction Layer
IL - Interaction Layer il.c – il_def.h – il_inc.h
Transport Protocol
TP – ISO Transport Protocol tpmc.c – tpmc.h
Diagnostics Layer
Diag - Diagnostics Layer CANdesc The files will be generated completely
Communication
CCL - Communication Control Layer Control Layer
ccl.c – ccl.h – ccl_inc.h
_Common
v_def.h – v_ver.h – sip_vers.c – sip_vers.h – vstdlib.c – vstdlib.h
Info: The SIP check ensures that all used CANbedded components fit together. If not,
a pre-processor error will occur. Please make sure that the SIP check file is complied
with your application.
Universal
XCP - Universal Measurement and Calibration Protocol Measurement and
Calibration Protocol
_xcp_appl.c - _xcp_appl.c - xcp_can.h - XcpProf.c - XcpProf.h
3.2.2 Installation GENy Framework Install GENy
Open the link from the delivery description to open the FTP server and save
Framework
GENyFramework_<version>-PGP-sda.exe on your computer. Start
GENyFramework_<version>-PGP-sda.exe and enter the passphrase (password
from e-mail) for GENy Framework.
- 12 -
Version 1.0.0
© Vector Informatik GmbH
User Manual Startup with PSA
A few STEPS to Basic ECU with PSA CANbedded
The GENyFramework_<version>.exe will be unpacked. Start this setup file, follow the
installation hints and enter the path to your delivery. GENy.exe will be installed at this
path.
3.3 STEP Configuration Tool and DBC File Follow the explanations for the basic settings of the CANbedded software
components in the GENy configuration tool.
3.3.1 Start GENy with a Link or a Batch File Working with GENy
There are different ways to start GENy and to load a configuration. By default you can
start the configuration tool and load the configuration afterwards. The more
comfortable way of using GENy is via a link or a batch file where you can start the
tool directly within your project with your project as a parameter.
Start GENy with a Link or a Batch File This is the recommended way if more than one CANbedded stack or configuration
setup is to be used in parallel. Link and batch file must contain the following
information:
¼ Path to the
GENy.exe ¼ Path to component
DLLs and
license file
¼ Optional: Path to an existing configuration file
.GNY.
© Vector Informatik GmbH
Version 1.0.0
- 13 -




A few STEPS to Basic ECU with PSA CANbedded
User Manual Startup with PSA
Example: Link
Enter the following path information into the Target area of the MS Window control:
yourPath\GENy\geny.exe /m ..\yourPath\_GENy\Components
/c ..\yourPath\GENyProject.gny
Example: Batch file Please write all commands below in ONE line into the batch file!
..\yourPath\GENy\geny.exe /m ..\yourPath\_GENy\Components '/c
..\yourPath\GENyProject.gny
3.3.2 Preparations in GENy New Configuration
Create a new configuration via File / New or the New Button
.
- 14 -
Version 1.0.0
© Vector Informatik GmbH



User Manual Startup with PSA
A few STEPS to Basic ECU with PSA CANbedded
Setup Dialog
Select your
Preconfiguration,
Microcontroller,
Derivative and your
Compiler in the
setup dialog.
Data base file and
Component
Click on
to add a channel and select CAN as channel type. In the Channel
Selection
Setup window make all entries concerning a certain channel. Name the channel (if
you dislike Channel x), browse for your database (DBC) and select one (or more for a
multiple Channel ECU) database nodes. For Gateways you have to add additional
Channels.
© Vector Informatik GmbH
Version 1.0.0
- 15 -



A few STEPS to Basic ECU with PSA CANbedded
User Manual Startup with PSA
Use the Software
Component Selection view to switch the necessary components
on.
Now we could go on and adjust the path where GENy generates the files in.
Open the Generation Directories window via
Configuration / Generation Paths…or
use
Now save the configuration. This file will look like: *.gny.
Define paths for the
generated files
¼ Enter the
Root path for relative directories. Confirm with tab.
¼ To get the files for the different components generated in specific folders, add a
relative path on the appropriate
Path field for the component and for the
Filetype.
- 16 -
Version 1.0.0
© Vector Informatik GmbH

User Manual Startup with PSA
A few STEPS to Basic ECU with PSA CANbedded
You also could enter an absolute path in the
Path field.
¼ Always check your settings for all components under
Resolved Path before
confirming via
[OK].
Info: The (C) behind
Filetypes indicates that these are files in C language.
Now save the configuration (.gny file) again.
© Vector Informatik GmbH
Version 1.0.0
- 17 -



A few STEPS to Basic ECU with PSA CANbedded
User Manual Startup with PSA
3.3.3 Settings for the CANbedded Software Components Navigation View in
The settings for the components are done via the Navigation and the Configuration
GENy
view. Any component you have selected in the Software Component Selection view is
listed in the navigation tree below Components
Let us go through all selected components and do the necessary settings.
Info: Remember that the channel is the major criteria where to find a configuration
element of the component. E.g. the setting of the baud rate is in the component
DrvCan_xxx and it is a channel specific setting.
The different
HW_XXXCPU components are
Some settings like the used derivative and compiler are very hardware dependent.
They are selected in the HW_xxxCPU tree. Make sure that the derivative, the
compiler and the register addresses are set correctly.
DrvCan_xxx Here you configure the CAN Driver. Use the default settings for the first start up.
DrvCan_xxx / Channel / Channel X The two most important settings here are the baud rate and the acceptance filters.
Click on the buttons […] to open the corresponding windows and do the necessary
settings (refer to GENy Online Help how to work with these two windows).
Filters and Bus
timing
All further channel specific settings for the CPU are also hardware dependent.
NameDecorator With the NameDecorator you can adjust the names of macros, functions and flags
that are generated. Use the default settings for the first start up
- 18 -
Version 1.0.0
© Vector Informatik GmbH

User Manual Startup with PSA
A few STEPS to Basic ECU with PSA CANbedded
Tp_Iso15765 Here you configure the ISO Transport Protocol. Use the default settings for the first
start up.
Il_Vector Here you configure the Vector Interaction Layer. Use the default settings for the first
start up.
Inirect NM Here you configure the Network Management. Use the default settings for the first
start up
Diag_CanDesc_UDS Here you configure the diagnostic component CANdesc. Use the default settings for
the first start up.
Ccl_core – Communcation Control Layer First open the Configuration View for the Ccl__Core. There will be no Communication
Request available. You have to add this.
Click on the Add
[…] button of the
CCL Communication Request and a new entry in
the Navigation view will be shown.
Name the
One Communication Request appears without name, so you can only see the letter
Communictaion
icon. Click on this empty icon and get the configuration view like in the following
Request
figure.
© Vector Informatik GmbH
Version 1.0.0
- 19 -



A few STEPS to Basic ECU with PSA CANbedded
User Manual Startup with PSA
Enter the name for this Communication Request. In this case
MyCommunicationRequest (CCL_MyCommunicationRequest: the configuration tool
adds the CCL as prefix to the name.) is now the parameter for the functions to control
the ECU states. We will use this parameter in the following software example, too.
Info: Make sure that the names for the requests are unique in the whole system. The
names have to be ANSI C compliant.
Using CCL many things become easier for the application. So the complete
initialization and the cyclic calls could be done by these components. Just check the
box
[CANbedded Handling] in the Ccl__core configuration view (see Figure 6 8).
Now we could switch to the CCL configuration view by choosing Ccl_core in the
navigation view.
We switched the
CANbedded Handling on, so we have to choose between the
Schedule Task and the
Task Container from the pull down menu. What does this
mean?
We let the CCL handle the initialization and control of the components. Control means
in this case the cyclic calling of all necessary CANbedded task functions and this
could be done in two ways.
- 20 -
Version 1.0.0
© Vector Informatik GmbH



User Manual Startup with PSA
A few STEPS to Basic ECU with PSA CANbedded
The easy way via
Schedule Task Schedule Task
The option
Schedule Task is the easiest way for the application programmer. The
function CclScheduleTask() will be generated and handles all cyclic CANbedded
calls internally.
Your application has to call this single function and all component tasks will be called
in the correct cycle time. The cycle time for this schedule task must be a common
divisor of all selected CANbedded call cycle values.
See
Cross reference: [1] (see se
ction Reference Documents on page
2). for more details on Schedule Task concept.
Container
Task Container The Task Container provides one function for all tasks with the same call cycle. The
application has to call these tasks with the correct call cycle and need not to know
which components are affected.
E.g. for all 10ms Tasks the task container function Ccl_10_0msTaskContainer is
generated. See
Cross reference: [1] (see se
ction Reference Documents on page
2) for more details on the Task Container concept.
Transceiver Settings What is left now is to provide the CCL with the information concerning the transceiver
you use. Open the channel specific configuration view of the CCL component as you
see in the following figure. Use the pull down menu to select your Transceiver Type.
Info: GENy supports the most of the common transceivers. If your transceiver is not
in this list, choose < Unknown >. For this case the application has to provide the
transceiver handling via three callback functions.
© Vector Informatik GmbH
Version 1.0.0
- 21 -





A few STEPS to Basic ECU with PSA CANbedded
User Manual Startup with PSA
Select your
Transceiver
Transceiver
After you have selected your Transceiver, you have to add your
Transceiver Config Configuration File
File. This file includes information for additional transceiver coding.
Use the
[…] button to load your
Transceiver Config File.
Ports
Dependent on the transceiver you select there will be displayed a corresponding
amount of ports, in this case the Enable Port, the Standby Port, the Error Port and the
Wake Up Port.
Info: To do the following settings you need a deep insight in the hardware of your
project.
Now you have to tell the CCL component how to control the ports of the transceiver.
Please refer to
Cross reference: [1] (see se
ction Reference Documents on page
2) for more details how to set up the transceiver handling.
Transceiver Unknown In this case you cannot do any further transceiver setting in the GENy as you see in
the illustration below.
Unknown
For an unknown transceiver the CCL does not know how to handle the transceiver.
- 22 -
Version 1.0.0
© Vector Informatik GmbH


User Manual Startup with PSA
A few STEPS to Basic ECU with PSA CANbedded
Transceiver
This has to be done by the application. For this reason the application is provided with
3 callback functions to handle this unknown transceiver:
ApplCclInitTrcv for transceiver initialization
ApplCclWakeUpTrcv for transceiver wake-up handling and
ApplCclSleepTrcv for transceiver sleep handling.
The code for these callback functions is very hardware dependent. Refer to the
hardware manual of you transceiver for more information
3.4 STEP Generate Files Let GENy generate the files to the appropriate, previously defined folders.
Now all configuration settings for the CANbedded software components are done and
we could go on with the generation process. Click the icon Generate System.
Make sure the shown
target paths are
correct
In the
Output View / Generations you see all generated files with the corresponding
paths. The Generated Files from the System Configuration view show the generated
© Vector Informatik GmbH
Version 1.0.0
- 23 -


A few STEPS to Basic ECU with PSA CANbedded
User Manual Startup with PSA
files in a sorted manner.
Info: Use this information to check if the files are generated in the desired paths.
The files for the CANdesc component are also generated, but via a different
generator. So they are not displayed in one of these windows.
There are also generated XML files. These files are for internal use of GENy only and
you must not change them.
Please check the output window also for (orange) warning and (red) error messages.
If there are some, clarify the reason. For the final software setup, no warnings or
errors shall be reported!
3.5 STEP Add CANbedded to Your Project Add the CANbedded C and H files to your project or makefile.
Your Build
What to do in this step depends on your development environment. Perhaps you work
environment
with a makefile?
You have to add the files of CANbedded to your project. These are the files of chapter
STEP Configuration Tool and DBC File on page
13 and the generated ones to the
previous step.
Info: Always make sure that the path you generate the files in and the path your
compiler is working on are the same!
At this point in time you are not able to compile and link the project. The files should
be complete but there are several adaptations for you to do in your application.
Go on with the next step.
3.6 STEP Adapt your Application Files Now your application files must be modified to use the CANbedded software
components (includes, cyclic calls, initialization, callback functions).
Include, initialize and Now all files for CANbedded and CANdesc are included in your project and we can
call the components go on to do the necessary adaptations in your application files.
cyclically.
These adaptations can be split in two categories:
Then connect
¼ Include, initialize and do the cyclic calls for the CANbedded software components
CANdesc with your
(use the component specific documentation for details).
application.
¼ Connect the CANbedded software components to your application
As you use CCL this is very easy to do.
- 24 -
Version 1.0.0
© Vector Informatik GmbH




User Manual Startup with PSA
A few STEPS to Basic ECU with PSA CANbedded
3.6.1 Including, Initialization and Cyclic Calls Pre-compile
Including If the Checkbox
CANbedded Handling is checked then you only have to include two
headers, the v_inc.h (that is generated) and the ccl_inc.h in this order. This header
includes all necessary header files for the selected Software Components.
Info: If you do not use CCL CANbedded Handling you have to do the “includes” for all
Software Components on your own.
Pre-compile
Initialization With the CCL CANbedded Handling the Initialization becomes very simple.
CclInitPowerOn(); is the only function for the initialization of all selected
CANbedded Software Components.
Info: Without CCL CANbedded Handling all component tasks must be called in the
correct order.
Call cyclic tasks
Cyclic Calls The handling of the cyclic component task calls depends on the settings on the CCL
configuration view (Schedule Task or Task Container see Figure 6 8). As mentioned
above you only have to call one function if you select Schedule Task:
CclScheduleTask();
make sure that the call cycle is a common divisor of
all tasks call cycles
In case of the Task Container you have to call all existing task container functions.
These functions look like this:
Ccl_10_0msTaskContainer();
Make sure that you call all these tasks, each with the correct call cycle and offset.
Info: The functions to control the cyclic task calls are generated in the file ccl_par.c.
Especially when using the task container functionality, refer to this file to get all
generated functions.
Info: If CCL CANbedded Handling is not checked, your application must do all the
task calls for the CANbedded software components on its own and in the correct
cycle time.
3.6.2 Application Handling of User Requests and the Bus Communication As mentioned in the chapter
Requesting and Releasing Bus Communication on page
36 the users can request or release the bus communication. Remember to control the
modes via your application and the functions:
CclRequestCommunication( CCL_MyCommunicationRequest )
CclReleaseCommunication( CCL_MyCommunicationRequest )
The parameter is the handle (you configured in the configuration tool) with CCL_ as
© Vector Informatik GmbH
Version 1.0.0
- 25 -




A few STEPS to Basic ECU with PSA CANbedded
User Manual Startup with PSA
prefix.
3.6.3 CANbedded Software Component Callback Functions Callbacks are still
At this point in time you would be able to compile but not to link. The callback
missing
functions of the components CANdesc and CCL are still missing. The detailed
description of these callback functions is given in the TechnicalReference of each
component. In the following we only show the callback functions and introduce the
templates to be able to compile, link and run the system basically.
Diagnostic callbacks
Callback Functions for Diagnostics Any diagnostics service needs at least one (maximum three) callback function
(Handlers, see the documentation for CANdesc). Dependent on the amount of
diagnostic services and their settings there are different callback functions. You find
the generated prototypes for the diagnostic callback functions in appdesc.h.
The diagnostic callback functions are provided in the generated template file called
ApplDesc.c. Add this template to your project.
Info: Remember to fill the callback functions later. This is only to be able to get a
basically working system that is the base for further development.
Read the comments in the template carefully. This will help you better understanding
how to use the template.
CCL callbacks
Callback Functions For Communication Control Layer (CCL) There are several callback functions to get the CCL running. The detailed description
of how to handle these functions correctly is in the
Cross reference: TechRef CCL
This is the list of all necessary callback functions:
vuint8
ApplCclCanStandby( vuint8 sleepResult )
{
return kCclNoRepeatCanSleep; /*is defined to 0*/
}
Info: This callback function is already part of the CCL template.
void
ApplCclTrcvGoToSleepWaitTime( void ){}
Info: This function is only necessary for some transceiver derivatives
void
ApplCclWakeUpTrcv( void ){}
- 26 -
Version 1.0.0
© Vector Informatik GmbH



User Manual Startup with PSA
A few STEPS to Basic ECU with PSA CANbedded
void
ApplCclSleepTrcv( void ){}
void
ApplCclInitTrcv( void ){}
Info: These functions are only necessary in case of you have selected UNKNOWN as
Tranceiver Type on the CCL configuration view.
void
ApplCclBusOffStart ( void ){}
void
ApplCclBusOffEnd( void ){}
Info: The application will be informed in case of a bus off.
void
ApplCclInit( void ){}
Info: Remember to fill the callback functions later. This is only to be able to get a
basically working system that is the base for further development.
3.7 STEP Compile and Link your Project Compile and link the complete project and download it to your test hardware or
development environment.
It is almost done!
Now we have all includes, all initializations, the components do have the cyclic calls
of their task functions and all callback functions are provided (but not programmed
yet).
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.
3.8 STEP Test it via CANoe Via an appropriate Tester (e.g. CANoe) check the results.
WELL DONE!
The last step is to test what we have done until now. This is no detailed test. It is just
to make sure that we have bus communication.
The ideal tester would be CANoe from Vector Informatik. Connect your hardware to
your CANcard, start CANoe, set the correct baud rate and have a look at the trace
window.
You see any bus communication? No error frames?
© Vector Informatik GmbH
Version 1.0.0
- 27 -


A few STEPS to Basic ECU with PSA CANbedded
User Manual Startup with PSA
Congratulations! The basic step is done, the CANbedded software components are basically working
together with your application.
That is the base you can start from to optimize your system. Remember the callback
functions we left empty and refer to
Cross reference: [1] (see se
ction Reference Documents on page
2) for more detailed information.
3.9 STEP Test and Release Hints Special Caution: Before the SOP it is your duty to recalculate the automatically
generated values for the baud rate and the acceptance filters. Make sure you have
the current version of the necessary hardware description available to validate the
used (CAN) controller settings.
- 28 -
Version 1.0.0
© Vector Informatik GmbH
User Manual Startup with PSA
Basic Information
4 Basic Information In this chapter you find the following information: 4.1 Documentation Structure for CANbedded Components page 30 Configuration Tools and Files 4.2 An Overall View page 344.3 An ECU – a More Detailed View page 35 Generic Usage of CANbedded Software Components Independent Software Components in an ECU Requesting and Releasing Bus Communication Multiple Channel ECU Availability and Usage of XCP within the CANbedded Stack Start-up Time of the CANbedded Stack Resources of the CANbedded Stack © Vector Informatik GmbH
Version 1.0.0
- 29 -


Basic Information
User Manual Startup with PSA
4.1 Documentation Structure for CANbedded Components Your delivery
To be able to get along with the delivery fast and easy this chapter will give you an
overview of the delivery and its documents.
Always read the User The first document you should read is this one, the startup user manual. It gives you
Manual first
an overview of all components and of how to put this stuff together and get it to work
basically.
Components
The delivery contains different components like Interaction Layer, CAN Driver, etc. A
component is normally documented in the following way.
Caution: If you use the CCL component, read its manuals and references first after
this user manual. CCL makes the handling of the other components very simple.
Different kinds of
UserManual_<ComponentName> documents
Very easy entry in the software component. It contains a step-by-step introduction of
how to use this component. This is not available for all components.
TechnicalReference_<ComponentName> Very detailed description of the component and its functionality. It gives you a very
- 30 -
Version 1.0.0
© Vector Informatik GmbH

User Manual Startup with PSA
Basic Information
technical sight on the component.
TechnicalReference_<ComponentName>_OEM/HW Some features of the component are very hardware-dependent or differ from one
OEM to the other? Then this kind of document is there to explain these special
technical aspects.
Application Note Very special topics of the component, especially in connection with other components
are described in application notes. Not all components do have application notes.
GENy – Configure your components The configuration tool GENy provides two major ways of documentation. The
OnScreen Help view and the Online Help.
Online Help The GENy Online Help gives you information about the generic handling of GENy. It
explains the different GENy windows, shows how to work with the GUI and offers
How-To-Descriptions for the frequently asked questions like how to set up a
configuration, how to update the database file, etc.
OnScreen Help This is an area in the GENy GUI where specific information about the presently
activated configuration element is displayed. This provides you with the information
you need to have to decide whether to use a GENy option or not. The more detailed
description and technical background can be found in the technical references of the
configured component (see above).
To guarantee quality it is obvious to use standard software components for the
communication part of your ECU. The software components of Vector Informatik are
called CANbedded and are shown in the figure below via grey boxes with red
inscription. The application is on top level and uses the functionality of the
CANbedded software components for Communication and Diagnostics.
CANbedded Layers
© Vector Informatik GmbH
Version 1.0.0
- 31 -
Basic Information
User Manual Startup with PSA
Hardware Interface
CAN Driver The CAN Driver handles the hardware specific CAN chip characters and provides a
standardized application interface. The CAN Driver for the PSA can transmit and
receive standard (11 bit) CAN Ids.
Transmission modes
Interaction Layer
and more…
The Interaction Layer (IL for short) is responsible for the transmission of messages
according to specified rules, monitoring receive messages, timeout monitoring, etc. It
provides a signal oriented application interface for the application.
Break the limitation
Transport Protocol of 8 data bytes
The CAN protocol is restricted to 8 data bytes per message. But in some cases (e.g.
diagnostics) you need to exchange much more than 8 data bytes. The segmentation
of the data, the monitoring of the messages and the timeout handling is done by the
Transport Protocol (TP for short).
UDS
Diagnostics The diagnostics layer (DIAG for short) works according to ISO14229 (UDS) and PSA
specifications.
Control transition to
Network Management bus sleep state
The Network Management (NM for short) is the component to control the bus, to
synchronize the transition to bus sleep, error recovery after bus-off, etc.
Measurement and
Universal Measurement and Calibration Protocol (XCP) Calibration
This is the Software Component for measurement and calibration on several bus
systems. To mention some feature: read and write access to various memory
locations or flash programming. XCP is not part of the official CANbedded delivery
process to PSA. See chapter
Availability and Usage of XCP within the CANbedded
Stack on page
37 within the CANbedded stack for more details.
The powerful
Communication Control Layer (CCL) component
This component provide the following features: communication bus access,
encapsulation of network management handling, handling of the CANbedded stack,
control of the transceiver and the handling of the start-up delay time.
4.1.1 Configuration Tools and Files Configuration tools
The delivery contains the MS Windows based configuration tool GENy. It is used to
and files
adapt the delivered source code via project specific generated data and configuration
defines to your project needs.
There is always the same concept behind the usage of Vector´s CANbedded software
components (red labled boxes).
- 32 -
Version 1.0.0
© Vector Informatik GmbH


User Manual Startup with PSA
Basic Information
The standard
generation process
for Vectors Software
Components.
CANdesc is a
completely
generated Software
Component.
GENy combines the information of the network database (DBC file) and your
application specific configuration for the CANbedded components. As a result it
generates files (header: configuration files and signal interface, source: parameters)
containing the upper information. You have to compile/link these files together with
the source code of the CANbedded software components and your application files.
Derived from this concept there are three sorts of files:
¼ Generated files (Configuration, Signal Interface, Parameters) you must not
change manually because the next generation process will delete your changes
(e.g. can_cfg.h). Changes can only be done via the configuration tool.
¼ Files that form a component (CANbedded software components) and must not be
changed at all (e.g. can_drv.c).
¼ Files for your application.
Info: The network database (
DBC file) is provided by Vector Informatik if it is ordered
or must be created as active work of TIER1. Each CAN bus has its own DBC file
describing the communication for that system.
The DBC file can be viewed and also edited by the tool CANdb++. CANdb++ is part
of each CANoe/CANstress/CANscope package but can also be purchased separately
as a CANdb++/Admin version.
The diagnostic description for CANdescBasic is part of the CANbedded delivery
© Vector Informatik GmbH
Version 1.0.0
- 33 -


Basic Information
User Manual Startup with PSA
4.2 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
e.g. CAN, FlexRay 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.
- 34 -
Version 1.0.0
© Vector Informatik GmbH


User Manual Startup with PSA
Basic Information
Application Software
Software for Network
Communication and Diagnostics
4.3 An ECU – a More Detailed View 4.3.1 Generic Usage of CANbedded Software Components Initialization, cyclic
To get almost all components to work your application has to initialize the
calls and callback
components and call certain component task functions cyclically. This is to derive the
functions.
time base each component needs. You can adjust the cycle times on the
component’s configuration views of configuration tool GENy.
No rule without exception: For some components there is more than one task to be called within a predefined
cycle (e.g. Interaction Layer: Rx and Tx task).
The CAN Driver has no task to be called (unless used in polling mode) because it is
an event driven component and uses interrupts.
While the components are running there are different callback functions for the
application to control the components’ behavior.
The PSA CANbedded stack contains usually the CCL (Communication Control
Layer), which will ease up the integration task. Please refer to
Cross reference: [1] (see se
ction Reference Documents on page
2) for more details.
© Vector Informatik GmbH
Version 1.0.0
- 35 -

Basic Information
User Manual Startup with PSA
4.3.2 Independent Software Components in an ECU N:1 relationship
A typical ECU application is divided up into multiple functional blocks. Each functional
block has its own tasks and might be implemented by another programmer. To ease
up independent and decoupled development of application code, the CANbedded
stack provides independent network control and signal access API’s for each
functional block.
4.3.3 Requesting and Releasing Bus Communication Bus communication (network control) is requested and released using CCL APIs. If a
functional block needs bus communication, a communication request is set via
CclRequestCommunication. If no bus communication is needed in the functional
block, it releases the communication request via CclReleaseCommunication.
Please note that the request and release is asynchronous. I.e. there is a delay
between requests and availability of network communication. The network has to be
handled after a release request until it is really stopped (state BusSleep).
4.3.4 Multiple Channel ECU More than one
Multiple channels ECU means to control more than one physical CAN channel. For
physical channel
each channel you need a database. To generate for a multiple channel ECU, add as
much database as channel to your configuration tool setup.
Make sure that you do the necessary settings in the tool for each channel. Below any
component there is a channel tree that contains the settings for the different
channels.
- 36 -
Version 1.0.0
© Vector Informatik GmbH

User Manual Startup with PSA
Basic Information
4.3.5 Availability and Usage of XCP within the CANbedded Stack Part of the
XCP is part of the official CANbedded delivery process to PSA.
CANbedded delivery
for PSA
4.3.6 Start-up Time of the CANbedded Stack The CANbedded software components usually need very little time for initialization
due to mainly data structures in the RAM are initialized.
The hardware specific drivers like the CAN or LIN driver access also hardware
registers of the microcontroller. The runtime for this depends strongly on the number
of registers, the speed of the internal µC data bus and, depending on the µC, the
necessary algorithm to access and control these registers (e.g. requesting the access
and waiting till the internal µC bus grants the access).
All in all the runtime of the CANbedded stack initialization highly dependents on the
configuration (e.g. how many messages have to be initialized, what does the
application do within the used callback functions, etc.).
Info: Please refer to the resource documentation Excel sheet stored in the _doc
directory of the delivery for details about your specific delivery package.
Power Supply
Some typical, time-consuming actions during start-up outside of the CANbedded
stack are :
PLL
¼ Switching on the power supply and wait till it is stable: a few [ms].
EEPROM
¼ Switching on the PLL and wait till it is stable: [µs] up to few [ms].
RAM
¼ Access to serial EEPROM (internal and external): can be very time consuming
SPI
¼ RAM check: can be very time consuming
Initialization of external hardware via SPI: can be very time consuming
4.3.7 Resources of the CANbedded Stack The CANbedded stack is optimized for minimum RAM and ROM usage and can
therefore be widely configured to the very special needs of your project.
Any supported but in the concrete project unused feature can be disabled via
compiler switches during compile time so that this functionality does not consume
RAM, ROM and runtime. It is therefore difficult to give an exact amount of resource
needs for the concrete project upfront.
© Vector Informatik GmbH
Version 1.0.0
- 37 -
Further Offers
User Manual Startup with PSA
5 Further Offers In this chapter you find the following information: 5.1 Hotline page 395.2 Training Classes page 395.3 Integration Support page 395.4 Integration Review page 39 - 38 -
Version 1.0.0
© Vector Informatik GmbH
User Manual Startup with PSA
Further Offers
5.1 Hotline The hotline is available by email or by phone from 13:00 to 16:00 (German time).
Hotline
Please
contact: Vector Informatik GmbH, 70499 Stuttgart
email6.1 Persistors page 41 Update Persistors – Install current Version - 40 -
Version 1.0.0
© Vector Informatik GmbH

User Manual Startup with PSA
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 or DCM/DEM in AUTOSAR environment.
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
Version

Additional Information
User Manual Startup with PSA
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
- 42 -
Version 1.0.0
© Vector Informatik GmbH


User Manual Startup with PSA
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.0.0
- 43 -


Additional Information
User Manual Startup with PSA
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.
- 44 -
Version 1.0.0
© Vector Informatik GmbH
User Manual Startup with PSA
FAQs
7 FAQs In this chapter you find the following information: 7.1 Introduction page 467.2 Frequently Asked Questions page 46 © Vector Informatik GmbH
Version 1.0.0
- 45 -





FAQs
User Manual Startup with PSA
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: You need a DBC file for your project, wherefrom do you get it? You have two possibilities to get a DBC file for your project. You can order the DBC
file from Vector (Vector create a new DBC file based on your specification) or you can
create a DBC file with the CANdb++ Editor by yourself.
For more information about the CANdb++ Editor have a look at
Start GENy with a Link or
a Batch File on page
13). FAQ: The transceiver type is unknown, so what transceiver settings you have
to set in GENy? You only have to set transceiver type as unknown (see se
ction Transceiver Unknown on page
22). - 46 -
Version 1.0.0
© Vector Informatik GmbH
User Manual Startup with PSA
Address table
8 Address table Vector Informatik
Vector Informatik GmbH
GmbH
Ingersheimer Str. 24
D-70499 Stuttgart
Phone: +49 (711) 80670-0
Fax: +49 (711) 80670-111
Vector France SAS
Vector France SAS
168, Boulevard Camélinat
F-92240 Malakoff
Phone: +33 (1) 4231 4000
Fax: +33 (1) 4231 4009
Vector Korea IT Inc. Vector Korea IT Inc.
Daerung Post Tower III, 508
Guro-dong, Guro-gu, 182-4
Seoul, 152-790
Republic of Korea
Phone: +82(0)2 2028 0600
Fax: +82(0)2 2028 0604
VecScan AB
VecScan AB
Theres Svenssons Gata 9
SE-417 55 Göteborg
Phone: +46 (31) 76476-00
Fax: +46 (31) 76476-19
Get more Information!
Visit our Website for:
> News
> Products
> Demo Software
> Support
> Training Classes
> Addresses
Document Outline
1.1.60 - UserManual_CANdesc
User Manual <User Manual Titlel>1.1.62 - 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 sect
ion 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 7 1.1.1 Certification 8 1.1.2 Warranty 8 1.1.3 Registered trademarks 8 1.1.4 Errata Sheet of manufacturers 8 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
n
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 wGeneratioith 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 Inyou 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
A
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 cladiagss.
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
n
tio
Requ
Req est
4000Serv
Ser ice 2
4000 is Just an
Respo
sp nse
Requ
Req est
40004000(positive)
Service 1
Respo
sp nse
Example
Respo
sp nse
Requ
Re
e
qu st
400040(neg
00ative)
(positive)
Respo
sp nse
Res
Re ponse
Requ
Req est
(neg
40004000ative)
(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
100AService 2
Reques
qu
t
es
100AResp
es onse
ons
Service 4
100A(positive)
Service 1
Response
Service 3 Request
4000pons
4000R
100esp
Aes onse
(posi
os tive)
ons
ve)
(negative)
Req
Re uest
Response
pons
4000Respo
sp nse
Service 2
Request
(nega
4000(p
4000 tive)
(posi
os tive)
Request
4000Resp
Re o
sps nse
ponse
pons
4000Respo
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
400040Respons
00e
(positive)
pons
)
Respo
sp nse
(negative)
(
R n
e eg
sp ati
egon ve
se )
Response
Request
pons
st
(neg
40004000ati
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 DowThn CANdela is top
A
diagnostic class is an abstract description of a use case.
own, CANd
d
esc
A
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 3Where 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 4Startup 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
d
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 GUsingeneration 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
rtDebug 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
e
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 STEPn Ge erating Files .6.1 4Using 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
d
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
Valuehe 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
Attributess in the following figure).
How are the settings
in CANdela appe
m
d
to your application?
Support for the
different Handlers
can be adjusted on
the Service Property
Page
4.9.1 owH 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 +
Pre+
Read +
Service_Instance_For_Demonstration_Purposes appldesc +
Post+
Read +
Service_Instance_For_Demonstration_Purposes with parameters:
void ApplDescReadService_Instance_For_Demonstration_Purposes(DescMsgContext* pMsgContext);
void ApplDesc
PreReadService_Instance_For_Demonstration_Purposes(void);
void ApplDesc
PostReadService_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 responsereqDataLen = 0Diagnostic
request (
A: reading service)
reqData[ 0 ]DiagnosticSID
Sub Service
-
-
-
BufferSID + 0x40
Sub Service
Data
Data
Data
(RAM Memory)
resData[ 1 ]
resData[ 2 ]
Positive Diagnostic
response
resData[ 0 ]resDataLenreqData[ 0 ]reqDataLenDiagnostic
request (
B: writing service)
reqData[ 1 ]
reqData[ 2 ]
DiagnosticSID
Sub Service
Data
Data
Data
BufferSID + 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
dTP 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
o
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” RExample: 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.
amRing Buffer Exple 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 diagnosticu 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[ Ptrprogress ], 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
n
you have to trigger a further function that handles the provision of diagnostic da
d
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
CanDescApplDescMainHandlerCyclicFunctionCall
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( );artDescRingBufferWrite( &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 se*4 ], 4 ); /*if resDataLen (12) data bytehavs e been copied to the diagnostic bufferthe repeated service callop sts automatically*/}} © Vector Informatik GmbH
Version 1.7
- 57 -
Additional Information
User Manual CANdesc
6 Additional oInformati 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
Products,
Categories 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 ..................................................
2
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 ..............................................................
4
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
1.1.63 - UserManual_CanDriver
User Manual1.1.65 - UserManual_CanDrivers
Vector CAN Driver User Manual
(Your First Steps)
Version 2.4
Vector Informatik GmbH, Ingersheimer Str. 24, 70499 Stuttgart
Tel. 0711/80670-0, Fax 0711/80670-399, Email can@vector-informatik.de
Internet http:\\www.vector-informatik.de

User Manual Vector CAN Driver
2 / 56
Higher layer componentsCAN Driver
CAN Controller
Transceiver
CANMessage Transmission - Reception Authors: Klaus Emmert
Version: 2.4
Status: released (in preparation/completed/inspected/released)
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
3 / 56
History Author Date Version Remarks Klaus Emmert
2001-05-11
0.1
First version of the User Manual
Klaus Emmert
2001-08-11
0.4
Technical and linguistic revision
Klaus Emmert
2001-09.21
0.6
Revision (pretransmit)
Klaus Emmert
2001-10-10
0.6a
Error in description of a mes-
sage, how to enter the manufac-
turer type to the example data
base.
Klaus Emmert
2001-12-14
1.0
Linguistic revision
Klaus Emmert
2002-09-25
1.4
Linguistic corrections and little
adaptations
Klaus Emmert
2003-07-16
1.5
Warning added for example code
usage
Klaus Emmert
2004-10-26
1.6
New Layout, example dbc file
deleted and description modified,
description for CANgen and the
new Generation Tool GENy, new
Symbols
Klaus Emmert
2006-05-30
1.7
Updated dialog for bus timing
register setup
Klaus Emmert
2006-09-08
1.8
Page number of Index, headline
numbering
Klaus Emmert
2007-02-20
1.9
Issues in Word Hyperlinks
Klaus Emmert
2007-07-26
2.0
Issues in steps introduction,
some typos.
Klaus Emmert
2007-09-06
2.1
Typos and reference in TOC
Klaus Emmert
2007-10-29
2.2
Baudrate setting description
Klaus Emmert
2008-09-04
2.3
Include file for CAN Driver and
GENy
Klaus Emmert
2009-08-26
2.4
Fix: v_inc.h must not be changed
manually.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
4 / 56
Motivation For This Work
The CAN Driver is the only component among the CANbedded Software Compo-
nents that is directly connected with the CAN Controller hardware. It is the founda-
tion for all other CANbedded Software Components.
The first target for you is to get the CAN Driver running, to see receive and transmit
messages on the bus.
WARNING All application code in any of the Vector User Manuals is for training pur-
poses only. They are slightly tested and designed to understand the basic
idea of using a certain component or a set of components. ©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
5 / 56
Contents 1 Welcome to the CAN Driver User Manual ....................................................... 8 1.1 Beginners with the CAN Driver start here ? ........................................ 8 1.2 For Advanced Users ........................................................................... 8 1.3 Special topics ...................................................................................... 8 1.4 Documents this one refers to…........................................................... 8 2 About This Document ....................................................................................... 9 2.1 How This Documentation Is Set-Up .................................................... 9 2.2 Legend and Explanation of Symbols................................................. 10 3 ECUs and Vector CANbedded Components – An Overall View.................. 11 3.1 Network Data Base File (DBC) ......................................................... 11 4 CANbedded Software Components............................................................... 12 4.1 Generation Tool ................................................................................ 13 4.2 The Vector CAN Driver ..................................................................... 14 4.2.1 Tasks of The Vector CAN Driver....................................................... 14 4.2.2 Vector CAN Driver Files .................................................................... 14 4.2.2.1 Component Files ............................................................................... 14
4.2.2.2 Generated Files................................................................................. 14
4.2.2.3 Configurable files .............................................................................. 15 4.2.3 Include The CAN Driver Into Your Application .................................. 15 5 Vector CAN Driver– A More Detailed View.................................................... 16 5.1 Information Package on the CAN Bus .............................................. 16 5.2 Storing Information Packages ........................................................... 17 5.2.1 The Registers of the CAN Controller................................................. 18 5.2.2 The Data Structure Generated by the Generation Tool for
Storing Message Data....................................................................... 18 5.2.3 Memory the Application Reserved for Signals. ................................. 19 6 CAN Driver in 9 Steps ..................................................................................... 20 6.1 STEP 1 Unpack the Delivery............................................................ 21 6.2 STEP 2 Generation Tool and dbc File ............................................. 22 6.2.1 Using CANgen as Generation Tool................................................... 22 6.2.2 Using GENy, the new Generation Tool ............................................. 30 6.3 STEP 3 Generate Files .................................................................... 33 6.3.1 Using CANgen Generation Tool........................................................ 33 6.3.2 Using GENy ...................................................................................... 33 ©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
6 / 56
6.4 STEP 4 Add Files to your Application .............................................. 35 6.5 STEP 5 Adaptations for your Application .......................................... 36 6.6 STEP 6 Compile, Link and Download ............................................... 40 6.7 STEP 7 Receiving A Message .......................................................... 40 6.8 STEP 8 Sending a Message ............................................................. 43 6.9 STEP 9 Further Actions .................................................................... 45 6.9.1 Strategies for Receiving a CAN Message......................................... 45 6.9.1.1 Hardware Filter (HW Filter) ............................................................... 45
6.9.1.2 ApplCanMsgReceived....................................................................... 46
6.9.1.3 Ranges.............................................................................................. 46
6.9.1.4 Search Algorithm............................................................................... 46
6.9.1.5 Precopy ............................................................................................. 46
6.9.1.6 Indication Flag / Indication Function.................................................. 47 6.9.2 Strategies for Sending a CAN Message ........................................... 48 6.9.2.1 Update RAM buffer ........................................................................... 48
6.9.2.2 CanTransmit...................................................................................... 49
6.9.2.3 The Queue ........................................................................................ 49
6.9.2.4 Pretransmit Function ......................................................................... 49
6.9.2.5 Confirmation Function and Confirmation Flag................................... 49 7 Further Information ......................................................................................... 51 7.1 An Exercise For Practice................................................................... 51 7.2 The Solution To The Exercise........................................................... 54 7.2.1 After the first reception and transmission of a new value:................. 54 7.2.2 After the reception of the same value as before: .............................. 54 7.2.3 The solution, step by step ................................................................. 54 8 Index ................................................................................................................. 56 ©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
7 / 56
Illustrations
Figure 3-1 A Modern Vehicle With Body CAN And PowerTrain Bus........................... 11
Figure 4-1 CANbedded Software Components ........................................................... 12
Figure 4-2 Order For Including Files............................................................................ 15
Figure 5-1 Message and Signal................................................................................... 16
Figure 5-2 Rx Register, Data Structure and Notification ............................................. 17
Figure 5-3 Tx Register, Data Structure and CanTransmit ........................................... 18
Figure 5-4 Memory optimization by the Generation Tool ............................................ 19
Figure 6-1 Add a dbc file ............................................................................................. 22
Figure 6-2 Warning – do not bother............................................................................. 22
Figure 6-3 Channel properties..................................................................................... 23
Figure 6-4 Save Setting For The First Time ................................................................ 23
Figure 6-5 Overview of Signals and Directories .......................................................... 24
Figure 6-6 CAN Driver Dialog (for HC12) .................................................................... 25
Figure 6-7 Init Registers For The CAN Controller (for HC12)...................................... 26
Figure 6-8 Acceptance Filters For The CAN Controller (for HC12) ............................. 27
Figure 6-9 Bus Timing Register Settings..................................................................... 28
Figure 6-10 TP Options ................................................................................................. 29
Figure 6-11 Setup Dialog Window and Channel Setup Window to Create a New Configuration.............................................................................................. 30 Figure 6-12 Component Selection................................................................................. 30
Figure 6-13 The Register Block Address is a General Setting for the CPU .................. 31
Figure 6-14 Register Block Offset, Acceptance Filters and Bus Timing are Channel-Specific Settings for the CPU ...................................................... 31 Figure 6-15 Acceptance Filter Settings Window of GENy ............................................. 32
Figure 6-16 Generation Process ................................................................................... 33
Figure 6-17 Information About the Generated Files and the Generation Process ........ 33
Figure 6-18 The Transceiver ......................................................................................... 37
Figure 6-19 Simple Test Environment ........................................................................... 40
Figure 6-20 Check button for indication flag.................................................................. 41
Figure 6-21 Calling Order Of Functions When A CAN Message Is Received............... 45
Figure 6-22 States Before Transmitting A CAN Message ............................................. 48
Figure 6-23 Confirmation Interrupt After Transmission Of CAN Message .................... 50
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
8 / 56
1 Welcome to the CAN Driver User Manual 1.1 Beginners with the CAN Driver start here ? You need s
ome information about this document?
Æ
see Chapter 2 Getting started Æ
see Chapter 3 9 Steps for the CAN Driver Æ
see Chapter 6 1.2 For Advanced Users Start reading here. Æ
see Chapter 5 1.3 Special topics Strategies for receiving a CAN message Æ
see Chapter 6.9.1
Strategies for sending a CAN message Æ
see Chapter 6.9.2
An exercise Æ
see Chapter 7.1
1.4 Documents this one refers to… TechnicalReference_CANDriver.pdf
TechnicalReference_CAN_xxx.pdf
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
9 / 56
2 About This Document This document gives you an understanding of the CAN Driver. You will receive
general information, a step-by-step tutorial on how to include and use the function-
alities of the CAN Driver.
For more detailed information about the CAN Driver and its API refer to the Technical
Reference (TechnicalReference_CANDriver.pdf) and the hardware specific refer-
ences TechnicalReference_CAN_xxx.pdf (e.g. TechnicalReference_CAN_HC12.pdf).
2.1 How This Documentation Is Set-Up Chapter Content Chapter 1 The welcome page is to navigate in the document. The main parts of the document
can be accessed from here via hyperlinks.
Chapter 2 It contains some formal information about this document, an explanation of legends
and symbols.
Chapter 3 An introduction to the files, the tools and information necessary to understand the
descriptions in the following chapters.
Chapter 4 Here you find some more insight in the CAN Driver about receiving and transmitting
messages, the CAN controllers and the data structure.
Chapter 5 A step-by-step guide to establish CAN communication on an ECU for the first time.
Follow the 9 steps to get the answer to most of your questions and problems..
Chapter 6 Here you find a problem to solve to check your understanding of the CAN Driver and
its functions.
Chapter 7 In this last chapter there is a list of experiences with the CAN Driver.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7










User Manual Vector CAN Driver
10 / 56
2.2 Legend and Explanation of Symbols You find these symbols at the right side of the document. They indicate special ar-
eas in the text. Here is a list of their meaning.
These areas
to the right of
Symbol Meaning the text
contain brief
items of
The building bricks mark examples.
information
that will
facilitate your
search for
Comm
ents
You will find key words and information in short sentences in the margin. This will
and
specific
explanati-
greatly simplify your search for topics.
topics.
The footprints will lead you through the steps until you can use the described Vector
CAN Driver.
There is something you should take care about.
Useful and additional information is displayed in areas with this symbol.
This file you are allowed to edit on demand.
This file you must not edit at all.
This indicates an area dealing with frequently asked questions (FAQ).
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
11 / 56
3 ECUs and Vector CANbedded Components – An Overall View 3.1 Network Data Base File (DBC) Normally the different ECUs in a modern vehicle are developed by different suppli-
ers (SUPPLIER X). All ECUs within the same bus system ( n or o) use the same
data base (dbc file) to guarantee that the ECUs will work together later on in the
vehicle.
SUPPLIER 1SUPPLIER 6SUPPLIER 2SUPPLIER 5Network Database
n
All_ECUs_highspeed.dbcn
Powertraino
All_ECUs_midspeed.dbco
BodyCANSUPPLIER 4SUPPLIER 3 Figure 3-1 A Modern Vehicle With Body CAN And PowerTrain Bus
The dbc file is designed by the vehicle manufacturer and distributed to all suppliers
There is the same
dbc file per bus
that develop an ECU. Thus every supplier uses the SAME dbc file for one vehicle
system (high
speed, low
platform and one bus system (powertrain, body CAN etc.) to guarantee a common
speed, etc) for all
basis for development.
suppliers to
guarantee a
common basis for
The dbc file contains e.g. information about every node in the network, the mes-
development
. sages/signals each node has to send or to receive. The distribution of the signals
among the messages is stored in the DBC file, too.
For example: every ECU has to know that a 1 in bit 7 in the 4th byte of the message
0x305 means “Ignition Key” on/off.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
12 / 56
4 CANbedded Software Components The vector CANbedded environment consists of a number of adaptive source code
components that cover the basic communication and diagnostics requirements in
automotive applications.
Figure 4-1 CANbedded Software Components
CAN Driver
The CAN Driver handles the hardware specific CAN chip characters and provides a standardized
application interface.
Interaction Layer
The Interaction Layer (IL for short) is responsible for the transmission of messages according to
specified rules, monitoring receive messages, timeout monitoring, etc. It provides a signal oriented
application interface for the application.
Transport Protocol
The CAN protocol is restricted to 8 data bytes per message. But in some cases (e.g. diagnostics)
you need to exchange much more than 8 data bytes. The segmentation of the data, the monitoring
of the messages and the timeouts is done by the Transport Protocol (TP for short).
Diagnostics
Diagnostics Layer according to ISO14229 / ISO14230 (Keyword Protocol 2000).
Network Management
The Network Management (NM for short) is the component to control the bus, to synchronize the
transition to bus sleep, error recovery after bus-off, etc.
Communication Control Layer (CCL) The CCL provides an integration environment for the CANbedded Software Components, an ab-
straction for different vehicle manufacturers, microcontrollers, CAN Controllers and compil-
ers/linkers. It also provides a global debug mechanism.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
13 / 56
Universal Measurement and Calibration Protocol (XCP) This is the Software Component for measurement and calibration on several bus systems. To men-
tion some feature: read and write access to various memory locations or flash programming.
Generation Tool
This is a PC tool for configuring the above listed components. The Generation Tool is driven by a
network database file, DBC file for short.
The CANbedded Software Components are configurable and can be adapted to
your specific needs via the Generation Tool.
4.1 Generation Tool The Generation Tool displays the complete set of ECUs in the network. In general
you pick out the one you develop the software for. In special cases when you de-
velop ECUs that are almost identical (e.g. door ECUs) you select more than one
(so-called multiple ECUs).
For
your ECU there are special requirements concerning the hardware and the
functionality. I.e. the driver must be suitable for your hardware and the standard
components must be adaptable for your project-specific needs. The means to do
this is the Generation Tool.
The Generation Tool is a PC-Tool. It reads in the Network Data Base file (DBC)
and offers you to select the node you are going to develop and has therefore all
information about your ECU, the receive and transmit messages, the signals etc.
The Generation Tool generates files that contain this information (DBC, hardware
and specific settings) and so complete the components core files and have to be
Include the
generated
included in the compile and link process.
files in your
system as
shown.
You must not
Your Hardware Platform-
change the
and Compiler information
Application
generated
files by hand
Project specific component settings
Specific Data
– the next
generation
process will
delete these
changes.
Right now there are two Generation Tools available, CANgen and the new Genera-
tion Tool called GENy. Which tool you have to use depends on you delivery and the
project.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7



User Manual Vector CAN Driver
14 / 56
4.2 The Vector CAN Driver A driver is a program to control a piece of hardware. In this case the Vector CAN
Driver controls the CAN Controller and its registers.
4.2.1 Tasks of The Vector CAN Driver
The CAN Driver basically handles the reception and transmission of information via
the CAN Bus and recognizes bus failure (bus off). The CAN Driver provides a
standard application interface for the application.
Your application only has to use a set of predefined functions to control the CAN
Driver and will be notified via interrupt about incoming information (messages). To
control the incoming and outgoing data and to be notified of important events you
have to add some service- and call-back-functions to your application (see 6.5).
For more detailed information about the CAN Driver please refer to the Vector CAN
Driver Technical Reference (TechnicalReference_CANDriver.pdf and TechnicalRe-
ferfence_CAN_<hardwareplatform>.pdf, e.g. TechnicalReference_CAN_HC12.pdf).
4.2.2 Vector CAN Driver Files
The Vector CAN Driver consists of 3 sets of files, component files, generated files
and configurable files
4.2.2.1 Component Files Independent of the used Generation Tool
can_drv.c - can_def.h - v_def.h You must not change these files at all.
4.2.2.2 Generated Files Independent of the used Generation Tool
can_cfg.h - v_cfg.h Only for CANgen
YourECU.c - YourECU.h Only for GENy
can_par.c - can_par.h - drv_par.c - drv_par.h - v_par.h - v_par.c - v_inc.h Do not change these files. You will lose the changes after the next generation proc-
ess.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7



User Manual Vector CAN Driver
15 / 56
4.2.2.3 Configurable files Independent of the used Generation Tool
can_inc.h
INC stands for include. Here you can add includes you need.. You have to include
can_inc.h in every application C file where you need CAN functionality, followed by
the include of YourECU.h.
The Generation Tool CANgen generates the signal and message access macros
as well as the indication or confirmation flags to the file
YourECU.h. GENy gener-
ates this to the file
can_par.h.
4.2.3 Include The CAN Driver Into Your Application
Use the illustration in Figure 4-2 to include the files for the CAN Driver into your
application correctly. Please keep to the including order to avoid errors while com-
piling or linking.
Figure 4-2 Order For Including Files
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
16 / 56
5 Vector CAN Driver– A More Detailed View You access the
signals relevant
for your ECU with
the macros
5.1 Information Package on the CAN Bus generated by the
Generation Tool.
As mentioned before, the information is exchanged between ECUs via the CAN
The generated
bus. The maximum amount of data which can be exchanged is 8 data bytes and
file sig_test.c
they are transmitted via a so-called
message.
contains a list of
all access macros
to the signals.
A message contains the ID (the “name” or number of the message), the DLC (data
length code, i.e., the number of data bytes) and the data bytes .
A message on the CAN Bus can contain from 0 to 8 data bytes.
Every message is divided up into
signals. A signal consists of 1 up to 64 bits. A
signal cannot exceed the
message boundary.
We do not consider signals here which are greater than 64 bits, as this involves the
Transport Protocol.
MessageID DLC
DL
0x01 0x12
Signal(1 Bit to 8 Bytes) 0x01 0x12
e.g. Temperature, (hi, low(hi, lo )A signal canl ca exceed excebyte boundariesrie Figure 5-1 Message and Signal
Signals are assigned to messages by the vehicle manufacturer database engineer.
This assignment is stored in the database (dbc file).
Normally you must not change the database (dbc file).
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
17 / 56
5.2 Storing Information Packages The more you understand about data handling in the CAN Driver the better you are
able to design your application. You have to know where the data is stored at a
specific point in time to be able to access this data correctly.
Notification for
Application
RAM buffer
Temp
Ignition
Copy to RAM buffer depending on ID.
Door_S
or_ tate
Keep data consistent!
CAN Driver
Rx register
ID DLC
Transceiver
CAN messages
CAN messages
Figure 5-2 Rx Register, Data Structure and Notification
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
18 / 56
Updated by Application
RAM buffer
Temp
Ignit
Igni ion
Door_
Door State
CanTransmit (TxHandle)
CAN Driver
Copy data to Tx register.
Tx register
Keep data consistent!
ID DLC
Transceiver
CAN messages
CAN messages
Figure 5-3 Tx Register, Data Structure and CanTransmit
There are 3 elements involved in storing information packages:
5.2.1 The Registers of the CAN Controller
Your CAN Controller has a receive register (Rx Register) and a transmit register
(Tx Register).
Later on you will
Data is always received in the Rx Register of the controller. The data is written to
see, that this
special access to
the Tx Register immediately before a transmission.
the hardware is
possible only in
the functions
You can access these two registers via the signal access macros containing the
ApplCanMsgRe-
_CAN_ in the name (see YourECU.h if you use CANgen and can_par.h if you use
ceived and in the
Precopy Func-
GENy).
tions for reception
and in the Pre-
transmit Function
for transmission.
The
signal access to the Tx Register is dependent on the hardware, not all drivers
support this feature.
5.2.2 The Data Structure Generated by the Generation Tool for Storing Mes-
sage Data.
The Generation Tool defines variables to allocate memory for the data of the re-
ceive messages and the transmit messages (The data allocation is optional and
can be switched off). In the receive procedure, the data will be copied from the Rx
Register to the message-specific memory area (RAM). In the transmit procedure,
you have to enter the current values in the variables and the driver will copy the
data to the Tx Register as shown in Figure 5-2 and Figure 5-3. ©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
19 / 56
The decision, whether to copy the data to or from the registers (receive and transmit)
with
your own function or whether you let the driver do the copying action is up to
you and is decided by the return value of specific functions (precopy function, pre-
transmit function, see
6.9). The Generation Tool optimizes the memory consumption. The highest byte con-
taining relevant signals determines the amount of bytes to be reserved for this
message. In the picture below, the red areas and lines in the bytes show where
relevant signal information is stored within the message.
4 bytesThe Generation
Tool minimizes
8 bytesthe amount of
memory reserved
for a message.
Figure 5-4 Memory optimization by the Generation Tool
In the first message the 3rd byte contains the last signal (counting started with 0).
Byte 4, 5, 6 and 7 have no relevant information for your ECU. In this case the Gen-
eration Tool only reserves 4 (0-3) bytes for this message.
The second message has information in the 7th byte, so the number of byte to be
reserved is 8 (0-7).
5.2.3 Memory the Application Reserved for Signals.
Sometimes you only need one byte or even only one bit signal out of a message.
To save RAM memory do not use a generated data structure. Use the precopy
function (see
6.9.1.5) to copy the byte or the bit of the received message to the
byte or the bit field you reserved in your application to hold this specific information.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
20 / 56
6 CAN Driver in 9 Steps STEP 1 : UNPACK THE DELIVERY Follow the install shield, unpack the delivery and install the generation tool.
STEP 2: GENERATION TOOL AND DBC FILE Configure the CAN Driver using the generation tool and an appropriate data base file
(DBC)..
STEP 3: GENERATE FILES The generation tool generates all necessary files for the CAN Driver.
STEP 4: ADD FILES TO YOUR APPLICATION PROJECT To use the CAN Driver you have to add the CAN Driver files to your application project.
STEP 5: ADAPTATIONS FOR YOUR APPLICATION Also adapt your application files to be able to use the functionality of the CAN Driver.
STEP 6: COMPILE AND LINK Compile and Link your application project including the CAN Driver.
STEP 7: RECEPTION OF A CAN MESSAGE Test the receiving path of the CAN Driver by sending a message to your ECU.
STEP 8: TRANSMISSION OF A CAN MESSAGE Transmit your first CAN message using the CAN Driver service functions.
STEP 9: FURTHER ACTIONS AND SETTINGS Topics above the very easy beginning.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
21 / 56
6.1 STEP 1 Unpack the Delivery The delivery of CANbedded Software Components normally comprises a Genera-
tion Tool and the source code of the software components.
The Generation
Tool generates
You only have to start the
files for your
application. It is
…_Setup.exe the connection
between your
hardware and
and to follow the install shield wizard.
settings, the
requirements of
your vehicle
manufacturer and
We recommend creating a shortcut to the Generation Tool.
the other ECUs,
your ECU has to
communicate
with.
Back to 9 Steps overview
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7




User Manual Vector CAN Driver
22 / 56
6.2 STEP 2 Generation Tool and dbc File Use new Generation Tool GENy, look there >> 6.2.1 Using CANgen as Generation Tool
When you start the Generation Tool you will see a window like
Figure 6-1. This starting window is the main window of the Generation Tool.
Figure 6-1 Add a dbc file
A click on the green plus (
+) will open a new window to add your database (dbc
file).
When you use
the browse-button
you will get an
absolute path to
the dbc file.
It is suggested
that you use
relative paths in
order to be able
to move your
project more
easily from one
directory to
another
. This warning
occurs only if you
open the dbc.file
Figure
for the first time
6-2 Warning – do not bother
because of the
extension file has
Browse for your dbc file and select it. When you do this for the first time, the
Warn-still not been
created. The
ing above will occur. Ignore it, and just confirm with
OK..
extension file will
contain your
Select your node; choose your target system and compiler.
settings you do in
the following.
Since we are using a CAN Driver with just one channel, the channel index has to be
left empty. When you have two or more channels, they will be distinguished via this
index.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7



User Manual Vector CAN Driver
23 / 56
The Name field is
set to the name of
the dbc file. You
can change the
name . It is only
used in the list of
your channels in
figure 2-5.
Figure 6-3 Channel properties
Confirm with OK and you will see your setting as text in the field of the starting win-
dow of the Generation Tool. When we save the configuration for the first time, we
have to use the menu command
File/Save as.
Figure 6-4 Save Setting For The First Time
Take a look at the directory where you stored the settings of the Generation Tool.
There is your dbc file and new files (see note) only used by the Tool.
The following files belong to the Generation Tool:
<databasename>.dbc
(exampleDRV.dbc)
<databasename>.ext
(exampleDRV.ext)
<databasename_nodename>.msg
(exampleDRV_YourECU.msg)
<databasename_nodename>.sig (exampleDRV_YourECU.sig)
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7



User Manual Vector CAN Driver
24 / 56
(<databasename_nodename>.fms (exampleDRV_YourECU.fms))
fms only when using a full CAN controller.
yourECU.ccf
this is the project file for the Generation
Tool.
Now you can open your settings in the normal way (not via the dbc file) by opening
the file YourECU.ccf.
When your vehicle manufacturer changes the dbc file, just copy all files important for
the Generation Tool into a new directory, delete the old dbc file and copy the new dbc
file in this new directory. Rename the old ext file with the name of the new dbc file.
This preserves your application-specific settings.
The checkbox
Generate only bit
and byte signal
This does not work when the target system has changed!!!
macros is only
used for very
special applica-
tions. If you have
any doubt, do not
choose this.
Now we shall make additional settings for the component CAN Driver. Use this but-
ton[
] to open the Generation Options and to enter the following dialog.
Figure 6-5 Overview of Signals and Directories
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
25 / 56
In the overview tab page (
Figure 6-5) you see all receive and send messages for
your node.
Just choose the path where the header and the C file are to be generated and the
path for the configuration file can_cfg.h.
Select the tab
CAN Driver.
In the following dialog you can make settings that are the same for all CAN drivers
regardless of the hardware platform. For the first attempt we do not select anything.
Here you see the
variety of setting
you can make to
configure a CAN
Driver. Take a
look at it but do
not enter anything
for this first
attempt.
Refer to the
document
CANdrv.doc to
get further infor-
mation about
these settings
. Figure 6-6 CAN Driver Dialog (for HC12)
The next tab,
CAN driver (advanced) is very special for the specific vehicle manufac-
turer and the hardware platform. Please refer to the description of your CAN Driver
Technical Reference for the advanced settings (TechnicalRefer-
ence_CAN_
hardwareplatform.pdf).
Finally we have to set the
Init registers. Please select this tab (Figure 6-7). Some of the following information might be hardware dependent but the fundamental
mechanisms are the same.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
26 / 56
Every two col-
umns belong to
one so-called init
structure consist-
ing of baud rate,
acceptance
filters…
Figure 6-7 Init Registers For The CAN Controller (for HC12)
This is a very important dialog. Please pay special attention to these settings.
Here is where you can make the settings for the hardware acceptance filters and
the bus timing of your CAN Controller.
First we look at the
Acceptance filters, second at the
Bustiming registers.
In order to minimize the number of messages that should not be received by your
ECU, you can set a hardware filter by means of the acceptance register (
1) (see
Figure 6-8). ©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
27 / 56
The reception of any message normally causes an interrupt. To minimize the inter-
rupt load you set the filters, so only relevant message will pass and cause an inter-
rupt.
Figure 6-8 Acceptance Filters For The CAN Controller (for HC12)
For the first attempt it is your choice whether to open all filter via the
Open filters or
you use the
Optimize filters button. Confirm with OK.
The setting of the filters is described in detail in the help document for the Generation
Tool. (just use the HELP button).
Next we will look at the
bus timing. To do this, while still on the
Init registers tab
page, click on the
Bustiming registers button.
Incorrect Bus Timing settings are common mistakes that cause errors while transmis-
sion and reception. Please pay special attention to all settings in this dialog.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7



User Manual Vector CAN Driver
28 / 56
Figure 6-9 Bus Timing Register Settings
Caution
Before SOP it is duty of the OEM / Tier1 supplier to recalculate and validate these
automatically calculated values for the bus timing registers.
First you have to enter the clock signal frequency. This is the base for further calcu-
lating the timing registers. Make sure to select the correct frequency.
The Bus Timing Registers of any CAN controller contain information about the bus
rate, the synchronization jump width (SJW) and the BTL cycles. There are two
ways to make these setting:
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
29 / 56
1.
Do you know the baud rate ? Enter the baud rate and click on
Calculate bustiming registers. You will get a
list of possible register setting. Choose your setting by a click in the list.
Between 60 and 80% is a good value for the Sample Rate and the SJW for your se-
lection. All vehicle manufacturers have strict guidelines for these settings.
2. You can also simply enter values for the two bus timing registers (CBT0 and
CBT1) and let the software calculate the baud rate.
Return to the
Init registers dialog via
OK and see the changed values.
With a further
OK you return to the main window of the Generation Tool.
Make sure that the checkboxes
Use TP, Use diagnosis, Use Can Calibration
Protocol, Use MCNet … are NOT selected (as we are working with the CAN
Driver only for this example).
The variety of these buttons is dependent on the manufacturer. Deactivate any com-
ponent but the CAN Driver.
Figure 6-10 TP Options
The figure is only an example. The screenshot may look very different in your case.
But you see the checkbox which must not be selected.
Read the following chapter if you use GENy.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7






User Manual Vector CAN Driver
30 / 56
6.2.2 Using GENy, the new Generation Tool The following first steps with the Generation Tool are described in details in the online
help of the Generation Tool GENy, too.
Start the Generation Tool and setup a new configuration. Via
File/New you open
the Setup Dialog Window. Select License, Compiler, Micro and Derivative (if avail-
able) and confirm via
[OK]. Then open the Channel Setup Window via the green
plus and the selection of the underlying bus system (CAN or LIN).
Figure 6-11 Setup Dialog Window and Channel Setup Window to Create a New Configuration
The channel name is Channel X per default (X is starting with 1). Use the browse
functionality to enter the location of the data base (dbc file).
Select your node out of the field
Database Nodes and confirm the settings with
[OK].
Now save the configuration via
File/Save or
File/Save as.
First at all you should switch on/off the components you need, in this case we only
use the CAN Driver.
Use the component selection at the bottom of the main window of the Generation
Tool and select the suitable Driver (in this example application we use the
CPUHC12 and the Driver HC12).
Figure 6-12 Component Selection
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7




User Manual Vector CAN Driver
31 / 56
Now you should set the path where the Generation Tool generated the files to. To
do this, open the Generation Directories Window via
Configuration/Generation
Paths. Enter the root path and select additionally individual paths for the compo-
nents, if the Generation Tool should generated the files to different folders. This is
also described very detailed in the GENy online help.
For the HC12 there are some hardware-specific settings that you have to make,
the register block address and the register block offset. It depends on you hard-
ware whether you have to do such kind of settings or not. Refer to the Technical-
Reference_CAN_YourHardware.pdf for more information.
Figure 6-13 The Register Block Address is a General Setting for the CPU
Figure 6-14 Register Block Offset, Acceptance Filters and Bus Timing are Channel-Specific Settings for the CPU
What is missing now is the settings for the acceptance filters and the bus timing.
Acceptance filter configuration and bus timing configuration are very important set-
tings. Please pay special attention to them.
As you see in the navigation tree above you can open the configuration windows
for these two settings via the channels of the hardware (e.g. CPUHC12).
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
32 / 56
First we take a look at the
Acceptance filters, second at the
Bustiming registers.
In order to minimize the number of messages that should not be received by your
ECU, you can set a hardware filter by means of the acceptance register.
Figure 6-15 Acceptance Filter Settings Window of GENy
The reception of any message normally causes an interrupt. To minimize the inter-
rupt load you set the filters, so only relevant message will pass and cause an inter-
rupt.
For the first attempt it is your choice whether to open all filter via the
Open filters
or you use the
Optimize filters button. Confirm with
[OK].
The window for the bus timing registers is the same as for the CANgen Generation
Tool. Refer to the lines above for this explanation.
To make the settings for the component CAN Driver itself use the lists below
Driv-
erHC12 and
DriverHC12/Channels/Channel 1. But for the this first attempt leave
these driver settings on their default values.
Back to 9 Steps overview
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7






User Manual Vector CAN Driver
33 / 56
6.3 STEP 3 Generate Files 6.3.1 Using CANgen Generation Tool
Click on the button
and start the generation process.
Remember to
start the genera-
tion process after
any change in the
dialog windows of
the Generation
Tool.
Figure 6-16 Generation Process
The double arrow is only available if you have a multi-channel CAN Driver distin-
guished via the Channel index.
Now we have generated for the first time. Check the directory and see the new
files. There should be at least the files YourECU.c and YourECU.h, and in the path
for the configuration file there should be can_cfg.h and v_cfg.h.
If you do not find the generated files check your path in the
Overview dialog.
6.3.2 Using GENy Click on the button
and start the generation process.
Figure 6-17 Information About the Generated Files and the Generation Process
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
34 / 56
The Generation Tool provides you with information about the
Generated Files and
Generation information. In this example shown above the acceptance filters are
not set correctly, Message_2 will not pass the filter. Open or optimize the filters.
If a message will not pass the acceptance filters, the Generation Tool will not create
signal access macros for the hardware (_CAN_ see in chapter
5.2.1). Make sure that
the generation process runs without error messages.
Now we have generated for the first time. Check the directory and see the new
files: can_par.c, can_par.h, drv_par.c, drv_par.h, can_cfg.h, v_par.c, v_par.h,
v_cfg.h, v_inc.h.
If you do not find the files check the paths in the
Generation Paths… dialog.
Back to 9 Steps overview
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7



User Manual Vector CAN Driver
35 / 56
6.4 STEP 4 Add Files to your Application In this step you have to add all files of the CANbedded Software Components (In
this example these files are only the ones for the CAN Driver) and the generated
ones to your project (or makefile).
Rename the file _can_inc.h to can_inc.h (remove the underscore prefix) and open
it with an appropriate editor. As you do not use any other component but the CAN
Driver you should delete the #include of the Network Management (nm_cfg.h) at
the end of this file.
If you want to use functions of the CAN Driver or you want to access signals or mes-
sages, you only have to include the can_inc.h and then the YourECU.h for
CANgen and v_inc.h for using
GENy.
Now add the driver files to your source list for your compiler or your makefile.
If you want to apply changes you have made in the Generation Tool, you must start
the generation process again. Remember compiling afterwards.
!!! We are still not able to compile and link. !!!
The starting point for this example is a very simple application consisting of only
one file (here applmain) and an interrupt vector table (vectors.c). It should give you
an idea of how to handle the service- and callback functions of the CAN Driver.
In the following chapters we complete this example step by step.
This example was created for using CANgen. For the usage of GENy you just have
to include the v_inc.h.
Example for HC12: |-------------------------------------------------------------------
| A U T H O R I D E N T I T Y
|-------------------------------------------------------------------
| Initials Name Company
| -------- --------------------- ---------------------------
| em Emmert Klaus Vector Informatik GmbH
|-------------------------------------------------------------------
/*Includes ********************************************************/
#include "can_inc.h"
#include "yourecu.h"
void main (void )
{
}
Back to 9 Steps overview
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7




User Manual Vector CAN Driver
36 / 56
6.5 STEP 5 Adaptations for your Application To be able to compile and link, you have to adapt a few things in your application.
Example for the HC12:
/* Includes*********************************************************/
#include "can_inc.h" /*using CANgen*/
#include "yourecu.h" /*using CANgen*/
#include "can_par.h" /*is also included for GENy via include of v_inc.h*/
/*Function prototypes **********************************************/
void enableInterrupts( void );
void hardwareInit( void );
/*Main Function **********************************************/
void main(void)
{
/*
make sure that the interrupts are disabled to initialize the
modules.*/
DO
NOT USE any CAN API function
before calling CanInitPowerOn.
It is forbidden to use CanInterruptDisable here hardwareInit();
It is forbidden to use any CAN
functionality CanInitPowerOn(kCanInitObj1);
before CanInit- PowerOn !!! enableInterrupts();
for(;;)
{
;
}
}
void ApplCanBusOff( void )
{
; /*Callback function for notification of BusOff*/
}
void ApplCanWakeUp( void )
{
; /*Callback function at the transition from SleepMode to sleep
indication recommended*/
}
void hardwareInit( void )
{
/*
Do your hardware specific initializations here.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
37 / 56
Remember your TRANSCEIVER
*/
;
}
@interrupt void irq_dummy0(void)
{
for( ;; ); /*all other interrupts except the CAN Interrupts are routed
to this function.*/
}
Now the description of the above code:
First, we have to include the
can_inc.h and then the generated header, here
yourecu.h.
The following define is to enable the interrupts and is hardware dependent.
In the main() function you have to do initializations first.
In the
hardwareInit you can turn on timers or PWM or something else.
When you use a
As you see, the transceiver connects directly to the CAN Bus, so:
high speed
transceiver, you
!!!
PLEASE THINK OF SWITCHING YOUR TRANSCEIVER ON !!!
have to take care
THE CAN DRIVER DOES NOT HANDLE THE TRANSCEIVER of your terminat-
ing resistor of
120Ω
Normally this is only necessary when using a low-speed-transceiver. Refer to your
hardware guide.
CAN DriverCAN Controllercan_rx
can_tx
(standby
enable)
TransceiverCAN_H
CAN_L
GND
Figure 6-18 The Transceiver
To start the CAN Controller and the CAN Driver, you have to call the function:
CanInitPowerOn( kCanInitObj1 ) Make sure that
the interrupts are
disabled when
calling the func-
Make sure that you use functions of the CAN Driver API
after CanInitPowerOn.
tion CanInitPow-
erOn. Normally
the interrupts are
disabled by
default at startup.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
38 / 56
The parameter passed in determines the init structure you made the settings for via
the Generation Tool. You will find the macro
kCanInitObj1 in the generated
yourecu.h (can_par.h for GENy) normally at the end of the file. (On some hard-
ware platforms, this parameter is not necessary (e.g. V850). Refer to your hard-
ware specific documentation for this information.
Now you can enable interrupts.
The main-function is an endless-loop. Perhaps you can turn on some LEDs, to see
the application running.
You also have to provide the CAN Driver with two application functions,
applCan-
BusOff and
applCanWakeUp. For the first start, you can leave these functions
empty to avoid linker errors.
Think of adding
this or a similar
file to your sys-
Since the CAN Driver uses interrupts for notifying the application when a CAN
tem, i.e. your
makefile or your
message has been received, you have to map the interrupts on the corresponding
project.
interrupt service routines. Refer to your compiler manual how to do this in your
case.
For the HC12 CAN Drivers this is done in the file vectors.c. Let’s have a look at this
file.
Interrupts and interrupt tables are highly dependent on the hardware. Just use this
example as a guide.
Example for HC12:
const functptr vectab[] = { // @0xFFC4 start address of table
CanTxInterrupt, // $FFC4 CAN transmit
CanRxInterrupt, // $FFC6 CAN receive
CanErrorInterrupt, // $FFC8 CAN error irq_dummy0, // reserved
irq_dummy0, //
irq_dummy0, //
CanWakeUpInterrupt, // $FFD0 CAN wake-up
irq_dummy0, //ATD
irq_dummy0, //SCI 2
irq_dummy0, //SPI
irq_dummy0, //SPI
irq_dummy0, //Pulse acc input
irq_dummy0, //Pulse acc overf
irq_dummy0, //Timer overf
irq_dummy0, //Timer channel 7
irq_dummy0, //Timer channel 6
irq_dummy0, //Timer channel 5
irq_dummy0, //Timer channel 4
irq_dummy0, //Timer channel 3
irq_dummy0, //Timer channel 2
irq_dummy0, //Timer channel 1
irq_dummy0, //Timer channel 0
irq_dummy0, //Real time
irq_dummy0, //IRQ
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
39 / 56
irq_dummy0, //XIRQ
irq_dummy0, //SWI
irq_dummy0, //illegal
irq_dummy0, //cop fail
irq_dummy0, //clock fail
_stext //RESET };
As you see in the example, we only use CAN-specific interrupts and the reset vec-
tor. All other interrupts result in a dummy interrupt.
You also have to provide the function irq_dummy0( ) in your application. Refer to your
hardware description to figure out the solution for your situation.
Back to 9 Steps overview
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7






User Manual Vector CAN Driver
40 / 56
6.6 STEP 6 Compile, Link and Download Now start your compiler by calling the
makefile or just clicking the start button. What
you do is depends on your development tool chain.
Back to 9 Steps overview
6.7 STEP 7 Receiving A Message Congratulations !!
You have now arrived at
Step 7, i.e. you can compile and link. You are very close
to your first CAN communication.
In every project you normally have to spend a lot of the time starting up the hardware
and the development environment.
Make sure that: You have the correct clock frequency (important for baud rate).
You have entered this clock in the dialog box of the Generation Tool.
The memory mapping is correct.
The physical CAN connection is there and has no damage.
You have a terminating resistor (120Ω) if you use high-speed CAN (powertrain).
Your transceiver is initialized properly
After the download of your Application, set a breakpoint in your debugger on the
main (void) function and start. Did it stop at main?
If so,
Congratulations again.
Remove the breakpoint and restart. Now your application is running in the endless
loop. Please check this!
CANoe is very
convenient for
testing a CAN
communication.
As soon as you
see the message
Id or the Name in
the Trace win-
dow after sending
a message, you
know that your
Figure 6-19 Simple Test Environment
hardware settings
are correct.
Now send a CAN message on the bus. It is best to use an ID your ECU normally
has to receive.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7



User Manual Vector CAN Driver
41 / 56
A very easy way to send a message is by using the CANoe (or CANalyzer), a PC-tool
from Vector Informatik. Use the generator block and send the message.
Send the message and observe the Trace window.
Do you see the name of the message or the ID?
Great, your ECU has acknowledged the CAN message, i.e. all hardware settings
are correct.
If you see Error frames, check the list above. The main mistakes are hardware set-
tings (transceiver), the baud rate (clock of CAN Controller), wiring problems and
ground offsets.
Now we are ready to modify our application. Please check in the Generation Tool
on the tab
Receive messages, if the
Indication flag for the message is switched on.
Figure 6-20 Check button for indication flag
There are many
If not, switch it on, start a new generation process, compile and link the system again
more ways to
react when a
and download it to the target.
CAN message is
received. Refer to
Step 9 in this
Now we use the so-called
Indication flag to poll the reception of the CAN message.
manual.
When an interrupt is triggered by the reception of a CAN message, the indication
flag will be set (if chosen in the Generation Tool).
When you use another dbc file, your message will have a different name. You will find
the correct macro for your indication flag in the file yourecu.h (can_par.h). Just search
for
indication.
Example for the HC12: void main(void)
{
hardwareInit();
CanInitPowerOn(kCanInitObj1);
enableInterrupts();
for(;;)
{
/* First Test modification*/
if( Message_2_ind_b )
{ Message_2_ind_b = 0; Breakpoint here ©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
42 / 56
} }
}
The names are generated out of the name of the signal and the pre- and postfixes
from the “names” tab. Refer to the file YourECU.h (can_par.h) for the correct writing of
messages, indication flags etc.
Compile, link and download the application and set a breakpoint (as shown). Now
send the CAN message via the Generator Block.
It stopped at the breakpoint?
If so, you received the message, used the correct macro for the flag and got noti-
fied of the reception.
Back to 9 Steps overview
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7



User Manual Vector CAN Driver
43 / 56
6.8 STEP 8 Sending a Message The next step is the transmission of a CAN message. This is done by calling the
function
CanTransmit( handle );
The
handle specifies the message you want to send. Open the file
yourecu.h
(can_par.h for GENy) and search for “
handle” in the section on send/transmit
objects. Chose the appropriate macro for the send message and use it as shown.
Example:
void main(void)
{
hardwareInit();
CanInitPowerOn(kCanInitObj1);
enableInterrupts();
for(;;)
handle {
/* First Test modification*/
if( Message_2_ind_b )
{
/*Second Test modification*/ if( CanTransmit( CanTxMessage_1 ) == kCanTxOk ) { Message_2_ind_b = 0;
}
}
}
}
Refer to the file YourECU.h (can_par.h for GENy) for the message handles.
Meaning of the return value of CanTransmit The function CanTransmit has a return value, kCanTxOk or kCanTxFailed. The
meaning of this value is not as simple as it looks like.
Without Software Transmit Queue kCanTxOk means that the data has been copied from the RAM to the Tx Register
and the transmit request is set in the CAN Controller hardware. The physical trans-
mission of the message depends on when the message wins the CAN bus arbitra-
tion.
kCanTxFailed means the hardware register is busy or CAN Driver is offline.
With Software Transmit Queue ©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
44 / 56
kCanTxOk could mean the same as above. But it also could mean that the transmit
request is set in the software queue of the CAN Driver and will be processed as soon
as possible. Read more about the software queue in the chapter
6.9.2.3. kCanTxFailed means the CAN Driver is offline.
Full CAN Tx Object There is no Tx queue functionality for Full CAN Tx Objects.
This modified application sends back a CAN message. You should see the re-
sponse message in your Trace window. Refer to the TechnicalRefer-
ence_CANDriver.pdf to get information about the return value.
Do you see the response message in the Trace window?
CONGRATULATIONS! The basic CAN communication is running. Of course this is a very simple application and far away from the complexity of your
application, but as the saying goes:
The longest way starts with the first step(s).
Back to 9 Steps overview
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7



User Manual Vector CAN Driver
45 / 56
6.9 STEP 9 Further Actions The next step is to build up your application around the communication. To do this
in a simple manner, read the following tips and recommendations. You will then be
given an exercise that poses a problem which you will try to solve. After finding the
correct answer, you will understand the order in which the functions of the CAN
Driver are called.
6.9.1 Strategies for Receiving a CAN Message
The
Figure 6-21 shows the calling order of the functions when receiving a mes-
sage.
Indication Flag/Function
Hardware Copy of data to
lockedsoftware buffer
conditional
Precopy Function
exit
Search Algorithm
exit
if not found
Ranges
exit
if matched
ApplCanMsgReceived
conditional
exit
Hardware Filter
CAN-BUS Figure 6-21 Calling Order Of Functions When A CAN Message Is Received
6.9.1.1 Hardware Filter (HW Filter) As you have learned before, you can adjust the hardware filter in the Generation
Tool. Every message that passes the hardware filter triggers an interrupt – if not
using polling mode.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
46 / 56
To reduce your interrupt load, optimize the filters (Generation Tool).
6.9.1.2 ApplCanMsgReceived In the Generation Tool you can choose to have this function called with any recep-
tion of a CAN message that passes the hardware filter.
Here you can filter the messages that pass the hardware filter but contain no rele-
If you select the
function
vant information. At this point, the data is in the receive register (
Rx register). Use
ApplCanMsgRe-
the hardware access macros to figure out ID, DLC and DATA of the received mes-
ceived, the
prototype will be
sage.
generated. You
only have to enter
the function.
6.9.1.3 Ranges Ranges are a software filter mechanism. Since the message is filtered by its ID
and assigned to the categories Network Management, Diagnostics, Application,
etc., you can route more messages on the same
Range precopy function.
6.9.1.4 Search Algorithm To figure out whether a message is meant for your ECU and which message ID it
is the CAN Driver has to compare the ID with an ID-list. This comparison can be
done in different ways. The criterion is the speed for browsing the list. The Genera-
tion Tool offers different search algorithms to choose. Please refer to the CAN
Driver Technical Manual for the differences.
6.9.1.5 Precopy In the Generation Tool (
receive objects/functions) you can enter a name for a mes-
sage-specific precopy function. This function is called by the CAN Driver before
copying the message data from the receive register to the RAM data structure (if
The _CAN_
selected).
macros will be
generated only
when you have
The
Precopy function e.g. can be used to check to see if the data has
chosen a precopy
function or the
changed. Use the
_CAN_ access macros to read the data out of the receive regis-
object is a full can
object.
ter and compare it with the RAM buffer (look in
yourECU.h for
CANgen
and in
can_par.h for GENy for these access macros).
This macro will be only generated if the message is a full can object or you have se-
lected a precopy-function for this message (see later).
As you are in interrupt context, data consistency is not in danger (refer to the tech-
nical reference for you hardware). Keep your actions short in any
Precopy func-
tion.
The return value of the
Precopy function determines what happens next.
kCanCopyData: The driver is to do the copying from receive register to RAM
buffer.
kCanNoCopyData: You did the copy of relevant data and the driver does not need
to call its copying routine.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
47 / 56
6.9.1.6 Indication Flag / Indication Function The application is notified by the indication flags and/or the indication functions
The driver indicates the reception of a message to the application.
Indication Function
This function runs in interrupt context and is message-specific. Keep your action
very short in this function.
You can enter a name for a message-specific
Indication function in the
Generation Tool (in the same way as you did it for the
Precopy function).
Indication Flag
This flag is message-specific. It is set by the CAN Driver and can be polled by the
application. It tells the application a new message has been received.
!!! This flag must be reset by the application. !!! You can use this flag to ensure you are working on the newest contents of a mes-
sage.
If the flag is set, it means that a new message has been received. Clear the flag and
access the received data. If the flag is cleared after your access, you can be sure that
you have current data. If the flag is set, new data has been received in the meantime,
so repeat this once again.
Remember for Data consistency
All flags are set by the driver in an interrupt context. If your µC does not perform an
atomic (i.e. uninterruptible) write access to bit data it is necessary to protect the
write access via an interrupt lock to prevent unexpected change or loss of flag
states. It is recommended to perform this (CAN-) interrupt lock via the API func-
tions CanInterruptDisable / CanInterruptRestore.
Please refer to your controller and/or compiler manual for information about atomic
write access to bit data in your system. In case of doubts, it is recommended to
lock the interrupt during the access.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
48 / 56
6.9.2 Strategies for Sending a CAN Message
The transmission of a CAN message is divided into two parts: the preparations until
the transmission of a message and the transmit interrupt handling, which informs
you about the successful sending of a message.
First we look at the preparations before sending.
Update RAM buffer
CAN Transmit
yes
Buffer free?Entry in Queue
exit
Pretransmit
Copy of data to
hardware buffer
Send Message
CAN-BUS Figure 6-22 States Before Transmitting A CAN Message
6.9.2.1 Update RAM buffer The methods of transmission highly depend on your application. You may have to
send in a fixed cycle, or you may have to send when a specific event occurs.
Both cases require current data. If you use the RAM buffer, you just have to keep
the data in it up-to-date.
When you use your own buffer you should enter the values directly into the trans-
mit register just before sending the message. Otherwise the data could be overwrit-
ten by another transmit message.
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
49 / 56
6.9.2.2 CanTransmit The CanTransmit function initiates the transmission of a specific message. The
You can only be
handle (in the file yourECU.h for CANgen and in can_par.h for GENy) specifies
sure that the
message has
which message is sent.
been sent when
you get the
confirmation
CanTransmit has 2 possible return values, but none of them guarantee that the
interrupt (confir-
mation function or
message has been sent yet. They just say that either the message will be sent as
confirmation flag)
soon as possible (with or without a queue) or the transmission request has been
rejected (see 6.8); 6.9.2.3 The Queue There are two possible causes for a return value of kCanTxOk: either the message
has directly entered the transmit buffer or the message has entered the queue (if
chosen in the Generation Tool).
An entry in the queue means, the
REQUEST to send this message is stored, not
the data. So leave the data untouched until you are sure the message has been
sent, i.e. until the
Confirmation flag is set or the
Confirmation function is called.
6.9.2.4 Pretransmit Function When you do not have a RAM buffer for your message, you must copy the data to
the transmit register of the CAN Controller in the
Pretransmit function. With
the call of the function you get a pointer directly to the transmit registers. In this
case you have to know the distribution of the signals to the bytes, because you do
not get signal access macros.
The time between the call of CanTransmit and the confirmation interrupt is not pre-
dictable. To update your data short before the transmission, use the Pretransmit func-
tion too. If this function is called, you can be sure that this message is the next mes-
sage to be sent.
When the message is sent and at least one ECU receives this message, the ac-
knowledge will trigger the so-called transmit interrupt. This interrupt calls the
transmit interrupt service routine, which in turn might call the confirmation function
or set the confirmation flag.
6.9.2.5 Confirmation Function and Confirmation Flag The
Confirmation function is called in interrupt context, so keep the run time
See the parallels
as short as possible by not doing much in the code.
Now you can be sure, your
between the
indication func-
message has been sent successfully.
tion/flag and the
confirmation
The
Confirmation flag has the same meaning, but you have to poll this flag in
function/flag
your application (similar to the way it is done with the
Indication flag). You
get the macro out of the generated file
yourECU.h (can_par.h).
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
50 / 56
Leave Interrupt
CanTransmitQueuedObject
Queue Empty?
Confirmation Flag/Function
CAN-BUSACKNOWLEDGE
Figure 6-23 Confirmation Interrupt After Transmission Of CAN Message
After the confirmation the queue (if chosen) will be worked on.
Back to 9 Steps overview
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7


User Manual Vector CAN Driver
51 / 56
7 Further Information 7.1 An Exercise For Practice The program below is a small application (
for the HC12) using the basic service- and
call-back functions of the CAN driver. Try to follow the program and answer the
questions connected with.
The application receives a CAN message containing a byte signal
b_Signal_2_c.
After processing the incoming message, the application sends another message
containing only one byte signal, called
b_Signal_1_c.
Can you calculate the value that will be sent back with
b_Signal_1_c depending
on the value of the variable
a and the value of the received signal
b_Signal_2_c?
See the solution at the end of this document
Example for the HC12: /* Includes
*******************************************************************/
#include "can_inc.h" /*for CANgen*/
#include "yourecu.h" /*for CANgen*/
#include "can_par.h" /*only include for GENy*/
/* Variable definition
*******************************************************************/
unsigned char a;
/* Function prototypes
********************************************************/
void main_function(void);
void enableInterrupts( void );
void hardwareInit( void );
/* The Main Function
**********************************************************/
void main(void)
{
hardwareInit();
CanInitPowerOn(kCanInitObj1);
a = 5;
b_Signal_2_c = 0;
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
52 / 56
enableInterrupts();
for(;;)
{
if( Message_2_ind_b )
{
b_Signal_1_c = b_Signal_2_c + a;
if( CanTransmit( CanTxMessage_1 ) == kCanTxOk )
{
/*Disable Interrupt*/
Message_2_ind_b = 0;
/*Enable Interrupt*/
}
}
if( Message_1_conf_b )
{
a=1;
/*Disable Interrupt*/
Message_1_conf_b = 0;
/*Enable Interrupt*/
}
}
}
/* Other Functions
**********************************************************/
void enableInterrupts( void )
{
/*Enable interrupts*/
}
void ApplCanBusOff( void ) /*later uesd for bus off treatment*/
{
;
}
void ApplCanWakeUp( void ) /*later used for wakeup functionality*/
{
;
}
/* new function added in the Generation Tool and application */
canuint8 ApplCanMsgReceived( void )
{
a=a+2;
return( kCanCopyData );
}
canuint8 M1_PretransmitFunction(CanChipDataPtr dat)
{
b_Signal_1_c = b_Signal_1_c +1;
return( kCanCopyData );
}
void M1_ConfirmationFunction(CanTransmitHandle tmtObject)
{
a=a+23;
}
canuint8 M2_Precopy(CanReceiveHandle rcvObject)
{
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
53 / 56
rcvObject = rcvObject; /*to avoid compiler warning. You only
use this handle if you have one
precopy function for two or more
messages*/
a=2;
if( b_CAN_Signal_2_c == b_Signal_2_c )
{
return(
kCanNoCopyData
);
/*same value as before, no need to
copy data, leave interrupt*/
}
else
{
a = b_CAN_Signal_2_c;
return( kCanCopyData );
}
}
void M2_IndicationFunction(CanReceiveHandle rcvObject)
{
rcvObject = rcvObject; /*to
avoid
compiler
warning.
You
only
use this handle if you have
one
precopy
function
for
two
or
more
messages*/
a=a+1;
}
/****************************************************/
void hardwareInit( void )
{
/*
Do your hardware specific initializations here.
Don’t forget to initialize your TRANSCEIVER, if necessary*/
;
}
@interrupt void irq_dummy0(void)
{
for( ;; );
}
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
54 / 56
7.2 The Solution To The Exercise 7.2.1 After the first reception and transmission of a new
value:
a = 1
b_Signal_1_c =
b_Signal_2_c*2+2 7.2.2 After the reception of the same value as before:
a = 2
no return message
Did you get it?
7.2.3 The solution, step by step
At the beginning,
a=5 and b_Signal_2_c = 0
The Main loop is waiting on an Indication Flag for Message 2 and a Confirmation
Flag for Message 1.
The first function that is called after the reception of Message 2 is
ApplCan-
MsgReceived. There the
2 is added to
a and returned with
kCanCopyData, so
the reception process continues.
At this point a=7 and b_Signal_2_c = b_Signal_2_c
The next function executed is
M2_Precopy. The variable
a is set to
2 and the re-
ceived signal b_CAN_Signal_2_c (the data in the Rx register, i.e. in the CAN Con-
troller) is compared with the signal b_Signal_2_c.
If there is no change, the return value kCanNoCopyData stops the receive process
the receive interrupt is exited.
Now a=2 and no response message will be sent.
If there is a difference,
a is set to b_CAN_Signal_2_c and the return value keeps
the receive interrupt going on.
At this point a= b_CAN_Signal_2_c and b_Signal_2_c= b_Signal_2_c
Now the
Indication function M2_IndicatinoFunction is called, where
a is increased by 1.
Now a= b_Signal_2_c+1 and b_Signal_2_c= b_Signal_2_c
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
55 / 56
Since the
Indication flag is set, now the main loop put b_Signal_1_c =
b_Signal_2_c+a, i.e. b_Signal_1_c= 2* b_Signal_2_c+1.
Now the message is requested to be sent (CanTransmit). If the request is an-
swered with a kCanTxOk, the Indication flag is cleared to avoid sending the mes-
sage again and again. Otherwise the flags stay set until the request of sending this
message is successful.
At this point a = b_Signal_2_c+1 and b_Signal_2_c = b_Signal_2_c and
b_Signal_1_c = 2* b_Signal_2_c +1
Before the message is on its way, the function
M1_PretransmitFunction is
called. This function increments the send signal by 1 and the return value lets the
driver copy the data from the RAM buffer to the Tx register.
At this point a = b_Signal_2_c+1 and b_Signal_2_c = b_Signal_2_c and
b_Signal_1_c = 2* b_Signal_2_c +2
Now the message is on its way via CAN. The first node to receive this message (in
this test case, CANoe) gives an acknowledge that triggers a transmit interrupt.
In the function
M1_ConfirmationFunction 23 is added to
a.
Now a = b_Signal_2_c+24 and b_Signal_2_c = b_Signal_2_c and b_Signal_1_c = 2*
b_Signal_2_c +2
Then the
Confirmation flag is set and recognized by the main loop. There the
variable a is set to 1 and the
Confirmation flag is reset to 0 to prevent setting
a over and over again.
So the result is:
a = 1 b_Signal_1_c = 2* b_Signal_2_c +2 ©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7

User Manual Vector CAN Driver
56 / 56
8 Index Acceptance filters ................................. 26, 32
Hardware..................................................... 45
applCanBusOff ........................................... 38
Including Order............................................ 15
ApplCanMsgReceived .................... 46, 52, 54
Indication flag .................................. 41, 49, 55
applCanWakeUp......................................... 38
Indication Flag............................................. 47
baud rate............................................... 29, 41
Indication Function...................................... 47
Bootloader .................................................. 10
Init registers........................................... 25, 29
Bustiming ........................................ 26, 27, 32
Interaction Layer ................................... 12, 13
Bustiming registers ............................... 26, 32
interrupt ....................................................... 47
CAN Driver. 12, 14, 15, 17, 22, 25, 33, 35, 45,
link.......................................35, 36, 40, 41, 42
46
makefile................................................. 35, 40
can_cfg.h .............................................. 25, 33
memory requirement................................... 19
can_inc.h .................................................... 35
message...................................................... 16
CANalyzer................................................... 41
Motivation...................................................... 4
CANdesc IN 8 STEPS ................................ 53
Network Management................................. 12
CANdesc tab............................................... 15
Open
filters............................................ 27, 32
CanInitPowerOn ......................................... 37
Optimze
filters ....................................... 27, 32
CanInterruptDisable.................................... 47
Precopy ...............................19, 46, 47, 52, 54
CanInterruptRestore ................................... 47
Pretransmit............................................ 19, 49
CANoe .................................................. 41, 55
Queue ......................................................... 49
Channel properties ..................................... 23
Ranges........................................................ 46
clock.......................................... 28, 39, 40, 41
receive register............................................ 18
compile ..................................... 35, 36, 40, 41
Registers ..................................................... 18
Confirmation ............................................... 49
Search Algorithm......................................... 46
Data consistency ........................................ 47
signals ......................................................... 16
dbc file ............................................ 11, 22, 41
Strategies .............................................. 45, 48
dbc-file ............................................ 22, 23, 24
transmit register .......................................... 18
Diagnostics ................................................. 12
Transport Protocol....................................... 12
example .......................................... 35, 38, 39
Universal Measurement and Calibration
Example........................ 35, 36, 38, 41, 43, 51
Protocol (XCP).................................. 12, 13
generation process ................... 14, 33, 35, 41
yourecu.h ................35, 36, 37, 38, 41, 43, 51
©2009, Vector Informatik GmbH
Version: 2.4
based of template version 1.7
Document Outline
1.1.66 - UserManual_GENy_InteractionLayer
Microsoft Word - UserManual_GENy_InteractionLayer.doc1.1.68 - UserManual_GENy_InteractionLayers
Interaction Layer with GENy User Manual
(Your First Steps)
Version 1.03.01
Vector Informatik GmbH, Ingerheimer Str. 24, 70499 Stuttgart
Tel. 0711/80670-0, Fax 0711/80670-399, Email can@vector-informatik.de
Internet http:\\www.vector-informatik.de


User Manual Interaction Layer
1 / 35
Authors: Klaus Emmert
Version: 1.03.01
Status: released (in preparation/completed/inspected/released)
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
2 / 35
History Author Date Version Remarks Klaus Emmert
2004-04-29
1.00
Converted from Version 0.8 to
new User Manual Layout.
Klaus Emmert
2004-05-17
1.1
Usage of vstdlib added (started with
IL version 1.83)
Klaus Emmert
2005-06-24
1.02
GENy added as new
Configuration Tool.
Gunnar Meiss
2007-05-16
1.03
ESCAN00020395
Gunnar Meiss
2007-07-12
1.03.01
ESCAN00021408 Update
Contents
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8


User Manual Interaction Layer
3 / 35
Motivation For This Work What is a signal?
A Signal is an abstract container for information. It can hold physical values, states
or commandos. Signals can concern the complete vehicle or only some control
units.
Using the Interaction Layer you do not have to take care about the transmission or
reception of signal or the data consistency. If you need the content of a signal, just
read it, if a value changed, just write it. All the rest is done by the Interaction Layer.
WARNING All application code in any of the Vector User Manuals is for training
purposes only. They are slightly tested and designed to understand the basic
idea of using a certain component or a set of components. 2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
4 / 35
Contents 1 Welcome to the Interaction Layer User Manual............................................. 7 1.1
Beginners with the Interaction Layer start here? ................................ 7
1.2
For Advanced Users .......................................................................... 7
1.3
Special topics .................................................................................... 7
1.4
Additional Documents dealing with the Interaction Layer ................... 7
2 About This Document ..................................................................................... 8 2.1
How This Documentation Is Set-Up ................................................... 8
2.2
Legend and Explanation of Symbols.................................................. 9
3 Interaction Layer – An Overall View ............................................................. 10 3.1
Transmission problems.................................................................... 10
3.1.1
What is left to do for transmission .................................................... 10
3.2
Reception problems......................................................................... 11
3.2.1
What is left to do for Reception ........................................................ 11
3.3
Tools And Files................................................................................ 11
3.3.1
The data base file (DBC file)............................................................ 11
3.3.2
Configuration Tool ........................................................................... 12
3.3.3
Generation Process with CANbedded Software Component ........... 12
3.4
What Is the Vector Interaction Layer................................................ 14
3.5
What The Interaction Layer Does .................................................... 14
4 This Component – A More Detailed View..................................................... 15 4.1
Files to form the Interaction Layer.................................................... 15
4.1.1
Fix files that form the Interaction Layer ............................................ 15
4.1.2
Generated files that must not be changed, too................................. 15
4.1.2.1
Configuration Tool GENy ................................................................. 15
4.1.3
Configurable files............................................................................. 15
4.1.4
il.c.................................................................................................... 15
4.1.5
il_def. h............................................................................................ 15
4.1.6
Il_par.c............................................................................................. 15
4.1.7
il_par.h............................................................................................. 15
4.1.8
il_cfg.h ............................................................................................. 16
4.1.9
il_inc.h ............................................................................................. 16
4.1.9.1
Vstdlib.c / vstdlib.h ........................................................................... 16
4.1.10
Includes when using GENy.............................................................. 16
4.2
Handling of the Interaction Layer ..................................................... 16
5 A Basically Running Interaction Layer In 7 Steps ....................................... 18 2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
5 / 35
5.1
STEP 1 Unpack the delivery ........................................................... 19
5.2
STEP 2 Configuration Tool and DBC File ....................................... 20
5.2.1
Working with the Configuration Tool GENy...................................... 21
5.2.1.1
Project Setup in GENy..................................................................... 21
5.2.1.2
Interaction Layer Settings in GENy .................................................. 21
5.3
STEP 3 Generate Files................................................................... 23
5.4
STEP 4 Add Files to Your Application............................................. 24
5.4.1
Using GENy..................................................................................... 24
5.5
STEP 5 Adaptations For Your Application ....................................... 25
5.6
STEP 6 Compile And Link ............................................................... 28
5.7
STEP 7 Test the Software Component ............................................ 28
5.7.1
Built-up of the test environment ....................................................... 28
5.7.2
Test of Interaction Layer .................................................................. 29
6 Further Information ....................................................................................... 31 6.1
States of the Interaction Layer ......................................................... 31
6.2
Debugging of Interaction Layer ........................................................ 31
6.3
Where to get the generated names for the macros and
functions .......................................................................................... 32
6.4
Usage of flags and functions............................................................ 32
6.5
Data Consistency ............................................................................ 33
7 Index................................................................................................................. 1 2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
6 / 35
Illustrations
Figure 3-1
Transmission Problems ............................................................................ 10
Figure 3-2
Reception Problems ................................................................................. 11
Figure 3-3
Generation Process For Vector CANbedded Software Components ........ 13
Figure 3-4
Overview CAN Driver, Interaction Layer and Application .......................... 14
Figure 4-1
Including Vector Interaction Layer ............................................................ 16
Figure 5-1
Generation Information............................................................................. 23
Figure 5-2
The test environment................................................................................ 28
Figure 5-3
How to get an data base into CANoe........................................................ 29
Figure 5-4
Configure menu and Real adjustment....................................................... 29
Figure 5-5
A trace of the example application with timeout occurring......................... 29
Figure 5-6
Insert a generator block to send the message 201 all 10ms ..................... 30
Figure 5-7
A trace without timeout ............................................................................. 30
Figure 6-1
The State machine of the Interaction Layer .............................................. 31
Figure 6-2
Debug options for Interaction Layer.......................................................... 31
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
7 / 35
1 Welcome to the Interaction Layer User Manual 1.1 Beginners with the Interaction Layer start here? You need some information about this document?
Chapter 2
What is the Interaction Layer?
Chapter 3.4
1.2 For Advanced Users Start reading here.
Chapter 4
7 Steps for Interaction Layer integration.
Chapter 5
1.3 Special topics States of the Interaction Layer
Chapter 6.1
Generated Names for macros and functions ?
Chapter 6.3
Flags and Functions
Chapter 0
1.4 Additional Documents dealing with the Interaction Layer TechnicalReference_InteractionLayer
OEM-specific Documentation
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
8 / 35
2 About This Document This document gives you an understanding of the Interaction Layer. You will
receive general information, a step-by-step tutorial to get the Interaction Layer
running and to use its functionalities.
2.1 How This Documentation Is Set-Up Chapter Content Chapter 1 The welcome page is to navigate in the document. The main parts of the document
can be accessed from here via hyperlinks.
Chapter 2 It contains some formal information about this document, an explanation of legends
and symbols.
Chapter 3 In this chapter you get a brief introduction in this Interaction Layer and its tasks.
Chapter 4 Here you find some more insight in the Interaction Layer.
Chapter 5 Here are the 7 Steps for you to integrate the Interaction Layer, how to do the
necessary settings in the Configuration Tool and how to connect the Interaction Layer
with your application.
Chapter 6 This chapter provides you with some further information.
Chapter 7 In this last chapter there is a list of experiences with the Interaction Layer.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8




































































































































































































































































































































































































































































User Manual Interaction Layer
9 / 35
2.2 Legend and Explanation of Symbols You find these symbols at the right side of the document. They indicate special
areas in the text. Here is a list of their meaning.
These areas
to the right of
Symbol Meaning the text
contain brief
items of
information
The building bricks mark examples.
that will
facilitate your
search for
Comm
ents
You will find key words and information in short sentences in the margin. This will
and
specific
explanation
s
greatly simplify your search for topics.
topics.
The footprints will lead you through the steps until you can use the described
Interaction Layer.
There is something you should take care about.
Useful and additional information is displayed in areas with this symbol.
This file you are allowed to edit on demand.
This file you must not edit at all.
This indicates an area dealing with frequently asked questions (FAQ).
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8




User Manual Interaction Layer
10 / 35
3 Interaction Layer – An Overall View One of the important tasks in programming ECUs for modern vehicles is the
handling of timers for actions like sending messages or monitoring incoming
messages. In some cases this can become quite complex and could be a lot of
programming work to do.
3.1 Transmission problems ABS
WhatWhenHow OftenTimeout& DefaultsNotificationData consistencyDashboard
The names of the
macros are
derived from the
signal names in
Figure 3-1 Transmission Problems
the database with
a pre- and a
postfix. You can
change the
default pre- and
The picture above mentions things to remember when transmitting data. You surely
suffixes in the
Configuration
know these kinds of problems.
Tool.
The Interaction Layer handles the classic problems with transmission and reception
for you. The information which signal or message should be sent in which timing,
which signal triggers a timeout flag when it is not received any more and further
information is stored in the data base (DBC file, use CANdb++ for editing DBC
data) and realized by the Interaction Layer.
Signal access
can be a macros
3.1.1 What is left to do for transmission or a function. This
depends on the
Regarding the transmission, you just have to fill the signal memory locations (use
signal length, its
generated signal/message access macros or functions) with the current values, the
location in the
message and the
transmission itself is done by the Interaction Layer.
transmission
mode.
As you access the signals via macros or functions, the data consistency is granted.
The Configuraion
Tool always
The Interaction Layer notifies the application in case of important events, such as a
generated the
successful transmission of a signal (confirmation) or a timeout when a signal has
best way to
access a signal.
not been received.
Caution
Signal access macros or functions are always
unsigned integer values !!!
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8




User Manual Interaction Layer
11 / 35
3.2 Reception problems New Data?ABS
NotificationTimeout& DefaultsData ConsistencyDashboard
Figure 3-2 Reception Problems
The names of the
The picture above mentions things to remember when receiving data. You surely
macros are
know these kinds of problems.
derived from the
signal names in
the database with
a pre- and a
suffix. You can
change the
3.2.1 What is left to do for Reception default pre- and
suffixes in the
Access the received data via the generated macros or functions any time you need
Configuration
Tool tab Names.
the information. The macros and functions guarantee the data consistency.
Events are signaled to the application via flags (polling) or functions.
You may react on the indications for reception, changed values or timeout. This
depends on the demands of your application.
The Interaction Layer will free you from handling the data transmission and reception
as far as possible. This job is shifted to the data base engineer who develops the
DBC file.
Caution
Signal access macros are always
unsigned integer values!
3.3 Tools And Files There is the same
DBC-file per bus
system (high
3.3.1 The data base file (DBC file) speed, low
speed, etc) for all
suppliers to
The DBC file normally is designed by the vehicle manufacturer and distributed to all
guarantee a
suppliers that develop an ECU.
common basis for
development.
For the Interaction Layer it contains attributes and the information about the
transmission modes of the signals (and messages) and e.g. the cycle times. It
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
12 / 35
contains all information that is necessary for transmitting and receiving signals,
which signal should be time monitored etc.
Every supplier uses the SAME DBC file for one type of vehicle to guarantee a
common basis for development.
3.3.2 Configuration Tool The Configuration Tool is a PC-Tool. It is used to configure the CANbedded
components to the application’s needs. The Configuration Tool generates files that
you have to include in your application.
For the Vector Interaction Layer many of the settings are done in the DBC file (see
above) and many setting can be done in the Configuration Tool. For each signal
flags, default values, access macros or functions and callback functions can be
switched to on or off separately.
3.3.3 Generation Process with CANbedded Software Component The Configuration Tool generates files that contain the configuration and the signal
interface of the CANbedded Software Components. In connection with the source
code of each component, CANbedded can be compiled and linked (see Figure
3-3).
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
13 / 35
CANdela
Network
The standard
Database
Database
generation
process for
Vectors Software
Components.
Application
Configuration Tool
Specific
Data
Generation
Configuration
Signal
Interface
Header
Includes
CANbedded
CANdesc
Software
Application
Parameters
Source
Components
Compiler, Linker
Executable
Figure 3-3 Generation Process For Vector CANbedded Software Components
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
14 / 35
3.4 What Is the Vector Interaction Layer os CAN
Application
Interaction
Layer
CAN Driver
CAN Controller
Transceiver
CAN Bus
Figure 3-4 Overview CAN Driver, Interaction Layer and Application
As you see the Interaction Layer is a higher layer than the CAN Driver and uses
the services of the physical layer for transmission and reception.
3.5 What The Interaction Layer Does The Vector Interaction Layer is responsible for transmission and reception of CAN
messages according their transmission modes, timeout monitoring and setting of
default values. It provides a signal interface to the application.
Therefore the programming effort for transmission and reception of signals is
reduced on some settings on the DBC and in the Configuration Tool and the basic
implementation of the Vector Interaction Layer Component.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8





User Manual Interaction Layer
15 / 35
4 This Component – A More Detailed View 4.1 Files to form the Interaction Layer The Interaction Layer consists of 3 sorts of files.
4.1.1 Fix files that form the Interaction Layer il.c
il_def.h
4.1.2 Generated files that must not be changed, too 4.1.2.1 Configuration Tool GENy Il_par.c
Il_par.h
Il_cfg.h
4.1.3 Configurable files il_inc.h or
_il_inc.h (the underscore means, this file has to be adapted by you)
4.1.4 il.c This file contains the code for the Interaction Layer.
You must not change this file at all.
4.1.5 il_def. h The file il_def.h is the header file of the Interaction Layer.
You must not change this file at all.
4.1.6 Il_par.c Generated file for the Interaction Layer parameters.
You must not change this file at all.
4.1.7 il_par.h Generated header for the Interaction Layer parameters.
You must not change this file at all.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8







User Manual Interaction Layer
16 / 35
4.1.8 il_cfg.h This is the configuration file of the Interaction Layer. It contains the configuration
switches according to your selections in the Configuration Tool.
Do not change this file. You will loose the changes after the next generation process.
4.1.9 il_inc.h INC stands for include. Here you can add includes you need. Use the delivered
standard il_inc.h for this first attempt and look at the default includes as an
example.
It is very important that you do NOT change the including order given in this header.
Include this file (as you did it with can_inc.h) in every c file where you need CAN
functionality. Il_inc.h “replaces” can_inc.h if you use the Interaction Layer.
4.1.9.1 Vstdlib.c / vstdlib.h You have to include the Vector standard library beginning with version 1.83 of the
Interaction Layer.
4.1.10 Includes when using GENy To use the Vector Interaction Layer, only the file il_inc.h must be included in all
application components that want to use Interaction Layer functionality.
Application.c
il_inc.h
Normally the
Interrupts are
disabled after
reset, but this is
Figure 4-1 Including Vector Interaction Layer
not granted for
any hardware
platform.
4.2 Handling of the Interaction Layer Make sure the
interrupts are
The Interaction Layer has to be added to the application and initialized
directly disabled.
after the initialization of the CAN Driver. Take care that the interrupts are disabled
DO
NOT USE
THE FUNCTION
CanInteruptDisable
here.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8


User Manual Interaction Layer
17 / 35
while initialization of the components. Additionally the functions IlRxTask() and
IlTxTask() have to be called cyclically within the cycle time adjusted in the
Configuration Tool (IL options/Timings IL Vector Channel X).
It is very important for the correct function of the Interaction Layer that the timing you
entered in the Configuration Tool and the cycle you call the IlRxTask() and IlTxTask()
are the same. This is the basis for the timing of the Vector Interaction Layer.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
18 / 35
5 A Basically Running Interaction Layer In 7 Steps STEP 1 : UNPACK THE DELIVERY Follow the install shield wizard to unpack the CANbedded Software Components and
the Configuration Tool.
STEP 2: CONFIGURATION TOOL AND DBC FILE Read-in the DBC file in the Configuration Tool and make the configuration settings for
the CANbedded Software Components.
STEP 3: GENERATE FILES Generate the files in the appropriate folders.
STEP 4: ADD FILES TO YOUR APPLICATION Add the CANbedded C and H files to your project or makefile.
STEP 5: ADAPTATIONS FOR YOUR APPLICATION Now your application files must be modified to use the CANbedded Software
Components (includes, cyclic calls, initialization) and do the call back functions.
STEP 6: COMPILE AND LINK Compile and link the complete project and download it to your test hardware or
development environment.
STEP 7: TEST THE SOFTWARE COMPONENT Test the software via a suitable test environment.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8


User Manual Interaction Layer
19 / 35
5.1 STEP 1 Unpack the delivery The delivery of CANbedded Software Components normally comprises the
Configuration Tool and the source code of the software components.
You only have to start the
Setup.exe The Configuration
Tool generates
files for your
and to follow the install shield wizard.
application. It is
the connection
between your
hardware and
We recommend creating a shortcut to the Configuration Tool.
settings, the
requirements of
your vehicle
manufacturer and
the other ECUs,
your ECU has to
communicate
with.
Back to 9 Steps overview
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8


User Manual Interaction Layer
20 / 35
5.2 STEP 2 Configuration Tool and DBC File We recommend for the integration of the Vector Interaction Layer to have a already
running application with already working bus communication (CAN Driver is
integrated and running).
Normally the adjustments in the DBC file are done by the data base engineer. To
be able to use the Interaction Layer the data base attributes and the corresponding
You can safe
timings have to be set properly.
much time when
you start changes
after verifying the
functionality of
For the following steps we used a very simple DBC file with only one receive
the hardware and
software you use
message and two transmit messages.
as basis for
changes.
For more
information about
how to starup
with GENy refer
to the GENy
online help.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8




































































































User Manual Interaction Layer
21 / 35
5.2.1 Working with the Configuration Tool GENy Open the Configuration Tool GENy,
5.2.1.1 Project Setup in GENy create a new configuration and fill-out the
Setup Dialog Pre-configuration file
Microcontroller
Derivative
Compiler
Select the bus system (here CAN) and fill-out the
Channel Setup
window
Browse for your
Database file
and select your ECU out of the
Database Nodes list.
Select the
Software Components Hw_xxx (in
this example it is the HC12), the CAN Driver
(DrvCan_Hw12MscanIdx) and with Il_Vector
the Interaction Layer.
Set
the
Generation Paths (<Shift> +<F7>) correctly.
5.2.1.2 Interaction Layer Settings in GENy For this example we want to monitor the reception of the Signal_2. If this signal is
not received over an adjustable (in the DBC file – use CANdb++ editor) period of
time, a timeout occurs.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8


User Manual Interaction Layer
22 / 35
There are two ways your application can be notified of a timeout,
via a
flag or
a
function.
In this example we use a function for notification.
Open the
Configuration Options for
Signal_2 via clicking Signal_2 in the
navigation view. Add a timeout function by clicking the
Add button and entering a
name or working with the default as shown.
Figure 5-1 Activate the Timeout Monitoring of Signal_2
Back to 9 Steps overview
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8




User Manual Interaction Layer
23 / 35
5.3 STEP 3 Generate Files Click on the button
to start the generation process for GENy.
Figure 5-1 Generation Information
The results of the Generation Process are shown in the two views at the bottom of
GENy.
Generated Files
This is a list with all file that GENy has generated and the folder information.
Messages
Here the information that occurs during the generation process. Take care of this
information after any generation process. Important generation error information
could be displayed there as you see in the example above.
Back to 9 Steps overview
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8



User Manual Interaction Layer
24 / 35
5.4 STEP 4 Add Files to Your Application 5.4.1 Using GENy Copy the core files for the Interaction Layer out of the delivery in the directory you
reserved for.
Add those new files together with the generated ones (see Figure 5-1) to the file list
of you compiler or makefile.
If you want to apply changes you have done in the Configuration Tool, you must start
the generation process again. Remember compiling afterwards.
Starting with IL implementation
version 1.83 the IL uses the Vector standard library
vstdlib for memory copy and clear routines to avoid calls to the C standard library.
Therefore it is required in that case to
link the file
vstdlib.c to the project. The
v_def.h includes the corresponding header.
Back to 9 Steps overview
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8



User Manual Interaction Layer
25 / 35
5.5 STEP 5 Adaptations For Your Application Using CANgen and GENy
To be able to compile and link, you have to do a few further adaptations in your
application.
This is the example you know from the CAN Driver. For a first test, this simple
application without any function except for calling the Interaction Layer Tasks
IlRxTask() and IlTxTask() cyclically, is enough.
In the following example application only the modifications are explained and
emphasized.
Example for HC12:
/* Includes*********************************************************/
#include "can_inc. h" #include "yourecu. h" #inlcude”il_inc.h”; /* with this include, the other two will be
included too.*/ unsigned char timerelapsed;
/*the function IlRxTask() and IlTxTask()
must not be called in interrupt context. So
this flag is used as an indicator, that a
timer interrupt occurred and is polled in
the application. */
/*Function prototypes **********************************************/
void enableInterrupts( void );
void hardwareInit( void );
/*Main Function ****************************************************/
void main(void)
{
/*make sure that the interrupts are disabled or disable interrupts
here.*/
hardwareInit();
It is forbidden to
use any CAN functionality CanInitPowerOn();
before IlInitPowerOn(); /*To use the Interaction Layer you have CanInitPowerOn
!!! to do the initialization first.
For the case your module does not know
this function, use IlInit(); */
timerelapsed = 0; /* timerelapsed = 0x00 no interrupt occurred
timerelapsed = 0xff interrupt occurred
enableInterrupts();
IlRxStart();
IlTxStart(); 2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
26 / 35
for(;;)
{
/* call of IlRxTask() and IlTxTask() if timerelapsed = 0xff*/
if( timerelapsed == 0xff)
{
timerelapsed = 0; /*clear the flag to call NmTask()
only once after a timer interrupt*/
IlRxTask(); /*cyclic call for interaction layer*/
IlTxTask();
}
}
}
void ApplCanBusOff( void )
{
;
}
void ApplCanWakeUp( void )
{
/*Call-Back function at the transition from SleepMode to sleep
indication recommended*/
}
void enableInterrupts( void )
{
CLI();
}
/*This is the function called in case of a timeout of the message_2 that
should be received cyclically*/
void ApplSignal_2SigTimeout( void )
{
IlPutTxMissingSignal(0x3d);
/*Trigger to send this message in case
of a timeout. Both names are defined
in the YourECU.h.*/
}
void hardwareInit( void )
{
/*
Do your hardware specific initializations here.
Remember your TRANSCEIVER
*/
}
@interrupt void irq_dummy0(void)
{
for( ;; );
/*all
other
interrupts
except
the
CAN
Interrupts are routed to this function.*/
}
/*This is the interrupt function of the timer interrupt. The timer will
be reset and the timerelapsed indicates the occurrence of an interrupt
for the application (see code above). */ 2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8


User Manual Interaction Layer
27 / 35
@interrupt void irq_timer0(void)
{
/*reload timer*/
timerelapsed = 0xff;
}
You also have to do modifications in the interrupt vector table. The occurrence of a
timer interrupt has to lead to the timer interrupt function. In this example you see
that the vector for the timer0 interrupt is added
.
Example for HC12:
const functptr vectab[] = { // @0xFFC4 start address of table
CanTxInterrupt, // $FFC4 CAN transmit
CanRxInterrupt, // $FFC6 CAN receive
CanErrorInterrupt, // $FFC8 CAN error irq_dummy0, // reserved
irq_dummy0, //
irq_dummy0, //
CanWakeUpInterrupt, // $FFD0 CAN wake-up
irq_dummy0, //ATD
irq_dummy0, //SCI 2
irq_dummy0, //SPI
irq_dummy0, //SPI
irq_dummy0, //Pulse acc input
irq_dummy0, //Pulse acc overf
irq_dummy0, //Timer overf
irq_dummy0, //Timer channel 7
irq_dummy0, //Timer channel 6
irq_dummy0, //Timer channel 5
irq_dummy0, //Timer channel 4
irq_dummy0, //Timer channel 3
irq_dummy0, //Timer channel 2
irq_dummy0, //Timer channel 1
irq_timer0, //Timer channel 0
irq_dummy0, //Real time
irq_dummy0, //IRQ
irq_dummy0, //XIRQ
irq_dummy0, //SWI
irq_dummy0, //illegal
irq_dummy0, //cop fail
irq_dummy0, //clock fail
_stext //RESET };
Back to 9 Steps overview
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8






User Manual Interaction Layer
28 / 35
5.6 STEP 6 Compile And Link Now start your compiler by calling the
makefile or just clicking the start button, this
depends on your development tool chain.
Back to 9 Steps overview
5.7 STEP 7 Test the Software Component You remember the testing method from the CAN Driver? To test the Interaction
Layer we use the same test environment with a few modifications.
5.7.1 Built-up of the test environment Figure 5-2 The test environment
The network will consist of 2 nodes, a real one (YourECU) and the simulated one,
the TestNode (as named in the data base).
Open your CANoe or CANalyzer.
The next step is to
Associate a new
database, the same data base (DBC file)
you use for your application.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8




User Manual Interaction Layer
29 / 35
Figure 5-3 How to get an data base into CANoe
Figure 5-4 Configure menu and Real adjustment
Make sure that the CANoe mode is switched to REAL and you have chosen the same
baud rate as in your real node YourECU.
5.7.2 Test of Interaction Layer Now start your Application on the hardware platform and the CANoe/CANalyzer.
Now you should see the cyclic message sent via the Interaction Layer, the
Message_1. Additionally you see the Timeout_Message, because the cyclic
message from CANoe is not being sent.
Figure 5-5 A trace of the example application with timeout occurring
!!! CONGRATULATIONS !!! The Interaction Layer is basically working.
Now try to prevent the timeout from occurring. Insert a generator block and send
the message with the ID 201 (Message_2) e.g. in a cycle of e.g. 10ms.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8



User Manual Interaction Layer
30 / 35
Figure 5-6 Insert a generator block to send the message 201 all 10ms
Restart the application and CANoe and the Timeout_Message will not occur
anymore.
Figure 5-7 A trace without timeout
This is working, too? You have implemented the Interaction Layer correctly for the
first time. Now you can go on.
Back to 9 Steps overview
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8


User Manual Interaction Layer
31 / 35
6 Further Information Now the Interaction Layer is basically working. To get a deeper understanding of
this module continue with this chapter. A very detailed description of the API you
find in the Technical Reference of the Interaction Layer.
6.1 States of the Interaction Layer The following figure shows the state machine of the Interaction Layer. There are
two identical state machines, one for transmission (
Tx) and one for reception (
Rx).
void
IlRxStart( void );
IlRxvoid
IlInit( void );
void
IlStop( void );
void
IlInit( void );
void
IlRxWait( void );
void
IlTxStart( void );
void
IlTxStop( void );
void
IlTxWait( void );
void
IlRxRelease( void );
void
IlTxRelease( void );
runningWait
Stop
PowerOn
Release
Start
waitingsuspendedInit
dI
uninit
Stop
Figure 6-1 The State machine of the Interaction Layer
Use the functions to switch the states of the Interaction Layer to your demands.
This becomes very important using the Interaction Layer together with a Network
Management.
6.2 Debugging of Interaction Layer Using the Interaction Layer you can select two main debug options.
Figure 6-2 Debug options for Interaction Layer
The argument check for the IL functions is used to check the arguments passed to
functions of the Interaction Layer. If an error was detected, the return value of the
functions will contain an error code. More about this feature see the Technical
Reference Interaction Layer.
The assertions you should use only during the development process.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
32 / 35
All assertions branch to the function
void ApplIlFatalError( ErrorCode ); where you can analyse the cause of the assertion.
6.3 Where to get the generated names for the macros and functions To avoid errors
occurring from
false writing a
You know the situation, the files are generated and now you start to develop your
recommend to
copy and paste
application. What is the name of the generated macros for the indication function?
the name from
What is the correct writing of the callback function? You know the signal name and
the file
YourECU.h and
your pre- and postfixes but:
ilpar.h.
Using GENy
all this information you get out of the generated file:
ilpar.h. 6.4 Usage of flags and functions The Interaction Layer is signal oriented. So all flags and functions notify events that
have to do with signals. There are flags and functions for reception and
transmission. See first all flags and functions concerning the reception of data.
Indication Flag Indicates the reception of a signal
Indication Function FirstValue Flag Can be used to indicate the reception of the signal since the last
reset of this flag or of the Interaction Layer
DataChanged Flag Indicates a changed signal
Timeout Flag Indicates a missing reception of a signal for the adjusted time.
Timeout Function to confirm the transmission there is one flag and one function.
Shows that the message containing the signal has been
Confirmation Flag acknowledged by another node.
Confirmation Function This acknowledge is sent when at least one ECU has receive the
message. The acknowledge triggers a transmit interrupt. Within
this interrupt the flag is set and the confirmation function is called.
You can use only
the flag, only the
The confirmation guarantees that the message containing the regarded signal has
function or both
combined. This is
been sent.
up to your
application.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
33 / 35
6.5 Data Consistency A very important part is the knowledge about data consistency and the situations
you have to take care for it.
Refer to the chapter dealing with the data consistency in the Technical Reference
of the Interaction Layer.
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8

User Manual Interaction Layer
1 / 35
7 Index Bootloader .................................................... 9
il_inc.h ......................................................... 16
clock............................................................ 27
Il_inc.h ......................................................... 15
compile........................................................ 25
ilpar.c........................................................... 15
Compile....................................................... 28
IlRxTask ................................................ 17, 26
confirmation ................................................ 10
IlTxTask................................................. 17, 26
dbc-file ........................................................ 11
Include......................................................... 16
Example ................................................ 25, 27
link ............................................................... 25
generation process ............................... 16, 24
Link.............................................................. 28
Generation Process .................................... 12
makefile ....................................................... 28
Generation Tool .......................................... 16
Motivation ...................................................... 3
il.c................................................................ 15
reception ................... 3, 10, 11, 14, 21, 31, 32
Il.c ............................................................... 15
Reception .............................................. 11, 32
il_cfg.h......................................................... 16
Test ............................................................. 28
il_def. h ....................................................... 15
transmission .................... 3, 10, 11, 14, 31, 32
il_def.h ........................................................ 15
vstdlib .......................................................... 24
2007, Vector Informatik GmbH
Version: 1.03.01
based on template version 1.8
1.1.69 - WELCOMEtoCANbedded
PowerPoint-Präsentation1.1.70 - WELCOMEtoCANbedded_ind
OutlinePage 1Page 2Page 3Page 41.1.71 - WELCOMEtoCANbeddeds


Welcome to CANbedded
Software Components for
Communication and Diagnostics.
© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
V1.02
2006-02-09



Get To Know The CANbedded Environment
The picture shows the layer model of the CANbedded components, their basic functions and connections.
CANbedded consists of a set of source code components you have to include in your application. The sort of
components depends on your
delivery.
The
Configuration Tool is the connection between the components and your project specific needs. It
generates files you also have to include in your application.
CANbedded Software ComponentsConfiguration Toolfor parameters and configuration of all
components
more see Online Help
Communication Control Layersoftware component integration and hardware
abstraction.
CAN Driverhardware specific CAN chip characteristics and
provision of a standardized application interface
Interaction Layerwith signal interface
Network Managementto control the CAN bus
Transport Protocolfor data exchange of more than 8 data bytes
Universal Measeurement and Calibration Protocolmeasurement and calibration of the ECU via different
bus systems.
Diagnostics Layeraccording to Keyword Protocol 2000 / UDS
How to start with ...slide 3CANbedded tutorialsslide 4© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 2
:






How to start with CANbedded Software Components
Follow the install shield wizard to unpack your delivery
Open the Configuration Tool (CANgen, DBKOMgen, GENy)
Create a new configuration, insert compiler, derivative,
data base file and select your node
Configure all CANbedded Components that you want to use
Generated the files
Add the generated files to your application project
Adapt you application to CANbedded Software Components
T Includes
T Initialization
T cyclic calls
T callback functions …
Compile and link the project
Download and Test
CANbedded environmentslide 2CANbedded tutorialsslide 4© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 3
:


Get To Know The CANbedded Tutorials
T
Beginners of CANbedded components should read the
UserManual_Startup_<OEM>_CANbedded first.
T
If not part of the delivery read the component specific user manuals
UserManual_<Component>. And if you use the CCL read the CCL user manual first.
T
There is a set of user manuals and references for every component as you see
below.
Document TypesUserManualFIRST steps to get an example executable running for each
component or the
complete delivery (if available for you OEM).
e.g. UserManual_CCL, UserManual_Startup_<OEM>_CANbedded
Technical Reference(SW)More detailed information about the component, API... e.g.
TechnicalReference_candrv
Technical Reference(HW)Hardware specific information of the component if available.
e.g. TechnicalReference_CAN_HC12
CANbedded environmentslide 2How to start with ...slide 3© 2006. Vector Informatik GmbH. All rights reserved. Any distribution or copying is subject to prior written approval by Vector.
Slide 4
:
Document Outline