dSPACECalibrationAndBypassingServiceImplementation
dSPACECalibrationAndBypassingServiceImplementation
Implementation
For Service Version 2.4
To access the Web version of this document, click the following link or scan the QR code:
https://www.dspace.com/dspace-help/Rb4Ln
To access the Web version, you must have a mydSPACE account. For more information on the
mydSPACE registration process, refer to https://www.dspace.com/faq?097.
How to Contact dSPACE
Mail: dSPACE GmbH
Rathenaustraße 26
33102 Paderborn
Germany
Tel.: +49 5251 1638-0
E-mail: [email protected]
Web: https://www.dspace.com
If possible, always provide the serial number of the hardware, the relevant dSPACE License
ID, or the serial number of the CmContainer in your support request.
Important Notice
This publication contains proprietary information that is protected by copyright. All rights
are reserved. The publication may be printed for personal or internal use provided all the
proprietary markings are retained on all printed copies. In all other cases, the publication
must not be copied, photocopied, reproduced, translated, or reduced to any electronic
medium or machine-readable form, in whole or in part, without the prior written consent
of dSPACE GmbH.
This publication and the contents hereof are subject to change without notice.
Contents
3
May 2024 dSPACE Calibration and Bypassing Service Implementation
Contents
4
dSPACE Calibration and Bypassing Service Implementation May 2024
Contents
DSECU_CUSTOM_COMMANDS.................................................................... 93
DSECU_FLASH_COMMANDS........................................................................ 94
5
May 2024 dSPACE Calibration and Bypassing Service Implementation
Contents
Index 141
6
dSPACE Calibration and Bypassing Service Implementation May 2024
About This Reference
Contents This document gives you information on how to implement the dSPACE
Calibration and Bypassing Service in your ECU code. The document also provides
detailed information on the available functions and macros needed to specify
and configure the service.
Note
Symbol Description
Indicates a hazardous situation that, if not avoided,
V DANGER
will result in death or serious injury.
Indicates a hazardous situation that, if not avoided,
V WARNING could result in death or serious injury.
Indicates a hazardous situation that, if not avoided,
V CAUTION could result in minor or moderate injury.
Indicates a hazard that, if not avoided, could result in
NOTICE
property damage.
Indicates important information that you should take
Note
into account to avoid malfunctions.
Indicates tips that can make your work easier.
Tip
7
May 2024 dSPACE Calibration and Bypassing Service Implementation
About This Reference
Symbol Description
Indicates a link that refers to a definition in the
glossary, which you can find at the end of the
document unless stated otherwise.
Follows the document title in a link that refers to
another document.
Naming conventions dSPACE user documentation uses the following naming conventions:
Special Windows folders Windows‑based software products use the following special folders:
Tip
Tip
8
dSPACE Calibration and Bypassing Service Implementation May 2024
About This Reference
Tip
Accessing dSPACE Help and After you install and decrypt Windows‑based dSPACE software, the
PDF files documentation for the installed products is available in dSPACE Help and as PDF
files.
dSPACE Help (local) You can open your local installation of dSPACE Help:
§ On its home page via Windows Start Menu
§ On specific content using context-sensitive help via F1
PDF files You can access PDF files via the icon in dSPACE Help. The PDF
opens on the first page.
9
May 2024 dSPACE Calibration and Bypassing Service Implementation
About This Reference
10
dSPACE Calibration and Bypassing Service Implementation May 2024
License Agreement for the dSPACE Calibration and Bypassing Service
Introduction If you want to work with the dSPACE Calibration and Bypassing Service, you
have to accept the License Agreement first.
License Agreement
This license is a legal Agreement between you, the end user, either individually
or as an authorized representative of the company acquiring the license,
and dSPACE GmbH acting directly or through its local dSPACE companies
or authorized distributors (collectively “dSPACE”), concerning the use of the
C code containing the dSPACE Calibration and Bypassing Service (hereinafter
referred to as “the Service”) together with any other materials which are
provided for use in connection with the Service, including without limitation the
executable for installation of the Service, any associated user manual and internal
documentation (hereinafter collectively referred to as “the Program”).
1. Grant of License Unless explicitly agreed otherwise, dSPACE grants you a nonexclusive license to
use the Program and execute the Service as described in the respective product
11
May 2024 dSPACE Calibration and Bypassing Service Implementation
License Agreement for the dSPACE Calibration and Bypassing Service
2. Restrictions of Use You may not market, distribute or transfer copies of the Program, in whole or
in part, to third parties (including any subsidiary, affiliate or company under
common control with you) or transfer the Program (directly or indirectly) via
Internet or network applications (such as Citrix, Microsoft Remote Desktop or
other terminal servers) or grant third parties any access to the Program by any
means. You may not rent, lease or loan the Program.
These restrictions do not prevent you from providing compiled object code
versions of the Service as part of your own ECU code to third parties, subject
to the condition that:
§ This takes place in the course of a project where (amongst others) dSPACE
tools are used, and
§ The code is used for the sole purpose of product development and not for use
in any end product or production.
The recipient of your respective ECU code needs to be instructed accordingly and
shall undertake to comply with these restrictions and to agree to the Limitation
of Liability according to Clause 4 hereunder. dSPACE reserves the right to ask for
written confirmation that appropriate instructions have been issued.
Upon request and at the sole discretion of dSPACE, you may be granted
permission to provide the Service itself, in whole or in part, to third parties as
part of your own ECU source code, subject to the conditions stated above. To be
valid, such permission needs to be granted in writing by dSPACE.
For the avoidance of doubt, in any case any transfer of or granting of access to
parts of the Program other than the Service itself is explicitly prohibited.
4. Limitation of Liability The Program was designed and tested solely for use in research and product
development and is supplied to you by dSPACE exclusively for this purpose. It
must be put into operation exclusively by suitably trained and expert operating
personnel under strict compliance with the safety measures described in the
software documentation. Any use of the Program or compiled object code
versions of the Service for purposes and under conditions other than the above,
including but not only any use in end products, constitutes inappropriate use.
Any liability by dSPACE under mandatory law, including but not restricted to
product liability law, for damages of any kind that may be caused by using the
Program or compiled object code versions of the Service in areas other than
product development shall be limited, even to the point of total exclusion, as the
case may be. In the event of claims by third parties against dSPACE that are due
12
dSPACE Calibration and Bypassing Service Implementation May 2024
License Agreement
In the event that any of the above terms is or becomes invalid, the remaining
terms shall continue in full force and effect.
Any failure to enforce, or any waiver of, any right under this Agreement by
dSPACE shall not be construed as a waiver of future rights.
The legal regulations shall apply in addition to the terms of this Agreement,
except in cases where they conflict with said terms. This Agreement shall be
governed by the laws of the Federal Republic of Germany, excluding the UN
Convention on Contracts for the International Sale of Goods (CISG).
13
May 2024 dSPACE Calibration and Bypassing Service Implementation
License Agreement for the dSPACE Calibration and Bypassing Service
14
dSPACE Calibration and Bypassing Service Implementation May 2024
Introduction to the dSPACE Calibration and Bypassing Service Implementation
Introduction The dSPACE Calibration and Bypassing Service is used to control communication
between an ECU and a calibration and/or prototyping tool. It can be used for
calibration, data acquisition, bypassing and ECU flash programming purposes.
System Components................................................................................ 17
Details on the components of a system that uses the dSPACE Calibration
and Bypassing Service.
Software Layers....................................................................................... 21
The dSPACE Calibration and Bypassing Service has several software
layers.
15
May 2024 dSPACE Calibration and Bypassing Service Implementation
Introduction to the dSPACE Calibration and Bypassing Service Implementation
Introduction The dSPACE Calibration and Bypassing Service is used to control communication
between an ECU and a calibration and/or prototyping tool. It can be used for
calibration, data acquisition, bypassing and ECU flash programming purposes.
Access to ECU application and During development of an ECU it is often necessary to access the application
resources running on the ECU. For example, values that are calculated by the ECU must be
measured, or parameters must be calibrated to change the behavior of the ECU
control algorithm.
The dSPACE Calibration and Bypassing Service provides access to the ECU
application and the ECU resources for calibration, measurement, bypassing and
ECU flash programming.
Further requirements To perform calibration, data acquisition (DAQ), bypassing, or ECU flash
programming using the dSPACE Calibration and Bypassing Service, different
components are required:
Calibration and DAQ For calibration and DAQ, you need the following
items:
§ PC with ControlDesk
§ ECU with DCI‑GSI2
or
RapidPro system used as a stand‑alone prototyping ECU
§ USB connection between the RapidPro system and the host PC with
ControlDesk
or
Ethernet connection between the ECU with DCI‑GSI2 and the host PC with
ControlDesk
Implementing the dSPACE Calibration and Bypassing Service is necessary in the
following cases:
16
dSPACE Calibration and Bypassing Service Implementation May 2024
System Components
ECU flash programming For ECU flash programming, you need the
following items:
§ dSPACE ECU Flash Programming Tool
§ DCI‑GSI2
§ Ethernet connection between the host PC with dSPACE ECU Flash
Programming Tool and the DCI‑GSI2
Service features For information on the features provided by the dSPACE Calibration and
Bypassing Service, refer to Features of the dSPACE Calibration and Bypassing
Service (dSPACE Calibration and Bypassing Service Feature Reference ).
System Components
Introduction To make use of the dSPACE Calibration and Bypassing Service, your system must
have different components.
17
May 2024 dSPACE Calibration and Bypassing Service Implementation
Introduction to the dSPACE Calibration and Bypassing Service Implementation
System components for The following illustration shows the required system components for working
working with an ECU with an ECU:
ECU
Custom code
Command server
Tool RAM
18
dSPACE Calibration and Bypassing Service Implementation May 2024
System Components
System components for The following illustration shows the required system components for working
working with a RapidPro with a RapidPro system used as a stand‑alone prototyping ECU:
system
PC with ControlDesk
RTLib
Custom code
Command server
Tool RAM
Host applications: A host application is required to access the ECU or RapidPro system via the
ControlDesk, RTI Bypass dSPACE Calibration and Bypassing Service.
Blockset, dSPACE ECU Flash
Host application for calibration and data acquisition You can use
Programming Tool
ControlDesk on your PC as a host application to calibrate parameters and
perform data acquisition (DAQ) on an ECU or RapidPro system used as a
stand‑alone prototyping ECU.
Host application for ECU function bypassing You can use the RTI Bypass
Blockset to implement communication between an ECU and the dSPACE
prototyping system for ECU function bypassing.
Note
19
May 2024 dSPACE Calibration and Bypassing Service Implementation
Introduction to the dSPACE Calibration and Bypassing Service Implementation
Host application for ECU flash programming A flash tool, for example,
the dSPACE ECU Flash Programming Tool, can access the dSPACE Calibration and
Bypassing Service to program the ECU‘s flash memory.
Note
Note
Currently, only the PODs have an LVDS interface which can be used for
bypassing.
Host interface for calibration and data acquisition When the dSPACE
Calibration and Bypassing Service is used for calibration or data acquisition, the
commands and data sent by the host PC are not received directly by the ECU,
but by the host interface. The host interface forwards them to the ECU. This
is realized via data structures located in the tool RAM. The location of the tool
RAM depends on the connected hardware:
§ With the DCI‑GSI2, the tool RAM is in the ECU RAM.
§ With a DPMEM‑based POD, the tool RAM is in a dual‑port RAM.
§ With the communication module (COM module) of the RapidPro system used
as a stand‑alone prototyping ECU, the tool RAM is in a dual‑port RAM.
The data structures are accessed either by the host interface or by the ECU.
Hence, the host interface is a piece of hardware that implements the host
connection itself and a dual-port RAM (for a DPMEM‑based POD or the COM
module of the prototyping ECU) or a debug interface to access the data
structures in the ECU´s RAM (for the DCI‑GSI2).
The software running on the host interface contains, among other modules, a
host interface module and the master of the dSPACE Calibration and Bypassing
Service. The host interface module receives the commands from the host
application and calls corresponding functions in the dSPACE Calibration and
Bypassing Service master. The master is responsible for setting up the tables for
DAQ, and for calling commands on the ECU.
Host interface for bypassing When the dSPACE Calibration and Bypassing
Service is used for bypassing, the software that controls the service runs on the
prototyping system. That means that the master of the dSPACE Calibration and
Bypassing Service is on the prototyping system. The host interface is used to
transfer the data sent by the bypassing system to the ECU. It simply forwards the
read/write commands.
20
dSPACE Calibration and Bypassing Service Implementation May 2024
Software Layers
ECU software The dSPACE Calibration and Bypassing Service consists of several modules:
§ dSPACE DAQ service module that is needed to perform data acquisition and/or
bypassing
§ Command Server module that processes the commands sent by the host
interface
The Command Server module receives the commands from the host interface,
processes them, and sends back their return values.
§ Customer‑specific module that implements the flashing algorithm and
additional commands
Some functions must be adapted to a specific ECU. For example, flashing
algorithms depend on the ECU’s flash memory. In addition, there is a
custom command interpreter which can be used to add customer‑specific
commands. The custom command feature is available only as part of a
dSPACE engineering service, because it requires modifications to the DCI‑GSI2
firmware.
For a RapidPro system used as a stand‑alone prototyping ECU, the custom
layer is already implemented for the given processor module. Hence, the
appropriate functions are integrated in the dSPACE Calibration and Bypassing
Service, which is included in the RTLib (real‑time library).
Service configuration The dSPACE Calibration and Bypassing Service is widely configurable and can be
adapted to the needs of a specific project. For example, it is possible to use only
the DAQ Service module. In that case, no commands can be sent to the ECU,
which means that features like ECU flash programming are not available.
Software Layers
Software layers and APIs Several software components and APIs are involved in using the dSPACE
Calibration and Bypassing Service. They are included in the ECU application or
ECU boot code with the following modules integrated:
§ Standard dSPACE Command Service, which provides the Mailbox API used by
the dSPACE Calibration and Bypassing Service host. The dSPACE Calibration
and Bypassing Service is configured to meet your ECU requirements through
21
May 2024 dSPACE Calibration and Bypassing Service Implementation
Introduction to the dSPACE Calibration and Bypassing Service Implementation
The following illustration shows the different software layers and APIs and their
dependencies:
Custom-specific modules
(e.g., flash driver, page
Custom API
switch functions for
RapidPro systems)
Custom-specific
Standard dSPACE
Calibration and Bypassing
service adaptation
Service Custom API (e.g., flash functions,
calibration commands)
dSPACE Calibration
dSPACE Command and Bypassing Service
Mailbox API
Service (slave) configuration file
(header file)
22
dSPACE Calibration and Bypassing Service Implementation May 2024
dSPACE Calibration and Bypassing Service Files
Note
Introduction The functions and configuration options used to implement the dSPACE
Calibration and Bypassing Service are contained in different header and code
files which you must compile and link to the ECU code.
Note
File structure The following tables show the header and code files for the dSPACE Calibration
and Bypassing Service. Different files are required, depending on the task you
want to perform.
23
May 2024 dSPACE Calibration and Bypassing Service Implementation
Introduction to the dSPACE Calibration and Bypassing Service Implementation
Note
You must compile and link the files to your ECU application.
Note
24
dSPACE Calibration and Bypassing Service Implementation May 2024
Elementary Data Types
Note
§ The dsECUboot module must only be compiled and linked if you want to
use the boot check function.
§ The dsECUboot module can be integrated into either the ECU application
code or the ECU boot code, regardless of the other header and code files
which are listed in the first table (see above).
Data types The dsECUcfg.h and dsECUbootcfg.h files define the data types for the
dSPACE Calibration and Bypassing Service. The default values listed below match
the most ECU processors:
typedef unsigned char DSECU_UInt8;
typedef signed char DSECU_Int8;
typedef unsigned short DSECU_UInt16;
typedef signed short DSECU_Int16;
typedef unsigned long DSECU_UInt32;
typedef signed long DSECU_Int32;
typedef float DSECU_Flt32;
typedef double DSECU_Flt64;
25
May 2024 dSPACE Calibration and Bypassing Service Implementation
Introduction to the dSPACE Calibration and Bypassing Service Implementation
26
dSPACE Calibration and Bypassing Service Implementation May 2024
Integration of the dSPACE Calibration and Bypassing Service
Introduction The ECU application must be instrumented by the dSPACE Calibration and
Bypassing Service.
Introduction The dSPACE Calibration and Bypassing Service provides three API functions for
initializing the service and performing command processing.
27
May 2024 dSPACE Calibration and Bypassing Service Implementation
Integration of the dSPACE Calibration and Bypassing Service
A typical location in the ECU code is where other initializations of the ECU are
performed. You need to access the tool RAM for this, so the chip select must first
be suitably programmed.
Foreground service The foreground service of the dSPACE Calibration and Bypassing Service is called
to transfer data to and from the ECU. For data transmission from the ECU to
the host, this is done by copying the (measurement) data to the tool RAM, and
invoking a trigger on the host interface. When bypassing is performed, data is
also copied from the host to the ECU. An interrupt can be used for this.
Background service The background service of the dSPACE Calibration and Bypassing Service checks
whether the tools are connected to the ECU and whether they are working
correctly. This is done by executing an alive check and activating the Command
Server. Depending on the configuration of the dSPACE Calibration and Bypassing
Service, the background service also processes commands.
Download and start of the The dSPACE Calibration and Bypassing Service can be used for ECU flash
flash kernel programming with the DCI‑GSI2 ECU interfaces. A single boot check function
of the dSPACE Calibration and Bypassing Service must be integrated in your ECU
application or the ECU‘s boot code to allow ECU flash programming.
The flash functions of the dSPACE Calibration and Bypassing Service are not
integrated into the standard ECU application, but into a separate flash kernel.
When the ECU is to be flashed, the DCI‑GSI2 sends a flashing request to the
dSPACE mailbox in the tool RAM, and triggers an ECU reset. When the ECU
28
dSPACE Calibration and Bypassing Service Implementation May 2024
Integration of the dSPACE Calibration and Bypassing Service in the ECU Code
reboots, the boot check function of the dSPACE Calibration and Bypassing
Service checks whether there is a flashing request. If there is, the boot check
function on the ECU waits until the flash kernel is loaded to the ECU‘s RAM
and started. The ECU then runs from the flash kernel. The ECU is ready to
receive flash commands. The flash tool sends a sequence of erase and program
commands to flash the new ECU application code or calibration data to your
ECU.
Integration of the dSPACE Calibration and Bypassing Service in the ECU Code.......................... 29
References
Integration of the dSPACE Calibration and Bypassing Service in the ECU Code
Introduction The ECU application must be instrumented by dSPACE Calibration and Bypassing
Service API functions. Different functions must be called according to the
purpose the service is to be used for.
General integration The initialization function and the background function must always be
integrated in the ECU code.
After execution of all the tasks of the current time raster, the ECU background
task is called. The period available for executing the ECU background task
depends on the time remaining in the current time raster. In this part of the ECU
code, the dsecu_service_background function must be called repeatedly (at
least once) until the next time the raster is triggered. The background function
checks whether the host interface is still alive and processing commands etc.
according to the service configuration.
29
May 2024 dSPACE Calibration and Bypassing Service Implementation
Integration of the dSPACE Calibration and Bypassing Service
Note
Integration for DAQ and The ECU application may consist of several ECU tasks which are called at fixed
bypassing time intervals (time rasters) or synchronously to specific ECU events (for example,
crankshaft‑synchronously).
dsecu_service()
ECU timer task 1 ECU timer task 1
dsecu_service()
dsecu_service_init()
t
dsecu_service_background()
30
dSPACE Calibration and Bypassing Service Implementation May 2024
Integration of the dSPACE Calibration and Bypassing Service in the ECU Code
In this example, the ECU task consists of three functions, and function 2 is to
be bypassed. The dsecu_service function is called at the beginning of function
2 (to read the function arguments) and at the end of function 2 (to write the
calculated data back to the ECU). dsecu_service is also called at the end of
the ECU task for data acquisition purposes.
Integration for ECU flash You need to provide specific flash drivers for flashing your ECU flash devices.
programming
Note
The actual flash driver is not part of the dSPACE Calibration and Bypassing
Service. You must provide it yourself since it depends on the type of flash
devices to be programmed. Many flash device suppliers distribute standard
flash drivers for their devices free of charge, for example, as downloads on
their Web sites.
To access the flash memory areas, the dSPACE Calibration and Bypassing Service
uses a standard dSPACE API which must be adapted to the custom‑specific
functions.
The following functions must be modified to map the standard dSPACE API to
the customer‑specific functions:
§ dsecu_custom_flash_program_start()
§ dsecu_custom_flash_erase_range()
§ dsecu_custom_flash_program_range()
§ dsecu_custom_flash_decode()
§ dsecu_custom_flash_finish()
Integration for calibration Calibration and page switching depend on your individual solution. You can
use pointers to memory areas, each of which represents a calibration page.
Calibration is performed by modifying a parameter in the appropriate page,
and page switching is done by changing the pointer to the current page. Or
you can use the memory overlay units supported by some processor types (for
example, Freescale‘s MPC565 processor). Page switching can also be performed
by reconfiguring the chip select.
The dSPACE Calibration and Bypassing Service provides standard functions for
calibration and page switching, contained in a standard dSPACE Calibration
and Bypassing Service Calibration API. The implementation of these functions
is customer‑specific, that is, the API functions must be adapted to the
customer‑specific functions.
31
May 2024 dSPACE Calibration and Bypassing Service Implementation
Integration of the dSPACE Calibration and Bypassing Service
The following functions must be modified to map the standard dSPACE API to
the customer‑specific functions:
§ dsecu_custom_cal_page_switch()
§ dsecu_custom_cal_absolute_access()
§ dsecu_custom_cal_paged_access()
§ dsecu_custom_cal_paged_access_finished()
Note
On some ECUs, the DCI‑GSI2 cannot access the overlay memory registers via the
serial interface. In these cases, the dSPACE Calibration and Bypassing Service is
used to perform read and write accesses to the registers. For further information,
refer to DSECU_CAL_MEMORY_COPY_METHOD on page 108.
Integration of custom The dSPACE Calibration and Bypassing Service can be extended by
commands custom‑specific commands. A custom command can be added to the service
without modifying the service code itself. To implement a customer‑specific
function, the dsecu_custom_command function must be modified.
Note
§ For the DCI‑GSI2, the custom command feature is available only as part
of a dSPACE engineering service, because it requires modifications to the
DCI‑GSI2´s firmware.
§ For a RapidPro system used as a stand‑alone prototyping ECU, some
RapidPro‑specific custom commands are already implemented and cannot
be modified.
Integration of custom‑specific By default, an interrupt from the ECU to the tool is triggered by writing to a
interrupt trigger memory location. In some cases, however, this trigger handling is not possible. In
these cases you must implement a custom‑specific trigger method by modifying
the dsecu_custom_trigger_hw_int function. For example, this function can
toggle a digital I/O pin to trigger an interrupt.
32
dSPACE Calibration and Bypassing Service Implementation May 2024
Basics on Service Integration with Multicore ECUs
Introduction Working with ECU microcontrollers that contain more than one processing core
might require integrating the dSPACE Calibration and Bypassing Service into
multiple cores.
Service integration into Modern ECU microcontrollers often contain more than one processing core. The
multiple cores dSPACE Calibration and Bypassing Service has to be integrated into multiple
cores if one of the following conditions is met:
§ The service is to be executed synchronously with tasks running on multiple
cores.
§ Data that needs to be read/written by the service resides in core local memory,
i.e., it can only be accessed by a specific core.
Preparing a single application For single applications running on multiple cores, the dSPACE Calibration and
running on multiple cores Bypassing Service has to be implemented only once. When you integrate a single
service instance for multiple cores, you must note the following points:
§ The tool RAM area that is used for data exchange between the service and the
external tool must be placed in a global RAM that can be accessed by each
relevant core.
§ Data caching must be disabled for the tool RAM area on each core. (This also
applies to running the service on a single core.)
§ The DSECU_SCS_LOCATION parameter of the service must be set to 1 to make
sure that the SCS structure is placed within the tool RAM and can therefore be
accessed by all cores. Refer to DSECU_SCS_LOCATION on page 111.
§ To avoid costly mutual exclusion constructs, it is recommended to use the
byte‑based subinterrupt mechanism.
Alternatively, you can also use bit‑based subinterrupts, but you must
note the following: The macros DSECU_INT_SAVE_AND_DISABLE and
DSECU_INT_RESTORE, which are used to disable and re-enable the interrupts
on the local core, must also implement mutual locks between all cores
that execute the dSPACE Calibration and Bypassing Service. Refer to
DSECU_INT_SAVE_AND_DISABLE on page 98 and DSECU_INT_RESTORE on
page 99.
§ Service IDs are used to uniquely identify a service call. It is recommended that
each identifier is used exclusively by a single core. If this is not possible, you
must use mutual exclusion constructs around the service calls to ensure that a
service ID is processed by only one core at a time.
Preparing multiple To provide access to multiple applications running on different cores of one
applications running on microcontroller, you must note the following points in addition to the points
different cores within the mentioned above:
same microcontroller § The dsecu_service_init initialization function must be called once at ECU
application startup.
33
May 2024 dSPACE Calibration and Bypassing Service Implementation
Integration of the dSPACE Calibration and Bypassing Service
34
dSPACE Calibration and Bypassing Service Implementation May 2024
Data Structures Used by the dSPACE Calibration and Bypassing Service
Introduction Most of the data structures used by the dSPACE Calibration and Bypassing
Service are located in the tool RAM.
35
May 2024 dSPACE Calibration and Bypassing Service Implementation
Data Structures Used by the dSPACE Calibration and Bypassing Service
Introduction Most of the data structures used by the dSPACE Calibration and Bypassing
Service are located in the tool RAM. These data structures are not shared
between the two tools using the dSPACE Calibration and Bypassing Service.
The number of relevant structure types can vary, depending on the maximum
number of service IDs used.
Data structures required if The following information applies to working with up to 255 dSPACE Calibration
DSECU_MAX_SERVICE_ and Bypassing Service calls, which means that only service IDs ≤ 255 are used.
COUNT ≤ 255
When started, each tool creates specific data structures which are used by the
application running on the target ECU. Three structure types are created in each
tool RAM. For details, see:
§ Service Configuration Section (SCS) on page 39
§ Table Pointer Section (TPS) on page 39
§ Address Tables (AT) on page 40
The Service Config Section (SCS) and the Table Pointer Section (TPS) are created
only once in each tool RAM.
The AT typically has several entities depending on the number of services used
and the amount of data that is transferred between the ECU and each tool.
The SCS contains service enable flags, one for each possible dSPACE Calibration
and Bypassing Service call. To avoid flag inconsistency, which can occur if the
tool writes to the table while the service accesses it, the dSPACE Calibration
and Bypassing Service features a local copy of the SCS in the ECU RAM or in
the tool RAM. The DSECU_SCS_LOCATION value defines the location of the SCS
copies for all tools connected to the ECU. If you want to place the SCS copies
in the ECU RAM, the value must be 0. If you want to place the SCS copies in
the tool RAM, the value must be 1. Usually, the ECU RAM is faster than the
tool RAM, if the tool RAM is located in an external memory (for example, in the
dual-port memory of DPMEM‑based PODs). If enough memory is available in the
ECU RAM, the value can be set to 0 for faster ECU code.
When the ECU application is running, the background task initializes the SCS
copy if the corresponding tool is active.
36
dSPACE Calibration and Bypassing Service Implementation May 2024
Basics on the Data Structures
The following illustration shows the data structures in the tool RAM. You can see
how the structure types are linked.
Data structures required if The following information applies to working with more than 255 dSPACE
DSECU_MAX_SERVICE_ Calibration and Bypassing Service calls, which means that the maximum number
COUNT > 255 of service IDs exceeds 255.
For service calls with service ID ≤ 255, the data structures are exactly the same as
described above (see Data structures required if DSECU_MAX_SERVICE_COUNT
≤ 255 on page 36). For service calls with ID > 255, two more structure types are
required. They are created additionally in each tool RAM when the tool is started.
For details, refer to:
§ Extended Table Pointer Section (ETPS) on page 41
§ Service Pointer Table (SPT) on page 41
The Extended Table Pointer Section (ETPS) is created once in each tool RAM.
It contains service enable flags, one for each possible dSPACE Calibration and
Bypassing Service call with ID > 255.
The following illustration shows the data structures that are required if
DSECU_MAX_SERVICE_COUNT > 255. Structure types that are used for service
calls with ID ≤ 255 are grayed out.
37
May 2024 dSPACE Calibration and Bypassing Service Implementation
Data Structures Used by the dSPACE Calibration and Bypassing Service
Address Table
DSECU_MAX_SERVICE_COUNT.............................................................................................. 126
38
dSPACE Calibration and Bypassing Service Implementation May 2024
Service Configuration Section (SCS)
Introduction The SCS structure is used to enable or disable data transmission for data
acquisition (DAQ) and bypassing, and references further data structures for
configuring the dSPACE Calibration and Bypassing Service.
Service enable flags The SCS features 255 service enable flags for enabling the specific dSPACE
Calibration and Bypassing Service calls with ID ≤ 255. Flag[0], which is the first
enable bit (LSB), is used as the global enable flag for all service calls.
§ If flag[0] is 0, all service calls are disabled.
§ If flag[0] is 1, all service calls with their enable flag set to 1 are enabled.
Note
Introduction The TPS stores information on interrupt generation and the dSPACE Calibration
and Bypassing Service calls with service ID ≤ 255 which are enabled for the
application running on the target ECU.
For dSPACE Calibration and Bypassing Service calls with service ID > 255, this
information is contained in the Extended Table Pointer Section.
Pointer to Address Table The TPS contains pointer‑to‑Address‑Table entries (32‑bit) which point to the
corresponding Address Tables.
Each Address Table is assigned to one ECU service call. More than one Address
Table can be assigned to one ECU service call at the same time. Since you can
configure each Address Table for one data direction, data can be transmitted
from and to the ECU within one ECU service call. This is required for some
bypassing scenarios, for example.
To use more than one Address Table with one ECU service call, you must
enable a functionality definition before compiling the ECU application (see
MORE_ATs_FOR_ONE_SRV on page 112).
39
May 2024 dSPACE Calibration and Bypassing Service Implementation
Data Structures Used by the dSPACE Calibration and Bypassing Service
Pointer to Extended Table If DSECU_MAX_SERVICE_COUNT is greater than 255, the TPS additionally contains
Pointer Section a pointer to the Extended Table Pointer Section, which holds information on the
dSPACE Calibration and Bypassing Service calls with IDs > 255.
References
DSECU_MAX_SERVICE_COUNT.............................................................................................. 126
Introduction The AT consists of an Address Table header and a number of value pairs. Each
pair consists of an address entry and an entry for the number of accesses to the
address.
Value pairs for block transfer If the block transfer mode is active (see Block Copy Mechanism on page 59),
the number‑of‑accesses entries are used to determine the size of the block. The
entries specify the number of accesses with the selected data type, so the size of
the data block (in bytes) is calculated by multiplying the number of accesses by
the size of the selected data type. Access starts with the address contained in the
corresponding start address entry.
Example For example, if the address in the start address entry for 32‑bit accesses is
0x1000 and the number of 32‑bit accesses is 3, the addresses used for data
transfers are 0x1000, 0x1004, 0x1008.
Value pairs for bit transfer For bit transfers, the number-of-accesses entry does not specify the number of
accesses. A bit mask for specifying the bits needed to be modified is given
instead.
§ First all bits with a mask bit of 0 are cleared. The other bits remain unchanged.
§ Then all bits are set additionally whose corresponding bit in the value to be
written is a 1 bit.
Note
In the RTI Bypass Blockset, the bit mask procedure differs from that
described above.
40
dSPACE Calibration and Bypassing Service Implementation May 2024
Extended Table Pointer Section (ETPS)
The tool must guarantee that only bits that are to be modified are set in the tool
RAM. The mask operation is done only if the ECU reads data from the tool RAM.
Bit operations are not supported for the ECU‑to‑tool direction. 8‑bit operations
must be used instead. The ECU writes the complete 8‑bit value to the tool RAM.
The tool masks and shifts the received 8‑bit value in order to get the values of
the relevant bits.
Introduction The ETPS stores information for dSPACE Calibration and Bypassing Service calls
with IDs > 255. The ETPS is only present if DSECU_MAX_SERVICE_COUNT is
greater than 255.
Pointer to Service Pointer The ETPS contains enable flags for the possible dSPACE Calibration and
Table Bypassing Service calls with service ID > 255. It also contains pointer-to-Service-
Pointer-Table entries which point to the corresponding Service Pointer Tables.
Each Service Pointer Table is assigned to exactly one active service call with
ID > 255.
References
DSECU_MAX_SERVICE_COUNT.............................................................................................. 126
Introduction An SPT stores information associated with one specific dSPACE Calibration and
Bypassing Service call. SPTs are used only for service calls with ID > 255.
For dSPACE Calibration and Bypassing Service calls with ID ≤ 255, this
information is held in the Table Pointer Section.
41
May 2024 dSPACE Calibration and Bypassing Service Implementation
Data Structures Used by the dSPACE Calibration and Bypassing Service
Pointer to Address Table An SPT contains a list of pointers to the Address Tables that have to be processed
in the service call.
Each Address Table is assigned to one service call. More than one Address Table
can be assigned to one ECU service call at the same time.
42
dSPACE Calibration and Bypassing Service Implementation May 2024
dSPACE Calibration and Bypassing Service Mechanisms
Extended bypassing The dSPACE Calibration and Bypassing Service provides extended bypassing
mechanisms mechanisms:
§ Double buffer mechanism
§ Wait mechanism
§ Buffer synchronization mechanism
43
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Mechanisms
Double buffer mechanism The double buffer mechanism is used to ensure that only consistent data blocks
are transmitted. If the mechanism is enabled, two buffers are used for data
exchange between the ECU and the RCP (rapid control prototyping) system. For
example, when reading data from the RCP system, the ECU continues reading
old data (= data already read before) as long as no new data is available from
the RCP system. This ensures data consistency. If you disable the double buffer
mechanism, only one buffer is used for data exchange.
The dSPACE Calibration and Bypassing Service supports the double buffer
mechanism. You can use the configuration file to specify whether the
mechanism is to be supported. Then you must enable or disable the double
buffer mechanism explicitly in every Read and Write block of the RTI Bypass
Blockset.
If the double buffer mechanism is disabled, the wait, failure checking, and
fail‑safe mechanisms are not available.
Wait mechanism You can use the wait mechanism to enable the ECU to wait for a valid response
from the RCP (Rapid Control Prototyping) system. If the mechanism is enabled,
the ECU waits until new data is available from the RCP system. If the ECU
receives no new data until a predefined timeout, the ECU continues working
in a defined way. The wait mechanism ensures that the ECU uses only data
calculated by the RCP system.
The dSPACE Calibration and Bypassing Service supports the wait mechanism.
You can use the configuration file to specify whether the mechanism is to be
supported. Then you must enable or disable the wait mechanism explicitly for
every event channel (service instance) in the Write blocks of the RTI Bypass
Blockset.
Note
§ You can enable the consistency wait mechanism only if you also enable
the double buffer mechanism.
§ Using the wait mechanism may increase the ECU’s task execution time.
§ You must configure a timeout scaling factor in the service configuration
or alternatively realize a custom time stamp functionality within the
service customization layer to ensure that the effective waiting time
and the wait time configuration match. For further information on
the functionality and configuration of the different timeout detection
methods, refer to Configuration of DAQ and Bypassing Features on
page 110.
44
dSPACE Calibration and Bypassing Service Implementation May 2024
Extended Bypassing Mechanisms
Buffer synchronization The buffer synchronization mechanism is used to enable the ECU to recognize
mechanism whether data that is written back from the RCP system to the ECU belongs
to the current sampling step, or whether it is delayed data from the previous
sampling step. Data that is written back from the RCP system to the ECU after
the ECU waiting time (specified in the wait mechanism) has expired is marked as
old data. This prevents old results from being erroneously interpreted as current
results.
Delayed data is identified by comparing identifier values of read and write service
calls. When sending data to the RCP system, the ECU also transmits a unique
identifier to the RCP system. (Each time a write service is called, the identifier
value is incremented.) When the RCP system writes the calculated data back to
the ECU, it also returns the identifier it received from the ECU. When new data
is available from the RCP system, the ECU compares its current local identifier
with the identifier received from the RCP system. Matching identifiers indicate
results of the current sampling step. If the identifiers differ, the received data is
immediately marked as old data (by setting old buffer equal to current buffer),
and the ECU continues waiting for new data.
Note
Failure checking and fail‑safe The dSPACE Calibration and Bypassing Service lets you enable the failure
mechanisms checking and the fail‑safe mechanisms.
45
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Mechanisms
Note
Note
§ You can enable the failure checking and fail-safe mechanisms only if you
also enable the double buffer mechanism.
§ To make the fail‑safe mechanism available, the failure checking
mechanism must be enabled.
46
dSPACE Calibration and Bypassing Service Implementation May 2024
Extended Bypassing Mechanisms
Flowcharts of extended Read service call The following illustrations show the extended bypassing
bypassing mechanisms mechanisms integrated for the read service call:
No Yes
Double buffer mechanism
is supported?
Double buffer
Yes mechanism is enabled No
Return new data.
for this read service?
Local data ID is
Yes equal to corresponding No
data ID, or timeout
occurred?
47
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Mechanisms
No Yes
Current buffer is equal
to old buffer?
No Yes
Return new data. Failure checking mechanism
is enabled?
Failure count No
Return old data. Yes
equals or exceeds
failure limit?
Write service call The following illustration shows the extended bypassing
mechanisms integrated for the write service call:
No Yes
Double buffer mechanism
is supported?
Double buffer
Yes mechanism is enabled No
for this write service?
Note
48
dSPACE Calibration and Bypassing Service Implementation May 2024
Alive and Version Information Mechanism
Introduction The dSPACE Calibration and Bypassing Service uses the alive and version
information mechanism to check if a calibration tool (ControlDesk) and/or
bypassing system (MicroAutoBox II) is connected to the ECU and is running.
Note
The alive and version information mechanism is always enabled and cannot
be configured or adapted.
Memory location Because measurement and bypassing in parallel is supported, the alive
and version information mechanism addresses two different memory ranges.
The locations used for communication between the tool and the ECU
are placed in each tool RAM, starting with the address defined by
DSECU_TOOL_30_PLUS_X_FREE_DPM_WORDS(tool_nr) (see dsecusvc.h).
The following definitions are used for the alive and version information
mechanism (see also the illustration below):
#define DSECU_VERSION_L (0)
#define DSECU_VERSION_H (1)
#define DSECU_COMPILED_FOR (2)
#define DSECU_ALIVE_DEVICE_WRITE (3)
#define DSECU_ALIVE_ECU_WRITE (4)
#define DSECU_ALIVE_DEVICE_READ DSECU_ALIVE_ECU_WRITE
#define DSECU_ALIVE_ECU_READ DSECU_ALIVE_DEVICE_WRITE
#define DSECU_DEVICE_STILL_ALIVE (5)
#define DSECU_ECU_STILL_ALIVE (6)
#define DSECU_RESERVED_WORD (7)
#define DSECU_MAGIC_WORD (8)
#define DSECU_DEVICE_VERSION_L (0xA)
#define DSECU_DEVICE_VERSION_H (0xB)
#define DSECU_MAILBOX_ADDR (0xC)
#define DSECU_DEVICE_RESET_COUNTER (0xE)
#define DSECU_ECU_RESET_COUNTER (0xF)
#define DSECU_LOW_LEVEL_CHECK (0x10)
#define DSECU_SERVICE_COUNT (0x12)
#define DSECU_SUBINT_INFO (0x13)
#define DSECU_FEATURE_FLAGS0 (0x14)
#define DSECU_FEATURE_FLAGS1 (0x15)
#define DSECU_MASTER_FEATURE_LEVEL (0x16)
49
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Mechanisms
and Bypassing Service code (low and high word), and a flag that indicates the
RCP hardware the service code was compiled for.
§ DSECU_ALIVE_DEVICE_WRITE and DSECU_ALIVE_ECU_WRITE are used to
determine whether the other side is alive. The first word is written by the
tool and read by the ECU, the second word is written by the ECU and read by
the tool.
§ DSECU_DEVICE_STILL_ALIVE and DSECU_ECU_STILL_ALIVE are used to
indicate that the tool or ECU side is switched off. During normal operation
a magic word is written to these memory locations. If one side shuts down, it
writes any other value to the appropriate location to inform the other side.
§ DSECU_DEVICE_RESET_COUNTER and DSECU_ECU_RESET_COUNTER words are
used to detect a reset. If an ECU reset occurs or if the application running on
the RCP system is restarted, the corresponding counter is incremented.
§ The 32‑bit word DSECU_LOW_LEVEL_CHECK is used by the tool to check
whether memory accesses to the tool RAM area are working correctly.
§ DSECU_SERVICE_COUNT indicates the maximum number of service IDs
supported by the service. The value is determined by setting the
DSECU_MAX_SERVICE_COUNT configuration option.
§ DSECU_SUBINT_INFO, DSECU_FEATURE_FLAGS0 and
DSECU_FEATURE_FLAGS1 contain information on the configuration of the
dSPACE Calibration and Bypassing Service. This information can be used by
the tool to detect misconfigurations.
§ DSECU_MASTER_FEATURE_LEVEL is used to tell the service which features are
supported by the tool.
The following words are used only if any feature besides data acquisition and
bypassing is enabled in the service.
§ DSECU_MAGIC_WORD is a 32‑bit value that is set by the tool (only dSPACE
ECU interface) to indicate that the (command) mailbox is present. The
DSECU_RESERVED_WORD entry is inserted to align the magic word to an
address divisible by 4.
§ DSECU_DEVICE_VERSION_L and DSECU_DEVICE_VERSION_H are used for
compatibility checks on the ECU. They are written by the tool (only dSPACE
ECU interfaces) and contain the version of the tool software with respect to
the dSPACE Calibration and Bypassing Service (low and high word).
§ The DSECU_MAILBOX_ADDR word specifies the address of the mailbox. All
commands and responses between the tool (only dSPACE ECU interface) and
the ECU are sent via the mailbox.
Note
50
dSPACE Calibration and Bypassing Service Implementation May 2024
Alive and Version Information Mechanism
The following illustration shows the alive and version information words in the
tool RAM:
29 58 Reserved (16)
. . ..
. .
.. .. ..
23 46 Reserved (16)
22 44 DSECU_MASTER_FEATURE_LEVEL (16)
21 42 DSECU_FEATURE_FLAGS1 (16)
20 40 DSECU_FEATURE_FLAGS0 16)
19 38 DSECU_SUBINT_INFO (16)
18 36 DSECU_SERVICE_COUNT (16)
16 32
DSECU_LOW_LEVEL_CHECK (32)
15 30
DSECU_ECU_RESET_COUNTER (16)
14 28
DSECU_DEVICE_RESET_COUNTER (16)
12 24
DSECU_MAILBOX_ADDR (32)
11 22
DSECU_DEVICE_VERSION_H (16)
10 20
DSECU_DEVICE_VERSION_L (16)
8 16
DSECU_MAGIC_WORD (32)
7 14
Reserved (16)
6 12
DSECU_ECU_STILL_ALIVE (16)
5 10
DSECU_DEVICE_STILL_ALIVE (16)
4 8
DSECU_ALIVE_ECU_WRITE /
DSECU_ALIVE_DEVICE_READ (16)
3 6
DSECU_ALIVE_ECU_READ /
DSECU_ALIVE_DEVICE_WRITE (16)
2 4
DSECU_COMPILED_FOR (16)
1 2
DSECU_VERSION_H (16)
0 0
DSECU_VERSION_L (16)
DSECU_TOOL_30_PLUS_X_FREE_DPM_WORDS(tool_nr)
ECU initialization When the dSPACE Calibration and Bypassing Service starts, it first clears the still
alive flag (DSECU_ECU_STILL_ALIVE) to signal to the tool that the ECU is not
alive (see illustration below).
The tool alive counter is read (DSECU_ALIVE_ECU_READ) and stored locally. Its
value is used to check whether the tool alive counter has changed. For example,
it is incremented during initialization of the RCP application.
51
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Mechanisms
by mistake. All subinterrupt request words are initialized to 0, before the ECU
alive counter is incremented to signal to the tool that the ECU is alive.
ECU background After ECU initialization, the ECU repeatedly calls the background function of the
dSPACE Calibration and Bypassing Service. Other actions depend on the current
state of the tool.
§ If the tool was not yet detected as alive, the DSECU_SINT_INIT subsystem is
called again. This checks whether the tool alive counter has been incremented.
If not, the background function is left, and the tool is not detected as alive.
If the tool alive counter has been changed (DSECU_ALIVE_DEVICE_WRITE),
the tool reset counter (DSECU_DEVICE_RESET_COUNTER) is read and stored
locally. This value is used to check whether the tool reset counter has changed.
For example, it is incremented when the tool is restarted. Finally, both the ECU
still alive flag and the tool still alive flag are checked. The tool is recognized as
alive only if both still alive flags are set correctly.
The tool‘s background function checks whether the ECU alive counter has
changed. This is the case if the background function of the ECU has been
called at least once. The tool alive counter is now incremented, and the ECU is
identified as alive.
§ If the tool is recognized as alive, the settings of the tool still alive flag and
the ECU still alive flag are checked, that is, the DSECU_DEVICE_STILL_ALIVE
and DSECU_ECU_STILL_ALIVE words are checked to determine if the tool
and ECU are still connected and running. If any check is negative, the tool is
assumed to be not alive, and the alive mechanism is restarted. If the checks
are positive, the tool reset counter (DSECU_DEVICE_RESET_COUNTER) is read.
If the value has changed, the tool has been restarted, and the alive mechanism
must be restarted. The tool alive counter is stored locally as a compare value
for the alive check. The subinterrupt request bits are invalidated by clearing
the valid bit (for bit‑based subinterrupt handling only), and the ECU alive
counter is incremented. In the next call to the background function, the alive
mechanism acts as if the tool is not alive.
52
dSPACE Calibration and Bypassing Service Implementation May 2024
Alive and Version Information Mechanism
ECU initialization
DSECU_SINT_INIT
subsystem
ECU background
DSECU_SINT_INIT
No Yes
subsystem Tool still alive
flag set?
Clear request valid bit
Yes No
Tool reset counter
No changed?
Tool alive counter
changed?
Read tool alive counter
Yes
53
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Mechanisms
Tool initialization The tool part of the alive mechanism is similar to the ECU part, except that the
use of counters is reversed.
During tool initialization, the ECU alive counter is read for later comparison with
the recent value in the background function. If the ECU increments the counter
in the meantime, the tool proceeds to the alive state in the first call to the
background function.
If bit‑based subinterrupt handling is enabled, the valid bit of the ready words is
cleared.
Finally, the tool alive counter and the tool reset counter are incremented.
Tool background The behavior of the background function depends on the current alive state of
the ECU.
§ If the ECU is not alive, the ECU alive counter is checked for a change. If it is
unchanged, the background function is left and the ECU is not detected as
alive. If the ECU alive counter has been changed, the ECU is detected as alive.
The ECU reset counter is read and the value is stored for later comparison.
Then the valid bit in the ready words is set for triggering the subinterrupts.
Finally, the tool alive counter is incremented, and the ECU state changes to
alive.
§ If the ECU was already detected as alive, in every call to the background
function the ECU reset counter is read and compared to the value that
was stored when the ECU changed to the alive state. If the counter is
unchanged, the dSPACE Calibration and Bypassing Service operates as normal.
If the ECU reset counter has changed (that is, the ECU has been reset), the
alive mechanism must be restarted. For this reason the ECU alive counter is
read and stored locally as it is in the initialization function. To avoid further
subinterrupts being triggered, the valid bit in the ready words is cleared.
Finally, the tool alive counter is incremented to signal that the tool is alive.
54
dSPACE Calibration and Bypassing Service Implementation May 2024
Subinterrupt Handling Mechanism
Tool initialization
Tool background
No No
ECU alive counter ECU reset counter
changed? changed?
Yes Yes
55
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Mechanisms
Subinterrupt handling The dSPACE Calibration and Bypassing Service supports three different methods
methods of subinterrupt handling:
§ Byte‑based subinterrupt handling
With byte‑based subinterrupt handling, one byte is used per subinterrupt. For
information on this method, refer to Byte‑Based and Word‑Based Subinterrupt
Handling on page 56.
§ Word‑based subinterrupt handling
With word‑based subinterrupt handling, two bytes are used per subinterrupt.
For information on this method, refer to Byte‑Based and Word‑Based
Subinterrupt Handling on page 56.
§ Bit‑based subinterrupt handling
With bit‑based subinterrupt handling, one bit is used per subinterrupt. For
information on this method, refer to Bit‑Based Subinterrupt Handling on
page 57.
Byte‑Based and Word‑Based The mechanisms for byte‑based and word‑based subinterrupt generation are very
Subinterrupt Handling similar. The difference is that in the one case only one byte is written to/read
from the tool RAM instead of two bytes.
94 Reserved (16)
..
64 - 89 ..
The locations for byte‑based subinterrupt generation are only one byte long.
Hence, the memory space needed for byte‑based subinterrupt handling is
smaller. The width of the hardware interrupt word is 16 bits in any case.
56
dSPACE Calibration and Bypassing Service Implementation May 2024
Subinterrupt Handling Mechanism
Bit‑Based Subinterrupt Like byte‑based and word‑based subinterrupt handling, the implementation of
Handling the bit‑based subinterrupt handling also requires three states.
57
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Mechanisms
86 Reserved (16)
Valid
72 bit Subinterrupt ready 39 ... 32
Valid
64 Subinterrupt pending 39 ... 32
bit
Valid bits Additionally, a valid bit is included in the MSB of the last
subinterrupt pending word and the last subinterrupt ready word. The
corresponding bit in the last subinterrupt acknowledge word is left void.
The valid bits determine whether the other bit entries are valid or not:
§ Valid bit of subinterrupt pending word is 0
All other bit entries of the pending memory area are invalid.
§ Valid bit of subinterrupt pending word is 1
All other bit entries of the pending memory area are valid.
§ Valid bit of subinterrupt ready word is 0
All other bit entries of the pending and acknowledge memory areas are
invalid.
§ Valid bit of subinterrupt ready word is 1
All other bit entries of the pending and acknowledge memory areas are valid.
58
dSPACE Calibration and Bypassing Service Implementation May 2024
Block Copy Mechanism
If the tool uses the three word categories, the subinterrupt pending words
must be checked against the subinterrupt ready and subinterrupt acknowledge
words. If a trigger bit differs from both the associated ready bit and the
associated acknowledge bit, the subinterrupt is triggered and the tool toggles
the acknowledge bit. In this state, the ECU is not allowed to trigger this
subinterrupt again. The tool processes the subinterrupt and finally toggles the
ready bit.
Introduction The block copy mechanism is used in the service call for transferring data blocks.
Block copy mechanism If the block copy mechanism is enabled, all data transfers use the address given
in the address entry of the Address Table (AT) as the start address. The number of
addresses included in the data transfer is written to the number-of-accesses entry
of the AT, corresponding to the address entry.
Example For the start address 0x1000 and a block of 3 data items with 32-bit
width, the calculated addresses are 0x1000, 0x1004 and 0x1008.
The addresses are calculated from the start address by incrementing by a value
depending on the data type used in the transfer:
§ 8 for 64-bit data transfers (number of bytes in 64-bit data)
§ 4 for 32-bit data transfers
§ …
If the block copy mechanism is disabled, only the address given in the address
entry of the Address Table (AT) is used. The number‑of‑accesses entry of the
AT corresponding to the address entry is ignored. If a data block has to be
transferred, several entries are generated in the AT.
59
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Mechanisms
Introduction The dSPACE Calibration and Bypassing Service supports ECU flash programming
for all kinds of ECUs and flash devices.
General ECU flash When configuring the dSPACE Calibration and Bypassing Service, you can split
programming concept the flash memory of an ECU into segments. For example, you can define
different segments for the ECU application code, the boot code, the calibration
data, and even the microcontroller‘s shadow configuration. Custom‑specific
functions must be integrated into the service for erasing and programming the
individual segments.
Each segment defines an area of the flash memory which may be accessed
by the flash tool. The flash tool can flash each segment independently, for
example, if a calibrated data set is to be flashed to the ECU, while the segments
containing ECU code must remain unchanged. Flash areas which are not covered
by a segment definition will not be modified by the flash tool.
The dSPACE Calibration and Bypassing Service also supports flashing memory
ranges which are normally not mapped to the ECU‘s linear address range (for
example, flashing an external I2C bus flash device or a processor‘s internal
shadow configuration). In this case the custom erase and program functions
can be adapted to map a specific memory device to an unused address range of
the ECU. This address range can then be used by the flash tool.
Sequence numbers for erasing and writing are defined for each individual
segment. You can therefore control the exact sequence in which the segments
are programmed to the ECU.
The number of segments, their absolute addresses, and the sequence numbers
for erasing/writing are part of the dSPACE Calibration and Bypassing Service.
They are compiled in the flash kernel. Thus, the flash tool can read these
configuration settings directly from the ECU.
60
dSPACE Calibration and Bypassing Service Implementation May 2024
ECU Flash Programming Mechanism
Command sequence for ECU For ECU flash programming, the flash tool uses the following flash commands:
flash programming § To signal the beginning of a flash sequence, the
dsecu_flash_program_start command is called.
§ A series of dsecu_flash_erase_range and dsecu_flash_program_range
commands is used to erase/program the flash memory.
§ dsecu_flash_program_finish is called to signal the end of the flash
sequence.
The flash commands are not integrated into the ECU application, but into a
small separate application, called the flash kernel. The flash kernel consists of
the dSPACE Calibration and Bypassing Service and the custom‑specific flash
functions. The flash kernel is loaded by the flash tool to the ECU RAM, where it
is activated.
Communication via dSPACE Communication between the dSPACE ECU interface and the ECU is via a mailbox
mailbox in the tool memory, called the dSPACE mailbox. Using several identifiers, the
dSPACE Calibration and Bypassing Service checks if the mailbox configuration is
valid (that is, if a host interface like the DCI‑GSI2 is active at the moment). If
the mailbox is valid, the dSPACE Calibration and Bypassing Service can execute
a command each time the dsecu_service_background function is called. The
service reads the relevant command ID and the required parameters from the
mailbox, clears the command ID, and executes the corresponding command
(for example, programming or erasing a memory segment). After the ECU has
completed the command execution, the result parameters (for example, error
codes) are placed in the mailbox. Finally, the service signals the host interface
that the command execution has finished.
61
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Mechanisms
62
dSPACE Calibration and Bypassing Service Implementation May 2024
dSPACE Calibration and Bypassing Service API Functions
Introduction Some functions of the dSPACE Calibration and Bypassing Service API must be
called by the ECU application to initialize the service or to transfer data to or
from the ECU.
dsecu_service_init.................................................................................... 64
To initialize the dSPACE Calibration and Bypassing Service.
dsecu_service.......................................................................................... 64
To start the dSPACE Calibration and Bypassing Service foreground
service.
dsecu_service_state................................................................................. 66
To check the state of the specified service ID.
dsecu_service_background...................................................................... 67
To start the dSPACE Calibration and Bypassing Service background
service.
dsecu_service_buffer_sync....................................................................... 68
To ensure that delayed data from the previous sampling step is
recognized as old data.
dsecuboot_check..................................................................................... 69
To check at ECU boot time whether the calibration interface is requesting
a flash operation.
63
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service API Functions
dsecu_service_init
Parameters tool_nr Specifies the number of the tool to be initialized. The number can be
0 or 1.
dsecu_service........................................................................................................................... 64
dsecu_service_background....................................................................................................... 67
dSPACE Calibration and Bypassing Service API Functions.......................................................... 63
dsecu_service
64
dSPACE Calibration and Bypassing Service Implementation May 2024
dsecu_service
Purpose To start the dSPACE Calibration and Bypassing Service foreground service.
Description The function is called to transfer data to or from the ECU. The function must be
integrated in the ECU code only if data acquisition (DAQ) or bypassing is to be
performed.
For bypassing purposes, one or two function calls are necessary, depending on
the bypass scenario:
§ Bypassing using two function calls
One function call is needed at the beginning of the function or task to be
bypassed (to read the arguments of the functions to be bypassed from the
ECU). The other function call is needed at the end of the function or task to be
bypassed (to write the function results calculated by the bypassing tool back to
the ECU).
§ Bypassing using one function call
The function call is placed at the end of the function or task to be bypassed (to
read the arguments of the functions to be bypassed by the tool, and to write
the function results of the last sampling step calculated by the bypassing tool
back to the ECU).
To perform data acquisition, only one function call placed at the end of the ECU
task is needed.
Return value The function returns an error code. The error code covers the errors for both
tools. For tool number 0, the error code is in the least significant byte (bits
0 … 7), and for tool number 1, it is in bits 8 … 15.
The following error definitions can be used as flags, that is, they can be
combined with a binary OR operation:
65
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service API Functions
dsecu_service_background....................................................................................................... 67
dsecu_service_init..................................................................................................................... 64
dsecu_service_state.................................................................................................................. 66
dSPACE Calibration and Bypassing Service API Functions.......................................................... 63
dsecu_service_state
Description This function can be used to determine the state of a given service ID. If the
service ID has not been enabled by the tool, DSECU_SVC_INACTIVE is returned.
When it has been enabled, DSECU_SVC_ACTIVE is returned, and subsequent
calls to the dsecu_service function will trigger the tool.
Return value The function returns an error code that covers the errors for both tools. For tool
number 0, the error code is in the least significant byte (bits 0 … 7), and for tool
number 1, it is in bits 8 … 15.
66
dSPACE Calibration and Bypassing Service Implementation May 2024
dsecu_service_background
dsecu_service........................................................................................................................... 64
dSPACE Calibration and Bypassing Service API Functions.......................................................... 63
dsecu_service_background
Purpose To start the dSPACE Calibration and Bypassing Service background service.
Description The function must always be integrated into the ECU code. It must be called
repeatedly in the background loop of the ECU, or in the task with the largest
time interval if no background loop is available. The function checks whether the
tool is/the tools are connected to the ECU, and whether it is/they are working
correctly.
Parameters None
Return value The function returns an error code. The error code covers the errors for both
tools. For tool number 0, the error code is in the least significant byte (bits
0 … 7). Bits 8 … 15 are used for the error code for tool number 1.
The following error definitions can be used as flags, that is, they can be
combined with a binary OR operation:
67
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service API Functions
dsecu_service........................................................................................................................... 64
dsecu_service_init..................................................................................................................... 64
dSPACE Calibration and Bypassing Service API Functions.......................................................... 63
dsecu_service_buffer_sync
Purpose To ensure that delayed data from the previous sampling step is marked as old
data.
Note
68
dSPACE Calibration and Bypassing Service Implementation May 2024
dsecuboot_check
Note
Return value The function returns an error code. The error code covers the errors for both
tools. For tool number 0, the error code is in the least significant byte (bits
0 … 7), and tool number 1, it is in bits 8 … 15.
The following error definitions can be used as flags, that is, they can be
combined with a binary OR operation:
dsecuboot_check
69
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service API Functions
Purpose To check at ECU boot time whether a flashing request is pending and to start the
flash kernel from your ECU application.
Description It is recommended to call this function as soon as possible in the ECU software,
so that it is possible to flash the ECU even if a part of the ECU software
is erroneous or damaged. You need to access the tool RAM for this, so the
chip select must first be suitably configured. dsecuboot_check must be called
before the dsecu_service_init function.
Parameters None
70
dSPACE Calibration and Bypassing Service Implementation May 2024
dSPACE Calibration and Bypassing Service Custom API Functions
Introduction The dSPACE Calibration and Bypassing Service Custom API provides several
functions.
dsecu_custom_flash_program_start......................................................... 73
To start the ECU flash programming.
dsecu_custom_flash_erase_range............................................................ 73
To erase a range in the ECU flash memory.
dsecu_custom_flash_program_range....................................................... 74
To program a range of the ECU flash memory.
dsecu_custom_flash_decode................................................................... 75
To decrypt and decode data that are to be flashed.
dsecu_custom_flash_finish...................................................................... 76
To finish the ECU flash programming.
dsecu_custom_command........................................................................ 77
To add custom commands to the dSPACE Calibration and Bypassing
Service.
dsecu_custom_copy................................................................................ 78
To read and write memory from/to the ECU.
71
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Custom API Functions
dsecu_custom_cal_page_switch.............................................................. 79
To switch the calibration page on the ECU.
dsecu_custom_cal_absolute_access......................................................... 80
To check the access rights in the absolute address mode.
dsecu_custom_cal_paged_access............................................................. 81
To check the access rights in the paged address mode.
dsecu_custom_cal_paged_access_finished............................................... 82
To finish the paged address mode.
dsecu_custom_trigger_hw_int................................................................. 83
To trigger hardware interrupts on the calibration or bypass interface.
dsecu_custom_timeout_timestamp_get................................................... 84
To calculate a custom time stamp.
dsecu_custom_timeout_pending_check................................................... 85
To check periodically whether a timeout occurred.
Introduction The dSPACE Calibration and Bypassing Service Custom API provides several
functions.
Basics The dSPACE Calibration and Bypassing Service provides several functions for ECU
flash programming, calibration, page switching, and interrupt handling. Since
these features depend on customer‑specific solutions, the appropriate standard
dSPACE Calibration and Bypassing Service API functions must be adapted. In
addition, it is possible to extend the dSPACE Calibration and Bypassing Service by
custom commands (included in a dSPACE engineering project).
Integration of the dSPACE Calibration and Bypassing Service in the ECU Code.......................... 29
72
dSPACE Calibration and Bypassing Service Implementation May 2024
dsecu_custom_flash_program_start
dsecu_custom_flash_program_start
Description This function requests permission to start a flash operation. The command is
always executed before the first erase or program operation is started. The
ECU may refuse a request if the current ECU state does not allow an update,
for example, if the engine is still running. In that case, the function returns
DSECU_UPDATE_DENIED. Otherwise, if permission is granted, the ECU may also
go to a different mode in which the standard ECU application is no longer
running, for example, by performing a system reset and starting the ECU's boot
code. Then the function returns DSECU_NO_ERROR.
Parameters None
dsecu_custom_flash_decode.................................................................................................... 75
dsecu_custom_flash_erase_range............................................................................................. 73
dsecu_custom_flash_finish....................................................................................................... 76
dsecu_custom_flash_program_range........................................................................................ 74
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
dsecu_custom_flash_erase_range
73
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Custom API Functions
Description This function returns DSECU_NO_ERROR if the range has been erased successfully.
Otherwise, it returns DSECU_ERASE_FAILED.
dsecu_custom_flash_decode.................................................................................................... 75
dsecu_custom_flash_finish....................................................................................................... 76
dsecu_custom_flash_program_range........................................................................................ 74
dsecu_custom_flash_program_start.......................................................................................... 73
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
dsecu_custom_flash_program_range
74
dSPACE Calibration and Bypassing Service Implementation May 2024
dsecu_custom_flash_decode
Description Programming a range of the ECU flash memory includes the verification
of the programmed range. The function returns DSECU_NO_ERROR if the
range has been programmed successfully. If the range has been programmed
but the check on the programmed range has failed, the function returns
DSECU_VERIFY_FAILED. Otherwise, it returns DSECU_PROGRAM_FAILED.
dsecu_custom_flash_decode.................................................................................................... 75
dsecu_custom_flash_erase_range............................................................................................. 73
dsecu_custom_flash_finish....................................................................................................... 76
dsecu_custom_flash_program_start.......................................................................................... 73
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
dsecu_custom_flash_decode
75
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Custom API Functions
Description This function decrypts and decodes the given data and returns the
decrypted/decoded data. The size of the returned data must be stored in
the output_length parameter. The function returns DSECU_NO_ERROR if the
data has been successfully decrypted and decoded. Otherwise, it returns
DSECU_METHOD_NOT_SUPPORTED.
Note
dsecu_custom_flash_erase_range............................................................................................. 73
dsecu_custom_flash_finish....................................................................................................... 76
dsecu_custom_flash_program_range........................................................................................ 74
dsecu_custom_flash_program_start.......................................................................................... 73
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
dsecu_custom_flash_finish
76
dSPACE Calibration and Bypassing Service Implementation May 2024
dsecu_custom_command
Description This function is called at the end, when the update operation has finished. The
ECU application can take appropriate measures, for example, to lock the flash
memory.
Parameters None
dsecu_custom_flash_decode.................................................................................................... 75
dsecu_custom_flash_erase_range............................................................................................. 73
dsecu_custom_flash_program_range........................................................................................ 74
dsecu_custom_flash_program_start.......................................................................................... 73
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
dsecu_custom_command
Description This function is called to add a custom command to the dSPACE Calibration
and Bypassing Service. The custom function can use the command_id to select
the execution of a specific command. Further parameters can be specified by
the data and data_length parameters. The former holds the data, the latter
specifies its number of bytes. If the function is to return data, the data_length
77
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Custom API Functions
parameter specifies the number of bytes that are to be returned to the caller,
and the return data is stored in the data parameter again. The function should
set the data_length to 0, if no data is to be returned. If the return value
of the function does not equal DSECU_NO_ERROR, a corresponding error code
must be returned to the host. The max_return_data parameter specifies the
maximum number of bytes which may be returned in the data parameter.
When this function is called, data_length parameter must be between 0 and
max_return_data.
Note
dsecu_custom_copy
78
dSPACE Calibration and Bypassing Service Implementation May 2024
dsecu_custom_cal_page_switch
Description This function copies the specified number of bytes from the source address to
the destination address.
DSECU_CAL_MEMORY_COPY_METHOD................................................................................ 108
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
dsecu_custom_cal_page_switch
Description This function switches to the calibration page specified by the page_number
parameter. The function returns DSECU_NO_ERROR if the page switch has been
successful. If the specified page does not exist, it returns DSECU_ILLEGAL_PAGE.
Parameters page_number Specifies the number of the page that is to be activated. The
page number must be in the range 0 … (DSECU_CAL_NUMBER_OF_PAGES - 1).
79
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Custom API Functions
dsecu_custom_cal_absolute_access.......................................................................................... 80
dsecu_custom_cal_paged_access.............................................................................................. 81
dsecu_custom_cal_paged_access_finished................................................................................ 82
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
dsecu_custom_cal_absolute_access
Description This function checks whether access to the memory block which is specified by
address and size is allowed in the absolute address mode. (In absolute address
mode, a parameter is written directly to the specified address.) Memory blocks
can be handled as read-only via the write_access parameter. If write access is
granted, the memory block is also readable.
Return value DSECU_NO_ERROR Access has been granted to the memory block.
80
dSPACE Calibration and Bypassing Service Implementation May 2024
dsecu_custom_cal_paged_access
dsecu_custom_cal_page_switch............................................................................................... 79
dsecu_custom_cal_paged_access.............................................................................................. 81
dsecu_custom_cal_paged_access_finished................................................................................ 82
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
dsecu_custom_cal_paged_access
Description This function translates a paged address to an absolute address, and then checks
whether access for a memory block is allowed in paged address mode. (In
absolute address mode, a parameter is written directly to the specified address.
This addressing mode must be used if data has to be written to a memory region
that is not paged.) The paged address is given by the address of the parameter
and the page specified by the page_number. The memory block is specified by
the address and the size. The absolute address must be returned via address.
Note
The address parameter does not contain the address itself, but a pointer to
it.
Parameters page_number Specifies the number of the page that is to be accessed. The
page number must be in the range 0 … (DSECU_CAL_NUMBER_OF_PAGES - 1).
81
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Custom API Functions
size Specifies the number of bytes that are to be accessed at the given
address.
Return value DSECU_NO_ERROR Access has been granted to the memory block.
dsecu_custom_cal_absolute_access.......................................................................................... 80
dsecu_custom_cal_page_switch............................................................................................... 79
dsecu_custom_cal_paged_access_finished................................................................................ 82
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
dsecu_custom_cal_paged_access_finished
Description This function is called after access to a paged memory block is completed. For
example, if a chip select must be reconfigured on the ECU for accessing a
certain page, this is done in the dsecu_custom_cal_paged_access function.
The dsecu_custom_cal_paged_access_finished function is used to revoke
it.
Parameters None
82
dSPACE Calibration and Bypassing Service Implementation May 2024
dsecu_custom_trigger_hw_int
dsecu_custom_cal_absolute_access.......................................................................................... 80
dsecu_custom_cal_page_switch............................................................................................... 79
dsecu_custom_cal_paged_access.............................................................................................. 81
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
dsecu_custom_trigger_hw_int
The trigger mechanism depends on the ECU hardware. Here are some examples
of hardware interrupt triggering:
§ Toggling a digital I/O pin which is connected to the calibration or bypassing
interface
§ Configuring a watchpoint (for example, on the MPC56x from Freescale,
formerly Motorola) and writing to a specific memory location
§ On some processors (for example, the NEC V85x) the trigger cannot be
configured by the processor itself, but must be set by the calibration or
bypassing interface. In these cases, the DCI Configuration Tool or the RTI
Bypass Blockset is used for configuration.
83
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Custom API Functions
DSECU_CUSTOM_HW_TRIGGER............................................................................................ 124
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
dsecu_custom_timeout_timestamp_get
Description This function calculates the current time stamp at the beginning
of a DAQ list, before capturing data from the ECU is started.
dsecu_custom_timeout_timestamp_get must be called before an ECU read
waiting sequence.
Return value TimeStamp Returns the calculated custom time stamp value.
dsecu_custom_timeout_pending_check.................................................................................... 85
DSECU_TIMEOUT_CUSTOM_FUNCTION................................................................................. 119
DSECU_TIMEOUT_TIMESTAMP_TYPE...................................................................................... 120
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
84
dSPACE Calibration and Bypassing Service Implementation May 2024
dsecu_custom_timeout_pending_check
dsecu_custom_timeout_pending_check
dsecu_custom_timeout_timestamp_get.................................................................................... 84
DSECU_TIMEOUT_CUSTOM_FUNCTION................................................................................. 119
DSECU_TIMEOUT_TIMESTAMP_TYPE...................................................................................... 120
dSPACE Calibration and Bypassing Service Custom API Functions............................................. 71
85
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Custom API Functions
86
dSPACE Calibration and Bypassing Service Implementation May 2024
dSPACE Calibration and Bypassing Service Configuration Options
Introduction The dSPACE Calibration and Bypassing Service provides mechanisms for
calibration, data acquisition, bypassing, subinterrupt handling, and ECU flash
programming. Most of these features are configurable.
87
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Introduction The features of the dSPACE Calibration and Bypassing Service can be configured.
Configuration is done via the dSPACE Calibration and Bypassing Service
configuration files dsECUcfg.h (for DAQ and bypassing) and dsECUbootcfg.h
(ECU flash programming), by means of conditional compilation with
preprocessor instructions (#defines).
Basic information on The dSPACE Calibration and Bypassing Service supports bypassing, data
configuration options acquisition and ECU flash programming tools in parallel. For the DCI‑GSI2, it
is sufficient to enable one service instance to perform bypassing, data acquisition
or ECU flash programming in parallel.
Some of the configuration options apply to both tools, which means that the
two service instances can be configured together (for example, the support of
32‑bit data types that can only be enabled globally). Other configuration options
must be set individually for each tool (for example, the location of the service
tables). Some preprocessor instructions are defined globally and must be unique.
In these cases, the name of each configuration option ends with the number of
the service instance. The configuration options of the first service instance have
the suffix “0”, and the configuration options of the second service instance are
suffixed by “1”.
Note
If only one tool is used at a time, the configuration options of the first
service instance are used, and the configuration options with suffix 1 are
ignored.
Note
88
dSPACE Calibration and Bypassing Service Implementation May 2024
Basics on Configuring Features of the dSPACE Calibration and Bypassing Service
89
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Disabling parts of the service reduces the consumption of ECU memory, and may
therefore improve the performance of the ECU application.
DSECU_SERVICE_REMOVED.................................................................... 90
To enable or disable the dSPACE Calibration and Bypassing Service
completely.
DSECU_DAQ_BYPASS_SERVICE............................................................... 91
To enable or disable data acquisition (DAQ) and bypassing.
DSECU_BYPASS....................................................................................... 91
To enable or disable bypassing.
DSECU_CALIBRATION_COMMANDS....................................................... 92
To enable or disable calibration commands.
DSECU_CUSTOM_COMMANDS.............................................................. 93
To enable or disable customer‑specific commands.
DSECU_FLASH_COMMANDS................................................................... 94
To enable or disable ECU flash programming commands.
DSECU_SERVICE_REMOVED
Purpose To enable or disable completely the dSPACE Calibration and Bypassing Service.
Parameters None
90
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of the Enabling/Disabling Features
DSECU_DAQ_BYPASS_SERVICE
Description During data acquisition and bypassing, a mechanism copies data to or from
the tool RAM. If DSECU_DAQ_BYPASS_SERVICE is disabled the mechanism is
disabled, and data acquisition and bypassing are not available. Other features,
like ECU flash programming, are not affected.
DSECU_BYPASS........................................................................................................................ 91
DSECU_BYPASS
91
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Description During bypassing, a mechanism copies data from the tool RAM to the internal
RAM of the ECU processor. If DSECU_BYPASS is disabled, this mechanism is
disabled, and bypassing is not available. Copying data in the other direction is
not affected, so that data acquisition is still possible.
Using this configuration option makes sense only if DAQ and bypassing are
enabled by DSECU_DAQ_BYPASS_SERVICE.
DSECU_DAQ_BYPASS_SERVICE................................................................................................ 91
DSECU_CALIBRATION_COMMANDS
92
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of the Enabling/Disabling Features
Description Other commands (for example, ECU flash programming commands) are not
affected by this option.
Note
For some DCI‑GSI2 processor families (e.g., the Freescale MPC55xx family),
calibration is done using the dSPACE Calibration and Bypassing Service. In
these cases, you must enable the calibration commands.
DSECU_CUSTOM_COMMANDS
93
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Description Other commands (for example, ECU flash programming commands) are not
affected by this option.
Note
DSECU_FLASH_COMMANDS
Description Other commands (for example, the custom command) are not affected by this
option.
94
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of the Enabling/Disabling Features
95
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
DSECU_NUMBER_TOOLS......................................................................... 96
To specify the number of DAQ and bypassing tools that can be used at
the same time.
DSECU_INT_STATUS_VAR_DECL.............................................................. 97
To declare a status variable for target processor interrupts.
DSECU_INT_SAVE_AND_DISABLE............................................................ 98
To disable the interrupts on the target processor.
DSECU_INT_RESTORE.............................................................................. 99
To re-enable the interrupts on the target processor.
DSECU_POINTER_QUALIFIER.................................................................. 100
To specify a prefix for pointer declarations.
DSECU_INLINE....................................................................................... 101
To specify a keyword for inline functions.
DSECU_DPMEM_OFFSETADDRx............................................................. 101
To specify the start address of the tool RAM.
DSECU_DPMEM_SIZEx........................................................................... 102
To specify the size of the tool RAM.
DSECU_POD_TYPEx............................................................................... 103
To specify the type of the POD used to adapt the target.
DSECU_PROCESSOR_TYPE.................................................................... 104
To specify the byte order of the ECU processor.
DSECU_BYTE_WRITE_SUPPORTED......................................................... 105
To specify whether byte‑wise write access to the tool RAM is supported.
DSECU_NUMBER_TOOLS
96
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of General Features
Purpose To specify the number of tools for DAQ, bypassing, or ECU flash programming
supported by the dSPACE Calibration and Bypassing Service at the same time.
Description For example, you can use either one calibration tool, or one ECU flashing tool, or
one calibration and one bypassing tool at the same time.
For the DCI‑GSI2, it is sufficient to enable one tool. The DCI‑GSI2 translates
the accesses of several tools into service accesses while using only one service
instance.
Parameters number of tools Specifies the number of service instances in the range
1 … 2.
DSECU_INT_STATUS_VAR_DECL
If you use the variable within at least one of the above macros, you must specify
its declaration via the DSECU_INT_STATUS_VAR_DECL macro. In this macro, the
variable must always be named status. The data type can be chosen as needed.
97
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Tip
To prevent compiler warnings (e.g. 'The variable xxx was declared but never
referenced'), you can leave the DSECU_INT_STATUS_VAR_DECL macro
blank if no variable is needed to store the interrupt status.
DSECU_INT_RESTORE............................................................................................................... 99
DSECU_INT_SAVE_AND_DISABLE............................................................................................. 98
DSECU_INT_SAVE_AND_DISABLE
Purpose To disable the interrupts on the target processor and store their current statuses.
Disabling interrupts depends on the target processor and often on the compiler.
98
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of General Features
DSECU_INT_RESTORE............................................................................................................... 99
DSECU_INT_STATUS_VAR_DECL............................................................................................... 97
DSECU_INT_RESTORE
Purpose To re-enable the interrupts on the target processor and restore the interrupt
status.
Description The status can be copied from the variable specified by status or from the stack
as shown in the example below to the interrupt status register of the target
processor. If a variable is used, it is strongly recommended to use a local variable.
Otherwise the status is overwritten if DSECU_INT_SAVE_AND_DISABLE is called
twice in succession without the DSECU_INT_RESTORE macro being called in
between.
Disabling interrupts depends on the target processor and often on the compiler.
99
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
DSECU_INT_SAVE_AND_DISABLE............................................................................................. 98
DSECU_INT_STATUS_VAR_DECL............................................................................................... 97
DSECU_POINTER_QUALIFIER
Purpose To specify the kind of pointer that is used within the dSPACE Calibration and
Bypassing Service.
Description Some processors are restricted in addressing a large memory range. Sometimes
an additional keyword (for example, “far”) must be used in the source code to
address a memory location.
Parameters … Qualifier for pointers in the dSPACE Calibration and Bypassing Service.
100
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of General Features
DSECU_INLINE
Purpose To enable inlining for the dSPACE Calibration and Bypassing Service.
Description Some functions of the dSPACE Calibration and Bypassing Service can be
compiled as inline functions. If inlining is supported by the compiler, this define
can be the same as the define which is set with inlining enabled.
DSECU_DPMEM_OFFSETADDRx
Purpose To specify the start address of the memory that is used by the dSPACE
Calibration and Bypassing Service.
Description This define specifies the start address of the tool RAM, which can be accessed by
the target processor and the tool.
If bypassing and data acquisition are done in parallel, this option must be set for
each tool individually. The memory ranges of the two tools must not overlap. See
also DSECU_DPMEM_SIZEx on page 102.
101
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Note
Do not place the tool RAM area in a cached memory area of the
microcontroller. Using a cached memory area can lead to loss or delay of
interrupt triggers and can cause problems with delays in reading/writing
memory contents.
Parameters offset address Specifies the start address of the memory in the DPMEM used
by the service.
DSECU_DPMEM_SIZEx............................................................................................................ 102
DSECU_DPMEM_SIZEx
Purpose To specify the size of the tool RAM that is used by the dSPACE Calibration and
Bypassing Service.
Description This define specifies the length of the tool RAM which can be accessed by the
target processor and the tool.
If bypassing and data acquisition are done in parallel, this option must be set
individually for each tool. The memory ranges of the two tools must not overlap.
See also DSECU_DPMEM_OFFSETADDRx on page 101.
102
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of General Features
Note
Do not place the tool RAM area in a cached memory area of the
microcontroller. Using a cached memory area can lead to loss or delay of
interrupt triggers and can cause problems with delays in reading/writing
memory contents.
Parameters size of tool RAM Specifies the length in bytes of the memory that is used by
the dSPACE Calibration and Bypassing Service.
DSECU_DPMEM_OFFSETADDRx.............................................................................................. 101
DSECU_POD_TYPEx
Description This option specifies the kind of adapter which is used to access the target.
Some address calculations must be adapted to the plug-on device (POD) that is
used. Thus, the POD must be specified if the dSPACE Calibration and Bypassing
Service is used for bypassing purposes. If bypassing and data acquisition are
done in parallel, this option must be set for each tool individually.
103
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Parameters The following parameters are available as POD types for DSECU_POD_TYPE:
DSECU_PROCESSOR_TYPE
Description Since the dSPACE Calibration and Bypassing Service can run on different kinds of
ECUs, you must specify the byte order of the ECU‘s microcontroller.
104
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of General Features
DSECU_BYPASS........................................................................................................................ 91
DSECU_BYTE_WRITE_SUPPORTED
Purpose To specify whether 8‑bit write accesses to the tool RAM are supported by the
calibration or bypass interface used.
Description For example, there are PODs that do not support byte‑wise ECU access, but only
16‑bit ECU access. Using the DSECU_BYTE_WRITE_SUPPORTED option, 8‑bit read
or write ECU access is nevertheless enabled for these PODs. To read from the
ECU, a bit mask specifying the needed bits is used. For write access, a macro is
executed which performs a read/modify/write operation.
DSECU_BYPASS........................................................................................................................ 91
105
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
DSECU_CAL_NUMBER_OF_PAGES......................................................... 106
To specify the number of pages implemented in the ECU application.
DSECU_CAL_PAGED_ADDRESSING....................................................... 107
To enable or disable the paged address mode.
DSECU_CAL_ABSOLUTE_ADDRESSING.................................................. 108
To enable or disable the absolute address mode.
DSECU_CAL_MEMORY_COPY_METHOD............................................... 108
To select the method used to copy memory.
DSECU_CAL_NUMBER_OF_PAGES
Purpose To specify the number of calibration pages implemented in the ECU application.
Note
Description You need this configuration option only if calibration commands are enabled by
DSECU_CALIBRATION_COMMANDS.
Parameters <number of pages> Specifies the number of calibration pages on the ECU.
106
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of Calibration Features
DSECU_CALIBRATION_COMMANDS........................................................................................ 92
DSECU_CAL_PAGED_ADDRESSING
You need this configuration option only if calibration commands are enabled by
DSECU_CALIBRATION_COMMANDS.
DSECU_CALIBRATION_COMMANDS........................................................................................ 92
107
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
DSECU_CAL_ABSOLUTE_ADDRESSING
Description Address translation must be done by the tool. Since the tool does not know
the location of the calibration pages in the ECU memory, this address mode is
used only for memory locations that are not paged. Both the paged and absolute
address modes can be enabled in parallel. The tool automatically determines the
address mode which must be used with a specific command.
You need this configuration option only if calibration commands are enabled by
DSECU_CALIBRATION_COMMANDS.
DSECU_CALIBRATION_COMMANDS........................................................................................ 92
DSECU_CAL_MEMORY_COPY_METHOD
108
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of Calibration Features
Description In some scenarios, the dSPACE Calibration and Bypassing Service must be used
to copy ECU memory from one location to another. This is used, for example,
to configure the overlay RAM registers for calibration. This configuration option
specifies the method used for copying the memory.
You need this configuration option only if calibration commands are enabled by
DSECU_CALIBRATION_COMMANDS.
DSECU_CALIBRATION_COMMANDS........................................................................................ 92
dsecu_custom_copy................................................................................................................. 78
109
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
DSECU_SCS_LOCATION........................................................................ 111
To specify the location of the Service Configuration Section (SCS) copy.
DSECU_SCSOFFSETADDRx..................................................................... 112
To specify the offset of the original Service Configuration Section (SCS).
MORE_ATs_FOR_ONE_SRV.................................................................... 112
To enable or disable the use of several Address Tables per service call.
DSECU_DOUBLE_BUFFER....................................................................... 113
To enable or disable the double buffer mechanism.
DSECU_BLOCK_COPY........................................................................... 114
To enable or disable the block copy mechanism.
DSECU_xxBIT_SUPPORT......................................................................... 115
To enable or disable the support of 64‑bit, 32‑bit, 16‑bit and 8‑bit data
types.
DSECU_BITS_SUPPORT.......................................................................... 116
To enable or disable the support of bit modification.
DSECU_ECU_WAITS.............................................................................. 117
To enable or disable the wait mechanism.
DSECU_FAILURE_CHECKING................................................................. 118
To enable or disable the failure checking mechanism.
DSECU_TIMEOUT_CUSTOM_FUNCTION................................................ 119
To enable or disable the custom time function for specifying the timeout.
DSECU_TIMEOUT_TIMESTAMP_TYPE..................................................... 120
To specify the data type of the time stamp used with the custom timeout
mechanism.
DSECU_TIMEOUT_SCALING_10US........................................................ 121
To specify the base unit for the timeout in the wait mechanism.
DSECU_FAILSAFE_PAGE......................................................................... 122
To enable or disable the fail‑safe page.
DSECU_CUSTOM_HW_TRIGGER........................................................... 124
To enable or disable custom hardware trigger.
DSECU_SUBINT_TYPE............................................................................ 124
To specify the type of subinterrupt handling.
DSECU_SINT_NUMBER.......................................................................... 125
To specify the number of subinterrupts.
110
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of DAQ and Bypassing Features
DSECU_MAX_SERVICE_COUNT............................................................. 126
To specify the maximum number of service IDs.
DSECU_SCS_LOCATION
Purpose To specify the location of the Service Configuration Section (SCS) copy.
Description The dSPACE Calibration and Bypassing Service copies the SCS to another
memory location. This can be either the normal RAM of the ECU, or the tool
RAM.
If the SCS copy is located in the tool RAM, the amount of local RAM is
minimized.
You need this configuration option only if data acquisition and bypassing are
enabled by DSECU_DAQ_BYPASS_SERVICE.
DSECU_DAQ_BYPASS_SERVICE................................................................................................ 91
111
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
DSECU_SCSOFFSETADDRx
Purpose To specify the offset of the original Service Configuration Section (SCS) in the
tool RAM.
Description The start address of the SCS is calculated by adding this offset to the start
address of the service memory (specified by DSECU_DPMEM_OFFSETADDRx).
Generally, the offset of the original SCS is set to 0.
You need this configuration option only if data acquisition and bypassing are
enabled by DSECU_DAQ_BYPASS_SERVICE.
Parameters offset Specifies the offset of the original SCS within the service memory.
DSECU_DAQ_BYPASS_SERVICE................................................................................................ 91
MORE_ATs_FOR_ONE_SRV
Purpose To enable or disable the use of several Address Tables per service call.
Description This option enables or disables the use of more than one Address Tables per
service ID. Each Address Table can be configured for one data direction. For
example, if more than one Address Table per service ID is supported, an ECU
112
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of DAQ and Bypassing Features
service call first reads data and then writes data to the tool RAM, or vice
versa. The tool can then assign more than one Address Table to one service ID.
However, supporting more than one Address Table per service ID requires slightly
more execution time, because the dSPACE Calibration and Bypassing Service
must scan all the Address Tables. If only one Address Table is allowed, the service
can skip the remaining Address Tables.
You need this configuration option only if data acquisition and bypassing are
enabled by DSECU_DAQ_BYPASS_SERVICE.
DSECU_DAQ_BYPASS_SERVICE................................................................................................ 91
DSECU_DOUBLE_BUFFER
Description The double buffer mechanism is used to ensure that only consistent data blocks
are transferred to or from the tool RAM. If the mechanism is enabled, two
buffers are used for data exchange between the ECU and the rapid control
prototyping (RCP) system. If the option is set to DSECU_DISABLED, the double
buffer mechanism is not supported, and only one data buffer is used for data
exchange.
You need this configuration option only if data acquisition and bypassing are
enabled by DSECU_DAQ_BYPASS_SERVICE.
113
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
DSECU_DAQ_BYPASS_SERVICE................................................................................................ 91
DSECU_BLOCK_COPY
Description This configuration option is a global setting for the dSPACE Calibration and
Bypassing Service, that is, it is done for both bypassing and data acquisition.
Data block transfer is usually disabled for bypassing, because only single data
values are transferred. This way, the size of the service code is minimized, and
the code is faster. However, if the tool requires the dSPACE Calibration and
Bypassing Service to transfer data blocks as well, you must enable the data block
copy mechanism with DSECU_BLOCK_COPY.
You need this configuration option only if data acquisition and bypassing are
enabled by DSECU_DAQ_BYPASS_SERVICE.
114
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of DAQ and Bypassing Features
For information on the block copy mechanism, refer to Block Copy Mechanism
on page 59.
Note
If you perform bypassing via the RTI Bypass Blockset, data block transfers
must be disabled.
DSECU_DAQ_BYPASS_SERVICE................................................................................................ 91
DSECU_xxBIT_SUPPORT
Description The options are enabled by default. If a data size is not used, for example,
because it is not supported by the target processor, or because it is not
used for data exchange between the ECU and the tool, you can disable
the corresponding option. This minimizes the compiled service code and
makes it faster. If a data size remains enabled although it is not used, the
only disadvantage is that the service execution time and the compiled code
are increased. The DSECU_64BIT_SUPPORT option especially might require a
115
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Enabled options are valid for all the tools connected to the ECU. Even if the
transfer of a certain data type is used by only one tool, the corresponding option
must be enabled, and the data type is available for every tool.
You need this configuration option only if data acquisition and bypassing are
enabled by DSECU_DAQ_BYPASS_SERVICE.
Note
The RTI Bypass Blockset supports data transfer only up to 32‑bit values.
DSECU_DAQ_BYPASS_SERVICE................................................................................................ 91
DSECU_BITS_SUPPORT
Purpose To enable or disable the writing of one or more bits to the ECU for bypassing.
Description This option enables or disables the support for bit modification in the ECU. The
transfer of bits from the ECU to the tool is not supported. For this direction,
116
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of DAQ and Bypassing Features
the whole byte containing the bit(s) must be read, and the other bits must be
masked out on the host PC with a binary AND operation. Thus, enabling bit
transfers makes sense only for bypassing.
DSECU_BYPASS........................................................................................................................ 91
DSECU_ECU_WAITS
Description The wait mechanism is used with bypassing to wait for a valid response from the
tool (new data available), provided that the double buffer mechanism is enabled.
You need this configuration option only if the double buffer mechanism is
enabled by DSECU_DOUBLE_BUFFER.
117
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
DSECU_DOUBLE_BUFFER........................................................................................................ 113
DSECU_FAILURE_CHECKING
Description If enabled, the failure checking mechanism is supported for data communication
from the tool to the ECU.
You need this configuration option only if the double buffer mechanism is
enabled by DSECU_DOUBLE_BUFFER.
118
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of DAQ and Bypassing Features
DSECU_DOUBLE_BUFFER........................................................................................................ 113
DSECU_TIMEOUT_CUSTOM_FUNCTION
Purpose To enable or disable the custom time stamp functionality for specifying the
timeout.
Description This option lets you specify the mechanism used to detect a timeout in the wait
mechanism.
§ If this option is enabled, the timeout is calculated via the custom timeout
mechanism. The DSECU_TIMEOUT_TIMESTAMP_TYPE define is used to specify
the timeout's data type.
With the custom timeout mechanism enabled, the waiting process of a
function is not interrupted by the execution of another function, but
continued simultaneously. That means interrupts do not extend the waiting
time of a function. The absolute waiting period (i.e., the time from the start
of the waiting process to its end) matches the timeout specified for the wait
mechanism.
Example:
Priority
function 2
function 1
t
Waiting time
119
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Priority
function 2
function 1
t
Waiting time Waiting time (resumed)
Function 1 starts its waiting process. When function 2 is ready for execution,
the waiting process of function 1 is interrupted until function 2 has finished.
Function 1 then resumes its waiting process.
DSECU_TIMEOUT_SCALING_10US......................................................................................... 121
DSECU_TIMEOUT_TIMESTAMP_TYPE...................................................................................... 120
DSECU_TIMEOUT_TIMESTAMP_TYPE
120
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of DAQ and Bypassing Features
Purpose To specify the data type of the time stamp used with the custom timeout
mechanism.
You need this configuration option only if the following configuration options
are enabled:
§ The custom timeout mechanism must be enabled by
DSECU_TIMEOUT_CUSTOM_FUNCTION.
§ The wait mechanism must be enabled by DSECU_ECU_WAITS.
§ The double buffer mechanism must be enabled by DSECU_DOUBLE_BUFFER.
§ Data acquisition and bypassing must be enabled by
DSECU_DAQ_BYPASS_SERVICE.
§ Bypassing must be enabled by DSECU_BYPASS.
dsecu_custom_timeout_pending_check.................................................................................... 85
DSECU_TIMEOUT_CUSTOM_FUNCTION................................................................................. 119
DSECU_TIMEOUT_SCALING_10US
Purpose To specify the base unit for the timeout in the wait mechanism.
Description You can specify a scaling factor for a timeout with the double buffer mechanism.
The timeout can only be used if the double buffer mechanism and the ECU wait
mechanism are enabled.
121
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Note
The specified timeout matches the real timeout only if this define is set
properly.
DSECU_BYPASS........................................................................................................................ 91
DSECU_DAQ_BYPASS_SERVICE................................................................................................ 91
DSECU_DOUBLE_BUFFER........................................................................................................ 113
DSECU_ECU_WAITS............................................................................................................... 117
DSECU_TIMEOUT_CUSTOM_FUNCTION................................................................................. 119
DSECU_FAILSAFE_PAGE
122
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of DAQ and Bypassing Features
Description The fail‑safe mechanism is used to provide valid data (fail‑safe data) when the
tool has failed to provide new data to the ECU more often than indicated in
the failure limit value. The failure checking mechanism and the double buffer
mechanism must be enabled to make this mechanism available.
When the fail‑safe mechanism is enabled, the fail‑safe flag and the failure limit
have to be set in the Address Table Header. If the maximum number of failures
is reached, the fail‑safe data is read. If the fail‑safe mechanism is disabled, the
service call will return an error.
You need this configuration option only if the following configuration options
are enabled:
§ The failure checking mechanism must be enabled by
DSECU_FAILURE_CHECKING.
§ The double buffer mechanism must be enabled by DSECU_DOUBLE_BUFFER.
§ Data acquisition and bypassing must be enabled by
DSECU_DAQ_BYPASS_SERVICE.
§ Bypassing must be enabled by DSECU_BYPASS.
Note
DSECU_BYPASS........................................................................................................................ 91
DSECU_DAQ_BYPASS_SERVICE................................................................................................ 91
DSECU_DOUBLE_BUFFER........................................................................................................ 113
DSECU_FAILURE_CHECKING.................................................................................................. 118
123
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
DSECU_CUSTOM_HW_TRIGGER
You need this configuration option only if data acquisition and bypassing are
enabled by DSECU_DAQ_BYPASS_SERVICE.
dsecu_custom_trigger_hw_int.................................................................................................. 83
DSECU_DAQ_BYPASS_SERVICE................................................................................................ 91
DSECU_SUBINT_TYPE
124
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of DAQ and Bypassing Features
Description In most cases, there is only one hardware interrupt line from the ECU to the tool.
To handle multiple interrupts, subinterrupt handling is needed. The methods
differ in the number of bits that are required for handling a subinterrupt:
§ The word‑based subinterrupt handling uses 16 bits per subinterrupt. This
method has always been used so far, so it offers high compatibility.
§ The byte‑based subinterrupt handling uses eight bits per subinterrupt. This
method is a cross between the other two methods.
§ With bit‑based subinterrupt handling, one bit is used per subinterrupt.
You need this configuration option only if data acquisition and bypassing are
enabled by DSECU_DAQ_BYPASS_SERVICE.
References
DSECU_DAQ_BYPASS_SERVICE................................................................................................ 91
DSECU_SINT_NUMBER........................................................................................................... 125
DSECU_SINT_NUMBER
125
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Description You can adapt the number of subinterrupts to the ECU application. The more
subinterrupts are used, the more memory is required to handle them, and the
longer it takes to read out the memory.
References
DSECU_SUBINT_TYPE............................................................................................................. 124
DSECU_MAX_SERVICE_COUNT
Description This define should be adjusted if more than 255 service IDs are needed. The
more service IDs are supported, the more tool RAM is required to handle them.
Parameters <number of service IDs> Specifies the maximum number of service IDs.
126
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of DAQ and Bypassing Features
127
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
DSECU_MAILBOX_ADDRx..................................................................... 129
To specify the start address of the dSPACE mailbox which is required
for communication between the ECU and the dSPACE ECU Flash
Programming Tool.
DSECU_FLASH_MAX_SECTORS............................................................. 130
To specify the maximum number of sectors that can be flashed.
DSECU_FLASH_SECTOR_LIST................................................................. 131
To specify a list with configuration data for each flash sector.
DSECU_FLASH_MAX_CODECHECKS..................................................... 132
To specify the maximum number of code checks.
DSECU_FLASH_CODECHECK_LIST......................................................... 133
To specify a list of code check data.
DSECU_APPLICATION_LOCK_INIT.......................................................... 134
To initialize ECU application locking during flash kernel download.
DSECU_APPLICATION_LOCK_LOOP....................................................... 134
To lock the ECU application during the download of the flash kernel.
DSECU_APPLICATION_VALID_CHECK.................................................... 135
To enable or disable the boot loader check for a valid ECU application.
DSECU_APPLICATION_VALID_ID_ADDRESS............................................ 136
To specify the location of the flash valid identifier in the ECU flash
memory.
DSECU_APPLICATION_VALID_ID_VALUE................................................ 137
To specify a fixed value indicating that the last ECU flash programming
operation was completed successfully.
Introduction Depending on what you want to do, different options are required.
128
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of ECU Flash Programming Features
Option overview Options for building a custom flash kernel (Necessary only if no flash
kernel provided by dSPACE is to be used) To build a custom flash kernel, the
following options are required:
§ DSECU_MAILBOX_ADDRx
§ DSECU_FLASH_MAX_SECTORS
§ DSECU_FLASH_SECTOR_LIST
§ DSECU_FLASH_MAX_CODECHECKS
§ DSECU_FLASH_CODECHECK_LIST
Note
The code check configuration settings are made in the dSPACE ECU
Flash Programming Tool. Thus, the DSECU_FLASH_MAX_CODECHECKS and
DSECU_FLASH_CODECHECK_LIST configuration options are obsolete.
DSECU_MAILBOX_ADDRx
Purpose To specify the start address of the dSPACE mailbox. The mailbox is used for
communication between the ECU and the dSPACE ECU Flash Programming Tool.
129
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
Description Via the dSPACE mailbox, the dSPACE ECU Flash Programming Tool indicates a
pending ECU flashing request to the ECU. During ECU flash programming, the
mailbox is used to transfer the erase and program commands from the flash tool
to the ECU.
Note
Parameters <start address of mailbox> Specifies the start address of the dSPACE
mailbox.
DSECU_FLASH_MAX_SECTORS
Purpose To specify the maximum number of sectors that can be flashed to the ECU.
You need this configuration option only if the flashing commands are enabled by
DSECU_FLASH_COMMANDS.
Parameters <number of sectors> Specifies the number of sectors that can be flashed.
130
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of ECU Flash Programming Features
References
DSECU_FLASH_COMMANDS.................................................................................................... 94
DSECU_FLASH_SECTOR_LIST
Purpose To specify the list with configuration data for every flash sector.
Description This option specifies the configuration for a list of flash sectors on the ECU. The
list must contain exactly DSECU_FLASH_MAX_SECTORS entries.
131
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
§ Memory type
The memory type is displayed in the flash tool for information. The following
memory types are available:
§ DSECU_MEMTYPE_EXT_FLASH
§ DSECU_MEMTYPE_EXT_RAM
§ DSECU_MEMTYPE_EXT_NVRAM
§ DSECU_MEMTYPE_INT_FLASH
§ DSECU_MEMTYPE_INT_RAM
§ DSECU_MEMTYPE_INT_NVRAM
You need this configuration option only if the flashing commands are enabled by
DSECU_FLASH_COMMANDS.
References
DSECU_FLASH_COMMANDS.................................................................................................... 94
DSECU_FLASH_MAX_CODECHECKS
132
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of ECU Flash Programming Features
Description This option specifies the number of code checks defined in this configuration
template.
Note
This option is obsolete. The code check configuration settings are now
made in the dSPACE ECU Flash Programming Tool. You should therefore set
the value of this define to 0.
Parameters <number of code checks> Specifies the number of code check data
packages.
DSECU_FLASH_CODECHECK_LIST
Purpose To specify the configuration for a list of data packages used for the code check.
Description This option specifies the configuration for a list of code check data packages.
Note
This option is obsolete. The code check configuration settings are now
made in the dSPACE ECU Flash Programming Tool. You should therefore set
the value of this define to 0.
133
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
DSECU_APPLICATION_LOCK_INIT
Purpose To prepare the ECU application for downloading the flash kernel.
Parameters … Code that is executed just before the flash kernel is downloaded.
DSECU_APPLICATION_LOCK_LOOP
134
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of ECU Flash Programming Features
Purpose To execute custom commands during the download of the flash kernel.
Description During the download of the flash kernel, the ECU application is locked,
which means it remains in an idle loop. This is necessary because the flash
kernel is written to RAM memory at the risk of overwriting other important
data (for example, program variables). The macro is called repeatedly by
the dsecuboot_check function until the flash kernel has been completely
transferred to the ECU memory.
DSECU_APPLICATION_VALID_CHECK
Purpose To enable or disable the boot loader check to find out if the flash memory
contains a valid ECU application.
Description The boot loader check for a valid ECU application is used to check whether
the last ECU flash programming operation was completed successfully or
not. When the check is enabled, the boot loader checks for the "flash
valid identifier" in the ECU flash memory (at the address specified by
DSECU_APPLICATION_VALID_ID_ADDRESS). The value in the ECU flash memory
is compared to the value specified by DSECU_APPLICATION_VALID_ID_VALUE.
135
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
If the values differ, the last ECU flash programming operation is assumed to be
invalid or incomplete, so the ECU application is not started and the ECU stays in
flash‑programming mode. The ECU application will not start until another ECU
flash programming operation is completed successfully.
DSECU_APPLICATION_VALID_ID_ADDRESS
Purpose To specify the location of the "flash valid identifier" in the ECU flash memory.
Description This define specifies the address of the flash valid identifier in the ECU flash
memory. The identifier is always 4 bytes long.
You can specify any location within a memory segment of CODE segment type
in the ECU application, or the address of a specific ID you introduced for this
purpose. The memory segment containing the identifier will be reprogrammed
with every flash operation.
You need this configuration option only if the boot loader check for a valid ECU
application is enabled by DSECU_APPLICATION_VALID_CHECK.
136
dSPACE Calibration and Bypassing Service Implementation May 2024
Configuration of ECU Flash Programming Features
References
DSECU_APPLICATION_VALID_CHECK..................................................................................... 135
DSECU_APPLICATION_VALID_ID_VALUE
Purpose To specify a fixed 32‑bit value indicating that the last ECU flash programming
operation was completed successfully.
Description With the boot loader check for a valid ECU application enabled, the value
found at DSECU_APPLICATION_VALID_ID_ADDRESS in the ECU flash memory
is compared to the value specified in this configuration option. If the values
are equal, the last flash programming operation was completed successfully. If
they differ, the ECU flash programming operation is assumed to be invalid or
incomplete.
Note
§ If you specify a fixed value, make sure that your ECU application contains
exactly that value at the "flash valid identifier" location (specified by
DSECU_APPLICATION_VALID_ID_ADDRESS).
§ If you do not specify a fixed value with this configuration option,
any value found in the ECU flash memory at the address specified by
DSECU_APPLICATION_VALID_ID_ADDRESS is accepted as a valid value,
except for the values 0x0 and 0xFFFFFFFF.
You need this configuration option only if the boot loader check for a valid ECU
application is enabled by DSECU_APPLICATION_VALID_CHECK.
Parameters <value> Specifies the fixed value indicating a successful ECU flash
programming operation.
137
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Configuration Options
References
DSECU_APPLICATION_VALID_CHECK..................................................................................... 135
138
dSPACE Calibration and Bypassing Service Implementation May 2024
dSPACE Calibration and Bypassing Service Interface Description
Interface Description
Required interface‑specific The A2L file must include an IF_DATA element specific to the calibration,
information measurement or bypass interface used. The IF_DATA element contains interface-
specific information. This information must comply with a special format, which
is described in ASAP2 Meta Language (AML) files. The AML specification of the
interface must also be contained in the A2L file.
The IF_DATA elements describing the dSPACE Calibration and Bypassing Service
implementation must be set to the configuration defined in dsECUcfg.h. For
information on how to configure the dSPACE Calibration and Bypassing Service,
refer to dSPACE Calibration and Bypassing Service Configuration Options on
page 87.
Note
139
May 2024 dSPACE Calibration and Bypassing Service Implementation
dSPACE Calibration and Bypassing Service Interface Description
Note
To access one ECU with the DCI‑GSI2 using two tools in parallel, for
example, to perform measurement/calibration and bypassing at the same
time, it is sufficient to configure one instance of the dSPACE Calibration and
Bypassing Service. In other cases, two instances of the dSPACE Calibration
and Bypassing Service must be configured to access one ECU using two
tools in parallel. Then each tool‑specific IF_DATA element must refer to
a different instance of the dSPACE Calibration and Bypassing Service. In
particular, the Tool RAM configurations must be different for the tools
to ensure that each tool accesses a different tool RAM. For information
on how to configure the dSPACE Calibration and Bypassing Service to be
accessible from two tools at the same time, refer to dSPACE Calibration and
Bypassing Service Configuration Options on page 87.
140
dSPACE Calibration and Bypassing Service Implementation May 2024
Index
Index
DSECU_FLASH_SECTOR_LIST 131 Extended Table Pointer Section 41
A DSECU_INLINE 101
DSECU_INT_RESTORE 99 F
Address Table 40
DSECU_INT_SAVE_AND_DISABLE 98
AT 40 flash kernel 28
DSECU_INT_STATUS_VAR_DECL 97
DSECU_MAILBOX_ADDRx 129
B DSECU_MAX_SERVICE_COUNT 126 I
bypassing DSECU_NUMBER_TOOLS 96 integrating the dSPACE Calibration and
buffer synchronization mechanism 45 DSECU_POD_TYPEx 103 Bypassing Service 27
double buffer mechanism 44 DSECU_POINTER_QUALIFIER 100
fail-safe mechanism 45 DSECU_PROCESSOR_TYPE 104
L
failure checking mechanism 45 DSECU_SCS_LOCATION 111
DSECU_SCSOFFSETADDRx 112 license agreement 11
wait mechanism 44
dsecu_service 64 license agreement for dSPACE Calibration and
dsecu_service_background 67 Bypassing Service 11
C Local Program Data folder 9
dsecu_service_buffer_sync 68
Common Program Data folder 8 dsecu_service_init 64
DSECU_SERVICE_REMOVED 90 M
D dsecu_service_state 66
MORE_ATs_FOR_ONE_SRV 112
DSECU_SINT_NUMBER 125
data types for dSPACE Calibration and Bypassing
DSECU_SUBINT_TYPE 124
Service 25 S
DSECU_TIMEOUT_CUSTOM_FUNCTION 119
Documents folder 8
DSECU_TIMEOUT_SCALING_10US 121 SCS 39
DSECU_APPLICATION_LOCK_INIT 134
DSECU_TIMEOUT_TIMESTAMP_TYPE 120 service configuration
DSECU_APPLICATION_LOCK_LOOP 134
DSECU_xxBIT_SUPPORT 115 dSPACE Calibration and Bypassing Service 87
DSECU_APPLICATION_VALID_CHECK 135
dsecuboot_check 69 Service Configuration Section 39
DSECU_APPLICATION_VALID_ID_ADDRESS 136
dSPACE Calibration and Bypassing Service Service Pointer Table 41
DSECU_APPLICATION_VALID_ID_VALUE 137
alive and version information mechanism 49 SPT 41
DSECU_BITS_SUPPORT 116
API 27
DSECU_BLOCK_COPY 114
background service 28
DSECU_BYPASS 91 T
block copy mechanism 59
DSECU_BYTE_WRITE_SUPPORTED 105 Table Pointer Section 39
boot check function 28
DSECU_CAL_ABSOLUTE_ADDRESSING 108 TPS 39
configuration 87
DSECU_CAL_MEMORY_COPY_METHOD 108
configuration of calibration features 106
DSECU_CAL_NUMBER_OF_PAGES 106
configuration of DAQ and bypassing
DSECU_CAL_PAGED_ADDRESSING 107
features 110
DSECU_CALIBRATION_COMMANDS 92
configuration of ECU flash programming
dsecu_custom_cal_absolute_access 80
features 128
dsecu_custom_cal_page_switch 79
configuration of enabling/disabling
dsecu_custom_cal_paged_access 81
features 90
dsecu_custom_cal_paged_access_finished 82
configuration of general features 96
dsecu_custom_command 77
Custom API 71
DSECU_CUSTOM_COMMANDS 93
data structures 36
dsecu_custom_copy 78
data types 25
dsecu_custom_flash_decode 75
dSPACE ECU Flash Programming Tool 17
dsecu_custom_flash_erase_range 73
ECU flash programming mechanism 60
dsecu_custom_flash_finish 76
file structure 23
dsecu_custom_flash_program_range 74
foreground service 28
dsecu_custom_flash_program_start 73
initialization 27
DSECU_CUSTOM_HW_TRIGGER 124
integration in ECU code 29
dsecu_custom_timeout_pending_check 85
license agreement 11
dsecu_custom_timeout_timestamp_get 84
requirements
dsecu_custom_trigger_hw_int 83
bypassing 16
DSECU_DAQ_BYPASS_SERVICE 91
calibration and data acquisition 16
DSECU_DOUBLE_BUFFER 113
ECU flash programming 17
DSECU_DPMEM_OFFSETADDRx 101
software layers 21
DSECU_DPMEM_SIZEx 102
starting the flash kernel 28
DSECU_ECU_WAITS 117
subinterrupt handling mechanism 55
DSECU_FAILSAFE_PAGE 122
system components 17
DSECU_FAILURE_CHECKING 118
dSPACE ECU Flash Programming Tool 17
DSECU_FLASH_CODECHECK_LIST 133
DSECU_FLASH_COMMANDS 94
DSECU_FLASH_MAX_CODECHECKS 132 E
DSECU_FLASH_MAX_SECTORS 130 ETPS 41
141
May 2024 dSPACE Calibration and Bypassing Service Implementation
Index
142
dSPACE Calibration and Bypassing Service Implementation May 2024