Professional Documents
Culture Documents
Openecu User Guide Simulink
Openecu User Guide Simulink
User Guide
OpenECU Developer Platform
Sim-API
Release 2.9.0 (r2020-1)
Pi, the Pi logo and OpenECU are trademarks of Pi Innovo Ltd. Microsoft, Windows,
Excel, Word, MATLAB, Simulink, StateFlow, Vision, CANape and INCA are all registered
trademarks of their respective owners.
1. Disclaimer
Pi Innovo makes no representation or warranties of any kind whatsoever with respect to
the contents hereof, and specifically disclaims any implied warranties of merchantability or
fitness for any particular purpose. Pi Innovo shall not be liable for any errors contained herein,
or for incidental or consequential damages in connection with the furnishing, performance or
use of the software, associated hardware, or this written material.
Pi Innovo reserves the right to revise this publication from time to time, and to make changes
in the content hereof without obligation to notify any person of such revision or changes.
A copy of the Pi Innovo Terms and Conditions of Sale is available on request, and includes
a declaration of the warranty and limitation of liability which apply to all Pi Innovo products
and services.
Any hazardous materials in Pi products are clearly marked with appropriate symbols. Product
Safety Data Sheets relating to these materials are available on request.
Pi Innovo's OpenECU platform offers a new solution to engine and vehicle control system
development. Based on Pi's extensive experience of ECU development, and backed by Pi's
unrivalled capabilities in project and customer support, OpenECU helps you get quickly to
what you need: working, robust control systems.
By using production ECU hardware as an auto-code platform, you gain all the advantages
of auto-coding and rapid prototyping, but with hardware that meets full production
environmental and packaging requirements (see Section A.1, “ECU hardware reference
documentation” for environmental and packaging details).
• a range of production ECU hardware modules for engines with up to 8 cylinders (or more
with multiple modules);
• an optional range of tested engine and vehicle control strategies, from individual functional
blocks to complete strategy suites;
• a comprehensive range of support and consultancy services, ranging from sensor selection
and system design advice through to complete bespoke system development.
For support contact information, please see the last page of this manual.
Simulink is a widely used software package for modelling, simulating and analysing dynamic
systems, which is based upon the MATLAB software engine. It allows you to build graphical
models of linear and non-linear systems, using a simple drag-and-drop interface and a library
of functional blocks. You can then simulate your model under dynamic running conditions
to analyse its behaviour, and continuously interact with the parameters while the simulation
is running.
Many functional blocks are included in the standard Simulink library, allowing you to model
any system whose dynamics you want to simulate. This library is supplemented by Pi's
OpenECU blocks, which are specialised for use with the OpenECU platform.
1.2.1. Hardware
The following items of hardware are available as part of OpenECU:
Connectors
All the connectors and terminals required to connect the ECU, the calibration tool and
your PC together.
Tools
You will require a crimping tool for the ECU connectors. Pi Innovo will give you details
on request.
1.2.2. Software
The following items of software are available as part of OpenECU:
And the following items of software are required but not provided as part of OpenECU.
Calibration Tool
This electronic tool is used to program the auto-generated code into the ECU, and to
monitor (and, in some cases, alter) the values of certain parameters while the ECU is
running. Pi's own PiSnoop product is one option, along with several industry-standard
alternatives, and we will be able to recommend a suitable product on request.
Compiler
A tool which takes the Simulink generated code representing the graphical model and
turns it into an executable image that can be run on OpenECU hardware.
• OPENECU
The main feature. Enabled when you purchase any version of OpenECU
• CAPI_BUILD
Allows for building OpenECU applications with the C-API. This feature is also a prerequisite
for SIMULINK_BUILD.
• SIMULINK_SIMULATE
Allows for simulation of OpenECU models in Simulink. This feature is also a prerequisite
for SIMULINK_BUILD.
• SIMULINK_BUILD
Allows for building OpenECU models with the Sim-API. Because the Sim-API wraps the
C-API, both features are required to build OpenECU Simulink models
• EXT_DIAG
• Allows use of the Extended diagnostics library functions at run time in OpenECU
applications
Either the physical system or a system simulator, is ultimately required to test and calibrate
your ECU and the system model you have created to run on it. A suitable Calibration/
reprogramming communications tool is also required conforming to the ASAP2 standard.
• MathWorks: MATLAB and Simulink (and optionally, Stateflow and Stateflow Coder):
See OpenECU Compatibility with Third Party Tools for a complete list of supported
versions.
See OpenECU Compatibility with Third Party Tools for a complete list of supported
versions.
• Wind River Diab compiler; version 5.5.1.0 (M220, M221, M250, M460 and M461); or
version 5.8.0.0 (M220, M221, M250, M460 and M461); or version 5.9.0.0 (M220, M221,
M250, M460, M461 and M670). Only the C language version is required (note, C++ is not
yet supported).
• Calibration tool: PiSnoop, ATI Vision™ (version 2.5 through 5.1.2), ETAS INCA (version
7.2.7) or Vector CANape (version 8.0 through 16.0).
Note
OpenECU developer software does not support earlier versions of Windows than XP
(SP3), Windows Vista, or Windows 8.
See the Chapter 2, Installation for full details of the software required.
Note also that there are serious hardware and personal safety considerations involved in
developing automotive control systems. Please make sure that you read and understand
the Safety and Warning section at the end of this chapter to reduce the chance of any such
hazards.
1. Design a model of your system, using Simulink library blocks, and optionally those blocks
that Pi Innovo has developed and included for the OpenECU platform. If you have
purchased a complete engine strategy suite, this will have been done for you. This process
will typically have many cycles of design and HIL (hardware-in-loop) testing.
2. Once you are satisfied that your model simulation functions within your design parameters,
the C code can be auto-generated from Simulink.
3. The C code is passed to the compiler, which generates the executable for the ECU
operating system. This is then programmed into the ECU using the Calibration Tool.
4. The ECU is then connected to either the physical system or a system simulator (e.g. Pi
AutoSim). There then follows a cycle of calibration and testing to optimise the model and
its parameters to the particular characteristics of the target system (or simulator). This may
involve returning to the Simulink model to adapt its design.
OpenECU comes with a wide range of options for customer and project support, allowing
you to draw on over 500 man-years of control system design experience. Whichever option
you choose, you can count on real commitment from Pi to provide what you need, and to
go the extra mile.
The safe operation of OpenECU is the responsibility of the those using it. The level of risk
associated with the user's application must be ascertained and appropriate mitigation devices
used to reduce the potential risks to an acceptable level. These mitigation devices may
include a system 'kill switch', driver training, backup systems and use of the vehicle in safe
environments.
• The responsibility for ensuring that the use of OpenECU is safe lies with the
customer.
• The customer will include appropriate mitigation devices as identified by the hazard
analysis they perform (such as engine kill switch, back up devices).
• The user will read all OpenECU documentation (including this document) to ensure its
safe use.
Systems, rather than software, have a Safety Integrity Level (SIL). The SIL of the customer's
resultant system will have to be assessed and defined by their knowledge of the processes
used to develop all the components (including those supplied by Pi) comprising the complete
system.
1.7.1.1. Hardware
The hardware is a production unit (see Section A.1, “ECU hardware reference
documentation” for module environmental specifications). However different applications will
have different requirements for output monitoring. Those outputs that are selected (by the
customer) to drive safety related outputs should include output monitor circuits. The use of
outputs for critical devices which do not contain a monitor feedback is strongly discouraged.
1.7.1.2. Platform
The platform comprises functionality which allows the high level strategy to operate in the
specific hardware target (electronic box). It includes:
• The operating system (RTOS) to schedule tasks, process interrupts and manage the
internal stack etc..
• The hardware drivers enabling the inputs to be read, and the outputs driven.
This suite of software is predominantly hand-coded with some additional auto-coded Simulink
models.
OpenECU has been developed using a lean SIL0 process enabling its rapid introduction to
the market place. This process included internal review, module testing and considerable
vehicle testing. It is considered to be a reliable and robust platform on which to build vehicle
control applications.
example, lead to injector 1 firing when you intended injector 2 to fire. The mis-calibration
of analogue inputs could lead to undesired behaviour such as steering angle or accelerator
pedal position to be mis-calculated.
Documented vehicle prove out tests should mitigate against this leading to severe outcomes.
1.7.1.3. Strategy
The strategy may be developed entirely by the customer, or be a development by the
customer of generic libraries supplied by Pi Innovo. In either case the integrity of the resultant
strategy model must be the responsibility of the customer.
Pi's generic libraries have been extensively validated via module testing, HIL system testing
and vehicle testing but have not undergone unit testing.
1.8. Warning
The supplied libraries have been validated for a specific application and a specific
hardware set. The user MUST validate the correct function of the strategies in their
application.
As the system designer and tester, it is your responsibility to ensure that your working
practices are specifically designed to minimise or eliminate the possibility of personal injury,
and to incorporate into your designs such fail-safe functionality as is necessary. This includes
the avoidance of certain dynamical situations such as open throttles and other 'positive
feedback' scenarios where control of the system may be lost.
1.8.2. Disclaimer
Pi Innovo makes no representation or warranties of any kind whatsoever with respect to
the contents hereof, and specifically disclaims any implied warranties of merchantability or
fitness for any particular purpose. Pi Innovo shall not be liable for any errors contained herein,
or for incidental or consequential damages in connection with the furnishing, performance or
use of the software, associated hardware, or this written material.
Pi Innovo reserves the right to revise this publication from time to time, and to make changes
in the content hereof without obligation to notify any person of such revision or changes.
A copy of the Pi Innovo Terms and Conditions of Sale is available on request, and includes
a declaration of the warranty and limitation of liability which apply to all Pi Innovo products
and services.
2.1. Introduction
This chapter describes the installation process for the OpenECU Simulink Blockset package
and its dependencies.
• GCC Compiler
Note
GCC is an optional component in the OpenECU installation (installed by default).
Additionally, GCC support is currently in a beta stage. As such, there a number of
known limitations for compiling an OpenECU application with GCC. Please see the
“Integration notes for third party tools” of the “Release notes” for a list of known issues
building with GCC for further details.
To program and calibrate an OpenECU with an application, OpenECU integrates with the
following calibration tools. Only one calibration tool is required:
• PiSnoop
• ATI VISION
• ETAS INCA
• Vector CANape
In addition, if you need to add state diagrams to the model, then you will also need:
• Stateflow (to develop state flow diagrams inside your model) Simulink Coder generates C
code from the state flow diagrams inside your model.
Simulink Coder generates C code which does not lend itself to efficient repeatable testing.
When creating a production version of your product, you may need better control of the
structure of the C code generated from the model to reduce the cost of testing the C code
against any industry standards. Under these circumstances you will also need:
To compile the generated C code (from either Simulink Coder or Embedded Coder), you will
need one of the following compilers:
To program and calibrate an OpenECU with an application, OpenECU integrates with the
following calibration tools. Only one calibration tool is required:
• PiSnoop
• ATI VISION
• ETAS INCA
• Vector CANape
• MATLAB: (see OpenECU Compatibility with Third Party Tools for a list of supported
versions)
OpenECU works with a number of other applications, but these need not be installed prior
to the OpenECU developer software.
• Stateflow: (see OpenECU Compatibility with Third Party Tools for a list of supported
versions)
• Wind River (Diab) C compiler (versions 5.5.1.0, 5.8.0.0 and 5.9.0.0) for M110, M220, M221,
M250, M460 and M461 targets
• GCC Compiler (version 4.7.3 free compiler option) for M110, M220, M250, M460, M461
and M670 targets
Note
GCC is an optional component in the OpenECU installation (installed by default)
The applications above have been listed with a version or release number. These are the
versions or releases that OpenECU has been tested against. It may be that OpenECU will
work with other versions of these applications, but it is recommended against and Pi may not
provide technical support if these versions or releases are not used.
OpenECU developer software may not function correctly on encrypted drives. OpenECU developer software must be able to
create files on the host file system. If using an encrypted drive, be sure that permission settings will allow OpenECU to create
files. Pi Innovo cannot provide support for issues with encrypted drives.
b
Mathworks Simulink Coder includes functionality of RTW and Stateflow Coder.
c
All OpenECU targets use Freescale PowerPC microcontrollers. The M110, M220, M221, M250, M460 and M461 use an
MPC5534 microcontroller, the M670 uses an MPC5674F microcontroller. The M560 and M580 use an MPC5746C for the primary
microcontroller and SPC560P34 for the secondary microcontroller.
See the Technicical Specification for your target for more information.
d
OpenECU has only been tested using GCC Compiler version 4.7.3 and is in the beta stage. As such, there are a number of
known issues to keep in mind when compiling an OpenECU application using GCC. For further details, please see "Integration
notes for third party tools" for a list of known issues.
e
These tools have been tested for reprogramming, data logging, and calibration. Some of them have many other features which
have not been tested with OpenECU.
f
The OpenECU method of configuring ATI Vision uses standardised ASAP2 files. As a result, all future versions of Vision are
expected to be backwardly compatible (e.g., version 3.7 and version 4.0 are known to be compatible).
g
The following Vision toolkits are typically used when working with OpenECU: Data Acquisition Toolkit, Calibration Toolkit,
Universal ECU Interface Standard Toolkit, APOLLO Data Analysis Toolkit, CAN Interface Toolkit and HORIZON Scripting/Remote
API Toolkit. In particular, the HORIZON Scripting/Remote API Toolkit is required if OpenECU builds are to generate Vision strategy
files (.vst).
Some third party tools have been marked deprecated and support for these tools will be
removed in a future release of OpenECU.
The installation process for the OpenECU developer software is performed by a wizard. To
run the wizard, execute the appropriate installer program. The installation can be stopped at
any point by selecting the Cancel button.
The installer requires that the user has administrative rights to make changes on the
computer. If a user without rights is trying to execute the installer a dialog box will be
displayed and the installation stops. Login with an administrator account or contact your
network administrator and try again.
If a version of an OpenECU installer is already running, a dialog box will appear saying so.
Select OK (which stops the current installer) and change to the other OpenECU installer to
continue.
If a version of MATLAB is running, a dialog box will appear saying so. Quit all instances of
MATLAB, then select OK to continue installation.
The next windows to appear present the license agreement for using OpenECU developer
software and related software. Read the license agreements and if acceptable, select I accept
the terms of the License Agreement and then Next. If not acceptable, do not install the
software.
The next window to appear provides a number of components that can be installed or
patched.
Adjust the component selection as required (especially if you require the installer to update
an installed copy of ETAS INCA) and select the Next button.
The next window asks for a destination path to be specified. By default, the installer presents
a path to your local drive.
Warning
If the default path is changed, ensure that only digits, upper and lower case letters and
the _ character are used to specify directory names. An installation path that includes
any space characters will cause problems later on.
If the MATLAB integration component was selected, the next window presented provides a
list of installed and compatible versions of MATLAB. The example here shows that OpenECU
should be integrated with MATLAB R2008b.
Select which versions of MATLAB will be used with OpenECU and select the Next button.
If no version should be updated select None.
If no compatible versions of MATLAB were found, the next window presents the command
to run to add OpenECU to MATLAB (more details given in Section 2.5.4, “MATLAB”).
If the INCA-ProF integration component was selected, the next window presented provides
a list of installed versions of INCA.
Select which versions of INCA will be used with OpenECU and select the Next button. If no
version should be updated select None.
Note
If any version of INCA is selected, then the installer will add OpenECU integration to
all versions of INCA. This is simply a consequence of the way INCA works.
If no versions of INCA were found, the next window presents details on how to achieve this
by hand (more details given in Section 2.5.7, “ETAS INCA calibration tool”). The instructions
should be carried out when INCA-ProF runs.
If the Start Menu Shortcuts component was selected, then the next window presented asks
the user to select where in the Start menu the OpenECU items will be added. During install,
the installer adds short cuts to the documentation components selected and to the OpenECU
uninstall application.
Once installation has completed, the user is provided an option to read the getting started
guide, the release notes and to visit the OpenECU web site.
Release notes
If you are installing a new version of OpenECU, it is strongly recommended that
you read the release notes. Some releases of OpenECU change the functionality of
features which may have an impact on existing applications.
This section is a quick setup guide to get OpenECU working with your license. Consult
the license administration guide for more information on license management and
administration. This document is provided with the installation at "[install path]\doc_user
\License-Administration-Guide.pdf".
2.3.1.1. Server
• After installing the platform, copy the files in "[install path]\tools\flexera\i86_n3\" to your
designated license server. On that machine, run lmtools.exe.
• Select the "System Settings tab", check "Include Domain", and press the button that says
"Save HOSTID Info to a File".
• Email the file to Pi Innovo with the purchase order. When the purchase is complete, Pi will
send you a valid license file. (Or if you have already completed the purchase, reply to the
welcome email with this information)
• It is recommended that lmadmin license server manager be used to serve licenses. Run
the lmadmin installer to install the software. Once the installation is complete, copy the
vender daemon, openecu.exe, into the install directory, "C:\Program Files (x86)\FlexNet
Publisher License Server Manager\".
• Start the license server manager. You can then use the web interface to upload the license
file and start serving your license.
Note
If a license has not yet been purchased, email the file to Pi Innovo with the purchase
order. When the purchase is complete, Pi will send a valid license file. If the purchace
has already been completed, reply to the welcome email with this information.
• It is recommended that lmadmin license server manager be used to serve licenses. Run
the lmadmin installer and start the license server manager. The web interface can then be
used to upload the license file and start serving your license.
Note
Details on installing and using the lmadmin tool are in Chapter 9 of the License
Administration Guide, "[install path]\doc_user\License-Administration-Guide.pdf".
Note
lmgrd is also provided with the platform as an alternative to lmadmin; consult Chapter
10 of the License Administration guide for details on its use.
2.3.1.2. Client
• On the user development machine, set the environment variable
OPENECU_LICENSE_FILE to <port>@<hostname>to tell the OpenECU platform to look
for a floating license from the license server.
• Select the "System Settings tab", check "Include Domain", and Press the button that says
"Save HOSTID Info to a File" (see screen shot above)
• Email the file to Pi Innovo with the purchase order. When the purchase is complete, Pi will
send you a valid license file. (Or if you have already completed the purchase, reply to the
welcome email with this information) If a license has not yet been purchased, email the
file to Pi Innovo with the purchase order. When the purchase is complete, Pi will send a
valid license file. If the purchace has already been completed, reply to the welcome email
with this information.
The uninstaller requires that the user has administrative rights to make changes on the
computer. If a user without rights is trying to execute the uninstaller a dialog box will be
displayed and the uninstaller stops. Login with an administrator account or contact your
network administrator and try again.
If a version of an OpenECU uninstaller is already running, a dialog box will appear saying
so. Select OK and change to the other OpenECU uninstaller to continue.
The uninstaller presents the location of the previous install to remove. Select the Uninstall
button to continue (this will remove that version of OpenECU) or select the Cancel button
to stop the uninstall.
When uninstalling, if this version of OpenECU is present in MATLAB's PATH, then the
uninstaller will not remove the reference. Next time MATLAB is started, it will try to gain
access to the deleted OpenECU directory and will raise an error. When this occurs, manually
remove the OpenECU directories by selecting MATLAB's menu option File->Set Path....
Note
The OpenECU uninstaller does not remove the INCA-ProF configuration files for CCP.
2.5.4. MATLAB
2.5.4.1. Integration
The installer integrates the OpenECU package with MATLAB and Simulink. However, if for
any reason the installer could not find an installed version of MATLAB, the user can manually
integrate the OpenECU blockset by issuing the following MATLAB commands:
addpath '[install path]\openecu'
addpath '[install path]\openecu\rtw\c\openecu_ert\code_templates'
addpath '[install path]\openecu\rtw\c\openecu_ert'
addpath '[install path]\openecu\rtw\c\openecu_grt'
addpath '[install path]\openecu\rtw\c\openecu_grt_rsim'
addpath '[install path]\openecu\mex_r<release>'
addpath '[install path]\openecu\mfile'
addpath '[install path]\openecu\model'
Note
where the text [install path] is replaced by the installed location of the OpenECU
blockset, e.g., c:\openecu\platform\1_9_2; and the text <release> is replaced
with the major version of MATLAB (e.g., 2013b or 2013b_64 for 64-bit versions of
MATLAB).
Once the path has been added, the user can check the OpenECU version by issuing the
following MATLAB command:
ver openecu
If nothing is printed, or an error message is returned, then the path specified by the addpath
command was incorrect and should be changed.
Warning: Model '...' was last saved using an old version (...) of Simulink.
For advice on upgrading this model to the current version of Simulink, see
the Upgrade Advisor.
> In oe_test_required_platform_vers at 26
In oe_make_rtw_hook at 153
In openecu_make_rtw_hook at 6
In general\private\openmdl at 13
In open at 159
In uiopen at 167
Workaround: Turn off the Notify when loading an old model option in Simulink's
preferences:
2.5.5. PiSnoop
2.5.5.1. Integration
Unlike some other calibration tools, during installation there is nothing special to be done
when integrating PiSnoop and OpenECU.
There have been integration issues between Vision and OpenECU, when the user
requests a build create a Vision VST (strategy) file. If OpenECU cannot create a strategy
file, then it may be necessary to register the COM interface for Vision by running the
RegisterCOMInterface.bat file included in the install of ATI Vision.
There have been reports of Vision interacting poorly with encrypted hard drives. At the
moment, it is not clear what the problem might be. On one occasion, Pi worked with ATI
and a customer and determined a work around that is not understood. The work around
was to rename the executable file for Vision to something longer than 11 characters.
ATI Vision 2006 (v3.2) is the earliest version for which CCP seed/key security has been
validated by Pi Innovo. Earlier versions may support CCP seed/key security (see the
relevant Vision documentation) but bugs in the CCP implementation on various targets
are known to exist. ATI have recommended that earlier versions should not be used, or
should be used with caution.
The INCA-ProF tool programs OpenECU over CCP using a set of configuration files. In order
to manually integrate these configuration files, the user must run INCA, open an experiment,
select manage memory then flash programming.
The user is then presented with a dialog box to browse ProF configurations, or a ProF settings
dialog box (in which case the user must select Configure...).
With the browse ProF configurations dialog box, select the "Install..." button and browse to
the install location of OpenECU:
[install path]\tools_integration\inca_prof
and select OK. This will have manually installed the INCA-ProF configuration file for
OpenECU.
Note
If manually integrating and the ProF files cannot be found in the location above, then re-
run the OpenECU installer and select the Integration -> INCA-ProF Integration option
and try again.
• On Choose your Activation Type window, select one of the following options:
• Permanent activation if you have been assigned with a license file from Wind River,
usually named WRSLicence.lic. The full path should point to the license file.
• Temporary activation if you wish to use the Wind River (Diab) compiler on an evaluation
basis, or temporary basis until a permanent license is provided.
• A reboot may be required to complete installation of the Wind River (Diab) compiler.
• If using one version of the Wind River (Diab) compiler, either setup the
OPENECU_DIAB_5_5_1_0 environment variable as described in the next point, or adjust
Window's system path to include the absolute path to the compiler's bin directory.
• If using more than one version of the Wind River (Diab) compiler (for instance, when you
are using two or more versions of OpenECU which require different versions of the Wind
River (Diab) compiler), the environment variable OPENECU_DIAB_5_5_1_0 must be set
to the absolute path to the compiler's bin directory. This macro must terminate in a “\”
and must use the DOS 8.3 short naming convention.
E.g., D:\Progra~1\diab\5_5_1_0\win32\bin\
Note
After setting the environment variable, MATLAB may need to be restarted to pick up
the new setting. If in doubt, issue the:
oe_check_compiler
The compiler incorrectly generates object code for “float <= float” comparisons, turning
the comparison into “float > float”. This issue has been resolved by removing the -
Xieee754-pedantic command line option to the compiler command line option to the
build configuration files.
The compiler incorrectly generates jump instructions in the object code if the jump
destination address differs from the address of the jump instruction by more than 15 bits
(signed). No warning or error is generated by the compiler. The result is a model which
does not behave as expected when run on target (usually the ECU appears as if it is
continually resetting).
To alert the user to this risk, an OpenECU build checks for large functions and issues a
warning message if any are found. The message takes the form:
Workaround (Simulink): RTW generates just a couple of C functions for the model, rather
than splitting major sub-systems into their own functions. Hence those functions can
become large enough to hit this compiler problem if the model is large. This can be
avoided by applying the atomic subsystem option to key subsystems in the model. RTW
generates a different C function for each atomic subsystem, where each resulting function
corresponds to just part of what would have been one large function. You should split any
large model up like this to avoid any one C function becoming large enough to hit this
compiler problem.
The compiler can generate non-existent labels such as ".L1013" when compiling code
involving large structures, such as those generated by TargetLink. The code then fails to
link because the labels are not defined. This has not yet been seen with Simulink builds
but it may possibly be seen in future.
The compiler rounds values when converting from floating point to integer, e.g. from "float"
to "signed long" (in terms of native types, otherwise known as F32 and S32 in the OpenECU
environment). For example, 3.6 as a float is rounded to 4 as an integer, but the C standard
requires that the fractional part is truncated, so a converted value of 3 would be correct.
Similarly -3.6 is rounded to -4 instead of being truncated to -3. This defect is fixed in version
5.8.0.0 of the compiler.
There has been a known issue which restricts the compiler to use Simulink lookup block.
When using Simulink lookup blocks, the Diab compiler would stop compilation with this
error message:
This has now been fixed, see F-CR 13325 in the release notes.
• Closed: compiling the main model file can take a long time.
Small models compile in a short period of time, but once the code presented to the compiler
exceeds a limit, the compiler takes a long time to compile the main model file (model-
name.c).
Workaround: the compiler sets aside an amount of memory for the compilation phase
and if the size of the model code exceeds the limit, the compilation slows down. This can
be avoided by increasing the size of the compiler's buffer using a command line option.
Add the pcomp_CompileOptions block to the model, set the mode parameter to Add
to options and set the compiler options parameter to -Xparse-size=100000. If the
compilation is still slow, increase the option value further.
• Follow the guidance given in Section 2.5.9, “Wind River (Diab) C Compiler v5.5.1.0”.
• If using a single version of the Wind River (Diab) compiler, either setup the
OPENECU_DIAB_5_8 environment variable as described in the next point, or adjust
Window's system path to include the absolute path to the compiler's bin directory.
• If using multiple versions of the Wind River (Diab) compiler (for instance, when you are
using two or more versions of OpenECU which require different versions of the Wind
River (Diab) compiler), the environment variable OPENECU_DIAB_5_8 must be set to the
absolute path to the compiler's bin directory. This macro must terminate in a “\” and must
use the DOS 8.3 short naming convention.
E.g., D:\Progra~1\diab\5_8_0_0\win32\bin\
Note
After setting the environment variable, MATLAB may need to be restarted to pick up
the new setting. If in doubt, issue the:
oe_check_compiler
There has been a known issue which restricts the compiler to use Simulink lookup block.
When using Simulink lookup blocks, the Diab compiler would stop compilation with this
error message:
This has now been fixed, see F-CR 13325 in the release notes.
• Follow the guidance given in Section 2.5.9, “Wind River (Diab) C Compiler v5.5.1.0”.
• If using a single version of the Wind River (Diab) compiler, either setup the
OPENECU_DIAB_5_9 environment variable as described in the next point, or adjust
Window's system path to include the absolute path to the compiler's bin directory.
• If using multiple versions of the Wind River (Diab) compiler (for instance, when you are
using two or more versions of OpenECU which require different versions of the Wind
River (Diab) compiler), the environment variable OPENECU_DIAB_5_9 must be set to the
absolute path to the compiler's bin directory. This macro must terminate in a “\” and must
use the DOS 8.3 short naming convention.
E.g., D:\Progra~1\diab\5_9_0_0\win32\bin\
Note
After setting the environment variable, MATLAB may need to be restarted to pick up
the new setting. If in doubt, issue the:
oe_check_compiler
There has been a known issue which restricts the compiler to use Simulink lookup block.
When using Simulink lookup blocks, the Diab compiler would stop compilation with this
error message:
This has now been fixed, see F-CR 13325 in the release notes.
The Diab 5.9.0.0 compiler generates object files that cause the Diab
ddump
command to generate the following error message during an application build.
The error appears to be benign and can be ignored. Currently, there is no known
workaround.
GCC is used with permission under the GPL Version 3. If GCC is installed with OpenECU, the
license file can be found in the [install path]\tools\gcc\ppc\docs directory of the
OpenECU install. If desired, a copy of the GCC source code can be found and downloaded
from the Pi Innovo website.
Support for GCC is currently in beta and as such, the user may run into issues which can
cause an application to fail to build or run correctly on target. Listed below are a set of known
issues when building an application using GCC. See Appendix K, Contact information for
details on how to get in contact with OpenECU support if support is needed for using GCC.
2.5.12.1. Installation
GCC is an optional component in the OpenECU installation and is installed by default.
When building a model that uses Simulink look up blocks, the compiler will emit diagnostic
messages similar to the following. These can be ignored.
• Information: GCC only supports non-VLE code. Therefore, the compiled code will be larger.
In general, GCC applications will be about 50% bigger than code generated by Diab.
• Information: The GNU linker locates data slightly differently than the Diab linker in the
final images. RAM and Flash memory utilization may be different for the same application
compiled by different compilers.
• Open: Applications built with GCC in general exhibit higher CPU loading than applications
build with Diab.
2.5.13. Python
Python is general purpose, high level interpreted programming language, distributed under
the PSF license which allows use in non open-source commercial applications. The license
can be found in the [install path]\tools\python\license.txt file.
2.5.13.1. Installation
Python is a required component of the OpenECU installation.
c:\windows\system32; or
c:\windows\syswow64
Locate the DLL referred to in the error message. The file will start with the characters “py”
and end with “.dll”. Group all Python DLLs and move them to a temporary location, then
restart OpenECU.
Temporarily moving DLLs will cause the other application to run incorrectly (and if DLLs
unrelated to Python are inadvertantly moved, then the applications that rely on those DLLs
may not run correctly). You can resolve this by returning the moved DLLs to their original
location, or possibly moving the DLLs to the location of the installed applications.
Note
The OpenECU installation of Python does not write files to the Windows directories,
or modify global registry entries relating to Python. As such, the OpenECU
installation of Python is entirely local to OpenECU and will not affect other packages.
3.1. Introduction
This chapter gives you a quick introduction to building and simulating models, and an
introduction to programming the OpenECU device.
The step1 exercise in Section 3.3, “Exercise — Step 1” describes how to incorporate the Pi
OpenECU blocks into your own Simulink designs, and how to test and calibrate your models
on the ECU. The exercise requires the following resources:
These examples can be accessed through MATLAB's launch pad or start menu. For instance,
select the launch pad, browse to the OpenECU selection and click on examples.
Or with later versions of MATLAB, run the following at MATLAB's command prompt.
oe_examples
Open the subsystem of interest and a series of blocks representing the example for at least
one ECU will appear.
Step1 completed
M461
For each example there is a block that details the loom, or how to connect OpenECU pins to
other devices to make the example work. An example or loom specification can be viewed
by double clicking or opening the appropriate block.
CANdb demo
An example which shows how the CANdb blocks (pcx_CANReceiveMessage and
pcx_CANTransmitMessage) of OpenECU can be utilised.
Extended diagnostics
An example which shows how to use the extended diagnostics library to link diagnostic
trouble code, freeze frame, in-use performance ratio and J1939 communication blocks
together.
Multi-rate demo
An example which shows how to transfer data between two portions of a model which
run at different rates. Simulink has specific rules about how to connect different rates this
and the example shows how this can be achieved.
NVM demo
An example which shows how the Adaptive Parameters (NVM) functionality of OpenECU
should be used. This includes two methods accumulating data to be stored (incremental
(2d map) or direct (array)) and the additional required blocks to commit the adapted
values to NVM.
Step1 completed
A set of completed step1 models for each ECU is available for reference (useful for just
trying OpenECU without the need to follow the detailed steps presented later).
Most examples can be run on any ECU. If you find an example but there isn't a corresponding
model for your ECU, change the ECU target as described in by the put_Identification block
and then adjust any I/O pin selections. If you need a hand, please contact us.
This exercise describes how to build, simulate and test a model that monitors a temperature
and activates a warning lamp if a temperature threshold is breached. The model uses a single
analogue input to measure the temperature, and a single PWM output to activate a 5 volt
warning lamp.
The exercise requires the OpenECU to be connected to various devices and components as
pictured in Figure 3.2, “Quick start loom”.
FEPS 17-19V, 0V
IGN Power supply
VPWR 12V DC
GND 0V
Calibration
CAN0-L, CAN0-H CAN
OpenECU 2 Tool
5V supply
Analogue input Pot Resistor
Sensor GND
LED
PWM output
By following the instructions below, you will complete the model design, test the simulation,
create compiled C code and test the model running on the ECU.
In this example, we have designed and partially modelled the system for you — you need
only finish the modelling process as described below.
Create an empty directory somewhere to store the step1 model. Start up MATLAB/
Simulink and change to that directory. Read off the part and issue numbers from the
label on your ECU. The part number is the text string beginning '01T-'. The issue number
appears immediately afterwards: it is the number before the 'm'. For example, the label
on an M250 module might read:
In this example, the part number is '01T-068276-000' and the issue number is 2. Note
that some part do not include the last three characters. Issue the following command at
MATLAB's command prompt:
oe_create_model('step1',
'dd', 'stp',
'template', 'minimal',
'part', '01T-068276-000',
'issue', 2)
This will create an OpenECU model named 'step1' with appropriate model settings as well
as a basic build list and a data dictionary using the prefix 'stp'. Replace the text string
'01T-068276-000' with the part number for your ECU, and the number 2 with the issue
number for your ECU. For more information issue the following command at MATLAB's
command prompt:
help oe_create_model
If your ECU part number does not have the final three characters, just enter what is there,
for example:
oe_create_model('step1',
'dd', 'stp',
'template', 'minimal',
'part', '01T-068276',
'issue', 2)
A new model with 'minimal' template has opened containing a single block called
put_Identification and while the model was opening, some additional text was printed to
the MATLAB command window.
Open the Library browser window and select the blocks that you will use in your model.
These blocks are:
• from the Source list: Ground;
• from the Sink list: Terminator;
• from the Math list: Constant, Relational Operator;
• from the Pi OpenECU, Input Drivers list: Analogue Input;
• from the Pi OpenECU, Output Drivers list: PWM Output;
• from the Pi OpenECU, CAN Drivers list: CAN Configuration;
• from the Pi OpenECU, Utilities list: Identification, CCP Configuration.
Connect the blocks together as shown in Figure 3.3, “Connected quick start model” (note
that the text in gray is commentary for this manual and need not be entered in your model):
put_ Identification
The analogue input block reads an input channel and The PWM output block pulses an output channel at a given frequency .
converts it to an engineering value after checking for faults . In this example , the duty_ cycle inport is set to 0 or 1 depending on the
outcome of the comparison , which forces the output to low or high without pulsing .
Note
The analogue input needs to be connected to ground and the PWM output needs to
be terminated to prevent Simulink from reporting an Unconnected Input error when
the simulation is run. The grounded inputs and outputs to and from your system only
provide simulated inputs and outputs when running in Simulink. When running on
the target ECU, these grounded inputs and outputs are ignored and the blocks read
sensors and drive actuators.
Save the model. You now have a partially complete graphical model of your design.
We still need to incorporate some design variables and parameters in some of the blocks and
interconnecting wires or signals in our model. By naming things, we can use the calibration
tool to set or inspect their values when we test the working system running on the ECU.
Variables must be named according to a system described in full in Section 5.2.5, “Naming
rules”. This system helps you to identify what type of information the variable holds, and
where it is initialised and used — very helpful in tracking down any design faults. Note that
calibratable variables of this type can only be changed on-the-fly with the development ECU
(i.e. not with the fleet ECU, which requires programming of its memory to change any variable
values).
3.3.2.1. Signals
We will use two signal variables in our design:
stp_ect
This is the value of the temperature that is output from the Analogue Input block,
representing the temperature of the engine in degrees Centigrade;
stp_ect_state
This is the result of the relational operator that calculates whether the engine temperature
is greater than the threshold temperature. It is 1 when the threshold is breached, and
0 otherwise.
Label the signals on either side of the Relational Operator block as follows:
stp_ect >
stp_ect_state
1. double-click on the appropriate signal and a text box will open beneath it;
2. type in the variable name, then click outside the box to complete.
1. double-click on the Constant block that leads into the lower of the two Relational Operator
inputs. A dialogue box appears.
2. click in the Value box, and instead of entering a numerical value, enter the variable name
stpc_ect_limit. This now references a MATLAB workspace variable (which we will
create further on).
You will also need to set a single constant used in the model:
3. double-click the Constant block that leads into the fault_value inport of the PWM Output
block. A dialogue box appears.
4. click in the Value box and enter boolean(0). This instructs the PWM Output block that
there are no faults in the system.
Block parameters are set by double-clicking on the block and entering appropriate values in
the various parameter fields that are displayed. Some parameters may only take on certain
values, in which case the text field is replaced by a drop-down list, from which you can select
the appropriate value.
Set the block mask parameters as the figure shows. A full description of the block mask
parameters is given later on Section 6.1.63, “Model identification (put_Identification)”, but a
summary of the items and their meaning is given here for this example.
Note
It is essential to include a put_Identification block in all OpenECU top level models. If
this block is not present, the model will not work as documented.
Set the block mask parameters as the figure shows. A full description of the block mask
parameters is given later in Section 6.1.13, “CAN configuration (pcx_CANConfiguration)”,
but a summary of the items and their meaning is given here for this example.
Set the block mask parameters as the figure shows. A full description of the block mask
parameters is given later in Section 6.1.19, “CCP configuration (pcp_CCPConfiguration)”,
but a summary of the items and their meaning is given here for this example.
Set the block mask parameters as the figure shows. A full description of the block mask
parameters is given later on Section 6.1.6, “Analogue input — processed (pai_AnalogInput)”,
but a summary of the items and their meaning is given here for this example.
The transfer function allows for non-linear conversion but must adhere to the same
restrictions as the put_Calmap1d block (e.g., regarding axis monotonicity). The transfer
function from the analogue input block data above in Figure 3.4, “Analogue input transfer
function”.
Set the block mask parameters as the figure shows. A full description of the block
mask parameters is given later on Section 6.1.84, “PWM output — fixed frequency
(pdx_PWMOutput)”, but a summary of the items and their meaning is given here for this
example.
This example uses a PWM output to drive an output either fully on (100% duty-cycle) or fully
off (0% duty-cycle). A digital output block Section 6.1.43, “Digital output (pdx_DigitalOutput)”
could have been used instead and is the more logical choice for this example. However, the
example uses a PWM output block to show that different outputs can be used in equivalent
ways.
Version: 1.0.0
CCP enabled : on
ECU type: M 250 Bit Rate : 500 kBps
ECU part number : 01T - 068276 -000 Bus ID: CAN 1 ( pin A29+A 44)
pcp_ CCPConfiguration
Issue number: 2
pcx_ CANConfiguration2
Copyright : 2012 , Pi Innovo .
put_ Identification
The analogue input block reads an input channel and The PWM output block pulses an output channel at a given frequency .
converts it to an engineering value after checking for faults . In this example , the duty_ cycle inport is set to 0 or 1 depending on the
outcome of the comparison , which forces the output to low or high without pulsing .
So far, you have populated the model with a number of Simulink and OpenECU blocks,
defined some behaviour by linking the blocks together to interact and now need to provide
the framework around the model to allow it to be built and run on an OpenECU device.
Data dictionary
A text file which holds information about the variables you have set up in your design
model that you will want to inspect on the physical system with the calibration tool. We
created three variables in this model, whose initial conditions, ranges and types must be
recorded in the data dictionary;
Draft versions of these resource files were created by the oe_create_model command.
1. Use your spreadsheet application or text-editing application to open the file called
stp_dd.txt in the directory called stp in the directory you created at the start of this
exercise.
The file has three lines — the top line always contains the column labels for reference, and
the other two lines contain dummy variables to be replaced by variables from our model.
2. Copy and paste the line that starts with stp_dummy so that the file looks like:
Then change each line, making sure not to delete or add any TAB characters, so that
the file looks like:
3. Save the file — if you're using a spreadsheet application to edit the data dictionary file,
save in a tab-delimited text format.
oe_read_build_list
which deletes the dummy workspace variables and replaces them with the set of variables
entered into the stp_dd.txt file. If any errors or warnings are displayed, go back and
edit the file until it matches the above (a complete list of error and warning messages are
given in Appendix H, Data dictionary tool errors).
Once read without errors, the workspace will have been updated and look something like:
5. Optionally, in R2015a and later, a Simulink based data dictionary can be used in place of
a text based data dictionary by issuing the following command, at MATLAB's command
prompt:
oe_config_using_sim_dd
This will convert the text based data dictionary to a Simulink data dictionary which can
then be edited within Simulink in Model Explorer.
More detailed information on the structure of the data dictionary can be found in
Section 4.2.2.2, “Data dictionary files”.
To update the model (right click on the background and select the Update diagram menu
item). Your model should now look like Figure 3.6, “Updated quick start model”.
Version: 1.0.0
CCP enabled : on
ECU type: M 250 Bit Rate : 500 kBps
ECU part number : 01T - 068276 -000 Bus ID: CAN 1 ( pin A29+A 44)
pcp_ CCPConfiguration
Issue number: 2
pcx_ CANConfiguration2
Copyright : 2012 , Pi Innovo .
put_ Identification
The analogue input block reads an input channel and The PWM output block pulses an output channel at a given frequency .
converts it to an engineering value after checking for faults . In this example , the duty_ cycle inport is set to 0 or 1 depending on the
outcome of the comparison , which forces the output to low or high without pulsing .
Library links
Each of the OpenECU blocks has a small icon of an arrow in the bottom left hand corner
of the block display. This indicates that the block on the screen is a reference to the
OpenECU library.
It is possible to break the library links but its very important that OpenECU blocks remain
as library links. When they remain as library links, when the OpenECU software is
updated, linked blocks are updated as well. If the link were broken, then the OpenECU
software is updated, the unlinked block remains at the older version of OpenECU.
Warning
Mixing versions of OpenECU blocks in a model may lead to undefined results when
the model is simulated or run on the target.
The colouring is a very useful indicator of related tasks and helps the model designer
break up the functionality between rates. As much as possible, functionality should be
placed at the slowest rate possible to ensure that as much computing power on the ECU
is made available.
Vectors of signals
The analogue input block shows a vector of outputs as a thick line with the number 5
written beside it. This means the vector contains 5 elements. More information about
each of those elements can be found in Section 6.1.6, “Analogue input — processed
(pai_AnalogInput)”.
Of course, for this example, you cannot change the behaviour of the simulation as it runs. In
order to do this, you can replace the ground input to the pai_AnalogInput block with a signal
generator and attach scopes to the signals to view during the simulation.
the model, and either pressing CTRL-B or selecting the menu option Tools -> Real-Time
Workshop -> Build Model. This instructs RTW to generate C code from the model and to
invoke OpenECU's template makefile to compile the C code.
The result of a successful build produces a number of files in the same directory as the step1
model:
• step1_tool_generic.a2l — the generic ASAP2 file for the build model (includes details
about the stp signals amongst other things);
• step1_tool_inca.a2l — the ETAS INCA specific ASAP2 file for the build model;
• step1_tool_vision.a2l — the ATI Vision specific ASAP2 file for the build model;
• step1_tool_canape.a2l — the Vector CANape specific ASAP2 file for the build model;
• step1_tool_vision.vst — the ATI Vision Strategy file for the build model (combined
ASAP2 and S-record files — only generated if a compatible version of ATI Vision is
installed);
• step1.a2l.err — any errors that resulted from creating the ASAP2 file (if there are any
errors, a short extract is displayed at the end of the build);
• step1_image_small.s37 — the image bytes to program into the OpenECU in Motorola S-
record format (small representing the minimum amount of code and data bytes to program
the OpenECU device) — suitable for the ATI Vision calibration tool;
• step1_image_small.hex — the image bytes to program into the OpenECU in Intel HEX
format — suitable for the Vector CANape and ETAS INCA calibration tool;
• step1.elf — the compiler's version of some of the above files — suitable for the PiSnoop
development tool;
• step1.snx — lists of variables PiSnoop will show or hide automatically — suitable for the
PiSnoop development tool;
If the build fails for any reason, go back through the stages of the example and identify any
corrections, or look at the installed and completed step1 model to identify any differences.
At a minimum, the OpenECU device will need to be powered and be connected to the CCP
tool over CAN as shown in the following diagram.
FEPS 17-19V, 0V
IGN Power supply
VPWR 12V DC
OpenECU GND 0V
Calibration
CAN0-L, CAN0-H CAN
2 Tool
1. Apply a positive FEPS voltage, as given in the following table and then power cycle the
ECU (the FEPS signal may not be detected if applied simultaneously with the ECU power).
Upon detecting the FEPS signal the ECU is placed into its reprogramming mode, where
it does not run the application and responds only to reprogramming commands.
3. Once programmed, ground the FEPS pin and power cycle the ECU. This places the ECU
in its application mode, where the ECU runs the programmed application.
This chapter provides an overview of OpenECU developer software in more depth than the
quick start covered in Chapter 3, Quick start. From this chapter, you will:
• Understand how to interact with the different Simulink coders through configuration sets,
as well as what features of Simulink are not supported by OpenECU.
• Understand the different system modes an ECU select, including the different software
components that make up the ECU's firmware.
To find out if OpenECU was successfully installed, type the following command at the
MATLAB prompt:
ver openecu
and MATLAB will display the version of OpenECU installed. A correct response will look
something like:
Note
The ver command is a MATLAB standard command. OpenECU integrates with a small
number of these commands, see Table 4.1, “Standard MATLAB commands”.
The functionality of OpenECU is split into various components (e.g., angular, input, output)
and documented in Section 4.6, “OpenECU blockset features”. The blocks can be dragged
from the library browser to a model.
Note
If too much information is displayed at once when using these commands, the display
can be broken into pages by executing the command:
more on
Create
model
Update
model
Simulate
model
Build
model
Program
ECU
6
Test
model
1. Create model — using the oe_create_model script will create a basic model containing
essential OpenECU blocks and will create a data dictionary. How to use this script and
what a data dictionary is, is described in more detail in Section 4.2.2, “Create model”.
2. Update model — by adding to the model's logic and algorithms, or amend what is already
there with feedback from simulating or testing the model. Some tips on model structure
can be found in Section 4.2.3, “Update model”.
3. Simulate model — on the PC using Simulink's simulation feature to quickly check the
overall functionality of the model without having to power up an ECU. Sometimes its
necessary or simply quicker to skip the simulation stage and try the model out on an
ECU. While simulation can help spot problems before running the model on an ECU, it is
essential to test the model on the ECU to confirm correct behaviour. Simulation is covered
in Section 4.2.4, “Simulate model”.
4. Build model — to create the files necessary to program an ECU with the model. Building
the model is taken care of by a combination of Simulink and OpenECU — there are no
manual steps to creating the ECU files, except to start a model build. An overview of how to
start a model build is given in Section 4.2.5, “Build model” and the automatic build process
and outputs are detailed in a later section, Section 4.3.6, “Building a model”.
5. Program ECU — to place the built model onto an ECU ready to run. Typically,
programming an ECU involves the use of a calibration tool and OpenECU is compatible
with ATI Vision, Vector CANape and ETAS INCA. Programming an ECU is covered in
detail in Section 4.5, “Programming an ECU”.
6. Test model — to determine if the model logic and algorithms perform adequately
and provide any feedback to update the model. Some tips on testing can be found in
Section 4.2.7, “Test model”.
Units file
An optional text file which lists the allowable units used to describe
named parameters and signals in the model. The units file is covered in
Section 4.2.2.3, “Units file”.
Note
Simulink Data Dictionaries are supported in R2015a and later.
4.2.2.1. Model
An OpenECU model can be created by:
Where the text [model-name] is replaced by the name to be given to the model, the
text [dd-name] is replaced by the name of the data dictionary and the text [part-
number] is replaced by the part number of the target (e.g., 01T-068144-000 for the
M460-000). The command opens a new Simulink model, creates a basic build list and
data dictionary file, adds put_Identification block to configure the ECU.
The model parameters are important to the correct working of OpenECU models and
are discussed in a little more detail in the following sections.
The procedure above uses a default name for the data dictionary and a default version of
hardware but these can be specified when creating the model.
where [dd_name] is replaced by the name of the data dictionary (e.g., the step1 model
from Section 3.3, “Exercise — Step 1” uses a data dictionary named stp) and where [part-
number] is replaced by the part-number of the target (see Section 6.1.63, “Model identification
(put_Identification)”). For more details, issue this command at MATLAB's command window:
help oe_create_model
The oe_create_model command will not be able to create a new model when it cannot
understand some of the parameters given to it or if it cannot access the file system (e.g., if
the file cannot be written or the file system is full).
If an error does occur when creating the model, once the problem that caused the error has
been resolved, it is best to remove the intermediate set of files that the oe_create_model
command generated, before issuing the command a second time.
Note that non-ASCII characters appearing in the data dictionary may not be interpreted
correctly by the calibration tool reading the resultant ASAP2 files, since different calibration
tools use different extended encoding conventions. It is best therefore to stick to ASCII
characters within the data dictionary.
Each data dictionary file is stored in a directory of the same name. Given the example of the
model read_sensor above, then there would be two directories named min and mot:
Each data dictionary file stored in each of those directories must be named data
dictionary name_dd.txt. Given the example of the model read_sensor above,
then there would be two files named min_dd.txt and mot_dd.txt in the corresponding
directories:
Each data dictionary follows a simple format, separated into columns and will look something
like:
To help readability, comment lines can be inserted into a data dictionary file. Comment lines
are ignored and start with either a ** or the -- character sequence. For example:
Each column has a heading, followed by as many data dictionary entries as necessary. Each
column is separated by a TAB character and because of this, Excel is a very useful tool for
editing the files (in Excel, save the file as Text (tab delimited) *.txt).
Column Description
Max The maximum expected value for this data dictionary entry.
Scale This column is optional. It specifies the amount by which the displayed
value will be scaled from the raw value read from the ECU.
Offset This column is optional. It specifies the amount by which the displayed
value will be offset from the raw value read from the ECU.
Enums A comma separated list of data dictionary entries which provide the
possible values this data dictionary entry can be. This column is
optional.
Defn This column is optional. It specifies the file in which the equivalent C
variable for the DDE will be defined. Only applicable when using RTW
Embedded Coder, the column is ignored for other auto-coders.
Decl This column is optional. It specifies the file in which the equivalent C
variable for the DDE will be declared. Only applicable when using RTW
Embedded Coder, the column is ignored for other auto-coders.
Lookup Reserved for future use, do not use.
Group Reserved for future use, do not use.
Rate Reserved for future use, do not use.
An example of how the data dictionary can be used to name model signals, model
constants and map look-ups is given below. Each entry follows the naming convention laid
out in (Section 5.2.5, “Naming rules”). Explore the OpenECU demos for more examples
(Section 3.2, “Installed examples”).
Instead of using values to represent discrete states, enumerations can be used instead.
These represent the discrete states using a textual name rather than a number. For instance,
in the following example, moi_state can have two enumerations: MOI_RUNNING which
represents the value 0 and MOI_STOPPED which represents the value 1. It is easier to
understand and interpret the enumerations than the values.
When a model is loaded, each data dictionary entry is checked for errors. A complete list
of checks is given in Appendix H, Data dictionary tool errors. If any errors or warnings are
displayed, go back and edit the file to remove the errors.
Note
When a data dictionary is changed OpenECU does not automatically read the file.
Instead, the user must read the data dictionaries by running the command:
oe_read_build_list
at MATLAB's prompt.
In R2015a and later, a Simulink based data dictionary file with an extension of .sldd can
be used with OpenECU. This type of data dictionary holds the same information as a text
based data dictionary, only the data is stored in oe.Parameter and oe.Signal objects in
the data dictionary file from within Simulink, instead of externally in text files. This file can be
edited manually from within Simulink using the Model Explorer interface, or programmatically
in Simulink using the Simulink.data.dictionary class and API.
The data dictionary file is specified in the Model Properties dialog box of the model File->
Model Properties-> Model Properties under the Data tab, as shown in the image below.
The data dictionary file can be viewed or edited by clicking the icon in the bottom left hand
corner of the model once it has been configured to use a data dictionary, as shown below.
The data dictionary file is then edited in Model Explorer Tools-> Model Explorer, as shown
below.
To add a new oe.Parameter or oe.Signal object to the data dictionary select Add->
Add Custom... from the Model Explorer menu, and in the dialog box, specify the name of
the variable and the class of the variable (either oe.Parameter or oe.Signal), as shown
below.
With a Simulink data dictionary, in order to make each variable available in a calibration tool,
the variable must have certain properties set in order to control the storage of that variable.
The properties must be set differently depending on the auto-coder used (see Section 4.3.2,
“Auto-coders” for more details about auto-coders), and the desired type and scope of the
variable.
The following table details the desired variable type in the model or calibration tool, and the
data object and properties required for each auto-coder which must be set to generate that
variable in the model and make available in the calibration tool:
Arrays
Displayable GRT oe.Signal name
signals RTMODEL .CoderInfo
.StorageClass = 'ExportedGlobal'
Calibration EC oe.Parameter name
scalars .CoderInfo
.StorageClass = 'Custom'
Calibration
maps (1d name
or 2d), or .CoderInfo
.CustomStorageClass = 'Global'
Arrays
name
.CoderInfo
.CustomAttributes
.MemorySection = 'Calibration'
Displayable EC oe.Signal name
signals .CoderInfo
.StorageClass = 'Custom'
name
.CoderInfo
.CustomStorageClass = 'Global'
name
.CoderInfo
.CustomAttributes
.MemorySection = 'Displayable'
Note
In the Model Explorer interface, the name.CoderInfo.StorageClass, and
name.CoderInfo.CustomStorageClass, properties are normally merged into the
same drop down selection field. The 'Global (Custom)' selection will select both
name.CoderInfo.StorageClass = 'Custom' and name.CoderInfo.CustomStorageClass
= 'Global' at the same time.
Note
The oe.Signal and oe.Parameter object classes are derived from the native
Simulink.Signal and Simulink.Parameter classes and are designed to better
A model configured to use a text based data dictionary can be automatically converted to
use a Simulink data dictionary with all of the existing data dictionary entries imported into
the .sldd file by calling the following command:
oe_config_using_sim_dd
By default, the script will convert the currently active model, using the data dictionary file
name model-name.sldd. If the data dictionary file already exists it can be overwritten with
additional parameters. See details at oe_config_using_sim_dd.
In addition to the previously mentioned data dictionary variables, additional data can also be
stored in a Simulink data dictionary file, such as Simulink.Bus objects, Simulink enum type
definitions, Configuration Sets, and other built-in Simulink types. Please refer to the Simulink
documentation for further details on the data that can be stored in a Simulink data dictionary
file.
A units file is stored in the same directory as the model. A units file for a model must
have the file-name model-name_units.txt where model-name is replaced by the name
of the model. An example units file for a model named read_sensor would be named
read_sensor_units.txt and might look like:
degC
kPa
In this example, only two units: degC or kPa, can be used for each data dictionary entry.
To help readability, comment lines can be inserted into the units file. Comment lines are
ignored and start with either a ** or the -- character sequence. For example:
A build list file for a model must have the file-name model-name_bl.m where model-
name is replaced by the name of the model. An example build list file for a model named
read_sensor would be named read_sensor_bl.m and would like very similar to:
feature_list = [{'min',
'mot'}];
In this example, the build list defines two data dictionary files, named min and mot. Further
data dictionary files can be added by extending the vector feature_list. It is important to
use three characters for each data dictionary name.
If a model is configured to use a Simulink data dictionary, the build list file will only list the
feature directories which are to be added to the MATLAB path. The data dictionary files are
specified within the model properties.
Before Simulink starts to simulate a model on the host PC, or builds a model to run on an ECU,
Simulink attempts to solve the model and applies consistency checks during the solving. This
process is called a diagram update. A diagram update can be performed at any point by
pressing CTRL+D in a model window, or by selecting the Edit -> Update diagram.
Note
It is useful to periodically update the model diagram to check that everything has been
accounted for. However, Simulink does not provide a mechanism for OpenECU to
ensure the text based data dictionary files have been incorporated into the model.
Therefore, if the data dictionary files have been updated, prior to a diagram update,
the user must issue the following command:
oe_read_build_list
at MATLAB's command prompt to ask OpenECU to read the data dictionary files.
Simulink provides a Model Explorer tool which makes it easy to navigate between parts of
the model based on the hierarchy of the subsystems. And OpenECU can incorporate the
model hierarchy into the files used to communicate with the ECU while the ECU is running
the model.
For instance, at a top level, a useful pattern to follow breaks the model into an input, output
and application subsystem.
Figure 4.6. Breaking the input and output processing from the
application
Input processing
The input subsystem reads sensor and actuator feedback signals
and decodes communication messages, transforming raw sensor
information into engineering units (possibly applying filters and other
validation techniques to ensure the input data is usable). The input
subsystem can be broken down into further subsystems, perhaps one to
read the raw sensor information, one to process into engineering units,
and one to validate the inputs (perhaps against other sensor inputs or
against a plant model of the system under control).
Application processing
The model subsystem processes the input subsystem data, determining
how the system it is controlling should react. The model subsystem
would be further broken down into smaller subsystems, each performing
a small portion of the overall functionality. The model subsystem creates
the data in engineering units necessary to drive the output subsystem.
Output processing
The output subsystem drives the actuators connected to the ECU to
achieve the demands of the model subsystem.
By breaking the model into these subsystems, the input and output subsystems can easily
be replaced when targeting another ECU. For instance, when moving to a more powerful
ECU because the application has grown, or when moving to a less powerful ECU because
the production needs for the prototyped application mean a cheaper ECU can be used.
To start a build, press CTRL+B in a model window, or select the menu option Tools -> Real-
Time Workshop -> Build model.
Detail on the build process, the generated build files and a summary of common issues can
be found in Section 4.3.6, “Building a model”.
At a minimum, the OpenECU device will need to be powered and be connected to the CCP
tool over CAN as shown in the following diagram.
FEPS 17-19V, 0V
IGN Power supply
VPWR 12V DC
OpenECU GND 0V
Calibration
CAN0-L, CAN0-H CAN
2 Tool
1. Apply a positive FEPS voltage, as given in the following table and then power cycle the
ECU (the FEPS signal may not be detected if applied simultaneously with the ECU power).
Upon detecting the FEPS signal the ECU is placed into its reprogramming mode, where
it does not run the application and responds only to reprogramming commands.
3. Once programmed, ground the FEPS pin and power cycle the ECU. This places the ECU
in its application mode, where the ECU runs the programmed application.
The testing phase seeks to ensure that the built Simulink model acts as expected under
all circumstances. OpenECU provides a CCP interface to allow calibration tools to access
model information. See Appendix B, Supporting tools for an introduction to how to use one
of the supported calibration tools to monitor the model while it runs on the ECU.
The OpenECU blockset works with most Simulink and RTW features. However, there are
a small number of restrictions. For instance, the OpenECU blockset is a discrete blockset
and does not work with continuous time blocks. See Section 4.3.1, “Block use restrictions”
for details.
The OpenECU blockset provides a number of additional RTW options. These options include
setting the application stack size, controlling what binary files are created at the end of a
build, through to selecting which compiler to use. See Section 4.3.4, “Configuration options”
for details.
The OpenECU blockset works with RTW's auto-coders: Generic Real-Time (GRT) and
Embedded Coder (EC). The blockset provides mechanisms to create configuration sets
(which are sets of parameters which tell RTW how to generate code) for each of the
auto-coders, and some utility blocks to quickly switch between configuration sets. See
Section 4.3.2, “Auto-coders” for details.
Note that inlined S-functions are supported, see Section C.2, “Custom
C code” for more.
4.3.2. Auto-coders
Simulink Coder (formerly Real-Time Workshop) provides a number of different auto-coders,
each with increasing levels of functionality:
Embedded Coder
The EC auto-coder is available with a license of Embedded Coder (or
Real-Time Workshop Embedded Coder). This license is separate from
the Simulink Coder license.
See OpenECU Compatibility with Third Party Tools for a complete list of supported coder
versions.
OpenECU provides a collection of configuration sets to select between each of these auto-
coders.
The picture in Figure 4.7, “Simulink's Model Explorer showing OpenECU configuration sets”
shows an OpenECU configuration set for each of the auto-coders described in Section 4.3.2,
“Auto-coders”. Only one configuration set is used at any time and Simulink shows this by
marking it active (in this case, the GRT RTMODEL auto-coder is active).
Each of the components is listed in the middle pane. Selecting any of the components shows
the component options in the right hand pane. Although it is possible to modify these options,
it is recommended that models keep the original OpenECU settings.
Under the Real-Time Workshop (or Code Generation in later versions of Simulink)
categories, there are both built-in Simulink options, and OpenECU additional options.
• Interface
Interface
The OpenECU build process will recognize the "ASAP2" setting for this parameter.
This option will set the parameter 'GenerateASAP2' to 'on', and during the build
process, an ASAP2 file will be generated using Simulink's built-in ASAP2 generation
process in place of the OpenECU ASAP2 generation process.
The OpenECU additional options are grouped into the following categories:
This group of options affects the model generated code before it is built.
This option is deprecated and should not be used in preference to the TDC-firing
function-call trigger outport from the pan_EngineConfig block. This option is retained
for backwards compatibility and will be removed in a future version of the blockset.
This group of options affects what images are generated at the end of a build. An image
is downloaded or flashed onto the ECU to run on target.
If not selected, the Vision strategy file is not produced (or is deleted if it previously
existed).
If not selected, the OpenECU build process will stop when there is a failure to generate
an ATI Vision strategy file.
This group of options affects the ASAP2 generated file (and the ATI Vision Strategy file
if selected).
Data dictionary names take the form prefix_name (as detailed in Section 5.2.5,
“Naming rules”) and are used for each ASAP2 entry. Some calibration tools can group
names together based on the prefix (for instance, ATI Vision's Structure naming:
Names as groups import feature). This feature converts the data dictionary names
before inserting them into the ASAP2 file to match tool features.
If not selected, the generic file is not produced (or deleted if it previously existed).
Note
If the Generate ATI Vision Strategy file option is selected, this option need not
be selected.
For instance, if a DDE is declared as having 4 elements but the workspace is modified
to have 5 elements after the build list has been read, then if this option is selected,
a build will generate an ASAP2 file which specifies 5 elements for that DDE. If this
option is not selected, a build will generate an ASAP2 file which specifies 4 elements
for that DDE.
Note
This feature requires that the RTW option Re-read build list before building is not
selected. If it is selected, then at the start of a build, OpenECU will re-read the
build list DDE files, overwriting any changes made to the equivalent workspace
variables.
This group of options selects between the available supported compiler versions for
OpenECU models.
Compiler
Which compiler to use to build an OpenECU model. The compiler and linker options
can be adjusted using the pcomp_CompileOptions and pcomp_LinkOptions blocks.
This group of options is used for model reference only in Embedded Coder. It is ignored
in all other auto-coders.
ECU type
Specifies the ECU that the model will run on (e.g. M250, M460, etc.). This field is used
only for model reference targets. For all other models use the put_Identification block
in your model. The put_Identification block will automatically make changes to this field
when present in the model.
Part number
Specifies the part number that appears on the ECU casing, followed by a hyphen and
three character suffix. The suffix denotes the option. The part number must match the
ECU type field (e.g. M250 option 000 = 01T-068276-000). This field is used only for
model reference targets. For all other models use the put_Identification block in your
model. The put_Identification block will automatically make changes to this field when
present in the model.
Issue number
Specifies the issue or revision number of the ECU. This is the first number that appears
after the hardware part number on the label of the ECU. This field is used only for
model reference targets. For all other models use the put_Identification block in your
model. The put_Identification block will automatically make changes to this field when
present in the model.
This group of options affects the data dictionary used for building and simulating a model.
This group of options affects the checksums that are applied to the application and
calibration data.
Checksum Type
Specifies checksum type. This checksum is calculated at build time and stored as
part of the binary image. It is compared with another checksum that is calculated on
the ECU during startup. If the checksums do not match, then the application is not
permitted to run. The CRC checksum is more likely to detect errors than the IPv4 style
checksum, but it takes significantly longer for the ECU to calculate during initialization.
Checksum Regions
Specifies regions to checksum. If this is set to include the calibration, then care must
be taken when using calibration tools. The tools will be able to modify calibrations, but
once the modifications are flashed the checksum will be invalidated and the application
will not be permitted to run.
The helper blocks perform a couple of actions which the Model Explorer won't.
• The helper blocks will create an appropriate configuration set if one isn't available. This
can be useful if a configuration set has been accidentally removed, or if more than one
configuration set for the same auto-coder is required (perhaps to experiment with RTW
options for that auto-coder).
• The helper blocks will read the build list and populate the workspace with DDEs. This
occurs because the EC auto-coder requires the workspace variables to have different types
from the GRT auto-coders. See Section 4.3.5.2, “Using the EC auto-coder” for more.
Note
Note that there is a prtw_Build helper block which starts a model build when double
clicked.
There is little about this auto-coder and OpenECU which is configurable. Its worth noting that
the data dictionary elements are available in the workspace using basic MATLAB types. The
data dictionary elements can be used as any other MATLAB variable in scripts and general
calculations.
To access the value for a parameter, use the expression [variable-name].Value. There
is no value for signals stored in MATLAB's workspace.
It can be useful to switch between the EC auto-coder and other auto-coders using the
OpenECU utility blocks. When switching to a GRT auto-coder, the data dictionary is read
into the workspace using MATLAB's basic types, and can be accessed like other MATLAB
variables.
This ensures that the model code and library code match when linked together, and can also
help when checking code compliance against various coding standards (e.g., with MISRA-
C, Guidelines for the use of the C language in critical systems).
If alternative templates are required then modify the configuration set for Embedded Coder
to point to alternative files. But note that each time the OpenECU Embedded Coder
configuration set is created, the templates will need to be modified again.
Note
The model can be broken into source files using subsystems. Functionality contained
in a subsystem, which has a Real-Time Workshop system code set to Function, can
specify the file into which the functionality of the subsystem is auto-coded.
OpenECU uses Embedded Coder's Data Placement feature to provide a mechanism to place
declarations and definitions of C variables in specific files.
By default, declarations and definitions are placed in globals.h and globals.c, but these
settings can be overridden by changing the name in the configuration set. But note that each
time the OpenECU Embedded Coder configuration set is created, the data placement files
will need to be modified again.
Variables can also be placed in specific files by specifying the file to use in the data dictionary,
under the decl and defn columns. See Table 4.2, “Data dictionary columns” for more.
Data OpenECU
Simulink
dictionary blockset
model
files
2
Intermediate build steps
Linker
script
files
Object
files
MAP ELF
file file
5 4
Target Target
ASAP2 image
file file
Simulink model
The application in model form. There are some restrictions on what the
model can contain, see Section 4.3.1, “Block use restrictions”.
Simulink blockset
Supporting Simulink blocks which provide direct access to the ECU's
functionality. OpenECU software provides the Simulink blockset. An
overview of the blockset is given in Section 4.6, “OpenECU blockset
features”.
1. Runs RTW to generate C code from the Simulink model and DDEs. The
generated C code includes the implementation of the model logic and
any necessary code to bind the model with the OpenECU and compiler
libraries.
2. Runs the compiler for the application code files. The compiler generates
object files used in the link stage.
3. Runs the linker to combine the object files from the application and
interface tool, as well as the compiler's library and OpenECU libraries, to
generate an ELF file.
4. Runs support tools and scripts to extract a binary image of the application
from the ELF file. At this stage, the binary image is modified with check-
sums and auxiliary data to support robust operation on the ECU.
5. Runs support tools and scripts to generate an ASAP2 file from the target
and DDE information. The ASAP2 file is used during reprogramming and
calibration of the ECU.
From those intermediate steps, the final set of objects are created:
To build the executable code for the ECU, select the model window so it becomes focused
then press CTRL+B to start the RTW build. Alternatively, place a prtw_Build block in the model
and double click the block.
The build process starts by re-reading the build list to ensure the latest DDE information is
present when generating the ASAP2 file.
### Starting Real-Time Workshop build procedure (with modification for OpenECU) for model:
Clearing any previously loaded build list...
Obtaining workspace data from each feature data dictionary...
Workspace variables loaded
The build then continues with the standard RTW build mechanism with a few additions for
OpenECU. In some earlier versions of RTW, if this is the first time the model has been built,
the build creates the RTW library which can take some minutes to complete. Subsequent
builds of the same model skip this part of the build.
In MATLAB versions r2014b and later messages will be logged to The Diagnostic viewer
window. This window can be viewed by clicking the link at the bottom of the model window.
where the text model_name denotes the name of your .mdl model file. Each of these files
can be found in the same directory as your model file.
Note
A subset of these files can be produced by altering the OpenECU RTW options
(accessed by opening an OpenECU model and selecting the menu option
Simulation -> Simulation parameters... then browsing to the OpenECU
options under Real-Time Workshop. More details on these settings are given in
Section 4.3.4, “Configuration options”.
One of the ASAP2 files and one of the image files can now be used with a calibration tool
to program the ECU via CCP (or if you are using a recent version of ATI Vision, you can
simply use the strategy file).
Also at the end of a successful build, a short summary of the memory used by the model is
displayed. It looks a little like:
Strategy memory:
142696 bytes of strategy/code memory used
250519 bytes remaining
Calibration memory:
3376 bytes of calibration memory used (rough indication, includes Simulink support data)
258767 bytes remaining
Workspace memory:
14040 bytes of workspace/displayable memory used, including
176 bytes of adaptive data, and
2 bytes of diagnostic trouble code data, and
8192 bytes of model stack
24008 bytes remaining
Built at: 2005, 08, 02 (year, month, day) 10:52:47 (hour:min:sec)
Strategy memory
Shows the amount of model code used and remaining.
Calibration memory
Shows the amount of calibration data (as well as Simulink support data)
used and remaining.
Workspace memory
Shows the amount of used and remaining RAM, where RAM is used
for general model calculations and signals, adaptive data and overall
program stack.
As your model develops, it is useful to take regular snap shots of the memory usage to
determine how quickly development is using up memory (and the same can be done by taking
regular snap shots of the ASAP2 variables mpl_cpu_loaded and mpl_max_used_stack
to determine how quickly development is using up CPU resources).
In order for the Diab compiler to run, the compiler must be installed
and the the path to the compiler must be specified in one of two
environment variables. See the instructions provided in the installation
guide, Section 2.5, “Integration notes for third party tools”.
In order for the Diab compiler to run, it must have access to a valid
license. The Diab compiler license is created by WindRiver after you
purchase the compiler. If you run into trouble with your Diab compiler
license, please contact OpenECU technical support and we will try to
help out.
The ECU has various memory spaces of finite size. If the model
becomes too large to fit into these memory spaces, then the Diab linker
will raise an error. It may be possible to optimise the build to reduce the
final model size. Please contact OpenECU technical support and we will
try to help out.
Boot mode
Bootloader
Library
Reprogrammer
Application
Boot mode
Boot mode starts after reset, performs some tests and, if successful,
determines what mode to enter (see Section 4.4.1, “Boot mode”).
Reprogramming mode
Reprogramming mode is entered if the FEPS pin is asserted before the
ECU is powered up, if there is an invalid application image in memory,
or for certain targets if the ECU is running the application and allowing
reprogramming while a reprogramming request is received (FEPS-less)
(see Section 4.4.2, “Reprogramming mode”).
Application mode
Application mode is entered if the FEPS pin is not asserted and if there
is a valid application image in memory (see Section 4.4.3, “Application
mode”).
• Tests on memory devices, looking for hard faults such as shorts on address lines, or
memory locations which cannot hold their contents;
• Tests on the code to run, looking for hard faults in the contents of code and data;
• Tests on the frequency of reset, looking for unexpected resets which occur back to back
in a short period of time.
If the tests fail then the bootloader will either reset or attempt to enter reprogramming mode,
flashing a code to indicate the cause (see the technical specification for each ECU for details
about code flashing). If the tests pass, then the bootloader will determine what mode to enter
next (see Section 4.4.2, “Reprogramming mode” and Section 4.4.3, “Application mode” for
details on how each mode is chosen).
In reprogramming mode, the ECU listens to the communications buses for instructions to
reprogram, as described in Section 4.5, “Programming an ECU”.
When application mode is entered, the library initialises the ECU hardware and starts running
the application model.
The platform performs various operations in the background including checks on RAM
hardware. If a RAM error is detected, an unrecoverable error is raised (resulting in ECU reset)
because program execution is otherwise likely to fail in an unpredictable manner.
Background checking for code or calibration corruption works through the Calibration
Verification Number computation on supported targets with the OBD library option. Ensure
that the CVN is recomputed continually if run-time corruption checking is required. If it is
detected, an unrecoverable error is raised (resulting in ECU reset). This is in addition to boot-
time checksum validation.
At a minimum, the OpenECU device will need to be powered and be connected to the CCP
tool over CAN 0 or CAN A (whichever the target ECU makes available). In some cases the
OpenECU module will need to have the FEPS line connected to a power supply capable of
up to 19 volts (depending on target), as shown in the following diagram.
Note
The FEPS voltage must be asserted before the ECU is powered up. Powering the
FEPS input and ECU simultaneously (i.e. shorting the FEPS and VPWR inputs) may
result in reprogramming mode not being detected.
FEPS 17-19V, 0V
IGN Power supply
VPWR 12V DC
OpenECU GND 0V
Calibration
CAN0-L, CAN0-H CAN
2 Tool
Boot mode
This is the mode initiated when the ECU is turned on (or recovering from
a powered reset). Boot mode choose whether to enter reprogramming
mode or application mode.
Reprogramming mode
This is the mode required to reprogram the OpenECU with the CCP tool.
This mode is entered differently depending on the ECU. All OpenECU
modules can be made to enter this mode by asserting the FEPS pin with
a positive voltage (above the required threshold) and power cycling the
OpenECU device.
Application mode
This is the mode required to run the application on OpenECU. Start this
mode by grounding the FEPS pin and power cycle the OpenECU device.
How reprogramming and application mode is entered differs slightly between groups of ECUs
due to differences in the electronics. For the M220, M250, M460 and M461 targets, the next
illustration shows how each mode is entered.
Figure 4.10. System modes for M220, M250, M460 and M461
ECU powers up;
or ECU resets
/
Enter boot mode
Reprogramming Application
mode mode
Reprogramming request received;
and application allows reprogramming;
/
Enter reprogramming mode
For the M221 and M670 targets, the next illustration shows how each mode is entered.
Reprogramming Application
/
mode mode
Reprogramming request received;
and application allows reprogramming;
/
Enter reprogramming mode
with different CCP settings is programmed then the new CCP settings
are used after the ECU is power cycled.
The defined CCP settings are defined in Table 6.3, “CCP defaults”. As
explained in the table, these settings will vary depending on the version
of firmware that is programmed into the ECU.
Once programmed, an ECU will remain in reprogramming mode until the power is cycled.
After the power cycle, the ECU will determine which mode to enter based on the FEPS
voltage. To start the application after programming, ensure FEPS is grounded and power
cycle the ECU.
The FEPS pin is asserted by applying a voltage to the pin. The required voltage varies
between ECUs.
As a shortcut, the device can be reprogrammed via a CCP compliant tool without cycling
the power to the ECU (FEPS may or may not been to be applied depending on the
ECU). When reprogramming starts, the OpenECU device switches from application mode to
reprogramming mode. It may be undesirable to allow this method due to safety reasons, so
the pcp_CCPInhibitReprogramming block can switch this method off.
If the OpenECU device has never been programmed before, it uses the CCP settings given
in Table 6.3, “CCP defaults”. The CCP compliant tool must use the same settings. Once
the OpenECU device has been reprogrammed with an application that uses different CCP
settings, the CCP compliant tool must be changed to use these settings.
Certain OpenECU devices might require different protocols for programming than CCP such
as J1939 or ISO 15765. Please consult the technical specification of your device to determine
the supporting protocols.
• OpenECU provides a series of blocks to store information across power cycles. The
information can be stored in scalars, arrays or maps, and the scalars and maps can be
adapted over time (for instance, when learning the mechanical end stops for valve positions
over time). See Section 4.6.2, “Adaptive parameters” for details.
• OpenECU provides a series of blocks to adjust the compiler and linker options for a model
build. Support for selecting which compiler to use as well as adjusting the options given to
the compiler and linker allow some control when incorporating custom code and working
around compiler bugs. See Section 4.6.4, “Compiler options” for details.
• OpenECU has a mechanism for retiring old blocks and replacing them with more capable
blocks through deprecation. See Section 4.6.5, “Deprecated blocks” for details.
• OpenECU provides a series of blocks for fault and diagnostic trouble code logging. The
fault information can be stored across power cycles and the diagnostic trouble codes can
be automatically handled in some J1939 messaging. See Section 4.6.6, “Fault support”
for details.
• OpenECU provides a series of blocks for analogue and digital input processing.
Support includes measuring analogue inputs, digital, frequency and PWM inputs. See
Section 4.6.11, “Analogue and digital inputs”.
• OpenECU provides a series of blocks to interact with the operating system The operating
system schedules the different operations the ECU must perform to function correctly,
including running the functionality assigned to each model rate. The blocks provide access
to run-time schedule information, including how much processing time is taken up running
all the software. See Section 4.6.13, “Operating system”.
• OpenECU provides a series of blocks for analogue and digital output processing.
Support includes driving constant current outputs, digital, PWM and stepper outputs. See
Section 4.6.14, “Analogue and digital outputs”.
• OpenECU provides a series of utility blocks to make some of the example models easier
to use the first time around. These blocks can be incorporated in other models and provide
quick mechanisms to configure each of the auto-coders, turn on and decode the sample
time colours and build a model. See Section 4.6.15, “Real-Time Workshop (RTW) support”.
• OpenECU provides a series of blocks to configure each of the target ECU specific features,
not covered in a general sense by other groups of blocks. For instance, the blocks provide
a mechanism to select whether some inputs are VRS single-ended or Hall effect and select
the over-current trip level for some outputs. See Section 4.6.16, “Target ECU identification
and configuration”.
• OpenECU provides a series of blocks which provide timing information. Simulink maintains
a base rate time, with a resolution as accurate as the quickest model rate. The ECU
maintains a much higher resolution timer as well as access to the current time since power
on. The blocks provide access to these timers. See Section 4.6.17, “Timing”.
• OpenECU provides a series of blocks to perform common and general functions. These
blocks are provided by OpenECU to support the same functionality across all versions of
Simulink that OpenECU supports. See Section 4.6.18, “Utilities”.
• OpenECU provides a series of blocks to access version information when using Simulink
and when running the model on an ECU. For instance, there is a block to determine if the
expected version of OpenECU is being used when editing the model, and a block to get
the version of OpenECU software running an ECU. See Section 4.6.19, “Versioning”.
OpenECU has specific support for ATI Vision, ETAS INCA and VECTOR CANape but can
also generate generic ASAP2 information for inclusion into any ASAP2 compliant calibration
tool.
The blockset library provides access to non-volatile storage: storage retained when the power
is removed from the module by either connecting a low power source to the Keep alive power
pin to retain the contents of RAM storage, or by committing the data to Flash storage (see
the technical specification for details on which storage type is supported by each target).
The adaptive data is check-summed using a 16-bit CRC. Failure to match the check-sum
against the adaptive data during library initialisation means that the data cannot be recovered.
In this case, adaptive data is reverted to the default for each adaptive element (the defaults
can be specified by the application).
Flash
Storage that requires no external power supply when the ECU is powered down (not
available on all target ECUs).
See Section A.1, “ECU hardware reference documentation” for details of what non-volatile
memory stores are available for each target ECU.
The application starts a commit of adaptive data to non-volatile store through the
pnv_AdaptiveChecksum block.
Note
If the non-volatile memory store is Flash, then the library will halt the application while
committing adaptive data to non-volatile memory. This is to prevent any higher-rate
tasks interrupting and attempting to access the Flash device (which will generally be
unavailable at that time).
The worst case scenario is for the application to be stopped for about 1.8 seconds. It
is the responsibility of the application to ensure that there will be no detrimental side
effects to stopping the application for this length of time, e.g., the application should
ensure all coil and injector outputs are turned off if applicable for that ECU.
It should also be noted that, once started, it is not possible to interrupt the Flash commit
process. So if, for example, a user of the ECU requests that the ECU start-up before
the process has completed, the ECU will not try to start until control is passed back
to the application.
The application can determine if the adaptive data requires a commit to non-volatile memory
through the pnv_Status block. When the ECU decides to power down, if this block shows the
data as unmodified there will be no need to store the data to non-volatile memory again; this
is important for a Flash-based solution as this means there is no need to write the data to
Flash, thus minimising shutdown time and reducing the number of Flash write cycles.
4.6.3. Communications
4.6.3.1. CAN communications
Functions to pack and transmit or receive and unpack CAN messages are provided. These
functions also report status information, for example: bus off. User selectable data types for
the message fields are supported at the Simulink block level.
Functions to use Vector CANdb files to define CAN messaging are provided:
When this kind of change occurs, rather than change the existing block, a new block is created
with the new functionality, while the old block is retained as is. This allows the model to
load without Simulink printing errors and the model can be changed to use the new block
as required.
However, to remove old functionality over time, the old block will be removed in a future
version of the developer software, ensuring the blockset remains efficient. Blocks which are
to be removed in the future are marked deprecated, and the documentation for those blocks
indicates how to replace the block with an equivalent block that isn't marked deprecated.
Currently, the following blocks are marked deprecated and will be removed in a future version
of the developer software. Please replace the use these blocks as soon as possible.
Direct
output signal
Output
circuitry
Processor
To external actuators
Output Output
device circuitry
Serial Direct
communications output signal
Direct I/O
Direct I/O takes place on demand. The application calls the necessary function and the
function takes a measurement or sets a driver accordingly.
Indirect I/O
Indirect I/O is delayed.
For an input, the application calls the necessary function and the data to be read is taken
from a buffer of data that was sampled some time ago. Once the model has completed
each model rate once, the data is buffered at the quickest rate which requests the data.
Thus indirect inputs are delayed by at most one iteration of the quickest rate which
requests the input.
For an output, the application calls the necessary function and the data to be written is
buffered and actioned some time later. Once the model has completed each model rate
once, the buffered data is actioned at the quickest rate which writes the indirect output.
Indirect I/O always occurs when there is an device between the processor and the pin. The
device communicates to the processor across a serial link and it is this communication which
introduces the delay. Only I/O channels noted as serial in the technical specification (see
Section A.1, “ECU hardware reference documentation”) are affected.
4.6.11.3. Monitors
Each target ECU provides some measure of feedback for a subset of the output pins. For
instance, measuring the reference voltage for A/D conversions to determine if the reference
voltage generator has failed. A complete list of the monitors can be found in the technical
specifications (see Section A.1, “ECU hardware reference documentation”). Each monitor
is read by using one of the blocks, e.g., using the Section 6.1.5, “Analogue input — basic
(pai_BasicAnalogInput)” block to read the analogue voltage of a monitor.
UEGO sensors require careful control of the heating element to avoid damaging the ceramic
heater, and careful control of the pump cell current to accurately measure the oxygen content.
See the modules technical specification document for more details.
The blockset library provides access to information about the tasks at run time:
• Section 6.1.81, “Processor loading (psc_CpuLoading)”
• Section 6.1.108, “Task duration (pkn_TaskDuration)”
Some operations are performed in parallel on different devices to the processor that runs
tasks. On some target ECU, information is available about how heavily loaded these
devices are:
• Section 6.1.82, “eTPU loading (psc_EtpuLoading)”
If enabled, OpenECU interprets the fastest rate task defined in the Simulink model
as a task that is triggered at specific engine angles if the check-box 'Angular Rate
Functionality' is checked. This check-box can be found in the menu option Simulation
Parameters -> Real Time Workshop -> OpenECU code generation options. The following
screen is an example:
The angular task is run at the engine angles defined in the engine configuration block, i.e.
the TDC angle + Angular Task Calc Angle. The angular task is intended for calculating
values such as the fuelling per cylinder. Note that if the engine is not rotating, the angular
task will not execute. In simulation, the angular task will behave as the fastest rate task
and all other task time-steps must be a multiple of the angular task time-step. A figure of
0.001s is suggested for the angular task time-step.
Stack
Each task shares the same stack space, an area of RAM dedicated to storing temporary
information about the task and the functionality the task is performing. The amount of
stack space is finite and must be specified when the model is built. The blockset library
provides information about how much stack has be used since ECU power on or last
reset:
• Section 6.1.106, “Stack used (psc_StackUsed)”
Watchdog
Each ECU implements a watchdog, a mechanism to reset the ECU if the ECU software
appears to be misbehaving. A simple watchdog scheme is implemented by the platform
software but the application model can take control of the watchdog and implement a
more complex scheme.
• Section 6.1.114, “Watchdog kick (psc_KickWatchdog)”
Memory tests
Each ECU implements an internal memory test during startup to check for hard memory
faults. Hard memory faults are memory faults that have become permanent such as
a shorted address line, or a memory cell that cannot change state. RAM is tested by
performing a destructive walking one's test on the address and data lines and a memory
recall test on the memory cells. ROM is tested by calculating a checksum of the contents.
If a hard memory fault is detected, then the ECU will reset itself to force safety related
outputs to a default state.
Some ECUs also implement a continuous internal memory test during runtime to check
for soft memory faults. Soft memory faults are transient memory faults, such as might
occur when a memory cell changes state due to stray electron releases. The error
correction module hardware is capable of detecting and correcting errors that are limited
to a single bit wrong in a 64-bit double word. If more than one bit is wrong in a 64-bit
double word, then the hardware can detect the error, but it cannot be corrected. If an
uncorrectable soft memory fault is detected, then the ECU will reset itself to force safety
related outputs to a default state.
The blockset library provides Simulink blocks to report the status of the continuous
internal memory soft error test as well as the address of the last detected correctable
error.
• Section 6.1.75, “Internal RAM test progress (psc_InternalRamTestProgress)”
• Section 6.1.77, “Internal ROM test progress (psc_InternalRomTestProgress)”
• Section 6.1.74, “Internal RAM test error (psc_InternalRamTestError)”
• Section 6.1.76, “Internal ROM test error (psc_InternalRomTestError)”
In order to support the services provided by the library (e.g., J1939 messaging), the library
defines a number of auxiliary tasks. These tasks have a unique priority relative to each other
and the application tasks, as shown in Table 4.8, “Library and application tasks”.
Tasks can have different triggers. Triggers make the task become ready to run. The highest
priority task ready to run is given the CPU.
Sporadic
The task becomes ready to run based on an event. The event is generally not periodic,
but may be periodic under some conditions.
Angular
The task becomes ready to run based on the crank or engine position. See Chapter 7,
Angular detail for more about supported engine functionality.
Periodic
The task becomes ready to run on a periodic basis.
Periodic (burst)
The task becomes ready to run based on an event. Once ready, the task becomes
periodic for a number of iterations, before stopping and waiting for another event.
Note
The scheduler deals with both application and library tasks. It is possible for a high
priority application task to use the processor for as long as it needs and there is no
protection offered by the library to prevent tasks from using up more processor time
than they should.
The application tasks are scheduled to relative to the library tasks such that a long
running task may cause a lower priority library task to become unduly delayed.
An example of this would be the CCP task which runs every 5ms. It is conceivable
that an application task may take longer than 5ms to complete and that is a desirable
property of the application. However, when the application task takes longer than 5ms,
the CCP task becomes delayed by the application task.
The design of the library tries to mitigate the consequences of delayed library tasks.
Delaying the library CCP task may cause a burst of DAQ messages to the calibration
tool to become delayed and the calibration tool may complain, but delaying the CCP
task will not cause the I/O functionality to become delayed or mis-behave.
However, mitigation is all that the library can achieve if the application uses large
amounts of the processor, and, for this reason the design of the application must
take this into account by keeping the application tasks short. For instance, by splitting
long running tasks up into discrete parts which are scheduled on successive task
invocations.
and a way to diagnose the status of the electrical connections of some ECU loads:
Direct
output signal
Output
circuitry
Processor
To external actuators
Output Output
device circuitry
Serial Direct
communications output signal
Direct I/O
Direct I/O takes place on demand. The application calls the necessary function and the
function takes a measurement or sets a driver accordingly.
Indirect I/O
Indirect I/O is delayed. The application calls the necessary function but the data to be
read or set is actioned some time after the function returns.
Indirect I/O always occurs when there is an device between the processor and the pin. The
device communicates to the processor across a serial link and it is this communication which
introduces the delay. Only I/O channels noted as serial in the technical specification (see
Section A.1, “ECU hardware reference documentation”) are affected.
4.6.14.3. Monitors
Each target ECU provides some measure of feedback for a subset of the output pins. For
instance, measuring the reference voltage for A/D conversions to determine if the reference
voltage generator has failed. A complete list of the monitors can be found in the technical
specifications (see Section A.1, “ECU hardware reference documentation”). Each monitor
is read by using one of the OpenECU blocks to read the monitoring state of an output. For
instance, using the pdx_DigitalInput block to read one of the digital state monitors, or the
pai_BasicAnalogInput block to read one of the voltage monitors.
To support switching between auto-coders, the blockset library provides a set of blocks which
switch between the different configuration sets. Simulink configuration sets contain options
for a specific auto-coder. Currently, building models against the RTW (GRT RTMODEL) and
RTW (EC) auto-coders is supported.
The blockset provides a utility block to start a model build. Pressing CTRL+B in a model
window performs the same functionality.
Some ECUs have capabilities which don't fit into the standard framework, and special support
is provided for those capabilities.
4.6.17. Timing
Real time applications, like those developed for OpenECU, often need to time events
or durations, at different resolutions. The blockset library provides two mechanisms to
manipulate time: using the Simulink task timers; and using the ECU processor's timers.
4.6.18. Utilities
The I/O library also provides a number of support or utility functions to facilitate module
configuration and diagnosis:
signal conditioning:
4.6.19. Versioning
For configuration management purposes, it can be useful to restrict the version of developer
software that can be used when editing and building a model. The blockset library provides
a flexible way to specify the allowable versions.
For configuration management and debugging purposes, it can be useful to know the
versions of software running on an ECU are compatible. The blockset library provides a way
to retrieve the version numbers of the various software components running on an ECU.
And a way to retrieve the date that each of those software components was built.
A way to ensure the code and calibration memory regions have not been altered is provided.
When converting any model, you will need to consider the following changes (as well as
those in Section 4.3.1, “Block use restrictions”):
Note
Some of the settings are harder to configure than others. It may be easier overall to
create a new model using the:
oe_create_model
command and copying the systems and blocks to this new model.
These settings can be set using the following commands when the model is selected:
oe_create_model
command and copying the systems and blocks to this new model.
Model identification
OpenECU provides a put_Identification block which identifies the target hardware the
model will run on. Before a build can complete, this block must have been added to the
model. Without this block, a RTW build of the model will fail.
When adding a put_Identification block to a model for the first time, it is best to set the
block's target hardware parameter then save, close and reload the model. This ensures
that any other OpenECU block in the model is adjusted for the newly selected hardware
target.
Continuous blocks
The OpenECU device relies on a discrete solver and therefore any block that relies on
a continuous solver will not work on OpenECU. Each of these blocks must be replaced
by a discrete equivalent. E.g., a continuous transfer function block to a discrete transfer
function.
Some MATLAB and Simulink tools exist to help perform these transformations, for
instance, the tustin approximation.
Computation load
The OpenECU device is based on a commercial engine controller and therefore uses
a commonly available processor to execute the model. Processing power is therefore a
resource that must be managed well and it is important to refactor your model so that
computation is spread over various model rates.
For instance, when reading a slow changing analogue input and processing its state, it is
often best to place the analogue input block to a model rate which is reflects how quickly
the analogue input can change. This avoids iterating portions of the model on a frequent
basis that produce similar values to previous iterations. If the slow changing analogue
input is subsequently used by a faster portion of the model, this can be accommodated
using Simulink blocks (an example of how to transfer information between different model
rates is given in the multi-rate demo, see Section 3.2, “Installed examples”).
OpenECU provides information about how long each of the model rates takes to
run as well as the percentage processor loading that can be viewed over CCP (see
Section 6.2.5, “Application and library task timing information”)
updated accordingly. The settings in the following list of tables, appropriate to the version
being used, should be considered.
• Table 4.16, “Model simulation settings for R2019a, R2019b, and R2020a”
For R2015a, support has been added for Simulink data dictionaries. For further details, see
Section 4.2.2.2, “Data dictionary files”.
5.1. Introduction
This chapter describes the processes involved in modelling your own strategies in Simulink,
and building the code. It also describes some modelling rules and guidelines that will make
it simpler to model and debug your designs.
The process of auto-code generation from Simulink is very much dependent on these
rules, and the nature of the process necessarily introduces some design constraints. These
constraints are simply there, however, to ensure that the model you design will successfully
create the code you want running in the ECU.
Pi Innovo has many hundreds of man-years of automotive design experience using Simulink,
and these rules and guidelines have come about through rigorous cycles of testing and
analysis. Adhering to Pi's rules and guidelines will also make it considerably easier to
understand the nature of any support queries you may have at the design and modelling level.
• All time based rates in the system must be multiples of the fastest rate interval (this includes
the angular rate).
• If it is required to perform calculations at a different rate to the default rate, you must create
a further subsystem with a new rate. Different rates can be used at any position in the
whole library hierarchy.
• Where data flows into a subsystem with a different rate (and the data was generated
internally in the current library), you must resample the signal, or the model will not build
in multitasking mode. Models can be single tasking, but to build it must be processed as
a multi-rate system i.e., multitasking mode. See the Simulink manual for information on
multitasking modes.
• If the signal comes from a block running at a faster rate, a Zero Order Hold block must be
the first thing connected to the inport of the subsystem. The sample time of the Zero Order
Hold must be set to correspond to the rate of the subsystem.
• When the signal comes from a block running at a slower rate, a unit delay block must be
used, with the sample time set to the slower rate. This appears inelegant, but is a Simulink
requirement for multi-rate systems. Note that although the unit delay must run at the slower
rate, the effect in the code is a delay by one step of the faster rate.
• During model development, the Sample Time Colours option is useful for identifying where
additional Zero Order Hold blocks are required, but isn't quite so helpful for the unit delay.
Inputs to triggered subsystems must be resampled according to the above rules. The effective
rate of the triggered subsystem for this purpose is the rate at which the trigger signal is
updated.
• Continuous Time blocks — No use of continuous time blocks is allowed. For some
targets the auto-code generator cannot produce code for these blocks, and for those for
which it can there is significant computational overhead. The blocks which are banned
under this rule are: Derivative, Integrator, Memory, State-Space, Transfer Fcn, Transport
Delay, Variable Transport Delay, Zero-Pole.
• Algebraic loops — The model cannot contain any algebraic loops. These occur when
the output of a calculation appears as one of its inputs. In many applications a variable is
updated and its value therefore depends on a previous value. In such cases a loop can be
avoided by inserting a unit delay (1/z) block. RTW cannot produce code if algebraic loops
exist. Where a unit delay block is used as above to avoid an algebraic loop it should be
shown flowing from right to left. Where a unit delay block is used for other purposes (such
as comparing successive values of a flow) it should be shown flowing left to right.
• Division by zero — Make division by zero, or overflow due to division by very small
numbers, impossible by constraining the divisor (denominator) to be a finite, non-zero
number. And as with all calculations, clip the output to be within its data-dictionary defined
range. (If the division is some part of a complex calculation, it is generally sufficient to clip
only the end result, before that is passed out of the subsystem (say) via a named, data
dictionary specified signal. If the signal is to be observable in unit tests, it should be clipped
within range unless it can be shown and commented to always be in range, given valid
inputs.) It is not sufficient to only clip the output of a divide operation, or ignore the result
if the divisor is very small, because allowing the erroneous divide operation to occur at
all may cause a machine exception on some platforms (and will produce a warning if run
in simulation).
• Switch blocks — When a Switch block is used, it should only be used as a logical switch.
If the control input is a 'real' type, the switching threshold will always be set to 0.5, because
the threshold is not printable. Where a threshold comparison is required, it should be shown
explicitly with a comparison block. See the section on Boolean signals, below.
• Absolute time — No use shall be made of absolute time. When a model has been
running for a long time, the absolute simulation time becomes so large that the time step is
smaller than the resolution of the (floating point) elapsed time. At this point the time simply
stops working. The following blocks are banned by this rule Repeating sequence, pulse
generator, ramp, clock, digital clock, chirp signal.
• Combinatorial logic — Avoid the use of the Combinatorial Logic block, and the S-R and
J-K flip-flop blocks which use it internally. Although useful, the embedded Logic block in
the flip-flop blocks causes a wastefully large RAM array to be generated in target code,
half of which is used to look up the second output which is normally terminated in any case.
Try to use primitive logic blocks and a 1/z instead or devise a simple library block.
• Logical flow — Where possible a logical flow from top left to bottom right should be
adopted within each subsystem.
• Proportions — Create subsystems in the level above such that each has an aspect ratio
close to 1:1. Each diagram, whether Simulink or Stateflow, should be drawn with an aspect
ratio of around 1.6:1 to facilitate printing on A4 or US letter paper in landscape mode.
• Size — Use hierarchies to keep the number of blocks displayed on the screen at any one
time reasonable. It should not be necessary to use the scroll bars to navigate around a
single level at legible zoom. Similarly all diagrams should be legible when printed on A4.
The top-level model should be the only exception.
• Wire junctions — When lines are joined the junction blob must always appear at the point
where the lines intersect. If a line has junctions to both sides they must never be coincident.
Coincident junctions are hard to distinguish from crossing lines. The junctions should be
staggered by at least one grid space.
• Hidden default name — If a block retains its default name, the name should be hidden.
• Block names — Calibration constants are represented using the Simulink constant block
with the value field set to the name of the constant. The block name should be the same
as its value, but it should be hidden. The name matters because RTW uses it to generate
names in the code.
your own models to make them consistently comprehensive to anyone else who may use
your model (and to the Pi support engineers, should you need to talk to them about your
design).
All names consist of a prefix, a descriptive body, and an optional suffix, separated by
underscore characters:
mbec_ign_key_debounce_time
Prefix Name
Used to gather variables for the same Used to uniquely identify the variable by name.
group of functionality together.
E.g., mbe for ‘master base engine’, or
alt for ‘alternator control’
The prefix consists of three or four lower case letters, these being:
• A three letter prefix code identifying which group of functionality the named item belongs to.
• A single letter identifying the type of the named item (not used for displayable signals).
See Table 5.1, “Variable naming convention” for a list of types.
• A suffix is used on names of parameters of blocks such as lookup tables, where the
parameters have the same name as the block with a defined suffix appended.
• Names are case sensitive, but no reliance shall be placed on this. All names should be
lower case except where otherwise stated below.
• The sense of any boolean variables should be clear from the name of the variable.
• Where there are multiple words in the descriptive body of a data name, the underscore
character '_# should be used to separate the words.
• Subsystems and Stateflow machines all have unique names. The name begins with the
library prefix followed by a one letter code to define the task rate associated with that
subsystem, and an underscore.
• Where there are multiple words in the descriptive body of a subsystem or Stateflow
machine name, each word should begin with a capital letter.
• Axes and data for lookup tables should be given the name of the table, followed by a suffix.
1-d lookup tables have two parameters as follows:
Given that it is unlikely the data will be manually edited in MATLAB, the drawing convention
above is adopted.
• If a constant is literal (not a calibration item), its name will be in upper case and need not
have the prefix. It is recommended, however, that the library prefix is retained (in upper
case) for literals which relate only to one feature.
• All calibration items and literals should be defined and have values assigned in the
MATLAB base workspace.
• Simulink ports are named as variables. Except for generic library blocks, the naming of
ports should be consistent throughout the entire model hierarchy, such that differently
named ports are never connected directly together.
In addition, the C-code generated by the Simulink blocks is clean and efficient compared
to the Stateflow version, though this is becoming less true with newer releases of Stateflow
Coder and RTW. See also the section on Boolean signals below.
Stateflow is useful when modelling state-based strategies. These can be very well
represented using the state chart notation, including the option of nested state machines.
However, mixing the flow chart nodes into transitions between states produces a messy and
confusing diagram. This is particularly true when actions are placed on transitions.
For this reason, state machines with flow nodes are to be avoided. A flow node may appear
as the entry point from an initial transition for the purpose of selecting one of a small number
of states when a chart (or particularly a sub-chart) is activated:
An analogous situation exists where a state has several exit conditions which share a
common part. If (and only if) the non-common parts are mutually exhaustive, the transitions
may be grouped through a flow node. The common part will be used as the condition to exit
the state to the node, then the remaining conditions will form the exits from the node.
In all cases where a flow node appears on a chart it will have a complete exhaustive set of
exit conditions. Thus the node is guaranteed to be transient, and will never cause Stateflow
to 'back up'.
Actions should be specified using the entry, during and exit attributes of states. If an action
is specified on a transition to a flow node, the behaviour is not intuitive, so these must be
avoided. Transition actions are allowed when it is not possible to achieve the desired result
using entry and exit only, but they should only appear on transitions directly from one state
to another.
To avoid confusion as to which transition out of a state takes priority, the conditions on the
transitions should be mutually exclusive.
Defensive programming practice requires that an action be defined for the case of a state
machine in an illegal or undefined state. The default action would be to re-initialise the state
machine via the initial transition. If this action is not appropriate then the diagram should be
annotated appropriately. This applies only to hand-coded projects, since it is not possible to
control Stateflow's handling of this condition.
The use of type conversions is often required to interface between floating point strategy
models and sensor or actuator hardware on the target platform.
In practice, however, the data type handling is rather limited. Only floating point and integer
types are available, and there is no provision for fixed point values (or integers with scaling
factors) (except by use of the fixed-point blockset, but values from that cannot be used in
scaled form in Stateflow). Consequently it is not practical to use Simulink for automatically
generating code for a fixed point processor target, since it would be necessary to explicitly
model every scaling factor compensation. For example, take the following piece of maths:
If we were to implement this using integer arithmetic, we would not only have raw values
displayed in any scope blocks but we would also need to add scaling corrections and integer
size conversions to result in the following:
the output from a logical operator block such as AND. This reduces RAM and CPU usage, and
causes more efficient code to be generated for switch blocks, replacing the usual comparison
against a threshold with a simple and fast if (boolean)... construct. (An error is issued if this
would be inconsistent with the switch threshold value set.)
Similarly, it may be appropriate to use integer types for some signals, e.g. when passing an
enumerated state variable. This saves RAM, reduces CPU use, and may remove the need
to make exact floating-point comparisons later. But see the section on Logical operators,
above; it is awkward to attempt to represent quantities which are naturally continuous (e.g.
a pressure) as scaled integers.
Note
There is no problem passing a Boolean or integer signal into Stateflow, so long as
Strong data typing is switched on in the Stateflow chart properties (otherwise, it expects
only floating-point inputs and outputs).
Avoid direct equality tests. Floating point results will be rounded, and tests for exact equality
are inherently risky.
Some inports, outports and parameters have a valid numerical range or size of vector. If so,
the range and size information is given beside the object's description using internal notation.
Notation Range
(x, y) x < value < y
[x, y) x <= value < y
(x, y] x < value <= y
[x, y] x <= value <= y
Some objects are not clipped to a range but folded into a range using modulo arithmetic and
where this occurs, the description includes details.
6.1.1.3. Description
x:
x z(x)
z:
put_ calmap 1d
Looks up the inport x in the X-axis Data parameter, interpolates the corresponding elements
in the Z Data parameter, giving a corresponding z(x) as the output.
Some calibration tools provide a feature which shows the map in graphical or tabular form
together with the active interpolation point. OpenECU supports this feature by populating
the ASAP2 file with the signal name which corresponds to the x inport. To make this
feature work, the x signal must be a named DD entity with its storage class property set to
ExportedGlobal.
6.1.1.4. Inports
• x
6.1.1.5. Outports
• z(x)
• X-axis Data
The name of the map's x axis (e.g. vftm_mymap_x, see Section "Naming rules"). There
must be two or more elements in this parameter and that must be the same as the number
of elements in parameter Z data. The values of X-axis Data must increase monotonically
but adjacent values may be the same.
• Z Data
The name of the map's z axis (e.g. vftm_mymap_z, see Section "Naming rules"). There
must be two or more elements in this parameter and that must be the same as the number
of elements in X-axis Data.
• Sample time
6.1.1.7. Notes
• The Simulink look-up and pre-index blocks can be used instead of the put_Calmap1d
block. If a model uses the OpenECU data dictionary, then the axes and look-up data
dictionary items must adhere to the naming convention and cannot be shared between
look-up blocks. If a model uses the Simulink data dictionary, then the naming convention
is not required, and axes and look-up DDEs can be reused between look-up blocks.
– Note that other combinations are possible, see Section 4.2.2.2, “Data dictionary files”
for details.
– Note that in some cases, the Simulink look-up block can be slower to run than the
put_Calmap1d block.
– Note that when using Simulink look-up blocks with the Diab compiler, the following
warning message is emitted during model builds. The warning can be ignored.
'[model].c', line [line]: warning (dcc:1792):
trying to assign 'ptr to volatile' to 'ptr'
If the inport x value is less than the first element or larger than the last element of parameter
X-axis Data, the block outputs the first element or last element of parameter Z Data
respectively as outport z(x).
Warning
This effectively clips the output value as if it were looked up at the nearest defined
break-point, which differs from the behaviour of the standard Simulink look-up block
in older versions (e.g., Simulink R12).
Otherwise, if the inport x is equal to the value of one of the elements of parameter X-axis
Data, the block outputs the corresponding element of parameter Z Data as outport z(x).
Otherwise, if the inport x is equal to the value of more than one element of parameter X-axis
Data and the corresponding elements in parameter Z Data differ (causing a discontinuity
in the function), the earliest element in the parameter Z Data is output.
6.1.2.3. Description
x x:
y: z(x,y)
y z:
put_ calmap 2d
Looks up the input x and y in the X-axis Data and Y-axis Data parameters then interpolates
between the corresponding Z Data parameter elements, giving a corresponding z(x,y) as
output.
Some calibration tools provide a feature which shows the map in graphical or tabular form
together with the active interpolation point. OpenECU supports this feature by populating
the ASAP2 file with the signal names which correspond to the x and y inports. To make
this feature work, the x and y signals must be named DD entities with their properties set
to ExportedGlobal.
6.1.2.4. Inports
• x
The x-value at which a z-value is to be interpolated. May be a scalar or a vector the same
size as inport y.
• y
The y-value at which a z-value is to be interpolated. May be a scalar or a vector the same
size as inport x.
6.1.2.5. Outports
• z(x,y)
• X-axis Data
The name of the map's x axis (e.g. vftm_mymap_x, see Section "Naming rules"). There
must be two or more elements in this parameter and that must be the same as the number
of elements as columns in parameter Z Data. The values of X-axis Data must increase
monotonically but adjacent values may be the same.
• Y-axis Data
The name of the map's y axis (e.g. vftm_mymap_y, see Section "Naming rules"). There
must be two or more elements in this parameter and that must be the same as the
number of elements as rows in parameter Z Data. The values of Y-axis Data must increase
monotonically but adjacent values may be the same.
• Z Data
The name of the map's z matrix (e.g. vftm_mymap_z, see Section "Naming rules"). There
must be the same number of rows as elements in parameter Y-axis Data and number of
columns as elements in parameter X-axis Data.
• Sample time
6.1.2.7. Notes
• The Simulink look-up and pre-index blocks can be used instead of the put_Calmap2d
block. If a model uses the OpenECU data dictionary, then the axes and look-up data
dictionary items must adhere to the naming convention and cannot be shared between
look-up blocks. If a model uses the Simulink data dictionary, then the naming convention
is not required, and axes and look-up DDEs can be reused between look-up blocks.
– Note that other combinations are possible, see Section 4.2.2.2, “Data dictionary files”
for details.
– Note that in some cases, the Simulink look-up block can be slower to run than the
put_Calmap2d block.
– Note that when using Simulink look-up blocks with the Diab compiler, the following
warning message is emitted during model builds. The warning can be ignored.
If the value of inport x lies outside the range defined by the smallest and largest values
of parameter X-axis Data, it is altered until it meets that range (i.e. it is made equal to the
nearest x value which does occur in parameter X-axis Data). Similarly the value of inport
y is made to meet the range defined by the smallest and largest values in parameter Y-
axis Data.
Warning
This effectively clips the output value as if it were looked up at the nearest defined
break-point, which differs from the behaviour of the standard Simulink look-up block
in older versions (e.g., Simulink R12).
If the point (x, y) is coincident with one of the intersections of the X-axis Data and Y-axis
Data breakpoints (i.e. the value of inport x equals one of the values in parameter X-axis
Data and the value of inport y equals one of the values in parameter Y-axis Data), the block
outputs the corresponding element value of parameter Z Data with no interpolation. This
includes the outer boundary (and corners) of the area defined by the x and y axes. If more
than one point in either axis parameter equals the value of one of the inports, such that a
discontinuity is defined in the surface, the lowest-indexed parameter element is selected.
If the point (x, y) is coincident with a X-axis Data element but lies between Y-axis Data
elements, then the value output is linearly interpolated between the bounding points in the
y direction referenced to the x axis. If two or more values in parameter X-axis Data equal
the value of inport x, the lowest-indexed entry is used.
If the point (x, y) is coincident with a Y-axis Data element but lies between X-axis Data
elements, then the value output is linearly interpolated between the bounding points in the
x direction referenced to the y axis. If two or more values in Y-axis Data equal to the value
of inport y, the lowest-indexed entry is used.
If the point (x, y) is not coincident with any X-axis Data or Y-axis Data elements, the outport
z(x,y) is obtained by bi-linearly interpolating between the bounding points in the x and y
axes defined by the lower-indexed x and y elements.
6.1.3.3. Description
year
month
day
psc_ AppBuildDate
Gets the build date for the ECU's application. The build date can be used to distinguish
between different versions of the application.
6.1.3.4. Inports
• sim_year
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport year is set to the value of this inport for simulation purposes.
• sim_month
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport month is set to the value of this inport for simulation purposes.
• sim_day
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport day is set to the value of this inport for simulation purposes.
6.1.3.5. Outports
• year
The year the application was built. Under simulation, if the Provide simulation inports
parameter isn't ticked, the outport is set to the minimum of its range. The signal attached
to the outport must be set as ExportedGlobal.
• month
The month of the year the application was built. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• day
The day of the month the application was built. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
6.1.3.7. Notes
None.
6.1.4.3. Description
major _ ver
minor _ ver
psc_ AppVersion
Gets the version information for the ECU's application. The version number is composed of
three fields, major, minor and sub-minor, typically written as major.minor.sub-minor.
The version can be used by the application for version control or diagnostics.
6.1.4.4. Inports
• sim_major_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport major_ver is set to the value of this inport for simulation purposes.
• sim_minor_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport minor_ver is set to the value of this inport for simulation purposes.
• sim_sub_minor_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport sub_minor_ver is set to the value of this inport for simulation purposes.
6.1.4.5. Outports
• major_ver
The major version number of the application. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• minor_ver
The minor version number of the application. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• sub_minor_ver
The sub-minor version number of the application. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to the minimum of its range. The
signal attached to the outport must be set as ExportedGlobal.
6.1.4.7. Notes
None.
6.1.5.3. Description
pai _ BasicAnalogInput
This block reads a physical analogue channel identified to obtain a raw input value when run
on target hardware. When run in simulation, the block instead takes the value on its inport
as its raw value.
A raw value is the number obtained from the analogue-to-digital converter in the ECU device
scaled as if it had 10-bit resolution, such that 0 indicates the reference ground (0 V), -1023
indicates the lower reference voltage (-5V) and 1023 indicates the upper reference voltage
(5V).
Note
The worst case conversion time for all analogue-to-digital values is ~500µs. Thus, when
the software asks for an analogue-to-digital conversion, the analogue-to-digital value
may be up to 500µs old.
Note
Once read, the [-5, 5]V range must be scaled by the application to the range indicated
in the technical specification for the selected target.
6.1.5.4. Inports
• sim_adc
Only used under simulation when the parameter Provide simulation input? is ticked. The
outport voltage is written to the value of this inport scaled from A/D counts to a voltage.
6.1.5.5. Outports
• voltage
The raw input reading converted to a voltage assuming the input range is -5V to 5V. The
outport must then be scaled by the application to the range given for the channel in the
target's technical specification.
• Channel
• Sample time
6.1.5.7. Notes
None.
6.1.6.3. Description
Channel : 5 VL ( pin B 32+B33)
Sample time : analog _ value
Raw Units: ADC Counts
pai _ AnalogInput
This block reads a physical analogue channel identified to obtain a raw input value when run
on target hardware. When run in simulation, the block instead takes the value on its input
as its raw value.
Depending on the block's configuration, a raw value is either a measure of the voltage on the
processor's analog-input pin or the number obtained from the analogue-to-digital converter
in the ECU device scaled as if it had 10-bit resolution, such that 0 indicates the reference
ground (usually 0 volts) and 1023 indicates the upper reference voltage (usually 5 volts).
Note
The worst case conversion time for all analogue-to-digital values is ~500µs. Thus, when
the software asks for an analogue-to-digital conversion, the analogue-to-digital value
may be up to 500µs old.
When the Transfer function type is set to “Map”, the block converts the raw value into an
engineering value through a 1-d table look-up. When set to “Linear”, the block uses a linear
equation with a specified scale and offset to convert the raw value to engineering value.
An engineering value is the value which takes the physical units appropriate for a particular
input device, e.g. kPa for a pressure sensor. This is obtained from the raw value through
some appropriate transformation. As the user specifies the transformation in the mask, it is
the responsibility of the user to choose appropriate and consistent units.
This block provides range and slew fault checking for analogue inputs. Range checking is
performed for raw values as well as engineering values.
When any range or slew error is detected, the block initially yields the last good value held.
If the leaky bucket confirms a fault however, the default value is output instead.
Filtering of faults is achieved using a leaky bucket algorithm. A leaky bucket integrator is used
to decide when an input is confirmed as faulty as a function of its current state, which may
be only transiently in error. Here the bucket always has a total volume or depth of unity (1.0).
When the input is deemed to be in error (e.g. out of range), water is poured into the bucket
at some rise rate. At all times water flows out of a leak in the bottom of the bucket with some
fall rate until it is empty. If the bucket should ever fill to the brim by reaching a depth greater
than or equal to 1.0, the input is confirmed as faulty. Should the bucket subsequently empty
to below its hysteresis depth, it is no longer confirmed as faulty.
6.1.6.4. Inports
• sim_raw_value
Only used under simulation. Under simulation, the value of this inport is used as the
analogue input A/D counts.
6.1.6.5. Outports
• analog_value
Engineering value of the analogue input conversion (see Transfer function for the
conversion), possibly clamped to the default value if any faults are active.
• confirmed_faults
Calibratable: No
• transient_fault_flag
Whether the input value is currently faulty (e.g. out of range). A scalar flag.
Range: 0 or 1
• Channel
The units in which the raw analogue input data is read. Either 'ADC Counts' (default) or
'Volts'.
The type of transfer function to use when converting from raw units to engineering units.
Either 'Map' (default) or 'Linear'.
Vector of breakpoints for z = f(x) raw value to engineering value look-up when Transfer
function type is set to Map.
Vector of data points for engineering value look-up when Transfer function type is set to
Map.
Scale of transfer function when Transfer function type is set to Linear. 'm' for z = m*(x +
a) + b
Offset of transfer function when Transfer function type is set to Linear. 'a' for z = m*(x +
a) + b
Offset of transfer function when Transfer function type is set to Linear. 'b' for z = m*(x +
a) + b
Tick to separate min and max values into separate values, or combine into a vector.
Vector of minimum and maximum permissible engineering values before input considered
faulty when Separate min/max values? is unchecked.
Vector of minimum and maximum permissible raw values before input considered faulty
when Separate min/max values? is unchecked.
Minimum permissible engineering values before input considered faulty when Separate
min/max values? is checked.
Maximum permissible engineering values before input considered faulty when Separate
min/max values? is checked.
Minimum permissible raw values before input considered faulty when Separate min/max
values? is checked.
Maximum permissible raw values before input considered faulty when Separate min/max
values? is checked.
Maximum absolute rate of change of input calculated over one model iteration before input
considered faulty.
Rate at which leaky bucket is filled when input is faulty in some respect.
Level below which bucket depth must fall before fault is no longer considered faulty. If set
to a negative value, fault remains latched. As a special case, if the hysteresis depth is set
negative, should the input ever reach a confirmed fault state it remains "latched" there until
the ECU device is powered down.
• Sample time
6.1.6.7. Notes
If a map name is given for the transfer function, both Transfer function raw axis and Transfer
function engineering look-up must be named (i.e., it is not possible to name one and give a
numerical vector for the other).
6.1.7.3. Description
pax_ AnalogOutput
The analogue output block causes the channel pin to be driven to a requested voltage or
resistance given by the level inport at every block iteration.
6.1.7.4. Inports
• level
A value representing the percentage of the output voltage or resistance range to supply
via the output channel. Note that the analogue output hardware implementation is target
dependent. See the target technical specification for further details regarding the output
transfer function.
6.1.7.5. Outports
None.
• Channel
6.1.7.7. Notes
None.
6.1.8.3. Description
Double click to
build model
A utility block to start a model build (equivalent to the keyboard shortcut CTRL-B when a
Simulink model window is in focus).
6.1.8.4. Inports
None.
6.1.8.5. Outports
None.
6.1.9.3. Description
year
month
day
psc_ BootBuildDate
Gets the build date for the ECU's boot code. The build date can be used to distinguish
between different versions of the boot code.
6.1.9.4. Inports
• sim_year
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport year is set to the value of this inport for simulation purposes.
• sim_month
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport month is set to the value of this inport for simulation purposes.
• sim_day
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport day is set to the value of this inport for simulation purposes.
6.1.9.5. Outports
• year
The year the boot code was built. Under simulation, if the Provide simulation inports
parameter isn't ticked, the outport is set to the minimum of its range. The signal attached
to the outport must be set as ExportedGlobal.
• month
The month of the year the boot code was built. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• day
The day of the month the boot code was built. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
6.1.9.7. Notes
None.
6.1.10.3. Description
major _ ver
minor _ ver
psc_ BootVersion
Gets the version information for the ECU's boot code. The version number is composed of
three fields, major, minor and sub-minor, typically written as major.minor.sub-minor.
The version can be used by the application for version control or diagnostics.
6.1.10.4. Inports
• sim_major_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport major_ver is set to the value of this inport for simulation purposes.
• sim_minor_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport minor_ver is set to the value of this inport for simulation purposes.
• sim_sub_minor_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport sub_minor_ver is set to the value of this inport for simulation purposes.
6.1.10.5. Outports
• major_ver
The major version number of the boot code. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• minor_ver
The minor version number of the boot code. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• sub_minor_ver
The sub-minor version number of the boot code. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
6.1.10.7. Notes
None.
6.1.11.3. Description
group_id
group_ letter
part_id
issue
psc_ BootPartNumber
Gets the part number information for the ECU's boot code. The part number is composed of
four fields, group identification number, group identification letter, part identification number
and issue number, typically written as group_idgroup_letter-part_id Iss issue.
Example: 12T-168232 Iss 3 The part number can be used by the application for
diagnostics, tracking and identification.
6.1.11.4. Inports
• sim_group_id
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport group_id is set to the value of this inport for simulation purposes.
• sim_group_letter
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport group_letter is set to the value of this inport for simulation purposes.
• sim_part_id
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport part_id is set to the value of this inport for simulation purposes.
• sim_issue
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport issue is set to the value of this inport for simulation purposes.
6.1.11.5. Outports
• group_id
The Group Identification number of the part number of the boot code. Under simulation, if
the Provide simulation inports parameter isn't ticked, the outport is set to the minimum of
its range. The signal attached to the outport must be set as ExportedGlobal.
• group_letter
The Group Identification letter of the part number of the boot code. The value represents
the ASCII code of the letter. Under simulation, if the Provide simulation inports parameter
isn't ticked, the outport is set to the minimum of its range. The signal attached to the outport
must be set as ExportedGlobal.
• part_id
The Part Identification number of the part number of the boot code. Under simulation, if
the Provide simulation inports parameter isn't ticked, the outport is set to the minimum of
its range. The signal attached to the outport must be set as ExportedGlobal.
• issue
The Issue number of the part number of the boot code. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to the minimum of its range. The
signal attached to the outport must be set as ExportedGlobal.
6.1.11.7. Notes
None.
6.1.12.3. Description
pcx_ BusStatus
Provide the current error state of a CAN bus, one of error-active, error-passive or bus-off.
See the Bosch CAN specification from their web site (http://www.can.bosch.com) or the ISO
specification for more details.
In addition to the usual CAN bus-off error handling performed by the CAN controller, when
a CAN bus-off condition is detected by the software, the software temporarily suspends
CAN message transmission. A transmission is then attempted periodically in order to check
whether the bus-off condition has been resolved. After the bus-off condition has been
resolved, the software resumes message transmission as normal.
6.1.12.4. Inports
• sim_bus_state
A dummy input for simulation purposes only. Set to zero to simulate an error-active state,
set to 1 to simulate an error-passive state, and set to 2 to simulate a bus-off state. Only
available if the mask parameter Provide simulation inputs is checked.
6.1.12.5. Outports
• bus_state
Set to zero if the CAN bus selected through mask parameter CAN Bus Identifier is in the
error-active state, set to 1 if in the error-passive state, and set to 2 if in the bus-off state.
Range: [0, 2]
• Sample time
6.1.12.7. Notes
None.
6.1.13.3. Description
pcx_ CANConfiguration
Specify the baud rate for a CAN bus. Some OpenECU devices support more than one CAN
bus, in which case, more than one CAN configuration block is required to configure each.
6.1.13.4. Inports
None.
6.1.13.5. Outports
None.
• Bit Rate
Range: 33.333, 50, 62.5, 83.333, 100, 125, 250, 500 or 1000 kBps
6.1.13.7. Notes
• Some ECUs include CAN bus termination internal to the ECU, whilst some do not. Where
CAN bus termination is not provided by the ECU, termination must be provided external
to the ECU. Robust CAN communication requires correct termination. No termination or
double termination can result in intermittent CAN messaging.
6.1.14.3. Description
Message ID : decimal
sim_ error_ flag Length : bytes error_ flag
Field Start Positions : [ ]
Field Widths : [ ]
Field Signs : [ ]
sim_rx_ trig_ flag rx_ trig_ flag
Field Type Codes: [ ]
Bus ID: CAN ( pin A23+A24)
Sample Time : seconds
sim_ overrun_ flag Use Extended ID: off overrun_ flag
Provide Simulation Input : off
pcx_ CANReceiveMessage
When a matching CAN message to this block is received, the block unpacks the message
contents into individual signals, as specified by the block mask parameters, and provides
them as outports. It is up to the application to provide an appropriate response (if one is
required).
The block can provide a time stamp of when the message was received (see block mask
parameter Provide Timestamp). The time stamp is a low accuracy time stamp, taken a short
period of time after the message is received. That period of time is variable depending on
the load of the processor and will therefore suffer jitter.
Warning
The PCX feature takes precedence over the PJ1939 feature. If you configure the PCX
feature to receive a J1939 frame, the PJ1939 feature will not see the frame, and it
will not be processed by the platform. This especially causes problems when receiving
J1939 DM14 'Boot Load' commands.
6.1.14.4. Inports
• sim_error_flag
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport error_flag in simulation.
• sim_rx_trig_flag
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport rx_trig_flag in simulation.
Calibratable: No
• sim_overrun_flag
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport overrun_flag in simulation.
• sim_timestamp
A dummy input for simulation purposes only; may be grounded if not required. The value
of the output timestamp in simulation. Only available if the mask parameter Provide
Timestamp is selected.
6.1.14.5. Outports
• error_flag
Set to 1 if some error has occurred which prevents CAN reception, or 0 otherwise.
• rx_trig_flag
Set to 1 if this message has been received at this iteration, or 0 otherwise. This flag will be
set even if the received message length differs from the expected length.
• overrun_flag
Set to 1 if more than one message with the same CAN message identifier has been
received in one model iteration, or 0 otherwise. If more than one message has been
received, the data from the latest message is used.
• timestamp
A low accuracy time stamp of when the message was last received as indicated by
rx_trig_flag, or zero if the message has never been received. The time stamp is a free
running microsecond timer, which wraps to zero at its maximum (rather than saturating).
Only available if the mask parameter Provide Timestamp is selected.
• Message Identifier
• Message Length
A vector of bit numbers indicating the position at which each input Item begins in the CAN
message. 0 corresponds to the least significant bit of data byte 0 of the message and 63
to the most significant byte of data byte 7 of the message, assuming these exist. For items
whose bit length entry exceeds 7, the bit length must be one of: 0, 8, 16, 24, 32, 40, 48, 56.
Range: [0, 8], 16, 24, 32, 40, 48, 56 bit positions
• Field Widths
A vector of bit lengths indicating the number of bits used to transmit each input Item. The
following values are allowed: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 24 and 32.
Items of 8 bits or fewer may not be defined so as to straddle CAN byte boundaries.
• Field Signs
A vector of 1 or 0 values. Corresponding data items for which this is set 1 are received as
twos-complement signed numbers, or unsigned numbers otherwise.
Range: 0 or 1
• Type Codes
This block provides one data field input for each element in Field Start Positions, as follows:
• Field Mnemonics
A string containing a comma-separated list of names with which to label the simulation
input and CAN data output ports.
• Sample time
If box is checked the 29 bit identifier is to be used, otherwise the 11 bit standard identifier
is to be used.
• Provide Timestamp
If selected then inport sim_timestamp and outport timestamp are made available.
If selected then dummy inputs for each of the outport can message signals, such as
sim_signal_name, are provided by the block.
6.1.14.7. Notes
• Unused signals in a CAN message need not be specified in the Field Start Bit Positions
parameter.
• Not all OpenECU modules have both CAN buses populated (see Section A.1, “ECU
hardware reference documentation” for details about each device).
• The signal data outports are updated any time a message is received as indicated by
rx_trig_flag. If the error_flag outport is asserted due to a mismatch in message size, the
data outports will contain potentially erroneous data from the incorrectly sized message.
It is recommended that the application software latch the values of all CAN signals only
when rx_trig_flag is set and error_flag is not set.
• If the block shows unnamed outports, it is likely that one or more of the block fields is
incorrect. Check the fields for mistakes and correct them.
• The restrictions involving alignment of data items with 8 or more bits can be overcome
by combining the smaller data items from the CAN message into larger data items using
some Simulink math blocks, or by using the pcx_CANdb_ReceiveMessage block.
• All data is unpacked in Motorola byte ordering (MS byte first, LS byte last). The order
of byte unpacking can be overcome by combining the smaller data items from the
CAN message into larger data items using some Simulink math blocks, or by using the
pcx_CANdb_ReceiveMessage block.
• Providing fewer than 8 entries in the Field Mnemonics parameter will result in some ports
not being named. Providing greater than 8 entries in the Field Mnemonics parameter will
result in corruption in the mask displayed on the block. This is a display artifact only and
in both cases the port signals will still function as normal.
6.1.15.3. Description
Message ID : decimal
Length : bytes
Field Start Positions : [ ]
Field Widths : [ ]
sim_ error_ flag Field Signs : [ ] error_ flag
Field Type Codes: [ ]
Bus ID: CAN ( pin A23+A24)
Use Extended ID: off
Provide Simulation Output : off
pcx_ CANTransmitMessage
When a message is to be transmitted, the block packs each of the signal inports into the
message, as specified by the block mask parameters, and transmits the message.
6.1.15.4. Inports
• sim_error_flag
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport error_flag in simulation.
• sim_request_count
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport request_count in simulation. Only available if the mask parameter Provide
Transmission Status is selected.
• sim_overwrite_count
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport overwrite_count in simulation. Only available if the mask parameter Provide
Transmission Status is selected.
• sim_ack_count
A dummy input for simulation purposes only; may be grounded if not required. The
value of outport ack_count in simulation. Only available if the mask parameter Provide
Transmission Status is selected.
6.1.15.5. Outports
• error_flag
Set to 1 if some error has occurred which prevents CAN transmission, otherwise set to 0.
• request_count
A free running count of the application requests to transmit a message. The counter wraps
to zero after reaching 65535. Only available if the mask parameter Provide Transmission
Status is selected.
• overwrite_count
A free running count of transmission requests which were queued by the software for later
transmission because the CAN controller could not immediately accept the message for
transmission. A queued message can be overwritten by subsequent attempts to transmit
the same message (for instance, if the CAN bus is heavily loaded and the transmission rate
high, the CAN controller may not be able to transmit the message before the application
requests it is sent again, possibly with different data control from the previous request). The
counter wraps to zero after reaching 65535. Only available if the mask parameter Provide
Transmission Status is selected.
• ack_count
A free running count of message transmissions successfully made by the CAN controller
(i.e., those transmit messages which were acknowledged by at least one CAN node on the
bus, not including the transmitting node). The counter wraps to zero after reaching 65535.
Only available if the mask parameter Provide Transmission Status is selected.
• Message Identifier
• Message Length
A vector of bit numbers indicating the position at which each input Item begins in the CAN
message. 0 corresponds to the least significant bit of data byte 0 of the message and 63
to the most significant byte of data byte 7 of the message, assuming these exist. For items
whose bit length entry exceeds 7, the bit length must be one of: 0, 8, 16, 24, 32, 40, 48, 56.
Range: [0, 8], 16, 24, 32, 40, 48, 56 bit positions
• Field Widths
A vector of bit lengths indicating the number of bits used to transmit each input Item. The
following values are allowed: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 24 and 32.
Items of 8 bits or fewer may not be defined so as to straddle CAN byte boundaries.
• Field Signs
A vector of 1 or 0 values. Corresponding data items for which this is set 1 are transmitted
as twos-complement signed numbers, or unsigned numbers otherwise.
Range: 0 or 1
• Type Codes
This block provides one data field input for each element in Field Start Positions, as given
in Table 6.2, “CAN block type codes”.
• Field Mnemonics
A string containing a comma-separated list of names with which to label the simulation
input and CAN data output ports.
If box is checked the 29 bit identifier is to be used, otherwise the 11 bit standard identifier
is to be used.
If selected then dummy outputs for each of the inport can message signals, such as
sim_signal_name, are provided by the block.
6.1.15.7. Notes
• Unused signals in a CAN message need not be specified in the Field Start Bit Positions
parameter.
• Not all OpenECU modules have both CAN buses populated (see Section A.1, “ECU
hardware reference documentation” for details about each device).
• If the block shows unnamed inports, it is likely that one or more of the block fields is
incorrect. Check the fields for mistakes and correct them.
• The restrictions involving alignment of data items with 8 or more bits can be overcome
by combining the smaller data items from the CAN message into larger data items using
some Simulink math blocks, or by using the pcx_CANdb_TransmitMessage block.
• All data is packed in Motorola byte ordering (MS byte first, LS byte last). The order
of byte packing can be overcome by combining the smaller data items from the CAN
message into larger data items using some Simulink math blocks, or by using the
pcx_CANdb_TransmitMessage block.
• Providing fewer than 8 entries in the Field Mnemonics parameter will result in some ports
not being named. Providing greater than 8 entries in the Field Mnemonics parameter will
result in corruption in the mask displayed on the block. This is a display artifact only and
in both cases the port signals will still function as normal.
6.1.16.3. Description
When a matching message to this block is received, the block unpacks the message contents
into individual signals, as specified by the CANdb information, and provides them as outports
in engineering units.
A CANdb file is a database of information regarding CAN nodes and CAN bus messages
(more information regarding this format can be found by visiting the web site of Vector
CANtech, Inc.). The database is edited using custom tools which make creation and
maintenance of message information easier.
For each message, the database stores information like the message identifier, whether the
identifier is standard or extended, what signals the message contains, etc.. For each signal,
the database stores the start bit position, the bit length, bit ordering etc.. This block provides
access to this information using the textual names assigned in the database, making the
blocks easier to create and maintain (in contrast to the pcx_CANReceiveMessage block).
The block can provide a time stamp of when the message was received (see block mask
parameter Provide Timestamp). The time stamp is a low accuracy time stamp, taken a short
period of time after the message is received. That period of time is variable depending on
the load of the processor and will therefore suffer jitter.
Warning
The PCX feature takes precedence over the PJ1939 feature. If you configure the PCX
feature to receive a J1939 frame, the PJ1939 feature will not see the frame, and it
will not be processed by the platform. This especially causes problems when receiving
J1939 DM14 'Boot Load' commands.
6.1.16.4. Inports
• sim_error_flag
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport error_flag in simulation.
• sim_rx_trig_flag
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport rx_trig_flag in simulation.
• sim_overrun_flag
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport overrun_flag in simulation.
• sim_timestamp
A dummy input for simulation purposes only; may be grounded if not required. The value of
outport timestamp in simulation. Only available if the mask parameter Provide Timestamp
is selected.
• sim_checksum_err
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport checksum_err in simulation. Only available if the mask parameter Checksum
Type is not None.
6.1.16.5. Outports
• error_flag
Set to 1 if some error has occurred which prevents CAN reception, or 0 otherwise.
• rx_trig_flag
Set to 1 if this message has been received at this iteration, or 0 otherwise. This flag will be
set even if the received message length differs from the expected length.
• overrun_flag
Set to 1 if more than one message with the same CAN message identifier has been
received in one model iteration, or 0 otherwise. If more than one message has been
received, the data from the latest message is used.
• timestamp
A low accuracy time stamp of when the message was last received as indicated by
rx_trig_flag, or zero if the message has never been received. The time stamp is a free
running microsecond timer, which wraps to zero at its maximum (rather than saturating).
Only available if the mask parameter Provide Timestamp is selected.
• checksum_err
Set TRUE if the most recently received message failed checksum validation or FALSE
otherwise. Only available if the mask parameter Checksum Type is not None.
• CANdb file
The name of the CANdb file, including extension. A path may be included, either relative or
absolute, however the directory containing the file must be on the MATLAB search path. If
more than one file has a matching (partial) path and filename, precedence is given firstly
to the current MATLAB directory and then to the first location on the MATLAB search path.
Only textual CANdb files are accepted (see restrictions in the notes section below).
• Message Name
The name of the message to receive. The name must be specified in the CANdb file
and must match case (e.g., message name EngineRPM is different from message name
enginerpm).
• Signal Names
A comma separated list of signal names to unpack from the message (e.g.,
"name1,name2" without the quotes). An empty list of names to unpack is supported, in
which case the block shows no additional outports. This mode can be used to detect
the presence of a message on the CAN bus without decoding any of the CAN message
contents.
If selected then all signals from the message are created as outports (similarly simulation
inports if required), if unselected then only those signals in the signal names field are
created as outports.
If this field is ticked and the dialog closed, next time this field is unticked, the signal names
field will contain the complete list of signals. This mechanism is useful when filling in the
dialog for the first time but you are unsure of the field names (e.g., open block, fill in CANdb
file name, message name, CAN bus and sample time, then tick this field, close the dialog,
then select the block again, untick this field, then edit the list of required signals).
If selected, a second set of outports are created for the message signals, each set to the
raw integer value extracted from the CAN message prior to being scaled into engineering
units.
The raw values are always reported as unsigned integers. If the CANdb signal is signed,
then the application is responsible for conversion into a signed value. 32-bit signals may
be converted by casting. Signals less than 32-bits must be sign extended to 32-bits prior
to casting.
If selected, each outport (except for the raw signal outports) is clipped to the limits for that
signal defined by the CANdb file.
If selected then each of the can message outport signals (and simulation inport signals)
show their engineering units, if the CANdb file defines those units.
• Sample time
• Provide Timestamp
If selected then inport sim_timestamp and outport timestamp are made available.
• Checksum Type
A drop-down selection of the type of checksum to expect in the last raw message byte,
computed over all of the preceding raw bytes in the message (even if they are not used
by any signals). The default is None, and the other currently supported option is the 8-
bit CRC defined by SAE-J1850. If used, the outport checksum_err is filled accordingly. In
simulation, the value from inport sim_checksum_err is passed through.
If selected then dummy inputs for each of the outport can message signals, such as
sim_signal_name, are provided by the block.
6.1.16.7. Notes
• Unused signals in a CAN message need not be specified in the Signal Names parameter.
• Not all OpenECU modules have both CAN buses populated (see Section A.1, “ECU
hardware reference documentation” for details about each device).
• The signal data outports are updated any time a message is received as indicated by
rx_trig_flag. If the error_flag outport is asserted due to a mismatch in message size, the
data outports will contain potentially erroneous data from the incorrectly sized message.
It is recommended that the application software latch the values of all CAN signals only
when rx_trig_flag is set and error_flag is not set.
• If the block does not show expected signals as outports, it is likely that one or more of the
block fields is incorrect. Check the fields for mistakes and correct them.
• Vector do not release the file format of CANdb files, so this block reads CANdb files as
best it can. When reading the CANdb file, if it cannot understand the file format, the block
will not show the request outports. Update the diagram to find out what the problem is.
• If the block does not show the signal outports expected, there is probably a mistake in
the CANdb file name or one of the signal names. Update the diagram to find out what the
error is.
• The CANdb blocks do not support extended signal multiplexing. If extended signal
multiplexing is present in the CANdb file, then the block will not be able to interpret the file.
• The CANdb blocks do not support signals defined in the CANdb file as signal type "double"
• The CANdb blocks do not support CANdb messages without signals. For these messages,
use the pcx_CANReceiveMessage block.
• Due to the internal design of the CANdb blocks, a loss of precision may occur when dealing
with integer values greater than 23 bits in size. This error increases as the value of the
signal increases beyond this limit. If integer precision is required, it is recommended that
the raw signal outports be used and for any scaling/offset specified in the DBC to be
implemented by the application.
6.1.17.3. Description
CANdb file :
Message name :
sim_ error_ flag Bus ID: CAN ( pin A23+A24) error_ flag
Checksum in last byte: None
Provide simulation output : off
When a message is to be transmitted, the block encodes each of the signal inports into the
message, as specified by the CANdb information, and transmits the message.
A CANdb file is a database of information regarding CAN nodes and CAN bus messages
(more information regarding this format can be found by visiting the web site of Vector
CANtech, Inc.). The database is edited using custom tools which make creation and
maintenance of message information easier.
For each message, the database stores information like the message identifier, whether the
identifier is standard or extended, what signals the message contains, etc.. For each signal,
the database stores the start bit position, the bit length, bit ordering etc.. This block provides
access to this information using the textual names assigned in the database, making the
blocks easier to create and maintain (in contrast to the pcx_CANTransmitMessage block).
Warning
In some cases, the CAN database will contain messages with multiplexed signals (more
than one signal is defined in a message with the same bit position and length). In order
to use such a message, the user must pre-select only one of the signals to transmit.
To do this, refer to Input All Message Signals?.
6.1.17.4. Inports
• sim_error_flag
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport error_flag in simulation.
• sim_request_count
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport request_count in simulation. Only available if the mask parameter Provide
Transmission Status is selected.
• sim_overwrite_count
A dummy input for simulation purposes only; may be grounded if not required. The value
of outport overwrite_count in simulation. Only available if the mask parameter Provide
Transmission Status is selected.
• sim_ack_count
A dummy input for simulation purposes only; may be grounded if not required. The
value of outport ack_count in simulation. Only available if the mask parameter Provide
Transmission Status is selected.
6.1.17.5. Outports
• error_flag
Set to 1 if some error has occurred which prevents CAN transmission, otherwise set to 0.
• request_count
A free running count of the application requests to transmit a message. The counter wraps
to zero after reaching 65535. Only available if the mask parameter Provide Transmission
Status is selected.
• overwrite_count
A free running count of transmission requests which were queued by the software for later
transmission because the CAN controller could not immediately accept the message for
transmission. A queued message can be overwritten by subsequent attempts to transmit
the same message (for instance, if the CAN bus is heavily loaded and the transmission rate
high, the CAN controller may not be able to transmit the message before the application
requests it is sent again, possibly with different data control from the previous request). The
counter wraps to zero after reaching 65535. Only available if the mask parameter Provide
Transmission Status is selected.
Calibratable: No
• ack_count
A free running count of message transmissions successfully made by the CAN controller
(i.e., those transmit messages which were acknowledged by at least one CAN node on the
bus, not including the transmitting node). The counter wraps to zero after reaching 65535.
Only available if the mask parameter Provide Transmission Status is selected.
• CANdb file
The name of the CANdb file, including extension. A path may be included, either relative or
absolute, however the directory containing the file must be on the MATLAB search path. If
more than one file has a matching (partial) path and filename, precedence is given firstly
to the current MATLAB directory and then to the first location on the MATLAB search path.
Only textual CANdb files are accepted (see restrictions in the notes section below).
• Message Name
The name of the message to transmit. The name must be specified in the CANdb file
and must match case (e.g., message name EngineRPM is different from message name
enginerpm).
• Signal Names
A comma separated list of signal names to pack into the message (e.g., "name1,name2"
without the quotes). An empty list of names is supported, in which case the block shows
no additional outports.
If selected then all signals from the message are created as inports (similarly simulation
outports if required), if unselected then only those signals in the signal names field are
created as inports.
If this field is ticked and the dialog closed, next time this field is unticked, the signal names
field will contain the complete list of signals. This mechanism is useful when filling in the
dialog for the first time but you are unsure of the field names (e.g., open block, fill in CANdb
file name, message name and CAN bus, then tick this field, close the dialog, then select
the block again, untick this field, then edit the list of required signals).
If selected then each of the can message inport signals (and simulation outport signals)
show their engineering units, if the CANdb file defines those units.
• Checksum type
A drop-down selection of the type of checksum to apply to the last raw byte in the message,
computed over all of the preceding raw bytes in the message (even if they are not used
by any signals). The default is None, and the other currently supported option is the 8-bit
CRC defined by SAE-J1850.
If selected then dummy outports for each of the outport can message signals are provided
by the block.
6.1.17.7. Notes
• Unused signals in a CAN message need not be specified in the Signal Names parameter.
• Not all OpenECU modules have both CAN buses populated (see Section A.1, “ECU
hardware reference documentation” for details about each device).
• If the block does not show expected signals as inports, it is likely that one or more of the
block fields is incorrect. Check the fields for mistakes and correct them.
• Vector do not release the file format of CANdb files, so this block reads CANdb files as
best it can. When reading the CANdb file, if it cannot understand the file format, the block
will not show the request inports. Update the diagram to find out what the problem is.
• If the block does not show the signal inports expected, there is probably a mistake in the
CANdb file name or one of the signal names. Update the diagram to find out what the
error is.
• The CANdb blocks do not support extended signal multiplexing. If extended signal
multiplexing is present in the CANdb file, then the block will not be able to interpret the file.
• The CANdb blocks do not support signals defined in the CANdb file as signal type "double"
• The CANdb blocks do not support CANdb messages without signals. For these messages,
use the pcx_CANTransmitMessage block.
• Due to the internal design of the CANdb blocks, a loss of precision may occur when dealing
with integer values greater than 23 bits in size. This error increases as the value of the
signal increases beyond this limit. If integer precision is required, it is recommended that
the pcx_CANTransmitMessage block be used and for any scaling/offset specified in the
DBC to be implemented by the application.
6.1.18.3. Description
can0_ bus_ off
Sample time : seconds
Provide simulation input : off
can1_ bus_ off
Provide the bus off state of each CAN bus as an outport. A CAN bus goes bus off
when sufficient errors have been detected by the CAN transceiver. See the Bosch CAN
specification from their web site (http://www.can.bosch.com) or the ISO specification for more
details.
When CAN bus off condition is detected, CAN transmission activity is suspended. A
transmission is then tempted periodically in order to check whether bus off condition has
been resolved. After bus off condition is resolved, transmission resumes as normal.
6.1.18.4. Inports
• sim_can0_bus_off
Only used during simulation. Set to 1 to simulate a CAN bus off state for CAN bus 0, zero
otherwise. Only available if the mask parameter Provide simulation input is checked.
• sim_can1_bus_off
Only used during simulation. Set to 1 to simulate a CAN bus off state for CAN bus 1, zero
otherwise. Only available if the mask parameter Provide simulation input is checked.
6.1.18.5. Outports
• can0_bus_off
• can1_bus_off
• Sample time
If selected then simulation inputs for each of the can bus off outports are provided by the
block.
6.1.18.7. Notes
• Not all OpenECU modules have both CAN buses populated (see Section A.1, “ECU
hardware reference documentation” for details about each device).
This block became deprecated in version 1.8.4 and will be removed in a future version of
the software. Please change to use the Section 6.1.12, “CAN bus status (pcx_BusStatus)”
block.
6.1.19.3. Description
CAN receive: 1785
ID
CAN transmit: 1784
ID
CAN station address
:0
CAN bus: ID
CAN
(pin A23+A24)
CCP enabled
: on
pcp_ CCPConfiguration
The CAN Calibration Protocol (CCP) is a CAN based messaging system designed to allow
tools to access information in real-time. For more details, refer to ASAM Standards: ASAM
MCD: MCD 1a at the ASAM Web site (http://www.asam.de).
This block configures OpenECU's CCP settings. The user can choose the transmit and
receive CAN message identifiers, the CCP station address and the CAN bus communications
will take place over. The block also configures whether CCP communications can take place
when the ECU is in application mode running the model.
If the block is absent from the model, CCP communications is disabled when the model is
running. CCP communications are still possible when OpenECU is being reprogrammed.
6.1.19.4. Inports
None.
6.1.19.5. Outports
None.
Range: [0, 2047] or [0, 536870911] when Use CRO extended ID? (29 bit) is selected.
Range: [0, 2047] or [0, 536870911] when Use DTO extended ID? (29 bit) is selected.
• Station address
The station address for CCP sessions. OpenECU will only communicate using CCP if a
session is opened using this station address. This feature is often used for connecting
multiple CCP devices to the same CAN bus using the same CRO and DTO identifiers.
If checked, then CCP communications is enabled while the model is running. If unchecked,
CCP communications is disabled while the model is running. In either case, CCP
communications is enabled when reprogramming OpenECU.
Warning
By not checking this option, reprogramming mode can only be entered with FEPS
applied. The ECU will not be able to be re-flashed without FEPS.
If checked, then 29 bit CAN identifiers for CCP receive messages will be supported the
range being [0, 536870911]. If unchecked, then CCP will support 11 bit CAN identifiers
the range being [0, 2047].
If checked, then 29 bit CAN identifiers for CCP transmit messages will be supported the
range being [0, 536870911]. If unchecked, then CCP will support 11 bit CAN identifiers
the range being [0, 2047].
6.1.19.7. Notes
• CCP communications can only be configured for one CAN bus. OpenECU does not support
CCP on more than one CAN bus.
• It is possible to connect OpenECU to a CAN bus with other nodes that also communicate
using CCP (including other OpenECU devices):
CAN bus
CCP device
OpenECU (possibly another
OpenECU)
Here, both devices use different CRO and DTO message identifiers. This is enough to
uniquely identify each device. Note that although each device has a station address of
zero, because all CRO and DTO identifiers are unique, the station addresses could be
any value.
CAN bus
CCP device
OpenECU (possibly another
OpenECU)
Here, both devices use the same CRO and DTO message identifiers so the station address
is used to distinguish between CCP devices.
Section B.3.3, “Configuring two OpenECUs on the same CAN bus with ATI Vision” details
how to connect ATI Vision and two ECUs for the first time. The procedure is similar for
other tools.
• If no configuration block exists in the model, CCP communications are disabled when the
model is running. When reprogramming, the following default settings are used:
• If a configuration block exists in the model but CCP communications are disabled then
when reprogramming, the CCP settings from the configuration block are used.
• If the hardware does not support the CAN bus selected, CCP communications will cease
while the model is running and while reprogramming. In this case, the OpenECU device
must be returned to Pi for reconditioning.
• The platform software supports version 2.1 of the CCP standard (Table F.1, “Supported
CCP commands” shows which commands are implemented).
Warning
OpenECU does not adhere to all the message timing characteristics listed by the
CCP standard all the time (especially when the model being run pushes the CPU
loading closer to 100%). Some calibration tools may raise an error or warning if it
does not receive a rely to a command within a time
• If the OpenECU module is not communicating to the calibration tool after a recently build
model is flashed onto the ECU, then try following Appendix G, CCP troubleshooting guide
to recover the ECU.
6.1.20.3. Description
Name : ''
Desc: ''
Size :
Rate : (sec)
pcp_ RasterConfig
The CAN Calibration Protocol (CCP) is a CAN based messaging system designed to allow
tools to access information in real-time. For more details, refer to ASAM Standards: ASAM
MCD: MCD 1a at the ASAM Web site (http://www.asam.de).
Calibration tools can request the ECU transmit data on a periodic basis. OpenECU supports
grouping data into at most 8 data acquisition lists (DAQs). The size and rate of each of these
DAQs can be adjusted by this block.
Note
If there are no pcp_RasterConfig blocks in the application then the following default
configuration is applied.
M220 M670
M221
M250
M460
M461
Rate (milliseconds) Size Size
10 15 30
100 15 30
200 15 30
1000 15 30
6.1.20.4. Inports
None.
6.1.20.5. Outports
None.
• Name
A unique name for the CCP DAQ raster. The name is written to the ASAP2 file and used
by the calibration tool to identify the raster.
• Description
• Size
The number of ODTs for the CCP DAQ raster. The total number of ODTs across
pcp_RasterConfig blocks must not exceed the range given below. For instance, on the
M670, it is permissible to have two pcp_RasterConfig blocks each with a size of 127. But
adding a third pcp_RasterConfig with a size of 1 brings the total to 255, which exceeds
the limit.
• Transmission rate
The suggested period between transmission of the CCP DAQ raster. Some calibration
tools will use the suggested period (e.g., INCA) whilst other calibration tools will ignore the
suggest period and allow the user to vary the transmission rate on the fly (e.g., Vision).
One of 0.005, 0.010, 0.030, 0.050, 0.100, 0.200, 0.500, 1.000 seconds
6.1.20.7. Notes
None.
6.1.21.3. Description
pcp_ CCPSecurity
To ensure that CCP seed/key security is also used during reprogramming mode, the functions
used to generate the seed (if required) and validate the key are copied to non-volatile storage
by the application. The reprogramming mode software retrieves the functions from non-
volatile storage, and copies them to RAM for execution.
There are three CCP privilege levels: calibration, data acquisition, and programming. These
privilege levels can be individually enabled or disabled. For instance, it is possible to enable
reprogramming access whilst calibration and data acquisition access remains disabled. The
calibration tool may impose further restrictions on how levels can be accessed.
privilege_level specifies the privilege level for which a seed is being requested.
Values are fixed by the CCP standard as:
seed is a four-byte array. This will initially contain values generated by a 32-bit random
number algorithm within the OpenECU platform. The seed generator function may
choose to leave these values intact, or may choose to set its own values in the seed
array.
privilege_level specifies the privilege level for which a seed is being requested.
seed is a four-byte array containing the last seed value passed to the calibration tool.
key is an array of up to six bytes whose length is specified by key_size. This contains
the key passed back by the calibration tool.
The CCP 2.1 specification for the CCP_UNLOCK command has a six-byte field for the
key, although in practice most implementations only use four bytes. The contents of the
remaining bytes are often undefined, so the key validator must take care to match the
expected seed-key algorithm.
The function must return TRUE if the key is valid for the seed, or FALSE if it is not.
It is frequently the case that seed/key functions are supplied only as object or library
code for security reasons, in which case the file must have been compiled without
PowerPC variable bit length (VLE) instructions.
6.1.21.4. Inports
None.
6.1.21.5. Outports
None.
The CAN bus for which CCP security will be implemented. A pcp_CCPConfiguration block
must also exist in the design which configures CCP for this CAN bus. If this does not exist,
an error will be reported.
• Security required
Whether CCP seed/key security is required for this CCP privilege level.
Calibratable: No
If required, the name of the C function which generates the seed value. If this is not
specified, a random 4-byte value will be generated by the OpenECU platform and used
as a seed instead.
The name of the C function which validates the key value transmitted by the calibration
tool. If this is not specified, an error will be reported.
If required, the name of the DLL supplying the key generation algorithm for the calibration
tool. This will typically only be required if the RTW build is required to generate ASAP2
(A2L) files to configure the calibration tool. If this is not specified, security will not be
configured in the A2L files, although typically the user will still be able to configure security
manually from within the calibration tool.
If required, the name of the function within the DLL supplying the key generation algorithm.
If unspecified, this will default to using the ASAP1A/ASAP2 standard function name
ASAP1A_CCP_ComputeKeyFromSeed. Note that some calibration tools do not permit the
function name to be specified; see the relevant section for the calibration tool to be used
for further details.
Whether the ECU should ignore security algorithms when reprogramming mode is entered
as a result of the module powering up with FEPS applied.
This option allows a security algorithm to be tested without the risk of putting the ECU in a
state where it cannot be reprogrammed. Otherwise, an error in the security algorithm will
necessitate returning the ECU to Pi for servicing.
6.1.21.7. Notes
The file(s) containing seed generator and key validator functions must be referenced by the
model. In Simulink, select the "Custom Code" option (found alongside other code generation/
RTW model build options; the menu item depends on MATLAB version). If these functions
are provided as uncompiled C, add the files to the list of "Include list of additional: Source
files". If these functions are provided as precompiled object or library files (as is frequently
done for security reasons), add them to the list of "Include list of additional: Libraries". RTW
will then compile (if necessary) and link these files as part of the build.
Note that if incorrect function names are specified for seed generator or key validator
functions, if the functions do not have the correct prototype, or if the relevant files are not
compiled/linked in the model, then the build will fail at the link stage. If this occurs, check that
function names and file names are specified correctly.
6.1.22.3. Description
Inhibit
inhibit
Reprogramming
pcp_ CCPInhibitReprogramming
It is often useful to be able to disallow reprogramming of the module when performing certain
actions, e.g., controlling an engine. Use this block to specify when reprogramming is allowed.
When disallowed, the following CCP operations will not be honoured (but other implemented
CCP operations are; see Table F.1, “Supported CCP commands” for a complete list of
supported CCP commands):
Warning
If the application is configured to inhibit reprogramming it may require the module to
be powered up with FEPS applied in order to re-flash the module.
6.1.22.4. Inports
• inhibit
6.1.22.5. Outports
None.
6.1.22.7. Notes
This block replaces the previous mechanism for inhibiting reprogramming via the automatic
ASAP2 entry mpl_inhibit_reprog. This ASAP2 entry is no longer available.
6.1.23.3. Description
Sample time : seconds
sim_ count rx_ count
Provide simulation input : on
pcp_ CCPRxCount
The platform CCP drivers keep track of various statistics, including the number of CRO
messages received by the driver.
6.1.23.4. Inports
• sim_count
Only used during simulation. The value of this inport will be passed to rx_count. Only
available if the mask parameter Provide simulation input is checked.
6.1.23.5. Outports
• rx_count
The number of CRO messages this module has received since the last reset. This value
will wrap around when 2^32 messages have been received.
• Sample time
6.1.23.7. Notes
6.1.24.3. Description
pcomp_ CompileOptions
After RTW has generated code for a model, a compiler converts the code into a binary image
suitable for the ECU to execute. Which compiler to use is chosen through the RTW Compiler
Selection option.
The compiler converts the model code into a binary image using various transformations,
some of which can be modified via command line options to the compiler. The
pcomp_CompileOptions block selects whether to use the default compiler options supplied
with OpenECU, to add additional options to the default options, or to replace the default
options altogether.
Warning
Alteration of the compiler options may lead to a model which fails to build, or a model
which will not run on the target ECU or which may run initially but fail later on. When
reporting a failure through technical support, please specify any changed compiler
options as this may help resolve the issue more quickly.
Diab 5.5.1.0
The default compiler options for the WindRiver Diab 5.5.1.0 compiler are:
Option Use
-c produce an object file only — do not attempt to link (OpenECU
compiles each source file separately, then links each together,
this is a required option)
-DREAL_T=float define RTW's real_T to be of 'float' type — this matches the
hardware most closely and provides good performance,
switching to 'double' will cause library incompatibility and slow
down the model significantly
-g3 generate debug information as much as possible given the
optimisations selected
-O turn on the compiler optimiser to reduce the binary image size
and increase the run time efficiency
-ew1551 suppress errors about volatile qualification mismatch between
RTW functions and calibrations
-Xaddr- ask the compiler to address all small data objects using
sconst=0x11 absolute addressing (i.e., not relative addressing via r2 or r13)
because the address range of the calibration data is too large
for relative addressing — defensive measure only; not strictly
necessary because the -Xsmall-const option makes sure no
data object is classed as small.
-Xbss-common- ask the compiler to ensure that there is only one declaration of
off a variable (without initialisation) — ensure there are no separate
objects for the same variable in different modules
-Xdouble-avoid ask the compiler to generate 32-bit floating point constants
rather than 64-bit floating point constants to reduce size and
increase run time efficiency
Option Use
-Xenum-is-int ensure that C and C++ objects link using the same data type
for enumerations — although not strictly necessary (and
OpenECU does not yet support C++ code), it may be an issue
for customer linked code
-Xforce- lint like option to ensure all functions have been declared with
prototypes a prototype — i.e., ensure we don't fall into the trap of implicit
function declarations which don't match the actual function
declaration
-Xieee754- request that the compiler match, as closely as possible, the
pedantic IEEE754 floating-point specification
-Xkeep- ask the compiler to keep the binary image representation —
assembly-file useful for diagnosing compiler problems
-Xkeywords=0x08 allow the use of the non-standard packed keyword to achieve
better use of memory in some data structures
-Xkill- avoid a bug in some versions of the Diab C compiler which
reorder=0x08 incorrectly applies peep-hole optimisation to instructions which
should not be transposed in the binary image
-Xmin-align=1 allow the compiler to place some packed data on address
boundaries which are not natural for some data types
-Xname- ask the compiler to place all calibration variables in the same
const=.cal_sec memory section for simple linking
-Xpass-source ask the compiler to output C source intermixed with the
assembly instructions — useful for diagnosing compiler
problems
-Xsmall-const=0 ask the compiler to avoid placing data objects in the small const
data area (see also, -Xaddr-sconst)
-Xstrict-eabi ensure the compiler does not generate stswi and lswi
instructions
-Xstsw-slow ensure correct calling procedure for architecture across different
object code — although not strictly required at the moment, this
defines the object interface for other object code that may be
linked to the final model e.g., custom code
-t... set to -tPPCE200Z3VEF for the M220 — selects the processor
for the target ECU
Diab 5.8.0.0
The default compiler options for the WindRiver Diab 5.8.0.0 compiler are the same as
Diab 5.5.1.0.
Diab 5.9.0.0
The default compiler options for the WindRiver Diab 5.8.0.0 compiler are the same as
Diab 5.5.1.0.
Option Use
-t... set to -tPPCE200Z3VEF for the M220, M221, M250, M460 and
M461 or set to -tPPCE200Z7VEF for the M670 — selects the
processor for the target ECU
GCC 4.7.3
Option Use
-c produce an object file only — do not attempt to link (OpenECU
compiles each source file separately, then links each together,
this is a required option)
-DREAL_T=float define RTW's real_T to be of 'float' type — this matches the
hardware most closely and provides good performance,
switching to 'double' will cause library incompatibility and slow
down the model significantly
-fkeep-static- emit variables declared static const when optimization isn't
consts turned on, even if the variables aren't referenced
-funsigned-char matching the default signed-ness of char for the Diab compiler
and the platform library files
-fno-common controls the placement of uninitialized global variables —
specifies that the compiler should place uninitialized global
variables in the data section of the object file, rather than
generating them as common blocks
-g3 generate debug information as much as possible given the
optimisations selected
-G 8 put global and static objects less than or equal to num bytes
into the small data or BSS sections instead of the normal data
or BSS sections. The default value of num is 8. The -msdata
option must be set to one of 'sdata' or 'use' for this option to
have any effect. All modules should be compiled with the same
-G num value. Compiling with different values of num may or
may not work — if it doesn't the linker gives an error message --
incorrect code is not generated.
-mcpu=e500mc selects the type of RX CPU to be targeted
-meabi align the stack to an 8-byte boundary
-memb set the PPC EMB bit in the ELF flags header to indicate that
'eabi' extended relocations are used
-mno- generate code that does not allow a static executable to be
relocatable relocated to a different address at run time. A simple embedded
PowerPC system loader should relocate the entire contents
of .got2 and 4-byte locations listed in the .fixup section, a table
of 32-bit addresses generated by this option
-mno- generates a .fixup section to allow static executables to be
relocatable-lib relocated at run time
-mregnames generate 'in', 'loc', and 'out' register names for the stacked
registers
-msdata put small initialized const global and static data in the '.sdata2'
section, which is pointed to by register r2. Put small initialized
non-const global and static data in the '.sdata' section, which
is pointed to by register r13. Put small uninitialized global and
static data in the '.sbss' section, which is adjacent to the '.sdata'
section
-O turn on the compiler optimiser to reduce the binary image size
and increase the run time efficiency
Option Use
-pass-exit- return with the numerically highest error produced by any phase
codes returning an error indication. The C front end returns 4 if an
internal compiler error is encountered
-x c use the C language when compiling
-Wno-attributes do not warn if an unexpected __attribute__ is used, such as
unrecognized attributes, function attributes applied to variables,
etc. This will not stop errors for incorrect use of supported
attributes
-Wa,-aln ask the compiler to keep the binary image representation —
useful for diagnosing compiler problems
All compilers
The build mechanism also adds the following compiler options. These options cannot
be changed.
Option Use
-D... various RTW required macro definitions
-DCFG_... defines the ECU the model is targeted at
-I... various include paths for source files (model based, RTW
based, compiler based and OpenECU based)
Note
Its outside the scope of this User Guide to explain all the different compiler options in
detail and their resulting affect on the ECU binary image. Please refer to appropriate
compiler User Guide for more information.
Note
Alteration of the compiler options may remove options which work around known bugs
in the compiler. For a list of known bugs which affect OpenECU, see Section 2.5.9.2,
“Known defects”, Section 2.5.10.2, “Known defects” and Section 2.5.11.2, “Known
defects”, Section 2.5.12.2, “Known defects”.
Note
Various settings must be confirmed before the compiler is accessible to OpenECU.
See the MATLAB command oe_check_compiler for more details.
6.1.24.4. Inports
None.
6.1.24.5. Outports
None.
• Mode
Whether to use the default compiler options, whether to add compiler options to the default
options, or whether to replace the default options altogether.
• Compiler options
The options to add to the default compiler options, or to replace the default options, as
selected by parameter Mode.
6.1.24.7. Notes
None.
6.1.25.3. Description
Double click to
configure model
using RTW- EC (ERT)
A utility block to switch the current active configuration set of RTW options for the RTW
Embedded Coder auto-coder. See Section 4.3.2, “Auto-coders” for more.
6.1.25.4. Inports
None.
6.1.25.5. Outports
None.
6.1.26.3. Description
Double click to
configure model
using RTW ( RTMODEL)
A utility block to switch the current active configuration set of RTW options for the RTW
RTMODEL auto-coder. See Section 4.3.2, “Auto-coders” for more.
6.1.26.4. Inports
None.
6.1.26.5. Outports
None.
6.1.27.3. Description
M 250 configuration
The pcfg_Config_M250 block configures pin A32, A33 and A34 to act as an injector output or
as a PWM output. If the pin is configured as a PWM output, then the block can also configure
the current trip level for each pin.
If the block is not present in a model, then the platform software configures pins A32, A33
and A34 as a PWM output with a current trip level of 5A during model initialisation.
6.1.27.4. Inports
None.
6.1.27.5. Outports
None.
The output type for pin A32, either injector output or PWM output.
The output type for pin A33, either injector output or PWM output.
The output type for pin A34, either injector output or PWM output.
6.1.27.7. Notes
If the block is not present in a model, then the platform software configures all pins as a PWM
output with a current trip level of 5A during model initialisation.
6.1.28.3. Description
M 460 configuration
The pcfg_Config_M460 block configures pin A31 to act as an injector output or as a PWM
output. If the pin is configured as a PWM output, then the block can also configure the current
trip level for pin A31.
If the block is not present in a model, then the platform software configures pin A31 as a
PWM output with a current trip level of 5A during model initialisation.
6.1.28.4. Inports
None.
6.1.28.5. Outports
None.
The output type for pin A31, either injector output or PWM output.
The current trip level above which the output will turn itself off, if the output has been
configured as PWM (the current trip level has no effect when the output is configured as
injector).
6.1.28.7. Notes
None.
6.1.29.3. Description
M 670 configuration
The pcfg_Config_M670 block configures pins Y20, Y21, and Y43 to set the resolution of
those frequency inputs.
If the block is not present in a model, then the platform software configures the pins to the
default slow clock setting.
• Medium Clock: 8.25Mhz timebase. For inputs 0.75 Hz to 2500 Hz with a minimum
resolution of at least 0.5 Hz
• Fast Clock: 16.5Mhz timebase. For inputs 1.6 kHz to 60 kHz with a minimum resolution
of at least 218 Hz.
6.1.29.4. Inports
None.
6.1.29.5. Outports
None.
6.1.29.7. Notes
None.
6.1.30.3. Description
level
Channel : AOT ( serial) (pin E 6)
Default level : sim_ level
Initial level :
fault
pax_ CcOutput
The constant current output block causes the channel pin to be driven to a requested current
given by the level inport at every block iteration.
6.1.30.4. Inports
• level
A value representing the percentage of the output current range to supply via the output
channel. For instance, if the output pin range is 0A to 2A, then a value of 0.5 at this inport
will request the hardware supply a constant current of 1A.
• fault
Place a 1 here to force the block to use the parameter Default level for the output, 0 to
use the inport level.
Range: 0 or 1
6.1.30.5. Outports
• sim_level
Only used in simulation. this outport is set to the requested current level (i.e., the inport
level or the parameter Default level depending on the inport fault).
• Channel
• Default level
This is the level for the constant current output when the fault inport is set to 1.
• Initial level
This is the level of the constant current output prior to when the block is first executed.
• Sample time
6.1.30.7. Notes
None.
6.1.31.3. Description
Channel : AOT ( serial) (pin E 6)
Frequency :
Offset: 0
Proportional coefficient : 0
Integral coefficient : 0
Dither steps: 0
Dither step size: 0
Sample time :
The current level is established with the pax_CcOutput block. Additional configuration
specific to the TLE8242-2 is provided by this block. The configuration is applied at every
block iteration.
6.1.31.4. Inports
None.
6.1.31.5. Outports
None.
• Channel
The desired frequency of the output. If the software cannot match the desired frequency,
the frequency will be adjusted to as close a match as is possible.
• Offset (ms)
The desired phase offset of the output relative to the TLE8242-2 phase sync signal. If the
offset is initialised to a non zero value, then the outputs will hold until the phase sync signal
is pulsed. The phase sync signal may be pulsed during runtime to syncronise outputs. If
the software cannot match the desired pulse offset, the offset will be adjusted to as close
a match as possible within 1/32 increments of the pulse period.
The desired proportional coefficient of the PI control loop that determines the duty cycle
of the constant current output. The supplied value is passed directly to the TLE8242-2 KP
register without scaling applied.
The desired integral coefficient of the PI control loop that determines the duty cycle of the
constant current output. The supplied value is passed directly to the TLE8242-2 KI register
without scaling applied.
• Dither steps
The desired number of dither steps per 1/4 waveform. If the software cannot match the
number of dither steps, the number of steps will be adjusted to as close a match as
possible.
The desired dither step size. If the software cannot match the desired dither step size, the
step size will be adjusted to as close a match as possible.
6.1.31.7. Notes
The current level and configuration for a channel should be set in the same task to ensure
data coherence.
The dither waveform is specified by the number of dither steps and the size of each step. Each
output pulse advances the dither waveform by one step. The following diagram demonstrates
the relationship between the pulse period, number of dither steps, and the dither step size.
Pulse Period
Pulse Output
Dither Step
Dither Waveform
¼ Dither Waveform
Setpoint
Pulse Start
Time
Each channel of the TLE8242-2 device includes a separate PI controller with programmable
gain values KP and KI. The Infineon TLE7242 KI KP Application note describes a method to
determine acceptable KP and KI values. A summary is included here; Please refer the the
Infineon application note for additional details.
Acceptable KP and KI values may be determined by modeling the control system with a linear
continuous time model.
VBAT
Supply voltage of the load.
Rc
Resistance of the load.
Lc
Inductance of the load measured at the pulse frequency.
Rsense
Sense resistance value. This value is determined by the OpenECU hardware. It is
100 mR for all outputs.
Fclk
Master clock frequency of the TLE8242-2 device. The frequency is set to 22 MHz
by the OpenECU platform.
FPWM
Pulse frequency of the output channel.
Calculate KP and KI
Calculate according to equations 4 and 5. If KP or KI is greater than 4095, then the
undamped natural frequency must be decreased.
6.1.32.3. Description
This block allow the application to initiate autozero of a TLE8242-2 device channel. The
channel will be zeroed over the next four pulse periods. The current setpoint must be set
to zero before triggering the autozero feature. TLE8242-2 channels cannot be autozeroed
in parallel.
6.1.32.4. Inports
• activate
A value of 1 at this inport will request the TLE8242-2 to initiate the autozero sequence for
the specified channel.
Range: 0 or 1
6.1.32.5. Outports
• complete
Range: 0 or 1
• Channel
6.1.32.7. Notes
Only one autozero block may be active at any time. If autozero is desired for multiple
channels, then the application must contain logic to schedule the activation of each block
appropriately.
6.1.33.3. Description
valid
min _ current
activate Channel : AOT ( serial) (pin E 6)
max_ current
avg_ current
This block allow the application to read the current measurement values of a TLE8242-2
channel. The measurement is updated at the end of the next dither period. TLE8242-2
channels cannot be measured in parallel.
6.1.33.4. Inports
• activate
A value of 1 at this inport will request the TLE8242-2 to initiate measurement for the
specified channel.
Range: 0 or 1
6.1.33.5. Outports
• valid
Range: 0 or 1
• min_current
This outport reports the minimum current measured during the dither period. The output
value is only valid while the valid output is asserted.
• max_current
This outport reports the maximum current measured during the dither period. The output
value is only valid while the valid output is asserted.
• avg_current
This outport reports the average current measured during the dither period. The output
value is only valid while the valid output is asserted.
• Channel
6.1.33.7. Notes
Only one current measurement block may be active at any time. If current measurement
is desired for multiple channels, then the application must contain logic to schedule the
activation of each block appropriately.
6.1.34.3. Description
transient_ state debounced _ state
put_ Debounce
This block debounces the transient state over a number of cycles to produce a steady state
output. The debounced state output only changes to reflect the transient state input if the
input has remained steady for a number of cycles.
Unlike other blocks, the debounce is expressed in block iterations, rather than a time period.
This makes the block more appropriate for debouncing state based signals than time based
signals.
6.1.34.4. Inports
• transient_state
6.1.34.5. Outports
• debounced_state
The debounced state. On the first iteration, the internal debounced state is set to the input
transient_state.
The number of block iterations (cycles) for which the input has to be steady before the
output follows it.
6.1.34.7. Notes
None.
6.1.35.3. Description
Table :
clear
pdtc_ ClearAll
For the DTCs with matching type to the parameter DTC type in the DTC table specified
by parameter DTC table identifier, this block sets the DTC state to clear. See the
pdtc_DiagnosticTroubleCode and pdtc_DiagnosticTroubleCodeExt blocks for details about
the states each type of DTC can have.
Freeze frame data associated with the cleared DTCs is also cleared. Monitor (DME and
DTE) data is also cleared other than persistent data which is never cleared (e.g. numerators
and denominators). As the platform does not know which DME/DTE objects are associated
with which DTCs in an application, it is assumed that the table being cleared applies to all
emissions-relevant monitors.
This is suitable for running in response to a J1939 DM11 request in OBD systems.
6.1.35.4. Inports
• clear
Set to 1 to force the state of each DTC, with matching type to that specified by parameter
DTC type, to clear. Otherwise, set to 0 for no change in DTC states.
6.1.35.5. Outports
None.
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
• DTC type
A drop-down selection of the type of DTC to act on in the DTC table specified by parameter
DTC table identifier.
6.1.35.7. Notes
None.
6.1.36.3. Description
Table :
clear
pdtc_ ClearAllIfActive
For the DTCs with matching type to the parameter DTC type in the DTC table specified by
parameter DTC table identifier, this block sets the DTC state to clear, if the DTC state is
currently active. See the pdtc_DiagnosticTroubleCode and pdtc_DiagnosticTroubleCodeExt
blocks for details about the states each type of DTC can have.
Freeze frame data associated with the DTCs cleared is also erased, but not monitor data.
6.1.36.4. Inports
• clear
Set to 1 to force the state of each DTC, with matching type to that specified by parameter
DTC type, to clear if it is currently active. Otherwise, set to 0 for no change in DTC states.
6.1.36.5. Outports
None.
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
• DTC type
A drop-down selection of the type of DTC to act on in the DTC table specified by parameter
DTC table identifier.
6.1.36.7. Notes
None.
6.1.37.3. Description
Table :
clear
pdtc_ ClearAllIfInactive
For the DTCs with matching type to the parameter DTC type in the DTC table specified
by parameter DTC table identifier, this block sets the DTC state to clear, if the DTC
Freeze frame data associated with the DTCs cleared is also erased, but not monitor data.
This is intended to be used in response to a J1939 DM3 request, which but the standard
warns that that service is not intended for clearing diagnostic data in regulated OBD products.
See also pdtc_ClearAll.
6.1.37.4. Inports
• clear
Set to 1 to force the state of each DTC, with matching type to that specified by parameter
DTC type, to clear if it is currently inactive. Otherwise, set to 0 for no change in DTC states.
6.1.37.5. Outports
None.
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
• DTC type
A drop-down selection of the type of DTC to act on in the DTC table specified by parameter
DTC table identifier.
6.1.37.7. Notes
None.
6.1.38.3. Description
active
active
lamp _ malfunction
SPN :
lamp _ red FMI : state
CM :
lamp _ amber
count
lamp _ protect
pdtc_ DiagnosticTroubleCode
A diagnostic trouble code (DTC) is a unique indicator used to remember the state of a fault.
The model determines if the conditions for signalling the fault are satisfied or not, and passes
this information to the pdtc_DiagnosticTroubleCode block. Whether the fault is active or not,
is maintained by the block while the model is running and across power cycles (see the
pdtc_Memory block for more details).
There is only one type of DTC at the moment, more may be added in the future.
J1939 DTC
The J1939 DTC maintains a fault state and a count of the how many times the DTC has
become active. The J1939 DTC states follow this state diagram:
if inport ‘active’ = 1
clear active
1 2
if inport ‘active’ = 0
if inport ‘active’ = 1
inactive
if inport ‘active’ = 0
The DTC starts in the clear state (or whichever state was recalled from non-volatile
memory during power up, see the pdtc_Memory block for more details), and remains in
this state until the inport active becomes 1. The block then changes the DTC state to
active and remains in this state until the inport active becomes zero. And so on.
Outwith this diagram pictured above, the DTC state can be forcefully set to
clear through the use of the pdtc_ClearAll block, or pdtc_ClearAllIfActive block, or
pdtc_ClearAllIfInactive block.
If the DTC cannot be recalled from non-volatile memory (which includes the first time the
ECU is powered up), then the J1939 DTC is initialised as follows:
6.1.38.4. Inports
• active
Set to 1 if the dtc is active, set to zero otherwise. Available only if the parameter DTC type
is J1939 DTC.
Range: 0 or 1
• lamp_malfunction
Set to desired lamp state (0 is Slow Flash, 1 is Fast Flash, 2 is On, 3 is Off). Available only
if the parameter DTC type is J1939 DTC.
Range: [0, 3]
• lamp_red
Set to desired lamp state (0 is Slow Flash, 1 is Fast Flash, 2 is On, 3 is Off). Available only
if the parameter DTC type is J1939 DTC.
Range: [0, 3]
• lamp_amber
Set to desired lamp state (0 is Slow Flash, 1 is Fast Flash, 2 is On, 3 is Off). Available only
if the parameter DTC type is J1939 DTC.
Range: [0, 3]
• lamp_protect
Set to desired lamp state (0 is Slow Flash, 1 is Fast Flash, 2 is On, 3 is Off). Available only
if the parameter DTC type is J1939 DTC.
Range: [0, 3]
6.1.38.5. Outports
• active.
Set to 1 if the dtc is in the active state, set to zero otherwise. Available only if the parameter
DTC type is J1939 DTC.
• state
Set to the value of the current DTC state (see the DTC types descriptions for a list of states
and values). Available only if the parameter DTC type is J1939 DTC.
• count
A count of the number of times a DTC has changed to the active state. Available only if
the parameter DTC type is J1939 DTC.
The name of the DTC table to store this DTC in (there must be a corresponding named
table specified in a pdtc_Table block in the model).
• DTC type
The value of the SPN for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC. Available only if the
parameter DTC type is J1939 DTC.
The value of the FMI for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC. Available only if the
parameter DTC type is J1939 DTC.
• Conversion method
The value of the CM for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC. Available only if the
parameter DTC type is J1939 DTC.
Range: 0 or 1
6.1.38.7. Notes
None.
6.1.39.3. Description
enable
pdtc_ EnablePeriodicLampUpdates
By default, the platform software will periodically determine the appropriate lamp status by
examining the state of all DTCs in all tables. For applications with a large number of DTCs,
this processing can take a significant amount of time.
This block allows an application to programmatically disable and enable this processing.
6.1.39.4. Inports
• enable
Set to 0 to disable periodic lamp updates, 1 to re-enable them. Note: Changing the value
to 0 while the lamps are currently being processed will not interrupt that processing, but
take effect at the next iteration of the DTC processing task.
Range: 0 or 1
6.1.39.5. Outports
None.
6.1.40.3. Description
sim_ store_ up_to_ date
commit _ dtcs
pdtc_ Memory
The pdtc_Memory block stores the DTC table data in non-volatile memory. On start-up, the
block attempts to retrieve the DTC table data prior to running the model. While the model is
running, the time at which the DTC table is stored back to non-volatile memory is determined
by the model itself.
The DTC table data is check-summed using a 16-bit CRC. Failure to match the check-sum
against the table data on start-up means that the data cannot be recovered. In this case,
DTC table data is reverted to the default start-up conditions for each type of DTC (see the
pdtc_DiagnosticTroubleCode and pdtc_DiagnosticTroubleCodeExt blocks for specifics).
When an application is programmed onto the ECU, any pre-existing DTC data (and any
related diagnostic information) are cleared if the model version number differs from what was
previously programmed. However, if the model version number remains the same, and the
total number of DTCs in the model also remains the same, then the pre-existing DTCs are
retained. The model version number is specified through the put_Identification block.
This block is used to update the check-sum and write the DTC table data to non-volatile
store. When the inport commit_dtcs is set to 1, the block pauses execution of the model,
calculates the DTC table data check-sum, stores the DTC table data in non-volatile memory,
then continues execution of the model.
Note
When the block pauses the model execution, the length of pause depends on the store
location. Storage in battery backed RAM will result in a short pause, storage to Flash
will result in a longer pause.
Old DTC data is reused so long as it has the expected total data size and was written
by an application with the same user-specified version number. Otherwise the values
revert to defaults. If the usage of DTC blocks has changed in a new software version,
increase the application sub-minor version number to ensure that any old values are
not used, as they may not map appropriately to the blocks in the new model even if
the total data size happens to match.
It is important to trigger the commit and not update any diagnostic trouble code thereafter
before shutting down the ECU. If diagnostic trouble code data is modified after the check-
sum has been updated, and the ECU shuts down, next time it powers up, diagnostic trouble
code data will revert to default.
To ensure the check-sum is up to date before shutting down the ECU, the store_up_to_date
outport provides an indication of whether the check-sum is correct or not. If not, shutdown
of the module can be prevented (if conditions are appropriate) and the store updated (by
setting the commit_dtcs inport to 1).
6.1.40.4. Inports
• sim_store_up_to_date
Range: 0 or 1
• commit_dtcs
Set to 1 to update the check-sum for the DTC tables and to write the result to non-volatile
memory. Set to zero otherwise.
Range: 0 or 1
6.1.40.5. Outports
• store_up_to_date
Set to 1 if the check-sum and DTC table data match, set to zero otherwise.
Range: 0 or 1
• Storage location
6.1.40.7. Notes
Battery backed RAM is a deprecated type of storage not present on current Pi ECUs. This
option should not be selected unless the ECU technical specification indicates that it is
supported on your ECU.
6.1.41.3. Description
Table :
Description :
pdtc_ Table
The pdtc_Table groups together DTCs into one table. The table can then be worked on by
other blocks (for instance, the pdtc_ClearAll block or the pj1939_Dm1Transmit block) and
stored in non-volatile memory (see the pdtc_Memory block).
6.1.41.4. Inports
None.
6.1.41.5. Outports
None.
The name of the DTC table (there must not be another pdtc_Table block with the same
identifier in the model).
A textual description of the DTC table used for documentation purposes only.
6.1.41.7. Notes
None.
6.1.42.3. Description
Channel : ACCR monitor ( pin C 14 / serial)
Inversion : off
sim_ state Set dead time : debounced _ state
Reset dead time :
Sample time :
pdx_ DigitalInput
The digital input block reads a raw input digital value of 0 if the pin identified by the mask
parameter Channel is at a logic low state or 1 if the pin is at a logic high state. The block is
also capable of inverting and debouncing a signal.
If the mask parameter inversion is set to 1 then a logical NOT operation is applied to the input
value before further processing. Otherwise it is passed through unchanged.
Debouncing can be achieved by setting mask parameters Set dead time and Reset dead
time. On the first iteration of the block, the debounced_state outport is set to the value of the
digital input (or the sim_state inport under simulation).
6.1.42.4. Inports
• sim_state
Only used in simulation. when the model is simulated, the outport debounced_state is set
to the value of this inport.
Range: 0 or 1
6.1.42.5. Outports
• debounced_state
1 if the raw input digital value has been high for at least Set dead time, 0 if the raw input
digital value has been low for at least Reset dead time.
Range: 0 or 1
• Channel
• Inversion
If inversion is ticked then a logical NOT operation is applied to the input value before further
processing.
The time the input will have to be high, before the block switches its output from 0 to 1. A
value of zero is acceptable. A negative value has the same effect as a zero value.
The reset dead time is the time the input will have to be low, before the block switches its
output from 1 to 0. A value of zero is acceptable. A negative value has the same effect
as a zero value.
• Sample time
6.1.42.7. Notes
6.1.43.3. Description
state
Channel : ACCR( pin C 14)
Inversion : off sim_ state
Default value :
fault
pdx_ DigitalOutput
The digital output block causes the channel pin to be taken high or low depending on the
state inport at every model iteration.
The channel logical state can be inverted with respect to the input in order to achieve the
desired logical output state by setting the mask parameter Inversion.
The block also has a mechanism to set the output to a default value in two situations: at
start-up; or if the fault indicator is active. The default output value is mapped directly to the
channel pin logical state and is never inverted.
6.1.43.4. Inports
• state
Place a 1 here to set the output channel pin high, place a 0 here to set the output channel
pin low.
Range: 0 or 1
• fault
Place a 1 here to force the block to use the default value for the channel pin state, otherwise
place a 0 here to force the block to use the inport state as the channel pin state.
Range: 0 or 1
6.1.43.5. Outports
• sim_state
Only used in simulation. this outport is set to the requested channel pin state (i.e., state
or the default state).
Range: 0 or 1
• Channel
• Inversion
Inverts the mapping of the input value to the channel pin. If inversion is set to 1 then a
logical NOT operation is applied to the input value before further processing.
Range: 0 or 1
• Default state
This sets the output to the default state in two situations: at start-up time, before this block
has been executed in the first model iteration; and if a fault indicator is associated with
the output and the fault is active. The value is mapped directly to the channel pin logical
state and is never inverted.
Range: 0 or 1
6.1.43.7. Notes
6.1.44.3. Description
sim_ valid valid
pdx_ Monitor
This block allows an application to determine whether or not the state of a digital output has
changed as requested within the expected response time. It works by recording the time
at which the output function requests a change of state, and then reading the actual state
observed on the feedback input at a specific time later. If the actual state does not match the
expected state, then a failure is noted. Independent counts of failures to fall and failures to
rise are maintained and made available to the application via the outputs from this block.
The block is only available for certain low-side outputs and there are important differences
between the falling edge and rising edge cases.
Falling edge: When a low-side output is activated, it is connected to ground within the ECU,
and the potential on the pin should drop rapidly to ground potential. Under normal conditions,
the time for the potential to fall is largely independent of the load on the pin. Failure of the
potential to drop within the expected time indicates a low resistance path to a higher potential
on the pin. This will result in a large current draw, causing the output device to get hot and
turn off. If the platform software detects that the monitor feedback has not gone low within the
expected time, it deactivates the output. The time threshold for the output to go low is hard-
coded within the platform software. (See the technical specification of the target ECU for
details.) The application can re-enable any disabled outputs using the pss_OvercurTripReset
block.
Rising edge: When a low-side output is de-activated, it is disconnected within the ECU, and
the potential on the pin should move in the direction of the high-side potential. How fast it
does so will depend on the resistance between the pin and the high-side potential, i.e. the
resistance of the load. Therefore the time threshold must be specified by the application via
the Rise time-out mask parameter of this block. If the potential fails to rise within the expected
time, this may indicate an open circuit on the pin, or a short-circuit to ground. Advice on what
thresholds to set for different loads is given in the technical specification of the target ECU.
The platform software takes no independent action in the case of such a fault being detected
beyond reporting the fault count to the application.
Support for this block is restricted to certain types of output. Currently only spark
outputs (using the pan_Spark block) and PWM outputs (using the pdx_PWMOutput or
pdx_PWMVariableFrequencyOutput blocks) support monitoring (and only on those channels
that have the necessary internal feedback signals). If the block is used with some other
function on the corresponding output channel, then the valid outport will return 0 (FALSE).
Note that output monitoring will occur on those channels that support it, where possible,
regardless of whether or not the application includes a pdx_Monitor block. This means
that outputs will be disabled if the corresponding monitor channels fail to go low within the
expected time. The only case where such intervention will not take place is if the output
function used does not support monitoring.
6.1.44.4. Inports
• sim_valid
Only used under simulation. Under simulation, the value of this inport is passed through
to the valid outport.
Range: 0 or 1
• sim_rise_failure_count
Only used under simulation. Under simulation, the value of this inport is passed through
to the rise_failure_count outport.
• sim_fall_failure_count
Only used under simulation. Under simulation, the value of this inport is passed through
to the fall_failure_count outport.
6.1.44.5. Outports
• valid
Set to 0 when there is a configuration error, most probably due to an output function being
used on this channel that does not support monitoring.
Range: 0 or 1
• rise_failure_count
A count of the number of times that the output state did not go high within the time specified
by the Rise time-out mask parameter, since the ECU was powered on or reset.
• fall_failure_count
A count of the number of times that the output state did not go low within the allowed time,
since the ECU was powered on or reset.
• Channel
• Rise time-out
The time within which the potential on the output pin is expected to go high after the output
is deactivated.
• Sample time
6.1.44.7. Notes
None.
6.1.45.3. Description
pdd_ DataInput
The digital data input block is a generic interface for reading a input channel that specifies
numerical integer data. The units and interpretation of the value depends on the Channel
being read.
6.1.45.4. Inports
• sim_value
Only used under simulation when the parameter Provide simulation input? is ticked. The
outport value is written using the value of this inport.
6.1.45.5. Outports
• value
The value of the digital data read from the specified channel.
• Channel
• Sample time
6.1.45.7. Notes
None.
6.1.46.3. Description
transient_ fault confirmed_ fault
put_ FaultCheck
Debouncing of a transient fault signal is achieved using a leaky bucket algorithm. A leaky
bucket integrator is used to decide when an input is confirmed as faulty as a function of its
current state, which may be only transiently in error.
The bucket always has a total volume or depth of unity (1.0). When the input is deemed to
be in error (e.g. out of range), water is poured into the bucket at some rise rate. At all times
water flows out of a leak in the bottom of the bucket with some fall rate until it is empty. If
the bucket should ever fill to the brim by reaching a depth greater than or equal to 1.0, the
input is confirmed as faulty. Should the bucket subsequently empty to below its hysteresis
depth, it is no longer confirmed as faulty.
6.1.46.4. Inports
• transient_fault
6.1.46.5. Outports
• confirmed_fault
Rate at which leaky bucket is filled when input is faulty in some respect.
Level below which bucket depth must fall before fault is no longer considered faulty. If set
to a negative value, fault remains latched. As a special case, if the hysteresis depth is set
negative, should the input ever reach a confirmed fault state it remains "latched" there until
the ECU device is powered down.
• Sample time
6.1.46.7. Notes
None.
6.1.47.3. Description
sim_ timed _ out timed _ out
Channel : CID 1 ( pin E 45)
Time out : Hz
Sample time :
sim_ frequency frequency
pdx_ FrequencyInput
The frequency measurement block, measures the duration of each pulse in a pulse train from
an input signal and determines the frequency of that pulse. The last measured frequency is
provided as an outport.
If a frequency has not been measured (because a complete signal pulse has not yet
occurred), then the corresponding frequency outport is clamped to zero.
If the input signal does not complete a pulse for longer than the block's timeout value, then the
timed_out outport of the block is set. When a timeout occurs, the frequency outport remains
at its last known value.
6.1.47.4. Inports
• sim_timed_out
Range: 0 or 1
• sim_frequency
Only used in simulation. Place the frequency in hertz here to simulate the last measured
frequency. A measurement of zero hertz indicates that no measurement is available.
6.1.47.5. Outports
• timed_out
1 if the input signal has not completed a pulse within the mask parameter timeout period
at the point of sampling (see the mask parameter section below), 0 otherwise.
Range: 0 or 1
• frequency
The last measured frequency in hertz, or 0 if no measurement has been taken (regardless
of the state of outport timed_out). The range of the frequency is limited in various ways.
• The range of the frequency that can be measured is limited by the filter circuitry of the
input pin.
• The lowest measurable frequency is limited by the filter circuitry and the size of the
corresponding processor timer for a channel. Any input frequency below the documented
limit, is reported as timed-out.
• The highest measurable frequency is limited by the filter circuitry and the resolution
of the corresponding processor timer for a channel. In general, the block reports the
frequency of the filtered signal and the input filtering forms an upper limit. However, as
the frequency increases, the resolution of measurement decreases.
Details of the input pin's filtering and processor timing can be found in an ECU's technical
specification.
• Channel
• Time out
The period of time in hertz after which if no complete pulse has been measured, the outport
timed_out is set to 1.
• Sample time
Calibratable: No
If selected then create simulation inports for each of the outport message signals.
6.1.47.7. Notes
None.
6.1.48.3. Description
direction
timedout
pdx_ HallDecodeInput
This block decodes pulse trains from a 3 phase hall input, such as a BLDC motor, and outputs
details such as direction, position, and speed.
The pulse train, in a 3 phase hall encoder, is generated from three sensors that are either
spaced 120° or 60° apart, depending on the sensor configuration. The hall decode block
takes this pulse train and measures the A, B, and C channels determining the direction at
each pulse and also counts the number of pulses. If the encoder is turning forwards then for
each edge on the A, B, and C channels the block increments the count. If the encoder is
turning backward then for each edge on the A, B, and C channels the block decrements the
count. When the block iterates, it outputs the cumulative count of pulses since initialization
and overflows/underflows on saturation.
The block also measures the duration of each pulse from the encoder's A, B, and C channels
and outputs the last measured frequency of the last channel. If the frequency of a channel
has not been measured (because a complete signal pulse has not yet occurred), then the
corresponding frequency outport is set to zero.
If the block's A, B, and C channels do not complete a pulse for longer than the block's timeout
value, then the timedout outport block is set. When a timeout occurs, the frequency outport
for that channel remains at its last known frequency measurement (or zero if a measurement
has not been completed).
Figure 6.4. Sector configuration for a 3 phase hall input - 60° spacing
3
011 B
1 7
001 111
0 6
000 110
4
100 C
There are two configurations that the hall sensors can be in, they can either be spaced 60°
apart or 120° apart. When the sensors are 60° apart the signals outputted from the sensors
across the three channels are 60° out of phase (i.e. the rising edge of each channel is 60°
apart from one another). However, in order for this to be true the sector configuration around
a stator of a motion system must be defined as shown in Figure 6.4, “Sector configuration for
a 3 phase hall input - 60° spacing”, where the rotation of the sectors happen in the sequence
of 0, 4, 6, 7, 3, 1, 0, 4, ... and so on. They are arranged in this fashion so that when the stator
makes a revolution the hall sensor waveforms are generated with the correct spacing.
A sector is a 3 bit value that is used to determine the position of the motion system as detected
by the sensors. Each bit in the sector equates to the pin state of each phase, the encoding
of this value is shown in Figure 6.5, “Sector output encoding”.
Bit 7 3 2 1 0
Not Used
Not Used
Phase C State
Phase B State
Phase A State
As mentioned previously, for a 3 phase hall input there are only 6 possible sector values and
as such each sector, consequently, has a width of 60°. In the 60° sensor spacing configuration
each sensor is therefore only placed one sector after the other. The labels A, B, and C in
Figure 6.4, “Sector configuration for a 3 phase hall input - 60° spacing” show this placing
of sensors.
The output of the sensors is dependent on the sectors that passes through them. For
example, if the output for sector 6 is being determined, sensor A will go low while sensors
B and C will go high. This is because following the bit representation in Figure 6.5, “Sector
output encoding”, bit 0 and 1 are high which correspond to the sensor states of phase B and
C. Similarly, if sector 1 is being measured, sensor A will output high while sensor B and C
will be low. Figure 6.6, “Sensor outputs with 60° spacing” below, shows the output of all 3
sensors across one full revolution with each signal being 60° out of phase.
Sensor A
Sensor B
Sensor C
Sector 0 4 6 7 3 1 0 4 ...
Furthermore, if the sensor configuration is changed and they are spaced 120° apart, instead
of the sensors being 1 sector apart they are 2 sectors apart, as each sector is 60° wide. Just
as it was the case for the 60° spacing configuration, in order for the sensor outputs to be 120°
out of phase the sectors must be pre-defined in a specific way. This configuration is shown
below, in Figure 6.7, “Sector configuration and outputs for 120° sensor spacing”, along with
the sensor outputs and the new sector sequence of 4, 6, 2, 3, 1, 5, 4, 6, and so on.
Figure 6.7. Sector configuration and outputs for 120° sensor spacing
120°
A
Sensor A
1
001
5 3
101 011
Sensor B
4 2
100 010
C 6 B
110
Sensor C
Sector 4 6 2 3 1 5 4 6 ...
6.1.48.4. Inports
• sim_direction
Only used in simulation. When the model is simulated, the outport direction is set to the
value of this inport.
Range: 0 or 1
• sim_sector
Only used in simulation. When the model is simulated, the outport sector is set to the value
of this inport.
Range: [0, 7]
• sim_revolution_frequency
Only used in simulation. When the model is simulated, the outport revolution_frequency
is set to the value of this inport.
• sim_revolution_counter
Only used in simulation. When the model is simulated, the outport revolution_counter is
set to the value of this inport.
• sim_sector_frequency
Only used in simulation. When the model is simulated, the outport sector_frequency is set
to the value of this inport.
• sim_sector_counter
Only used in simulation. When the model is simulated, the outport sector_counter is set
to the value of this inport.
• sim_timedout
Only used in simulation. When the model is simulated, the outport timedout is set to the
value of this inport.
Range: 0 or 1
6.1.48.5. Outports
• direction
Range: 0 or 1
Note
The direction determines the sequence of the edges across channels. For example,
if the direction is 1 and the sequence of edges for a motor with 60° spaced sensors
is C, B, and A (as shown in Figure 6.6, “Sensor outputs with 60° spacing”) then when
the direction is 0 the sequence will be reversed to A, B, and C.
• sector
The measured sector of the 3 phase hall input. A sector represents the position of the
motion system.
Range: [0, 7]
Note
See Figure 6.4, “Sector configuration for a 3 phase hall input - 60° spacing” and
Figure 6.7, “Sector configuration and outputs for 120° sensor spacing” for the pre-
defined sector configurations for 60° spaced and 120° spaced sensors, respectively.
• revolution_frequency
The measured revolution frequency of the overall 3 phase hall input. The frequency is
measured from the last rising/falling edge to the current edge (of the same channel), as
shown in the Figure below.
Revolution Periods
Sensor A
Sensor B
Sensor C
Sector 0 4 6 7 3 1 0 4 ...
• revolution_counter
The count of electrical revolutions seen by the 3 phase hall input. The revolution counter is
only updated during phase A. It is increased when the direction is 1, and decreased when
the direction is 0.
• sector_frequency
The measured sector frequency between phases of the 3 phase hall input, updated by the
last phase. It is measured from the last edge, on any channel, to the current edge; see
Figure below.
Sector
Periods
Sensor A
Sensor B
Sensor C
Sector 0 4 6 7 3
• sector_counter
The count of sectors seen by the 3 phase hall input. The sector counter is updated on
every sector. It is increased when the direction is 1, and decreased when the direction is 0.
• timedout
Set to 1 if the 3 phase hall input input signal has timed out when the block is iterated. If
between iterations, the input signal timed out and then re-established itself, the time out
event is not registered.
Range: 0 or 1
• Channel A
The input pin to measure for phase A of the 3 phase hall input.
• Channel A Invert
• Channel B
The input pin to measure for phase B of the 3 phase hall input.
• Channel B Invert
• Channel C
The input pin to measure for phase C of the 3 phase hall input.
• Channel C Invert
The sensor configuration to use for the 3 phase hall input, either 60° or 120° spacing.
• Timeout (Hz)
The period of time in hertz after which if no complete pulse has been measured for any
channel, the corresponding outport timedout is set to 1.
• Sample time
6.1.48.7. Notes
6.1.49.3. Description
mode
duty_ cycle
pdx_ HbridgeOutput
The H-Bridge output block drives a load connected between the two ECU pins in the desired
mode. Four modes are provided allowing the H-Bridge output to have no drive (all switches
open), brake (high-side switches closed), forward or reverse (one side is connected to high-
side while the other is PWM'ed to ground at a programmable frequency and duty-cycle).
Warning
To avoid unexpected behavior, H-bridges should be set to NO DRIVE mode before
flashing the ECU. This can be done by commanding the actuators to NO DRIVE any
time the engine is not turning.
The duty-cycle used in forward and reverse mode is defined as the proportion of time where
the load is driven (low-side switch is grounded).
Note
Some of the PWM output channels do not produce an accurate waveform when the
duty cycle is either very small (e.g., 0.5%) or very large (e.g., 99.5%). All H-bridge
output channels cope with 0% and 100% duty cycles correctly.
For the M250 target specifically, in order to avoid shoot-through and damage to the
ECU when the mode switches, a 100us dead-time is inserted in the PWM signal for
one task cycle at the beginning of mode-transition. Additionally, this dead-time insertion
will only occur if the duty cycle that is commanded has a low time of less than 100us.
For this reason, it will not be possible to command a 100% duty cycle during mode-
transition for one task period. See diagram below for further detail.
100us
A30
A1
A30 is requested to have a high duty cycle, After one task iteration is complete and
but it is extended to 100 microsecond off the mode is unchanged, the duty cycle is
time (dead time) for one task duration. restored (dead-time removed).
6.1.49.4. Inports
• mode
• frequency
• duty-cycle
6.1.49.5. Outports
None.
• Channels
• Initial mode
Range: [No Drive, Brake, Forward, Reverse] (for M220, M250 and M670 targets)
• Initial frequency
6.1.49.7. Notes
None.
6.1.50.3. Description
The J1939 messaging protocol is a CAN based messaging system designed to pass
information between vehicle network ECUs in real-time. For more details, refer to SAE J1939
(and sub-parts 21, 71, 73, 81) at the SAE Web site (http://www.sae.org).
• Handles requests for PGs by filtering out PGNs the model does not handle and returning
NACK messages.
• Handles reception and transmission of J1939 messages, in a similar way to the existing
pcx_CANReceiveMessage and pcx_CANTransmitMessage blocks.
• Handles the transport protocol (J1939/21) for sending long messages (up to 1785 bytes
in length).
• Handles some of the diagnostic requirements (J1939/73) for sending and receiving lists of
diagnostic trouble codes (DM1 and DM2 messages). This includes support in the blockset
for diagnostic trouble codes (see Section 4.6.6, “Fault support”).
• Handles the network protocol (J1939/81) as if the ECU and the rest of the network have
fixed network nodes.
Note
This may be extended in the future to include dynamic network addressing.
The pj1939_Configuration block configures the ECU's behaviour when handling J1939
messages. This block configures parameters that adjust the amount of memory set aside for
processing J1939 messages.
6.1.50.4. Inports
None.
6.1.50.5. Outports
None.
The number of bytes for each J1939 message buffer. In some networks, the maximum
length of any received or transmitted J1939 message will be smaller than the maximum
J1939 length of 1785 bytes. This parameter allows the modeller to reduce the amount of
RAM allocated to J1939 messages, and therefore increase the RAM allocated to other
functions of the ECU.
The number of long (transport) messages than can be received simultaneously. The
smaller the number, the more RAM is allocated to other functions of the ECU.
Note
The larger the number, the more transport messages can be received at the same
time. However, the larger the number, the more likely it is that it will not be possible
for the ECU to adhere to the J1939 transport timeouts and some message receives
may fail.
The number of long (transport) messages than can be transmitted simultaneously. The
smaller the number, the more RAM is allocated to other functions of the ECU.
Note
The larger the number, the more transport messages can be transmitted at the same
time. However, the larger the number, the more likely it is that it will not be possible
for the ECU to adhere to the J1939 transport timeouts and some message transmits
may fail.
The number of receive and transmit buffers per channel used to store J1939 CAN data
between processing of J1939 messages (which occurs every 5 milliseconds).
The maximum number of DM7 test entries that may be stored in the buffer, upon receipt
of DM7 request messages.
A checkbox to enable the use of a common multi-frame priority. This priority overrides
the priorities for all DM transmit blocks for multi-frame message responses. (Single frame
responses are unaffected.) It does not affect any priorities passed to instances of the
pj1939_PgTransmit block.
The value of the common multi-frame priority. Only available when the mask parameter
checkbox Use common multi-frame priority is ticked.
Range: [0, 7]
6.1.50.7. Notes
6.1.51.3. Description
OpenECU can support J1939 on any or all of the available CAN interfaces on an ECU. The
pj1939_ChannelConfiguration block creates a J1939 channel to associate J1939 operations
with a particular CAN interface. Each Individual J1939 operation specifies the J1939 channel
with which the operation is associated.
See the pj1939_Configuration block for information about shared configuration items.
6.1.51.4. Inports
None.
6.1.51.5. Outports
None.
• Channel ID
The name of the source ECU, given as a vector of 8 elements. The node name excludes
the self-configuration field (see parameter Source self-configuring).
• Source self-configuring?
Set if this ECU can self-configure its network address, clear if this ECU will remain at a
fixed address.
6.1.51.7. Notes
6.1.52. J1939 DM1 receive (pj1939_Dm1Receive)
Indicates if a J1939/73 DM1 message has been received and decodes the contents of the
lamp status.
6.1.52.3. Description
sim _ error_ flag error_ flag
pj 1939 _ Dm 1 Receive
The application model may request the DM1 message or rely on the other J1939 node to
transmit the DM1 message periodically. This block does not make a request for the DM1
message.
6.1.52.4. Inports
• sim_rx_trig_flag
• sim_error_flag
• sim_overrun_flag
• sim_lamp_malfunction
• sim_lamp_red
• sim_lamp_amber
• sim_lamp_protect
• sim_timestamp
The simulation value for the outport timestamp. Available only if the mask parameter
Provide timestamp is selected.
6.1.52.5. Outports
• error_flag
• rx_trig_flag
Set to 1 if a DM1 message matching the source address has been received since the last
time the block was evaluated, 0 otherwise.
• overrun_flag
Set to 1 if more than one DM1 messages matching the source address have been received
since the last time the block was evaluated, 0 otherwise.
• lamp_malfunction
• lamp_red
• lamp_amber
• lamp_protect
• timestamp
The time when the last valid message was received. Strictly this gives the time when
the message was assembled from the possibly multiple CAN packets, and has a
resolution of 50 ms. The timestamp is a free-running microsecond timer that wraps to zero
approximately every 70 minutes. Available only if the mask parameter Provide timestamp
is selected.
• J1939 Channel
The logical J1939 channel on which the message will arrive. Must be a channel declared
with a pj1939_ChannelConfiguration block.
• Source address
Range: 0 or 253
• Sample time
• Provide timestamp
If selected then inport sim_timestamp and outport timestamp are made available.
6.1.52.7. Notes
None.
6.1.53.3. Description
Channel :
SPN :
sim _ active active
FMI :
CM :
Source address :
sim _ oc oc
Sample time :
pj 1939 _ Dm 1 DecodeDtc
The active/not active status of a specified DTC as reported by another unit via J1939 DM1
messages can be monitored using this block. The outputs are updated each time a new
DM1 message is received. Use the pj1939_Dm1Receive block to determine when a DM1
message is received.
6.1.53.4. Inports
• sim_active
• sim_oc
6.1.53.5. Outports
• active
• oc
The occurrence count of the DTC (as specified by the parameters Suspect parameter
number, Failure mode indicator and Conversion method).
• J1939 Channel
The logical J1939 channel on which the message will arrive. Must be a channel declared
with a pj1939_ChannelConfiguration block.
The value of the SPN for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC.
The value of the FMI for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC.
• Conversion method
The value of the CM for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC.
Range: 0 or 1
• Source address
Range: 0 or 253
• Sample time
6.1.53.7. Notes
None.
6.1.54.3. Description
sim _ error_ flag
force_ transmission
Channel : 0
Table :
priority
pj 1939 _ Dm 1 Transmit
When the block iterates, the DTC table is inspected for active and previously active DTCs. If
any differ since the last time the block iterated, a DM1 message could be sent. The J1939-73
specification explains how the periodic transmission of this message varies in relation to DTC
activation state changes, as a need to limit J1939 network bandwidth.
6.1.54.4. Inports
• sim_error_flag
• sim_transport_errors
Calibratable: No
• force_transmission
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the DM1 message (This could be the source address of the
corresponding PGN request, or the global address (255) if the request was sent to the
global address). If use_dest_addr is false or a PDU2 message is shorter than 9 bytes, this
value is ignored and the message is sent to the global address.
• use_dest_addr
Whether to send the DM1 to a specified destination address. If false (0), the message will
always be sent to the global address. Set to true (1) to allow the message to be sent to a
specific destination address, such as the source address of a PGN request.
Range: 0 or 1.
6.1.54.5. Outports
• error_flag
Set to 1 when the DM1 message could not be buffered for transmission, or if a previous
request to send a DM1 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
6.1.54.7. Notes
In order to meet the requirement of sending a periodic DM1 message every second, when
there is one or more active DTCs, it is necessary to set the block sample rate to 1 second
or less. The rate must be an integer factor of 1 second.
6.1.55.3. Description
sim _ error_ flag error_ flag
Channel : 0
Source address :
sim _ lamp _ malfunction lamp _ malfunction
Sample time :
pj 1939 _ Dm 2 Receive
A J1939-73 DM2 message is a variable length message, transmitted by a network node to the
global network address. The DM2 message contents detail any previously active diagnostic
trouble codes and lamp statuses. As the message is variable in length, direct blockset support
is provided (rather than relying on the pj1939_PgReceive block).
The application model must request the DM2 message. This block does not make a request
for the DM2 message.
6.1.55.4. Inports
• sim_error_flag
• sim_rx_trig_flag
• sim_overrun_flag
• sim_lamp_malfunction
• sim_lamp_red
• sim_lamp_amber
• sim_lamp_protect
• sim_timestamp
The simulation value for the outport timestamp. Available only if the mask parameter
Provide timestamp is selected.
6.1.55.5. Outports
• error_flag
• rx_trig_flag
Set to 1 if a DM2 message matching the source address has been received since the last
time the block was evaluated, 0 otherwise.
• overrun_flag
Set to 1 if more than one DM2 messages matching the source address have been received
since the last time the block was evaluated, 0 otherwise.
• lamp_malfunction
• lamp_red
• lamp_amber
• lamp_protect
• timestamp
The time when the last valid message was received. Strictly this gives the time when
the message was assembled from the possibly multiple CAN packets, and has a
resolution of 50 ms. The timestamp is a free-running microsecond timer that wraps to zero
approximately every 70 minutes. Available only if the mask parameter Provide timestamp
is selected.
• J1939 Channel
The logical J1939 channel on which the message will arrive. Must be a channel declared
with a pj1939_ChannelConfiguration block.
• Source address
Range: 0 or 253
• Sample time
• Provide timestamp
If selected then inport sim_timestamp and outport timestamp are made available.
6.1.55.7. Notes
None.
6.1.56.3. Description
Channel :
SPN :
sim _ previously _ active previously _ active
FMI :
CM :
Source address :
sim _ oc oc
Sample time :
pj 1939 _ Dm 2 DecodeDtc
The previously active/not previously active status of a specified DTC as reported by another
unit via J1939 DM2 messages can be monitored using this block. The outputs are updated
each time a new DM2 message is received. Use the pj1939_Dm2Receive block to determine
when a DM2 message is received.
6.1.56.4. Inports
• sim_active
• sim_oc
6.1.56.5. Outports
• previously_active
• oc
The occurrence count of the DTC (as specified by the parameters Suspect parameter
number, Failure mode indicator and Conversion method).
• J1939 Channel
The logical J1939 channel on which the message will arrive. Must be a channel declared
with a pj1939_ChannelConfiguration block.
The value of the SPN for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC.
The value of the FMI for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC.
• Conversion method
The value of the CM for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC.
Range: 0 or 1
• Source address
Range: 0 or 253
• Sample time
6.1.56.7. Notes
None.
6.1.57.3. Description
sim _ error_ flag
transmit
Channel : 0
Table :
priority
pj 1939 _ Dm 2 Transmit
A J1939/73 DM2 message is a variable length message, transmitted by a network node to the
global network address. The DM2 message contents detail any previously active diagnostic
trouble codes. As the message is variable in length, direct blockset support is provided (rather
than relying on the pj1939_PgTransmit block).
6.1.57.4. Inports
• sim_error_flag
• sim_transport_errors
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the DM2 message (This could be the source address of the
corresponding PGN request, or the global address (255) if the request was sent to the
global address). If use_dest_addr is false or a PDU2 message is shorter than 9 bytes, this
value is ignored and the message is sent to the global address.
• use_dest_addr
Whether to send the DM2 to a specified destination address. If false (0), the message will
always be sent to the global address. Set to true (1) to allow the message to be sent to a
specific destination address, such as the source address of a PGN request.
Range: 0 or 1.
6.1.57.5. Outports
• error_flag
Copyright 2020, Pi Innovo 282
Software detail
Set to 1 when the DM2 message could not be buffered for transmission, or if a previous
request to send a DM2 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
6.1.57.7. Notes
None.
6.1.58.3. Description
sim_error_flag error_flag
Channel: 0
PDU datapage: []
sim_rx_trig_flag PDU format: [] rx_trig_flag
Message length: [] bytes
Field start positions: [ ]
sim_overrun_flag overrun_flag
Field widths: [ ]
Field signs: [ ]
Field packings: [ ]
sim_source_addr source_addr
Sample time: -1
Provide simulation input: off
sim_dest_addr dest_addr
pj1939_PgReceive
When a matching J1939 message to this block is received, the block unpacks the message
contents into individual signals, as specified by the block mask parameters, and provides
them as outports.
Warning
The PCX feature takes precedence over the PJ1939 feature. If you configure the PCX
feature to receive a J1939 frame, the PJ1939 feature will not see the frame, and it
will not be processed by the platform. This especially causes problems when receiving
J1939 DM14 'Boot Load' commands.
6.1.58.4. Inports
• sim_error_flag
• sim_rx_trig_flag
• sim_overrun_flag
• sim_source_addr
• sim_dest_addr
• sim_timestamp
The simulation value for the outport timestamp. Available only if the mask parameter
Provide timestamp is selected.
• sim_fields
A set of simulation inports for the corresponding outports fields. Available if there is at least
one field and the parameter Provide simulation input? is selected.
6.1.58.5. Outports
• error_flag
Set to 1 if some error has occurred which prevents CAN reception, or 0 otherwise. Errors
which prevent reception are: CAN bus detected as bus-off, or the length of the received
J1939 message does not match the Message length parameter.
Range: 0 or 1
• rx_trig_flag
Set to 1 if the block has detected reception of the J1939 message since the last iteration
of this block, set to zero otherwise.
Range: 0 or 1
• overrun_flag
Set to 1 if the block has detected reception of the same J1939 message more than once
between iterations of this block.
Range: 0 or 1
• source_addr
• dest_addr
• timestamp
The time when the last valid message was received. Strictly this gives the time when
the message was assembled from the possibly multiple CAN packets, and has a
resolution of 50 ms. The timestamp is a free-running microsecond timer that wraps to zero
approximately every 70 minutes. Available only if the mask parameter Provide timestamp
is selected.
• fields
• J1939 Channel
The logical J1939 channel on which the message will arrive. Must be a channel declared
with a pj1939_ChannelConfiguration block.
• PDU datapage
The pdu datapage value of the PGN of the J1939 message to receive.
Range: 0 or 1
• PDU format
The pdu format value of the PGN of the J1939 message to receive.
• PDU specific
The pdu specific value of the PGN of the J1939 message to receive. If the PDU format
parameter is less than 240, then this parameter is not available for editing and does not
form part of the PGN.
• Message length
A vector of bit numbers indicating the start position of each field in the CAN message.
where byte 1 corresponds to the first received data byte in the first CAN
message for the J1939 message. This numbering scheme matches the
J1939 specification but differs from the existing CAN blocks. Although this
may cause some confusion when both blocks are used in the same model,
it will help reduce mistakes when using the J1939 blockset with the J1939
specification of message contents.
• Field widths
A vector of bit lengths indicating the number of bits allocated to each field.
A field which starts at bit 5 and has 10 bits of width is identified as follows:
• Field signs
A vector of zero or one values, corresponding to each field. Fields for which this is set 1
are received as twos-complement signed numbers, or unsigned numbers otherwise.
Range: 0 or 1
• Field packing
A vector of zero or one values, corresponding to each field. Fields for which this is set 1
are received as MS packing, or LS packing otherwise.
Range: 0 or 1
J1939 message fields are generally packed LS byte first, so the field which
starts at bit 5 and has 10 bits of width, would be interpreted as:
MS LS
Data byte 2 Data byte 1
- - - - - - 14 13 12 11 10 9 8 7 6 5
s s s s s s x x x x x x x x x x
where 'x' is the corresponding bit taken from the J1939 message data
bytes, and 's' is the sign extension of the data. In this case, bit 14 may be
considered the sign bit, if the data in the J1939 message data is signed.
However, if the J1939 message field was packed MS byte first, the bits
would be interpreted as:
MS LS
Data byte 1 Data byte 2
- - - - - - 6 5 14 13 12 11 10 9 8 7
s s s s s s x x x x x x x x x x
where 'x' is the corresponding bit taken from the J1939 message data
bytes, and 's' is the sign extension of the data. In this case, bit 6 may be
considered the sign bit, if the data in the J1939 message data is signed.
• Field mnemonics
A string containing a comma-separated list of names with which to label the simulation
field inports and message field outports.
Range: 0 or 1
If selected then create simulation inports (sim_fields) for each of the outport message
signals (fields).
• Provide timestamp
If selected then inport sim_timestamp and outport timestamp are made available.
• Sample time
6.1.58.7. Notes
• Unused fields in a J1939 message need not be specified in the Field start positions
parameter.
• If the block shows unnamed outports, or if the field outports are not shown, it is likely that
one or more of the block's parameter fields is incorrect. Check the parameter fields for
mistakes and correct them.
• The following example illustrates the least significant (LS) and most significant (MS) byte
ordering in J1939 messages. The message is received as follows:
MS LS
Byte 1 2 3 4 5 6
Message 11 10 FF FF 20 21
(hex)
where the first parameter is in LS byte format, starts at bit 0, is 16 bits wide and unsigned,
and the second parameter is in MS byte format, starts at bit 32, and is also 16 bit wide
and unsigned.
Parameter 1 is unpacked using LS byte formatting giving 0x1011. The LS byte is unpacked
from the LS byte of its position within the message (byte 1) giving 0x11, and the MS byte
is unpacked from the MS byte of its position within the message (byte 2) giving 0x10.
Parameter 2 is unpacked using MS byte formatting giving 0x2021. The LS byte is unpacked
from the MS byte of its position within the message (byte 6) giving 0x21, and the MS byte
is unpacked from the MS byte of its position within the message (byte 5) giving 0x20.
6.1.59.3. Description
sim _ requested requested
Channel : 0
PDU datapage :
sim _ source _ addr source _ addr
PDU format :
Sample time :
sim _ dest_ addr dest_ addr
pj 1939 _ PgRequested
The pj1939_PgRequested block captures all J1939/21 Request PGN messages directed at
the ECU and determines if the model must respond to any of them. If the model is configured
to do so (by use of this block), then the model must implement an appropriate action or
response. If the model is not configured to do so, then the ECU will respond with a NACK
(if it is appropriate to do so).
The PGN to match against any J1939 request message, is specified by parameters PDU
datapage, PDU format and PDU specific. If a matching PGN has been requested, then
the outport requested is set to 1. The PGN must not be duplicated in more than one
pj1939_PgRequest block.
Requests for DM1, DM2, DM3, DM4, DM5, DM6, DM11, DM12, DM20, DM21,
DM23, DM24, DM25, DM26, DM27, DM28, DM29, DM31, DM32, DM34, DM41,
DM42, DM43, DM44, DM45, DM46, DM47, DM48, DM49, DM50, DM51 and
DM52 messages are handled by the model using this block. The application
modeller must then provide the necessary logic to handle the request using
the corresponding pdtc_ClearAllIfActive, pdtc_ClearAllIfInactive, pj1939_Dm1Transmit,
pj1939_Dm2Transmit, pj1939_Dm4Transmit, pj1939_Dm5Transmit, pj1939_Dm8Transmit,
pj1939_Dm10Transmit, pj1939_Dm20Transmit, pj1939_Dm21Transmit,
pj1939_Dm24Transmit, pj1939_Dm25Transmit, pj1939_Dm26Transmit,
pj1939_Dm30Transmit, pj1939_Dm32Transmit, pj1939_Dm34Transmit, and
pj1939_TransmitDtcDm blocks.
6.1.59.4. Inports
• sim_requested
• sim_source_addr
• sim_dest_addr
Simulation value for the inport dest_addr. Available only if the parameter PDU format is
less than 240.
• sim_timestamp
The simulation value for the outport timestamp. Available only if the mask parameter
Provide timestamp is selected.
6.1.59.5. Outports
• requested
Set to 1 if the pgn defined by the parameters PDU datapage, PDU format and PDU specific
matches a request message.
Range: 0 or 1
• source_addr
• dest_addr
The destination J1939 network address of the request message. Available only if the
parameter PDU format is less than 240.
• timestamp
The time when the last valid message was received. Strictly this gives the time when
the message was assembled from the possibly multiple CAN packets, and has a
resolution of 50 ms. The timestamp is a free-running microsecond timer that wraps to zero
approximately every 70 minutes. Available only if the mask parameter Provide timestamp
is selected.
• J1939 Channel
The logical J1939 channel on which the request will arrive. Must be a channel declared
with a pj1939_ChannelConfiguration block.
• PDU datapage
The pdu datapage value of the PGN to match against a J1939 request message.
Range: 0 or 1
Calibratable: No
• PDU format
The pdu format value of the PGN to match against a J1939 request message.
• PDU specific
The pdu specific value of the PGN to match against a J1939 request message. If the PDU
format parameter is less than 240, then this parameter is not available for editing and does
not form part of the PGN.
• Sample time
• Provide timestamp
If selected then inport sim_timestamp and outport timestamp are made available.
6.1.59.7. Notes
None.
6.1.60.3. Description
sim _ error_ flag
error_ flag
sim _ transport_ errors Channel : 0
PDU datapage :
PDU format :
priority
Message length : bytes
Field start positions : [ ]
dest_ addr Field widths : [ ]
transport_ errors
pj 1939 _ PgTransmit
When a J1939 message is to be transmitted, the block packs each of the signal inports into
the message, as specified by the block mask parameters, and transmits the message.
6.1.60.4. Inports
• sim_error_flag
• sim_transport_errors
• priority
Range: [0, 7]
6.1.60.5. Outports
• error_flag
Set to 1 when there an a problem transmitting the message, set to zero otherwise.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
• PDU datapage
The pdu datapage value of the PGN of the J1939 message to transmit.
Range: 0 or 1
• PDU format
The pdu format value of the PGN of the J1939 message to transmit.
• PDU specific
The pdu specific value of the PGN of the J1939 message to transmit. If the PDU format
parameter is less than 240, then this parameter is not available for editing and does not
form part of the PGN.
• Message length
The length of the data bytes in the message to transmit. Maximum size is the smaller of
maximum range or buffer size.
A vector of bit numbers indicating the start position of each field in the CAN message.
where byte 1 corresponds to the first received data byte in the first CAN
message for the J1939 message. This numbering scheme matches the
J1939 specification but differs from the existing CAN blocks. Although this
may cause some confusion when both blocks are used in the same model,
it will help reduce mistakes when using the J1939 blockset with the J1939
specification of message contents.
• Field widths
A vector of bit lengths indicating the number of bits allocated to each field.
A field which starts at bit 5 and has 10 bits of width is identified as follows:
Calibratable: No
• Field packing
A vector of zero or one values, corresponding to each field. Fields for which this is set 1
are transmitted as MS packing, or LS packing otherwise.
Range: 0 or 1
J1939 message fields are generally packed LS byte first, so the field which
starts at bit 5 and has 10 bits of width, would be interpreted as:
MS LS
Data byte 2 Data byte 1
- - - - - - 14 13 12 11 10 9 8 7 6 5
s s s s s s x x x x x x x x x x
where 'x' is the corresponding bit taken from the J1939 message data
bytes, and 's' is the sign extension of the data. In this case, bit 14 may be
considered the sign bit, if the data in the J1939 message data is signed.
However, if the J1939 message field was packed MS byte first, the bits
would be interpreted as:
MS LS
Data byte 1 Data byte 2
- - - - - - 6 5 14 13 12 11 10 9 8 7
s s s s s s x x x x x x x x x x
where 'x' is the corresponding bit taken from the J1939 message data
bytes, and 's' is the sign extension of the data. In this case, bit 6 may be
considered the sign bit, if the data in the J1939 message data is signed.
• Field mnemonics
A string containing a comma-separated list of names with which to label the message field
inports.
Range: 0 or 1
6.1.60.7. Notes
• Unused fields in a J1939 message need not be specified in the Field start positions
parameter (bits in unused fields are set to 1 for transmission).
• If the block shows unnamed inports, or if the field inports are not shown, it is likely that
one or more of the block's parameter fields is incorrect. Check the parameter fields for
mistakes and correct them.
• The following example illustrates the least significant (LS) and most significant (MS) byte
ordering in J1939 messages. Given two parameters:
MS LS
Byte 1 2
Parameter 1 (hex) 10 11
Parameter 2 (hex) 20 21
the first parameter is packed into the J1939 message in LS byte format, starting at bit 0, is
16 bits wide and unsigned, and the second parameter is packed in MS byte format, starting
at bit 32, and is also 16 bit wide and unsigned.
MS LS
Byte 1 2 3 4 5 6
Message 11 10 FF FF 20 21
(hex)
Parameter 1 has been packed using LS byte formatting. The LS byte of 0x1011 (0x11)
has been packed into the LS byte of its position within the message (byte 1), and the MS
byte of 0x1011 (0x10) has been packed into the MS byte of its position within the message
(byte 2).
Parameter 2 is packed using MS byte formatting. The LS byte of 0x2021 (0x21) has been
packed into the MS byte of its position within the message (byte 6), and the MS byte of
0x2021 (0x20) has been packed into the MS byte of its position within the message (byte 5).
Bytes 2 and 3 are not used and are therefore set with all bits at 1.
6.1.61.3. Description
pcomp_ LinkOptions
After RTW has generated code for a model, a compiler converts the code into a binary image
suitable for the ECU to execute. Which compiler to use is chosen through the RTW Compiler
Selection option.
The compiler's linker combines each of the compiled source code files into a binary image
using various transformations, some of which can be modified via command line options to
the compiler. The pcomp_LinkOptions block selects whether to use the default linker options
supplied with OpenECU, to add additional options to the default options, or to replace the
default options altogether.
Warning
Alteration of the linker options may lead to a model which will not build, or a model
which will not run on the target ECU or which may run initially but fail later on. When
reporting a failure through technical support, please specify any changed linker options
as this may help resolve the issue more quickly.
Option Use
-f65535 fill unused memory regions with set bits — this mirrors the
functionality of some post-processing build scripts
-lc ask the linker to include part of the standard C library
-lm ask the linker to include the math part of the standard C library
-m2 ask the linker to produce a map file with a particular layout —
essential for some post-processing of the build files
-t... set to -tPPCE200Z3VEF for the M220, M221, M250, M460 and
M461 or set to -tPPCE200Z7VEF for the M670 — selects the
processor for the target ECU
-Xcheck- ask the linker to check that memory regions and data within
overlapping those regions, do not overlap
-Xelf ask the linker to generate an ELF object file format — essential
for some post-processing of the build files
Option Use
-M print a link map to the standard output
-lgcc ask the linker to try and link against libgcc.a
-lc ask the linker to include part of the standard C library
-lm ask the linker to include the math part of the standard C library
--check- ask the linker to check section addresses after they have been
sections assigned to see if there are any overlaps
--emit-stub- label linker stubs with a local symbol that encodes the stub type
syms and destination
-cref output a cross reference table. If a linker map file is being
generated, the cross reference table is printed to the map file.
Otherwise, it is printed on the standard output
-m elf32ppc emulate the elf32ppc linker
Note
Its outside the scope of this User Guide to explain all the different linker options in detail
and their resulting affect on the ECU binary image. Please refer to appropriate compiler
User Guide for more information.
Note
Alteration of the linker options may remove options which work around known bugs
in the compiler. For a list of known bugs which affect OpenECU, see Section 2.5.9.2,
“Known defects”, Section 2.5.10.2, “Known defects”, Section 2.5.11.2, “Known defects”
and Section 2.5.12.2, “Known defects”.
6.1.61.4. Inports
None.
6.1.61.5. Outports
None.
• Mode
Whether to use the default linker options, whether to add linker options to the default
options, or whether to replace the default options altogether.
• Linker options
The options to add to the default linker options, or to replace the default options, as selected
by parameter Mode.
6.1.61.7. Notes
None.
6.1.62.3. Description
Memory Configuration :
Configuration A
pmem _ MemoryConfiguration
Various configurations are available for dividing the available volatile and non-volatile
memory between use for code, calibration and general RAM.
6.1.62.4. Inports
None.
6.1.62.5. Outports
None.
• Memory configuration
A list of the memory configurations available for this target. See Memory configurations for
details of the memory configurations available for different targets.
6.1.62.7. Notes
None.
6.1.63.3. Description
Strategy Identification
Description :
Version: ..
ECU type : G 850
ECU part number : 01T - 068077 -000
Issue number: 0
Copyright :
put_ Identification
The model identification block is usually placed in the top level Simulink diagram of the model.
It contains a mask entry which can be used to display a description of the model.
The model identification block also specifies the following information which is recorded in
the built calibration image:
• copyright description.
In the case of the copyright description, the information is placed in the model image and
the calibration image.
The model identification block also selects the target hardware the model will expect to run on.
This parameter should be selected when the model is first created. Changing the parameter
later on has consequences (see the Notes section for the put_Identification block for more
details).
6.1.63.4. Inports
None.
6.1.63.5. Outports
None.
• ECU type
Specifies the name of the ECU that the model will run on. Selection of the ECU type
changes the possible inputs and outputs on other blocks. The parameter should be
selected at the start of the model but if it must be changed later (for instance, moving
to another hardware platform to reduce costs) then consult the Notes section for the
put_Identification block for more details.
• Part Number
Specifies the hardware part number that appears on the ECU casing, followed by a hyphen
and a three-character suffix. This suffix denotes the option. Only those options that require
special software support are explicitly listed. If the option is not explicitly listed, then option
000 should be selected.
• Issue Number
Specifies the issue or revision number of the ECU that the model will run on. This is the first
number that appears after the hardware part number on the label of the ECU. For example,
if "2m4" appears after the hardware part number, then the issue number to be entered is 2.
• Pin naming
Specifies the type of names used for pin and channel identification. Generic pin naming
uses the following terms for each pin.
Name Description
AIN Analogue input
AOT Analogue output
DIN Digital input
DOT Digital output
Monitor Feedback signal from output driver circuitry
Powertrain pin naming uses a scheme that shortens the typical application naming given
in the target specification tables linked to in Section A.1, “ECU hardware reference
documentation”. The default selection for this drop-down is Powertrain pin naming to
maintain backwards compatibility with existing models.
• Name
Specifies the name of the model/application. The name has no functional effect on the
model but is used when generating ASAP2 files and in response to the CCP EXCHANGE-
ID message.
The name can include tokens which are automatically converted during model build.
Tokens are single words starting and ending in the “%” character. For instance, the string
“Application for %target%” contains one token named target, which is converted to
the target ECU name during a model build. The following table lists the available tokens:
Token Replacement
%copyright% Replaced with the string from the Copyright parameter.
%target% Replaced with a string representing the ECU target and option.
%ver-major% Replaced with the string from the Major version number
parameter.
%ver-minor% Replaced with the string from the Minor version number
parameter.
%ver-subminor% Replaced with the string from the Sub-minor version number
parameter.
The name can be read from the target at run time by displaying the mpls_app_name
automatic ASAP2 entry.
• Description
Specifies a description of the model. The description is displayed in the block. This has no
functional effect on the model. The description can be read from the target at run time by
displaying the mpls_app_description automatic ASAP2 entry.
Specifies the major version number of the model. This has no functional effect on
the model. The version can be read from the target at run time by displaying the
mpl_app_ver_major automatic ASAP2 entry.
Specifies the major version number of the model. This has no functional effect on
the model. The version can be read from the target at run time by displaying the
mpl_app_ver_minor automatic ASAP2 entry.
Specifies the major version number of the model. This has no functional effect on
the model. The version can be read from the target at run time by displaying the
mpl_app_ver_subminor automatic ASAP2 entry.
• Copyright
Specifies a copyright string that is embedded in the generated image. This has no
functional effect on the model. The copyright can be read from the target at run time by
displaying the mpls_app_copyright automatic ASAP2 entry.
6.1.63.7. Notes
• The Description parameter text can usually be split into multiple lines to make it more
readable. As the edit box of the description provides for a single line only, a new line can
be inserted by added the characters \n where a new line is required.
• Changing the ECU type parameter affects which inputs and outputs are selectable in other
blocks. This is also a risk when changing the parameters Part Number and Issue Number.
If a model contains such blocks, then when the target hardware is changed, the inputs and
outputs change when the model is next loaded or when a block is updated. If a change
in hardware is necessary, then the user should work out how the inputs and outputs will
change between hardware targets, then open the model, change the hardware selection,
save and close the model, then reload the model and modify each block input or output
appropriately.
Accidental changes to the hardware target may leave the block inputs and outputs in an
undefined state.
6.1.64.3. Description
Adaptive Data Checksum
calc_ checksum
Adaptive data can be modified from the default values of scalar, 1-d or 2-d maps, or arrays
while the model is running, and recalled next time the model is started. The method depends
on the ECU and its configuration options:
• In most ECUs, adaptive data is stored in flash. This is retained when the ECU is unpowered.
In either case, a checksum is used to validate the data at start-up time. If the checksums
match at start-up, the adaptive data is retained from the previous power cycle, otherwise
the adaptive data is reverted to default. In most ECUs, the data is also reverted to default
if the stored data size or application version number are incompatible with the current build
of software.
This block is used to force the stored data to be updated. When the inport calc_checksum
transitions from 0 to 1, the block pauses execution of the model, calculates the checksum
and stores the adaptive data, then continues execution of the model. In the case of battery-
backed RAM, that merely involves computing the new checksum, but in the case of flash the
memory is physically reprogrammed. Real-time execution will be briefly affected.
To ensure the battery-backed checksum is up to date before shutting down the ECU, the
pnv_Status block provides an indication of whether the checksum is correct or not. If not,
shutdown of the module can be prevented (if conditions are appropriate) and the checksum
updated. That block also indicates if the last flash save was successful.
Note
Flash memory wears out over time, and after a minimum number of checksum
updates, the Flash memory is more likely to forget information each time the checksum
is updated. For this reason, Flash is only programmed when adaptive data has
changed since the last checksum update (either through an adaption operation or reset
operation).
See the technical specification for each ECU for information about the Flash capabilities
of each ECU.
Old adaptive data is reused so long as it has the expected total data size and was
written by an application with the same user-specified version number. Otherwise the
values revert to defaults. If the usage of adaptive blocks has changed in a new software
version, increase the application sub-minor version number to ensure that any old
values are not used, as they may not map appropriately to the blocks in the new model
even if the total data size happens to match.
6.1.64.4. Inports
• calc_checksum
Transition from 0 to 1 to cause the adaptive data to be saved; no save takes place
otherwise.
6.1.64.5. Outports
None.
• Sample time
6.1.64.7. Notes
None.
6.1.65.3. Description
x
adapt _ increment x:
Adaptive z : adapted _z
adapt
reset
Looks up the inport x in the X-axis Data (default) parameter, interpolates the corresponding
elements in the Adaptive Z Data (default) parameter, giving a corresponding adapted_z as
the output.
The adaptive 1-d look-up block is similar to the OpenECU put_Calmap1d block, except that
the z-axis look-up values can change over time under control of the model and be recovered
from non-volatile memory when the model starts. If the adaptive values cannot be recovered
at start-up, or if the model is simulated, the default values are used before any adaption
takes place.
The target non-volatile memory is provided in two ways: either through storage that requires
an external power source when the ECU is powered down (battery backed RAM storage),
or not (Flash storage). See the technical specification for details on which storage type is
supported by each target.
The battery backed non-volatile memory requires a small amount of power overall, i.e., much
less than powering the ECU normally.
The adaptive data is check-summed using a 16-bit CRC. Failure to match the check-sum
against the adaptive data on start-up means that the data cannot be recovered. In this case,
or if the model is simulated, adaptive data is reverted to the default value specified when
the model was built.
Warning
Unlike R12 Simulink maps, 1-d and 2-d maps in OpenECU do not extrapolate beyond
the limits of the input axis or axes. OpenECU calibration maps should be used for all
maps that form part of an OpenECU build.
Some calibration tools provide a feature which shows the map in graphical or tabular form
together with the active interpolation point. OpenECU supports this feature by populating
the ASAP2 file with the signal name which corresponds to the x inport. To make this
feature work, the x signal must be a named DD entity with its storage class property set to
ExportedGlobal.
6.1.65.4. Inports
• x
• adapt_increment
The increment to the current adapted value. The increment is only used when the inports
adapt and reset are conditioned correctly. May be a scalar or a vector. If the inport is
attached to a vector, the size of the vector must match the size of any vector attached to
another inport.
• adapt
1 if the current adapted value should be adjusted, 0 otherwise. If the inport reset is 1, no
adaption will occur (even if inport adapt is 1). May be a scalar or a vector. If the inport is
attached to a vector, the size of the vector must match the size of any vector attached to
another inport.
Range: 0 or 1
• reset
1 if the current adapted value should be reset to Adaptive Z Data (default), 0 otherwise.
May be a scalar or a vector. If the inport is attached to a vector, the size of the vector must
match the size of any vector attached to another inport.
Range: 0 or 1
6.1.65.5. Outports
• adapted_z
The adapted value or values interpolated from parameter Adaptive Z Data (default) at the
value or values for inport x.
The name of the map's x axis (e.g. vftm_mymap_x, see Section "Naming rules"). There
must be two or more elements in this parameter and that must be the same as the number
of elements in parameter Adaptive Z Data (default). The values of this parameter must
increase monotonically and adjacent values must not be the same.
The name of the map's z axis (e.g. vftm_mymap_zsee Section "Naming rules"). There
must be two or more elements in this parameter and that must be the same as the number
of elements in X-axis Data (default). The adaptive block reverts to these values when the
reset inport is asserted or when the block data is unrecoverable during power initialisation
of the ECU.
• Sample time
6.1.65.7. Notes
• The build process generates a corresponding ASAP2 entry to the adaptive parameter
that can be accessed via a calibration tool. The name of this entry has a fifth character
'a', i.e., given the default parameter name vtfm_mymap_z, an ASAP2 entry with name
vtfma_mymap_z is generated. Note that this implies that only a single adaptive parameter
can exist per named default parameter.
Warning
If two or more blocks refer to the same named item in the Adaptive Z Data (default)
field, these blocks will independently adapt the same adaptive parameter.
Possible reset
If the inport reset is 1, the block reverts the Adaptive Z Data (default) parameter data to
the block's defaults and sets the output from a look-up and interpolation.
Possible adaption
If a reset has not occurred and the inport adapt is 1, then the Adaptive Z Data (default)
parameter data is altered as follows before setting the output from a look-up and
interpolation.
zb
za
xa xb
xa and xb bound inport x (see exceptions below), za and zb are the corresponding elements
of the parameter Adaptive Z Data (default).
When the software adapts the 1-d look-up table, the Adaptive Z Data (default) is modified
as follows:
If the inport x is less than xa and xa is the first element in the X-axis Data (default) parameter
then the software treats xb as the same element as xa, zb as the same element as za and
performs the adaption calculation with interpl as 0.
If the inport x is greater than xb and xb is the last element in the X-axis Data (default)
parameter then the software treats xa as the same element as xb, za as the same element
as zb and performs the adaption calculations with interpl as 1.
6.1.66.3. Description
x
y
x:
y:
adapt _ increment adapted _z
Adaptive z :
adapt
reset
Looks up the input x and y in the X-axis Data (default) and Y-axis Data (default) parameters,
interpolates between the corresponding Adaptive Z Data (default) parameter elements, giving
a corresponding adapted_z as output.
The adaptive 2-d look-up block is similar to the OpenECU put_Calmap2d block, except that
the z-axis look-up values can change over time under control of the model and be recovered
from non-volatile memory when the model starts. If the adaptive values cannot be recovered
at start-up, or if the model is simulated, the default values are used before any adaption
takes place.
The target non-volatile memory is provided in two ways: either through storage that requires
an external power source when the ECU is powered down (battery backed RAM storage),
or not (Flash storage). See the technical specification for details on which storage type is
supported by each target.
The battery backed non-volatile memory requires a small amount of power overall, i.e., much
less than powering the ECU normally.
The adaptive data is check-summed using a 16-bit CRC. Failure to match the check-sums on
start-up means that the data cannot be recovered. In this case, or if the model is simulated,
adaptive data is reverted to the default value specified when the model was built.
Warning
Unlike R12 Simulink maps, 1-d and 2-d maps in OpenECU do not extrapolate beyond
the limits of the input axis or axes. OpenECU calibration maps should be used for all
maps that form part of an OpenECU build.
Some calibration tools provide a feature which shows the map in graphical or tabular form
together with the active interpolation point. OpenECU supports this feature by populating
the ASAP2 file with the signal names which correspond to the x and y inports. To make
this feature work, the x and y signals must be named DD entities with their properties set
to ExportedGlobal.
6.1.66.4. Inports
• x
• y
• adapt_increment
The increment to the current adapted value. The increment is only used when the inports
adapt and reset are conditioned correctly. May be a scalar or a vector. If the inport is
attached to a vector, the size of the vector must match the size of any vector attached to
another inport.
• adapt
1 if the current adapted value should be adjusted, 0 otherwise. If the inport reset is 1, no
adaption will occur (even if inport adapt is 1). May be a scalar or a vector. If the inport is
attached to a vector, the size of the vector must match the size of any vector attached to
another inport.
Range: 0 or 1
• reset
1 if the current adapted value should be forced to Adaptive Z Data (default), 0 otherwise.
May be a scalar or a vector. If the inport is attached to a vector, the size of the vector must
match the size of any vector attached to another inport.
Range: 0 or 1
6.1.66.5. Outports
• adapted_z
The adapted value or values interpolated from parameter Adaptive Z Data (default) at the
values for inports x and y.
The name of the map's x axis (e.g. vftm_mymap_x, see Section "Naming rules"). There
must be two or more elements in this parameter and that must be the same as the
number of elements as columns in parameter Adaptive Z Data (default). The values of this
parameter must increase monotonically and adjacent values must not be the same.
The name of the map's y axis (e.g. vftm_mymap_y, see Section "Naming rules"). There
must be two or more elements in this parameter and that must be the same as the number
of elements as rows in parameter Adaptive Z Data (default). The values of this parameter
must increase monotonically and adjacent values must not be the same.
The name of the map's z matrix (e.g. vftm_mymap_z, see Section "Naming rules"). There
must be the same number of rows as elements in parameter Y-axis Data (default) and
number of columns as elements in parameter X-axis Data (default).
• Sample time
6.1.66.7. Notes
• The build process generates a corresponding ASAP2 entry to the adaptive parameter
that can be accessed via a calibration tool. The name of this entry has a fifth character
'a', i.e., given the default parameter name vtfm_mymap_z, an ASAP2 entry with name
vtfma_mymap_z is generated. Note that this implies that only a single adaptive parameter
can exist per named default parameter.
Warning
If two or more blocks refer to the same named item in the Adaptive Z Data (default)
field, these blocks will independently adapt the same adaptive parameter.
Possible reset
If the inport reset is 1, the block reverts the Adaptive Z Data (default) parameter data to
the block's defaults and sets the output from a look-up and interpolation.
Possible adaption
If a reset has not occurred and the inport adapt is 1, then the Adaptive Z Data (default)
parameter data is altered as follows before setting the output from a look-up and
interpolation.
yb
zab zbb
ya
zaa zba
xa xb
xa and xb bound x (see exceptions below), ya and yb bound y (see exceptions below), zaa ,
zab, zba and zbb are the corresponding elements in the parameter Adaptive Z Data (default).
When the software adapts the 2-d look-up table, the Adaptive Z Data (default) is modified
as follows:
If the inport x is less than xa and xa is the first element in the X-axis Data (default) parameter
then the software shall treat xb as the same element as xa, zab as the same element as zaa
and perform the adaption calculation with interplx as 0.
If the inport x is greater than xb and xb is the last element in the X-axis Data (default)
parameter then the software shall treat xa as the same element as xb, zaa as the same
element as zab and perform the adaption calculation with interplx as 1.
6.1.67.3. Description
adapt _ increment
Adaptive Scalar :
adapt adapted _ scalar
reset
The adaptive scalar block is similar to the standard constant block provided by Simulink,
except that the constant can change over time under control of the model and be recovered
from non-volatile memory when the model starts. If the value cannot be recovered at start-
up, or if the model is simulated, the default values are used before any adaption takes place.
The target non-volatile memory is provided in two ways: either through storage that requires
an external power source when the ECU is powered down (battery backed RAM storage),
or not (Flash storage). See the technical specification for details on which storage type is
supported by each target.
The battery backed non-volatile memory requires a small amount of power overall, i.e., much
less than powering the ECU normally.
The adaptive data is check-summed using a 16-bit CRC. Failure to match the check-sums on
start-up means that the data cannot be recovered. In this case, or if the model is simulated,
adaptive data is reverted to the default value specified when the model was built.
6.1.67.4. Inports
• adapt_increment
The increment to the current adapted value. The increment is only used when the inports
adapt and reset are conditioned correctly.
• adapt
1 if the current adapted value should be adjusted, 0 otherwise. If the inport reset is 1, no
adaption will occur (even if inport adapt is 1).
Range: 0 or 1
• reset
1 if the current adapted value should be reset to Adaptive Scalar (default), 0 otherwise.
Range: 0 or 1
6.1.67.5. Outports
• adapted_scalar
The name of the default adapted scalar output value (e.g., vftc_myscalar). The adaptive
block reverts to this value when the reset inport is asserted or when the block data is
unrecoverable during power initialisation of the ECU.
• Sample time
6.1.67.7. Notes
• The build process generates a corresponding ASAP2 entry to the adaptive parameter
that can be accessed via a calibration tool. The name of this entry has a fifth character
'a', i.e., given the default parameter name vftc_myscalar, an ASAP2 entry with name
vftca_myscalar is generated. Note that this implies that only a single adaptable value
can exist per named default parameter.
Warning
If two or more blocks refer to the same named item in the Adaptive Scalar (default)
field, these blocks will independently adapt the same adaptive parameter.
6.1.68.3. Description
n
valid _n
u
Array :
change
u'
reset
pnv_ array
Sets outport u' to the value of the adapted array indexed by inport n. Before outport u is set,
the value of indexed adapted array can be changed to inport u.
The target non-volatile memory is provided in two ways: either through storage that requires
an external power source when the ECU is powered down (battery backed RAM storage),
or not (Flash storage). See the technical specification for details on which storage type is
supported by each target.
The battery backed non-volatile memory requires a small amount of power overall, i.e., much
less than powering the ECU normally.
The adaptive data is check-summed using a 16-bit CRC. Failure to match the check-sums on
start-up means that the data cannot be recovered. In this case, or if the model is simulated,
adaptive data is reverted to the default value specified when the model was built.
6.1.68.4. Inports
• n
• u
The value to write to the nth element of the array. The type of this inport is the same as
the type of the parameter Array Data (default).
• change
1 if the nth element of the array should be change to inport u, 0 otherwise. If the inport
reset is 1, no change will occur (even if inport change is 1).
Range: 0 or 1
• reset
1 to change the array to the values of the Array Data (default) parameter, 0 otherwise.
Range: 0 or 1
Calibratable: No
6.1.68.5. Outports
• valid_n
1 if inport n refers to an element in the array, 0 if inport n is larger than the number of
array elements.
• u'
The value of the nth element of the array, possibly after the array has been changed. The
type of this outport is the same as the type of the parameter Array Data (default).
• whole_array
The current values of all elements of the array, possibly after the array has been changed,
output as a vector. The type of this outport is the same as the type of the parameter Array
Data (default). This outport is only present when the Output entire array contents? mask
parameter checkbox is ticked.
The name of the DDE for the array (e.g. vftv_array, see Section "Naming rules"). An
array can contain one or more elements. The type of the array dictates the type of inport
u and outport u'.
Tick this checkbox to create an outport from the block to output the entire array contents.
• Sample time
6.1.68.7. Notes
• The build process generates a corresponding ASAP2 entry to the adaptive parameter
that can be accessed via a calibration tool. The name of this entry has a fifth character
'a', i.e., given the default parameter name vtfv_array, an ASAP2 entry with name
vtfva_array is generated. Note that this implies that only a single adaptive parameter
can exist per named default parameter.
Warning
If two or more blocks refer to the same named item in the Array Data (default) field,
these blocks will independently adapt the same adaptive parameter.
6.1.69.3. Description
sim_ ram_ adaptive _ checksum_ok ram_ adaptive _ checksum_ok
NV Status
Flash Storage : off
sim_ flash_ adaptive _ checksum_ok flash_ adaptive _ checksum_ok
pnv_ status
The non-volatile status block details the state of all non-volatile memories. For most ECUs,
only flash storage is present.
6.1.69.4. Inports
• sim_ram_adaptive_checksum_ok
Range: 0 or 1
• sim_flash_adaptive_checksum_ok
Range: 0 or 1
6.1.69.5. Outports
• ram_adaptive_checksum_ok
1 if the battery-backed RAM adaptive data check-sum is valid and up to date, 0 otherwise.
If the adaptive data check-sum is invalid or inconsistent with the data stored in the battery
backed RAM at model start up, the adaptive data is reverted to default - see help on the
following adaptive data blocks: adaptive checksum, scalar, 1-d or 2-d maps, or arrays.
Range: 0 or 1
• flash_adaptive_checksum_ok
1 if the adaptive data check-sum is valid either at start up or after a NVM update, 0
otherwise. If the adaptive data check-sum is invalid at model start up, the adaptive data is
reverted to default - see help on the following adaptive data blocks: adaptive checksum,
scalar, 1-d or 2-d maps, or arrays.
Range: 0 or 1
• Sample time
6.1.69.7. Notes
None.
6.1.70.3. Description
enable
pss_ OutputControl
The output control block enables or disables some of the output driver devices on the target
hardware.
If the pss_OutputControl block is not present in a model, then the output drivers are enabled
when the model starts.
M250 ECUs
On the M250 ECUs, the output control block turns on or off the high side switches (pin A16)
from which individual actuators can be attached. The choice of actuators which are directly
controlled by this block is under the control of the system designer.
VPWR
LOAD
LOAD
switch control from blockset
(e.g., from digital output block)
PWRGND
PWRGND
M460 ECU
On the M460 ECU, the output control block turns on or off the high side switches (pins A19,
A29, A39, A40) from which individual actuators can be attached. The choice of actuators
which are directly controlled by this block is under the control of the system designer.
VPWR
LOAD
LOAD
weak
switch control from software
pull
(e.g., from digital output)
down
PWRGND
weak
switch control from software
pull
(e.g., from PWM output)
down
PWRGND
See Section 6.1.72, “Over current trip reset and diagnostic enable
(pss_OvercurTripReset_DiagnEnable)” for a method to use the weak pull-up and pull-down
resistors to diagnose issues with the connected actuators.
6.1.70.4. Inports
• enable
Set to 1 to enable the output drivers, set to 0 to disable the output drivers.
Range: 0 or 1
6.1.70.5. Outports
None.
6.1.70.7. Notes
None.
6.1.71.3. Description
pss_ OvercurTripReset
• Over-current trip latch reset — when the overcur_trip_reset inport transitions from 0
to 1, the block records a request to clear the over-current trip latches. See the technical
specification for the target ECU for details regarding the over-current trip latches.
6.1.71.4. Inports
• overcur_trip_reset
Change from 0 to 1 to request a reset of the over-current trip latches. The request is
buffered by the blockset and actioned when enough time has past since the last over-
current trip reset (ensuring time for sufficient ECU heat dissipation).
Range: 0 or 1
6.1.71.5. Outports
None.
6.1.71.7. Notes
None.
6.1.72.3. Description
diagnostic _ enable
• High side (safety switch) diagnostic enable — the diagnostic_enable inport controls the
switch for a weak pull-up resistor in parallel with the high side switch. This functionality is
only implemented on M460 target, see the technical specification for M460 for details on
the high side diagnostic functionality.
• Over-current trip latch reset — when the overcur_trip_reset inport transitions from 0
to 1, the block records a request to clear the over-current trip latches. See the technical
specification for the target ECU for details regarding the over-current trip latches.
If the pss_OvercurTripReset_DiagnEnable block is not present in a model, then the high side
diagnostic weak pull-up resistor switch is initialised open by the blockset when the ECU starts
to run the model.
6.1.72.4. Inports
• diagnostic_enable
Set to 1 to close the high side diagnostic weak pull-up resistor switch, set to 0 to open
the switch.
Range: 0 or 1
• overcur_trip_reset
Change from 0 to 1 to request a reset of the over-current trip latches. The request is
buffered by the blockset and actioned when enough time has past since the last over-
current trip reset (ensuring time for sufficient ECU heat dissipation).
Range: 0 or 1
6.1.72.5. Outports
None.
6.1.72.7. Notes
None.
6.1.73.3. Description
injector _ frequency sim_ injector _ frequency
pdx_ PeakHoldInjectorOutput
The peak and hold injector output block causes a stepped current signal to be generated at
the selected injector frequency, in which the current is firstly controlled to the peak current
threshold for the duration determined by the peak duty cycle, after which it is controlled to the
hold current threshold for the remaining duration of the peak-hold duty cycle (i.e. the duration
of the peak-hold duty cycle minus the peak duty cycle), after which the current falls to zero
until the beginning of the next cycle.
Peak current
Hold current
Injector current
Peak channel
Injector clock
The injector frequency, clock frequency, peak duty cycle and peak-hold duty cycle are all
driven from block inputs. The actual duty cycles are scaled by the mask parameter Min/Max
duty cycle as follows:
output peak duty cycle = Minimum duty cycle + (Maximum duty cycle - Minimum duty cycle)
* peak_duty_cycle
output peak-hold duty cycle = Minimum duty cycle + (Maximum duty cycle - Minimum duty
cycle) * peak_hold_duty_cycle
Furthermore, the output peak-hold duty cycle is always constrained to be at least as great
as the output peak duty cycle.
The channel output can be offset from other injector channels of the same frequency. The
Offset parameter is used to delay the start of the injector cycle, so that the injector will not
activate at the same time as other injector signals of the same frequency.
Other channel
(with same
frequency) signal
Channel signal
Offset time
If the inport fault input is non-zero, then the output peak duty cycle is set to the mask
parameter Peak default duty cycle and the output peak-hold duty cycle is set to the mask
parameter Peak-hold default duty cycle.
6.1.73.4. Inports
• injector_frequency
• peak_duty_cycle
After being rescaled by the mask parameter Min/Max duty cycle as described above, this
is the ratio of the peak current time to the injector cycle time.
• peak_hold_duty_cycle
After being rescaled by the mask parameter Min/Max duty cycle as described above, this
is the ratio of the peak-hold current time to the injector cycle time.
• fault
Set to 1 to force the block to use the default peak and peak-hold duty cycles, 0 otherwise.
Range: 0 or 1
• clock_frequency
6.1.73.5. Outports
• sim_injector_frequency
Only used in simulation. This outport is set to the calculated frequency for the injector
cycles.
• sim_peak_duty_cycle
Only used in simulation. This outport is set to the calculated duty cycle (after rescaling by
the mask parameter Min/Max duty cycle as described above) for the peak channel.
• sim_peak_hold_duty_cycle
Only used in simulation. This outport is set to the calculated duty cycle (after rescaling by
the mask parameters Min/Max duty cycle as described above) for the peak-hold channel.
It is constrained to be at least as great as the peak duty cycle.
• sim_clock_frequency
Only used in simulation. This outport is set to the calculated frequency for the injector clock.
• Injector channel
The injector channel for this block. The peak, peak-hold and injector clock channels are
automatically assigned based on this.
The frequency of the channel signal before the block first iterates.
This is the final duty cycle of the peak signal when inport fault is set. The duty cycle is
mapped directly to the output channel.
Range: 0 or 1 duty-cycle
The duty cycle of the peak signal (prior to rescaling by Min/Max duty cycle) before the
block has first been executed.
This is the final duty cycle of the peak-hold signal when inport fault is set. The duty cycle
is mapped directly to the output channel.
Range: 0 or 1 duty-cycle
The duty cycle of the peak-hold signal (prior to rescaling by Min/Max duty cycle) before
the block has first been executed.
The frequency of the injector clock signal before the block first iterates.
Defines the lower and upper end of the window into which the input duty cycles are rescaled
before use. The lower limit must be in the range 0 to (upper limit - 0.1). Similarly the upper
limit must be in the range (lower limit + 0.1) to 1.0.
• Offset
The desired phase offset, in milliseconds, of the injector output, relative to other injector
output channels that have been configured with the same frequency.
6.1.73.7. Notes
6.1.74.3. Description
error_ detected
error_ address
psc_ InternalRamTestError
Gets the recoverable error status of the ECU's internal RAM test as well as the address of
the last error.
6.1.74.4. Inports
• sim_error_detected
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport error_detected is set to the value of this inport for simulation purposes.
Range: [0, 1]
• sim_error_address
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport error_address is set to the value of this inport for simulation purposes.
6.1.74.5. Outports
• error_detected
1 when a recoverable memory test error has been detected, 0 otherwise. Under simulation,
if the Provide simulation inports parameter isn't ticked, the outport is set to the minimum
of its range. The signal attached to the outport must be set as ExportedGlobal.
Range: [0, 1]
• error_address
The internal memory address where a recoverable error has been detected. The outport
is only valid if error_detected is 1. Under simulation, if the Provide simulation inports
parameter isn't ticked, the outport is set to the minimum of its range. The signal attached
to the outport must be set as ExportedGlobal.
• Sample time
6.1.74.7. Notes
Unrecoverable memory test errors are reported by the put_Reset block.
6.1.75.3. Description
start_ address
end_ address
current_ address
psc_ InternalRamTestProgress
Gets the start address, end address, and current address of the ECU's internal RAM test.
The test checks a fixed number of internal memory segments during each iteration of the
model. The test starts over once it reaches the end address.
6.1.75.4. Inports
• sim_start_address
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport start_address is set to the value of this inport for simulation purposes.
• sim_end_address
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport end_address is set to the value of this inport for simulation purposes.
• sim_current_address
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport current_address is set to the value of this inport for simulation purposes.
6.1.75.5. Outports
• start_address
The first address of the internal memory test. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• end_address
The last address of the internal memory test. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• current_address
The current address of the internal memory test. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• Sample time
6.1.75.7. Notes
None.
6.1.76.3. Description
error_ detected
error_ address
psc_ InternalRomTestError
Gets the recoverable error status of the ECU's internal ROM test as well as the address of
the last error.
6.1.76.4. Inports
• sim_error_detected
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport error_detected is set to the value of this inport for simulation purposes.
Range: [0, 1]
• sim_error_address
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport error_address is set to the value of this inport for simulation purposes.
6.1.76.5. Outports
• error_detected
1 when a recoverable memory test error has been detected, 0 otherwise. Under simulation,
if the Provide simulation inports parameter isn't ticked, the outport is set to the minimum
of its range. The signal attached to the outport must be set as ExportedGlobal.
Range: [0, 1]
• error_address
The internal memory address where a recoverable error has been detected. The outport
is only valid if error_detected is 1. Under simulation, if the Provide simulation inports
parameter isn't ticked, the outport is set to the minimum of its range. The signal attached
to the outport must be set as ExportedGlobal.
• Sample time
6.1.76.7. Notes
Unrecoverable memory test errors are reported by the put_Reset block.
6.1.77.3. Description
start_ address
end_ address
current_ address
psc_ InternalRomTestProgress
Gets the start address, end address, and current address of the ECU's internal ROM test.
The test checks a fixed number of internal memory segments during each iteration of the
model. The test starts over once it reaches the end address.
6.1.77.4. Inports
• sim_start_address
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport start_address is set to the value of this inport for simulation purposes.
• sim_end_address
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport end_address is set to the value of this inport for simulation purposes.
• sim_current_address
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport current_address is set to the value of this inport for simulation purposes.
6.1.77.5. Outports
• start_address
The first address of the internal memory test. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• end_address
The last address of the internal memory test. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• current_address
The current address of the internal memory test. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• Sample time
6.1.77.7. Notes
None.
6.1.78.3. Description
year
month
day
psc_ PlatformBuildDate
Gets the build date for the ECU's platform code. The build date can be used to distinguish
between different versions of the platform code.
6.1.78.4. Inports
• sim_year
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport year is set to the value of this inport for simulation purposes.
• sim_month
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport month is set to the value of this inport for simulation purposes.
• sim_day
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport day is set to the value of this inport for simulation purposes.
6.1.78.5. Outports
• year
The year the platform code was built. Under simulation, if the Provide simulation inports
parameter isn't ticked, the outport is set to the minimum of its range. The signal attached
to the outport must be set as ExportedGlobal.
• month
The month of the year the platform code was built. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to the minimum of its range. The
signal attached to the outport must be set as ExportedGlobal.
• day
The day of the month the platform code was built. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to the minimum of its range. The
signal attached to the outport must be set as ExportedGlobal.
6.1.78.7. Notes
None.
6.1.79.3. Description
major _ ver
minor _ ver
psc_ PlatformVersion
Gets the version information for the ECU's platform code. The version number is composed
of three fields, major, minor and sub-minor, typically written as major.minor.sub-minor.
The version can be used by the application for version control or diagnostics.
6.1.79.4. Inports
• sim_major_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport major_ver is set to the value of this inport for simulation purposes.
• sim_minor_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport minor_ver is set to the value of this inport for simulation purposes.
• sim_sub_minor_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport sub_minor_ver is set to the value of this inport for simulation purposes.
6.1.79.5. Outports
• major_ver
The major version number of the platform code. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• minor_ver
The minor version number of the platform code. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• sub_minor_ver
The sub-minor version number of the platform code. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to the minimum of its range. The
signal attached to the outport must be set as ExportedGlobal.
6.1.79.7. Notes
None.
6.1.80.3. Description
group_id
group_ letter
part_id
issue
psc_ PlatformPartNumber
Gets the part number information for the ECU's platform code. The part number is composed
of four fields, group identification number, group identification letter, part identification number
and issue number, typically written as group_idgroup_letter-part_id Iss issue.
Example: 12T-168232 Iss 3 The part number can be used by the application for
diagnostics, tracking and identification.
6.1.80.4. Inports
• sim_group_id
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport group_id is set to the value of this inport for simulation purposes.
• sim_group_letter
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport group_letter is set to the value of this inport for simulation purposes.
• sim_part_id
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport part_id is set to the value of this inport for simulation purposes.
• sim_issue
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport issue is set to the value of this inport for simulation purposes.
6.1.80.5. Outports
• group_id
The Group Identification number of the part number of the platform code. Under simulation,
if the Provide simulation inports parameter isn't ticked, the outport is set to the minimum
of its range. The signal attached to the outport must be set as ExportedGlobal.
• group_letter
The Group Identification letter of the part number of the platform code. The value
represents the ASCII code of the letter. Under simulation, if the Provide simulation inports
parameter isn't ticked, the outport is set to the minimum of its range. The signal attached
to the outport must be set as ExportedGlobal.
• part_id
The Part Identification number of the part number of the platform code. Under simulation,
if the Provide simulation inports parameter isn't ticked, the outport is set to the minimum
of its range. The signal attached to the outport must be set as ExportedGlobal.
• issue
The Issue number of the part number of the platform code. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to the minimum of its range. The
signal attached to the outport must be set as ExportedGlobal.
6.1.80.7. Notes
None.
6.1.81.3. Description
loading
psc_ CpuLoading
Determines the load on the main processor over the last 50 milliseconds and the maximum
load since the ECU was powered on (or last reset).
The load is calculated as the time used by any running task or interrupt over a 50 millisecond
window, expressed as a percentage. The calculation is an estimate as the 50 millisecond
window can extend over a wider duration if the processor is heavily loaded. As the 50
millisecond window does not synchronise with the model rate tasks, some aliasing can occur
as well (for instance, one 50 millisecond window may contain only a small percentage of work
done by the model, while another window may contain a higher percentage).
There is no provision to change the window duration for the loading calculation.
6.1.81.4. Inports
• sim_loading
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport loading is set to the value of this inport for simulation purposes.
6.1.81.5. Outports
• loading
The processor loading over the last 50 milliseconds or the maximum processor loading
seen since the ECU powered on (or reset). Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range.
• Output mode
Whether the loading outport is set to the processor loading over 50 milliseconds, or the
maximum loading since power on (or reset).
• Sample time
6.1.81.7. Notes
None.
6.1.82.3. Description
loading
psc_ EtpuLoading
Determines the load on each eTPU device over the last 50 milliseconds and the maximum
load since the ECU was powered on (or last reset). The eTPU device, or devices, are used
to process simple and complex I/O operations (such as decoding a crank wheel input).
The load is calculated as the time used by any running task or interrupt over a 50 millisecond
window, expressed as a percentage. The calculation is an estimate as the 50 millisecond
window can extend over a wider duration if the processor is heavily loaded. As the 50
millisecond window does not synchronise with the I/O operations, some aliasing can occur
(for instance, one 50 millisecond window may contain only a small percentage of work done
by the eTPU, while another window may contain a higher percentage).
There is no provision to change the window duration for the loading calculation.
6.1.82.4. Inports
• sim_loading
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport loading is set to the value of this inport for simulation purposes.
6.1.82.5. Outports
• loading
The eTPU loading over the last 50 milliseconds or the maximum eTPU loading seen since
the ECU last powered on (or last reset). Under simulation, if the Provide simulation inports
parameter isn't ticked, the outport is set to the minimum of its range.
• Output mode
Whether the loading outport is set to the eTPU loading over 50 milliseconds, or the
maximum loading since last power on (or last reset).
• Device
• Sample time
6.1.82.7. Notes
None.
6.1.83.3. Description
sim_ timed _ out timed _ out
pdx_ PwmInput
The input block measures a PWM signal and performs a number of operations:
Frequency measurement
The block measures the time of each high and low (or low and high) pulse to determine
the frequency of the input signal.
Input signal
active low if
invert is 0
Cycle time (1/Frequency)
Input signal
active high if
invert is 1 Cycle time (1/Frequency)
Whether the block measures a low pulse followed by a high pulse, or a high pulse
followed by a low pulse is determined by the Invert block parameter.
Pulse measurement
The block measures the durations of the first and second pulses and derives the duty
cycle (first pulse time divided by the cycle time). Very small duty cycles (less than 1% or
greater than 99%) will not be measured accurately or at all.
Period count
The block accumulates the count of complete periods modulo 16777216. The application
calculated difference of counts between iterations of the block could be used to diagnose
unexpected changes in the signal.
Input signal
Cycle/period count 0 1 2
Timeout check
The block measures the period duration and determines whether the signal has taken
longer than the Time out duration. The block accumulates the count of time out events,
and provides an outport to indicate if the signal is timed out when the block iterates.
Input signal
6.1.83.4. Inports
• sim_timed_out
Only used in simulation. Place 1 here to simulate a time out, zero otherwise.
Range: 0 or 1
• sim_timeout_count
Only used in simulation. Place a count here to simulate the count of time outs in the input
signal.
• sim_duty_cycle
Only used in simulation. Place a duty cycle here to simulate the duty cycle of the last
measured period.
• sim_freq
Only used in simulation. Place a frequency in Hz here to simulate the frequency of the
last measured period.
• sim_first_duration
Only used in simulation. Place a duration in microseconds here to simulate the first pulse
from the last measured period.
• sim_second_duration
Only used in simulation. Place a duration in microseconds here to simulate the second
pulse from the last measured period.
• sim_period_count
Only used in simulation. Place a count here to simulate the count of periods seen in the
input signal.
• sim_pin_state
Only used in simulation. Place a zero or 1 here to simulate the pin state sample.
Range: 0 or 1
6.1.83.5. Outports
• timed_out
1 if a complete period has not been measured for the timeout given by the mask parameter
Time out, zero otherwise.
Range: 0 or 1
• timeout_count
• duty_cycle
Ratio of the first pulse duration to the period, or zero if no measurement has been taken.
• freq
Frequency of the last measured period, or zero if no measurement has been taken. The
range of the frequency is limited in various ways.
• The range of the frequency that can be measured is limited by the filter circuitry of the
input pin.
• The lowest measurable frequency is limited by the filter circuitry and the size of the
corresponding processor timer for a channel. Any input frequency below the documented
limit, is reported as timed-out.
• The highest measurable frequency is limited by the filter circuitry and the resolution
of the corresponding processor timer for a channel. In general, the block reports the
frequency of the filtered signal and the input filtering forms an upper limit. However, as
the frequency increases, the resolution of measurement decreases.
Details of the input pin's filtering and processor timing can be found in an ECU's technical
specification.
• first_duration
The duration of the first pulse from the last measured period, or zero if no measurement
has been taken.
• second_duration
The duration of the second pulse from the last measured period, or zero if no measurement
has been taken.
• period_count
• pin_state
Set to 1 if the input signal is high when the block iterates, set to zero if the input signal is
low when the block iterates.
Range: 0 or 1
• Channel
• Invert
Whether the first pulse in the period will be high (option unticked) or low (option ticked). This
option does not consider any inversion performed by the hardware, the user must do so.
• Time out
The period of time after which if no complete period has been measured, the outport
timed_out is set to 1.
• Sample time
If selected then create simulation inports for each of the outport message signals.
6.1.83.7. Notes
None.
6.1.84.3. Description
Channel : CDA( pin E 17)
duty_ cycle Inversion : off
Default duty cycle :
Initial duty cycle : sim_ duty_ cycle
Frequency : Hz
fault Offset : ms
[ Min / max dutycycle ]:
pdx_ PWMOutput
The PWM output block causes the channel output pin to oscillate at a desired frequency and
duty cycle. The duty cycle is the High time divided by the Cycle time.
The actual state of the output pin is determined by the polarity of the pin. Some outputs
are low-side only, some are high-side only, and some are software selectable. For software
selectable pins, the polarity of the output can be selected by using the pdx_DigitalOutput
block with the DOT select-high-side signal for the associated pin. Refer to the technical
specification section for details on which pins support which polarities on each target.
Regardless of polarity, if the output is non-inverted, the output pin will be active during the
High time and the output pin will be off (high impedance) during the Low time. If the output
is inverted, the output will be active during the Low time and off during the High time.
High time
High time
Low time
output duty cycle = Minimum duty cycle + (Maximum duty cycle - Minimum duty cycle) *
duty_cycle
If the Minimum duty cycle is 0 and the inport duty_cycle is 0, the output channel state is set
low and does not oscillate. When the Maximum duty cycle is 1 and the inport Duty_cycle is
1, the output channel state is set high and does not oscillate.
The block supports 0% and 100% duty cycles, where the output signal no longer pulses. A
0% duty cycle is defined as High time equals zero and 100% duty cycle is defined as Low
time equals zero.
The channel output pin state can be inverted in order to achieve the desired logical output
state.
The channel output can be offset from other PWM channels of the same frequency. The
{Offset} parameter is used to delay the start of the PWM cycle, so that the PWM pulse will
not occur at the same time as other PWM signals of the same frequency.
Channel signal
If the inport fault input is nonzero, then the output is set to the default duty cycle mask
parameter. The default duty cycle is never inverted and can only be set to zero or one so care
should be taken to chose the appropriate value to disable the output during a fault condition.
6.1.84.4. Inports
• duty_cycle
• fault
Place a 1 here to force the block to use the default duty cycle for the output, 0 otherwise.
Range: 0 or 1
6.1.84.5. Outports
• sim_duty_cycle
Only used in simulation. this outport is set to the requested duty cycle (i.e., duty_cycle
or the default duty cycle).
• Channel
• Inversion
Inverts the mapping of the input value to the channel pin. If inversion is ticked then a logical
NOT operation is applied to the output state.
This value is used if fault is active. The value is mapped directly to the output channel
and is never inverted. Care should be taken to choose the appropriate value to drive the
output off.
Range: 0 or 1 duty-cycle
The duty cycle that is output before the block has first been executed. This value is used
in a similar way to Default duty cycle in that it is never inverted, however it can be set
anywhere in the range 0 to 1.
• Frequency
• Offset
The desired phase offset, in milliseconds, of the PWM output, relative to other PWM output
channels that have been configured with the same frequency.
Target Range
M110 Not supported
M220 Not supported
M221 Not supported
M250 [0, 2000] ms
M460 [0, 2000] ms
M461 Not supported
M670 Not supported
6.1.84.7. Notes
• The resolution of the PWM channels depends on the output device (specified in the
hardware target tables in Section A.1, “ECU hardware reference documentation”). Some
channels have better resolution that others.
• Some of the PWM output channels do not produce an accurate wave form when the duty
cycle is either very small (e.g., 0.5%) or very large (e.g., 99.5%). All PWM output channels
cope with 0% and 100% duty cycles correctly.
For the M250 target specifically, in order to avoid shoot-through and damage to the ECU
when the mode switches, a 100us dead-time is inserted in the PWM signal for one task
cycle at the beginning of mode-transition. Additionally, this dead-time insertion will only
occur if the duty cycle that is commanded has a low time of less than 100us. For this
reason, it will not be possible to command a 100% duty cycle during mode-transition for
one task period.
6.1.85.3. Description
Channel : CDA( pin E 17)
duty_ cycle Inversion : off sim_ duty_ cycle
Default duty cycle :
frequency Initial duty cycle :
Initial frequency : Hz
Offset : ms sim_ frequency
fault
[ Min / max dutycycle ]:
pdx_ PWMVariableFrequencyOutput
The PWM output block causes the channel output pin to oscillate at a desired frequency and
duty cycle. A duty cycle is the High time divided by the Cycle time.
High time
High time
Low time
output duty cycle = Minimum duty cycle + (Maximum duty cycle - Minimum duty cycle) *
duty_cycle
If the Minimum duty cycle is 0 and the inport duty_cycle is 0, the output channel state is set
low and does not oscillate. When the Maximum duty cycle is 1 and the inport Duty_cycle is
1, the output channel state is set high and does not oscillate.
The block supports 0% and 100% duty cycles, where the output signal no longer pulses. A
0% duty cycle is defined as High time equals zero and 100% duty cycle is defined as Low
time equals zero.
The channel output pin state can be inverted in order to achieve the desired logical output
state.
If the inport fault input is nonzero, then the output is set to the default duty cycle mask
parameter (the default duty cycle is never inverted).
6.1.85.4. Inports
• duty_cycle
• frequency
• fault
Place a 1 here to force the block to use the default frequency and duty cycle for the output,
0 otherwise.
Range: 0 or 1
6.1.85.5. Outports
• sim_duty_cycle
Only used in simulation. this outport is set to the processed duty cycle (i.e., duty_cycle or
Initial duty cycle).
• sim_frequency
• Channel
• Inversion
Inverts the mapping of the input value to the channel pin. If inversion is set to 1 then a
logical NOT operation is applied to the output state.
This is the duty cycle of the channel when inport fault is set. The duty cycle is mapped
directly to the output channel and is not inverted by parameter Inversion.
The duty cycle of the channel signal before the block has first been executed. This duty
cycle is inverted if the mask parameter Inversion is set to 1.
• Initial frequency
The frequency of the PWM signal before the block first iterates.
• Offset
The desired phase offset, in milliseconds, of the PWM output, relative to other PWM output
channels that have been configured with the same frequency.
Target Range
M110 Not supported
M220 Not supported
M221 Not supported
M250 [0, 2000] ms
M460 [0, 2000] ms
M461 Not supported
M670 Not supported
6.1.85.7. Notes
• The resolution of the PWM channels depends on the output device (specified in the
hardware target tables in Section A.1, “ECU hardware reference documentation”). Some
channels have better resolution that others, notably the MIOS channels.
• Some of the PWM output channels do not produce an accurate wave form when the duty
cycle is either very small (e.g., 0.5%) or very large (e.g., 99.5%). All PWM output channels
cope with 0% and 100% duty cycles correctly.
For the M250 target specifically, in order to avoid shoot-through and damage to the ECU
when the mode switches, a 100us dead-time is inserted in the PWM signal for one task
cycle at the beginning of mode-transition. Additionally, this dead-time insertion will only
occur if the duty cycle that is commanded has a low time of less than 100us. For this
reason, it will not be possible to command a 100% duty cycle during mode-transition for
one task period.
6.1.86.3. Description
duty_ cycle
Channel : DOT ( pin A1)
Inversion : off
Default duty cycle :
frequency Initial duty cycle :
Initial frequency : Hz
Offset : ms average_ voltage
[ Min / max dutycycle ]:
fault Analog input channel : AIN ( pin A12)
Number of samples:
Sampling point :
Sampling phase : High time
sim_ average_ voltage
pdx_ PWMOutputWithSyncSampling
The PWM output block causes the channel output pin to oscillate at a desired frequency and
duty cycle. A duty cycle is the High time divided by the Cycle time.
High time
High time
Low time
output duty cycle = Minimum duty cycle + (Maximum duty cycle - Minimum duty cycle) *
duty_cycle
If the Minimum duty cycle is 0 and the inport duty_cycle is 0, the output channel state is set
low and does not oscillate. When the Maximum duty cycle is 1 and the inport Duty_cycle is
1, the output channel state is set high and does not oscillate.
The block supports 0% and 100% duty cycles, where the output signal no longer pulses. A
0% duty cycle is defined as High time equals zero and 100% duty cycle is defined as Low
time equals zero.
The channel output pin state can be inverted in order to achieve the desired logical output
state.
If the inport fault input is nonzero, then the output is set to the default duty cycle mask
parameter (the default duty cycle is never inverted).
6.1.86.4. Inports
• duty_cycle
• frequency
• fault
Place a 1 here to force the block to use the default frequency and duty cycle for the output,
0 otherwise.
Range: 0 or 1
• sim_average_voltage
Only used in simulation. When the model is simulated, the outport average_voltage is set
to the value of this inport.
6.1.86.5. Outports
• average_voltage
The average value of the analog input measured synchronously to the PWM output signal.
• Channel
• Inversion
Inverts the mapping of the input value to the channel pin. If inversion is set to 1 then a
logical NOT operation is applied to the output state.
This is the duty cycle of the channel when inport fault is set. The duty cycle is mapped
directly to the output channel and is not inverted by parameter Inversion.
The duty cycle of the channel signal before the block has first been executed. This duty
cycle is inverted if the mask parameter Inversion is set to 1.
• Initial frequency
The frequency of the PWM signal before the block first iterates.
• Offset
The desired phase offset, in milliseconds, of the PWM output, relative to other PWM output
channels that have been configured with the same frequency.
• Sampling point
The desired sampling point of the analog input relative to the PWM output signal. The
sampling point is during the selected phase (high or low) of the PWM output signal.
Normally 0.5 to sample at the center of the PWM phase.
• Sampling phase
The desired sampling phase of the analog input relative to the PWM output signal.
6.1.86.7. Notes
6.1.87.3. Description
pdx_ QuadratureDecode
This block decodes the signals from a quadrature encoder. A quadrature encoder generates
a pulse train from two sensors which pick up markings on the encoder disk.
Primary channel
The sensor signals are
conditioned by the encoder
and sensed by OpenECU. Secondary channel
Encorder disk,
rotating forwards.
Primary and secondary channel edges 90°
out of phase. Decoding the phase of the edges
determines the rotation of the encoder.
The sensors and markings are arranged so that when the encoder is turning, the sensor
signals generate two pulse trains 90° out of phase. If the disk is turning in a forwards direction,
the primary channel edges will lead the secondary channel edges. If the disk is turning in a
backwards direction then the primary channel edges will lag the secondary channel edges.
If there are no signal edges on either channel after a period of time, then the encoder has
stopped turning (or is turning slowly enough to be considered stationary).
Primary channel shows leading edges. Primary channel shows lagging edges.
Forwards direction Backwards direction
Primary channel
Secondary channel
The quadrature decode block measures the primary and secondary channels, determines
the direction at each pulse and counts the pulses. If the encoder is turning forwards then for
each edge on the primary and secondary channels, the block increments the count. If the
encoder is turning backwards then for each edge on the primary and secondary channels,
the block decrements the count. When the block iterates, it outputs the count of pulses and
resets the count to zero.
For instance, if the encoder turns forwards for nine edges between iterations of the block,
the block output will be nine. If the encoder turns forwards for six edges and then backwards
for two edges between executions of the block, the block output will be four.
Primary channel
Secondary channel
Edge count 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 5 4
Note
Some encoders provide an index signal and some encoders provide complement
signals of the primary and secondary signals, both for the purposes of improving
reliability. This block does not decode these signals.
6.1.87.4. Inports
• sim_input
Only used in simulation. place the sum of edges here to simulate the number of edges
sensed since the last iteration of this block. A value of zero indicates that the encoder
position is at the same place as it was when the block was last iterated.
Range: [-8388608, 8388607] edges (for M221, M250, M460, M461 and M670 targets)
6.1.87.5. Outports
• edges_sensed
The count of edges sensed since the last time the block was iterated. A value of zero
indicates that the the encoder position is at the same place as it was when the block was
last iterated.
Range: [-8388608, 8388607] edges (for M221, M250, M460, M461 and M670 targets)
• Primary channel
The input pin sourcing the primary signal to measure. The relationship between the primary
and secondary channels is explained above.
• Secondary channel
The input pin sourcing the secondary signal to measure. The relationship between the
primary and secondary channels is explained above.
• Sample time
6.1.87.7. Notes
• If the edges_sensed outport is zero, it means the encoder position is in the same position
as it was when the block was last iterated. This can occur if the encoder position has not
moved, or if the encoder position has moved and returned to its original position. This
should be kept in mind if the block will be used to derive the encoder's velocity.
• The block iteration period must be sufficient to ensure that the sum of leading and lagging
edges is no more than 32767 between iterations of the block. If the sum of edges is greater
than 32767 then the edges_sensed outport will contain the sum of edges modulo 32768.
6.1.88.3. Description
sim_ primary_ timed _ out primary_ timed _ out
sim_ secondary_ timed _ out Primary channel : CID 1 ( pin E 45) secondary_ timed _ out
Secondary channel : CID 1 ( pin E 45)
sim_ primary_ frequency Secondary pulse count : primary_ frequency
Timeout : Hz
sim_ secondary_ frequency Sample time : secondary_ frequency
pdx_ QuadratureDecodeAndFrequencyInput
This block decodes the signals from a quadrature encoder. A quadrature encoder generates
a pulse train from two sensors which pick up markings on the encoder disk.
Primary channel
The sensor signals are
conditioned by the encoder
and sensed by OpenECU. Secondary channel
Encorder disk,
rotating forwards.
Primary and secondary channel edges 90°
out of phase. Decoding the phase of the edges
determines the rotation of the encoder.
The sensors and markings are arranged so that when the encoder is turning, the sensor
signals generate two pulse trains 90° out of phase. If the disk is turning in a forwards direction,
the primary channel edges will lead the secondary channel edges. If the disk is turning in a
backwards direction then the primary channel edges will lag the secondary channel edges.
If there are no signal edges on either channel after a period of time, then the encoder has
stopped turning (or is turning slowly enough to be considered stationary).
Primary channel
Secondary channel
The quadrature decode block measures the primary and secondary channels, determines
the direction at each pulse and counts the pulses. If the encoder is turning forwards then for
each edge on the primary and secondary channels, the block increments the count. If the
encoder is turning backwards then for each edge on the primary and secondary channels,
the block decrements the count. When the block iterates, it outputs the count of pulses and
resets the count to zero.
For instance, if the encoder turns forwards for nine edges between iterations of the block,
the block output will be nine. If the encoder turns forwards for six edges and then backwards
for two edges between executions of the block, the block output will be four.
Primary channel
Secondary channel
Edge count 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 5 4
Note
Some encoders provide an index signal and some encoders provide complement
signals of the primary and secondary signals, both for the purposes of improving
reliability. This block does not decode these signals.
The block also measures the duration of each pulse from the encoder primary and secondary
channels and outputs the last measured frequency of each channel. If the frequency of a
channel has not been measured (because a complete signal pulse has not yet occurred),
then the corresponding frequency outport is set to zero.
If the primary or secondary channel does not complete a pulse for longer than the block's
timeout value, then the corresponding primary_timed_out and secondary_timed_out outports
of the block are set. When a timeout occurs, the frequency outport for that channel remains at
its last known frequency measurement (or zero if a measurement has not been completed).
6.1.88.4. Inports
• sim_primary_timed_out
Only used in simulation. Place 1 here to simulate a time out for the primary channel
frequency measurement, 0 otherwise.
Range: 0 or 1
• sim_secondary_timed_out
Only used in simulation. Place 1 here to simulate a time out for the secondary channel
frequency measurement, 0 otherwise.
Range: 0 or 1
• sim_primary_frequency
Only used in simulation. Place the frequency in hertz here to simulate the last measured
primary channel frequency. A measurement of zero hertz indicates that no measurement
is available.
• sim_secondary_frequency
Only used in simulation. Place the frequency in hertz here to simulate the last
measured secondary channel frequency. A measurement of zero hertz indicates that no
measurement is available.
• sim_edges_sensed
Only used in simulation. Place the count of edges here to simulate the number of edges
sensed since the last execution of this block. A value of zero indicates that the encoder
position is at the same place as it was when the block was last iterated.
Range: [-8388608, 8388607] edges (for M221, M250, M460, M461, and M670 targets)
6.1.88.5. Outports
• primary_timed_out
1 if the primary channel input signal has not completed a pulse within the mask parameter
timeout period at the point of sampling (see the mask parameter section below), 0
otherwise.
Range: 0 or 1
• secondary_timed_out
1 if the secondary channel input signal has not completed a pulse within the mask
parameter timeout period at the point of sampling (see the mask parameter section below),
0 otherwise.
Range: 0 or 1
• primary_frequency
The last measured primary channel frequency in hertz, or 0 if no measurement has been
taken (regardless of the state of outport primary_timed_out). The range of the frequency
is limited in various ways.
• The range of the frequency that can be measured is limited by the filter circuitry of the
input pin.
• The lowest measurable frequency is limited by the filter circuitry and the size of the
corresponding processor timer for a channel. Any input frequency below the documented
limit, is reported as timed-out.
• The highest measurable frequency is limited by the filter circuitry and the resolution
of the corresponding processor timer for a channel. In general, the block reports the
frequency of the filtered signal and the input filtering forms an upper limit. However, as
the frequency increases, the resolution of measurement decreases.
Details of the input pin's filtering and processor timing can be found in an ECU's technical
specification.
Range: [0.5, ...] Hz (for M221, M250, M460, M461 and M670 targets)
• secondary_frequency
Range: [0.5, ...] Hz (for M221, M250, M460, M461 and M670 targets)
• edges_sensed
The count of edges sensed since the last time the block was iterated. A value of zero
indicates that the the encoder position is at the same place as it was when the block was
last iterated.
Range: [-8388608, 8388607] edges (for M221, M250, M460, M461 and M670 targets)
• Primary channel
The input pin sourcing the primary signal to measure. The relationship between the primary
and secondary channels is explained above.
• Secondary channel
The input pin sourcing the secondary signal to measure. The relationship between the
primary and secondary channels is explained above.
The number of pulses to accumulate when calculating the frequency for the secondary
input channel. The primary channel frequency is always calculated by measuring one
complete pulse.
• Time out
The period of time in hertz after which if no complete pulse has been measured for
the primary or secondary channel, the corresponding outports primary_timed_out and
secondary_timed_out are set to 1.
Range: [0.5, 10000] Hz (for M221, M250, M460, M461 and M670 targets)
• Sample time
6.1.88.7. Notes
• If the edges_sensed outport is zero, it means the encoder position is in the same position
as it was when the block was last iterated. This can occur if the encoder position has not
moved, or if the encoder position has moved and returned to its original position. This
should be kept in mind if the block will be used to derive the encoder's velocity.
• The block iteration period must be sufficient to ensure that the sum of leading and lagging
edges is no more than 8388607 (for M221, M250, M460, M461 and M670 targets) between
iterations of the block. If the sum of edges is greater then the edges_sensed outport will
wrap with modulo arithmetic, (24-bit for M221, M250, M460, M461 and M670 targets).
• The primary and secondary frequency outports may differ in value due to hardware filtering.
A specific example of this would be where the two channels have differing low pass filters
such that the input signals are cut off at different frequencies.
6.1.89.3. Description
u
max_ range_ fault
max_ value
put_ RangeCheck
6.1.89.4. Inports
• u
• max_value
A value of u greater than this causes the outport max_range_fault to become set.
• min_value
A value of u less than this causes the outport min_range_fault to become set.
6.1.89.5. Outports
• max_range_fault
• min_range_fault
6.1.89.7. Notes
None.
6.1.90.3. Description
power_ reset
watchdog_ reset
access_ reset
unknown_ reset
boot _ duration
put_ Reset
Allow the user to force the module to reset. Provide information about the previous reset
event including how long the module took to start iterating the model.
6.1.90.4. Inports
• force_reset
Set to 1 to cause the ECU to reset, 0 otherwise. The reset is occurs as soon as the block
iterates and causes the ECU to boot as if from power up. If the FEPS module pin is held
high, the ECU will start reprogramming mode and not start the model.
Range: 0 or 1
6.1.90.5. Outports
• power_reset
Set to 1 if the last reset event was from a power up event, 0 otherwise.
• watchdog_reset
Set to 1 if the last reset event was due to the ECU's processor watchdog, 0 otherwise.
• access_reset
Set to 1 if the last reset event was due to incorrect software in the model or platform
accessing a memory area in the controller that did not exist, 0 otherwise.
• fp_reset
Set to 1 if the last reset event was due to incorrect software in the model that attempted
to manipulate a floating point value in a way the ECU's processor determined as invalid,
0 otherwise. Note that floating point exceptions are not enabled on all platforms and as
such the lack of a floating point reset is not sufficient to prove that the model is free from
floating point manipulation errors.
• mem_reset
Set to 1 if the last reset event was due to an unrecoverable corruption of internal memory,
0 otherwise. The cause of a reset that occurs as a result of memory corruption may not
always be identified by software. If the cause cannot be identified by the platform software,
then the reset will be reported by the unknown_reset outport.
• forced_reset
Set to 1 if the last reset event was due to a forced model reset, 0 otherwise.
• unknown_reset
• boot_duration
A rough indication of how long the module took to boot (i.e., from processor start to starting
the first model iteration) in seconds. Only if the version of boot is sufficient (version 1.0.7
or greater) will this outport contain a value. If the boot version is not sufficient, the outport
is set to zero.
Note
The duration from power up to processor start is not part of boot_duration. It varies
based on the environmental conditions but is usually around 40ms to 80ms in
duration. The boot duration will increase as the calibration size increases.
6.1.90.7. Notes
• The block replaces the use of the automatic ASAP2 entry mpl_rsr. mpl_rsr is no longer
available.
6.1.91.3. Description
reset_ count
psc_ ResetCount
Get the free running count of the number of powered resets since power on. The count is
reset upon power cycle.
6.1.91.4. Inports
• sim_count
Only used under simulation and when the parameter Provide simulation inputs is ticked.
The outport reset_count is set to the value of this inport for simulation purposes.
Range: 0 to 4294967295.
6.1.91.5. Outports
• reset_count
The number of resets since the ECU was powered on. Under simulation, if the Provide
simulation inputs parameter isn't ticked, the outport is set to the minimum of its range.
Range: 0 to 4294967295.
• Sample time
6.1.91.7. Notes
None.
6.1.92.3. Description
psc_ UnstableResetCount
Get the limited counter of the number of powered resets that occur within 60 seconds of
initialisation. It is cleared once the application been running for at least 60 seconds. If the
unstable reset counter reaches a threshold defined in the platform, then the module will be
forced in to reprogramming mode.
6.1.92.4. Inports
• sim_count
Only used under simulation and when the parameter Provide simulation inputs is ticked.
The outport unstable_reset_count is set to the value of this inport for simulation purposes.
Range: 0 to 4.
6.1.92.5. Outports
• unstable_reset_count
The number of unstable resets since the ECU was powered on. Under simulation, if the
Provide simulation inputs parameter isn't ticked, the outport is set to the minimum of its
range.
Range: 0 to 4.
• Sample time
6.1.92.7. Notes
None.
6.1.93.3. Description
year
month
day
psc_ PrgBuildDate
Gets the build date for the ECU's reprogramming code. The build date can be used to
distinguish between different versions of the reprogramming code.
6.1.93.4. Inports
• sim_year
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport year is set to the value of this inport for simulation purposes.
• sim_month
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport month is set to the value of this inport for simulation purposes.
• sim_day
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport day is set to the value of this inport for simulation purposes.
6.1.93.5. Outports
• year
The year the reprogramming code was built. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to the minimum of its range. The signal
attached to the outport must be set as ExportedGlobal.
• month
The month of the year the reprogramming code was built. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to the minimum of its range. The
signal attached to the outport must be set as ExportedGlobal.
• day
The day of the month the reprogramming code was built. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to the minimum of its range. The
signal attached to the outport must be set as ExportedGlobal.
6.1.93.7. Notes
None.
6.1.94.3. Description
major _ ver
minor _ ver
psc_ PrgVersion
Gets the version information for the ECU's reprogramming code. The version number
is composed of three fields, major, minor and sub-minor, typically written as
major.minor.sub-minor. The version can be used by the application for version control
or diagnostics.
6.1.94.4. Inports
• sim_major_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport major_ver is set to the value of this inport for simulation purposes.
• sim_minor_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport minor_ver is set to the value of this inport for simulation purposes.
• sim_sub_minor_ver
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport sub_minor_ver is set to the value of this inport for simulation purposes.
6.1.94.5. Outports
• major_ver
The major version number of the reprogramming code. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to the minimum of its range. The
signal attached to the outport must be set as ExportedGlobal.
• minor_ver
The minor version number of the reprogramming code. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to the minimum of its range. The
signal attached to the outport must be set as ExportedGlobal.
• sub_minor_ver
The sub-minor version number of the reprogramming code. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to the minimum of its range. The
signal attached to the outport must be set as ExportedGlobal.
6.1.94.7. Notes
None.
6.1.95.3. Description
group_id
group_ letter
part_id
issue
psc_ PrgPartNumber
Gets the part number information for the ECU's reprogramming code. The part number
is composed of four fields: group identification number, group identification letter, part
identification number and issue number, typically written as group_idgroup_letter-
part_id Iss issue. Example: 12T-168232 Iss 3 The part number can be used by
the application for diagnostics, tracking and identification.
6.1.95.4. Inports
• sim_group_id
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport group_id is set to the value of this inport for simulation purposes.
• sim_group_letter
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport group_letter is set to the value of this inport for simulation purposes.
• sim_part_id
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport part_id is set to the value of this inport for simulation purposes.
• sim_issue
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport issue is set to the value of this inport for simulation purposes.
6.1.95.5. Outports
• group_id
The Group Identification number of the part number of the reprogramming code. Under
simulation, if the Provide simulation inports parameter isn't ticked, the outport is set to the
minimum of its range. The signal attached to the outport must be set as ExportedGlobal.
• group_letter
The Group Identification letter of the part number of the reprogramming code. The value
represents the ASCII code of the letter. Under simulation, if the Provide simulation inports
parameter isn't ticked, the outport is set to the minimum of its range. The signal attached
to the outport must be set as ExportedGlobal.
• part_id
The Part Identification number of the part number of the reprogramming code. Under
simulation, if the Provide simulation inports parameter isn't ticked, the outport is set to the
minimum of its range. The signal attached to the outport must be set as ExportedGlobal.
• issue
The Issue number of the part number of the reprogramming code. Under simulation, if the
Provide simulation inports parameter isn't ticked, the outport is set to the minimum of its
range. The signal attached to the outport must be set as ExportedGlobal.
6.1.95.7. Notes
None.
6.1.96.3. Description
available
Key:
ECU serial
number
serial
preg_ RetrieveKey
Given a key, selected through the Registry key mask parameter, the block searches through
the ECU's registry to retrieve the key's data. If the key was found then the available outport
is set to 1 and the remaing outports set to the key's data. If the key was not found then the
available outport is set to zero.
Note
Not all ECUs are programmed with registry data. Older ECUs, do not contain registry
data.
6.1.96.4. Inports
• sim_available
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport available is set to the value of this inport for simulation purposes.
Range: 0 or 1
• sim_serial
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport serial is set to the value of this inport for simulation purposes.
• sim_shift
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport shift is set to the value of this inport for simulation purposes.
Range: [1, 3]
• sim_day
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport day is set to the value of this inport for simulation purposes.
• sim_month
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport month is set to the value of this inport for simulation purposes.
• sim_year
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport year is set to the value of this inport for simulation purposes.
• sim_prefix
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport prefix is set to the value of this inport for simulation purposes.
• sim_id
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport id is set to the value of this inport for simulation purposes.
• sim_part
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport part is set to the value of this inport for simulation purposes.
• sim_issue
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport issue is set to the value of this inport for simulation purposes.
• sim_mod
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport mod is set to the value of this inport for simulation purposes.
• sim_fpart_a
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outports fpart_a are set to the value of these inports for simulation purposes.
• sim_fpart_b
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outports fpart_b are set to the value of these inports for simulation purposes.
• sim_fid_a
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport fid_a is set to the value of this inport for simulation purposes.
• sim_fid_b
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport fid_b is set to the value of this inport for simulation purposes.
• sim_build_type_a
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport build_type_a is set to the value of this inport for simulation purposes.
• sim_build_type_b
Only used under simulation and when the parameter Provide simulation inports is ticked.
The outport build_type_b is set to the value of this inport for simulation purposes.
• sim_value
Only used under simulation and when the parameter Provide simulation inports is ticked
and if the Registry key mask parameter is set to Generic. The outport value is set to the
value of this inport for simulation purposes.
Size: 6
6.1.96.5. Outports
• available
Whether the key could be retrieved or not. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to zero. The signal attached to the outport
must be set as ExportedGlobal.
Range: 0 or 1
• serial
The ECU's serial number. Outport available if the Registry key mask parameter is set
to ECU serial number. Under simulation, if the Provide simulation inports parameter isn't
ticked, the outport is set to zero. The signal attached to the outport must be set as
ExportedGlobal.
• shift
The team shift at the point of manufacture. Outport available if the Registry key mask
parameter is set to ECU date of manufacture. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to zero. The signal attached to the outport
must be set as ExportedGlobal.
Range: [1, 3]
• day
The day of the month at the point of manufacture. Outport available if the Registry key mask
parameter is set to ECU date of manufacture. Under simulation, if the Provide simulation
inports parameter isn't ticked, the outport is set to zero. The signal attached to the outport
must be set as ExportedGlobal.
• month
The month of the year at the point of manufacture. Outport available if the Registry key
mask parameter is set to ECU date of manufacture. Under simulation, if the Provide
simulation inports parameter isn't ticked, the outport is set to zero. The signal attached to
the outport must be set as ExportedGlobal.
• year
The year at the point of manufacture. Outport available if the Registry key mask parameter
is set to ECU date of manufacture. Under simulation, if the Provide simulation inports
parameter isn't ticked, the outport is set to zero. The signal attached to the outport must
be set as ExportedGlobal.
• prefix
The prefix of the engineering part number, e.g., 01 from 01T-068165. Outport available if
the Registry key mask parameter is set to ECU date of manufacture. Under simulation, if
the Provide simulation inports parameter isn't ticked, the outport is set to zero. The signal
attached to the outport must be set as ExportedGlobal.
• id
The letter of the engineering part number, e.g., T from 01T-068165. Outport available if
the Registry key mask parameter is set to ECU date of manufacture. Under simulation, if
the Provide simulation inports parameter isn't ticked, the outport is set to zero. The signal
attached to the outport must be set as ExportedGlobal.
• part
The remainder of the engineering part number, e.g., 068165 from 01T-068165. Outport
available if the Registry key mask parameter is set to ECU date of manufacture. Under
simulation, if the Provide simulation inports parameter isn't ticked, the outport is set to zero.
The signal attached to the outport must be set as ExportedGlobal.
• issue
The ECU's PCB issue number, representing the PCB design. Outport available if the
Registry key mask parameter is set to ECU PCB issue and modification number. Under
simulation, if the Provide simulation inports parameter isn't ticked, the outport is set to zero.
The signal attached to the outport must be set as ExportedGlobal.
• mod
The ECU's PCB modification number, representing hand modifications to the PCB to match
the PCB design intent. Outport available if the Registry key mask parameter is set to ECU
PCB issue and modification number. Under simulation, if the Provide simulation inports
parameter isn't ticked, the outport is set to zero. The signal attached to the outport must
be set as ExportedGlobal.
• fpart_a
The pre numerical part to the factory part number, which represents a detailed build
specification for the ECU. Outport available if the Registry key mask parameter is set to
ECU factory part number. Under simulation, if the Provide simulation inports parameter
isn't ticked, the outport is set to zero. The signal attached to the outport must be set as
ExportedGlobal.
• fpart_b
The post numerical part to the factory part number, which represents a detailed build
specification for the ECU. Outport available if the Registry key mask parameter is set to
ECU factory part number. Under simulation, if the Provide simulation inports parameter
isn't ticked, the outport is set to zero. The signal attached to the outport must be set as
ExportedGlobal.
• fid_a
The first letter identifier that separates the pre and post factory part number. Outport
available if the Registry key mask parameter is set to ECU factory part number. Under
simulation, if the Provide simulation inports parameter isn't ticked, the outport is set to zero.
The signal attached to the outport must be set as ExportedGlobal.
• fid_b
The second letter identifier that separates the pre and post factory part number. Outport
available if the Registry key mask parameter is set to ECU factory part number. Under
simulation, if the Provide simulation inports parameter isn't ticked, the outport is set to zero.
The signal attached to the outport must be set as ExportedGlobal.
• build_type_a
The first letter of a two letter identifier representing the factory part number build type.
Outport available if the Registry key mask parameter is set to ECU factory part number.
Under simulation, if the Provide simulation inports parameter isn't ticked, the outport is set
to zero. The signal attached to the outport must be set as ExportedGlobal.
• build_type_b
The second letter of a two letter identifier representing the factory part number build type.
Outport available if the Registry key mask parameter is set to ECU factory part number.
Under simulation, if the Provide simulation inports parameter isn't ticked, the outport is set
to zero. The signal attached to the outport must be set as ExportedGlobal.
• value
The raw data bytes of the registry key matching the Generic key. Outport available if the
Registry key mask parameter is set to Generic. Under simulation, if the Provide simulation
inports parameter isn't ticked, each index of the outport is set to 0. This value is also output
if outport available shows that the registry is unavailable. The signal attached to the outport
must be set as ExportedGlobal.
Size: 6
• Registry key
Generic
The raw data of the key matching the Generic key parameter is
returned.
ECU serial
The serial number is a 32-bit positive integer. Serial numbers across
different families of ECUs do not overlap.
• Generic key
The generic key to read from the registry. Parameter available if the Registry key mask
parameter is set to Generic.
6.1.96.7. Notes
All the supported keys for the registry and their corresponding data is defined below. Each
Registry key mask parameter selection points to a unique key except for the Generic key
parameter which can be used to select any generic key. The table below shows which
Registry key dropdown selection maps to which key and also shows the Key ID values that
can be used if the Generic registry key is selected.
Note
All numeric values are stored in Motorola format (i.e. MSB first)
6.1.97.3. Description
Requires version:
put_ RequirePlatformVersion
Restrict the versions of OpenECU platform that a model can be build against. This block can
restrict the platform to a specific version, before or after a specific version, or to be between
two versions.
More than one put_RequirePlatformVersion block may be added to a model to refine the
restriction conditions.
If there are no put_RequirePlatformVersion blocks in a model, the model may be built against
any version of platform (whether the build completes successfully will depend on which
version of the platform the model was created with — e.g., a model created with features
from a newer version of the platform may not build using an older version of the platform).
Note
In order for this block to function fully, the model postloadfcn property must be set
according to the section Model pre-load and post-load hooks.
6.1.97.4. Inports
None.
6.1.97.5. Outports
None.
• Check
A drop-down of methods for restricting the version of platform to use when building.
• Version
The literal text of the version number (e.g., 1.5.0) that the platform must equal in order
to be able to build the model. Only available when the Check parameter is set to Single
version.
• Before version
The literal text of the version number (e.g., 1.5.0) that the platform come before (not
inclusive) in order to be able to build the model. Only available when the Check parameter
is set to Before version.
• After version
The literal text of the version number (e.g., 1.5.0) that the platform come after (not
inclusive) in order to be able to build the model. Only available when the Check parameter
is set to After version.
• From version
The literal text of the version number (e.g., 1.5.0) that the platform come before (inclusive)
in order to be able to build the model. Only available when the Check parameter is set to
Range of versions.
• To version
The literal text of the version number (e.g., 1.5.0) that the platform come after (inclusive)
in order to be able to build the model. Only available when the Check parameter is set to
Range of versions.
6.1.97.7. Notes
None.
6.1.98.3. Description
Double click to show
sample time colours
A utility block to turn on Simulink's sample time colouring. Double click on the block to turn
on sample time colours.
6.1.98.4. Inports
None.
6.1.98.5. Outports
None.
6.1.99.3. Description
decoded _ frames
desyncs
timestamp
pin _ state
pdx _ SentInput
The SENT input block decodes a sensor's transmission pulses according to SAE J2716 Jan
2010, making available the sensor's status and data information. SAE J2716 describes SENT
as:
• decodes the SENT transmission into status and fast data nibbles;
• stores the last received, decoded and verified status and data nibbles;
• allows for a transmitter clock tick variance of ± 25% for the calibration and synchronisation
pulse;
• uses the calibration and sychronisation pulse to ratiometrically adjust the status, data and
CRC pulses;
• verifies the frame size (checks the expected number of nibbles, or frame edges);
For short or enhanced serial message reception over 16 or 18 consecutive SENT frames,
see the pdx_SentSerialInput block.
6.1.99.4. Inports
• sim_frames_decoded
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_desyncs
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_valid
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_status
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_data
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_timestamp
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_pin_state
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
6.1.99.5. Outports
• frames_decoded
A counter incremented for each frame that is successfully received, decoded and verified.
• desyncs
A counter incremented for each loss of synchronisation with the SENT sensor pulse
stream. Loss of synchronisation occurs when the block pulse decoder has not seen a valid
pulse for more than 125% of a calibration pulse duration (where a calibration pulse is 56
SENT ticks, Tick length); or a calibration, status, nibble or CRC pulse is too short; or the
frame CRC verification fails.
• valid
1 if at least one SENT frame has been successfully received, decoded and verified, 0
otherwise. If 1, then the status and data outports provide the status and data received from
the last frame, and the timestamp outport provides the time when the frame was received.
Range: 0 or 1
• status
The status nibble of the last SENT frame that was successfully received, decoded and
verified. Set to zero when a SENT frame has not been successfully received.
Range: 0 or 1
• data
The data nibbles of the last SENT frame that was successfully received, decoded and
verified. Set to zero when a SENT frame has not been successfully received. The data
nibbles are packed into the integer right aligned.
• timestamp
A timestamp taken when the last SENT frame was fully received, decoded and verified.
The timestamp increments in counts of 256, wrapping approximately every 4 seconds.
The timestamp can be used by the application to determine whether the SENT sensor is
transmitting data at the expected period.
• pin_state
1 if the channel pin voltage is above the detection threshold, 0 otherwise. Can be used by
the application for electrical diagnostics.
Range: 0 or 1
• Channel
• Tick length
The length of the SENT sensor's transmission clock tick connected to this channel.
The number of data nibbles transmitted by the SENT sensor in each frame.
• CRC version
• Sample time
Calibratable: No
If selected then the block creates simulation inports for each of the outports.
6.1.99.7. Notes
None.
6.1.100.3. Description
messages
crc_ failures
valid
message _ id
data
timestamp
pdx _ SentSerialInput
The SENT input block decodes a sensor's transmission pulses according to SAE J2716 Jan
2010, making available the sensor's short or enhanced serial data. See the pdx_SentInput
block for a summary of SENT.
• decodes the status nibble from 16 or 18 consecutive SENT transmissions into message
identification and data values;
When using a pdx_SentSerialInput block, the application model must have a corresponding
pdx_SentInput block to initialise the SENT channel.
6.1.100.4. Inports
• sim_messages
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_crc_failures
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_valid
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_serial_format
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_message_id
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_data
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
• sim_timestamp
Available when Provide simulation input? is ticked. The value of this inport is copied to the
corresponding outport during model simulation.
6.1.100.5. Outports
• messages
A counter incremented for each serial message that is successfully received, decoded and
verified.
• crc_failures
A counter incremented for each serial message that is received but that fails a CRC
verification.
• valid
Set to one if at least one serial message has been successfully received, decoded and
verified, set to zero otherwise. If set to one, then the serial_formatpdxf_serial_format,
message_id and data outports provide information about the last successfully received,
decoded and verified message, and the timestamp outport provides the time when the
message was received.
Range: 0 or 1
• serial_format
The detected serial format of the last successfully received, decoded and verified serial
message. Set to zero when a serial message has not been received.
• message_id
The value of the message identifier of the last successfully received, decoded and verified
serial message. Set to zero when a serial message has not yet been received.
Range: [0, 15] for short serial and enhanced serial format 2
Range: [0, 255] for enhanced serial format 1
• data
The data nibbles of the last successfully received, decoded and verified serial message.
Set to zero when a serial message has not yet been received.
• timestamp
A timestamp is taken when the last SENT message was fully received, decoded and
verified. The timestamp increments in counts of 256, wrapping approximately every 4
seconds. The timestamp can be used by the application to determine whether the SENT
sensor is transmitting data at the expected period.
• Channel
• Sample time
If selected then the block creates simulation inports for each of the outports.
6.1.100.7. Notes
None.
6.1.101.3. Description
u
Start up timeout periods :
u_ invalid _ code
Loss of communication periods :
start_ count
put_ SignalGapDetection
• has not received a CAN message within the required start-up period (code 6); or
The block will start monitoring the status of inport u (whether a CAN message was received
this model iteration or not) when the inport start_count is 1. For as long inport u is zero (no
message received), the block will output code 5.
If the block observes that it has not received a single CAN message within the required
module start-up period, the block will output code 6.
If the application has received at least a single CAN message within the required start-
up period, but has then subsequently not received a new message for the pre-defined
consecutive number of missed message periods, the block will output code 7.
For as long as the block is receiving CAN messages, the block will output code 8.
These output codes can be fed into the Section 6.1.103, “Signal validate
(put_SignalValidate)” block to provide further fault detection.
6.1.101.4. Inports
• u
• start_count
6.1.101.5. Outports
• u_invalid_code
Result of monitoring when the CAN message was received over time (inport u). See the
table in the notes section for a complete list of the codes.
Range: [5, 8]
The number of message periods the block will wait after inport start_count has been set
to 1, before reporting that it has not received a CAN message within this required period.
The number of message periods the block will wait, with inport u set to 0, before reporting
that it has stopped receiving the CAN message.
6.1.101.7. Notes
• The possible error codes (see also Table 6.8, “CAN signal validate error codes.”) are
enumerated as:
6.1.102.3. Description
Error Value :
u Unavailable Value :
Minimum Value :
Maximum Value : y
Scale Factor :
u_ invalid _ code Offset Value :
Output Type : (int 8)
put_ SignalPrepare
The signal prepare block converts from engineering value to integer form. The input value is
checked against minimum and maximum parameters and clipping may occur when the result
is copied into one of the possible integer data types of the output port.
It is common to find a CAN specification that designates values for CAN signals as in error
or unavailable. Although not always the case, typically the highest values are used (e.g., in
an unsigned 8 bit quantity that can range from 0 to 255, typically 254 and 255 signify that the
signal is unavailable or in error). This block directly supports this concept.
Minimum and maximum limits (in engineering units) are also defined for each CAN signal, and
an engineering value outside this range is set to a value which indicates error to the receiving
CAN node. This block directly supports checking for out of range engineering values.
And while many quantities are transmitted in integer format that corresponds to the value in
engineering units, many other fields have scale and offset values. This block directly supports
converting the engineering value to a scaled integer value as:
6.1.102.4. Inports
• u
Value to convert from the application. The blocks accepts a data type of uint8, int32
and real_T.
• u_invalid_code
Defines the validity of the input u. See Table 6.7, “CAN signal prepare invalid codes.” for
a complete list of codes.
Range: [0, 8]
6.1.102.5. Outports
• y
• Error value
• Unavailable value
• Minimum value
The smallest value of u that is valid. The data type of this parameter is the same as the
input u.
• Maximum value
The largest value of u that is valid, The data type of this parameter is the same as the
input u.
• Scale factor
• Offset value
Offset factor applied to u to convert it from engineering units to an integer form. The data
type is in engineering units. A value of 0 should be used if there is no offset.
• Output type
6.1.102.7. Notes
• The possible error codes are enumerated as:
6.1.103.3. Description
Error Value : y
u Unavailable Value :
Minimum Value :
Maximum Value :
Default Value : invalid _ flag
Scale Factor :
Offset Value :
u_ invalid _ code Error Delay Cycles:
Output Type : ( double ) y_ invalid _ code
put_ SignalValidate
The signal validate block performs validation checks on a supplied input value (usually from
a received CAN message). It checks for the input data being unavailable or in error, applies
a linear transfer function, performs clipping, then casts the output to a user selected type.
It is common to find a CAN specification that designates values for CAN signals as in error
or unavailable. Although not always the case, typically the highest values are used (e.g., in
an unsigned 8 bit quantity that can range from 0 to 255, typically 254 and 255 signify that the
signal is unavailable or in error). This block directly supports this concept.
Minimum and maximum limits (in engineering units) are also defined for each CAN signal,
and received data outside those limits typically indicates an error (in transmitting module
behaviour, or CAN communications). This block directly supports checking for out of range
engineering values.
And while many quantities are transmitted in integer format that corresponds to the value in
engineering units, many other fields have scale and offset values. This block directly supports
converting the scaled integer value to an engineering value as:
When an error is detected, if the block has previously output a valid value, it will continue
to output the previous valid value while the error condition persists for a number of delayed
cycles, after which, if the error persists, the default value is output.
6.1.103.4. Inports
• u
• u_invalid_code
A code that defines the status of the inport u. The block acts on an error code of 5, 6, 7,
or 8 (see Table 6.8, “CAN signal validate error codes.”).
Range: [0, 8]
6.1.103.5. Outports
• y
• invalid_flag
Range: 0 or 1
• y_invalid_code
A value indicating the manner in which the input is invalid (see below for a table of error
codes).
Range: [0, 8]
• Error value
The value which indicates the input is in error. It is internally converted to int32 data type.
• Unavailable value
The value which indicates the input is unavailable. It is internally converted to int32 data
type.
• Minimum value
• Maximum value
• Default value
• Scale factor
• Offset value
Offset value to convert from integer to engineering units, in engineering units. A value of
0 should be used if no offset is required.
An integer number of block executions; the number of cycles before any error condition
is output. May be zero, in which case error conditions are output immediately the block
executes.
• Output type
6.1.103.7. Notes
• The possible error codes are enumerated as:
6.1.104.3. Description
u slew_ fault
put_ SlewRateCheck
Compares the value of inport u between the current and previous model iterations and
determines if the absolute difference exceeds the slew rate limit.
6.1.104.4. Inports
• u
6.1.104.5. Outports
• slew_fault
Set to 1 if the absolute difference between inport u at this model iteration and the previous
model iterate is greater than the parameter Absolute raw slew rate limit, 0 otherwise. On
the first model iteration, the block outputs 0.
Range: 0 or 1
Maximum absolute rate of change of input calculated over one model iteration before input
considered faulty.
• Sample time
6.1.104.7. Notes
None.
6.1.105.3. Description
Device : CJ125-A
sim_ count count
Sample time :
psp_ FaultCount
Certain SPI devices support the ability to validate their communication with the main
processor. If a fault occurs in the communication, the platform will track the error. This block
allows the number of detected errors to be reported to the application.
6.1.105.4. Inports
• sim_count
Only used under simulation when the parameter Provide simulation input? is ticked. The
outport count is written using the value of this inport.
6.1.105.5. Outports
• count
• Device
• Sample time
6.1.105.7. Notes
The counter Value will saturate at 255. This value is only cleared by resetting the ECU.
6.1.106.3. Description
used_ bytes
psc_ StackUsed
Gets the number of bytes used by the application model and platform library since the ECU
was last powered on (or reset). The stack is shared area of RAM used to store temporary
information, such as calculations and function call parameters.
The total stack size allocated to the application model and platform library can be adjusted
through the RTW options, see System stack size. It is important to allocate sufficient
stack space for the worst case function call tree through the application and platform code
otherwise the ECU may not behave as expected. While developing a model, keep a track of
the stack size used and, as the usage grows, grow the system stack size appropriately.
Note
The ECUs are configured by the platform software to reset when the stack overflows
its allocation. The reset prevents the ECU from behaving unexpectedly.
When using RTW as the model auto-coder, be aware that RTW has two ways of allocating
model data.
• RTW can statically allocate the data, which means that the model data is allocated to a
fixed address in memory and not to the stack. This form of allocation is preferred because
at run time the stack usage will be low, and if the model becomes too large for the ECU's
memory, the model will fail to build completely.
Unselect the RTW Enable local block outputs option to have RTW statically allocate model
data.
• RTW can dynamically allocate the data to the stack. This means that the stack use can
vary significantly at run time and the system stack size will need to be larger. This form of
allocation is not preferred because to guarantee that the stack will not overflow will require
detailed analysis of the RTW generated code.
Select the RTW Enable local block outputs option to have RTW dynamically allocate model
data to the stack.
6.1.106.4. Inports
• sim_used_bytes
Only used under simulation and when the parameter Provide simulation inputs is ticked.
The outport used_bytes is set to the value of this inport for simulation purposes.
6.1.106.5. Outports
• used_bytes
The number of used bytes from the system stack size since the ECU was powered on (or
reset). Under simulation, if the Provide simulation inputs parameter isn't ticked, the outport
is set to the minimum of its range.
• Sample time
6.1.106.7. Notes
None.
6.1.107.3. Description
sim_ master_ duty_ cycle
master_ duty_ cycle Master channel : DOT INJ ( pin A1)
Master inversion: off
master_ frequency Master default duty cycle :
sim_ master_ frequency
Master initial duty cycle :
master_ fault Master initial frequency : Hz
Master offset : ms
sim_ slave_ duty_ cycle
Slave inversion : off
slave_ duty_ cycle Slave default duty cycle :
Slave initial duty cycle :
sim_ slave_ frequency
slave_ frequency Slave initial frequency : Hz
Slave delay : uS
slave_ fault [ Min / max dutycycle ]:
sim_ slave_ delay
pdx_ PWMSynchronisedOutput
The synchronised PWM output block causes two channel output pins to oscillate with
independent frequency and duty cycle. The duty cycle is the High time divided by the Cycle
time for a given channel.
High time
High time
The slave channel is generated relative to the master channel pulse (in this instance, both
the master and slave channels are generated with the same frequency).
Synchronisation Synchronisation
point point
The slave pulse can be delayed relative to the master pulse by setting the parameter Slave
delay to a non-zero value.
In all cases, only one pulse per cycle is generated by both the master and slave channels.
For instance, if the frequency of the slave channel was twice that of the master channel, only
one pulse would be generated by the slave channel.
The Master channel output (and thus the slave) can be offset from other PWM channels
of the same frequency. The Master offset parameter is used to delay the start of the PWM
cycle, so that the PWM pulse will not occur at the same time as other PWM signals of the
same frequency.
output master duty cycle = Minimum duty cycle + (Maximum duty cycle - Minimum duty cycle)
* master_duty_cycle
output slave duty cycle = Minimum duty cycle + (Maximum duty cycle - Minimum duty cycle)
* slave_duty_cycle
For a given channel, if the output duty cycle is 0, the output channel state is set low and
does not oscillate. If the output duty cycle is 1, the output channel state is set high and does
not oscillate.
If the inport master_fault input is non-zero, then the output master duty cycle is set to the
mask parameter Master default duty cycle. Similarly for the output slave duty cycle.
6.1.107.4. Inports
• master_duty_cycle
Ratio of the high time to the signal cycle time for the master channel.
• master_frequency
• master_fault
Set to 1 to force the block to use the default master frequency and master duty cycle for
the master channel, 0 otherwise.
Range: 0 or 1
• slave_duty_cycle
Ratio of the high time to the signal cycle time for the slave channel.
• slave_frequency
• slave_fault
Set to 1 to force the block to use the default slave frequency and slave duty cycle for the
slave channel, 0 otherwise.
Range: 0 or 1
6.1.107.5. Outports
• sim_master_duty_cycle
Only used in simulation. this outport is set to the calculated duty cycle for the master
channel.
• sim_master_frequency
Only used in simulation. this outport is set to the calculated frequency for the master
channel.
• sim_slave_duty_cycle
Only used in simulation. this outport is set to the calculated duty cycle for the slave channel.
• sim_slave_frequency
Only used in simulation. this outport is set to the calculated frequency for the slave channel.
• sim_slave_delay
Only used in simulation. this outport is set to the calculated frequency for the slave channel.
• Master channel
The master channel for this block. The slave channel is automatically assigned.
• Master inversion
If selected, the final master duty cycle is set to 1 minus the output master duty cycle,
otherwise the final master duty cycle is the same as the output master duty cycle.
This is the final duty cycle of the channel when inport master_fault is set. The duty cycle is
mapped directly to the output channel and is not inverted by parameter Master inversion.
Range: 0 or 1 duty-cycle
The duty cycle of the channel signal before the block has first been executed. This duty
cycle is inverted if the mask parameter Master inversion is set to 1.
The frequency of the channel signal before the block first iterates.
• Master offset
The offset of the master (and hence the slave) channel output.
Target Range
M110 Not supported
M220 Not supported
M221 Not supported
M250 [0, 2000] ms
M460 [0, 2000] ms
M461 Not supported
M670 Not supported
• Slave inversion
If selected, the final slave duty cycle is set to 1 minus the output slave duty cycle, otherwise
the final slave duty cycle is the same as the output slave duty cycle.
This is the final duty cycle of the channel when inport slave_fault is set. The duty cycle is
mapped directly to the output channel and is not inverted by parameter Slave inversion.
Range: 0 or 1 duty-cycle
The duty cycle of the channel signal before the block has first been executed. This duty
cycle is inverted if the mask parameter Slave inversion is set to 1.
The frequency of the channel signal before the block first iterates.
• Slave delay
The time delay between synchronisation of the master and slave channel. The slave pulse
is started Slave delay microseconds after the master pulse starts.
6.1.107.7. Notes
• If the pulse for the slave channel extends through the synchronisation point, then the
master and slave channel signals become undefined. Most likely is that the master channel
continues to generate a PWM signal and the slave channel goes low, but this is not
guaranteed under all conditions.
To avoid an inconsistent update to the output, the low-lying driver (based on code from
the silicon manufacturer) buffers new parameters before applying them. This results in a
delay of two or three PWM cycles between the model updating the frequency or duty cycle
and the effect being seen in the output waveform.
6.1.108.3. Description
duration
pkn_ TaskDuration
Each rate in a model is represented by a task. A task contains all the functionality to iterate
that model rate. Simulink has a specific scheme for executing each task to simulate the model
on the host PC, or to run the model on a target ECU. While arbitrarily large models can be
run on the host PC, where the model is not run in real time, there is a limit to the size of model
that can be executed on the target ECU. The psc_TaskDuration block provides feedback on
how long each task takes to run and can be used to indicate whether all tasks run in real
time or not.
The task duration excludes the time taken for other tasks to run and includes the time taken
during platform interrupts. For instance, in a model which has a 5 millisecond and a 10
millisecond rate, the task duration measurement of the 10 millisecond task will not include
any time taken up by an interrupting 5 millisecond task. But, in the same time frame, if the
platform handled some interrupts for CAN messaging and angular functionality, then the time
taken to service the interrupts is included.
Together with the psc_CpuLoading block, the psc_TaskDuration block can provide an
indication of where the majority of the processing to run the model takes place, useful when
attempting to optimise the model. It is useful to record the output of both these blocks across
the lifetime of the model development — a graph of these values against time will quickly
show if the model will become too large for the ECU as development progresses.
6.1.108.4. Inports
• sim_duration
Only used under simulation and when the parameter Provide simulation inputs is ticked.
The outport duration is set to the value of this inport for simulation purposes.
6.1.108.5. Outports
• duration
The last measured duration of the model rate task, or the maximum duration seen for that
task since the ECU was powered on (or reset). Under simulation, if the Provide simulation
inputs parameter isn't ticked, the outport is set to the minimum of its range.
Target Range
M110 [0 53687091] microseconds
M220 [0 53687091] microseconds
M221 [0 53687091] microseconds
M250 [0 53687091] microseconds
M460 [0 53687091] microseconds
M461 [0 53687091] microseconds
M670 [0 16268815] microseconds
• Output mode
Whether the outport duration is set to the last measured task duration or the maximum
task duration seen since the ECU was powered on (or reset).
In order to provide accurate task monitoring, it is recommended that the sample time be
configured to be no greater than the maximum amount of time that can be represented
by outport duration
The periodicity of the block. The task and block sample time allow the model rate task
measurement to occur independently from the task itself.
6.1.108.7. Notes
None.
6.1.109.3. Description
overruns
pkn_ TaskPeriodOverrun
Each rate in a model is represented by a task. A task contains all the functionality to iterate
that model rate. Simulink has a specific scheme for executing each task to simulate the model
on the host PC, or to run the model on a target ECU. While arbitrarily large models can be
run on the host PC, where the model is not run in real time, there is a limit to the size of
model that can be executed on the target ECU in real time. The pkn_TaskPeriodOverrun
block provides feedback on how many times a model rate (periodic) task has overrun its rate.
For example, if a model contains a 5 millisecond rate then the pkn_TaskPeriodOverrun block
counts the number of times the 5 millisecond model rate task becomes ready to run when
the 5 millisecond task is already running.
A model rate task may overrun its period for a number of reasons:
• The quantity and type of blocks required to execute every period is too much for the target
ECU to achieve.
• A higher priority model rate task or tasks (those with shorter periods) uses up processor
time that the lower priority model rate tasks require to complete within their period.
Together with the psc_CpuLoading block, and the pkn_TaskDuration block, the
pkn_TaskPeriodOverrun block can provide an indication of where the majority of the model
processing takes place, useful when attempting to optimise the model. It is useful to record
the output of these blocks across the lifetime of the model development — a graph of these
values against time will help to indicate if the model will become too large for the ECU as
development progresses.
6.1.109.4. Inports
• sim_overruns
Only used under simulation and when the parameter Provide simulation inputs is ticked.
The outport overruns is set to the value of this inport for simulation purposes.
6.1.109.5. Outports
• overruns
The saturated counts of periodic overruns for the model rate task since the ECU was
powered on (or reset). Under simulation, if the Provide simulation inputs parameter isn't
ticked, the outport is set to the minimum of its range.
The periodicity of the block. The task and block sample time allow the model rate task
measurement to occur independently from the task itself.
6.1.109.7. Notes
None.
6.1.110.3. Description
This block allows for easy import of production code from a subsystem developed in
TargetLink. The TargetLink model name, subsystem name, and input/output ports are
specified in the block interface. One button causes the block to configure itself to have
the specified interface. Another button launches the TargetLink code generator to generate
production code for the TargetLink subsystem, imports the production code into the model at
the block location, and imports the TargetLink data dictionary entries into the Simulink data
dictionary.
Currently, TargetLink version 4.4 (2018-B) has been tested and is supported. Newer
TargetLink versions are expected to be compatible, but have not been fully tested.
6.1.110.4. Inports
• input
6.1.110.5. Outports
• output
• TargetLink Model
Press the "Browse..." button to browse for the model file. If the browse button is used, you
will be prompted to select which subsystem from the TargetLink model file that you wish to
import. All mask parameters will be automatically populated from the selected TargetLink
subsystem.
The name of the TargetLink subsystem in the TargetLink model that you wish to import.
The names of the input ports for the block interface, separated by commas.
The names of the output ports for the block interface, separated by commas.
Clicking this button will update the interface of this block. Input ports will be created
according to the "Input port names" parameter, and output ports will be created according
to the "Output port names" parameter. Note that clicking this button will disconnect the
block from the rest of the model as the block is re-drawn.
• Start Import
Clicking this button will import TargetLink production code into the model at the current
block location. The following actions occur:
1. The TargetLink code generator is launched to produce production code from the
TargetLink subsystem.
4. Target Language Compiler (TLC) code is generated for the current block to call the
TargetLink production code.
5. All data entries in the TargetLink data dictionary associated with the selected TargetLink
model will be imported into the Simulink data dictionary.
Copyright 2020, Pi Innovo 429
Software detail
6.1.110.7. Notes
TargetLink integration has the following restrictions:
1. The TargetLink subsystem in the TargetLink model must have all inports and outports
configured to be function reference arguments (Class: FCN_REF_ARG in the TargetLink
dialog).
2. The OpenECU model must be configured to use the Simulink data dictionary. This is
because the text based data dictionary does not support fixed point scaling and offset.
3. The model must be configured to disable the OpenECU naming convention. See the
following image.
5. Only scalar and array inports and outports are supported. TargetLink bus ports are not
supported at the current time.
6.1.111.3. Description
Time base : Seconds
time
Mode : Relative
ptm_ RealTime
Output the current time (absolute), or output the time since the last time the block executed
(relative). Time is tracked in two ways: for host simulation — using Simulink's task timing;
and for target execution — using the ECU's operating system timers.
When run under simulation, this block has the same behaviour as the Simulink Time block,
see Section 6.1.112, “Time (Simulink) (ptm_SimulinkTime)”.
When run on target, this block reads the time from the ECU's operating system. The ECU's
operating system utilises a high resolution timer to provide microsecond, millisecond and
second results, any of which can be selected as the block output using the drop-down option.
When the block is iterated, the time outport is the latest reading from the high resolution timer.
The ptm_RealTime block can be configured to provide an absolute time or a relative time.
The absolute time is the time at which the block is iterated since the start of the model (after
power on, or reset). The relative time is time since the block was last iterated, or if the block
has never iterated before, the time since the start of the model.
To understand the absolute time configuration, consider a simple model with two model rates,
5ms and 10ms. The 5ms model rate contains a ptm_RealTime block configured for absolute
time, and to work in microseconds. The block is iterated at times A, C and D.
time
0 1 2 3 4 5 6 7 8 9 10 11
A B C D E
A. At time A, the ptm_RealTime block sets time outport value to around 250 microseconds
(the time since the model started).
C. At time C, the ptm_RealTime block sets time outport value to around 5250 microseconds.
D. At time D, the ptm_RealTime block sets time outport value to around 10250 microseconds.
And to understand the relative time configuration, consider the same model where the 10ms
model rate contains a ptm_RealTime block configured for relative time. The block is iterated
at times B and E.
B. At time B, the ptm_RealTime block sets time outport value to around 1330 microseconds
(the time since the model started as there has been no iteration of the block prior to time B).
E. At time E, the ptm_RealTime block sets time outport value to around 10000 microseconds,
being the difference between time E and B. The precise value will vary depending on the
influence of higher-priority tasks and interrupt work.
The description above uses the term “around x milliseconds” because of task jitter. Task jitter
occurs when the length of time a task takes to complete varies each time the task runs. As
an example, consider a task that has some logic implemented by the auto-coder as an if-else
statement. If in different iterations of the model task different parts of the if-else statement run,
and if the processing which occurs for those parts differs, then each part will take a different
amount of time to complete and the overall task duration will vary. If the ptm_RealTime block
occurs after the if-else logic then the time output by the block will vary.
Warning
The type of outport time is an unsigned 32-bit integer, which limits the range of time
this block can represent.
32
The value for both absolute and relative time are provided modulo 2 . It is up to the
application to take care of the wrap around caused by the modulo.
6.1.111.4. Inports
None.
6.1.111.5. Outports
• time
The current real-time taken from the ECU's operating system timer, as either an absolute
time since the model started, or as a relative time since the last time the block was iterated
(or the start of the model if the block has not been iterated before).
32
Range: [0, inf] modulo 2 , seconds, milliseconds, or microseconds
• Time base
The resolution and units of the outport time, as seconds, milliseconds or microseconds.
• Output mode
• Sample time
6.1.111.7. Notes
None.
6.1.112.3. Description
Time base : Seconds
time
Mode : Relative
ptm_ SimulinkTime
Output the current Simulink task time (absolute), or output the time since the last time the
block executed (relative). Time is tracked using Simulink's task timers for both host simulation
and target execution.
This block reads the time from the Simulink's task timers. Simulink task timers track the time
each task should run at the resolution of the quickest model rate. For instance, if there were
two model rates, 5ms and 10ms, then the resolution of the Simulink task timer for each model
rate would be 5ms. The block converts these timers to microsecond, millisecond or second
resolution, as required by parameter Time base. When the block is iterated, the time outport
is the timer for the current model rate task.
The ptm_SimulinkTime block can be configured to provide an absolute time or a relative time.
The absolute option is the Simulink task time at which the block is iterated since the start
of the model (after power on, or reset). The relative option is the Simulink task time since
the block was last iterated, or if the block has never iterated before, the Simulink task time
since the start of the model.
To understand the absolute time configuration, consider a simple model with two model
rates, 5ms and 10ms. The 5ms model rate contains a ptm_SimulinkTime block configured
for absolute time. The block is iterated at times A, C and D.
time
0 1 2 3 4 5 6 7 8 9 10 11
A B C D E
A. At time A, the ptm_SimulinkTime block sets time outport value to 0 milliseconds (the time
since the model started). Note that the time matches the start of the model rate task and
not the current time. If the current time is required then see the ptm_RealTime block.
And to understand the relative time configuration, consider the same model where the 10ms
model rate contains a ptm_SimulinkTime block configured for relative time. The block is
iterated at times B and E.
B. At time B, the ptm_SimulinkTime block sets time outport value to 0 milliseconds (the time
since the model started as there has been no iteration of the block prior to time B).
In the last example at time B, the 10ms Simulink task timer is zero rather 0.5 milliseconds.
The Simulink task timer is zero because Simulink would like to start both the 5ms and 10ms
model rate tasks at the same time, time zero. Because the ECU's operating system runs the
quickest rate task first, the 10ms model rate task starts after the 5ms model rate task has
completed.
If the 10ms model rate task were to take longer and the 5ms model rate task ran more quickly,
for example, every 2ms, then the task sequence over time looks different:
time
0 1 2 3 4
A B C D
C. At time C, even though the 10ms task has not yet completed, the 2ms model rate task
ran and Simulink updated timer for that task. The ptm_SimulinkTime block therefore sets
time outport value to 2 milliseconds.
D. At time D, the 10ms model rate task has not yet completed and the Simulink task timer
remains at zero. The ptm_SimulinkTime block therefore sets time outport value to 0
milliseconds.
Warning
The type of outport time is an unsigned 32-bit integer, which limits the range of time
this block can represent.
Simulink may generate code to maintain its task timers using a type which cannot
represent the full range of the outport time. In this case, the Simulink task timers may
saturate rather than wrap around due to the modulo. Again, it is up to the application
to address this condition.
For more information about Simulink's task timers see the MathWorks' documentation
for RTW.
6.1.112.4. Inports
None.
6.1.112.5. Outports
• time
The current simulink task time, as either an absolute time since the model started, or as
a relative time since the last time the block was iterated (or the start of the model if the
block has not been iterated before).
32
Range: [0, inf] modulo 2 , seconds, milliseconds, or microseconds
• Time base
The resolution and units of the outport time, as seconds, milliseconds or microseconds.
• Output mode
• Sample time
6.1.112.7. Notes
None.
6.1.113.3. Description
calibration _ mode
Channel : Pin Z 10+Z11+Z22+Z 23 ( UEGO A)
reference_ current Initial reference current : 01 : 10 uA
Initial Ip amplification : 0 : Gain 8
Ip_ amplification
The Platform provides this interface for ECUs containing Bosch CJ125 devices to uses the
device to interact with external Bosch LSU 4.9 UEGO sensors. For further information on
connecting to and using UEGO sensors, please see the ECU's technical specification.
This block is called periodically during an application task to set the internal configuration
of the specified CJ125 device. The block should be called in a task with the desired rate at
which the device should be reconfigured.
6.1.113.4. Inports
• calibration_mode
Set to 0 to put the CJ125 device in normal operation mode. Set to 1 to put the device in
calibration mode. This will cause the UR and UA analogue inputs for the CJ125 to be set
to their calibration values.
When calibration mode is enabled, UR, being the input indicating the temperature of the
UEGO sensor, will indicate the UR measurement corresponding to the optimal UEGO
sensor temperature. UA, being the input indicating the UEGO pump cell current, will be
set to the value corresponding to a Lambda measurement of 1 when calibration mode
enabled. See the ECU's technical specification for more details.
Range: [0, 1]
• reference_current
Set to the enumeration of the desired reference current used by the device.
Range: [0, 15] respectively for the enumeration values: 0 uA, 10 uA, 20 uA, 30 uA, 40 uA,
50 uA, 60 uA, 70 uA, 80 uA, 90 uA, 100 uA, 110 uA, 120 uA, 130 uA, 140 uA, 150 uA
• Ip_amplification
Set to the enumeration value corresponding to the desired amplification of the pump current
(Ip). Ip is calculated from the UA input and its value is dependent on the specified gain
setting. See the ECU's technical specification for more details.
6.1.113.5. Outports
None.
• Channel
If selected then inport reference_current is made available. Otherwise the Initial Reference
Current value is used during runtime.
• Initial Ip Amplification
6.1.113.7. Notes
None.
6.1.114.3. Description
kick
psc_ KickWatchdog
A watchdog is a timer that causes a processor reset when the timer exceeds a maximum
duration. By kicking the watchdog on a periodic basis, the processor reset never occurs.
A simple scheme to utilise the watchdog kicks the watchdog on a periodic basis. A more
complex scheme might kick the watchdog only if the software appears to be performing the
correct functionality (for instance, if two independent measurements of the same quantity
show a large discrepancy).
The psc_KickWatchdog block causes the processor watchdog timer to clear thus avoiding a
reset. Each ECU has a fixed watchdog duration.
If no psc_KickWatchdog block is present in the model then the watchdog will be kicked by
the platform automatically at the maximum period for the target ECU.
6.1.114.4. Inports
• kick
Set to 1 to cause watchdog timer to clear (no reset), set to zero to allow the watchdog timer
to continue to increase (reset will occur when timer exceeds the duration).
Range: 0 or 1
6.1.114.5. Outports
None.
6.1.114.7. Notes
None.
6.1.115.3. Description
Boost voltage :
prop_BoostConf ig
This block configures the boost voltage for all waveforms. The waveform must be setup using
a prop_WaveformConfig block.
6.1.115.4. Inports
None.
6.1.115.5. Outports
None.
• Boost voltage
6.1.115.7. Notes
None.
6.1.116.3. Description
prop_Wavef ormConf ig
This block configures the properties of a waveform by setting the voltage, current and
durations for up to three phases. An example of a possible waveform is shown in Figure 6.19,
“Three stage, waveform”.
On
Off
T5
Current
C1
C2
C3
T1 T2 T3 T4 T6 T7
Time
The block allows either the boost supply or battery supply to be selected for the voltage
during each Phase 1 and Phase 2. These options can be configured with the Phase 1 - Select
Vboost and Phase 2 - Select Vboost parameters.
The current setpoint can be selected individually for each phase providing for a number of
different possible combinations. Phase 1 and 2 are unique in that they can be configured
to terminate when the current setpoint is reached with the Phase 1 - Switch at current and
Phase 2 - Switch at current, parameters. When the waveform is configured in this manner, the
Phase 1 - Duration (us) (T1) and/or Phase 2 - Duration (us) (T2) options are used as maximum
duration timeouts. If the load current cannot be reached within the duration configured for the
phase, the output will switch to the next phase. If the phase duration is set to zero, the phase
is skipped. Phase 3 will continue for the remaining duration of the pulse (T5).
During each phase a dither off time can be configured individually per phase. (Phase 1 -
Dither off duration (us), Phase 2 - Dither off duration (us), Phase 3 - Dither off duration (us)).
When the current setpoint is reached during the phase, the output will turn off for the dither
off time before turning back on, to regulate the current at the setpoint. This parameter can be
used to increase or decrease the amount of dither around the current setpoint during each
phase.
At the end of the phase before switching to the next phase, a phase switch off time can be
configured to provide for a faster current decay rate between phases. During this time current
is allowed to recirculate freely through the load, providing for a faster switch between two
current setpoints. The Phase 1 switch off duration is set with the Phase 1 - Switch off duration
(us) paramter (T2) and the Phase 2 switch off duration is set with the Phase 1 - Switch off
duration (us) paramter (T4).
6.1.116.4. Inports
None.
6.1.116.5. Outports
None.
• Waveform
A drop down to identify the waveform to configure. The selection of waveform is dependent
on the target ECU hardware selected in the put_Identification block.
• Phase 1 - Enable
Enables Phase 1 of the waveform. If this option is unchecked, the phase will be skipped.
Enables the boost supply as the source of the high side during Phase 1 of the waveform.
If this option is unchecked, the high side will be driven with battery voltage.
Calibratable: No
Sets the duration of the driven (i.e. T1) period of Phase 1 of the waveform. If Phase 1
- Switch at current is unchecked the current will be regulated to value set by Phase 1 -
Current (A). If Phase 1 - Switch at current is checked the duration is the maximum time to
wait before switching to the next phase if the phase current has not been reached.
Enables Phase 1 of the waveform to be terminated immediately upon reaching the current
set by Phase 1 - Current (A). If this option is unchecked, the phase will be active for the
entire duration set by Phase 1 - Duration (us).
Sets the current level during the driven (i.e. T1) period of Phase 1 of the waveform.
Sets the duration of the off period after reaching the phase current during the driven period
of Phase 1 (i.e. T1) of the waveform. The duration will affect the current dither during the
phase. A larger value will allow the current to drop further, providing more dither.
Sets the duration of the non-driven (i.e. T2) period of Phase 1 of the waveform. During
this phase, both the high side and low side of the output are turned off allowing current
to recirculate through the load to the Vboost supply, providing a faster current decay rate
when switching phases. If no recirculation is required, the duration can be set to zero.
• Phase 2 - Enable
Enables Phase 2 of the waveform. If this option is unchecked, the phase will be skipped.
Enables the boost supply as the source of the high side during Phase 2 of the waveform.
If this option is unchecked, the high side will be driven with battery voltage.
Sets the duration of the driven (i.e. T3) period of Phase 2 of the waveform. If Phase 2
- Switch at current is unchecked the current will be regulated to value set by Phase 2 -
Current (A). If Phase 2 - Switch at current is checked the duration is the maximum time to
wait before switching to the next phase if the phase current has not been reached.
Enables Phase 2 of the waveform to be terminated immediately upon reaching the current
set by Phase 2 - Current (A). If this option is unchecked, the phase will be active for the
entire duration set by Phase 2 - Duration (us).
Sets the current level during the driven (i.e. T3) period of Phase 2 of the waveform.
Sets the duration of the off period after reaching the phase current during the driven period
of Phase 2 (i.e. T3) of the waveform. The duration will affect the current dither during the
phase. A larger value will allow the current to drop further, providing more dither.
Sets the duration of the non-driven (i.e. T3) period of Phase 2 of the waveform. During
this phase, both the high side and low side of the output are turned off allowing current
to recirculate through the load to the Vboost supply, providing a faster current decay rate
when switching phases. If no recirculation is required, the duration can be set to zero.
Sets the current level during the driven (i.e. after T4) period of Phase 3 of the waveform.
Sets the duration of the off period after reaching the phase current during the driven period
of Phase 3 (i.e. after T4) of the waveform. The duration will affect the current dither during
the phase. A larger value will allow the current to drop further, providing more dither.
6.1.116.7. Notes
Phase 3 of the waveform is always enabled.
Setting the switch off duration or dither off duration to a very large value may allow the current
to decay to zero during the injection, possibly allowing the injector to close, and triggering
an electrical diagnostic fault.
6.1.117.3. Description
Wavef orm : Wavef orm 1
Channel : DOT FCV -A1 (pin Y 18 )
prop_Wavef ormSetChannel
This block configures the waveform to use for an output channel. The waveform must be
setup using a prop_WaveformConfig block.
6.1.117.4. Inports
None.
6.1.117.5. Outports
None.
• Waveform
A drop down to identify the waveform to select. The selection of waveform is dependent
on the target ECU hardware selected in the put_Identification block.
• Channel
6.1.117.7. Notes
None.
The sections below give a complete list of automatically generated ASAP2 entries.
Note
When using PiSnoop be sure to load the ASAP2 (.a2l) file symbols to view these
parameters. In many cases they are aliases for C variables with different names in
the .elf file, and some have necessary scale factors applied in the ASAP2 attributes.
Past and current boot code version numbering is given in Section 6.3, “OpenECU software
versioning”.
Past and current boot code version numbering is given in Section 6.3, “OpenECU software
versioning”.
Past and current boot code version numbering is given in Section 6.3, “OpenECU software
versioning”.
The application name, description and copyright, as well as the time and date when the
application was built, is available through ASAP2 entries. This information is useful when
confirming what the ECU is actually executing.
Note
The time displayed at the end of a build in Simulink matches ASAP2 entries above.
This can be useful when determining whether the correct version of the application was
programmed into the ECU.
Table 6.13. Automatic ASAP2 entries for application rate task timing
information
When the application is executing, the platform is maintaining a series of tasks that support
the application. These tasks perform basic input and output support as well as general
housekeeping. Each task takes some time to execute and the following entries record the
last execution time of each.
These entries support development by showing how long the software takes to run on the
target hardware. As development progresses, new functionality can be compared to previous
functionality to assess how much processing time is consumed.
The assessment can be made by noting how frequently the tasks run and how long they
take, giving an estimated total consumption.
Some target ECU support loading measurement for processing devices other than the CPU.
The eTPU device, or devices, are used for simple and complex I/O processing.
Although previous entries record how long the last execution took, it is useful to know the
longest execution that has occurred since power up. There are ASAP2 entries to support this.
Table 6.17. Automatic ASAP2 entries for maximum application rate task
timing information
ASAP2 name Description Units
mpl_mtt_[name] The largest value of the microseconds
corresponding application
duration ASAP2 variable
seen since the last power
up or reset.
mpl_max_cpu_loaded The largest value of percent
mpl_cpu_loaded seen
since the last power up or
reset.
mpl_max_etpu_a_loaded The largest value of percent
mpl_etpu_a_loaded seen
Note that the maximum task duration entries record the longest execution seen since power
up and not the worst case execution time of the task. It could be that a task will take longer to
run if given different stimuli. OpenECU does not support the direct derivation of worst case
execution times.
There is also a seconds counter which is cleared to zero when the ECU is turned on or resets.
The counter can be used to determine if the ECU is resetting on a regular or irregular basis.
Expected and unexpected resets are logged and counted. There are ASAP2 entries to report
reset counts.
Table 6.19. Automatic ASAP2 entries for reset information (M110, M220,
M250, M460, M461)
ASAP2 name Description Units
mpl_unstable_reset_count Number of resets since events
power-up, or since the
application was last stable.
mpl_reset_count Number of resets since events
power-up.
In the Sim-API, the size of the stack can be modified in the OpenECU RTW options. For
instance, this might be necessary after testing shows that the average amount of used stack
at run time is too large in comparison to the allocated stack size.
Note
The platform is likely to cause the inexact condition to occur due to rounding. While the
platform has been written to avoid other conditions (such as divide by zero), extreme
values passed by the application to the platform may result in the platform causing
other conditions to occur.
When providing technical support, Pi may need to know the version numbers for the software
components.
Details on how to find out the version numbers for Main processor are given in Section 6.2,
“Automatic ASAP2 entries”.
Version numbers for HCS12 processor can be retrieved by uploading the software, with FEPS
signal applied. Contact technical support for more details.
6.4.1. Documentation
Name
help openecu — display OpenECU specific commands
Synopsis
help openecu
Description
Displays the available OpenECU specific commands. Additional information about an
OpenECU specific command can be displayed by executing the command:
help <command>
e.g.,
help oe_freeccp
Name
ver openecu — display version of OpenECU installed
Synopsis
ver openecu
Description
Displays the version of OpenECU blockset the MATLAB path points at (and if using MATLAB
R12.1, displays the date when that version was created).
The MATLAB path can be changed by selecting the menu option File -> Set Path... to select
a different version of the OpenECU blockset (if the path is changed, MATLAB must be
restarted).
Warning
If more that one version of the OpenECU blockset exists on MATLAB's path, the
behaviour of OpenECU will be undefined. The command
oe_check_path
will raise an error if more than one OpenECU blockset exists on MATLAB's path (the
user must run this command manually).
6.4.2. Blockset
Name
oe_blockset — open the OpenECU blockset library.
Synopsis
oe_blockset
Description
Opens the OpenECU blockset library. Blocks can be dragged directly from the library into
an OpenECU model.
Name
oe_examples — open the OpenECU examples model.
Synopsis
oe_examples
Description
Opens the OpenECU examples model where the user can then open the examples by double
clicking any of the sub-systems.
Name
oe_create_model — create a new OpenECU model in the current directory.
Synopsis
oe_create_model {modelname} [dd [dd-name]] [part [part-number]] [issue
[issue-number]] [template [template-type]]
Description
OE_CREATE_MODEL('model-name')
Creates a new OpenECU model with appropriate model settings and a 'basic' template
containing a put_Identification block, as well as creating a build list and data dictionary that
defaults to using a prefix of 'aaa'. The put_Identification block defaults to the 01T-068432-000
(M220-000) issue 1 target configuration.
Creates a new OpenECU model with appropriate model settings and a 'basic' template
containing a put_Identification block, as well as creating a basic build list and data dictionary
using a prefix given by 'dd-name'. 'dd-name' must be 3 characters long. The model defaults
to the 01T-068432-000 (M220-000) issue 1 target.
Creates a new OpenECU model with appropriate model settings and a 'basic' template
containing a put_Identification block, as well as creating a basic build list and data dictionary
using a prefix given by 'dd-name'. The model is configured for the target given by 'part-
number' and 'issue-number'.
Creates a new OpenECU model with appropriate model settings take from one of the
supported templates specified by 'template-type', containing a put_Identification block, as
well as creating a basic build list and data dictionary using a prefix given by 'dd-name'. The
model is configured for the target given by 'part-number' and 'issue-number'.
Examples
oe_create_model('my_name')
Creates a new OpenECU model named 'my_name' with a data dictionary using the prefix
'aaa' for a 01T-068432-000 (M220-000) issue 1 target.
Creates a new OpenECU model named 'my_name' with a data dictionary using the prefix
'mbe' for a 01T-068432-000 (M220-000) issue 1 target.
Creates a new OpenECU model named 'my_name' with a data dictionary using the prefix
'mbe' for a 01T-068276-000 (M250-000) issue 2 target. The OpenECU model created will
have a basic-bussed template.
It is not possible to create a model if a file with a matching name already exists in the same
directory. Choose a different name for the model and run the command again.
It is possible to create a model with a data dictionary file that already exists. The user will be
given a choice to retain the existing data dictionary, or overwrite the existing data dictionary
when the command runs.
Templates
minimal
Nothing but a put_Identification block to select the ECU target.
basic
Builds on top of the minimal template by including: configuration for the ECU target,
CAN bus and CCP communications for reprogramming, signal monitoring and calibration
purposes; retrieval of the version and build information for each software component
programmed into the ECU for identification purposes; retrieval of basic operating
variables, such as CPU loading and stack use for periodic checks on how large the
application becomes over time; and a basic break down of data flow from input through
to output processing ready to fill out.
basic-bussed
Identical to the basic template except that the data flow from input to output processing
utilises busses making the diagram tidier.
Name
oe_read_build_list — read the data dictionary into the workspace.
Synopsis
oe_read_build_list [modelname]
Description
OE_READ_BUILD_LIST reads the build list for the active model and places the data
dictionary items into the workspace. OE_READ_BUILD_LIST 'model_name' reads the
build list for the named model (which must be in the current directory) and places the data
dictionary items into the workspace.
Name
oe_clear_build_list — removes the model data dictionary items from the workspace.
Synopsis
oe_clear_build_list
Description
OE_CLEAR_BUILD_LIST removes data dictionary entries from the workspace and removes
any build list paths from MATLAB's path.
Name
oe_build_model — initiate a model build using the current configuration parameters.
Synopsis
oe_build_model
Description
OE_BUILD_MODEL starts building the currently selected model using the model's
configuration parameters.
Name
oe_check_compiler — determines whether each of the compilers that OpenECU supports is
available and, if applicable, licensed.
Synopsis
oe_check_compiler
Description
OE_CHECK_COMPILER determines whether each of the compilers that OpenECU supports
is available and licensed.
Checks are made against various compiler versions to ensure that when a model build is
initiated, the compiler is available.
If there is one compiler version installed, the user may add the path to the compiler's
executable to the system PATH environment variable. If there is more than one compiler
version installer, the user must set an environment variable for each version.
GCC comes packaged with the OpenECU installer. It does not require an environment
variable or a license for use.
c:\program files\windriver\diab\5.5.1.0\win32\bin\
c:\progra~1\windri~1\diab\5.5.1.0\win32\bin\
Some versions of the Diab compiler will prompt the user for a license server or license file
through a dialog window if a license cannot be found. The user may either fill out the license
information or press the cancel button as required.
Name
oe_check_path — determines if more than one version of OpenECU exists in MATLAB's
path.
Synopsis
oe_check_path
Description
OE_CHECK_PATH checks for all installed copies of OpenECU on MATLAB's path and warns
the user if more than one was found.
Only one version of OpenECU should be referenced from MATLAB's path otherwise different
versions can interact to result in models which do not load correctly or build correctly.
path
at MATLAB's command prompt. To modify the path, select the menu option 'File -> SetPath...'
and having made any modifications, select Save to remember the modifications for when
MATLAB next starts.
Name
oe_config_using_ert — configure the model to use Embedded Coder (RTW) for model builds.
Synopsis
oe_config_using_ert
Description
OE_CONFIG_USING_ERT creates an active configuration set for OpenECU to be build using
Embedded Coder (RTW-EC) if the configuration set has not already been created. If the
configuration set already exists then the configuration set is activated.
Name
oe_config_using_grt_rtmodel — configure the model to use the RTMODEL target of Simulink
Coder (RTW) for model builds.
Synopsis
oe_config_using_grt_rtmodel
Description
OE_CONFIG_USING_GRT_RTMODEL creates an active configuration set for OpenECU to be
build using Simulink Coder (RTW-RTMODEL) if the configuration set has not already been
created. If the configuration set already exists then the configuration set is activated.
Name
oe_config_using_sim_dd — configure the model to use a Simulink Data Dictionary.
Synopsis
oe_config_using_sim_dd [modelname]
Description
OE_CONFIG_USING_SIM_DD creates a Simulink Data Dictionary with the default name of
bdroot.sldd from the model's build list, and configure the model to use this data dictionary.
Name
oe_switch_version — list available versions of OpenECU or update MATLAB's path to
another version of OpenECU.
Synopsis
oe_switch_version
oe_switch_version directory-of-installed-openecu
Description
OE_SWITCH_VERSION lists available platforms relative to the current OpenECU MATLAB
path and those previously installed. The user can select which version to switch to.
OE_SWITCH_VERSION STR STR changes the current OpenECU MATLAB path to the
platform path that matches the first and second parameter (the second parameter is optional).
OE_SWITCH_VERSION DIR changes the current OpenECU MATLAB path to the platform
path specified by the first parameter. The parameter must be the full path including drive
character.
Examples:
oe_switch_version
oe_switch_version 1_9_2
oe_switch_version trunk
oe_switch_version c:\openecu\platform\1_9_2
The matching strings can be shortened. For instance, the first of the two following examples
can be shortened into the second:
Note
MATLAB's path will be modified for the current session and saved for the next. Next
time MATLAB starts, the switched-to version of OpenECU will be retained.
Note
Switching to an earlier version of OpenECU is supported. But earlier versions of
OpenECU do not always support switching to later versions. If switching to an later
version of OpenECU fails then you will need to manually edit the MATLAB path
manually. See the Installation section of the Release Notes or User Guide for details
on which paths to add.
Warning
MATLAB's cache of models is cleared without saving. All models and MEX functions
will be cleared from memory (except those in a debug or compile state) using the
bdclose all and clear functions commands. This avoids cached elements of
one version of OpenECU being used after switching to another version of OpenECU.
Name
oe_freeccp — download a built model image to OpenECU.
Synopsis
oe_freeccp [-check] [-f <image_file>] [-cancardxl] [-pci] [-croid <id>] [-
dtoid <id>] [-targetid <station address>] [-b <baudrate>]
Description
OE_FREECCP invokes the freeccp tool to either download a model image to an OpenECU or
to check if an OpenECU is available on a CAN link.
The freeccp tool is provided free and unsupported by Pi Innovo. Users are permitted to use
this software for commercial and non-commercial purposes.
Option Description
-check check for an OpenECU device on the CAN link (use appropriate
CRO, DTO, station address and baud rate settings as
necessary)
-f <image_file> download the build S-record image file (do not use the Intel
HEX image)
-cancardxl select a cancardxl can card
-pci select a PCI can card
-croid set the CRO CAN identifier (PC to ECU CAN message —
default is 1785)
-dtoid set the DTO CAN identifier (ECU to PC CAN message —
default is 1784)
-targetid set the station address (default is 0)
-b set the baud rate in kBps (default is 500)
Examples:
oe_freeccp -f step1_image_small.s37
attempts to program the OpenECU device with the built step1 model.
attempts to program the OpenECU device with the built step1 model, using a CAN ID of
400 for the CRO messages, using a CAN ID of 401 for the DTO messages, using a station
address of 2 at 500 kBps.
oe_freeccp -check
This section describes the engine, or angular functionality of the OpenECU blockset,
covering:
• Crankshaft and camshaft sensor processing to determine engine position in Section 7.1,
“Engine position sensor processing”.
• Engine cylinder sequencing and related model asynchronous events in Section 7.2,
“Engine TDC-firing events”.
• Engine related analogue inputs sampled at specific angles (such as manifold pressure),
or sampled and processed during an angular window (such as knock) in Section 7.3,
“Analogue input processing” and Section 7.4, “Knock sensor processing”.
• Engine related injection pulse generation for port injection (low pressure) and direct
injection (high pressure) in Section 7.5, “Scheduling injector outputs”.
• Engine related spark generation for coils in Section 7.6, “Scheduling coil outputs”.
• Engine related general purpose digital output pulse generation at specific angles in
Section 7.7, “Scheduling digital outputs”.
VR signal
(+ve, -ve)
Processing the variable reluctance sensor results in a series of digital edges for further signal
processing (see Section 7.1.2.4, “Crank decoding”) at the center of a physical tooth. The
differential signal is amplified, processed to determine an adaptive threshold used in noise
reduction, and then processed to determine zero crossings representing the center of teeth.
Peak threshold
adaption
Zero crossing
Precision detection
differential
amplifier
Once the positive differential input signal voltage rises above an adaptive threshold, the
zero crossing comparator is armed. Arming the comparator this way provides robust noise
immunity to the input VR signal, preventing false triggers from occurring due to a broken
tooth or an off-center tooth wheel.
The peak threshold level is set to a third of the peak of the previous cycle of the input VR
signal. As the sensor signal peak voltage rises, the adaptive peak threshold voltage also
increases by the same ratio. Similarly as the signal peak voltage falls. If the input signal
voltage remains lower than the adaptive peak threshold for more than 85 milliseconds,
an internal watchdog timer drops the threshold level to a default minimum threshold. This
ensures pulse recognition recovers even in the presence of intermittent sensor connection.
VR signal
(+ve)
Once armed, the zero crossing detection logic generates a digital edge on the falling slope of
the positive pair of the VR input. The zero-voltage level of the VR sensor signal corresponds
to the center of the gear-tooth and is the most reliable marker for position/angle-sensing
applications.
VR signal
(+ve)
Processed
tooth edge
signal
The crank VR input circuitry introduces a phase offset as an artifact of signal filtering. The
phase shift causes the digital tooth edge representing the tooth center to occur some time
after the actual tooth center. The time between the digital tooth edge and the actual tooth
center increases as the frequency of the input signal increases.
Note
The application must take the phase shift introduced by filter circuits into account
explicitly if required. The phase shift is typically accommodated implicitly by calibratable
look-up tables for general calculations such as spark advance. However cylinder
balancing and other application strategies may wish to take the phase shift into account
explicitly.
NR timeout
Used to reject
noisy signal edges
Tooth edge
detected, t0
The application can accept the defaults or use the pan_CrankWheelConfigExt block to set
them explicitly. The noise rejection window can be calibrated out.
12+1 36-1
24-1-1-1 36-1-2-3
Throughout this document, a crank trigger wheel with one group of missing teeth uses
the notation N-M, where N represents the number of physical and missing teeth, and M
represents the number of missing teeth. Similarly, a crank trigger wheel with an extra tooth
uses the notation N+1, where N represents the number of physical teeth minus the extra
tooth. If there are more than one group of missing teeth, or more than one extra tooth, then the
notation is extended by adding further -M or +1 symbols as necessary. For example, 60-2-2-2
represents a crank wheel with 54 physical teeth and three groups of two missing teeth.
Each crank wheel input must be configured using a pan_CrankWheelConfig block. With the
exception of the missing or extra teeth, the teeth must be regular in size and angular distance,
#° per tooth.
α°
α°
α°
½α°
½α°
α°
α°
12+1
α°
α°
α°
α°
α°
α°
For a crank trigger wheel with an extra tooth, the leading edge of the extra tooth must be
evenly spaced by half #°.
α°
α°
N α°
α°
α°
12-1
α°
α°
α°
α°
α°
α°
Similarly, for a crank trigger wheel with missing teeth, the missing tooth region must be N #
°, where N is an integer greater than zero.
SD timeout
Used to detect
crank stall
Tooth edge
detected, t0
Stall-detection timeout:
The crank stall detection mechanism cannot be calibrated out (in contrast to the noise
rejection mechanism, see Section 7.1.1.5, “Noise rejection”).
When the crank trigger wheel decoding first detects two teeth before stall is detected, then
the ECU considers the crankshaft to be moving. The detection of a moving crankshaft is
used by the port injection functionality to deliver a priming pulse if configured to do so. The
application can retrieve movement information using the pan_CrankWheelMovement block.
Crank region
12+1
Crank sync point
For a crank trigger wheel with one or more extra tooth sync points, the crank region (shown
in blue) extends from the end of the sync point to the end of the next sync point. The sync
point itself (shown in red), differs from the rest of the crank region with a change in pattern
that the ECU can detect (in this case, an extra tooth).
Crank region
36-1-1-1
Crank sync point
The crank region and sync point are defined similarly for missing teeth.
Multiple sync points in a crank trigger wheel are supported but all sync points must be of the
same type. For instance, if the crank trigger wheel has one extra tooth sync point, then any
additional sync points must also be of the extra tooth variety.
B a
12+1
In the case of a sync point with an extra tooth, the time between teeth prior to the extra tooth,
A, the time between the extra tooth and the prior tooth, B, and the time between teeth as if
the extra tooth were not there, a, are used. The model can accept the default ratio values or
use the using a pan_CrankWheelConfigExt block to set them explicitly.
a
12-1
In the case of missing teeth, the time between teeth prior to the gap, A, the time across the
gap, B, and the time between teeth after the gap, a, are used to detect a sync point.
There are some limits on crank trigger wheel processing. In particular, the total number of
teeth on the crank trigger wheel, the number of teeth between sync points, the number of
of extra teeth and the the number of missing teeth, must fall within the limits defined by the
pan_CrankWheelConfig block.
Note
Some care is required when configuring the orientation of the crankshaft trigger wheel
sync points relative to cylinder events. For example, if a sync point lines up with an
area of the engine revolution with high acceleration, then it may be hard for the ECU
to correctly decode sync point information. Align crankshaft trigger wheel sync points
with regions of the engine rotation which see the least variation in speed.
• Find crank region synchronisation — used to find the missing tooth region when
synchronisation was not previously gained, or had been lost
• Keep crank region synchronisation — used to maintain synchronisation with the crank
wheel once synchronisation has been found
Within each group, a series of states decodes the crank signal over time.
3
Find
first tooth
edge
4
Find crank region synchronisation
Find
second tooth
edge
Tooth edge timed out
Detect
Ba
7, 8, 9, 10
Tooth edge timed out
Count
teeth
Confirm
sync pont
Ignore-crank-signal
Occurs once during initialisation of the ECU, after reset.
The state ignores crank edges for 10 milliseconds, letting any electronics settle during
power up.
Skip-crank-teeth
Occurs once the ignore-crank-signal state is complete.
Ignores the first n processed teeth edges, further letting any electronics settle during
power up.
First-edge
Occurs once the skip-crank-teeth state is complete, or loss of crank synchronisation
occurred, or the crank signal is declared stalled.
If a tooth edge occurs within first-tooth-timeout milliseconds since the last tooth edge
then the time of the tooth edge is remembered for later processing. Otherwise, the crank
signal is declared as stalled. This sets the minimum speed at which the crank decode
logic will start to look for crank synchronisation.
Second-edge
Occurs if the first-edge state did not timeout.
If a tooth edge occurs within a timeout since the last tooth edge then the time of the
tooth edge is remembered for later processing. Otherwise the crank signal is declared
stalled. For example, a crank trigger wheel with missing teeth sync points has a timeout
as follows:
SD timeout
Used to detect
crank stall
Stall-detection timeout:
Detect-AB:
Occurs if the second-edge state did not timeout; or if the detect-ab state did not detect
a sync point; or if the detect-ba state did not confirm a sync point.
If a tooth edge occurs within a timeout since the last tooth edge then the time of the
tooth edge is remembered for later processing. Otherwise the crank signal is declared
as stalled.
The state buffers the time of teeth edges in a cyclic fashion, where t0 is the time of the
most recent tooth, t-1 is the time of the tooth before t0, and t-2 the time of the tooth before
that. The state uses a AB ratio test from Section 7.1.2.3, “Sync point detection” to detect
the sync point. For example, a crank trigger wheel with missing teeth sync points has
a timeout as follows:
SD timeout
Used to detect
crank stall
Stall-detection timeout:
Detect-Ba
Occurs if the detect-ab state found a sync point.
If a tooth edge occurs within a window since the last tooth edge then the time of the tooth
edge is remembered for later processing (as in state detect-ab). Otherwise the crank
signal is declared stalled.
The state uses a Ba ratio test from Section 7.1.2.3, “Sync point detection” to detect the
sync point. For example, a crank trigger wheel with missing teeth sync points has a
timeout as follows:
NR timeout SD timeout
Used to reject Used to detect
noisy signal edges crank stall
Tooth edge
detected, t0
Stall-detection timeout:
If the ratio test passes, the ECU declares region sync to the crank trigger wheel (see
Section 7.1.9, “Engine synchronisation modes”).
Count-teeth
Occurs if the detect-ba state or confirm-sync-point state detected a sync point.
If a tooth edge occurs within a timeout since the last tooth edge then the number of teeth
since the gap is counted and the angle clock is maintained (see Section 7.1.4, “Angle
clock”). Otherwise the crank signal is declared stalled. For example, a crank trigger wheel
with missing teeth sync points has noise rejection and stall detect / timeout processing
as follows:
NR timeout SD timeout
Used to reject Used to detect
noisy signal edges crank stall
Tooth edge
detected, t0
Stall-detection timeout:
Confirm-sync-point
Occurs if the count-teeth state counted the number of physical crank teeth for the current
crank region without timeout.
Works as the detect-ab state does with the addition of noise rejection. For example, a
crank trigger wheel with missing teeth sync points has noise rejection and stall detect /
timeout processing as follows:
NR timeout SD timeout
Used to reject Used to detect
noisy signal edges crank stall
Stall-detection timeout:
For crank wheels that have multiple sync points, the application must provide information
about the next crank region at the end of each detected sync point (decoding states detect-
ba and confirm-sync-point). At the end of each successfully decoded sync point, the ECU
invokes the pan_CrankWheelSyncPointTrigger block on the second tooth in the subsequent
crank region. The block generates an asynchronous function call trigger used to invoke a
subsystem.
Crank region
36-1-1-1
Crank sync point
In response, the application must look at the information about the sync point and provide
information about the next crank region. Information about the sync point can be retrieved
using the pan_CrankWheelSyncPointLast block. The information includes the number of
teeth detected since the last sync point, and the durations of the teeth involved in the
sync point (see Section 7.1.2.3, “Sync point detection”, sync point durations A, B and a).
Information about the next crank region can be set using the pan_CrankWheelSyncPointNext
block.
As an example, consider a 60-1-2 crank trigger wheel. Lets say this represents two crank
regions:
When a sync point has been found and verified, the application will be invoked. If the
application retrieves information about the sync point showing there was 28 physical teeth
seen, then the application would assume that crank region X follows next and provide
details about region X. Similarly, if the application retrieves information showing there was
29 physical teeth seen, then the application would assume that crank region Y follows next
and provide details about region Y.
Note
Due to other processing that the ECU performs, there may be a delay between the sync
point trigger being recognised by the ECU and ECU running the corresponding sub-
system. See Table 4.8, “Library and application tasks” for an overview of the ECU's
tasks, including those of higher priority than the crank sync point tasks, which might
cause delays.
The process for determining crank zero degrees starts when the ECU has not gained
synchronisation to the crank trigger wheel. The ECU monitors the crank signal for a possible
sync point. When the first sync point is found and verified then the tooth at the end of the sync
point is assigned to correspond to crank zero degrees. When the ECU loses synchronisation
to the crank trigger wheel, this process starts again.
The following diagram shows crank zero degrees for two crank trigger wheels, one for a
single extra tooth sync point, and one for a single missing teeth sync point.
Direction of
rotation
300° 300°
270° 270°
33 33
0° 0°
0°
0°
24
24
0°
0°
210°
210°
12+1 12-1
180°
180°
30°
30°
60
60
0° 0°
15
°
15
°
In both the extra and missing cases, the crank wheel starts to move, the sync point
(highlighted in red) is detected and crank zero degrees is assigned to the following tooth.
When there is more than one sync point, the process is the same. The first sync point detected
is used to assign crank zero degrees.
300° 300°
270° 270°
33 33
0° 0°
0°
0°
24
24
0°
0°
210°
210°
12+1+1+1 12-1-1
180°
30°
180°
30°
60
0°
60
0°
15
°
15
°
120° 90° 90°
120°
However, as there is more than one sync point on the crank wheel, each time the crank
wheel starts to turn and a sync point is found and verified, crank zero degrees can change
positions, as shown in the following diagram for a 12-1-1 crank trigger wheel.
300° 120°
270° 90°
33 15
0° 0°
0°
°
60
24
180°
0°
210°
30°
12-1-1 12-1-1
210°
180°
30°
0°
24
60
0° 0°
0°
15
°
33
90° 270°
120° 300°
The application must determine which sync point was first detected and apply an angle offset
to compensate using the pan_EngineDeclareSync block. The application can determine the
sync point by looking at the camshaft trigger wheel tooth angles if available, or some other
method, such as the crank tooth acceleration curve.
Note that in the previous examples, crank zero degrees is assigned to the start of the
physical tooth at the end of the sync point. This occurs when using a Hall-effect sensor, which
generates a digital pulse corresponding to each physical tooth. When using a VR sensor,
the crank sensor processing results in a digital signal with an offset (see Section 7.1.1.1,
“Variable reluctance signal” for more).
Direction of
rotation
300°
270°
33
0°
0°
24
0°
210°
12+1
180°
30°
60
0°
15
°
120° 90°
In this case, crank zero degrees is assigned to the center of the tooth at the end of the
sync point. The application must account for the difference between using a Hall-effect or
VR crank sensor.
The angle clock is synchronised to the crank teeth. When a tooth is detected, the frequency
of the angle clock is based on the duration of time between the last two teeth (ignoring sync
points). The frequency of the clock is chosen to achieve a resolution of at least 0.1 crank
degrees. The angle clock then ticks at that rate for the number of degrees per tooth, #°,
providing an interpolated estimate of the position between teeth.
For example, let A represent the time between the last two detected teeth (excluding sync
points). When the crankshaft is spinning at a constant speed, A will remain constant.
Tooth period, A A A
Angle clock
When a new tooth is detected, the angle clock frequency is adjusted to achieve the minimum
resolution. The angle clock then ticks up at that rate (shown in blue) and stops after #°. As
the crankshaft is spinning at a constant speed, the angle clock will stop just before a new
tooth is detected. In this way, the angle clock provides an estimate of the crankshaft position
between teeth.
When the crankshaft decelerates between teeth, the angle clock will stop before the next
tooth is detected, as depicted below (in red). When the next tooth is detected, the frequency
of the angle clock is recalculated and the angle clock starts to tick up at that rate.
Angle clock
The angle clock completes one tooth increment early when the
crank wheel declerates. Angle clock starts to increment when
the next tooth is detected.
When the crankshaft accelerates between teeth, the angle clock will not have completed #
° of ticks before the next tooth is detected, as depicted below (in purple). To compensate,
when the next tooth is detected the angle clock switches to a high frequency to catch up.
Once #° of ticks have been completed, the frequency of the angle clock is adjusted as before
and clock starts to tick up at that rate.
Angle clock
Note that the angle clock accuracy depends on the number of crank trigger wheel teeth. The
larger the number of teeth, the better the accuracy of the angle clock.
At the start of a crank region, the crank region tooth count is reset to one. Each tooth is
counted until the next crank region starts. Any extra teeth in a sync point are ignored.
Direction of
rotation
10 11 10 11
12
9
9
1
1
8
8
12+1 12-1
2
2
7
7
3
3
6 6
5 4 5 4
The first tooth counted per crank revolution corresponds to the tooth the ECU assigns to
crank zero degrees (see Section 7.1.3, “Crankshaft zero degrees”). If the crank trigger wheel
has more than one sync point, then tooth one may change positions depending on which sync
point is detected first. Each tooth is counted until the crank has turned a complete revolution,
then the count is reset to one. Any extra teeth in a sync point are ignored.
10 11 4 5
9
3
1
7
8
12-1-1 12-1-1
2
8
7
1
3
5 4 11 10
• A per-tooth calculation provides instantaneous speed. During a sync point, the speed
calculation compensates for any missing teeth. Note that the higher the number of missing
teeth, the less accurate the speed calculation will be if the engine rotation is accelerating
or decelerating across the sync point.
In comparison to crank trigger wheel processing, little processing occurs for cam trigger
wheels. Depending on the circuit configuration for an ECU, the ECU will support VR or Hall-
effect camshaft sensors. See the ECU's technical specification for details relating to VR
signal processing (processing for crank and cam shaft sensor processing typically differs).
And except for filtering implemented by the input circuit, there is no support to reject noise
as there is for crankshaft sensor processing.
Typically, the cam trigger wheel has at least one unique tooth edge which can be used to
determine the overall engine position (i.e., to determine between two halves of a four-stroke
engine cycle). But the ECU's camshaft sensor processing does not require this. The pattern
of expected cam trigger wheel teeth are not supplied to the ECU and need not be equally
spaced (unlike the crankshaft trigger wheel). Cam trigger wheel patterns, such as a half moon
or more complex, are treated the same.
However, the application must specify the number of cam trigger wheel teeth using a
pan_CamWheelConfig block for each camshaft.
Once the angle clock is running, the ECU records the angle of tooth edges, in the order of
detection, from the cam trigger wheel into a vector or array. The ECU supports recording
both sensor edges of a tooth, or just the leading or trailing sensor edge. Tooth angles are
recorded relative to crank zero degrees. The application can retrieve the tooth angles using
the pan_CamWheelToothEdgeAngles block.
Cam trigger wheel tooth edge information is recorded by the ECU. The application uses
this information to determine the overall engine position and adjust crank zero degrees (see
Section 7.1.3, “Crankshaft zero degrees”). In turn, the ECU adjusts the angle clock and any
scheduled events based on the angle clock, as described in more detail in Section 7.1.9,
“Engine synchronisation modes”.
Some engines do not have a camshaft (e.g., two-stroke), or do not attach a sensor to the
camshaft (e.g., four-stroke motorbike engine). In the two-stroke case, there is no need to
utilise the ECU's camshaft processing. In the case of sensor-less camshaft system, the
application will need to utilise other input processing to determine the overall engine position.
See Section 7.3, “Analogue input processing” for input processing of analogue inputs to
detect pressure patterns or Section 7.2, “Engine TDC-firing events” for input processing of
engine speed to detect acceleration patterns.
In the crank and cam signal processing outlined so far, the ECU will automatically handle
engine synchronisation up to crank region sync. The application must then determine the
overall engine position from the crank sync point information, the cam tooth edge information
(if configured), or any other source such as manifold pressure or crank accelerations, then
request a switch to half or full engine modes using the pan_EngineDeclareSync block. The
current engine synchronisation state can be read using the pan_EngineSync block.
0
No crank
synchronisation
Crank
region sync Sync point found
2 1
Half Full
engine sync engine sync
Sync point found
No crank synchronisation
Occurs during initialisation of the ECU, after reset, or when crank signal processing times
out (stall), or when crank signal processing cannot detect an expected sync point (loss
of sync), or when the application forces loss of crank sync.
When the ECU has no crank sync all angular functions except crank and cam trigger
wheel processing are turned off.
Crank moving
Occurs when the engine sync mode was previously no crank sync and the ECU has
processed at least two crank teeth without timeout (stall).
When the ECU first detects the crankshaft to be moving, the crank moving state becomes
active and if configured, the ECU will generate a priming fueling pulse on each port-
injection output pin.
The ECU will remain in the crank region sync mode trying to maintain synchronisation
to the crank trigger wheel. The ECU will trigger the application at the end of each sync
point. The application must determine the overall engine position, then request a change
to either the half engine sync mode or the full engine sync mode.
In half engine sync mode the application has determined the position of a four-stroke
engine with evenly spaced TDC-firing events, to one of two engine halves, but does not
know which half yet. The cylinder TDC-calculation trigger, port injection, spark and digital
output functions support running an engine in this mode.
In full engine sync mode the application has determined the position of a two-stroke or
four-stroke engine. Most angular functions are enabled in full engine sync mode.
Each of the synchronisation modes enables different sets of angular functionality. When a
function is disabled, input processing ceases and output drivers are turned off.
For the purposes of reading sensors or driving actuators related to a cylinder, it is useful
to define events relative to a common position for each cylinder. This user guide uses the
following terms:
• TDC-firing — the engine angle when the cylinder's piston is at top dead center (TDC) prior
to fuel burning, relative to crank zero degrees.
• TDC-calculation — the relative angle to the cylinder's TDC-firing angle when the ECU
triggers an application asynchronous function call, to calculate per-cylinder data.
As ignition timing is normally specified as crank degrees before TDC-firing, and knock
processing related to ignition timing, the angle convention is the opposite for knock and spark/
coil functionality, where the ECU treats positive angles relative to TDC-firing as happening
before TDC-firing (BTDC-firing), and negative angles relative to TDC-firing as happening
after TDC-firing (ATDC-firing).
Direction of
rotation
63
Cy 0 °
l -2
Cy °
90
l -1
0°
12-1 12-1
2 revolutions 2 revolutions
0°
Cy °
l -1
90
l -2
Cy 0 °
63
Note that the crank diagram has been drawn to show two crank revolutions, covering 720
crank degrees. Also note that depending on which crank sync point is found first, the definition
of crank zero degrees can change. The TDC-firing angles are always relative to crank zero
degrees. The TDC-firing angles entered into the pan_EngineConfig block are in cylinder
order, i.e., “[90, 630]” in this case.
Another example might be a symmetric 4-cylinder inline engine, with TDC-firing angles
relative to crank zero degrees of 46°, 406°, 226° and 586° for cylinders 1 through 4.
Direction of
rotation
586° 226°
Cyl-4 Cyl-3
406°
Cyl-1
Cyl-2
46°
0°
12-1 12-1
2 revolutions 2 revolutions
Cyl-2
Cyl-1
406°
46°
0°
Cyl-3 Cyl-4
226° 586°
For example, taking the same symmetric 4-cylinder inline engine diagram as before, with
an angular offset of -90° (shown in purple), the engine revolution is split into regions, each
assigned to a cylinder.
Direction of
rotation
6°
49
67
6°
586°
TDC-calc
Cyl-4
= -90°
406°
Cyl-2
0°
12-1
2 revolutions
Cyl-1
46°
Cyl-3
226°
6°
31
13
6°
When the application retrieves the current cylinder at angle 500°, the ECU will indicate
cylinder 4. When the application retrieves the current cylinder at angle 480°, the ECU will
indicate cylinder 2.
Note
Due to other processing that the ECU performs, there may be a delay between the
cylinder's TDC-calculation angle being recognised by the ECU and ECU running
the corresponding sub-system. See Table 4.8, “Library and application tasks” for an
overview of the ECU's tasks, including those of higher priority than the TDC-calculation
task, which might cause delays.
Direction of
rotation
540°
0°
12-1-1
2 revolutions
360°
180°
If the ECU identified the crank sync point and crank zero degrees lines up with the engine
configuration, then the application need not apply an engine angle offset. But if the ECU
identifies another crank sync point so that crank zero degrees does not line up with the engine
configuration:
360°
540°
12-1-1
2 revolutions
180°
0°
then the application must determine how the two differ. In this case, an engine angle offset
of -180° realigns crank zero degrees with the engine configuration:
Direction of
rotation
540°
0°
12-1-1
2 revolutions
360°
180°
• Crankshaft trigger wheel teeth can be used to determine the engine position, see
Section 7.2.4.2, “By crankshaft trigger wheel pattern”.
• Camshaft trigger wheel teeth can be used to determine the engine position, see
Section 7.2.4.3, “By camshaft trigger wheel pattern”.
• Crankshaft trigger wheel accelerations can be used to determine cylinder power and
compression strokes, see Section 7.2.4.4, “By crank speed monitoring”.
• Analogue sensors measuring air pressure or flow can be used to determine cylinder intake
strokes, see Section 7.2.4.5, “By engine or cylinder pressure monitoring”.
36-1
Once the sync point has been detected, the ECU will change to crank region synchronisation
and then the application can request a switch to full engine synchronisation with an engine
angle offset of zero (or a specific angle to adjust crank zero degrees to suit the application's
needs). The application can trigger a sub-system for each detected sync point using the
pan_CrankWheelSyncPointTrigger block.
For a four-stroke engine configuration, when a crankshaft trigger wheel has one sync point,
then a sync point can be used to identify one of the two engine cycle halves.
Once the sync point has been detected, the ECU will change to crank region synchronisation
and the application can request a switch to half engine synchronisation. For gasoline port
injected engines, this engine synchronisation mode supports injection and spark every 360
crank degrees, facilitating engine start. The application can run the engine in this mode until
the application determines which half of the engine cycle is active, before requesting a switch
to full engine synchronisation mode.
Crankshaft trigger wheels with more than one sync point offer alternatives to waiting up to
a full crank revolution to declare half or full engine synchronisation. The application can use
the use the pan_CrankWheelSyncPointLast block to identify information about the last crank
region. If the crank region has a varying number of missing teeth per sync point, then the
application can determine the crankshaft position by decoding the timing provided by that
block.
36-1-2-3
Similarly, if there is a varying number of physical teeth between crank regions (ignoring any
extra teeth), then the application can determine the crankshaft position by reading the number
of detected teeth between crank regions provided by that block.
8-1,12-1,16-1
Note that some care is required when utilising these types of techniques. The position
of crankshaft trigger wheel sync points relative to cylinder events must be taken into
consideration. If a sync point lines up with an area of the engine revolution with high
acceleration, say on starting, then it may be hard for the ECU and the application to correctly
decode sync point information.
A common technique is to arrange the camshaft wheel pattern so that reading the digital
state of the camshaft wheel input channel at key crankshaft positions. For example, a half
moon camshaft wheel pattern can be arranged so that the camshaft wheel input reads high
during one crank sync point and low during the other.
Direction of
rotation
Δ = 360°
0°
crank
450°
180°
12-1
cam
2 crank revolutions
Δ = 360°
The red portion (marked 1 and 2) shows approximately where the application might sample
the camshaft wheel input if triggered from a crank sync point. The application can read the
digital state of a camshaft wheel input using the pan_CamWheelDigitalInput block, at any
time, e.g., periodically or after a sync point. The application can trigger a sub-system for each
crankshaft wheel sync point using the pan_CrankWheelSyncPointTrigger block.
Often an engine configuration has a more complex camshaft wheel pattern, typically one
tooth, or one tooth edge, per cylinder.
Direction of
rotation
Δ = 140°
7 °
65 ca
77 m
°
1
Δ
=4
0°
11
7°
°
140
Δ=
0°
crank
36-1
Δ = 140°
2 crank revolutions
517°
40°
Δ=
7°
47
25
7°
2
Δ
=4
0°
° 29
140 40°
Δ= 7°
Δ=
337°
In the example above for an 4 cylinder engine, reading the digital state of the camshaft wheel
input after each sync point would be sufficient (shown in red, marked 1 and 2). However,
engine configurations that adjust cam timing will introduce a phase, such that the camshaft
wheel turns relative to the crankshaft wheel.
cam
0°
40°
Δ = 40°
0°
14
Δ=
Δ=
14
0°
°
580
0°
crank
36-1
180°
2 crank revolutions
Δ = 40°
40°
Δ=1
220
°
Δ=
0°
26 4
2
0°
0°
44 0° 4
Δ=
Δ=1
° 40°
400
Here, a 77° phase has been introduced. The camshaft wheel pattern remains the same but
the teeth edge angles have been offset. In this circumstance, the technique of reading the
digital state of the camshaft wheel after each sync point does not work, as both readings
show the same high state (shown in red, marked 1 and 2).
An alternative technique to reading the digital state of the camshaft wheel input looks for one
tooth edge in regions of the crank revolution. The technique relies on there being at least one
unique tooth edge that occurs across two crank revolutions. For example, in the previous
diagram taking the cam angles and comparing them to the cam angles offset by 360° shows
that some edges are unique and some are not.
Entries 2, 4, 6 and 8 cannot be used to determine the engine position, because those entries
occur at the same angle (modulo 360) on each crank revolution. Entries 1, 3, 5 and 7 occur
only once every second crank revolution and can therefore be used to determine the engine
position.
Given a phasing range of 77°, each unique tooth edge can be windowed. Allowing for 1° of
mechanical play, each unique edge can be identified with the following angle ranges:
Shown in the same form of diagram as before, the unique cam tooth edges (highlighted in
red) are enclosed in angular windows (highlighted in green, marked 1, 3, 5 and 7 after the
edge index). Each window in green has a corresponding window in yellow, offset by 360°. If a
rising edge is found in any of the green windows then the application can declare full engine
synchronisation with an offset of zero degrees. If a rising edge is found in any of the yellow
windows then the application can declare full engine synchronisation with an offset of 360°.
719°
698°
78
°
1 80
°
9°
61
8°
61
0°
157°
crank
539°
36-1
179°
2 crank revolutions
518°
25
8°
25
9°
9° 5
43
8°
43
338°
359°
The application can retrieve the edges of camshaft trigger wheel teeth using the
pan_CamWheelToothEdgeAngles block. The tooth edge information is updated as new
edges are detected, so the application can either periodically retrieve and process cam angle
information, or retrieve and process cam angle details after each crank sync point by using
the pan_CrankWheelSyncPointTrigger block.
A variation on the single edge windowed approach, is to count teeth edges in a window. Take
a camshaft trigger wheel for a four cylinder engine, where the teeth are arranged so that one
half of the camshaft trigger wheel (360° of crank revolution) has two groups of single teeth,
whilst the other half has two groups of double teeth.
Direction of
rotation
714° 30°
132
°
0°
570°
crank
168°
36-1
2 crank revolutions
534°
210°192°
312
°
390° 348°
372°
Assuming a similar phasing of 77°, then the pattern can be broken up into four windows,
two for the single tooth groups (highlighted in green, marked 2) and two for the double tooth
groups (highlighted in yellow, marked 4). The windows are arranged to be identical across
crank revolutions.
31°
54°
°
594
4
0°
571°
crank
36-1
2 crank revolutions
211°
2
234
°
4
°
414
391°
The application retrieves the camshaft trigger wheel tooth edge angles, counts the number
found in the most recent window. If the expected number of edges are found in the window
then the application can declare engine synchronisation with zero engine angle offset.
Otherwise, if the number of edges matches the expected number for the next crank revolution
then the application can declare engine synchronisation with 360° of engine angle offset.
The method relies on there being a unique camshaft trigger wheel tooth edge for each crank
region. This works well when there are multiple crank regions, as each crank region can be
processed on an event driven basis.
Direction of
rotation
Δ = 130°
0° ca
67 m
70
°
Δ=
70
0°
13
°
Δ=
140
0°
°
crank
36-1-1-1
540°
2 crank revolutions
Δ=1
30°
°
30 1
Δ=
27
0°
° Δ = 130
410 °
In this example, each tooth edge is offset by 10° from the previous crank region.
For an engine configuration without variable camshaft timing, the application can decode the
overall engine position within two crank regions (between 140 and 240 crank degrees) by
retrieving and processing one cam tooth edge after each sync point.
For an engine configuration with variable camshaft timing, the application will need to control
the camshaft phase during engine start and process two cam teeth edges to know the overall
engine position.
Arranging the camshaft trigger wheel teeth edges so that the difference in angle between
each edge is unique, can be decoded by the application to identify the engine position.
Direction of
rotation
10 11 11
10
22 23 23
12 22
24
9
9
21
21
1
13
1
13
8
20
8
20
12+1+1+1 12-1-1
14
14
2
2
19
19
7
7
15
15
18
3
3
6 16 16
17 17
5 4 5 4
In the diagram above, the outer circle of numbers represents the first crank revolution.
If the configuration of the engine is two-stroke, then the inner circle of numbers can be
ignored (the engine tooth identification is the same as the crank tooth identification for two-
stroke engines). The inner circle of numbers represents the second crank revolution for four-
stroke engines. The application can retrieve the most recently decoded engine tooth using
a pan_CurrentEngineTooth block.
• A per-cylinder calculation provides an averaged engine speed between the last two TDC-
calculation events.
The ECU will take measurements of multiple analogue input channels at specific engine
positions and make them available to the application. The application defines which analogue
input pins to read on an angular basis using a pan_AngularAnalogInput_Config block.
Note that not all analogue input pins can be used for angular sampling. Any marked as
serial by the ECU's technical specification cannot be used, as these inputs require serial
communication to devices within the IC. The communication leads to large jitter in sampling
angle and are thus excluded.
Knock can be detected by listening to the frequency of the engine block using one or
more acoustic sensors. The sensors are placed at carefully selected locations in the block,
and processed during regions around each cylinder's TDC-firing angle. Knock produces
a characteristic pinging noise and can be picked out by filtering the acoustic signal for
key frequencies. See the ECU's technical specification for details relating to knock signal
processing.
To configure the ECU to perform knock sensor signal processing, the application must identify
the regions around each cylinder's TDC-firing angle when processing will take place. A
region is defined by a starting angle relative to each cylinder's TDC-firing angle. A region is
terminated when the next region starts. The application does this using a pan_KnockConfig
block.
As a convenience, the ECU provides the pan_InjectorConfig block which can be used to map
a number of injectors to cylinders when there is one injector per cylinder.
• Saturating — this type of driver works by supplying the battery's positive voltage to the
injector's high-side and connecting the injector's low-side to the ECU's injector pin that
connects to the battery's negative terminal through a switch. Turning on and off the switch
controls fuel injection by lifting or returning the injector needle.
Current
C1
VBAT+
T1
Time
These drivers expect an injector with a relatively high internal resistance (typically 10 or 20
ohms) where the current through the resistor saturates when turned on for sufficiently long
enough. The current flow in the driver and injector circuit stays low keeping the components
cool for long life.
Engines with saturating injectors typically supply fuel to the injectors with low pressure.
Due to the low fuel supply pressure, injection durations can occur for a sizable duration
of the cylinder cycle. See Section 7.5.1, “Port injection” for details on how the ECU can
drive these types of injectors.
• Peak-and-hold — this type of driver works in a similar fashion to a saturating driver but
includes current sensing circuitry. The ECU controls two phases of injection. The first
phase, peak, draws more current to pull back the injector needle quickly. The second
phase, hold, draws less current to hold the needle in position to allow fuel to flow.
Current
C1
C3
VBAT+ VBAT+
T1 T2
Time
These drivers expect an injector to have lower internal resistance than saturating injectors,
and therefore supply higher current. The current sensing circuitry helps meet the injector
and ECU component life requirements.
Engines with peak-and-hold injectors typically supply fuel to the injectors with higher
pressure. Due to the higher fuel supply pressure, injection durations are short and more
precisely controlled. See Section 7.5.2, “Direct injection” for details on how the ECU can
drive these types of injectors.
• Boosted peak-and-hold — this type of driver works in a similar fashion to the peak-and-
hold driver but includes a phase of injection prior to the peak phase, where the supplied
voltage to the injector is boosted. This boosted phase increases the rate at which the
injector needle is lifted, allowing for higher fuel supply pressure and more precise injection
timing. See Section 7.5.2, “Direct injection” for details on how the ECU can drive these
types of injectors.
Current
C1
C2
C3
T1 T2 T3
Time
In high load and/or cold conditions, the engine strategy may request long injections. To help
prevent injection when the inlet valve is closing (or has closed), the application sets a drop-
dead angle that the ECU uses to stop any on-going injection.
• In half engine synchronisation, for a four-stroke engine, the injection schedule is repeated
every half engine cycle, each with half the requested duration of injection. This mode will
run an engine without knowing which half of the engine cycle is current, and can be used
for quicker starts or limp home mode depending on cam trigger wheel information, or lack
of. In half engine synchronisation, for a two-stroke engine, port injection works as if full
engine synchronisation has been declared by the application.
Although not commonly used, due to higher emissions, the ECU supports a priming injection.
The priming injection is intended to get fuel into the cylinders as quickly as possible in
cold environmental conditions. The ECU starts the priming injection when crank moving
synchronisation has been achieved (see Section 7.1.2.4, “Crank decoding”). To request a
priming injection signal the application uses the pan_InitialInjection_PI block. prior to crank
moving synchronisation.
The application can retrieve information about delivered injection pulses using the
pan_InjectionFeedback_PI block.
The amount to injection can be expressed in units of time or volume of fuel. When the amount
is provided in volume, the ECU will sample the fuel-rail pressure sensor just before each
injection event, and convert volume to time through a 2D table provided by the application
using the pan_InjectorCompConfig_DI block.
The application is responsible for checking that the fuel-rail pressure signal is valid. The
application reads the fuel-rail pressure sensor using a pai_BasicAnalogInput block. on a
periodic basis, along with any other sensor required to infer correct operation, and must
override the fuel-rail pressure signal using a pan_InjectionOverrideFrp_DI block. when the
application determines the sensor is generating an invalid signal. Overriding the fuel-rail
pressure signal may also be useful when validating the application fueling strategy.
Regardless of the units of the injection amount, once converted to time, each injection event
has an injection compensation duration added prior to injection. The compensation duration
allows the application to fine tune injection events based on the micro mechanical differences
between injectors. The application sets the compensation duration uses the pan_Injection_DI
block.
The injection schedule is made up of multiple injection events. The application can enumerate
each event as needed, e.g., pilot, main, post. The only restriction is that each injection event
occurs later in the cylinder cycle than the previous event, i.e., injection events may not
overlap. Due to conversion from volume to time, or due to changes in the engine speed,
events may end up overlapping even if the schedule from the application did not. In these
circumstances, the ECU delays the later of two overlapping events and inserts a delay
between them. The application can specify the delay using a pan_InjectorConfig_DI block.
Note that if using an external injection signal conditioning box, the circuitry of the conditioning
box may impose requirements on the minimum time between injection events. For example,
this might be required to ensure the boost voltage is sufficiently high for each injection event,
or that the conditioning circuitry stays below a critical temperature.
The application can retrieve information about delivered injection pulses using the
pan_InjectionFeedback_DI block.
For ECUs which have configurable waveforms, the total duration of the injection signal, T5,
is set by the application using the pan_Injection_PI block or pan_Injection_DI block. Within
that time-frame, the application can specify one or more injection phases, and within each
phase, the desired current, voltage source and switch time using a prop_WaveformConfig
block. For example, with the M670 ECU, it is possible to shape the injection signal into three
phases. High pressure diesel engine configurations typically have a boosted phase to quickly
lift the injection needle free of mechanical and pressure forces, a peak phase to complete
the needle lift and a hold phase to complete fuel delivery.
Drive signal
On
Off
T5
Current
C1
C2
C3
T1 T2 T3 T4 T6 T7
Time
The desired hold current for a stage is specified by Cn. For each stage, the application can
select between battery voltage, VPWR, or boost voltage, VBOOST. The application can set the
VBOOST control point using a prop_BoostConfig block. The higher boost voltage is typically
used to energise a coil quickly, thus providing fine control over short digital pulses.
The application can defined multiple waveforms and individually assign a waveform to an
injector output pin using a prop_WaveformSetChannel block.
The purpose of the coil is to discharge energy accumulated during a dwell period, causing
a spark between the plug's electrically isolated shell and electrode. The spark ignites the
cylinder's fuel/air mixture.
Like injector output pins, the application must associate a spark output pin to a cylinder. The
application does so using a pan_SparkConfig block.
Spark pulse generation is enabled in half and full engine synchronisation modes. In these
modes, the application can schedule a spark signal with a start and end angle using a
pan_Spark block.
• In full engine synchronisation mode, the application can select between a single spark
signal per cylinder cycle, commonly referred to as coil-on-plug, or two spark signals per
cylinder cycle to support wasted spark, where one coil is used to spark in two cylinders.
• In half engine synchronisation mode, the application can select between no spark signals,
or two spark signal per cylinder cycle. The latter mode supports half engine synchronisation
mode for port injection without knowing which half of the engine cycle is current.
The application can retrieve information about delivered spark pulses using the
pan_SparkFeedback block.
Note that measurement of current for optimal dwell time is not yet supported.
The application specifies the start and end actions using a pan_AngularOutput block. The
start actions are always specified to occur at a start angle, while the end actions are specified
to occur at some duration after the start angle. The duration can be either an angle or a time
depending on the output mode selected. Possible actions are setting the pin-state to active
or inactive, toggling the state or leaving the state unchanged.
In addition to controlling the output in the angular domain, the ECU allows an immediate
action to be specified. This allows a relatively crude level of purely time-based control to
occur at the resolution of the application's task period.
7.8.1.3. Description
Group : Group 1
Channel : AIN ( pin A3)
Fixed sample angles :
pan_ AngularAnalogInputConfig
The application must use a pan_AngularAnalogInput_Config block for each input channel to
be sampled on an angular basis. A pan_AngularAnalogInput_Config block must be present
in the model for other angular analogue input related blocks to operate.
The function identifies the analogue input channel to be sampled. The ECU samples
this analogue input channel across the engine cycle, buffering the conversions.
The results relative to a cylinder's TDC-firing angle can be retrieved using the
pan_AngularAnalogInputVariable block. The results relative to crank zero degrees can be
retrieved using the pan_AngularAnalogInputVariableAbs block.
The block identifies the analogue input channel to be sampled and associates the channel
with a group name. Other analogue input blocks must refer to the same group name.
7.8.1.4. Inports
None.
7.8.1.5. Outports
None.
• Group
A drop down to identify the group of analogue input channel samples to configure.
The selection of groups is dependent on the target ECU hardware selected in the
put_Identification block.
• Channel
Specifies the input channel for the analogue input selected for this Group. The range
of selectable channels is dependent on the target ECU hardware selected in the
put_Identification block.
Tick to enable the Fixed sample angles mask parameter. When ticked, the application
must supply the angles at which to sample the analogue input channel at build time. These
angles cannot be modified when the application is running. Untick this mask parameter to
supply the sample angles at run-time through either the pan_AngularAnalogInputVariable
or pan_AngularAnalogInputVariableAbs block.
Specifies a vector of values specifying the points relative to TDC-firing at which analogue
input samples are to be taken. A positive value denotes an angle after TDC-firing. The
sample angles are used for each cylinder.
7.8.1.7. Notes
None.
7.8.2.3. Description
cylinder
Group:
average
Group 1
angles
pan_ AngularAnalogInputVariable
The angular samples are buffered by the ECU when the TDC-calculation event occurs. See
Section 7.2, “Engine TDC-firing events” for a definition of TDC-calculation. If the angles at
which the samples are taken are both before and after the TDC-calculation angle, then those
samples prior to the TDC-calculation angle will be from the current cycle, but the angles after
the TDC-calculation angle will be from one cycle earlier.
The sample angles are resolved to the closest sample (samples occur every 6 degrees
throughout the engine cycle).
7.8.2.4. Inports
• cylinder
Identifies the cylinder samples are taken from. Samples are made relative to the cylinder's
TDC-firing angle.
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
• angles
Specifies a vector of values specifying the points relative to TDC-firing at which analogue
input samples are to be taken. A positive value denotes an angle after TDC-firing. The
angles are reduced to a resolution of at least 6 crank degrees.
• sim_average
Only used under simulation. The outport average is set to the value of this inport. Available
only if Average samples? is ticked.
• sim_samples
Only used under simulation. Under simulation, the width of this inport is configured to
match the width of the outport (as a scalar for an average sample, or a vector for individual
samples). The outport samples is set to the value of this inport. Available only if Average
samples? is unticked.
7.8.2.5. Outports
• average
The average of the angular sample channel calculated and buffered at the last TDC-
calculation event. This outport is available when the Average samples? mask parameter
is ticked.
• samples
The individual samples of the angular channel buffered at the last TDC-calculation event.
This outport is available when the Average samples? mask parameter is unticked.
The outport is a vector of samples. The size of the vector matches the size of the angles
inport. The order of the A/D samples given by this outport matches the order of the sample
angles given by the angles inport.
• Group
A drop down to identify the group of analogue input channel samples to process (as defined
by the pan_AngularAnalogInputConfig block).
• Average samples?
Tick to provide the sampled A/D channel information as an average, untick to provide the
information as individual samples.
• Sample time
7.8.2.7. Notes
None.
7.8.3.3. Description
Group:
angles average
Group 1
pan_ AngularAnalogInputVariableAbs
The angular samples are buffered by the ECU when the TDC-calculation event occurs. See
Section 7.2, “Engine TDC-firing events” for a definition of TDC-calculation. If the angles at
which the samples are taken are both before and after the TDC-calculation angle, then those
samples prior to the TDC-calculation angle will be from the current cycle, but the angles after
the TDC-calculation angle will be from one cycle earlier.
The sample angles are resolved to the closest sample (samples occur every 6 degrees
throughout the engine cycle).
7.8.3.4. Inports
• angles
A vector of angles where analogue input samples are to be taken. Each angle is relative
to crank zero degrees. The angles are reduced to a resolution of at least 6 degrees.
• sim_average
Only used under simulation. The outport average is set to the value of this inport. Available
only if Average samples? is ticked.
• sim_samples
Only used under simulation. Under simulation, the width of this inport is configured to
match the width of the outport (as a scalar for an average sample, or a vector for individual
samples). The outport samples is set to the value of this inport. Available only if Average
samples? is unticked.
7.8.3.5. Outports
• average
The average of the angular sample channel calculated and buffered at the last TDC-
calculation event. This outport is available when the Average samples? mask parameter
is ticked.
• samples
The individual samples of the angular channel buffered at the last TDC-calculation event.
This outport is available when the Average samples? mask parameter is unticked.
The outport is a vector of samples. The size of the vector matches the size of the angles
inport. The order of the A/D samples given by this outport matches the order of the sample
angles given by the angles inport.
• Group
A drop down to identify the group of analogue input channel samples to process (as defined
by the pan_AngularAnalogInputConfig block).
• Average samples?
Tick to provide the sampled A/D channel information as an average, untick to provide the
information as individual samples.
• Sample time
7.8.3.7. Notes
None.
7.8.4.3. Description
Cam wheel:
Primary
DIN( pin A4)
pan_ CamWheelConfig
The application must use a pan_CamWheelConfig block for each input channel to be
attached to a camshaft encoder wheel. A pan_CamWheelConfig block must be present in the
model for other camshaft related blocks to operate. The block identifies the teeth arrangement
for one camshaft sensor input, including the maximum expected number of teeth and which
teeth edges to record. When the angle clock is running, the application can retrieve the
cam wheel tooth record using a pan_CamWheelToothEdgeAngles block with a matching
camshaft wheel encoder input channel selection.
7.8.4.4. Inports
None.
7.8.4.5. Outports
None.
• Wheel
A drop down to identify the camshaft wheel to configure. The selection of wheel is
dependent on the target ECU hardware selected in the put_Identification block.
• Channel
Specifies the input channel for the camshaft sensor input selected for this Wheel. The
selection of channel is dependent on the target ECU selected in the put_Identification
block.
• Wheel teeth
Specifies the maximum number of teeth, or lobes, of the camshaft wheel encoder. If the
camshaft wheel has more teeth than specified here, then some angle information about
teeth will not be recorded by the pan_CamWheelToothEdgeAngles block, and the block's
count_extra outport will count up.
Specifies the tooth edge type to use when recording teeth angles. Note that the target
ECU circuitry may invert the signal (see the ECU's Technical Specification for details about
signal inversions).
Falling
One angle per tooth is captured on the falling edge from the processed
sensor signal.
Rising
One angle per tooth is captured on the rising edge from the processed
sensor signal.
7.8.4.7. Notes
None.
7.8.5.3. Description
Cam
Wheel state
Digital Input
pan_ CamWheelDigitalInput
The pan_CamWheelDigitalInput block provides the instantaneous digital voltage level (high
or low) seen at a camshaft wheel input pin. Note that the target ECU circuitry may invert the
signal (see the ECU's Technical Specification for details about signal inversions).
7.8.5.4. Inports
• sim_state
Only used under simulation. Under simulation, the value of this inport is passed through
to outport state.
7.8.5.5. Outports
• state
Set to zero if the voltage level on the camshaft wheel pin is low, set to one if the voltage
level on the camshaft wheel pin is high. Note that the target ECU circuitry may invert the
signal (see the ECU's Technical Specification for details about signal inversions).
• Wheel
A drop down to identify the camshaft wheel input pin to measure. The selection of wheel
must match a pan_CamWheelConfig block elsewhere in the model.
• Sample time
7.8.5.7. Notes
None.
7.8.6.3. Description
Cam
Wheel movement
Movement
pan_ CamWheelMovement
The pan_CamWheelMovement block retrieves whether the camshaft wheel is moving or not.
The ECU continually monitors the camshaft wheel input signal looking for tooth edges. If
a tooth edge (as defined in the pan_CamWheelConfig block) is detected within a timeout
period (approximately 2 seconds), then the ECU declares the wheel as moving. Otherwise,
the ECU assumes the wheel is stationary and not moving.
7.8.6.4. Inports
• sim_movement
Only used under simulation. Under simulation, the value of this inport is passed through
to outport movement.
7.8.6.5. Outports
• movement
Set to zero if the camshaft wheel input appears to have stopped (i.e., is below the frequency
measurement threshold of approximately 0.5 Hz), and set to one if the camshaft wheel
input appears to be moving.
• Wheel
A drop down to identify the camshaft wheel to measure for movement. The selection of
wheel must match a pan_CamWheelConfig block elsewhere in the model.
• Sample time
7.8.6.7. Notes
None.
7.8.7.3. Description
angles
edges
count _ timedout
count _ empty
count _ extra
pan_ CamWheelToothEdgeAngles
Timeout check
The ECU measures the duration between cam teeth edges and declares a timeout if
no edge is seen for approximately 2 seconds (roughly 30 RPM for a single tooth cam
trigger wheel). The ECU accumulates the count of time out events (modulo 16777216),
and provides an outport to indicate if the signal is timed out when the block iterates.
For example, if there is persistent noise on the camshaft wheel sensor signal then the
extra edge count will be incremented at the end of each camshaft revolution. If the
pan_CamWheelConfig block is configured for two teeth but the wheel has three teeth,
then the extra edge count will be incremented at the end of each camshaft revolution.
7.8.7.4. Inports
• sim_angles
Only used under simulation. Under simulation, the values of this vector inport are passed
through to outport angles.
• sim_edges
Only used under simulation. Under simulation, the values of this vector inport are passed
through to outport edges.
• sim_num_edges_last
Only used under simulation. Under simulation, the values of this vector inport are passed
through to outport num_edges_last.
• sim_num_edges_this
Only used under simulation. Under simulation, the values of this vector inport are passed
through to outport num_edges_this.
• sim_timedout
Only used under simulation. Under simulation, the value of this inport is passed through
to outport timedout.
• sim_count_timedout
Only used under simulation. Under simulation, the value of this inport is passed through
to outport count_timedout.
• sim_count_empty
Only used under simulation. Under simulation, the value of this inport is passed through
to outport count_empty.
• sim_count_extra
Only used under simulation. Under simulation, the value of this inport is passed through
to outport count_extra.
7.8.7.5. Outports
• angles
The measured angle or angles of the processed camshaft wheel teeth edges, as defined
by the pan_CamWheelConfig block. The angles are relative to zero degrees of the primary
crankshaft wheel input, as described in Section 7.1.3, “Crankshaft zero degrees”, adjusted
by the application declared engine angle offset, as described in Section 7.2.4, “Engine
angle offset”.
For example, if a tooth edge is detected 15 degrees after crank zero degrees, and the
application has not declared engine sync, then the block will report the angle as 15. If the
application subsequently declares engine sync with an angle offset of 360 crank degrees,
then the block will report the angle as 375.
When the ECU loses synchronisation with the primary crankshaft then the values of the
angles output are reset to zero.
• edges
Corresponding measurement of the tooth edge for each tooth angle, either falling, rising
or not yet sampled.
When the ECU loses synchronisation with the primary crankshaft then the values of the
edges output are reset to not yet sampled.
• num_edges_last
The number of camshaft trigger wheel teeth edges captured in the last engine revolution
(from engine tooth one to engine tooth one).
• num_edges_this
The number of camshaft trigger wheel teeth edges captured in this engine revolution (from
engine tooth one to the current engine tooth).
• timedout
Set to one when a cam wheel tooth edge has not been detected in approximately 2
seconds. With a single toothed cam trigger wheel, this equates to approximately 30 RPM.
The duration of the time out is fixed by the block.
• count_timedout
• count_empty
A count of engine revolutions where no camshaft teeth edges are detected, wrapped
modulo 16777216. An engine revolution starts at crank zero degrees and ends one or
two crank revolutions later. The number of crank revolutions depends on the engine type
selected by the pan_EngineConfig block.
• count_extra
A count of extra edge events, wrapped modulo 16777216. An extra edge event occurs
when more than the expected number of edges are detected per camshaft revolution.
An engine revolution starts at crank zero degrees and ends one or two crank revolutions
later. The number of crank revolutions depends on the engine type selected by the
pan_EngineConfig block.
• Wheel
A drop down to identify the camshaft wheel for angle measurement. The selection of wheel
must match a pan_CamWheelConfig block elsewhere in the model.
• Sample time
Calibratable: No
7.8.7.7. Notes
None.
7.8.8.3. Description
valid
Current
Crank
Angle
angle
pan_ CurrentCrankAngle
The pan_CurrentCrankAngle block retrieves the current angle of the crankshaft wheel
encoder, relative to crank zero degrees (see Section 7.1.3, “Crankshaft zero degrees”). The
retrieved value is taken from the angle clock, which is an estimate of crank decoding and
position identification process (Section 7.1.4, “Angle clock”).
7.8.8.4. Inports
• sim_valid
Only used under simulation. Under simulation, the value of this inport is passed through
to the valid outport.
• sim_angle
Only used under simulation. Under simulation, the value of this inport is passed through
to the angle outport.
7.8.8.5. Outports
• valid
Set to zero when the ECU cannot provide a crank angle (for instance, the ECU has not
gained region synchronisation with the crankshaft wheel encoder), or set to one when the
outport angle is valid.
• angle
The estimated angle of the crankshaft wheel. If the crank wheel is primary, then the value
is taken from the angle clock (which is itself an estimate of the wheel position between
teeth). If the crank wheel is secondary, then the value is taken from the last decoded tooth
(and therefore with reduced resolution).
• Wheel
A drop down to identify the crankshaft wheel for angle measurement. The selection of
wheel must match a pan_CrankWheelConfig block elsewhere in the model.
• Sample time
7.8.8.7. Notes
None.
7.8.9.3. Description
Crank wheel:
Missing teeth ( grouped)
pan_ CrankWheelConfig
The application must use a pan_CrankWheelConfig block for each input channel to be
attached to a crankshaft encoder wheel. A pan_CrankWheelConfig block must be present
in the model for other crankshaft related blocks to operate. The block identifies the teeth
arrangement for one crankshaft sensor input, including the number of teeth, sync points and
their type.
The block supports crank trigger wheels with missing teeth or an extra tooth. Common crank
trigger wheels, such as 12+1 and 36-1 are supported:
12+1 36-1
24-1-1-1 36-1-2-3
Where supported, the application can use the pan_CrankWheelConfigExt block to further
define how the crankshaft signal is processed for electrical noise, sync point detection and
more.
See Section 7.1.1, “Crankshaft position sensor processing” for a general description of how
the ECU processes different crank sensor signals, and see the ECU's Technical Specification
for details specific to an ECU. In particular, note that some ECUs (such as the M670)
invert the crankshaft sensor signal in circuitry, which must be taken in to account with the
Tooth edge polarity mask parameter. Please see the crank sensor input section of the
ECU's Technical Specification to determine polarity settings. The ECU does not diagnose
an inverted crank signal.
The block makes a distinction between primary and secondary crankshaft encoding wheels.
A primary wheel can drive the angle clock, as described in Section 7.1.4, “Angle clock”. A
secondary wheel cannot drive the angle clock but can be used to determine phasing between
the primary wheel and itself.
7.8.9.4. Inports
None.
7.8.9.5. Outports
None.
• Wheel
A drop down to identify the crankshaft wheel to configure. The selection of wheel is
dependent on the target ECU hardware selected in the put_Identification block.
• Channel
Specifies the input channel for the crankshaft sensor input selected for this Wheel. The
selection of channel is dependent on the target ECU selected in the put_Identification
block.
• Wheel type
Specifies the expected pattern of teeth on the crankshaft encoding Wheel. The selection
of wheel type is dependent on the target ECU selected in the put_Identification block.
α°
α°
N α°
α°
α°
12-1
α°
α°
α°
α°
α°
α°
α°
α°
α°
½α°
½α°
α°
α°
12+1
α°
α°
α°
α°
α°
α°
• Wheel synchronisation
Specifies the algorithm to use when detecting crank synchronisation points (see
Section 7.1.2.2, “Crank wheel sync points”. The selection of algorithm is dependent on the
target ECU selected in the put_Identification block.
• Wheel teeth
Specifies the number of teeth on the crankshaft encoding wheel, plus any missing teeth
but ignoring an extra teeth. For example, use 60 for a 60-2 wheel, 36 for a 36-1-1 wheel,
12 for a 12+1 wheel, and 12 for a 12+1+1 wheel.
Specifies the number of teeth involved in one of the sync points of the crankshaft wheel
encoder. Negative integers indicate missing teeth, positive integers represent extra teeth.
Specifies the polarity of the input signal to be used as the tooth indication when decoding
the crankshaft wheel. Note that this polarity refers to the processed signal to the
microprocessor, and therefore its meaning with respect to the polarity on the external pin
varies between target ECUs, as detailed below.
Default
With this choice, for a Hall-effect signal, a falling edge is the tooth
indication. For a VR signal, the tooth indication always corresponds
to the zero crossing point where the positive signal falls below the
negative signal. Note that for a VR signal, the default selection should
always be preferred, since the other edge of the processed signal
will correspond to the arming point (when the voltage rises above
a threshold that depends on the previous peak values) and is less
accurate as a reference point. Since a variable reluctance sensor
typically has two output signals, one can always ensure that the
positive-to-negative zero crossing point matches the desired tooth
indication by swapping the connections if necessary.
Falling
The interpretation of this field depends on the target ECU hardware
selected in the put_Identification block. For the M221 and M250
targets, “Falling” is the same as “Default”.
Rising
The interpretation of this field depends on the target ECU hardware
selected in the put_Identification block. For the M220 and M670
targets, “Rising” is the same as “Default”.
7.8.9.7. Notes
7.8.10.3. Description
Extended
Crank Wheel
Configuration
pan_ CrankWheelConfigExt
The pan_CrankWheelConfigExt block configures sync point detection, noise rejection and
stall detection parameters for decoding one or more crankshaft sensor inputs. A detailed
explanation of the parameters is given in Section 7.1.2.4, “Crank decoding”.
If this block is not present in an application model then the parameters default, as detailed in
each of the mask parameters. A pan_CrankWheelConfig block must be present in the model
for the other crankshaft related blocks to operate.
7.8.10.4. Inports
None.
7.8.10.5. Outports
None.
• Wheel
A drop down to identify the crankshaft wheel to configure. The selection of wheel is
dependent on the target ECU hardware selected in the put_Identification block.
• Skip teeth
Number of processed teeth edges to ignore during ECU initialisation, used to ignore
electrical noise during power up. Set to zero to calibrate out this decoding step.
The minimum time between processed teeth edges before the crank decode logic will
continue. Effectively sets the minimum speed before searching for crank synchronisation.
Set to zero to calibrate out this decoding step.
The ratio of the inter-tooth time immediately before the missing tooth region to the time
across the missing tooth region, below which the crank decode logic determines a missing
tooth region has been detected.
Range: [0, 1)
The ratio of the inter-tooth time immediately after the missing tooth region to the time across
the missing tooth region, below which the crank decode logic determines a missing tooth
region has been detected.
Range: [0, 1)
The ratio of the inter-tooth time that the crank decode logic will ignore processed crank
teeth edges, for the tooth immediately proceeding the missing tooth region. Set to zero to
remove noise-rejection functionality.
Range: [0, 1)
The ratio of the inter-tooth time proceeding the missing tooth region, added to the next
expected tooth edge, to calculate the crank stall timeout. If a processed tooth edge has
not been seen by the timeout, the crank decode logic will assume the wheel has stalled.
Range: [0, 4)
The ratio of the inter-tooth time that the crank decode logic will ignore processed crank
teeth edges, for the tooth immediately after the missing tooth region. Set to zero to remove
noise-rejection functionality.
Range: [0, 1)
The ratio of the inter-tooth time after missing tooth region, added to the next expected tooth
edge, to calculate the crank stall timeout. If a processed tooth edge has not been seen by
the timeout, the crank decode logic will assume the wheel has stalled. The inter-tooth time
is calculated using the missing tooth region time, divided as if there were no missing teeth.
Range: [0, 4)
The ratio of the inter-tooth time that the crank decode logic will ignore processed crank
teeth edges, for teeth not immediately before or after the missing tooth region. Set to zero
to remove noise-rejection functionality.
Range: [0, 1)
The ratio of the inter-tooth time added to the next expected tooth edge, to calculate the
crank stall timeout. If a processed tooth edge has not been seen by the timeout, the crank
decode logic will wait for a further tooth time (see Stall-detection ratio, timeout tooth) before
declaring crank stall.
Range: [0, 4)
If the crank decode logic declares crank stall for a normal tooth, the crank decode logic will
try waiting an additional period of time before declaring stall. The ratio is used as before.
Set to zero to remove noise-rejection functionality.
Range: [0, 1)
If the crank decode logic declares crank stall for a normal tooth, the crank decode logic will
try waiting an additional period of time before declaring stall. The ratio is used as before.
If this second timeout triggers then the crank decode logic declares the crank stalled.
Range: [0, 4)
7.8.10.7. Notes
None.
7.8.11.3. Description
Crank
Wheel state
Digital Input
pan_ CrankWheelDigitalInput
The pan_CrankWheelDigitalInput block provides the instantaneous digital voltage level (high
or low) seen at a crankshaft wheel input pin. Note that the target ECU circuitry may invert the
signal (see the ECU's Technical Specification for details about signal inversions).
7.8.11.4. Inports
• sim_state
Only used under simulation. Under simulation, the value of this inport is passed through
to outport state.
7.8.11.5. Outports
• state
Set to zero if the voltage level on the crankshaft wheel pin is low, set to one if the voltage
level on the crank pin is high. Note that the target ECU circuitry may invert the signal (see
the ECU's Technical Specification for details about signal inversions).
• Wheel
A drop down to identify the crankshaft wheel to measure. The selection of wheel must
match a pan_CrankWheelConfig block elsewhere in the model.
• Sample time
7.8.11.7. Notes
None.
7.8.12.3. Description
state
Crank
Decoding
State
error
pan_ CrankWheelDecodeState
3
Find
first tooth
edge
4
Find crank region synchronisation
Find
second tooth
edge
Tooth edge timed out
Detect
Ba
7, 8, 9, 10
Tooth edge timed out
Count
teeth
Confirm
sync pont
The pan_CrankWheelDecodeState block retrieves the last detected error when processing
the crank signal, indicating for example, that crank region synchronisation was lost due to a
timeout between teeth arrival times (stall) or that crank region synchronisation was lost due
to the wrong number of counted teeth between sync points.
7.8.12.4. Inports
• sim_state
The value of this inport is passed to the state output under simulation.
• sim_error
The value of this inport is passed to the error output under simulation.
7.8.12.5. Outports
• state
The current state whilst decoding the crankshaft sensor signal. See the description of
decoding states in Section 7.1.2.4, “Crank decoding”.
• error
A bitmap representing the last detected error whilst decoding the crankshaft sensor signal.
When this block is iterated, the bitmap is cleared to zero. The bitmap is the summation
of the values give in Table 7.2, “Crankshaft signal decoding error bitmap values”. For
instance, the error value 40 means the decoding state machine lost synchronisation with
the crank signal just before a sync point.
Value Description
0 No error detected whilst decoding.
1 An error internal to decoding state machine occurred. Please contact
OpenECU technical support if this error occurs.
2 An error internal to decoding state machine occurred. Please contact
OpenECU technical support if this error occurs.
4 An error internal to decoding state machine occurred. Please contact
OpenECU technical support if this error occurs.
8 The crankshaft has stalled (the time between consecutive teeth is
sufficiently low that the ECU cannot tell if the crankshaft is moving
or not). See Section 7.1.2.1, “Crank wheel movement and stall
detection” for a description of stall detection.
16 The crankshaft has stalled whilst waiting for a tooth not immediately
before, during, or immediately after the sync point.
32 The crankshaft has stalled whilst waiting for the tooth immediately
before the sync point.
64 The crankshaft has stalled whilst waiting for the tooth immediately
after the sync point.
128 The decoding state machine has lost region synchronisation
because of a tooth found in a missing teeth sync point. This error
condition can occur if the wrong sync point type has been selected
in the pan_CrankWheelConfig block or if the wrong number of
teeth have been provided by the pan_CrankWheelConfig or
pan_CrankWheelSyncPointNext block.
256 The decoding state machine has lost region synchronisation
because the extra tooth of a sync point was not found. This error
condition can occur if the wrong sync point type has been selected
in the pan_CrankWheelConfig block or if the wrong number of
teeth have been provided by the pan_CrankWheelConfig or
pan_CrankWheelSyncPointNext block.
512 The decoding state machine has lost region synchronisation
because the application requested loss of sync through the
pan_EngineDeclareSync block.
• Wheel
A drop down to identify the crankshaft wheel for speed measurement. The selection of
wheel must match a pan_CrankWheelConfig block elsewhere in the model.
• Sample time
7.8.12.7. Notes
None.
7.8.13.3. Description
Crank
Wheel movement
Movement
pan_ CrankWheelMovement
7.8.13.4. Inports
• sim_movement
Only used under simulation. Under simulation, the value of this inport is passed through
to outport movement.
7.8.13.5. Outports
• movement
Set to zero if the crankshaft wheel input appears to have stopped, and set to one if the
crankshaft wheel input appears to be moving.
• Wheel
A drop down to identify the crankshaft wheel to measure for movement. The selection of
wheel must match a pan_CrankWheelConfig block elsewhere in the model.
• Sample time
7.8.13.7. Notes
None.
7.8.14.3. Description
valid
Secondary
Crank
Phase
angle
pan_ CrankSecondaryPhase
The pan_CrankSecondaryPhase block provides the current phase angle of the specified
secondary crankshaft wheel relative to the primary crankshaft wheel that generates the angle
clock. The crankshaft encoder wheel pattern need not be the same for the primary and
secondary inputs.
The ECU continuously monitors the primary and secondary crankshaft wheel signals. The
ECU measures the phase on each tooth of a secondary crankshaft wheel, as the difference
between the angle clock of the primary crankshaft wheel and the angle of the secondary
crankshaft wheel tooth.
The phase angle is always a value between 0° and 360° and represents the secondary wheel
angle minus the primary wheel angle, so that if the secondary wheel is 10° in advance of
the primary, it will return a value of 10, and if the primary wheel is 10° in advance of the
secondary it will return a value of 350.
7.8.14.4. Inports
• sim_valid
Only used under simulation. Under simulation, the value of this inport is passed through
to the valid outport.
• sim_angle
Only used under simulation. Under simulation, the value of this inport is passed through
to the angle outport.
7.8.14.5. Outports
• valid
Set to zero when the ECU cannot provide a phase angle (for instance, if the ECU has not
synchronised with both the primary and the selected secondary crankshaft wheels), set to
one when the outport angle is valid.
• angle
The estimated phase angle of the specified secondary crankshaft wheel encoder relative
to the primary crankshaft wheel encoder.
• Wheel
A drop down to identify the crankshaft wheel for angle measurement. The selection of
wheel must match a pan_CrankWheelConfig block elsewhere in the model. There must
also be a pan_CrankWheelConfig block for the Primary crank wheel present in the model.
• Sample time
7.8.14.7. Notes
None.
7.8.15.3. Description
Crank
Wheel speed
Speed
pan_ CrankWheelSpeed
The pan_CrankWheelSpeed block provides the rotational speed of a crankshaft wheel. The
Type mask parameter selects the speed calculation output by the block.
7.8.15.4. Inports
• sim_speed
Only used under simulation. Under simulation, the value of this inport is passed through
to outport speed.
7.8.15.5. Outports
• speed
The measured speed of the crankshaft wheel encoder selected by parameter Wheel.
• Wheel
A drop down to identify the crankshaft wheel for speed measurement. The selection of
wheel must match a pan_CrankWheelConfig block elsewhere in the model.
• Type
A drop down to specify the speed calculation to perform. The selection of type is dependent
on the target ECU hardware selected in the put_Identification block.
Per tooth
The speed as calculated from the time between the last two crank
teeth. When calculating a speed across a missing tooth sync point,
the block adjusts the speed as if there were physical teeth present.
Extra sync point teeth are ignored.
• Sample time
Calibratable: No
7.8.15.7. Notes
None.
7.8.16.3. Description
Crank
Wheel sync
Sync
pan_ CrankWheelSync
The pan_CrankWheelSync block retrieves whether the ECU has synchronised to the
crankshaft wheel or not. The ECU continually monitors the crankshaft wheel input signal
looking for tooth edges. If the crankshaft signal decoding state machine has reached state
Count teeth or higher, then the ECU has synchronisation to the wheel. See Section 7.1.2.4,
“Crank decoding” for a description of the crank decoding state machine.
7.8.16.4. Inports
• sim_sync
Only used under simulation. Under simulation, the value of this inport is passed through
to outport sync.
7.8.16.5. Outports
• sync
Set to zero if the ECU does not have synchronisation with the crankshaft wheel, set to one
if the ECU has synchronisation.
• Wheel
A drop down to identify the crankshaft wheel for synchronisation information. The selection
of wheel must match a pan_CrankWheelConfig block elsewhere in the model.
• Sample time
7.8.16.7. Notes
None.
7.8.17.3. Description
teeth
Crank before
Sync Point
Last sync_ point
after
pan_ CrankWheelSyncPointLast
Note that for crankshaft wheels that have one sync point, the ECU will maintain
synchronisation to the crank wheel using the decoding state machine without the need for the
application to use the pan_CrankWheelSyncPointTrigger, pan_CrankWheelSyncPointLast
and pan_CrankWheelSyncPointNext blocks.
7.8.17.4. Inports
• sim_teeth
Only used under simulation. Under simulation, the value of this inport is passed through
to the teeth outport.
• sim_before
Only used under simulation. Under simulation, the value of this inport is passed through
to the before outport.
• sim_sync_point
Only used under simulation. Under simulation, the value of this inport is passed through
to the sync_point outport.
• sim_after
Only used under simulation. Under simulation, the value of this inport is passed through
to the after outport.
7.8.17.5. Outports
• teeth
Range: [3, n] where n is the number of physical crank teeth as specified in the
corresponding pan_CrankWheelConfig block.
• before
• sync_point
• after
• Wheel
A drop down to identify the crankshaft wheel for speed measurement. The selection of
wheel must match a pan_CrankWheelConfig block elsewhere in the model.
• Sample time
7.8.17.7. Notes
None.
7.8.18.3. Description
teeth _to_ sync
Crank
Sync Point
Next
teeth _in _ sync
pan_ CrankWheelSyncPointNext
The pan_CrankWheelSyncPointNext block provides information about the next crank region
to the ECU. This includes the number of expected teeth for that region (ignoring any extra
teeth), and the number of teeth that represent the sync point. A description of what constitutes
a crank region can be found in Section 7.1.2.2, “Crank wheel sync points”.
Note that for crankshaft wheels that have one sync point, the ECU will maintain
synchronisation to the crank wheel using the decoding state machine without the need for the
application to use the pan_CrankWheelSyncPointTrigger, pan_CrankWheelSyncPointlast
and pan_CrankWheelSyncPointNext blocks.
7.8.18.4. Inports
• teeth_to_sync
Range: [3, n]
where n is the number of physical crank teeth as specified in the corresponding
pan_CrankWheelConfig block.
• teeth_in_sync
The number of teeth involved in the sync point at the end of the next crank region. Negative
integers indicate missing teeth, positive integers represent extra teeth.
7.8.18.5. Outports
None.
• Wheel
A drop down to identify the crankshaft wheel for speed measurement. The selection of
wheel must match a pan_CrankWheelConfig block elsewhere in the model.
• Sample time
7.8.18.7. Notes
None.
7.8.19.3. Description
Crank
Sync Point trigger
Trigger
pan_ CrankWheelSyncPointTrigger
Note that for crankshaft wheels that have one sync point, the ECU will maintain
synchronisation to the crank wheel using the decoding state machine without the need for the
application to use the pan_CrankWheelSyncPointTrigger, pan_CrankWheelSyncPointLast
and pan_CrankWheelSyncPointNext blocks.
7.8.19.4. Inports
None.
7.8.19.5. Outports
• trigger
An asynchronous function-call output that triggers on the second tooth of a crank region
following the successful decoding of a crankshaft sync point for the previously crank region.
• Wheel
A drop down to identify the crankshaft wheel for which a trigger will be generated. The
selection of wheel must match a pan_CrankWheelConfig block elsewhere in the model.
Calibratable: No
7.8.19.7. Notes
None.
7.8.20.3. Description
valid
Current
Crank
Tooth
tooth
pan_ CurrentCrankTooth
The pan_CurrentCrankTooth block retrieves the current tooth identifier of the crankshaft
wheel. See Section 7.1.5, “Crank tooth identification” for a description of crank tooth
identifiers.
7.8.20.4. Inports
• sim_valid
Only used under simulation. Under simulation, the value of this inport is passed through
to the valid outport.
• sim_tooth
Only used under simulation. Under simulation, the value of this inport is passed through
to the tooth outport.
7.8.20.5. Outports
• valid
Set to zero when the ECU cannot provide a crank tooth (for instance, the ECU has not
synchronised to the crankshaft wheel encoder), set to one when the outport tooth is valid.
• tooth
The identifying number of the last detected tooth of the crankshaft wheel encoder. The
reported identifier is adjusted by the tooth offset supplied to the pan_EngineDeclareSync
block.
• Wheel
A drop down to identify the crankshaft wheel for tooth measurement. The selection of wheel
must match a pan_CrankWheelConfig block elsewhere in the model.
• Sample time
7.8.20.7. Notes
None.
7.8.21.3. Description
pan_ AngularOutputConfig
The pan_AngularOutputConfig block configures the digital output in one of two modes: Angle-
Angle and Angle-Time. Both allow an action to occur at a specific angle (either relative to
crank zero degrees or relative to TDC-firing for a given cylinder). A second action then occurs
after a specified duration. For Angle-Angle mode, the duration is an angle, whereas for Angle-
Time mode the duration is a time. The output mode is a fixed feature of the output specified
in the configuration block.
The pan_AngularOutputConfig block configures the default output state when neither half or
full engine synchronisation is active (see Section 7.1.9, “Engine synchronisation modes” for
details), or when the ECU first powers on.
7.8.21.4. Inports
None.
7.8.21.5. Outports
None.
• Channel
• Mode
• Stall Action
Specifies the pin state to be output when the engine stalls, i.e. when neither half or full
engine synchronisation is active. This also determines the pin state to be output when the
ECU is first powered on.
7.8.21.7. Notes
None.
7.8.22.3. Description
cylinder
immediate _ action
start_ action
end_ action
duration
The pan_AngularOutput block allows an application to control an output in the angular domain
in a fairly generic way by specifying start and end actions on a digital output pin state. The
start actions are always specified to occur at a start angle, while the end actions are specified
to occur at some duration after the start angle. The duration can be either an angle or a time
depending on the output mode selected. Note that the output mode is a fixed property of
the output that is specified by the corresponding pan_AngularOutputConfig block. Possible
actions are setting the pin-state to active or inactive, toggling the state or leaving the state
unchanged.
In addition to controlling the output in the angular domain, the block allows an immediate
action to be specified. This allows a relatively crude level of purely time-based control to
occur at the resolution of the block task time. An example application might be to control an
output using this immediate action before crank synchronisation, and then use the angular
control once crank sync had been attained.
crank angle
0° 360° 720°
duration = X ms
Block is called
immediate_action = ‘turn-off’
crank angle
0° 360° 720°
duration = X ms
Block is called
immediate_action = ‘turn-off’
don’t care
Output pin state
crank angle
0° 360° 720°
Duration = Y degrees
Block is called
immediate_action = ‘turn-on’
don’t care
Output pin state
crank angle
0° 360° 720°
duration = Y degrees
Block is called
immediate_action = ‘turn-on’
Multiple instances of the pan_AngularOutput block associated with a given channel are
allowed, to allow the output to be controlled more easily both in the angular and time domain.
However a single instance of the pan_AngularOutputConfig block must exist for each channel
used.
Note
Care must be taken when using multiple instances of the pan_AngularOutput block on
the same channel, since they will potentially be in competition.
The start angle is interpreted either relative to crank-zero, or relative to the TDC-firing angle
of a specified cylinder number. The specified start event will then occur at the next such
start angle to occur. For a two-stroke engine (as specified by the pan_EngineConfig block),
the start angle is interpreted modulo 360 degrees. For a four-stroke engine, the start angle
is interpreted modulo 360 degrees in half engine synchronisation mode, and modulo 720
degrees in full engine synchronisation mode.
When the ECU is in neither half or full engine synchronisation mode, the output can
be scheduled but will not be driven as the engine position will be unknown. If engine
synchronisation is lost, then the output pin state is set to the value specified in the Stall action)
mask parameter of the corresponding pan_AngularOutputConfig block. This also determines
the initial output state before the current block has ever run.
Each index in the mux of values is treated as a separate event. If the block iterates while an
event is underway and the data for the current event in the mux of values is modified, then
the behaviour is determined by the allow_end_modification inport value. If this is zero, then
the data will be buffered and take effect on the next instance of that event. On the other hand,
if the allow_end_modification inport value is one, then the end of the event will be updated
according to the newly provided duration and end_action values (and the start_action and
start_angle values are ignored). If the newly provided duration has already elapsed, then the
end_action is applied immediately. (Note that in this case it will be applied immediately after
any immediate_action that has been specified.)
Figure 7.5. Output data updated during an event, end modification allowed
Block is called again with
allow_end_modification TRUE
start_angle &
start_action = ‘turn-on’
Angle duration is
modified for the current
Output pin state pulse
crank angle
0° 720° 1440°
Initial duration,
end_action = ‘turn-off’
Block is called
Figure 7.6. Output data updated during an event, end modification not allowed
crank angle
0° 720° 1440°
angle_duration
& end_action = ‘turn-off’
Block is called
If the duration for an event is zero, then that event will be skipped for the schedule of events. If
the duration for all events in the schedule are set to zero, then at the start_angle of the event
in the first index of the schedule, a single action will be performed corresponding to the result
of applying the start_action followed by the end_action. For example, if both actions specify
that the output pin state should be toggled, then no change to the pin state will occur. If an
update occurs when an event is underway with duration of zero and allow_end_modification
set to one, then the newly specified end_action is applied immediately.
The possible values for the inports immediate_action, start_action, and end_action are:
Value Description
0 Turn-off - the output pin will be modified to the non-driven state.
1 Turn-on - the output pin will be modified to the driven state.
2 Toggle - the output pin will be toggled.
3 No-action - the output pin will not change driven state.
If two events in a schedule overlap, the first pulse will be terminated at the start angle of
the next pulse with a single action corresponding to the result of applying the end_action of
the first event followed by the start_action of the next event. The schedule will then continue
normally with the duration of the next event, resulting in the correct timing of the next event
from that event's start_angle.
1st event
2nd event
crank angle
0° 720° 1440°
1st and 2nd events combined
Block is called
If an event start_action occurs within the min_off_time after the end_action of a previous
event, the second event will be delayed to ensure the min_off_time is maintained between
the two events. The min_off_time can be set to zero to prevent the subsequent pulse from
being delayed.
1st event
2nd event
crank angle
0° 720° 1440°
7.8.22.4. Inports
• cylinder
This determines how the start_angle is to be interpreted. If zero is passed, then the
start_angle inport is interpreted relative to crank zero degrees. If a number between 1
and the number of cylinders is passed, then the start_angle is interpreted relative to that
cylinder's TDC-firing angle.
Range: 0 or [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
• immediate_action
The action to apply immediately (i.e. when the block iterates) to the output state, as
specified by Table 7.3, “Angular digital output pin actions”.
• start_action
A vector of actions to apply to the output state at the angle specified by start_angle, as
specified by Table 7.3, “Angular digital output pin actions”. This vector may contain up to
six elements and must be the same width and have the same ordering as the end_action,
start_angle, and duration vectors.
• end_action
A vector of actions to apply to the output state after the specified duration has elapsed
since the start_angle, as specified by Table 7.3, “Angular digital output pin actions”. This
vector may contain up to six elements and must be the same width and have the same
ordering as the start_action, start_angle, and duration vectors.
• start_angle
A vector of requested start angles for the beginning of the output event. The interpretation
of this angle is determined by the value passed to the cylinder inport. The value of the
angle is folded to the range modulo 360° or 720° as appropriate as explained above. This
vector may contain up to six elements and must be the same width and have the same
ordering as the start_action, end_action, and duration vectors.
• duration
A vector of either angles or times depending on the Mode specified in the instance of
the pan_AngularOutputConfig block that exists for this channel. When the Mode is Angle-
Angle, then the durations are angles in degrees; if it is Angle-Time then the durations
are times in milliseconds. The duration specifies when after the start_angle to apply the
pin action specified by the end_action. This vector may contain up to six elements and
must be the same width and have the same ordering as the start_action, end_action, and
start_angle vectors.
• allow_end_modification
A flag that applies only when an event is currently underway. Set to one to update the
duration and end_action information immediately. Set to zero to buffer the data to be used
on the next instance of the event.
• allow_cycle_repeat
Set to one to repeat the schedule of events, set to zero to schedule events once only.
• min_off_time
The minimum time between events, delaying the start of subsequent events if necessary.
7.8.22.5. Outports
None.
• Channel
7.8.22.7. Notes
None.
7.8.23.3. Description
valid
Current
Engine
Angle
angle
pan_ CurrentEngineAngle
The pan_CurrentEngineAngle block retrieves the current angle of the crankshaft wheel
encoder, relative to crank zero degrees (see Section 7.1.3, “Crankshaft zero degrees”). The
retrieved value is taken from the angle clock, which is an estimate of crank decoding and
position identification process (Section 7.1.4, “Angle clock”).
7.8.23.4. Inports
• sim_valid
Only used under simulation. Under simulation, the value of this inport is passed through
to the valid outport.
• sim_angle
Only used under simulation. Under simulation, the value of this inport is passed through
to the angle outport.
7.8.23.5. Outports
• valid
Set to zero when the software cannot provide an engine angle (for instance, the ECU has
not synchronised to the crankshaft wheel), set to one when the outport angle is valid.
• angle
The estimated angle of the engine taken from the angle clock.
• Sample time
7.8.23.7. Notes
None.
7.8.24.3. Description
Engine type : Diesel
Engine cycle type : 2- stroke
Number cylinders : 0
TDC angles : [ ]
Angular task calc angle :
pan_ EngineConfig
The pan_EngineConfig block specifies the engine cycle type (two-stroke or four-stroke), the
TDC-firing angles for each cylinder and the relative angle to TDC-firing at which to trigger the
TDC-calculation event. See Section 7.2.2, “Cylinder TDC-firing angles” for details on how the
TDC-firing angle is derived from crank zero degrees, and see Section 7.2.3, “Cylinder TDC-
calculation application events” for details on the TDC-calculation event.
When using this method, ensure the configuration set option Angular rate functionality
(deprecated) is unticked (see the next method and also Section 4.3.4, “Configuration
options”).
• By adjusting the quickest periodic application rate to run each time a TDC-calculation
event occurs. This is an older method and has some incompatibilities with Simulink, both
in simulation and on target. In particular, Simulink's task timing is not always correct when
running on target.
Warning
This method is deprecated and should not be used. Support cannot be provided
for the incompatibilities that this method causes. Use the asynchronous function-call
trigger method instead.
As an example, take a symmetrical four stroke four cylinder engine with a 12-1 patterned
crankshaft trigger wheel.
Direction of
rotation
6°
49
67
6°
586°
TDC-calc
Cyl-4
= -90°
406°
Cyl-2
0°
12-1
2 revolutions
Cyl-1
46°
Cyl-3
226°
6°
31
13
6°
Relative to crank zero degrees, the TDC-firing angles for the cylinders in firing order are 46°
(cylinder 1), 226° (cylinder 3), 406%deg; (cylinder 2) and 586° (cylinder 4). The application will
perform some calculations for each cylinder and 90° prior to TDC-firing is deemed sufficient
time to perform those calculations at the highest engine speed plus some margin. Then the
parameters to the pan_EngineConfig block would be:
In response, the trigger outport, representing the TDC-calculation events described in more
detail in Section 7.2.3, “Cylinder TDC-calculation application events”, is activated by the ECU
at 676° (cylinder 1), 136° (cylinder 3), 316° (cylinder 2) and 496° (cylinder 4).
7.8.24.4. Inports
None.
7.8.24.5. Outports
• trigger
An asynchronous function-call output that triggers an event TDC calculation angle degrees
before or after a cylinder's TDC-firing angle.
• Engine type
Specifies the expected type of engine to configure the application. The selection of engine
type is dependent on the target ECU hardware selected in the put_Identification block.
Note that this mask parameter is no longer actively used by the ECU and will be removed
in a future version of OpenECU.
Note
If more than 8 cylinders are configured, the engine type must be set to Diesel and
the spark functions will not be available.
Diesel
Configure application for a direct injection type engine (see
Section 7.5.2, “Direct injection”).
Specifies a vector of values defining the angle of each cylinder's TDC-firing event relative
to crank zero degrees.
The vector is specified in cylinder order (and hence the firing order can be derived). The
TDC-firing angles must be separated by spaces and enclosed within square brackets, e.g.
[90 630 270 450]. The number of entries in the field specifies the number of cylinders.
Specifies the angle in degrees relative to TDC-firing when the TDC-calculation trigger for
each cylinder is activated (a positive value denotes an angle after TDC-firing, a negative
value before TDC-firing). The parameter is a single value and applies to all cylinders.
7.8.24.7. Notes
None.
7.8.25.3. Description
valid
Current
Cylinder
cylinder
pan_ CurrentCylinder
The pan_CurrentCylinder block retrieves the current cylinder identifier of the engine from
the ECU. The cylinder identifier is updated whenever a new TDC-calculation angle is
reached. See Section 7.2, “Engine TDC-firing events” for a definition of TDC-calculation. The
application specifies the TDC-calculation angle using a pan_EngineConfig block.
7.8.25.4. Inports
• sim_valid
Only used under simulation. Under simulation, the value of this inport is passed through
to the valid outport.
• sim_cylinder
Only used under simulation. Under simulation, the value of this inport is passed through
to the cylinder outport.
7.8.25.5. Outports
• valid
Set to zero when the ECU cannot provide an engine cylinder (for instance, the ECU has
not synchronised to the crankshaft wheel encoder), set to one when the outport cylinder
is valid.
• cylinder
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
• Sample time
7.8.25.7. Notes
None.
7.8.26.3. Description
tooth
Engine
Speed speed
num _ teeth
pan_ EngineSpeed
The pan_EngineSpeed block provides the rotational speed of the engine, derived from the
primary crankshaft wheel. The ECU continually records the time of arrival for each primary
crankshaft wheel tooth. The block uses these timestamps to calculate engine speed. The
Type mask parameter selects the speed calculation output by the block.
7.8.26.4. Inports
• sim_speed
Only used under simulation. Under simulation, the value of this inport is passed through
to outport speed.
• cylinder
The cylinder to return the processed tooth rangespeed calculation. Only used when Type
is set to Tooth range (relative).
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
• tooth
The engine tooth identifier used in combination with the num_teeth inport to calculate
engine speed, based on the mask parameter Type.
• num_teeth
Used in combination with the tooth inport to calculate engine speed. The number of crank
teeth after inport tooth to be included as part of the engine speed calculation. The engine
speed calculation is based on the time difference between the detection of these teeth. If
the given tooth is out of range, the tooth value will be clipped to the range before engine
speed is calculated.
7.8.26.5. Outports
• speed
• Type
A drop down to specify the speed calculation to perform. The selection of type is dependent
on the target ECU hardware selected in the put_Identification block.
Per cylinder
The speed as measured between two adjacent cylinder TDC-
calculation events.
If the ECU has recorded one crank revolution but not yet two, then
the speed is averaged over one revolution. This allows the application
to retrieve a per-engine-revolution value as quickly as possible but
without having to know how many crankshaft revolutions have so far
occurred.
Per tooth
The speed as measured from the time between the last two primary
crankshaft wheel teeth. When calculating a speed across a crankshaft
sync point, the block adjusts the speed as if there were physical teeth
For crankshaft wheels with missing teeth sync points, the time that
the missing teeth would have occurred is not estimated and is treated
the same as the last physical tooth prior to the missing region sync
point. If requesting the engine speed based on missing teeth only, the
block outputs zero.
For crankshaft wheels with extra teeth sync points, the time of any
extra teeth is not recorded and is treated the same as the last physical
tooth prior to the extra tooth sync point. If requesting the engine speed
based on extra teeth only, the block outputs zero.
For crankshaft wheels with missing teeth sync points, the time that
the missing teeth would have occurred is not estimated and is treated
the same as the last physical tooth prior to the missing region sync
point. If requesting the engine speed based on missing teeth only, the
block outputs zero.
For crankshaft wheels with extra teeth sync points, the time of any
extra teeth is not recorded and is treated the same as the last physical
tooth prior to the extra tooth sync point. If requesting the engine speed
based on extra teeth only, the block outputs zero.
• Sample time
7.8.26.7. Notes
None.
7.8.27.3. Description
sync
Engine
angle _ offset
Sync
tooth _ offset
pan_ EngineSync
The pan_EngineSync block retrieves the current engine synchronisation mode. The engine
synchronisation mode can be changed by the application using the pan_EngineDeclareSync
block. A detailed description of the engine synchronisation modes can be found in
Section 7.1.9, “Engine synchronisation modes”. For reference, the decoding state values are:
0
No crank
synchronisation
Crank
region sync Sync point found
2 1
Half Full
engine sync engine sync
Sync point found
7.8.27.4. Inports
• sim_sync
Only used under simulation. Under simulation, the value of this inport is passed through
to outport sync.
7.8.27.5. Outports
• sync
The current engine synchronisation mode. See the description of modes in Section 7.1.9,
“Engine synchronisation modes”.
• Sample time
7.8.27.7. Notes
None.
7.8.28.3. Description
sync
Declare
angle _ offset
Sync
tooth _ offset
pan_ EngineDeclareSync
In short, the ECU will track the crankshaft wheel to achieve crank region synchronisation.
The application must then determine the overall engine position, using crank, cam or other
indicators, and move to either half or full engine synchronisation (it is not possible for the
application to select crank region synchronisation). At any point, the application can force loss
of engine synchronisation to deactivate output drivers using the pan_EngineLoseSync block.
Each of the engine synchronisation modes enables different sets of angular functionality.
When a function is disabled, input processing ceases and output drivers are turned off.
7.8.28.4. Inports
• sync
Set to one of no change (0), full sync (1) or half sync (2) modes. Changing to crank region
sync is not supported
If the value of the sync inport matches no change, then ECU makes no change to the
current synchronisation process.
If the value of the sync inport matches the current engine synchronisation mode as either
half or full, then the ECU ignores the request to change mode.
• angle_offset
The offset to add to crank zero degrees first assigned when crank region synchronisation
was found. For example, if the application requests 180 degrees offset after crank
synchronisation is found, then the overall engine angle offset is 180 degrees.
Subsequently, if the application requests 360 degrees offset, then the overall engine angle
offset is 360 degrees (not 180 + 360 degrees).
When loss of engine synchronisation is detected, the ECU clears the engine angle offset
to zero.
• tooth_offset
The offset to add to the engine tooth identifier one, first assigned when crank region
synchronisation was found. Like the angle_offset inport, the value is an absolute offset,
not an additive offset. Rather than the ECU determine the closest engine tooth to the
angle_offset, the application can choose the closest. The ECU expects the tooth offset to
match the angle offset and will not operate as expected if the application supplied tooth
offset is more than ± 1 tooth from the actual tooth offset.
When loss of engine synchronisation is detected, the ECU clears the engine tooth offset
to zero.
7.8.28.5. Outports
None.
7.8.28.7. Notes
None.
7.8.29.3. Description
Lose
lose_ sync
Sync
pan_ EngineLoseSync
The pan_EngineLoseSync block instructs the ECU to lose engine synchronisation. The
process is described in Section 7.1.9, “Engine synchronisation modes”. Changing the
lose_sync inport from zero to one results in the ECU reverting to the No crank synchronisation
mode for the primary crankshaft trigger wheel input, disabling most angular functionality.
When a function is disabled, input processing ceases and output drivers are turned off.
7.8.29.4. Inports
• lose_sync
When the value of the inport changes from zero to one, the ECU loses engine
synchronisation, and the engine angle offset and tooth offset are cleared to zero.
7.8.29.5. Outports
None.
7.8.29.7. Notes
None.
7.8.30.3. Description
valid
Current
Engine
Tooth
tooth
pan_ CurrentEngineTooth
The pan_CurrentEngineTooth block retrieves the current engine tooth identifier of the primary
crankshaft wheel. See Section 7.2.5, “Engine tooth identification” for a description of engine
tooth identifiers. Engine tooth identifiers are used when the pan_EngineSpeed block in Tooth
range (absolute) and Tooth range (relative) mode.
7.8.30.4. Inports
• sim_valid
Only used under simulation. Under simulation, the value of this inport is passed through
to the valid outport.
• sim_tooth
Only used under simulation. Under simulation, the value of this inport is passed through
to the tooth outport.
7.8.30.5. Outports
• valid
Set to zero when the ECU cannot provide an engine tooth identifier (for instance, the ECU
has not synchronised to the crankshaft wheel encoder), set to one when the outport tooth
is valid.
• tooth
The identifying number of the last detected engine tooth of the primary crankshaft
wheel encoder. The reported identifier is adjusted by the tooth offset supplied to the
pan_EngineDeclareSync block.
• Sample time
7.8.30.7. Notes
None.
7.8.31.3. Description
Injector drive :
Saturating
pan_ InjectorConfig
The pan_InjectorConfig block configures the injector output pins to use for each injection
channel, and the injection drive method as outlined in Section 7.5, “Scheduling injector
outputs”. The block assigns one injector channel to each cylinder defined by the
pan_EngineConfig block. To assign more than one injector channel to a cylinder,
see the pan_SingleInjectorConfig block. The application can drive injectors using the
pan_Injection_DI and pan_Injection_PI blocks.
Note
For the M250 target, when the Injector Drive parameter is set to Saturating, the
pcfg_Config_M250 block must set any injector channels from the Cylinder n injector
channel parameter to be PWM.
7.8.31.4. Inports
None.
7.8.31.5. Outports
None.
• Injector drive
Over time, this mask parameter has become obsolete. As such, this parameter will be
removed in a future version of OpenECU. For the moment, always select saturating.
7.8.31.7. Notes
None.
7.8.32.3. Description
Single
Injector
Drive
pan_ SingleInjectorConfig
The pan_SingleInjectorConfig block configures one injector output pin. The injector is
identified by a number. The injector identifier is used by the application with the
pan_Injection_DI and pan_Injection_PI blocks. With the injector output pin, the block
associates a drive type (peak/hold or saturating), an injector pulse type (single pulse or
multiple pulse), the output pin that the injector is associated with, and the cylinder identifier
the injector is associated with.
The list of available options depends on the choice of target. The number of the cylinder
matches its position in the array of TDC-firing angles defined in the pan_EngineConfig block.
Number 1 corresponds to the first cylinder in this array, 2 to the second, and so on.
Note
For the M250 target, when the Injector drive type parameter is set to Saturating then
the pcfg_Config_M250 block must set the corresponding injector channel to PWM.
7.8.32.4. Inports
None.
7.8.32.5. Outports
None.
• Injector identifier
• Injector channel
A drop-down selection of channels available for use as injector outputs on the selected
target ECU.
Over time, this mask parameter has become obsolete. As such, this parameter will be
removed in a future version of OpenECU. For the moment, always select saturating.
A drop-down selection of injector pulse types available for the selected target ECU, i.e.
single pulse or multiple pulse.
• Injector cylinder
Range: [1, n]
7.8.32.7. Notes
None.
7.8.33.3. Description
The pan_InjectorConfig_DI block specifies constraints that are applied to the direct injection
scheduling. See Section 7.5.2, “Direct injection” for an overview of direct injection and the
mask parameters for this block for specific details.
7.8.33.4. Inports
None.
7.8.33.5. Outports
None.
The minimum duration of any injection pulse. Set to zero if a minimum pulse duration is not
required. If a requested pulse duration is greater than zero but smaller than this minimum
time, the ECU will generate a pulse equal to this minimum time.
The exception to the minimum injection duration is when the injection pulse is cut short
due to the Drop dead angle.
The minimum time between pulses for a single injector, applied to all injectors. This
parameter ensures a minimum time between pulses for an injector and will override the
starting angle of a subsequent pulse if necessary.
Note
Contact Pi Innovo if application requires injector pulse separation outside of the
range above.
The drop dead angle applied to all cylinders, relative to the cylinder's TDC-firing angle
(positive angles after TDC-firing). The ECU will stop injections at this point on a given
cylinder. That is, it will terminate any pulse in progress (regardless of the Minimum injection
duration and not schedule any subsequent pulses until the next cylinder cycle.
7.8.33.7. Notes
None.
7.8.34.3. Description
Channel : AIN ( pin A3)
FRP TF - Volts: [ ]
FRP TF - Pressure: [ ]
FRP TF max volts:
Injector CM - Fuel volume :
Injector CM - FRP:
Injector CM - Injection duration :
The pan_InjectorCompConfig_DI block configures the fuel rail pressure (FRP) analogue input
used to convert injection volume requests into units of time. As described in Section 7.5.2,
“Direct injection” just prior to each direct injection pulse is made, the fuel rail pressure
analogue input is sampled. Any volume request is converted to a duration using a 2D lookup
map. This technique compensates for rapid variation in the fuel rail pressure that may occur
after the injection schedule is requested by the application.
7.8.34.4. Inports
None.
7.8.34.5. Outports
None.
• Channel
A drop-down selection of analogue input channels to use as the fuel rail pressure input.
This is the X-axis of the transfer function that converts the fuel rail pressure sensor voltage
into engineering units of MegaPascals (MPa). The voltages contained within this axis
should range between zero and the voltage specified with the Fuel rail pressure maximum
voltage parameter.
Size: [2, 10] elements, for M220, M221 and M250 targets
Size: [2, 15] elements, for M670 targets
Range: [0, Fuel rail pressure maximum voltage] volts
This is the Z-data of the transfer function that converts the fuel rail pressure sensor voltage
into engineering units of MegaPascals (MPa).
Size: 1 by [2, 10] elements, for M220, M221 and M250 targets
Size: 1 by [2, 15] elements, for M670 targets
Range: [0, 500] MPa
This is the maximum voltage that can be read by the chosen analogue input Channel
before the input saturates, e.g., will be 5.0 on a 0-5v input. This allows the ECU to convert
a raw number of A/D converter counts into a voltage.
Size: [2, 10] elements, for M220, M221 and M250 targets
Size: [2, 15] elements, for M670 targets
3
Range: [0, 512] mm
Size: [2, 10] elements, for M220, M221 and M250 targets
Size: [2, 15] elements, for M670 targets
Range: [0, 500] MPa
This is the data of the injection duration map (Z-data default), the actual injection durations.
Size: [2, 10] by [2, 10] elements, for M220, M221 and M250 targets
Size: [2, 15] by [2, 15] elements, for M670 targets
Range: [0, 1000] milliseconds
Resolution: (floor(max_duration/16.38375ms)+1)*0.2500us for M220, M221 and M250
targets
Resolution: (floor(max_duration/15.88727ms)+1)*0.2424us for M670 target
7.8.34.7. Notes
None.
7.8.35.3. Description
override
Injection
Override FRP
frp
The pan_InjectionOverrideFrp_DI block is used to override the fuel rail pressure input used
for direct injection with an arbitrary value (for instance, when the application detects that the
fuel rail pressure sensor has failed). When overridden, the ECU will use this value in the
injection duration calculations. See Section 7.5.2, “Direct injection” for an overview of direct
injection. The application uses the pan_InjectorCompConfig_DI block to select the desired
fuel rail pressure input channel and volume to duration conversion table.
7.8.35.4. Inports
• override
Set to one to override the fuel rail pressure override, zero otherwise.
• frp
The value to override the fuel rail pressure value with, when inport override is set to one.
7.8.35.5. Outports
None.
7.8.35.7. Notes
None.
7.8.36.3. Description
injector _id
on_ angle
amount Injection
duration _ offset
duration _ mode
The pan_Injection_DI block updates the direct injection schedule for an injector channel.
See the Section 7.5.2, “Direct injection” for an overview of direct injection. In short, the ECU
monitors the angle clock and starts injection pulses based on the schedule on_angles. The
schedule of pulses can be specified in units of volume or time at run-time, based on the
duration_mode inport.
If duration_mode is set to volume mode, the ECU converts a requested volume of fuel from
the amount inport into a pulse duration. The ECU samples fuel rail pressure shortly before
the injection on angle and uses a map lookup to derive the required injection duration. This is
to compensate for very rapid fluctuations in fuel rail pressure that cannot be compensated for
in the higher-level strategy, as the correction must be made as late as near to the injection
start as possible.
The desired analogue input for fuel rail pressure and related map data and axes are
configured with the pan_InjectorCompConfig_DI block.
If duration_mode is set to time mode, the ECU uses the amount inport directly for pulse
duration. The ECU will not compensate for fuel rail pressure in this mode.
The injection schedule update takes effect depending on whether the schedule has been
started for this cycle or not:
• If the application has not previously requested an injection schedule for this injector
channel, then the update is applied immediately and the first pulse scheduled. If the angle
clock has passed the first pulse's on angle for this cylinder cycle, then the first pulse will
be postponed until the next cylinder cycle.
• Otherwise, if the first injection pulse from the schedule prior to this update has not yet been
generated for this cylinder cycle, then the update is applied immediately and the first pulse
rescheduled. If first pulse is in the past compared to the current angle clock, then the first
pulse will be postponed until the next cylinder cycle.
• Otherwise, if the first injection pulse from the schedule prior to this update has been
generated, then the request is buffered and applied at the start of the next cylinder cycle.
• Otherwise, if the application makes no further requests to update the injection schedule,
then the ECU will repeat the schedule at most 4 times. Once the repeats are completed, the
ECU clears the schedule and no further injection pulses are generated until the application
requests a new injection schedule.
The ECU supports the generation of up to six injection pulses per cylinder cycle. The on
angles are relative to the each cylinder's TDC-firing angle (positive angles after TDC-firing).
start of
injection event
(panf_rel_on_angle)
Multiple pulses
(panf_pulses = 4)
injection event
crank angle
0° 90°
Injection pulses are performed on each cylinder according to the requested pulse schedule. If
two pulses overlap, the latter pulse will be delayed. (Note that its duration will not be modified.)
If this delay then means that the next two pulses overlap, then the next pulse will be delayed
too, and so on for the remaining pulses. In effect, the pulses will be shuffled along in time.
The pan_InjectorConfig_DI block is used to define constraints that apply to all injections.
Actual Injection
Requested Injection Requested Injection Event Requested Injection
Event Actual Injection Event Event
Event Actual Injection
Event
injection event
crank angle
0° 90°
Minimum inter-injection
Minimum pulse duration
delay
(panf_min_inj_time)
(panf_min_off_time)
TDC firing Drop Dead Angle
for Cylinder n (panf_drop_dead_angle)
• A minimum inter-injection delay applied to the durations between all pulses can be defined.
• The drop-dead angle for each cylinder is an angle relative to TDC-firing and acts as a final
injection cut-off point for a cylinder. That is, any injection in progress at this angle will be
terminated and any subsequent injections for that cylinder cycle will not be scheduled.
The drop-dead angle can be set through the pan_InjectorConfig_DI block and remain
fixed during application run-time. Or the application can tick this block's Allow updates to
drop dead angle for this injector? mask parameter and adjust the drop dead angle during
application run-time using the inport dd_angle.
The direct injection functionality is active in full engine synchronisation mode only (see
Section 7.1.9, “Engine synchronisation modes” for a description of modes). In any other
mode, the ECU forces all injectors off. When the ECU detects loss of engine synchronisation,
the injection schedule is cleared and the application must request a new schedule for
injections to occur once full engine synchronisation is gained.
7.8.36.4. Inports
• injector_id
The injector identifier number. When the injection was configured using the
pan_InjectorConfig block then the injection identifier is the same as the cylinder identifier
from that block. When the injection was configured using the pan_SingleInjectorConfig
block then the injector identifier is taken from that block.
Range: [1, n]
where n represents the number of supported injector outputs by the selected ECU.
• on_angle
A vector of angles, relative to TDC-firing (positive angles after TDC-firing). Each angle
represents the start of an injection pulse. This vector may contain up to six elements and
must be the same width as the amount vector. Due to the potential of cyclic wrap-around
in the application layer, monotonicity of the vector is not enforced in the platform layer. The
platform layer will attempt to schedule all on-angles after the first on-angle in the same
cycle by taking the cycle modulus of the relative difference and adding that to the first angle.
For correct operation the schedule must have one or two sequences of strictly increasing
angles (no repeated values). For example, [0, 90, 180, 270, 360, 450, 540, 630] and [270,
360, 450, 540, 630, 0, 90, 180] are acceptable.
If the drop-dead angle specified by the pan_InjectorConfig_DI block is earlier than the first
pulse, the drop-dead angle will be adjusted in cycle increments to be after the first pulse.
Any subsequent pulses which occur after that conditioned drop-dead angle will result in
no corresponding injection pulse.
• amount
A vector of pulse volumes or pulse durations depending on the duration_mode inport. This
vector may contain up to six elements and must be the same size and ordering as the
on_angle inport vector.
3
Range: [0, 512) mm if duration_mode is set to volume
Range: [0, 1000] milliseconds if duration_mode is set to time
Note
The best resolution of injection duration is 0.25 microseconds for M2xx targets
and 0.2424 microseconds for M670. Actual resolution of the duration is a function
of the maximum duration of all pulses in this schedule request. In the current
implementation, granularity doubles every power of two times the maximum timer
duration. The maximum timer duration is 16.384 milliseconds for M2xx targets, and
15.887 milliseconds for M670. For example, the M2xx resolution is 0.25 us if the
maximum pulse duration is less than 16.384 milliseconds, and the resolution will go
to 0.50 us if the maximum pulse duration is between 16.384 us and 32.7675 us, etc.
• duration_offset
An additive offset of duration applied to each injection pulse, used to compensate for slight
mechanical and electrical differences between injectors.
• duration_mode
Set to zero to interpret the amount inport in units of volume, set to one to interpret as units
of time.
• dd_angle
The drop dead angle applied to this injector, relative to TDC-firing. The ECU will stop
injections at this point on a given cylinder. Available when the Allow updates to drop dead
angle for this injector? mask parameter is ticked.
7.8.36.5. Outports
None.
7.8.36.7. Notes
None.
7.8.37.3. Description
valid
num _ pulses
on_ angle
Injection
injector _id amount
Setpoint Feedback
duration _ offset
duration _ mode
For a given injector, the pan_InjectionSetpoint_DI block reads the injection schedule supplied
by the application. The pan_InjectionSetpoint_DI block is used to verify that the data stored
in eTPU memory match that which the application intended to write, allowing for checks of
eTPU memory faults.
If this function is called while the eTPU is updating internal schedule parameters, it will
wait until the eTPU is complete guaranteeing that all the parameters read are from a single
schedule.
7.8.37.4. Inports
• injector_id
The injector identifier of the injection schedule to read. When the injection was
configured using the pan_InjectorConfig block then the injection identifier is the same
as the cylinder identifier from that block. When the injection was configured using the
pan_SingleInjectorConfig block then the injector identifier is taken from that block.
Range: [1, n]
where n represents the number of supported injector outputs by the selected ECU.
7.8.37.5. Outports
• valid
One when the data read was successfully and coherently read, zero if a problem occurred.
• on_angle
A vector of injection on-angles, relative to TDC-firing, to match the values passed to the
pan_Injection_DI block.
Note
The values returned in this vector are the internal representation of the angles. These
may differ from the specified values by a modulo to fit into the internal angle range.
• amount
A vector of injection amounts to match the values passed to the pan_Injection_DI block.
3
Range: [0, 512) mm if duration_mode is set to volume
Range: [0, 1000] milliseconds if duration_mode is set to time
• duration_offset
An additive duration applied to this injector's pulses to match the value passed to the
pan_Injection_DI block.
• duration_mode
Whether the application specified the injection schedule in volume or time, matching the
value passed to the pan_Injection_DI block.
• drop_dead_angle
The drop dead angle as set by the parameter value passed to the pan_InjectorConfig_DI
block.
Note
The value passed to the ECU is transformed to be kept with in a valid angle range.
This transform cannot be reversed, so the angle is reported with the following
transform applied:
• Sample time
7.8.37.7. Notes
None.
7.8.38.3. Description
valid
on_ angles
off_ angles
Injection
injector _id durations
Feedback
pulse_ count
The pan_InjectionFeedback_DI block reports direct injection events that have already
occurred for a selected injector.
The reported information is updated at the end of each direct injection event. If the block
iterates while an injection event for the selected injector is on-going, then the application must
determine the appropriate index for the vector parameters from the pulse event counter.
7.8.38.4. Inports
• injector_id
Range: [1, n]
where n represents the number of supported injector outputs by the selected ECU.
7.8.38.5. Outports
• valid
A value of 1 specifies that the data read was successfully. A value of 0 indicates that some
problem occurred.
• on_angles
A vector of injection starting angles, relative to TDC-firing for the associated cylinder for this
injector identifed by inport injector_id to match the values passed to the pan_Injection_DI
block.
Note
The value passed to the ECU is transformed to be kept with in a valid angle range.
This transform cannot be reversed, so the angle is reported with the following
transform applied:
• off_angles
A vector of injection ending angles, relative to TDC-firing for the associated cylinder for this
injector identifed by inport injector_id to match the values passed to the pan_Injection_DI
block.
Note
The value passed to the ECU is transformed to be kept with in a valid angle range.
This transform cannot be reversed, so the angle is reported with the following
transform applied:
• durations
A vector of injection durations, relative to TDC-firing for the associated cylinder for this
injector identifed by inport injector_id to match the values passed to the pan_Injection_DI
block.
• pulse_count
The number of injection events that have occurred for the injector identifed by inport
injector_id.
• accumulated_fuel_time
The accumulated fuel flow time of the injector identifed by inport injector_id since the ECU
was reset.
• accumulated_fuel_volume
The accumulated fuel flow volume of the injector identifed by inport injector_id since the
ECU was reset. The value of this outport is only valid if the duration_mode inport to the
pan_Injection_DI block is set to volume mode.
3
Range: [0, inf] modulo 2097151 mm
• Sample time
7.8.38.7. Notes
None.
7.8.39.3. Description
flow_ time
Initial
dead _ time
Injection
enable
The pan_InitialInjection_PI block sets the duration of the fuel priming pulse which occurs
when the engine is first seen to be turning (before crank region synchronisation has been
achieved). The purpose of the initial fuel pulse is to ensure there is sufficient fuel in the engine
cylinders when the first sparks occur to match the environmental conditions and engine size,
making the engine more likely to start.
The initial fuel pulse must be explicitly enabled by inputting a rising edge to the enable inport.
Once this is detected, a request to generate an initial pulse is latched and this request is
only cleared when the initial pulse starts, i.e. once crank movement has been detected. If the
engine stops and then starts again without the ECU losing power, then another initial pulse
will only be generated if a further request has been detected by inputting another rising edge
to the enable inport. This can be done any time after the previous initial pulse has started.
The duration of the initial fuel pulse is calculated the minimum of (inport flow_time + inport
dead_time) and 500 milliseconds. The duration is unaffected by the end of intake angle
specified through the pan_Injection_PI block.
Due to the relative timing between sensing the engine starting to turn and the ECU
synchronising with the crank trigger wheel which in turn causes scheduled spark events to
occur, unburnt fuel can pass through a cylinder into the exhaust. Because unburnt fuel can
pass into the exhaust, the initial fuel pulse method is not generally used for emissions related
programmes. The initial fuel pulse can be turned off by not using the pan_InitialInjection_PI
block, or using the pan_InitialInjection_PI block with a total injection time of zero milliseconds.
7.8.39.4. Inports
• flow_time
The flow time represents the time the injector allows fuel to pass the injector tip.
• dead_time
The dead time represents the time it takes the injector needle to lift and allow fuel to flow.
When the dead time is updated for injector n, it is updated for all injectors, as it is a shared
parameter.
• enable
A change of input state from 0 to 1 is interpreted as a request for an initial injection pulse.
Such a request is latched until the pulse begins.
7.8.39.5. Outports
None.
7.8.39.7. Notes
All times have a resolution of 0.25 us for M2xx targets, and 0.2424 us for M670.
7.8.40.3. Description
cylinder
on_ angle
flow_ time
Injection
dead _ time
The pan_Injection_PI block updates the port injection schedule for an injector channel. See
the Section 7.5.1, “Port injection” for an overview of port injection. In short, the ECU monitors
the angle clock and starts the main injection pulse based on the schedule on_angle. The
injection lasts for the requested duration.
injection event
crank angle
0° 360° 720°
The total injection drive signal lasts for inport flow_time + inport dead_time. flow_time and
dead_time are individually clipped to their respective ranges. The dead time represents the
time it takes the injector needle to lift and allow fuel to flow. The flow time represents the time
the injector allows fuel to pass the injector tip.
Figure 7.12. Injector pulse duration is composed of “dead time” and “flow time”
flow_time
injection pulse
crank angle
dead_time
If the duration of the injection event extends beyond the end_of_intake_angle then the
injection pulse is stopped. Usually end_of_intake_angle is configured to occur before the
inlet valve closes so that fuel is not left to pool behind the intake valve to be ingested in the
next cylinder cycle.
The port injection functionality is active in half and full engine synchronisation mode (see
Section 7.1.9, “Engine synchronisation modes” for a description of modes).
• In half engine synchronisation mode for a four-stroke engine, injection pulses are
generated every 360 degrees, and the on_angle and end_of_intake_angle values are
interpreted modulo 360 degrees.
A further inport is available, split_fuel_factor, to determine what fraction of the full flow time
to apply. This allows wall-wetting effects to be included more easily when calculating the
pulse durations. In this case, the pulse duration is given by:
injection event
crank angle
0° 360° 720°
TDC firing
for cylinder n
In half engine synchronisation mode for a two-stroke engine, then injection pulses are
generated as if the ECU were in full engine synchronisation mode.
• In full engine synchronisation mode for a two or four-stroke engine, injection pulses are
generated in full every engine cycle.
When neither half or full engine synchronisation is active, the ECU forces all injectors off (the
exception to this rule is the initial fuel pulse which may occur if movement in the crank wheel
has been detected but crank region synchronisation has not yet been achieved).
7.8.40.4. Inports
• cylinder
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
• on_angle
The requested start angle for the first main pulse relative to the cylinder's TDC-firing angle
(a positive value denotes an angle after TDC-firing). In half engine synchronisation mode,
the ECU will generate a second main pulse, starting 360° on from the start of the first main
pulse.
• flow_time
The flow time represents the time the injector allows fuel to pass the injector tip.
• dead_time
The dead time represents the time it takes the injector needle to lift and allow fuel to flow.
When the dead time is updated for injector n, it is updated for all injectors, as it is a shared
parameter.
• end_of_intake_angle
The angle at which to stop any ongoing injection pulse. Must be no more than ± 720
degrees from the start of injection angle inport on_angle.
Note
If crank sync has not been achieved, then this value will be that of negative the TDC
firing angle.
• split_fuel_factor
The fraction of the flow-time to use when half engine synchronisation mode is active.
Range: [0, 1)
7.8.40.5. Outports
None.
7.8.40.7. Notes
All times have a resolution of 0.25 us for M2xx targets, and 0.2424 us for M670.
7.8.41.3. Description
enable _ update
cylinder
Update
on_ angle
Injection
flow_ time
dead _ time
The pan_Injection_PI block schedules a main pulse (and possibly a second main pulse if
half engine synchronisation mode is active). Once scheduled, the start angle and duration of
the pulse can be modified in response to transient conditions using pan_UpdateInjection_PI
block.
• The pan_UpdateInjection_PI block can change the start angle of the main injection pulse
if the main injection pulse for the current cylinder cycle has not started.
• The pan_UpdateInjection_PI block can change the duration of the main injection pulse
if the main pulse has not started or if the pulse has not completed. This may result in a
contracted or extended pulse.
• The pan_UpdateInjection_PI block can generate a post injection pulse if the main pulse
has completed and the requested duration is larger than the already delivered pulse. The
block may generate more than one post pulse if invoked more than once during the engine
cycle. Generation of post pulses is controlled through the enable_post_pulses inport.
injection event
crank angle
0° 360° 720°
Updates to the port injection schedule can be disabled through the enable_update inport.
When neither half or full engine synchronisation is active, the ECU forces all injectors off (the
exception to this rule is the initial fuel pulse which may occur if movement in the crank wheel
has been detected but crank region synchronisation has not yet been achieved).
7.8.41.4. Inports
• enable_update
Set to one to allow the block to update the injector schedule, zero otherwise.
• enable_post_pulses
• cylinder
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
• on_angle
The requested start angle for the first main pulse relative to the cylinder's TDC-firing angle
(a positive value denotes an angle after TDC-firing). In half engine synchronisation mode,
the ECU will generate a second main pulse, starting 360° on from the start of the first main
pulse.
If the injector has been scheduled for a main pulse but has not yet started the main pulse
for the current cylinder cycle, the start angle will be adjusted if there is enough time to do so.
• flow_time
The flow time represents the time the injector allows fuel to pass the injector tip.
If the injector has been scheduled for a main pulse but has not yet started, or if the
main pulse has started but not completed, then the main pulse duration will be adjusted
accordingly. If the main pulse has completed and this request is larger than the already
delivered fuel, a post pulse will be generated for the difference between the request and
the delivered fuel.
• dead_time
The dead time represents the time it takes the injector needle to lift and allow fuel to flow.
• split_fuel_factor
The fraction of the flow-time to use when unsynchronised with the cam wheel.
Range: [0, 1)
7.8.41.5. Outports
None.
7.8.41.7. Notes
All times have a resolution of 0.25 us for M2xx targets, and 0.2424 us for M670.
7.8.42.3. Description
valid
on_ angle
Injection
cylinder flow _ time
Setpoint Feedback
dead _ time
For a given injector, the pan_InjectionSetpoint_PI block reads the port injection schedule
supplied by the application. The pan_InjectionSetpoint_PI block is used to verify that the
data stored in eTPU memory match that which the application intended to write, allowing for
checks of eTPU memory faults.
If this function is called while the eTPU is updating internal schedule parameters, it will
wait until the eTPU is complete guaranteeing that all the parameters read are from a single
schedule.
7.8.42.4. Inports
• cylinder
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
7.8.42.5. Outports
• valid
One when the data read was successfully and coherently read, zero if a problem occurred.
• on_angle
The injection on angle, relative to TDC-firing, to match the values passed to the
pan_Injection_PI block.
• flow_time
The duration of injection flow time to match the value passed to the pan_Injection_PI block.
• dead_time
The duration of injection dead time to match the value passed to the pan_Injection_PI
block.
• end_of_intake_angle
The angle at which to turn injector off to match the value passed to the pan_Injection_PI
block.
Note
If crank sync has not been achieved, then this value will be that of negative the TDC
firing angle.
• split_fuel_factor
The fraction of the flow time used when in split-fuel mode to match the value passed to
the pan_Injection_PI block.
Range: [0, 1)
• Sample time
7.8.42.7. Notes
All times have a resolution of 0.25 us for M2xx targets, and 0.2424 us for M670.
7.8.43.3. Description
valid
on_ angle
Injection
cylinder flow _ time
Setpoint Feedback
dead _ time
The pan_InjectionFeedback_PI block reports information about injection events that have
already occurred for a selected cylinder. At the end of each port injection pulse, the ECU
increments a counter of requested pulses and increments an accumulator of total injection
flow time.
Whenever the ECU attempts to generate a pulse, the feedback information is updated. If the
ECU cannot generate a pulse due to an electrical fault, or if the ECU partially generates a
pulse due to the pulse schedule being cut short during the dead-time portion, the pulse count
is incremented regardless.
The accumulated flow time does not include any of the dead-time portions, but does include
priming/initial, main or post pulses, and correctly accounts for a pulse that is cut short due
to the drop-dead angle.
The feedback information is incremented using modulo arithmetic. The application must
iterate the pan_InjectionFeedback_PI block frequently enough to avoid inaccurate results
due to the modulo operation.
7.8.43.4. Inports
• cylinder
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
7.8.43.5. Outports
• valid
A value of 1 specifies that the data read was successfully and coherently read. A value of
0 indicates that some problem occurred.
• pulse_count
The number of injection events that have occurred for this cylinder since the ECU was
reset.
• accumulated_flow_time
• Sample time
7.8.43.7. Notes
7.8.44. Knock configuration (pan_KnockConfig)
Configure the parameters used to sample a knock sensor.
7.8.44.3. Description
pan_ KnockConfig
The pan_KnockConfig block configures the knock processing functionality and sets the
earliest starting angle of any knock detection window relative to each cylinder's TDC-firing
angle.
Note
The angle sense differs from most other angular blocks. A positive value denotes an
angle before TDC-firing, and a negative value denotes an angle after TDC-firing. See
Section 7.2.1, “Relative angles to TDC-firing” for more).
See the Section 7.4, “Knock sensor processing” for an overview of knock sensor processing.
In short, the application schedules a sample window in which to process a knock
sensor signal using the pan_KnockDetectionWindow block. The parameters that can be
adjusted for knock processing are set by the application using the pan_KnockFilter_Hip901x
block. Shortly after the end of each sample window, the ECU completes knock signal
processing and buffers the result which can be retrieved by the application using the
pan_KnockFeedback block.
7.8.44.4. Inports
None.
7.8.44.5. Outports
None.
• Device
The earliest starting angle of any knock detection window relative to a cylinder's TDC-firing
angle (positive angles before TDC-firing).
7.8.44.7. Notes
None.
7.8.45.3. Description
cylinder
pan_ KnockDetectionWindow
Note
The angle sense differs from most other angular blocks. A positive value denotes an
angle before TDC-firing, and a negative value denotes an angle after TDC-firing. See
Section 7.2.1, “Relative angles to TDC-firing” for more).
The filter characteristics are specific to the knock signal processing device. For the HIP901x
family of knock signal processors, the pan_KnockFilter_Hip901x block is used to configure
these settings. The result of the sampling and filtering is provided by the pan_KnockFeedback
block.
The above diagram shows a knock window relative to a cylinder's TDC-firing point, where
the knock transducer sensor signal is sampled and filtered. The knock window is chosen to
centre on a cylinder's knocking event and is used to exclude other engine noise such as
ignition and valve closing events.
For each cylinder, there is a region around the cylinder's TDC-firing point within which a
knock window can be generated.
If the start angle of the knock window lies outside the cylinder's region, or if the end angle
occurs before start angle or if the window is too small to be generated reliably, no knock
window is generated for that cylinder.
If the end angle extends into the next cylinder's region, the end angle is clipped so that it
does not cause the knock window to extend into the next cylinder's region.
The result of the knock filtering is made available shortly after the end of the knock window
via the pan_KnockFeedback block.
Knock signal processing is active in full engine synchronisation mode and disabled in other
modes.
7.8.45.4. Inports
• cylinder
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
• on_angle
Start angle of the knock detection window relative to the cylinder's TDC-firing angle
(positive angles before TDC-firing). The block folds the angle into the range [0, 720)°.
• off_angle
End angle of the knock detection window relative to the cylinder's TDC-firing angle (positive
angles before TDC-firing). The block folds the angle into the range [0, 720)°.
7.8.45.5. Outports
None.
• Window
A drop-down list of window types. Some targets support the sampling of a reference
window in addition to an active window.
• Channel
The input pin(s) sourcing the signal to measure. Note that this mask parameter is currently
unused and is only provided for future expandability. The channel is selected when the
pan_KnockFilter_Hip901x block iterates. This also means that only one knock channel
window can be set at a time.
7.8.45.7. Notes
None.
7.8.46.3. Description
Window : Active window valid
Channel : KIN ( pin Y 51+Y52)
cylinder
knock_ signal
pan_ KnockFeedback
The pan_KnockFeedback blocks retrieves the result of the last processed knock signal
for a cylinder. When the knock sensor signal was processed, and the parameters used
in processing, are set by the application using the pan_KnockDetectionWindow and
pan_KnockFilter_Hip901x blocks.
Knock signal processing is active in full engine synchronisation mode and disabled in other
modes. When the ECU is not in full engine synchronisation mode, the knock processing
result is forced to zero.
7.8.46.4. Inports
• cylinder
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
• sim_knock_signal
The value of this inport is passed to the knock_signal output under simulation.
7.8.46.5. Outports
• knock_signal
The result of the last processed knock signal for the cylinder if the valid outport is one,
zero otherwise.
• valid
Set to one if the processed knock signal is valid, zero otherwise. Causes of valid being
zero include: lack of full engine synchronisation; requested cylinder is outside the number
of cylinders configured (see the pan_EngineConfig block), knock is not configured by the
application (a pan_KnockConfig block does not exist in the application), or if the application
sets the knock window starting angle in the pan_KnockDetectionWindow block too close
to the start of the knock region window specified with the pan_KnockConfig block, where
too close is defined as the two angles occurring within 223 microseconds at the current
engine RPM.
• Window
A drop-down list of window types. Some targets support the sampling of a reference
window in addition to an active window.
• Channel
The input pin sourcing the signal to measure. Note that this mask parameter is currently
unused and is only provided for future expandability. The channel is selected when the
pan_KnockFilter_Hip901x block iterates. This also means that only one knock channel
can be read at a time, and the data will come from the channel of the last iterated
pan_KnockFilter_Hip901x block.
7.8.46.7. Notes
None.
7.8.47.3. Description
cylinder
integration
The pan_KnockFilter_Hip901x block sets the HIP901x device signal processing parameters
to be applied to the knock transducer signal when it is sampled. The sensor sampling region is
set by the application using the pan_KnockDetectionWindow block. The result of the filtering
is provided by the pan_KnockFeedback block.
A simplified view of the knock signal processing stages is given in the following block diagram:
-
differential
channel selection
knock transducer
swicthes
Adjustable
gain stage
-
differential
knock transducer +
Adjustable Adjustable
Active full processed
bandpass filter integrator
wave rectifier knock signal
stage stage
• The knock signal to process is first selected from two differential inputs, as selected by the
application using the pan_KnockConfig block. The device responsible for detecting knock
can process just one sensor at a time.
rd
• The knock signal is then passed through a 3 order anti-aliasing filter. This filter is required
to have no more than 1dB attenuation at 20kHz (highest frequency of interest) and a
minimum attenuation of 10dB at 180kHz.
• The knock signal is then passed through a gain stage to compensate knock energies if
needed.
• The knock signal is then passed through a band-pass filter to detect the frequencies of
interest. The filter frequency is established by the characteristics of the particular engine
and transducer.
• The knock signal is then passed through a full wave rectifier before being passed into an
integrator stage, the output of which can be monitored for knock. Integration is towards the
positive supply when a knock signal is present.
Knock signal processing is active in full engine synchronisation mode and disabled in other
modes. When the ECU is not in full engine synchronisation mode, the knock processing
result is forced to zero.
7.8.47.4. Inports
• cylinder
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
• gain
• bandpass
Bandpass centre frequency applied to the knock transducer signal for a specific cylinder.
• integration
Integration time constant applied to the knock transducer signal for a specific cylinder.
7.8.47.5. Outports
None.
• Window
A drop-down list of window types. Some targets support the sampling of a reference
window in addition to an active window.
• Channel
7.8.47.7. Notes
The values of the gain, bandpass and integrator inports are quantised by the knock
processing as given in the table below. Input values are rounded to the nearest available
discrete value. Out of range input values are clipped to range.
7.8.48.3. Description
Spark arrangement:
Coil on plug
pan_ SparkConfig
The pan_SparkConfig block configures a set of spark output channels and the drive method
(coil-on-plug or wasted spark). The drive method results in different spark pulse sequences
depending on the engine synchronisation mode (see Section 7.1.9, “Engine synchronisation
modes” for an overview of modes).
• Coil-on-plug — associates one spark output pin with one spark coil. In full engine
synchronisation mode, the ECU generates one spark pulse. In half engine synchronisation
mode, the ECU will either generate no spark pulses, or generate two spark pulses per
engine cycle, depending on the 4-stroke 360 degree sparks in half engine sync mode?
mask parameter.
Generating two spark pulses per engine cycle helps start the engine when the application
does not know which half of the engine cycle is active. This mode of spark generation is
similar to wasted spark, and indeed half of the sparks are wasted on average, but unlike
the wasted spark mode, there must be one coil for each cylinder.
• Wasted spark — associates one spark output pin with two spark coils. Each spark coil
corresponds to one engine cylinder. The wasted spark option can be used to run a four-
stroke engine that have evenly spaced TDC-firing angles with half as many spark output
pins.
For the M250 target, the application must use the pcfg_Config_M250 block to set any spark
channels from the Cylinder n spark channel mask parameter to be PWM.
7.8.48.4. Inports
None.
7.8.48.5. Outports
None.
• Spark arrangement
The required spark arrangement type, either coil-on-plug (one spark output pin per coil per
cylinder) or wasted spark (one spark output pin for two coils, one coil per cylinder).
• Invert output
Whether to emit sparks every 360 degrees until full engine synchronisation has been
obtained. This can aid quicker engine starting for inline engines, but may be unsuitable for
“V” engines if shared-coil wasted spark is also in use.
Calibratable: No
7.8.48.7. Notes
None.
7.8.49.3. Description
cylinder
off_ angle
pan_ Spark
The pan_Spark block schedules a spark pulse for a cylinder. See Section 7.6, “Scheduling
coil outputs” for an overview of driving coils. In short, the ECU monitors the angle clock
and generates a spark pulse based on the schedule's on_angle and off_angle, relative to a
cylinder's TDC-firing angle.
Note
The angle sense differs from most other angular blocks. A positive value denotes an
angle before TDC-firing, and a negative value denotes an angle after TDC-firing. See
Section 7.2.1, “Relative angles to TDC-firing” for more).
The generation of one or more spark pulses is based on the current engine synchronisation
mode and the configuration applied by the application. See Section 7.1.9, “Engine
synchronisation modes” for an overview of synchronisation modes.
• In full engine synchronisation mode with the wasted spark option disabled, the ECU
generates one pulse per engine cycle per spark output pin.
start of end of
coil event coil event
(on_angle) (off_angle)
coil event
crank angle
0° 360° 720°
TDC firing
for cylinder n
• In full engine synchronisation mode with the wasted spark option enabled, the ECU
generates two pulses per engine cycle per spark output pin. The wasted spark option can
be used to run a four-stroke engine that have evenly spaced TDC-firing angles with half
as many spark output pins.
crank angle
0° 360° 720°
• In half engine synchronisation mode with the 360 degree spark option disabled, the ECU
will generate no spark pulses.
• In half engine synchronisation mode with the 360 degree spark option enabled and the
wasted spark option disabled, the ECU will generate two pulses per engine cycle per spark
output pin. The spark schedule is repeated every 360 degrees.
• In half engine synchronisation mode with the 360 degree spark option enabled and the
wasted spark option enabled, the ECU will generate two pulses per engine cycle per spark
output pin. The spark schedule with the later angle is chosen to be repeated every 360
degrees.
Note
On an evenly spaced TDC-firing angle engine, there is unlikely to be much of a
difference between the two cylinder spark schedule requests. But for an unevenly
spaced TDC-firing angle engine, it isn't possible to know which of two cylinder
schedules to use for a single spark output pin. So the ECU chooses the last of the
two schedules as being too late in one cylinder will give poor-torque firing but being
too early in other cylinder may result in backwards firing.
For this reason, neither wasted spark nor 360 degree spark options are
recommended for an asymmetrical engine.
In all cases, if the application requests a change to the spark schedule using the pan_Spark
block, then the ECU takes one of two actions. If a spark pulse is being generated when the
application makes the new schedule request, then the new request is buffered for the next
cycle, but if a spark pulse is not being generated then the new request is used immediately.
In the case where the new schedule is used immediately, this will result in a second spark
pulse for the engine cycle if the new schedule starting angle is in the future.
If the application makes no further requests to update the spark schedule, then the ECU
will repeat the schedule at most 4 times. Once the repeats are completed, the ECU clears
the schedule and no further spark pulses are generated until the application requests a new
spark schedule.
The spark functionality is active in half and full engine synchronisation mode only (see
Section 7.1.9, “Engine synchronisation modes” for a description of modes). In any other
mode, the ECU forces all spark outputs off.
Note
Unlike other angular functionality, when an application updates the spark schedule,
the ECU will wait for the existing spark pulse to complete (if one is active) and then
immediately schedule the update. If the update can be scheduled in the same cylinder
cycle, then it will be, otherwise the update will be scheduled for the next cylinder cycle.
For this reason, it may be preferable to update the spark schedule using the TDC-
calculation trigger, rather than periodically.
Note
If the ECU has electrical monitoring and protection features, that can automatically turn
off a spark output in the event of over-current (for example), then leaving the spark
output on for too long may lead to advanced spark timing when the ECU turns the spark
output off before the end angle has been reached to protect the electronics.
7.8.49.4. Inports
• cylinder
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
• on_angle
The starting angle of the spark pulse, relative to TDC-firing (positive angle is before TDC-
firing).
• off_angle
The ending angle of the spark pulse, relative to TDC-firing (positive angle is before TDC-
firing).
7.8.49.5. Outports
None.
7.8.49.7. Notes
None.
7.8.50.3. Description
valid
Spark
cylinder last_off_ angle
Feedback
pulse count
pan_ SparkFeedback
The pan_SparkFeedback block retrieves information about spark events that have occurred
for a specific cylinder. At the end of each spark pulse, the ECU increments a counter of
requested pulses and captures the requested off angle of the pulse.
When the ECU attempts to generate a pulse, the feedback information is updated. If the ECU
cannot generate a pulse due to an electrical fault, the pulse count and off angle is updated
regardless.
When capturing the last pulse off angle, the function does not make a distinction between the
main pulse (requested) and either a secondary pulse for wasted spark on the same output
channel, or a secondary pulse for starting an engine in half engine synchronisation mode. It
is up to the application to make the distinction if that is required.
The feedback pulse count is incremented using modulo arithmetic. The application must
iterate the pan_SparkFeedback block frequently enough to avoid inaccurate results due to
the modulo operation.
7.8.50.4. Inports
• cylinder
Range: [1, n]
where n is the number of cylinders specified by the pan_EngineConfig block.
7.8.50.5. Outports
• valid
A value of 1 specifies that the data read was successfully. A value of 0 indicates that some
problem occurred.
• last_off_angle
The angle at which the last spark pulse ended, relative to TDC-firing for this cylinder. A
positive value indicates an angle before TDC-firing.
• pulse_count
The number of spark events that have occurred for this cylinder since the ECU was reset.
• Sample time
7.8.50.7. Notes
None.
This section gives details on the Extended Diagnostics Functions which are an optional
addition to the OpenECU platform.
The diagnostic infrastructure support has been designed to meet both CARB and EURO
diagnostics requirements and communicate with scan tools according to both heavy duty
(J1939) and passenger car (ISO15765) protocols. It is aimed at vehicles which have to
comply with 2010 and beyond legislation (eg EURO6).
It is important that the user understands general OBD terminology and the interactions
between the various SAE/ISO standards and emissions/OBD legislated requirements. The
standards are generally very good at describing their own terms and acronyms; therefore
they have not been repeated here. There is no substitute for reading the relevant standard.
A quick browse is absolutely essential, so that you will know where to look when the time
comes for more detailed information.
The term diagnostics can be taken to mean many different tasks on different levels. The
following diagram shows some of these. Details of how the user's application has to interact
with the OpenECU platform are described below.
For European OBD documents, most of the emissions related legislation is held within
Directive 70/220/EEC, which has been amended many times over the years. OBD
requirements are held within Annex XI, which itself was created and subsequently modified
by directives:
• 1998/69/EC
• 1999/102/EC
• 2002/80/EC
• 2003/76/EC
For heavy-duty diesel vehicles the Commission brought in Directive 2003/522. Subsequently,
Directive 2005/55/EC introduced additional requirements for Euro-V emissions compliant
diagnostic systems from 2008 or 2009 onwards. This was in turn amended by:
• 2005/78/EC
• 2006/51/EC
• 2008/74/EC
For Euro-VI heavy duty diesel vehicles, the previous regulations were revoked and a new
Commission Directive 582/2011 was put in place.
The Californian (CARB) diagnostics requirements are captured within Title 13 California
Code of Regulations in either section 1962.8 for passenger cars, light and medium duty
vehicles or section 1971.1 for heavy duty vehicles.
Scan tool communications fall into two main categories: heavy duty using J1939 and light
duty using ISO15765 based protocols. The second (light duty) category also includes the
original J1979 diagnostic service requirements (also described in ISO15031-5) as well as the
higher numbered KWP2000 and UDS services.
The implementation within the OpenECU platform attempts to steer a course through
these various diagnostics requirements. At times they conflict and in such cases, the
implementation allows the user to select one alternative or another. There are also cases
where a user may want to deliberately over-ride some aspect of the protocol or diagnostic
requirements (e.g. during manufacturing). In these cases, the platform provides the user
application with the ability to make those changes. Therefore it is essential that the application
works together with the platform to provide a coherent and legally compliant diagnostic
system. It cannot be left to just one side or the other.
One of the more confusing areas is the overlap between J1939-73 and ISO15031-5 (J1979)
services for the generic, mandatory services. Both protocols have the ability to transmit more
or less the same information, but in wildly different ways. The following table is loosly derived
from one in J1939-73 and attempts to translate between the two.
8.3. Approach
The approach to implementing the diagnostics functions is a balance between providing
flexibility and requiring minimal intervention. The user needs the ability to configure their
data and choose which services to support. In some cases, the scan tool interactions do
not require additional user code (model) as the data is well structured and can be reported
simply by the OpenECU platform.
The Simulink blockset provided does not force any particular structure or hierarchy onto
the user. The OpenECU build system will gather data about DTCs, freeze-frames, PIDs,
monitors etc at build time and generate an appropriate set of embedded data structures for
that particular system. This allows the user to implement diagnostic functions throughout their
model without carrying any extra overheads within the embedded code.
The diagnostics system works closely with the NVM file system. Again, the user has some
flexibility in terms of allocating certain amounts of memory or choosing when data is written,
but for the most part, this interface is seamless and diagnostic data is stored and retrieved
safely with minimal input from the user. The freeze-frames potentially take the largest amount
of NVM, which is controlled via the pff_Configuration block.
Communications with the scan tool behave slightly differently for J1939 compared to
ISO15765 and related protocols. For J1939, the user’s application model is required to
provide data for the reply to a scan tool request. However, for most of the ISO15765 standard
services, the data is retrieved by the platform and sent back to the scan tool with minimal
intervention from the user’s application model.
ECU
SCAN TOOL
User’s Application
NVM data,
DTCs,
API Freeze-frames,
Test results
IUPR
etc
CAN
OpenECU platform
DTCs may be grouped into tables to help the user manipulate them. They can then be cleared
(by table name) if required.
DTCs will also have an associated freeze-frame that is stored when the fault occurs. The
user may specify several different types of freeze-frame for use with different DTCs. The
various freeze-frame definitions may include more or less data to be captured when a fault
occurs. Note that the legislation requires some specific pieces of data to be captured for
emissions related faults.
For a specific piece of data to be captured in a freeze-frame, the application needs to point it
out to the platform. This is one of the uses of the PID block (J1939 SPN data). The platform
can grab the latest data from the inport to the PID block when required. The same PID block
mechanism allows the OpenECU platform to provide real-time data from within the user’s
model to a scan tool (e.g. for J1979 service $01 or J1939 DM24).
The user may implement the DTC, PID and freeze-frame blocks anywhere in the model.
At build time, the OpenECU system will search the user’s model to find all potential DTCs
and associated freeze-frame definitions and will allocate sufficient memory depending on the
number and type of DTCs and freeze-frames.
Here's an example of J1939 SPN data being collected via two PID blocks. This data can
now be used in freeze frames as well as reported via DM24. The PID blocks can be placed
anywhere in a model to gather data from the most convenient places. To incorporate this
data into a freeze frame, use a vector calibration containing the list of PID identifiers(J1979)
or SPNs(J1939) in the pff_FreezeFrame block.
pid _ bytes
Vy = Vu * 2^-8
2 Qy = Qu >> 8 uint 8 pid _ bytes
engspd Ey = Eu
app_ bytes J 1939 SPN : 190
mod uint 8
256 override_ status
There are user configurations related to freeze-frames, which determine the total number to
capture and the maximum amount of RAM and NV memory to allocate for freeze-frames. This
allows the user to limit the allocation of memory (e.g. in the event of repeated faults) while
at the same time making maximum use of the resources available in the ECU. This flexibility
means that the system can be tailored to be more useful during development phases (when
extra memory may be available) and then scaled back for the production version without
changes to the model structure.
The Simulink block pdtc_DiagnosticTroubleCodeExt is the main dialog for each fault
in describing how it should behave. In particular, note the distinctions between CARB
permanent and Euro non-eraseable DTCs. In each case the conditions required to clear the
DTC are fully specified in the relevant legislation.
of an output signal. Alternatively the tests may be classed as non-continuous which means
that they can only be performed when the vehicle is in a certain operating state, for example
checking the performance of a catalyst or the EGR sub-system.
The OpenECU platform allows the user to define the monitors and related tests in the system
using the ppr_DiagnosticMonitorEntity and ppr_DiagnosticTestEntity blocks.
The user's application must use these blocks in conjunction with their individual diagnosis
algorithms and provide data from each time an individual test is performed. The data is used
in two ways by the platform:
• Firstly, each time a test is run, this allows the platform to update the numerator and
denominator to be used in calculating the In-Use-Performance-Ratio for that particular
diagnostic.
• Secondly the most recent test results (and limits) must be available for communication to
a scan tool. The platform will store this data in NVM (to keep it in the event of a power
down) for future communication to a scan tool.
Note
The legislation has some specific values (MonitorID) that must be used for specific sub-
system emissions monitors.
The Simulink model below shows a set of conditions for each of the tests being used to
enable two further sub-systems. Each of those sub-systems will contain an individual flow
test and associated interfaces.
At the monitor level, the application uses the ppr_DiagnosticMonitorEntity block. There are
inputs for when the tests are running, when they have completed and there is also the ability
to force data into the block. These forcing inputs have been grounded (set to FALSE). The
output of the DME block provides the latest value of the numerator/denominators associated
with the overall flow monitor.
Also shown are the two ppr_DiagnosticTestEntity blocks for the two individual tests. These
receive the data for individual test results, limits and individual numerator/denominator
updating.
For an ISO based scan tool, the data is accessed by a Service $06 command. Passing the
data to the scan tool is handled directly by the platform, so in this case, the DME and DTE
block outputs are for information only.
2
Another _ flow_ parameter
>=
AND
mftc_ temperature_ thresh_ high
3
>=
Measured_ temperature
==
mftc_ normal _ operation _ state
dte_ denominator
Test_ complete [Hi _ flw_ done] denominator _ update
The Simulink model below shows how an individual pass/fail result is used to set and clear
DTCs.
2 4
Test_ value Hi_ flow _flt _ state
In1
parameter1
flow_ test_ value K Ts
In2 <=
parameter2 z-1 state
1
Flow test algorithm > test_ failed
Flow_ data pressure
count
Hi_ flow _ time
ISO ID : 1234
dc_ count
K Ts
1
z-1
> 1
Test_ complete
Hi_ flow_ test_ duration
1
commit store_ up_to_ date
z
Delay
ppr_ Memory
We’ve made up some imaginary table which provides a test limit. The flow test algorithm
computes a value which is compared against this limit. If the value is greater than the limit,
then an integrator adds up the time for which it is over the limit. Once suitable time has
passed, the test is considered to have failed and a fault code will be stored by triggering the
DTC block. These DTC blocks may exist anywhere within the Simulink model.
The duration integrator allows for sufficient time to pass and if the test value was not above
the limit, the test will be completed and passed.
Note that the test limits and test value are passed out to the DTE block for use in the event of
a scan tool service $06 request. The platform is asked to store the new results after a short
delay. This is required, as the service $06 request needs to be given the most recent test
results, even if those results are days or even weeks old.
When a DTC is triggered (via the test_failed inport as shown above) an emissions related
system must capture a freeze frame. This mechanism uses the PID and freeze-frame blocks
ppid_Pid and pff_FreezeFrame.
Firstly, an example of how the lamp outputs can be used. Here, we have configured the MIL
lamp as a CAN output, the Red Stop Light and Amber Warning Light as digital outputs on
this module and the Protection Lamp is not used.
pcx_ CANTransmitMessage
mil _ status
pdtc_ Status
state
Channel : DOT ( pin A1)
Inversion : off
Default value : 0
fault
pdx_ DigitalOutput 1
The next model snippet shows the setting of some of the generic counters. Note that this
has some slightly simplified logic.
4
>
Time _ since_ start
240
4_ hrs
dc_ start
1
>
ECT AND wu_ start
70
3
>
Engine _ speed
500
rpm
There are additional blocks to force NVM storage – this can be done by the user on a periodic
basis or perhaps only after tests have completed and new results are available or when DTCs
have been set. The blocks are shown in the example models.
If a scan tool now follows the J1979/ISO 15031 standard to request emissions data, the
OpenECU system will respond with the correctly formatted data for each request. The full list
of emissions related diagnostic services are detailed below.
The build process will create entries for this value in the A2L file for sev-a (highest), sev-b1,
sev-b2, sev-c, or sev-none (lowest). To emit all DTCs regardless of their emissions severity
level, use sev-none.
ID Service Notes
0x03 ReadEmissionDTCs (J1979) Reports only DTCs defined as
emission-related
0x04 ClearEmissionDTCs (J1979) Clears only DTCs defined as
emission-related
0x06 RequestOBDTestResults (J1979) Reports test results for ISO test
IDs
0x07 ReadEmissionDTCsPending Reports only DTCs defined as
(J1979) emission-related that are pending
0x09 RequestVehicleInformation Used to read Vehicle Information
(J1979) data stored as InfoTypes
0x0A ReadEmissionDTCsPermanent Reports only DTCs defined
(J1979) as emission-related that are
permanent
0x10 StartDiagnosticSession Used to request a change between
(KW2000-3) or diagnostic sessions. (Default,
DiagnosticSessionControl (UDS) Extended and Programming)
0x11 ECUReset (KW2000-3, UDS) Used to reset the ECU. Only
supported by Bootloader to exit
reprogramming mode
0x14 ClearDiagInfo (KW2000-3, UDS) Clears all or subgroup of ISO
DTCs (not J1939-only DTCs)
0x17 ReadStatusOfDTC (KW2000-3) Reports the status of the specified
DTC
0x18 ReadDTCByStatus (KW2000-3) All DTCs, regardless of emissions
severity
0x19 ReadDTCInfo (UDS) 16-bit DTCs currently output, lower
byte zero; many subfunctions
0x21 ReadDataByLocalIdentifier Used to read PID values using an
(KW2000-3) 8-bit identifier
0x22 ReadDataByCommonID Used to read PID values using an
(KW2000-3, UDS) 16-bit identifier
0x23 ReadMemoryByAddress Used to read raw memory contents
(KW2000-3, UDS) (subject to security restrictions)
0x24 ReadScalingDataByIdentifier Used to read scaling data for a PID
(UDS)
0x27 SecurityAccess (KW2000-3, UDS) Used to grant security access in
boot loader mode
0x28 CommunicationControl (UDS) Used to switch on/off the
transmission and or the reception
of certain messages
0x28 DisableNormalMessageTransmissionUsed to switch off the transmission
(J2190) of non-diagnostic and non-network
management messages
0x29 EnableNormalMessageTransmissionUsed to switch on the transmission
(J2190) for all messages
0x2A ReadDataByPeriodicIdentifier Used to request automatic periodic
(UDS) transmission of selected PIDs
ID Service Notes
0x2C DynamicallyDefineDataIdentifier Used to specify a new PID
(UDS) composed of other PIDs or
memory reads
0x2E WriteDataByLocalIdentifier Used to write PIDs specified by 16-
(KW2000-3, UDS) bit identifier (eg NV PID data)
0x2F IOControlByCommonID Used to override PID values using
(KW2000-3, UDS) a 16-bit identifier
0x30 IOControlByLocalID (KW2000-3, Used to override PID values
UDS) (identified by KW2000 8-bit local
identifier)
0x31 RoutineControl (UDS) Used to initiate a specified process
in boot loader mode, e.g. erase
memory
0x34 RequestDownload (KW2000-3, Used to initiate a downloading of
UDS) a block of memory in boot loader
mode (only the downloading of
unencrypted, uncompressed data
is currently supported)
0x36 TransferData (KW2000-3, UDS) Used to download data in boot
loader mode (only the downloading
to flash is currently supported)
0x37 RequestTransferExit (KW2000-3, Used to terminate data transfer
UDS) between the tester and the ECU in
boot loader mode
0x3E TesterPresent “Ping” to maintain communications
0x85 ControlDTCSetting Used to Stop or Start the setting of
DTCs
Note
Services $14, $17 and $18 use the ISO 15031-6 values for groupOfDTC groups in
KW2000-3 style (powertrain 0x0000, chassis 0x4000, body 0x8000, network/other
0xC000, all 0xFF00). For $14, the equivalent 24-bit UDS values may alternatively be
used (0x000000, 0x400000, ... and 0xFFFFFF for 'all').
Note
Please contact Pi Innovo for support with flash reprogramming. The EraseMemory
routine ($FF00) typically specified by OEMs is supported in two formats:
• Logical index: If no length is supplied, the address value is interpreted as the zero-
based index of the eraseable flash block, which is device-dependent. For example,
the MPC5534 M0 block (0x40000 - 0x5FFFF) has index 6. This follows the HIS group
reprogramming specification.
Generic J1939 receive and transmit blocks are provided, but are only useful where the reply is
a fixed length. When the reply may be of a variable length, the special response blocks should
be used. They will invoke the J1939 transport protocol for multi-frame replies (if necessary).
See here Section 4.6.3.3, “J1939 (SAE) communications” for the full list of J1939 blocks
provided by OpenECU.
pj1939_PgRequested_DM4
dest_addr
transport_errors
exd_ff_DM4_transport_error
use_dest_addr
This example is for DM4. The same request/response arrangement should be used for all
J1939 DM requests. OpenECU provides a specific transmit block for each DM that has a
variable length response.
8.7.1.3. Description
cvn
calculating
psc_ CvnCalc
The CVN is calculated using CRC-16-CCITT. The reported CVN is composed of the code
area CRC and calibration area CRC. The calibration area CRC occupies the 2 most
significant bytes. The code area CRC occupies the 2 least significant bytes. Memory regions
which are expected to change during normal ECU operation have been omitted from both
code and calibration CRCs. The code area CRC excludes the file storage area. DTCs,
freeze frames, etc, are stored in the file storage memory region. The calibration area CRC
excludes adaptive calibrations. Unused memory areas have been omitted from both code
and calibration CRCs.
Note that when the calibrations are mapped to RAM on development ECUs (i.e. whenever
one can actually calibrate on-the-fly), changing those calibrations will affect the CVN.
This is not the case for production units when the calibration is fixed and stored in non-
volatile memory (NVM). When runtime calibration changes are made via CCP, the currently
calculated CVN will be invalidated, and the available outport will be set to FALSE until the
CVN is recalculated with a rising edge on the trigger inport.
The calibration verification number (CVN) is computed in the background task. Multiple
invocations of the background task are used to calculate the CRC so as to prevent a watchdog
timeout. At each invocation the CRC is calculated for a relatively small chunk of memory.
Background checking for code or calibration corruption works through the Calibration
Verification Number computation on supported targets with the OBD library option. Ensure
that the CVN is recomputed continually if run-time corruption checking is required. If it is
detected, an unrecoverable error is raised (resulting in ECU reset). This is in addition to boot-
time checksum validation.
After the CVN has been calculated for the first time, it will be automatically stored in NVM and
recalled by the block during initialization on the next reset. The available and cvn outports
will be updated with the previously calculated results after a power cycle.
8.7.1.4. Inports
• trigger
A boolean flag to trigger the CVN calculation, apply a rising edge to this inport.
8.7.1.5. Outports
• cvn
The calculated CVN is supplied to the application from this port. The supplied CVN is
composed of the code area CRC and calibration area CRC. The calibration area CRC
occupies the 2 most significant bytes. The code area CRC occupies the 2 least significant
bytes.
• available
Once a CVN has been calculated returns TRUE until ECU reset, i.e. triggering further CVN
calculations does not alter this value.
• calculating
8.7.1.7. Notes
None.
See Section 6.1.35, “DTC clear all (pdtc_ClearAll)” for a detailed description.
See Section 6.1.36, “DTC clear all if active (pdtc_ClearAllIfActive)” for a detailed description.
See Section 6.1.37, “DTC clear all if inactive (pdtc_ClearAllIfInactive)” for a detailed
description.
8.7.5.3. Description
Table :
clear
pdtc_ ClearDtcs
Given a DTC table, clear all DTCs (if the clear state is supported by the DTC), which match
the block parameters DTC type (in accordance with comparator Type comparison), DTC
emissions severity (in accordance with comparator Emissions severity comparison), DTC
state (in accordance with comparator State comparison). This block provides for configurable
clearing of DTCs according to the user requirements e.g. the user may wish to clear all DTCs
in a given table that are of type ISO only, with emissions severity greater than B1 and with
state not equal to active.
The user may also select to clear DTCs only according to OBD regulations (e.g. following
CARB regulations for permanent DTCs or Euro non-erasable DTCs), or may select to clear
DTCs unconditionally.
8.7.5.4. Inports
• clear
Set to 1 to force the state of each DTC to state clear which match the block parameters
DTC type (in accordance with comparator Type comparison), DTC emissions severity (in
accordance with comparator Emissions severity comparison), DTC state (in accordance
with comparator State comparison).
8.7.5.5. Outports
None.
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
• Type comparison
A drop-down selection of the comparison to perform on the DTC's type (first step) when
clearing DTCs, in the DTC table (specified by parameter DTC table identifier). See
parameter DTC type for the second step.
Calibratable: No
• DTC type
A drop-down selection of the type of DTCs to use (second step) for clearing DTCs in the
DTC table (specified by parameter DTC table identifier). If the parameter Type comparison
is set to 'Any' then this drop-down is not available.
A drop-down selection of the comparison to perform on the DTC's emissions severity (first
step) when clearing DTCs, in the DTC table (specified by parameter DTC table identifier).
See parameter DTC emissions severity for the second step.
A drop-down selection of the emissions severity to use (second step) for clearing DTCs
in the DTC table (specified by parameter DTC table identifier). If the parameter Emissions
severity comparison is set to 'Any' then this drop-down is not available.
• State comparison
A drop-down selection of the comparison to perform on the DTC's state (first step)
when clearing DTCs, in the DTC table (specified by parameter DTC table identifier). See
parameter DTC state for the second step.
• DTC state
A drop-down selection of the DTC state to use (second step) for clearing DTCs in the DTC
table (specified by parameter DTC table identifier). If the parameter State comparison is
set to 'Any' then this drop-down is not available.
If checked, this block will clear DTCs matching the comparison criteria above
unconditionally, regardless of whether they are configured as CARB permanent DTCs or
as Euro non-erasable DTCs.
If unchecked, this block will only clear DTCs which match the comparison criteria above,
and which are permitted to be cleared at this time by OBD regulations. Any CARB
permanent DTCs will be cleared under the conditions of the CARB regulations, and Euro
non-erasable DTCs will never be cleared.
Typically this would be unchecked for clearing DTCs via OBD scan tool request, and would
be checked for a full reset of DTCs during production or in other situations where OBD
regulations on clearing DTCs are not relevant (e.g. moving the ECU to a different vehicle).
8.7.5.7. Notes
None.
8.7.6.3. Description
dc_ start
wu_ start
ic_ start
eng_ running
ok_to_clr_ perm
pdtc_ Control
Platform control of DTCs can depend on the number of drive, warm-up and ignition cycles that
have taken place as well as the engine running state. This block is used to signal the start of
each cycle and the engine running state. It is up to the application to determine the conditions
for starting each of the cycles and the engine running state, as these can be dependent on
the regulatory requirements that are being adhered to.
When an OBD clear request is received, any relevant CARB permanent DTCs will not
be cleared immediately. Instead they will be cleared at the end of this drive cycle (or a
subsequent drive cycle) if the relevant test has been carried out and passed (and has not
subsequently failed again). In addition, DTCs relating to certain monitors are required to
wait for certain vehicle/operating conditions to be met during a drive cycle before permanent
DTCs for these monitors may be cleared, where these vehicle/operating conditions will have
exercised a representative range of vehicle behaviour and any existing fault is likely to have
been detected. It is up to the application to determine whether these conditions have been
satisfied, as these can be dependent on the regulatory requirements that are being adhered
to.
8.7.6.4. Inports
• dc_start
A transition from 0 to 1 indicates the start of a new drive cycle. The input should remain high
throughout the drive cycle, but it must be switched low for at least one iteration between
cycles.
Calibratable: No
• wu_start
A transition from 0 to 1 indicates the start of a new warm-up cycle. The input should remain
high throughout the warm-up cycle, but it must be switched low for at least one iteration
between cycles.
• ic_start
A transition from 0 to 1 indicates the start of a new ignition cycle. The input should remain
high throughout the ignition cycle, but it must be switched low for at least one iteration
between cycles.
• eng_running
• ok_to_clr_perm
Set to 1 to indicate that vehicle/operating conditions are currently met such that an OBD
clear request may be carried out for permanent DTCs. Set to 0 otherwise.
8.7.6.5. Outports
None.
8.7.6.7. Notes
None.
8.7.7.3. Description
state
test_ failed
count
ISO ID : 0
dc_ count
test_ completed
wu_ count
pdtc_ DiagnosticTroubleCodeExt
A diagnostic trouble code (DTC) is a unique indicator used to remember the state of
a fault. This block supports platform-controlled fault handling for emissions-related and
non-emissions-related faults. The model determines if the conditions for progressing the
platform's fault handling state machine are satisfied or not, and passes this information to
the pdtc_DiagnosticTroubleCodeExt block. The state of any fault can be maintained by the
block while the model is running, and also across power cycles (see the pdtc_Memory block
for more details).
There are two types of DTC currently supported - J1939 and ISO-15765 - although more may
be added in the future. Each DTC can be defined as either a single type, or a combination
of both J1939 and ISO types.
Each DTC can be in one of four states. Its state is Clear if its fault conditions have never
been present, or if a previously active fault has healed itself (its fault conditions have not
been present for a sufficient amount of time). Its state is Pending if its fault conditions are
present, but have not been present for long enough to confirm the fault. Its state becomes
Active if a Pending DTC's fault conditions persist long enough for it to be confirmed, or if a
Previously Active DTC's fault conditions return. Its state becomes Previously Active if an
Active DTC's fault conditions have been not been present for a sufficient amount of time.
The library will transition through the different states, Clear, Pending, Active and Previously
Active based upon the inputs from the application, test_failed and test_completed as well
as information regarding current drive cycle and warm up cycle count.
State transitions are also affected by the action selected when a DTC reaches Previously
Active but the test then fails again. Behaviour in this situation is not specified by CARB
(and therefore not by other OBD specifications deriving from CARB), so behaviour is
manufacturer-specific. One possible interpretation is that the DTC should simply return
immediately to Active. The other possible interpretation is that the DTC should return to
Pending: in this case, if the test continues to fail then the DTC transitions to Active; or if the
test passes for the duration of another drive cycle then the DTC returns back to Previously
Active (instead of returning to Clear as a DTC would usually do from Pending state).
Selection of the desired behaviour is configurable at the C-API level, but this has not yet been
implemented in Simulink; Simulink models will currently always select the latter interpretation
(transition to Pending) for DTC.
If transitions between Previously Active and Pending states are disabled, the following
diagram describes the DTC state transitions.
if ‘test_failed’ = FALSE
if ‘test_failed’ = TRUE
for required drive if ‘test_failed’ = TRUE
if ‘test_failed’ = TRUE cycles
Clear Active
Pending
1 2
4
if ‘test_failed’ =
if ‘test_failed’ =
FALSE for required
FALSE throughout if ‘test_failed’ =
drive cycles
last drive cycle TRUE
Previously
Active
3
if ‘test_failed’ =
FALSE for required
warm-up cycles if ‘test_failed’ = FALSE
If transitions between Previously Active and Pending states are enabled, the following
diagram describes the DTC state transitions.
if ‘test_failed’ = FALSE
if ‘test_failed’ = TRUE for
if ‘test_failed’ = TRUE
if ‘test_failed’ = TRUE required drive cycles
Clear Active
Pending
1 2 if ‘test_failed’ =
4 FALSE for required
drive cycles
if ‘test_failed’ = FALSE
throughout last drive cycle if ‘test_failed’ =
AND TRUE
was not previously active
if ‘test_failed’ = FALSE
throughout last drive cycle Previously
AND Active
was previously active
3
if ‘test_failed’ = FALSE
for required warm-up
cycles if ‘test_failed’ = FALSE
The library keeps track of drive cycles and warm-up cycles based on calls by the application
to the pdtc_Control block.
Detection of warm-up and DTC ageing in the Previously Active state is not as straightforward
as it might at first appear. OBD regulations (in particular CARB and European regulations)
define "drive cycles" unambiguously, but are less clear on the definition of a "warm-up cycle".
It has therefore been necessary to adopt an interpretation which is believed to be the most
stringent possible interpretation, so that regulatory compliance can be assured. Regulations
The OpenECU interpretation of a warm-up cycle is "an ignition cycle in which a warm-up (as
reported by the customer) occurs". The test causing a DTC to be raised must also run and
pass during the same ignition cycle in which the warm-up occurs, in order for the DTC to be
aged by one warm-up count. The following diagram describes scenarios which illustrate how
this will work in an application.
A B C DE F G H J K L M
Power cycle
At points A and B a test has not been run and passed in the same warm-up cycle, so the
warm-up count is not incremented.
At point C the warm-up has not yet occurred when the test is run and passed, so the warm-
up count is not incremented. At point D the warm-up occurs, and as a result of the test having
been previously run and passed, the warm-up count is incremented. Further instances of
the test running and passing during this ignition cycle (E) do not affect the warm-up count,
because this is required to count warm-ups and not test executions.
At point F the test is run and passed when the warm-up has already occurred, so the warm-up
count is incremented immediately. Further instances of the test running and passing during
this ignition cycle (G) again do not affect the warm-up count.
Due to power-hold relays, capacitors or other system behaviour, the ECU may not lose power
when the ignition is cycled. Points H and J illustrate that tests carried out on subsequent
ignition cycles with warm-ups will increment the warm-up count, even if the ECU has not
been powered off. Point K illustrates that the requirement for test run and warm-up remains.
Tests may also be required to take place during the power-hold period. Point L illustrates that
the warm-up count will be incremented during the power-hold period if a warm-up cycle has
previously taken place this ignition cycle. Point M illustrates that the requirement for warm-
up still exists during the power-hold period.
Note that this diagram does not mention drive cycles, as these are calculated independently
and do not affect warm-up (except insofar as they are based on conditions arising in the same
vehicle). Note also that the diagram does not mention warm-ups reported with the ignition
off, because the regulatory definition of a warm-up requires the engine to be on (and hence
the ignition to be on).
Changes to DTC states are written to non-volatile storage when block Section 6.1.40, “DTC
memory update (pdtc_Memory)” is invoked with a request for commit to storage. This will
typically occur on shutdown and at periodic intervals during execution. If DTCs have not
changed since the last write to non-volatile storage, invocation of the block Section 6.1.40,
“DTC memory update (pdtc_Memory)” has no effect, maximising the lifespan of non-volatile
storage.
If the DTC cannot be recalled from non-volatile memory (which includes the first time the
ECU is powered up), then the library initialises the DTC as follows:
8.7.7.4. Inports
• test_failed
Range: 0 or 1
• test_completed
Set to 1 if the test has been completed for this DTC (can be hardwired to 1 for a continuously
monitored DTC).
Range: 0 or 1
8.7.7.5. Outports
• state
Set to the value of the current DTC state (see the DTC states descriptions for a list of
states and values).
• count
A count of the number of times a J1939 DTC has changed to the active state. Available
only if the parameter DTC type is J1939 DTC, and currently not supported by the platform-
controlled fault handling.
Range: [0, 127] counts - 0 to 126 (The value 127 is reserved for indicating not available).
• dc_count
Drive cycle count. The number of drive cycles to 'debounce' the DTC state before setting
it to active. This is exported for information only, as the platform is responsible for
progressing the state machine.
• wu_count
Warm-up cycle count. The number of warm-up cycles in which the DTC has not failed -
used to 'heal' faults that are no longer present. This is exported for information only, as the
platform is responsible for progressing the state machine.
• DTC name
An optional name can be given to a DTC to identify it for calibrating the ID parameters. If no
name is given, it will be allocated a name when the model is built. Note that this allocated
name can change between builds, so should not be use for calibration. If a DTC will need
to be calibrated, it should be explicitly named.
Generation of DDE entries for DTCs needs to be enabled. See Configuration options for
more details.
The name of the DTC table to store this DTC in (there must be a corresponding named
table specified in a pdtc_Table block in the model).
• DTC type
The value of the SPN for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC. Available only if the
parameter DTC type includes J1939 DTC.
The value of the FMI for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC. Available only if the
parameter DTC type includes J1939 DTC.
• Conversion method
The value of the CM for this DTC. The parameters Suspect parameter number, Failure
mode indicator and Conversion method uniquely identify the DTC. Available only if the
parameter DTC type includes J1939 DTC.
Range: 0 or 1
• ISO ID
The value of the ID for this DTC. This ID uniquely identifies the DTC. Available only if the
parameter DTC type includes ISO DTC.
A drop-down selection of the emissions severity level at which a DTC fits. This allows the
modeller to combine "emissions related" and other DTCs within the same system.
A drop-down selection of the UDS service $19 severity level for the DTC. Available only
if the parameter DTC type includes ISO DTC.
• MIL action
The action for the Malfunction Indicator Lamp when this DTC is active.
• RSL action
The action for the Red Stop Lamp when this DTC is active.
• AWL action
The action for the Amber Warning Lamp when this DTC is active.
• PL action
The action for the Protection Lamp when this DTC is active.
• Permanent
Whether or not this DTC is considered 'permanent' (as defined by CARB/EPA) when the
DTC is active. If the ECU is intended to comply with CARB, this should be selected for
all DTCs that light the MIL.
Available only if the parameter Permanent is true. CARB requires that for permanent DTCs,
an OBD clear request does not immediately clear the DTC; instead the DTC may only be
cleared when the ECU has verified that the fault is no longer present.
If this option is unselected, vehicle/operating conditions are not required. The test for this
DTC must have been completed and report no fault existing since the OBD clear request
was received. At the end of the drive cycle in which the test for this DTC is run, the DTC
is cleared as per a normal OBD clear request.
CARB requires that this option is selected for DTCs relating to specific monitors, and
optionally may be selected for DTCs relating to other monitors.
• Non-erasable
The number of drive cycles for which the fault condition must be present before this DTC
automatically transitions from Pending to Active. By default, this parameter is set to 1 (as
recommended by the CARB regulations).
The number of drive cycles for which the fault condition must be absent before this DTC
automatically transitions from Active to Previously Active. By default, this parameter is set
to 3 (as recommended by the CARB regulations).
Whether or not this DTC uses elapsed engine running time for it to transition from Active
to Previously Active.
The value of the elapsed engine running time for the DTC to transition from Active to
Previously Active Available only if the parameter DTC de-activate using engine running
time is checked.
Whether or not this DTC uses warmup cycles for it to transition from Previously Active to
Clear.
The number of warm-up cycles for which the fault condition must be absent before this
DTC automatically transitions from Previously Active to Clear. By default, this parameter
is set to 40 (as recommended by the CARB regulations). Available only if the parameter
DTC clear using warmup cycles is checked.
Whether or not this DTC uses elapsed engine running time for it to transition from
Previously Active to Clear.
The value of the elapsed engine running time for the DTC to transition from Previously
Active to Clear. Available only if the parameter DTC clear using engine running time is
checked.
The amount of time until the derate will occur, should this DTC become active. Available
only if the parameter Has torque derate is checked.
A reference to the name of the frame frame to capture is entered here (see
pff_FreezeFrame for specifics).
8.7.7.7. Notes
None.
Optionally, values are output required to support EuroVI MIL activation and to populate
messages with MIL and B1-severity fault time counter values.
8.7.8.3. Description
mil _ status
rsl_ status
Sample time :
awl_ status
pl _ status
pdtc_ Status
Each DTC in the system can specify which (if any) warning lamps are to be lit or flashed
when they become active. This block reports the required states of these lamps. The relative
priorities of the lamp states are (from highest to lowest) continuously on, fast flash, slow flash,
and off. The highest priority lamp state of all of the active DTCs is indicated by this block.
8.7.8.4. Inports
None.
8.7.8.5. Outports
• mil_status
Indicates the state of the Malfunction Indicator Lamp, taking into consideration the states
of all DTCs in the system.
• rsl_status
Indicates the state of the Red Stop Lamp, taking into consideration the states of all DTCs
in the system.
• awl_status
Indicates the state of the Amber Warning Lamp, taking into consideration the states of all
DTCs in the system.
• pl_status
Indicates the state of the Protection Lamp, taking into consideration the states of all DTCs
in the system.
• mi_actv_mode
Range: [0, 3] (0 is mode 1/no fault, 1 is mode 2/class C, 2 is mode 3/class B1 < 200hr, 3
is mode 4/class A or B1 > 200hr)
Calibratable: No
• mil_cumulative
The total time for which the MIL has been active with the engine running. (This outport is
only shown if the "Show EuroVI outputs?" option is checked.)
• b1_cumulative
The total time for which any B1 severity DTC has been active with the engine running. This
corresponds to the "System Greatest B1 Counter" in SAE J1939-73 DM39. (This outport
is only shown if the "Show EuroVI outputs?" option is checked.)
• b1_continuous
The current time for which any B1 severity DTC has been active with the engine running.
This counter is reset if no B1 fault is active for three engine cycles. This corresponds to
the "Single B1 Counter" in UN_ECE Regulation 49 Addendum 48 Rev 4. (This outport is
only shown if the "Show EuroVI outputs?" option is checked.)
Whether to set additional outports to EuroVI-related values concerning MIL activation and
MIL/B1 time counters.
• Sample time
8.7.8.7. Notes
None.
8.7.9.3. Description
dtc_ match
Table :
dtc_ count
pdtc_ MatchExists
Given a DTC table, determine the existence of DTCs which match the block parameters
DTC type, DTC emissions severity and DTC state. Indicate the existence, or otherwise via
an output flag and a count.
8.7.9.4. Inports
None.
8.7.9.5. Outports
• dtc_match
Set to 1 if at least one DTC exists, in the DTC table, that matches the criteria. Set to 0,
otherwise.
• dtc_count
Set to the number of DTCs, in the DTC table, that match the criteria.
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
• DTC type
A drop-down selection of the type of DTCs to match in the DTC table (specified by
parameter DTC table identifier).
A drop-down selection of the emissions severity of the DTCs to match in the DTC table
(specified by parameter DTC table identifier).
If this option is checked, the block will attempt to match DTCs that have an emissions
severity greater than or equal to the DTC emissions severity. Otherwise, the block will
attempt to match DTCs that have an emissions severity equal to the DTC emissions
severity.
• DTC state
A drop-down selection of the state of the DTCs to match in the DTC table (specified by
parameter DTC table identifier).
Calibratable: No
• Sample time
8.7.9.7. Notes
None.
See Section 6.1.40, “DTC memory update (pdtc_Memory)” for a detailed description.
See Section 6.1.41, “DTC table definition (pdtc_Table)” for a detailed description.
8.7.12.3. Description
Table :
cleared
Sample time : seconds
pdtc_ TableCleared
8.7.12.4. Inports
None.
8.7.12.5. Outports
• cleared
Indication of whether the table's DTCs have been cleared since the block's previous
execution. The value corresponds to which (if any) DTCs have been cleared since the last
execution.
Note
The KWP/UDS service $14 value is set regardless of the groupOfDTC parameter
requested, even if that means only a subset of DTCs were actually cleared.
The name of the DTC table to monitor (there must be a corresponding named table
specified in a pdtc_Table block in the model).
• Sample time
The periodicity of the block execution. The sample time must be set explicitly - the block
cannot be set to inherit a sample time from its parent. As the block's outport value is
valid only until its next execution, the sample time should be sufficient for the value to be
processed before this occurs.
8.7.12.7. Notes
None.
8.7.13.3. Description
Enabled : off
Severity Threshold :
None
piso_ Configuration
The ISO messaging protocol is a CAN based messaging system designed to pass information
between vehicle network ECUs in real-time. The platform software handles communication
with an external test tool using ISO 15765-2 based protocols (J1979, Keyword Protocol
2000-3, and ISO 14229-1 UDS).
There is support in the blockset for diagnostic trouble codes (see Section 4.6.6, “Fault
support”).
The diagnostic services supported are drawn from three standards: SAE J1979 (ISO
15031-5, "OBD2"), Keyword Protocol 2000-3 (ISO 14230-3) and Unified Diagnostic Services
(UDS, ISO 14229-1). They all work in the same way, with the first byte of each request
message indicating the required service. Some services are the same (or compatible) in
KW2000-3 and UDS. For a list of supported services, see the Extended Diagnostic Functions
section.
The piso_Configuration block configures the ECU's behaviour when handling ISO messages.
This includes selecting which CAN bus for ISO messaging, specifying the transmit and
receive message IDs, as well as other parameters that adjust the amount of memory set
aside for processing ISO messages.
If a piso_Configuration block is not present in the model, or if it is but the Enable ISO
diagnostics parameter is not set, then ISO support is disabled.
8.7.13.4. Inports
None.
8.7.13.5. Outports
None.
• Transmit message ID
The unique CAN identifier for the ISO messages transmitted by the system.
For standard OBD, ISO 15765-4 requires a value in the hex range 7E8 to 7EF for 11-bit
IDs (the value being the physical receive ID plus 8), or 18DAF1xx for 29-bit IDs, where xx
is the ECU 'source address' in J1939 terms.
• Extended transmit ID
Calibratable: No
• Receive message ID
The unique CAN identifier for the ISO messages received by the system.
For standard OBD, ISO 15765-4 requires a value in the hex range 7E0 to 7E7 for 11-bit
IDs (the value being the physical response ID minus 8), or 18DAxxF1 for 29-bit IDs, where
xx is the ECU 'node address' in J1939 terms.
• Extended receive ID
The global CAN identifier for ISO messages received by all participating ECUs in the
vehicle.
For standard OBD, ISO 15765-4 requires a value of 7DF hex for an 11-bit ID system or
18DB33F1 for a 29-bit ID system.
The ECU reprogramming session expects a value of 7DF hex to be used. If a different
value is specified by the application and the tester, reprogramming operations may not
function as expected.
The number of bytes for the ISO receive message buffer. This parameter allows the
modeller to reduce the amount of RAM allocated to ISO messages, and therefore increase
the RAM allocated to other functions of the ECU.
The number of bytes for the ISO transmit message buffer. This parameter allows the
modeller to reduce the amount of RAM allocated to ISO messages, and therefore increase
the RAM allocated to other functions of the ECU.
A drop-down selection of the emissions severity level at which a DTC should be considered
"emissions related". This allows the modeller to combine "emissions related" and other
DTCs within the same system.
PIDs for automatic periodic sending must be in the 0xF2nn identifier range. Of those,
this parameter is the maximum number that the platform will allow to be simultaneously
requested by the test tool for automatic periodic transmission while the application is
running via UDS service $2A. Leave at zero if service $2A support is not required, to save
RAM.
The "fast" target rate for PIDs requested for automatic transmission via UDS service $2A
in milliseconds. The "medium" rate is 2x this period, and the "slow" rate is 4x this period.
The platform will send PIDs more slowly than the target rate if this target cannot be met
due to the PID size and transport protocol delays.
The number of internal buffer slots allocated for the construction of dynamically-defined
PIDs via UDS service $2C. If necessary one large PID definition may straddle several
internal buffers. Leave at zero if service $2C support is not required, to save RAM.
If checked, this option allows the user to override the standard message response to J1979
service requests $03, $07 and $0A. Note that this override option should only be used in
exceptional circumstances where it is understood that the resultant message responses
will deviate from the J1979 standard.
• Service$03 response
A drop-down selection of the override to apply to a J1979 service request $03 response.
Only available if the Override J1979 standard? parameter is checked. Note that the
platform also provides a calibration to override the response at runtime.
• Service$07 response
A drop-down selection of the override to apply to a J1979 service request $07 response.
Only available if the Override J1979 standard? parameter is checked. Note that the
platform also provides a calibration to override the response at runtime.
• Service$0A response
A drop-down selection of the override to apply to a J1979 service request $0A response.
Only available if the Override J1979 standard? parameter is checked. Note that the
platform also provides a calibration to override the response at runtime.
8.7.13.7. Notes
None.
8.7.14.3. Description
Security : off
inhibit _ reprogramming
pdg_ Permissions
Certain UDS/KWP2000 services can be restricted to protect your ECU from having
unauthorised changes or having its contents read out over the diagnostic link.
The relevant services can either be completely disallowed, or allowed only if the required
seed-key security exchange has been passed successfully. (The options are detailed below.)
Even if flash reprogramming via UDS is allowed, you may wish to disable this facility if
run-time circumstances are not appropriate (e.g. vehicle moving or engine running). The
'inhibit_reprogramming' inport allows you to control whether reprogramming is permitted at
run time.
8.7.14.4. Inports
• inhibit_reprogramming
8.7.14.5. Outports
None.
If enabled, the platform will attempt to use a C code function that implements your own
custom security algorithm, whenever it receives the SecurityAccess ($27) service request
from the tool. The security algorithm is also used in programming mode (i.e. by the boot
loader) so that access to the ECU can be controlled even if the application has been erased,
for subsequent programming attempts.
See Notes section at the end of this block help for more detail on how to implement the
security function.
Used to control whether UDS protocol flash reprogramming of the application code and/or
calibration is allowed at all, and if so what SecurityAccess must be achieved first (if any).
The options are:
This parameter only becomes visible if Allowed if specified security level(s) attained is
selected above. Specify one or more values of the seed-key security level (LEV_SAT_RSD
in the UDS standard) at which flash programming should be permitted. The levels must be
odd values as used in the requestSeed request. (The corresponding level in the sendKey
message is an even number equal to LEV_SAT_RSD + 1.)
• ReadMemoryByAddress
This is very similar to the parameter which selects the allowed access for UDS
flash reprogramming, but this time controls access to ECU memory via the
ReadMemoryByAddress service ($23). See above for options.
This is just like the corresponding parameter for flash reprogramming described in detail
above, but this time relevant to ReadMemoryByAddress.
8.7.14.7. Notes
You must implement your own security function to use seed-key security; it is not supplied
by Pi Innovo, because it will be specific and confidential to you. The function must be written
such that it does not depend on any statically allocated variables and does not call any
functions, including functions inserted by the compiler for math utilities for example. This is
to ensure that it is fully relocatable, which is required for it to run as part of the boot loader
in reprogramming mode, as well as in normal application mode.
To add your function to the build, place the C file alongside the model, and then instruct RTW
to include it in the build by using the Custom Code... Include list of additional:... Source files
option, alongside other model configuration and build options in the Code Generation/Real-
Time Workshop section (the exact menu item depends on MATLAB version).
Alternatively, you can compile your C code to make an object (.o) file and specify it in
the Libraries option nearby. This is useful if you wish to be cautious with confidentiality by
avoiding application-builders needing to have the C source code available.
Warning
If the auto-coder settings are switched, e.g. from Simulink Coder to Embedded Coder,
this setting will need to be reconfigured.
The function name for the security algorithm and the second empty function that marks the
end of it are fixed. If they are missing, a linker error will be reported. A complete example
block of code is presented below, in which the "secret" algorithm is to reverse the order of
the two seed bytes to form the correct key:
#include "openecu.h"
/*****************************************************************************
* Purpose: Called by the library when UDS/KW2000 diagnostic security access
* is required.
* Returns: Return code to send to tool on error, otherwise zero if OK.
* Notes: Code is copied to nonvolatile memory and must be relocatable. It
* must not call any functions (including compiler arithmetic
* utilities).
*****************************************************************************
*/
U8 psc_diag_security_callback
(
const U8* pdgf_request_message, /* The received unpacked request message */
U16 pdgf_request_message_len, /* Total byte length of request message */
U8* pdgf_seed_buffer, /* Place seed here, or access it when computing correct key */
U8* pdgf_seed_len, /* Specify your seed length (in bytes) here (max 8 bytes) */
U32 pdgf_random /* Pseudorandom number you may use to generate seed */
)
{
if (pdgf_request_message_len < 2)
{
return 0x13; /* invalid length */
switch (pdgf_request_message[1])
{
case 0x03: /* a requestSeed value we choose to support */
/* Set up the seed bytes, here using the provided random number */
pdgf_seed_buffer[0] = (U8) pdgf_random & 0xff;
pdgf_seed_buffer[1] = (U8) (pdgf_random >> 8);
*pdgf_seed_len = 2;
return 0;
break;
case 0x04: /* corresponding sendKey value */
if ((pdgf_request_message_len == 4) &&
(pdgf_request_message[2] == pdgf_seed_buffer[1]) &&
(pdgf_request_message[3] == pdgf_seed_buffer[0]) )
{
/* security passed -- bytes reversed! */
return 0;
}
else
{
return 0x35; /* invalid key */
}
break;
default:
return 0x12; /* unsupported parameters */
break;
}
}
/*****************************************************************************
* Purpose: Marks the end of the security function above.
* Returns: None.
* Notes: Must be placed immediately after the security function. The
* platform uses this to calculate the size of the security function
* when relocating it to non-volatile memory for use in
* reprogramming mode.
*****************************************************************************
*/
void psc_diag_security_end
(
void
)
{
}
8.7.15.3. Description
None
pdg_ ExtendedDataRecord
Extended data records convey status information associated with a DTC. The information
is retrieved at the time of the request. This block allows the assignment of
8.7.15.4. Inports
None.
8.7.15.5. Outports
None.
If enabled, the platform will report a one byte extended data record containing the DTC
occurrence count.
Range: [1,239]
If enabled, the platform will report a one byte extended data record containing the number
of drive cycles in which the test has failed. The record is only available when the DTC is
pending.
This field specifies the DTCExtendedDataRecordNumber that is used to identify the count
of drive cycles in which the test has failed.
Range: [1,239]
If enabled, the platform will report a one byte extended data record containing the number
of drive cycles since the last test failure. The record is only available when the DTC is
active.
Range: [1,239]
• Report total warm up cycles in which the fault has not been present
If enabled, the platform will report a one byte extended data record containing the number
of warm-up cycles in which the fault has not been present. The record is reset upon the
DTC state transition to the previously active state.
Range: [1,239]
If enabled, the platform will report a two byte extended data record containing the total time
(resolution 1min/bit) left until derate will occur. The record is only available while the DTC
is in the active state and the DTC attribute 'has-torque-derate' is true.
This field specifies the DTCExtendedDataRecordNumber that is used to identify the total
time left until derate will occur.
Range: [1,239]
Calibratable: No
If enabled, the platform will report a two byte extended data record containing the total time
(resolution 0.2hr/bit) that the DTC has been in the previously active state.
This field specifies the DTCExtendedDataRecordNumber that is used to identify the total
time that the DTC has been in the previously active state.
Range: [1,239]
If enabled, the platform will report a two byte extended data record containing the total time
(resolution 0.2hr/bit) that the DTC has been in the active state.
This field specifies the DTCExtendedDataRecordNumber that is used to identify the total
time that the DTC has been in the active state.
Range: [1,239]
If enabled, the platform will report a two byte extended data record containing the total time
(resolution 0.2hr/bit) that the engine has been running while the DTC's fault has not been
present and the DTC has been in the 'active' or 'previously active' state.
This field specifies the DTCExtendedDataRecordNumber that is used to identify the total
time that the engine has been running while the DTC has been in the 'active' or 'previously
active' state.
Range: [1,239]
8.7.15.7. Notes
None.
8.7.16.3. Description
routine _ ready
routine _ running
Routine Name : pdg _ RoutineControl
Routine ID : 0 decimal
results_ valid RCOR Length : 0 bytes
Timed Routine : off routine _ request
results Results Length : 0 bytes
Status Record Length : 0 bytes
Provide Simulation Input : on
status_ record
pdg_ RoutineControl
Routines can be used to allow a diagnostic tool to perform a custom function within the ECU.
For example, a function of the ECU can be started and stopped from the diagnostic tool, or
a set of values can be written to or read from ECU memory. The actual routine is defined
by the application software.
8.7.16.4. Inports
• routine_ready
Flag from the application to inform the platform that the routine is able to run. If this inport
is FALSE, the platform will send a negative response to the diagnostic tool if this routine
is requested, and the routine_request outport will output noRequest.
• routine_running
Flag from the application to inform the platform that the routine is running.
• results_valid
Flag from application to inform the platform that the data supplied at results inport is valid
(i.e. the routine has been run at least one time, and the results are considered valid by the
application.) If results are not used for this routine,set Results Length to 0 in the dialog,
and ground this inport.
• results
This is the array of bytes that will be transmitted to the diagnostic scan tool when service
0x31 is requested with subfunction 0x03 (requestRoutineResults) AND results_valid is
TRUE. If results will not be used, set Results Length to 0 in the dialog, and ground this
inport.
• status_record
This is an optional array of bytes that will be transmitted to the diagnostic scan tool in
response to any service 0x31 request. If a status record is not used, set Status Record
Length in the dialog to 0 and ground this inport.
• sim_routine_request
This inport is only used in simulation and only appears if Provide Simulation Input is ticked
in the dialog. During simulation, any value supplied to this inport is immediately copied to
the routine_request outport.
Value type: U8
• sim_rcor
This inport is only used in simulation and only appears if Provide Simulation Input is ticked
in the dialog. During simulation, any array supplied to this inport is immediately copied to
the rcor outport.
8.7.16.5. Outports
• routine_request
Indicates the routine request sub-function that was received from the diagnostic scan tool.
Note: the received routine request sub-function will only be output for one sample.
Value type: U8
• rcor
• Routine ID
A unique routine ID that will be used by the diagnostic tool to identify this routine. Note:
routine IDs 0x0202, 0x0203, 0xFF00, and 0xFF01 are reserved by the platform and cannot
be used by the application.
• RCOR Length
Defines the number of bytes in the optional routineControlOptionRecord byte array. Set to
0 if the routine does not use a routineControlOptionRecord.
• Timed Routine
If ticked, this routine is a "Method B" (timed) routine, and will therefore stop on its own
(without a stopRoutine request). If unticked, this routine is a "Method A" (untimed) routine,
which requires a stopRoutine request to stop the routine. See ISO 14229-1 section 13 for
further details regarding Method A vs. Method B routines.
Even if ticked, the routine must handle a stopRoutine request to allow the diagnostic tool
to stop the routine if necessary.
• Results Length
Defines the number of bytes in the results array. Set to 0 if the routine does not use results.
Defines the number of bytes in the optional statusRecord array. Set to 0 if the routine does
not use a statusRecord.
If ticked, two additional inports will be revealed. See sim_routine_request inport and
sim_RCOR for further details.
• Sample Time
Defines the sample time that this block will use to check for incoming routine requests, and
update outports. Must be a multiple of 0.001.
8.7.16.7. Notes
Negative response codes to service $31 requests are handled automatically by the platform
software. The following list gives the possible negative response codes and the situations
in which they are sent.
• conditionsNotCorrect (0x22): sent when the diagnostic tool sent a startRoutine request
when routine_ready is FALSE.
2) The diagnostic tool sends a startRoutine command for a routine that is already
running.
3) The diagnostic tool sends a stopRoutine command for a routine that is not running.
• requestOutOfRange (0x31): This negative code can occur if one of the following two
situations occur:
1) The diagnostic tool sends a service $31 request for a routine ID that is not supported
by the application or the platform.
2) The diagnostic tool sends a service $31 request with the the number of bytes in
the optional routineControlOptionRecord that is different from what is defined in the
RCOR Length dialog parameter.
1) If the application specifies that the routine is ready AND a startRoutine request is received
from the tool, the application MUST start the routine. Otherwise, the routine state machine
will stay in the RoutineRequested state until a stopRoutine request is received for the same
routine ID. Furthermore, the routine must be started within the amount of time to allow the
response message to be transmitted within 1000 ms of when the diagnostic tool sent the
request.
2) If a stopRoutine request is received from the diagnostic tool, the application MUST stop the
routine. Otherwise, the routine control state machine will stay in the RoutineSopping state.
Furthermore, the routine must be stopped within the amount of time to allow the response
message to be transmitted within 1000 ms of when the diagnostic tool sent the request.
Some routines are handled by the platform without any input from the application. These
routines have routine IDs that may not be used by the application. The reserved routine IDs
are: 0x0202, 0x0203, 0xFF00, and 0xFF01.
8.7.17.3. Description
pid _ bytes
app_ bytes
override_ status
ppid _ Pid
A PID is used to access the current value of an application parameter by a diagnostic scan
tool. The access includes reading the parameter and if enabled over-riding the parameter.
If the parameter is a non-volatile PID, this value can be written to non-volatile memory, and
retained across power cycles.
8.7.17.4. Inports
• app_bytes
Application supplied data which is to be accessed by a diagnostic scan tool via the
associated PID.
• write_to_nv
Flag from application to write the data supplied at app_bytes to non-volatile memory. The
memory write is triggered on a rising edge. This inport is only active when the Non-volatile
storage parameter is ticked.
8.7.17.5. Outports
• pid_bytes
When the PID data is being overridden at the request of the diagnostic scan tool, this
outport gives the override data. When not overridden, this outport just copies what is
entered at the app_bytes inport. Note that the size and dimensions of this outport are
automatically set to match those of the app_bytes inport.
• override_status
• is_valid
Flag to indicate if the value read from a non-volatile PID is valid. The non-volatile PID
can be invalid, if it does not exist yet in non-volatile memory, as it has never been written
before. It can also be invalid if the previous size in bytes does not match the currently read
size. This flag indicates if the data in pid_bytes is valid. This outport is only active when
the Non-volatile storage parameter is ticked.
• num_cem_recvd
The number of controlEnableMask bytes received in the most recent $2F request from the
test tool. This outport is only active when the Number of controlEnableMask bytes expected
parameter has a non-zero value.
• cem_bytes
The controlEnableMask byte values received in the most recent $2F request from the
test tool. This outport is only active when the Number of controlEnableMask bytes
expected parameter has a non-zero value. Only the number of bytes indicated in the
num_cem_recvd signal are valid; the rest are zeroed.
• Non-volatile storage
If ticked indicates the PID's value is to be preserved across power cycles thus it is stored
in non-volatile memory
• J1979 (8 bit)
If ticked, this parameter is accessible using the SAE J1979 protocol. A numeric box is
unveiled upon ticking this box. In the unveiled numeric box enter the unique PID number.
This parameter is not available if the Non-volatile storage parameter is ticked.
• KWP (8 bit)
If ticked, this parameter is accessible using the Keyword 2000-3 protocol. A numeric box
is unveiled upon ticking this box. In the unveiled numeric box enter a unique PID number.
If ticked, this parameter is accessible using the ISO 14229-1 (UDS) protocol. Two additional
parameters are unveiled upon ticking this box. In the unveiled numeric box enter the unique
PID number. Tick the unveiled "ReadScalingByIdentifier (UDS $24) support" box if UDS
$24 support is required. If this box is ticked, more options are unveiled: see below following
"Resend input as output". NOTE: If ticked, the PID data is not altered in any way by the
PID block. The UDS $24 scaling data is only used to describe the scaling done by the
application prior to the PID block so the diagnostic tool can properly decode the data.
• J1939 (SPN)
If ticked indicates the PID represents a J1939 Suspect Parameter Number. A numeric box
is displayed upon ticking this box. In the displayed numeric box enter the unique SPN
number. Note that this parameter is only currently used to allow freeze frame data to be
stored for a J1939 DTC, and to allow reading from and writing to non-volatile memory.
• Alphanumeric?
This checkbox is only displayed when the J1939 (SPN) checkbox is ticked. It determines
the format in which the SPN data is transmitted. If ticked, the SPN data is treated as
alphanumeric data with most significant byte transmitted first; otherwise it is transmitted
with least significant byte first.
• String PID
If ticked indicates a string PID. A box to enter the string is displayed upon ticking this box.
The entered string needs to be enclosed with single apostrophes. Note when using a string
PID with non-volatile memory, the value of the string will only be written during initialisation.
• Allows IOControl
If ticked allows the diagnostic scan tool to override the PID. Leave unticked to deny the
diagnostic scan tool the ability to override the PID. Not applicable for non-volatile PIDs.
For a PID value which is being overridden by a diagnostic scan tool, two options exist for
what value to report back to the diagnostic scan tool in response to a read data by identifier
($22) command. Not applicable for non-volatile PIDs.
If set to a non-zero value, the PID will accept additional input bytes as part of a $2F service
request, and these are assumed to be controlEnableMask bytes. These are made available
via the outports num_cem_recvd and cem_bytes.
Part of ReadScalingByIdentifier support. Enter the number of data bytes that will be stored
by this PID. This is the number of data bytes of the PID data, NOT the number of scaling
bytes.
Part of ReadScalingByIdentifier support. This field will be unveiled if the "Scaling Data
Type" drop-down is set to "F: Manually enter scaling bytes". This field allows the user to
manually specify all of the scaling bytes that will be sent by the test tool. Scaling bytes
must be entered as a comma-separated list of decimal integers from 0 to 255.
Part of ReadScalingByIdentifier support. This read-only field displays the scaling bytes that
will be transmitted when service $24 is requested.
8.7.17.7. Notes
Certain PIDs are handled by the platform and should not be defined by the application using
this block. In particular, the J1979 standard defines PIDs $00, $20, $40, etc. to be bitfields
defining what other PIDs are supported in various contexts. These PIDs are handled directly
by the platform in response to the different J1979 service messages that request them.
Similarly, PID 0x02 is defined in the J1979 standard to identify the DTC that caused a freeze
frame to be stored, and since this also depends on the context (as to the identity of the freeze
frame in question) this too is handled directly by the platform.
8.7.18.3. Description
scaling/bit : 0
offset : 0
in raw
max : 0
min : 0
ppid _ Scaling
A PID value is usually stored in the ECU (server) in a finite number of bytes with an associated
scaling. This scaling is common to both the client (diagnostic scan tool) and server.
The scaling block has been added as an aid to encoding a PID value with a scaling. As such
it is envisaged that the output of this block will feed into the input of ppid_Pid. The scaling
applied by this block follows the form of raw = (in - Scaling offset )/ Scaling/bit
Note this block does not support multi-packed PIDs such as PID $01 of SAE J1979.
8.7.18.4. Inports
• in
8.7.18.5. Outports
• raw
Raw bytes output to represent the input with the scaling applied.
If ticked a drop down list of standard J1979 scalings is revealed. The scalings in the list
are as per Annex B of issue 7 of ISO15031-5 (SAE J1979).
• Scaling/bit
For example a value of 0.25 in this field would result in 4 being output (assuming the offset
is set to 0) from this block when the input is 1.
• Scaling offset
For example with a value of 0.25 set in the scaling/bit field and this field set to 0.5, would
result in 2 being output from this block when the input is 1.
• Max
Numeric field to enter the maximum value of the input. An input value exceeding the
maximum value is clipped to the maximum value prior to the scaling being applied.
• Min
Numeric field to enter the minimum value of the input. An input value falling below the
minimum value is clipped to the minimum value prior to the scaling being applied.
• Engineering Units
String field to the engineering units associated with the scaling. The string in this field
should be enclosed with single apostrophes.
A drop down list of the supported data types out. The supported data types are:
• uint8
• uint16
• uint32
8.7.18.7. Notes
None.
8.7.19.3. Description
Name :
pff_ FreezeFrame
A Freeze Frame is a snapshot of parameter values recorded at the time a diagnostic trouble
code (DTC) was captured.
Note: non-volatile PIDs are not supported in freeze frames. If a freeze frame is defined by
the application to contain a non-volatile PID, this PID is ignored by the PFF feature when
capturing or accessing the freeze frame data.
The following diagram mirrors the finite state machine for the fault state for a DTC (see
platform OBD state machine). In the diagram the transition conditions have been removed
to aid clarity. The diagram highlights the transitions that cause a freeze frame instance to
be captured and deleted.
Once captured, the freeze frame instance is stored in non-volatile memory. As depicted in
the diagram above, it is possible for multiple instances of a freeze frames associated with a
single DTC to be stored in non-volatile memory.
When a DTC's fault state transitions to "Cleared" all instances of stored freeze frames
associated with the DTC are deleted from non-volatile memory.
Note: The DTC occurrence count in the freeze frame may be out of sync when DTC becomes
Active
Freeze frame numbering is used by J1979 to report back to the scan tool the DTC that caused
freeze frame capture and to read back the stored freeze frame instance(s). Numbering of
freeze frame instances stored in non-volatile memory is sequential with the earliest captured
freeze frame numbered as 0. As per J1979 numbering of freeze frames has an upper limit
of 255.
Note: J1979 freeze frames are only captured for emissions related DTCs.
UDS snapshot freeze frames follow the same capture rules as other freeze frame types;
however, snapshots do not follow the same deletion rules. Snapshots captured as a result
of a particular DTC are still deleted when the associated DTC transitions to clear; however,
snapshots are not deleted when the DTC transitions from pending to previously active.
Snapshot storage gives preference to the first and the most recent occurrence of a particular
DTC. The snapshot captured as a result of the first occurrence of a DTC is assigned
DTCSnapshotRecordNumber 0. The snapshot captured as a result of the next occurrence
of a DTC is assigned DTCSnapshotRecordNumber 1 and is replaced upon subsequent
occurrences of the DTC.
Note: A maximum of 2 UDS snapshots per DTC are stored at any given time.
8.7.19.4. Inports
None.
8.7.19.5. Outports
None.
A unique freeze frame name is required in this field. The freeze frame name is referenced
in the Simulink block of the DTC (see pdtc_DiagnosticTroubleCodeExt) that triggers the
freeze frame.
Note the freeze frame name is used in the generated C code and as such should follow
the C variable naming convention.
If ticked indicates the freeze frame complies with the J1979 standard.
• PID(s) to capture
A vector calibration giving the list of PID identifiers for a J1979 freeze frame is placed in
this field. The vector calibration needs to be defined in the data dictionary. The value field
of the vector calibration in the data dictionary defines the PID identifers for the named
freeze frame. However, all freeze frames should be cleared and the ECU power cycled
after changing this calibration.
Note that PIDs that are not defined in the application may be listed in the PIDs to capture
field. The application will build, but the freeze frame may not behave as expected during
runtime.
Note that Non-volatile PIDs may be listed in the PIDs to capture field. The application will
build, but the freeze frame may not behave as expected during runtime.
Note that although no restriction is placed on when one may change this calibration, the
correct procedure is to clear all freeze frame information and power cycle the ECU after
any such change. Failure to follow this procedure could lead to anomalies in the freeze
frame handling.
• J1939 (DM4)
If ticked indicates the freeze frame complies with J1939's DM4 freeze frame definition.
The mandatory SPNs are given by J1939-73 (FEB2010) as 899, 102, 190, 92, 110 and
84. The mandatory SPNs for DM4 have been hardcoded into the platform. As such when
the OpenECU platform captures a DM4 freeze frame it always attempts to capture the
mandatory SPN(s) regardless of the presence or absence of the SPN in the application. A
mandatory SPN absent from the application will result in 0xFF(s) populating the data field
allocated for the absent mandatory SPN in the returned DM4 message.
• Manufacturer SPN(s)
The manufacturer's list of SPNs for a DM4 freeze frame are placed in this field. To enter the
list of manufacturer SPNs use a vector calibration. The values of the SPNs are calibratable.
However, all freeze frames should be cleared and the ECU power cycled after changing
this calibration.
A manufacturer SPN absent from the application will be ignored. The SPN will not be
saved to non-volatile memory when the DM4 freeze frame is captured. The SPN's data
will not appear in the returned DM message and no data fields within the returned DM4
are allocated to denote its presence.
• J1939 (DM25)
If ticked indicates the freeze frame complies with J1939's DM25 freeze frame definition.
As per J1939-73 only a single freeze frame definition can exist for DM25. The parameter
list is specified by pff_Dm25FreezeFrame.
• UDS (Snapshot)
If ticked indicates the freeze frame complies with the ISO 14229-1 (UDS) snapshot
definition.
• ISO PID(s)
A vector calibration giving the list of ISO PID identifiers for a snapshot is placed in this
field. The vector calibration needs to be defined in the data dictionary. The value field of
the vector calibration in the data dictionary defines the ISO PID identifiers for the named
freeze frame. However, all freeze frames should be cleared and the ECU power cycled
after changing this calibration.
8.7.19.7. Notes
It is possible to configure a single freeze frame block for both J1979 (freeze frame) and UDS
(snapshot). If this occurs, then the both the freeze frame and the snapshot will follow the
J1979 deletion rules.
8.7.20.3. Description
pff_ Dm 25 FreezeFrame
8.7.20.4. Inports
None.
8.7.20.5. Outports
None.
The list of SPN(s) for a DM25 freeze frame are placed in this field. To enter the list of
SPN(s) use a vector calibration. The values of the SPN(s) are calibratable.
A SPN absent from the application will be ignored. No data fields within the returned DM25
are allocated to denote its presence.
8.7.20.7. Notes
None.
8.7.21.3. Description
pff_ Configuration
Specifies the amount of volatile (RAM) and non-volatile (flash) memory allocated for freeze
frame storage.
8.7.21.4. Inports
None.
8.7.21.5. Outports
None.
This field specifies how much of non-volatile memory is allocated to storing instances
of freeze frames. The allocation will be exclusively used for freeze frame storage. An
appropriate size should be chosen to contain your application needs.
Captured freeze frames are stored in non-volatile memory using a file system. Each
captured freeze frame is stored in an individual file. There is an overhead associated with
each file stored in NVM. This overhead is 20 bytes plus whatever is required to round up
to a multiple of 8 bytes. Thus on a freeze frame of 100 bytes, the overhead would be 20
bytes, whereas on a freeze frame of 101 bytes, the overhead would be 27. This overhead
forms part of the total non-volatile memory allocation to store freeze frames, for instance if
the application stores 10 freeze frame files each consisting of a 100 bytes of data the total
NVM allocation specified here should be at least 1200 bytes.
• RAM buffer size for buffering freeze frame data prior to writing to NVM (bytes)
RAM is allocated statically (at build time) in OpenECU. The specified RAM buffer size is
used to store instances of freeze frames prior to writing to non-volatile memory. As such
this field should at a minimum equal or exceed the largest freeze frame data size of all
freeze frames in the application. Writing data to NVM is carried out in the background task
as it takes time to complete. Should your application need to capture multiple freeze frame
instances within a short interval this buffer should be sized appropriately to ensure the
freeze frames are successfully written to NVM.
Note: an under sized RAM buffer may result in freeze frame instances not being captured.
Note: DM4 and DM25 of J1939 specify a max freeze frame data size of 1785 bytes.
This field specifies an upper limit on how many captured J1979 freeze frame instances
can be stored in non-volatile memory (NVM).
This field specifies an upper limit to how many captured DM4 freeze frame instances can
be stored in non-volatile memory.
This field specifies an upper limit to how many captured DM25 freeze frame instances can
be stored in non-volatile memory.
This field specifies an upper limit to how many captured UDS snapshot instances can be
stored in non-volatile memory.
8.7.21.7. Notes
None.
8.7.24.3. Description
8.7.24.4. Inports
• sim_error_flag
• sim_transport_errors
• transmit
Range: 0 or 1.
Calibratable: No
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the response message (usually the source address of the
corresponding request). If use_dest_addr is false or a PDU2 message is shorter than 9
bytes, this value is ignored and the message is sent to the global address.
• use_dest_addr
Whether to send the DM to a specified destination address. If false (0), the message will
always be sent to the global address. Set to true (1) to allow the message to be sent to a
specific destination address, such as the source address of a PGN request.
Range: 0 or 1.
8.7.24.5. Outports
• error_flag
Set to 1 when the DM message could not be buffered for transmission, or if a previous
request to send a DM message has not completed.
• transport_errors
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
• DM Type
8.7.24.7. Notes
None.
See Section 6.1.52, “J1939 DM1 receive (pj1939_Dm1Receive)” for a detailed description.
See Section 6.1.53, “J1939 DM1 decode DTC (pj1939_Dm1DecodeDtc)” for a detailed
description.
See Section 6.1.54, “J1939 DM1 transmit (pj1939_Dm1Transmit)” for a detailed description.
See Section 6.1.55, “J1939 DM2 receive (pj1939_Dm2Receive)” for a detailed description.
See Section 6.1.56, “J1939 DM2 decode DTC (pj1939_Dm2DecodeDtc)” for a detailed
description.
See Section 6.1.57, “J1939 DM2 transmit (pj1939_Dm2Transmit)” for a detailed description.
8.7.31.3. Description
sim _ error_ flag
transmit
Channel : 0
priority
8.7.31.4. Inports
• sim_error_flag
• sim_transport_errors
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the DM4 message (This could be the source address of the
corresponding PGN request, or the global address (255) if the request was sent to the
global address). If use_dest_addr is false or a PDU2 message is shorter than 9 bytes, this
value is ignored and the message is sent to the global address.
• use_dest_addr
Whether to send the DM4 to a specified destination address. If false (0), the message will
always be sent to the global address. Set to true (1) to allow the message to be sent to a
specific destination address, such as the source address of a PGN request.
Range: 0 or 1.
8.7.31.5. Outports
• error_flag
Set to 1 when the DM4 message could not be buffered for transmission, or if a previous
request to send a DM4 message has not completed.
Calibratable: No
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.31.7. Notes
None.
8.7.32.3. Description
sim _ error_ flag
transmit
Channel : 0
Table : error_ flag
priority
obd _ compliance
pj 1939 _ Dm 5 Transmit
A J1939/73 DM5 message is a fixed length message transmitted by a network node to the
global network address. The DM5 message contents detail the diagnostic readiness data
(part 1). As the message is made up from data calculated and stored internally within the
platform, direct support is provided (rather than using the pj1939_PgTransmit block).
8.7.32.4. Inports
• sim_error_flag
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• obd_compliance
The OBD compliance that this controller/software combination meets (see J1939-73
section 5.7.5.3).
8.7.32.5. Outports
• error_flag
Set to 1 when the DM5 message could not be buffered for transmission, or if a previous
request to send a DM5 message has not completed.
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
8.7.32.7. Notes
None.
8.7.33.3. Description
Channel : 0
sim _ source _ addr TID : source _ addr
Sample time :
pj 1939 _ Dm 7 Decode
A J1939/73 DM7 message is a fixed length message. The purpose of a DM7 message is to
command tests or last measured test results. Direct blockset support is provided (rather than
relying on the pj1939_PgReceive block).
Refer to J1939-73 FEB2010 section 5.7.7 for details of the DM7 message.
8.7.33.4. Inports
• sim_test_commanded
8.7.33.5. Outports
• test_commanded
Set to 1 (true) if a DM7 message has been received containing a commanded test which
matches the Test identifier only (when parameter Test identifier is in the range [1, 64]) or
if a DM7 message has been received containing a commanded test which matches the
Test identifier and Suspect parameter number and Failure mode indicator parameters
(when parameter Test identifier is in the range [247, 250]). Note that this is a one-shot
pulse which will remain high only until the next block iteration.
• source_addr
• dest_addr
• J1939 Channel
The logical J1939 channel on which to receive the request. Must be a channel declared
with a pj1939_ChannelConfiguration block.
• Test identifier
The value of the TID of the commanded test to match against. In the case where a DM30
response is required, the parameters Suspect parameter number, Failure mode indicator
and Test identifier uniquely identify the commanded test. If a DM8 response is required
then only the Test identifier is needed.
The value of the SPN of the commanded test to match against. The parameters
Suspect parameter number, Failure mode indicator and Test identifier uniquely identify the
commanded test. Only applicable if the Test identifier parameter is in the range [247, 250].
A DM30 response is required when the requested DM7 test consists of a valid SPN/FMI/
TID combination.
The value of the FMI of the commanded test to match against. The parameters Suspect
parameter number, Failure mode indicator and Test identifier uniquely identify the
commanded test. Only applicable if the Test identifier parameter is in the range [247, 250].
A DM30 response is required when the requested DM7 test consists of a valid SPN/FMI/
TID combination.
• Sample time
8.7.33.7. Notes
None.
8.7.34.3. Description
sim_error_flag
sim_transport_errors
error_flag
transmit
Channel : 0
priority
transport_errors
test_id
dest_addr
use_dest_addr
pj1939 _Dm8Transmit
A J1939/73 DM8 message is a variable length message. The DM8 message contains the
test results corresponding to commanded tests received in DM7 messages (refer to the
pj1939_Dm7Decode block). Test results data is supplied internally by the platform via the
PPR feature (see the ppr_DiagnosticTestEntity block). As the message is variable in length
and contains data maintained internally by the platform, direct support for the DM8 message
is provided (rather than using the pj1939_PgTransmit block).
8.7.34.4. Inports
• sim_error_flag
• sim_transport_errors
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• test_id
The J1939 test identifier to use for obtaining test results to be transmitted in the DM8
message.
• dest_addr
J1939 destination address for the DM8 message (This could be the source address of the
corresponding PGN request, or the global address (255) if the request was sent to the
global address). If use_dest_addr is false or a PDU2 message is shorter than 9 bytes, this
value is ignored and the message is sent to the global address.
• use_dest_addr
Whether to send the DM8 to a specified destination address. If false (0), the message will
always be sent to the global address. Set to true (1) to allow the message to be sent to a
specific destination address, such as the source address of a PGN request.
Range: 0 or 1.
8.7.34.5. Outports
• error_flag
Set to 1 when the DM8 message could not be buffered for transmission, or if a previous
request to send a DM8 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.34.7. Notes
None.
8.7.35.3. Description
priority
pj 1939 _ Dm 10 Transmit
A J1939/73 DM10 message is a fixed length message transmitted by a network node to the
global network address. The DM10 message contains the list of non-continuously monitored
systems tests supported by the controller. The test identifier to bit position mapping is defined
in the DM10 bit position parameter of the ppr_DiagnosticTestEntity block. As the
message is constructed from data held within the platform, direct support for the DM10
message is provided (rather than using the pj1939_PgTransmit block).
8.7.35.4. Inports
• sim_error_flag
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
8.7.35.5. Outports
• error_flag
Set to 1 when the DM10 message could not be buffered for transmission, or if a previous
request to send a DM10 message has not completed.
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.35.7. Notes
None.
8.7.36.3. Description
sim _ error_ flag
error_ flag
sim _ transport_ errors
transmit Channel : 0
priority
transport_ errors
dest_ addr
pj 1939 _ Dm 20 Transmit
8.7.36.4. Inports
• sim_error_flag
• sim_transport_errors
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the response message (usually the source address of the
corresponding request).
8.7.36.5. Outports
• error_flag
Set to 1 when the DM20 message could not be buffered for transmission, or if a previous
request to send a DM20 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.36.7. Notes
None.
8.7.37.3. Description
sim _ error_ flag
transmit
priority
mil _ on _ time
mil _ on _ distance
dest_ addr
pj 1939 _ Dm 21 Transmit
A J1939/73 DM21 message is a fixed length message transmitted by a network node to the
specified destination address. The DM21 message contents detail the diagnostic readiness
data (part 2). Refer to J1939-73 Feb2010 section 5.7.21 for details. Direct support is provided
(rather than using the pj1939_PgTransmit block).
8.7.37.4. Inports
• sim_error_flag
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• mil_on_time
The accumulated count (in minutes) run by the engine while the MIL is activated. Refer to
J1939-73 Feb2010 section 5.7.21.3 for details. The platform will limit the transmitted value
to the range specified below.
• mil_on_distance
The distance travelled (in kilometres) while the MIL is activated. Refer to J1939-73
Feb2010 section 5.7.21.1 for details. The platform will limit the transmitted value to the
range specified below.
• time_since_dtc_clear
The engine running time (in minutes) accumulated since emission related DTCs were
cleared. Refer to J1939-73 Feb2010 section 5.7.21.4 for details. The platform will limit the
transmitted value to the range specified below.
• dist_since_dtc_clear
The distance accumulated (in kilometres) since emission related DTCs were cleared. Refer
to J1939-73 Feb2010 section 5.7.21.2 for details. The platform will limit the transmitted
value to the range specified below.
• dest_addr
J1939 destination address for the response message (usually the source address of the
corresponding request).
8.7.37.5. Outports
• error_flag
Set to 1 when the DM21 message could not be buffered for transmission, or if a previous
request to send a DM21 message has not completed.
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.37.7. Notes
None.
8.7.38.3. Description
sim _ error_ flag
transmit
Channel : 0
priority
A J1939/73 DM24 message is a variable length message. It identifies which SPNs support
Data Streams, Scaled Test Results, and Expanded Freeze Frames (DM25).
The Data Stream SPNs are simply those ppid_Pid blocks with SPN IDs defined. The Scaled
Test Result SPNs are those defined in the ppr_DiagnosticTestEntity blocks. The DM25 SPNs
are specified by the calibration identified in the pff_Dm25FreezeFrame block.
Note: for Data Stream SPNs the application still has to create the message responses for
the corresponding PGNs itself, using the pj1939_PgTransmit block.
8.7.38.4. Inports
• sim_error_flag
• sim_transport_errors
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the DM24 message (This could be the source address of
the corresponding PGN request, or the global address (255) if the request was sent to the
global address). If use_dest_addr is false or a PDU2 message is shorter than 9 bytes, this
value is ignored and the message is sent to the global address.
• use_dest_addr
Whether to send the DM24 to a specified destination address. If false (0), the message will
always be sent to the global address. Set to true (1) to allow the message to be sent to a
specific destination address, such as the source address of a PGN request.
Range: 0 or 1.
Calibratable: No
8.7.38.5. Outports
• error_flag
Set to 1 when the DM24 message could not be buffered for transmission, or if a previous
request to send a DM24 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.38.7. Notes
None.
8.7.39.3. Description
sim _ error_ flag
transmit
Channel : 0
priority
8.7.39.4. Inports
• sim_error_flag
• sim_transport_errors
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the DM25 message (This could be the source address of
the corresponding PGN request, or the global address (255) if the request was sent to the
global address). If use_dest_addr is false or a PDU2 message is shorter than 9 bytes, this
value is ignored and the message is sent to the global address.
• use_dest_addr
Whether to send the DM25 to a specified destination address. If false (0), the message will
always be sent to the global address. Set to true (1) to allow the message to be sent to a
specific destination address, such as the source address of a PGN request.
Range: 0 or 1.
8.7.39.5. Outports
• error_flag
Set to 1 when the DM25 message could not be buffered for transmission, or if a previous
request to send a DM25 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.39.7. Notes
None.
8.7.40.3. Description
sim _ error_ flag
transmit
priority
A J1939/73 DM26 message is a fixed length message. The DM26 message contents detail
the diagnostic readiness data (part 3). Refer to J1939-73 Feb2010 section 5.7.26 for details.
Direct support is provided (rather than using the. pj1939_PgTransmit block).
8.7.40.4. Inports
• sim_error_flag
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the DM26 message (This could be the source address of
the corresponding PGN request, or the global address (255) if the request was sent to the
global address). If use_dest_addr is false or a PDU2 message is shorter than 9 bytes, this
value is ignored and the message is sent to the global address.
• use_dest_addr
Whether to send the DM26 to a specified destination address. If false (0), the message will
always be sent to the global address. Set to true (1) to allow the message to be sent to a
specific destination address, such as the source address of a PGN request.
Range: 0 or 1.
• engine_run_time
The time (in seconds), since key-on, that the engine has been running. Refer to J1939-73
Feb2010 section 5.7.26.1 for details. The platform will limit the transmitted value to the
range specified below.
• warmup_count_since_clear
The number of warm-up cycles since all DTCs were cleared. Refer to J1939-73 Feb2010
section 5.7.26.2 for details. The platform will limit the transmitted value to the range
specified below.
8.7.40.5. Outports
• error_flag
Set to 1 when the DM26 message could not be buffered for transmission, or if a previous
request to send a DM26 message has not completed.
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.40.7. Notes
None.
8.7.41.3. Description
sim _ error_ flag
transmit
Channel : 0
priority
dest_ addr
pj 1939 _ Dm 30 Transmit
8.7.41.4. Inports
• sim_error_flag
• sim_transport_errors
Calibratable: No
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• spn
The J1939 suspect parameter number to use for obtaining the test results to be transmitted
in the DM30 message.
• dest_addr
J1939 destination address for the response message (should usually be the source
address of the corresponding request, but the global address (255) if the request was sent
to the global address).
8.7.41.5. Outports
• error_flag
Set to 1 when the DM30 message could not be buffered for transmission, or if a previous
request to send a DM30 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
Together with the spn and Failure Mode Indicator (FMI), this identifies the specific test for
which results are required, to match the DTE values; or a special value of 246 (results for
all tests) or 247 (all results for specified SPN only).
Together with the spn and Test Identifier (TID), this identifies the specific test for which
results are required, to match the DTE values; or a special value of 31 if a TID of 246 or
247 is requested.
8.7.41.7. Notes
None.
8.7.42.3. Description
sim _ error_ flag
error_ flag
sim _ transport_ errors
Channel : 0
transmit
Table :
priority
transport_ errors
dest_ addr
pj 1939 _ Dm 32 Transmit
8.7.42.4. Inports
• sim_error_flag
• sim_transport_errors
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the response message (usually the source address of the
corresponding request).
Calibratable: No
8.7.42.5. Outports
• error_flag
Set to 1 when the DM32 message could not be buffered for transmission, or if a previous
request to send a DM32 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
8.7.42.7. Notes
None.
8.7.43.3. Description
8.7.43.4. Inports
• sim_error_flag
• sim_transport_errors
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the response message (usually the source address of the
corresponding request).
Calibratable: No
8.7.43.5. Outports
• error_flag
Set to 1 when the DM33 message could not be buffered for transmission, or if a previous
request to send a DM33 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.43.7. Notes
None.
8.7.44.3. Description
sim _ error_ flag
transmit
Channel : 0 error_ flag
priority
dest_ addr
pj 1939 _ Dm 34 Transmit
A J1939/73 DM34 message is a fixed length message transmitted by a network node to the
specified destination address. The DM34 message contents detail the status of the engine
operating in the NTE control areas for given pollutants such as NOx and PM. Direct support
is provided (rather than using the pj1939_PgTransmit block).
8.7.44.4. Inports
• sim_error_flag
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the response message (usually the source address of the
corresponding request).
8.7.44.5. Outports
• error_flag
Set to 1 when the DM34 message could not be buffered for transmission, or if a previous
request to send a DM34 message has not completed.
Calibratable: No
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.44.7. Notes
The platform requires that the status of the various NTE areas is updated by the application.
The pj1939_UpdateNteStatus block is provided for this purpose.
8.7.45.3. Description
sim _ error_ flag
start_ transmission
Channel : 0
force_ transmission
Table :
stop_ transmission
transport_ errors
priority
dest_ addr
pj 1939 _ Dm 35 Transmit
A J1939/73 DM35 message is a variable length message. The DM35 message contents
detail the transient fault status of diagnostic trouble codes. As the message is variable in
length, direct blockset support is provided (rather than relying on the pj1939_PgTransmit
block).
When the block executes, the DTC table is inspected for a change in transient fault status
of DTCs. If any differ since the last time the block executed, a DM35 message is sent (when
the minimum inter-message interval has elapsed). The purpose for this message is that
of troubleshooting intermittent wiring problems ("wiggle test"). Refer to J1939-73 Feb2010
section 5.7.35 for details of the transmission rate and options.
8.7.45.4. Inports
• sim_error_flag
• sim_transport_errors
• start_transmission
Set to 1 to start the transmission of DM35 messages. A rising edge on this inport causes
DM35 messages to be transmitted either until key-off or the stop_transmission inport is
set to 1.
Range: 0 or 1.
• force_transmission
Set to 1 to force the transmission of a DM35 message, regardless of whether any DTC
has a change of transient fault status.
Range: 0 or 1.
• stop_transmission
Range: 0 or 1.
• priority
Range: [0, 7]
Calibratable: No
• dest_addr
J1939 destination address for the response message (usually the source address of the
corresponding request).
8.7.45.5. Outports
• error_flag
Set to 1 when the DM35 message could not be buffered for transmission, or if a previous
request to send a DM35 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
Calibratable: No
8.7.45.7. Notes
None.
8.7.46.3. Description
sim _ error_ flag
transmit
priority
vnrw_ count
mil _ strategy
incomplete _ monitors
pj 1939 _ Dm 36 Transmit
8.7.46.4. Inports
• sim_error_flag
• transmit
Range: 0 or 1.
Calibratable: No
• priority
Range: [0, 7]
• vnrw_count
• continuous_mil
A code indicating whether one or more systems or components requires that the MIL be
steady (continuous) burning. Refer to J1939-73 Feb2010 section 5.7.36.2 for details.
Range: [0, 3]
• mil_strategy
A code indicating whether any system is configured to employ a discriminatory MIL display.
Refer to J1939-73 Feb2010 section 5.7.36.3 for details.
Range: [0, 3]
• mil_activation_mode
A code indicating the most severe form of MIL display required by the failure status of any
system or component. Refer to J1939-73 Feb2010 section 5.7.36.4 for details.
• incomplete_monitors
The number of incomplete diagnostic monitors for a given sub-system or component. Refer
to J1939-73 Feb2010 section 5.7.36.5 for details. The platform will limit the value to the
range specified below.
• mil_accumulated_time
The accumulated count, in minutes, that the MIL is activated for the current MIL activation.
Refer to J1939-73 Feb2010 section 5.7.36.6 for details. The platform will limit the value
to the range specified below. This range is chosen to match that of the accumulated time
sent on DM21 message.
8.7.46.5. Outports
• error_flag
Set to 1 when the DM36 message could not be buffered for transmission, or if a previous
request to send a DM36 message has not completed.
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.46.7. Notes
None.
8.7.47.3. Description
sim _ error_ flag
force_ transmission
priority
snrw_ count
Channel : 0 error_ flag
continuous _ mil
mil _ strategy
incomplete _ monitors
pj 1939 _ Dm 37 Transmit
8.7.47.4. Inports
• sim_error_flag
• force_transmission
Set to 1 if the DM37 message should be transmitted in addition to the periodic transmission
and regardless of any change in input data.
Range: 0 or 1.
• priority
Range: [0, 7]
• snrw_count
The number of components that the system has determined to be non-roadworthy. Refer
to J1939-73 Feb2010 section 5.7.37.1 for details. A change of data on this inport causes
transmission of a DM37 message. The transmission is delayed, if necessary, until the
minimum inter-message interval has elapsed. Refer to J1939-73 Feb2010 section 5.7.37
for details of permitted transmission rates.
• continuous_mil
A code indicating whether the system requires that the MIL be steady (continuous) burning.
Refer to J1939-73 Feb2010 section 5.7.37.2 for details. A change of data on this inport
causes transmission of a DM37 message. The transmission is delayed, if necessary, until
the minimum inter-message interval has elapsed. Refer to J1939-73 Feb2010 section
5.7.37 for details of permitted transmission rates.
Range: [0, 3]
• mil_strategy
A code indicating whether the system is configured to employ a discriminatory MIL display.
Refer to J1939-73 Feb2010 section 5.7.37.3 for details. A change of data on this inport
causes transmission of a DM37 message. The transmission is delayed, if necessary, until
the minimum inter-message interval has elapsed. Refer to J1939-73 Feb2010 section
5.7.37 for details of permitted transmission rates.
Range: [0, 3]
• mil_activation_mode
A code indicating the most severe form of MIL display required by the failure status the
system or component. Refer to J1939-73 Feb2010 section 5.7.37.4 for details. A change of
data on this inport causes transmission of a DM37 message. The transmission is delayed,
if necessary, until the minimum inter-message interval has elapsed. Refer to J1939-73
Feb2010 section 5.7.37 for details of permitted transmission rates.
• incomplete_monitors
The number of incomplete diagnostic monitors for a given sub-system or component. Refer
to J1939-73 Feb2010 section 5.7.37.5 for details. A change of data on this inport causes
transmission of a DM37 message. The transmission is delayed, if necessary, until the
minimum inter-message interval has elapsed. Refer to J1939-73 Feb2010 section 5.7.37
for details of permitted transmission rates. The platform will limit the value to the range
specified below. This range is chosen to match that of the 'Vehicle Incomplete Monitor
Count' sent on DM36 message.
8.7.47.5. Outports
• error_flag
Set to 1 when the DM37 message could not be buffered for transmission, or if a previous
request to send a DM37 message has not completed.
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.47.7. Notes
In order to meet the minimum transmission rate requirements in J1939-73 FEB2010 section
5.7.37, the block should be scheduled at a 0.1Hz or faster rate. It is recommended that the
rate be faster than 1Hz in order that the transmission of DM37 messages is able to meet the
maximum allowable frequency for those transmitted on change of input data. When there is
no change in the data on the inports, and no forced transmission, the block will transmit the
DM37 messages at the rate of 0.1Hz (1 message every 10 seconds).
8.7.48.3. Description
sim _ error_ flag
transmit
Channel : 0
GTR description :
priority
8.7.48.4. Inports
• sim_error_flag
• sim_transport_errors
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the DM38 message (This could be the source address of
the corresponding PGN request, or the global address (255) if the request was sent to the
global address). If use_dest_addr is false or a PDU2 message is shorter than 9 bytes, this
value is ignored and the message is sent to the global address.
• use_dest_addr
Whether to send the DM38 to a specified destination address. If false (0), the message will
always be sent to the global address. Set to true (1) to allow the message to be sent to a
specific destination address, such as the source address of a PGN request.
Range: 0 or 1.
8.7.48.5. Outports
• error_flag
Set to 1 when the DM38 message could not be buffered for transmission, or if a previous
request to send a DM38 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
• GTR description
A description of the UN/ECE WWH OBD Global Technical Regulation (GTR) to which the
sub-system or component complies. See J1939-73 Feb2010 section 5.7.38.1 for details.
The entered string must be enclosed within single quotes. The single quotes are not,
however, included in the transmitted string. The platform will limit the individual character
ASCII values to the range specified below. Should a character fall outside, it is rejected
and no further characters are processed. The platform will also limit the string length to
the range specified below.
8.7.48.7. Notes
None.
8.7.49.3. Description
sim _ error_ flag
transmit
total _ b1 _ time
pj 1939 _ Dm 39 Transmit
A J1939/73 DM39 message is a fixed length message transmitted by a network node to the
global network address. The DM39 message contents detail the system specific cumulative
information. Direct support is provided (rather than using the pj1939_PgTransmit block).
8.7.49.4. Inports
• sim_error_flag
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• cumulative_mil_time
The total amount of time that the MIL has been demanded to be illuminated during the life
of the system or component. Refer to J1939-73 Feb2010 section 5.7.39.1 for details.
• total_b1_time
The total amount of time that one or more DTCs with emission severity B1 have been
active. Refer to J1939-73 Feb2010 section 5.7.39.2 for details.
8.7.49.5. Outports
• error_flag
Set to 1 when the DM39 message could not be buffered for transmission, or if a previous
request to send a DM39 message has not completed.
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
8.7.49.7. Notes
None.
8.7.50.3. Description
sim _ error_ flag
transmit
Channel : 0
Table :
priority
pj 1939 _ Dm 40 Transmit
A J1939/73 DM40 message is a variable length message. The DM40 message contents
detail the system specific individual B1 failure counters. Direct support is provided (rather
than using the pj1939_PgTransmit block).
8.7.50.4. Inports
• sim_error_flag
• sim_transport_errors
• transmit
Range: 0 or 1.
• priority
Range: [0, 7]
• dest_addr
J1939 destination address for the DM40 message (This could be the source address of
the corresponding PGN request, or the global address (255) if the request was sent to the
global address). If use_dest_addr is false or a PDU2 message is shorter than 9 bytes, this
value is ignored and the message is sent to the global address.
• use_dest_addr
Whether to send the DM40 to a specified destination address. If false (0), the message will
always be sent to the global address. Set to true (1) to allow the message to be sent to a
specific destination address, such as the source address of a PGN request.
Range: 0 or 1.
8.7.50.5. Outports
• error_flag
Set to 1 when the DM40 message could not be buffered for transmission, or if a previous
request to send a DM40 message has not completed.
• transport_errors
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
Calibratable: No
The name of the DTC table to act on (there must be a corresponding named table specified
in a pdtc_Table block in the model).
8.7.50.7. Notes
None.
See Section 6.1.58, “J1939 parameter group receive message (pj1939_PgReceive)” for a
detailed description.
See Section 6.1.60, “J1939 parameter group transmit (pj1939_PgTransmit)” for a detailed
description.
8.7.54.3. Description
Channel : 0
transmit PGN :
Type : Ack
pj 1939 _ SendAck
The send acknowledgement block can be used to acknowledge any PGN request (with either
Ack, Nack, Access Denied or Busy responses).
8.7.54.4. Inports
• transmit
8.7.54.5. Outports
None.
• J1939 Channel
The logical J1939 channel on which to transmit. Must be a channel declared with a
pj1939_ChannelConfiguration block.
• PGN to be acknowledged
• Required response
The required response for this message: Ack, Nack, Access Denied or Busy.
8.7.54.7. Notes
None.
8.7.55.3. Description
nte _ status
pj 1939 _ UpdateNteStatus
The platform requires information regarding the status of the engine operation in the NTE
control areas, for given pollutants such as NOx and PM. This block provides the facility to
update that information in order that a J1939 DM34 message (when requested) contains up-
to-date data. Refer to J1939-73 FEB2010 section 5.7.34 for details of the various NTE areas.
8.7.55.4. Inports
• nte_status
A 2-bit status code indicating the status of engine operation within the manufacturer specific
NTE area. See J1939-73 FEB2010 section 5.7.34 for details of these codes.
8.7.55.5. Outports
None.
• NTE area
A drop down to identify the NTE area for which the status is to be updated.
• Sample time
8.7.55.7. Notes
This block updates the platform data for the pj1939_dm34Transmit block.
8.7.56.3. Description
in InfoType : $ 02
pdg_ InfotypeInput
The InfoType designates the type of vehicle specific information that the application is
supplying. This supplied vehicle specific information can be accessed using a diagnostic
scan tool via J1979 service $09 by specifying the InfoType.
The InfoTypes $00, $20, $40,.. etc specify which InfoTypes an application supports.
The underlying platform code implements the supported InfoType message. Placing the
pdg_InfotypeInput block with an appropriate Infotype selected in the application model will
cause the corresponding bitfield to be set in the supported InfoTypes message.
8.7.56.4. Inports
• in
Application supplied data which is to be accessed via service 0x09 by a diagnostic scan
tool.
Note this inport accepts inputs from multidimensional data types, such as a simulink Mux,
simulink constant block whose constant value is a vector (specified in the data dictionary),
etc.
Note the length of the supplied data must match that defined in the J1979 standard.
• pending
Indicates the availablity of the application data. False indicates the data is available.
When true, a J1979 request for the data will result in the negative response code $78
(requestCorrectlyReceived-ResponsePending) followed by a negative response code $78
message at 4.5s intervals until pending transistions to false where upon the supplied
infotype data is sent.
8.7.56.5. Outports
None.
• InfoType
$02
Vehicle Identification Number.
$04
Calibration Identifications
Note the number of data items (NODI) is currently limited to 1 for this
InfoType
$06
Calibration Verification Number (CVN)
$0A
ECUNAME
$0B
In-use Performance Tracking
$0D
Engine Serial Number
$0F
Exhaust Regulation Or Type Approval Number
8.7.56.7. Notes
None.
8.7.57.3. Description
enabled
monitor _ run
readiness_ complete
force_ complete
completed
DME ID :
Readiness limit :
numerator
force_ not_ complete
denominator
monitor _ enabled
ratio
ppr_ DiagnosticMonitorEntity
A Diagnostic Monitor Entity (DME) is a group of Diagnostic Test Entities (DTEs) and is
represented by an ISO-15765 Monitor Identifier (OBDMID), a monitor group (which is used for
reporting In-Use Performance Tracking over ISO-15765 protocol) and/or by a J1939 Suspect
Parameter Number (which is used for reporting performance tracking over J1939 protocol).
Examples of a DME monitor group are:-
• Catalyst
• Evaporative system
• PM filter
• NOx adsorber
• Fuel system
The platform holds information for each DME, consisting of monitor readiness status as well
as monitor enable and monitor completion status. The monitor readiness status is a term
used in OBD that refers to a vehicle's readiness for I/M inspection. For monitors that are
non-continuous and have an emissions threshold, a readiness status indicator is stored to
indicate whether or not that particular monitor has run enough times to make a diagnostic
decision. The monitor enable status for the current driving cycle indicates when a monitor is
not disabled in a manner such that there is no way for the driver to operate the vehicle for
the remainder of the driving cycle and make the monitor run. The monitor completion status
indicates if all monitoring conditions required for the particular monitor have been tested and
a result has been obtained.
8.7.57.4. Inports
• monitor_run
Set to 1 if the monitor has run, set to zero otherwise. This is used by the the platform
to determine the monitor completion and readiness status. The platform increments the
number of times a monitor has been run on each 0 to 1 transition of this inport, provided
that inport monitor_enabled is set to 1 and force_complete and force_not_complete are
both set to 0.
Range: 0 or 1
• force_complete
Set to 1 to force the monitor readiness status to complete, independent of the number of
times the monitor has been run. Set to 0 otherwise. The block responds on the rising edge
of this inport.
Range: 0 or 1
• force_not_complete
Set to 1 to force the monitor readiness status to incomplete, independent of the number
of times the monitor has been run. Set to 0 otherwise. The block responds on the rising
edge of this inport.
Range: 0 or 1
• monitor_enabled
Range: 0 or 1
8.7.57.5. Outports
• enabled
Range: 0 or 1
• readiness_complete
Set to 1 if this DME's run count is greater than or equal to its Readiness count limit
parameter, set to 0 otherwise.
Range: 0 or 1
• completed
Set to 1 if all monitoring conditions required for this DME have been tested and a result
has been obtained, set to 0 otherwise.
Range: 0 or 1
• numerator
If there is only one DTE for this monitor then the numerator will be set to that DTE's specific
numerator. If there is more than one DTE, then the value of this outport will be the specific
numerator corresponding to the lowest ratio found in the set of DTEs for this monitor.
• denominator
If there is only one DTE for this monitor then the denominator will be set to that DTE's
specific denominator. If there is more than one DTE, then the value of this outport will be
the specific denominator corresponding to the lowest ratio found in the set of DTEs for
this monitor.
• ratio
If there is only one DTE for this monitor then the ratio will be set to that DTE's specific ratio.
If there is more than one DTE, then the value of this outport will be the lowest ratio found
in the set of DTEs for this monitor.
• DME identifier
The minimum number of times the monitor must be run before the monitor readiness status
is set to complete.
• ISO Type?
If this box is checked then the parameters pertaining to ISO specific DMEs are available.
Note that a DME can be ISO type, J1939 type or both.
Range: 0 or 1
• Monitor identifier
The ISO-15765 monitor identifier (OBDMID - see J1979 spec dated Sept 2010 appendix
D). It is used for reporting over ISO-15765 diagnostics in response to service $06. Only
available if the ISO Type? option is checked.
• Monitor group
A drop down to specify the ISO-15765 monitor group as described in J1979 spec dated
Sept 2010 appendix G. It is used for reporting performance ratio data over ISO-15765
diagnostics, in response to service $09. Only available if the ISO Type? option is checked.
• J1939 Type?
If this box is checked then the parameters pertaining to J1939 specific DMEs are available.
Note that a DME can be ISO type, J1939 type or both.
Range: 0 or 1
• J1939 SPN
The value of the J1939 SPN for this DME. Only available if the J1939 Type? option is
checked.
8.7.57.7. Notes
None.
8.7.58.3. Description
dte_ numerator
numerator_ update
dte_ denominator
denominator _ update
test_ value
test_ run
dte_ test_ lim _ max
ppr_ DiagnosticTestEntity
A DTE is a specific test for some vehicle component for which test results are recorded. It
is represented by an ISO-15765 Test Identifier (ISO-TID), which is reported over ISO-15765
protocol and/or by a J1939 Test Identifier (J1939-TID), which is reported over J1939 protocol.
The platform holds information for each DTE, consisting of a numerator (a measure of the
number of times a vehicle has been operated such that all monitoring conditions necessary
for a specific test (DTE) to detect a malfunction have been encountered) and a denominator (a
measure of the number of times a vehicle has been operated). These are used to implement
algorithms in the platform to individually track and report a minimum acceptable In-Use
Performance Ratio (IUPR). The platform keeps track of whether the test value for the DTE
has been updated at least once in the current drive cycle and holds test value and min and
max limits for the DTE.
8.7.58.4. Inports
• numerator_update
Set to 1 if the numerator for this DTE is to be updated, set to zero otherwise. The block
responds to a rising edge on this inport. This is used by the block to increment the specific
numerator for the DTE. Note that the DTE specific numerator will be incremented only
once per drive cycle. Therefore, it is important that this inport is returned to level 0 before
a new drive cycle event, if a numerator update is not required. The signal passed to this
inport should be connected to all DTEs which contain the same Monitor identifier in order
that the specific numerator is updated simultaneously for all those DTEs.
Range: 0 or 1
• denominator_update
Set to 1 if the denominator for this DTE is to be updated, set to zero otherwise. The block
responds to a rising edge on this inport. This is used by the block to increment the specific
denominator for the DTE. The user should set this inport to 1 only when every monitoring
condition necessary for the monitor of the specific component to detect a malfunction and
store a pending fault code has been satisfied. Note that the DTE specific denominator
will be incremented only once per drive cycle. Therefore, it is important that this inport is
returned to level 0 before a new drive cycle event, if a denominator update is not required.
The signal passed to this inport should be connected to all DTEs which contain the same
Monitor identifier in order that the specific denominator is updated simultaneously for all
those DTEs.
Range: 0 or 1
• test_value
• test_limit_min
The threshold which the test value must be above in order to pass the test.
• test_limit_max
The threshold which the test value must be below in order to pass the test.
• test_run
Sets whether the test has been run at this time step.
When this input is 1, the block sets the test value and min and max limits for the DTE
to the values on inports test_value, test_limit_min and test_limit_max respectively. When
this input is 0, the stored test value and min and max limits are held unchanged. Note
that this input is level-triggered and not edge-triggered. This is required so that results for
continuously-monitored tests such as range checks on sensors may be updated at every
step.
Range: 0 or 1
• reset
Set to 1 to cause the block to reset the test value, test min and test max for this DTE to
initial values of 0 and its test run status to 'test not run'. Set to 0, otherwise. Note that this
input is level-triggered and not edge-triggered. This is required so that test results may be
repeatedly reset if necessary. Note also that test_run takes precedence over this input.
Copyright 2020, Pi Innovo 772
Extended diagnostics functions
Range: 0 or 1
8.7.58.5. Outports
• dte_numerator
The specific numerator for this DTE. Used internally for calculation of the DME's In-Use
performance ratio which this DTE belongs to.
• dte_denominator
The specific denominator for this DTE. Used internally for calculation of the DME's In-Use
performance ratio which this DTE belongs to.
• numerator_updated_this_dc
Set to 1 if the specific numerator for this DTE has been updated this drive cycle, set to
0 otherwise.
Range: 0 or 1
• denominator_updated_this_dc
Set to 1 if the specific denominator for this DTE has been updated this drive cycle, set
to 0 otherwise.
Range: 0 or 1
• dte_test_value
The test value that the platform holds for this DTE.
• dte_test_limit_min
The test minimum threshold that the platform holds for this DTE.
• dte_test_limit_max
The test maximum threshold that the platform holds for this DTE.
• dte_test_run_status
The test run status that the platform holds for this DTE. A value of 0 indicates that the test
has never run. A value of 1 indicates that a test has run on this drive cycle. A value of 2
indicates that a test has run but not on this drive cycle.
Range: [0, 2]
• DTE identifier
Calibratable: No
• DME identifier
The identity of the DME that this DTE belongs to. For example, an Exhaust gas sensor
monitor will have a subset of DTEs. This DTE needs to have a matching DME identifier
parameter with its parent DME.
• ISO Type?
If this box is checked then the parameters pertaining to ISO specific DTEs are available.
Note that a DTE can be ISO type, J1939 type or both.
Range: 0 or 1
• Monitor identifier
The ISO-15765 monitor identifier (OBDMID - see J1979 spec dated Sept 2010 appendix
D) that this DTE belongs to. It is used for reporting over ISO-15765 diagnostics in response
to service $06. Only available if the ISO Type? option is checked.
This identifier is used to reference the scaling and unit to be used by the external test
equipment in order to calculate and display the test values (results), Minimum Test Limit,
and the Maximum for the DTE. Only available if the ISO Type? option is checked.
The ISO specific test identifier (TID). Only available if the ISO Type? option is checked.
• J1939 Type?
If this box is checked then the parameters pertaining to J1939 specific DTEs are available.
Note that a DTE can be ISO type, J1939 type or both.
Range: 0 or 1
The J1939 specific test identifier (TID). See J1939-73 Sept 2010 section 5.7.7.1 for details.
Only available if the J1939 Type? option is checked.
This is the scaling, limit, offset, and transfer function for the DTE. Only available if the
J1939 Type? option is checked.
• J1939 SPN
This is the SPN number associated with the DTE. Only available if the J1939 Type? option
is checked.
• J1939 FMI
This is the FMI number associate with the DTE. See J1939-73 Sept 2010 Appendix A.
Only available if the J1939 Type? option is checked.
This is the bit position to set in a requested DM10 message response, to indicate test
supported. Refer to J1939-73 FEB2010 section 5.7.10 for details. The assignment of a
given test identifier (as provided in the J1939 test identifier parameter) to a given bit position
is manufacturer specific. This parameter is optional and may be left blank, in which case the
DM10 bit position will default to the value provided in the J1939 test identifier parameter,
provided it lies in the range specified below. Only available if the J1939 Type? option is
checked.
8.7.58.7. Notes
None.
8.7.59.3. Description
ppr_ GeneralDenominator
The general denominator is defined as a measure of the number of times a vehicle has
been operated and is not specific to a Diagnostic Test Entity. The general denominator is
incremented by one if inport update is set to 1. Otherwise, no increment is attempted.
8.7.59.4. Inports
• update
Set to 1 if the general denominator is to be incremented, set to zero otherwise. Note that the
platform's general denominator will be incremented only once per drive cycle. Therefore,
it is important that this inport is set to 0 before a new drive cycle event occurs, if a general
denominator update is not required.
Range: 0 or 1
8.7.59.5. Outports
• general_denominator
8.7.59.7. Notes
None.
8.7.60.3. Description
ppr_ IgnitionCycle
The ignition cycle counter is defined as a counter that indicates the number of ignition cycles
a vehicle has experienced under certain engine speed conditions for a certain amount of
time. The ignition cycle counter is incremented by one if inport update is set to 1. Otherwise,
no increment is attempted. Note that the platform's ignition cycle counter will be incremented
only once per ignition cycle.
8.7.60.4. Inports
• update
Set to 1 if the ignition cycle counter is to be incremented, set to zero otherwise. Note
that the platform's ignition cycle counter will be incremented only once per ignition cycle.
Therefore, it is important that this inport is set to 0 before a new ignition cycle event occurs,
if an ignition cycle counter update is not required.
Range: 0 or 1
8.7.60.5. Outports
• ignition_cycle_count
The value of the ignition cycle counter that is held by the platform.
8.7.60.7. Notes
None.
8.7.61.3. Description
ppr_ Memory
The ppr_Memory block stores the In-use performance ratio data in non-volatile memory.
Storage consists of DME and DTE data plus the ignition cycle counter and general
denominator. On start-up, the block attempts to retrieve the data prior to running the model.
While the model is running, the time at which the data is stored back to non-volatile memory
is determined by the model itself.
Failure to retrieve the data on start-up causes the data to be reverted to the default start-
up conditions.
The target non-volatile memory may be provided in two ways: either through storage that
requires an external power source when the ECU is powered down (battery backed RAM
storage), or not (Flash storage). In the case of IUPR data, only Flash storage is supported.
See the technical specification for details on which storage type is supported by each target.
This block is used to write the In-use performance ratio data to non-volatile store. When the
inport commit is set to 1, the block pauses execution of the model, stores the IUPR data in
non-volatile memory, then continues execution of the model.
Note
This block suspends the scheduler for a period of time. When storing the information,
the worst case Flash erase time given worst case environmental conditions, can be
around 1.8 seconds.
Old IUPR data is reused so long as it has the expected total data size and was written
by an application with the same user-specified version number. Otherwise the values
revert to defaults.
To ensure the IUPR data is up to date before shutting down the ECU, the store_up_to_date
outport provides an indication of whether the storage to Flash was successful or not. If not,
shutdown of the module can be prevented (if conditions are appropriate), and the store
updated (by setting the commit inport to 1).
8.7.61.4. Inports
• commit
Set to 1 to write the IUPR data to non-volatile memory. Note that the block responds to the
rising edge of this inport in order to prevent multiple stores to NVM. Set to zero otherwise.
Range: 0 or 1
8.7.61.5. Outports
• store_up_to_date
Set to 1 if the storage of IUPR data to non-volatile memory was successful, set to zero
otherwise.
Range: 0 or 1
8.7.61.7. Notes
• None.
8.7.62.3. Description
count
ppr_ MonitorsIncomplete
The count of the number of DMEs that are enabled and have a status of readiness not
complete is calculated and presented on the count outport.
8.7.62.4. Inports
None.
8.7.62.5. Outports
• count
The count of the number of monitors (DMEs) that are enabled and incomplete.
• Sample time
8.7.62.7. Notes
None.
Generic ECUs
Customer ECUs
Further information about ECUs, including simplified I/O schematics and mechanical
drawings, can be downloaded from the website (registration or purchase of ECU required)
or requested through OpenECU technical support as described in Appendix K, Contact
information.
For tools that are supplied by other companies, additional details about how to use the tools
can be found in their respective manuals. Pi Innovo will not provide technical support in the
use of these tools.
The sections on the calibration tools (Section B.3, “ATI Vision”, Section B.5, “Vector
CANape”, Section B.4, “ETAS INCA”) and on a free programming tool called FreeCCP
(Section B.6, “FreeCCP”) assume that the step1 example application (see Chapter 3, Quick
start for details) has been built using the default CCP settings (Table 6.3, “CCP defaults”)
and that the user is familiar with the installation of the calibration tool.
B.2. PiSnoop
Pi Innovo's PiSnoop tool has many functions that are useful in typical OpenECU
developments. It offers a cost-effective alternative to traditional calibration tools, but its
emphasis is more on software development than calibration. Therefore it presents an
interface that is part way to a debugger in terms of watch and memory windows, but typically
interacts with the ECU via CCP, just like a calibration tool.
PiSnoop is under continual development, so this manual does not attempt to document how
to use it with OpenECU in detail as is done for the other tools below. Instead, see the online
help that is included in the PiSnoop installation (including the specific OpenECU application
note) for up-to-date guidance. In brief however, capabilities include:
• Works with any Vector, Kvaser or PEAK-System (PCAN) CAN interface on Windows XP
or higher.
• Loads symbols (parameter names, addresses, types and descriptions) from ASAP2 (.a2l)
files...
• ... but can also load symbols from the linker output (.elf) files, giving access to all
static C language objects present including arrays, structure elements, pointers and
bitfields, without needing data dictionary entries. In Simulink builds, this means Real-Time
Workshop structures such as rtDWork and rtB can be explored, making "hidden" block-
related values, present in the autocode, available for debug purposes.
• ECU memory access and flash reprogramming via CCP, with seed-key security support
and fast DAQ data-logging, which tolerates ECU power cycling.
• Calibration parameter value changes can be uploaded by name to a file, to use for
download or flash reprogramming with a different build later.
• Watch, map lookup and raw memory windows to view and edit ECU memory or offline
file images.
• CAN traffic generation and monitoring/logging with .dbc file support for named messages
and signals.
• Extensible through plug-in architecture supporting new protocols, hardware interfaces and
custom windows.
Debugger-style memory windows can be used to view and edit memory contents. Known
symbols loaded from .a2l or .elf files are highlighted when the mouse pointer is placed over
their locations:
Further windows are integrated for CAN and diagnostic functions. For example, arbitrary
CAN traffic can be generated by hand or using a .dbc file:
They also assume that an ATI Vision Hub is used. If another communications device is used,
the user will need to deviate from these instructions.
1. Install ATI vision, the installer may reboot your machine. Once windows is restarted, it will
detect new USB hardware (assuming the hub is plugged in: if not, plug it in).
Ask windows to install the USB hardware software from the "device software" directory
located where you just installed ATI vision, e.g., c:\program files\Accurate Technologies
\ati vision\device software.
Start Vision and you will be presented with a window similar to the following:
2. Next, you must create a project to details how ATI Vision will communicate with the
OpenECU device.
Create a new project using the menu option File->New, then select Project.
and save it somewhere on your hard-disk (here, it has been saved using the name
"example_project").
Next, add a device by right clicking on the Computer item and selecting "Add Device..."
Select USB port and in the subsequent dialog, accept all the defaults and select OK.
Next, add a device by right clicking on the USB item and selecting "Add Device..."
Select VISION Network Hub in the subsequent dialog and select OK.
Accept the default hub name and in the subsequent dialog properties defaults by selecting
OK.
Next, add another device by right clicking on the VisionHub item and selecting "Add
Device..."
Select a VNI CAN device type, accept the default name and in the subsequent dialog,
accept the defaults by selecting OK.
Next, add another device by right clicking on the VNICAN item and selecting "Add
Device..."
Select the CCP Controller Device, accept the default name and in the subsequent
dialog, accept the defaults by selecting OK. This has told the Vision tool that you will be
communicating to a CCP compatible device over CAN via the Vision Hub connected to
the PC via a USB cable.
3. Next, you must create a strategy file to hold both the calibration data and program data.
Select File->New, then Strategy File.
The main Vision window will change and you will be presented with the import wizard.
Select the ASAP2 description file item.
For the step1 example, select the step1_tool_vision.a2l file from the location
where you built it (note that the following diagrams show an older version of the step1
application called step1_r12_g800).
It is important to keep the "Strategy Presets" text box clear and to tick the "Delete existing
data items from before importing" check-box. This ensures that the memory and CCP
settings are taken from the ASAP2 file and that subsequent imports of the same strategy
will clear out previous ASAP entries before loading the latest.
Click Import to read in the ASAP2 file, then click on the More button.
Select import memory image, then select Motorola S-record File, then browse and select
the step1_image_small.s37 file from the place where you built it.
Select Import, then Finish. The Wizard dialog box now closes.
Note
You must now save this strategy (menu option File->Save) and change back to
the project file by clicking on the "example_project" tab at the bottom of the Vision
window.
They also assume that an ATI Vision Hub is used. If another communications device is used,
the user will need to deviate from these instructions.
Before building an application, select the Generate ATI Vision Strategy file RTW option (see
Section 4.3.4, “Configuration options” for more details about how to do this). Alternatively,
follow the instructions for creating an ATI Vision strategy described in Section B.3.1, “Creating
a new project and strategy in ATI Vision”.
1. Add this strategy to the tree list by right clicking on the PCM item and selecting "Add
Strategy...", browse to the location where you saved the strategy file and select it.
This will add two items to the tree view, one for the strategy and one for the calibration
data immediately below it.
2. If CCP seed/key security is to be used, copy the relevant DLL(s) into the same location
as the strategy file.
3. To try out the connection, go online by selecting the menu option Project->Online.
The tree view will change to show that each of the devices previously added are
communicating correctly:
If any of the devices show a yellow or red mark, then there is a physical disconnection or
CCP communications error (e.g., different settings for CCP in the OpenECU device and
the application). The dialog box will not pop-up and you will not be able to Flash the device.
Go back and check that each of the settings corresponds to physical devices and CCP
settings, check that CAN is connected to the correct pins and try again.
To program the OpenECU device with the strategy, select Flash then OK. This brings up
a dialog box which shows which memory regions on the OpenECU device to program.
Select Start to program the device.
Note
In order to reprogram or Flash the OpenECU device, the OpenECU device must be
in reprogramming mode. For details on how to enter reprogramming mode refer to
Section 4.5, “Programming an ECU”
Once programmed, the FEPS must be disconnected (if used) and the OpenECU device
power cycled. This reboots the OpenECU and starts to run the application.
4. You can now view ASAP2 entries by creating a screen and adding the application signals
and calibrations you wish to see. Select File->New, then Screen File. The main window
will change. Right click on the background and select "Add Control".
For now, we will only look at scalar values by selecting Data List items, but 1-d and 2-d
maps are supported, as well as recorders etc..
Select Data List and you will be presented with a dialog box which lists the ASAP2 entries.
Double click on stp_ect_state and then select OK. You will be presented with the
current value of stp_ect_state in real-time.
At this point, you have managed to connect ATI Vision to OpenECU, download the step1
application and view one application signal in real-time. Please refer to the ATI Vision user
manual for more details about how to use ATI Vision.
Strategy A
OpenECU A
USB CAN
CRO: 1785 ATI Hub
CRO: 1785
DTO: 1784
DTO: 1784
The above diagram shows ATI Vision with a single strategy using the default CCP settings.
A similarly configured OpenECU is connected to ATI Vision via the CAN bus to the Vision
Hub, and from the Hub to the PC via a USB cable. Your setup may vary depending on what
equipment you have (for instance, you may have two ATI Hubs but the overall concept of
configuring the additional OpenECU's remains).
When a second OpenECU is first required, a second application will be built into a second
strategy which must use different CCP settings from the first strategy. The tool settings may
follow the example default settings for two OpenECUs.
ATI Vision
OpenECU A
CRO: 1785
Strategy A DTO: 1784
USB CAN
CRO: 1785 ATI Hub
DTO: 1784
OpenECU B
The diagram shows ATI Vision with two strategies: strategy A using the default CCP settings
(as in the single OpenECU example above); strategy B using different CCP settings. The
CCP settings distinguish between the two OpenECUs. Two OpenECUs are connected to the
Hub allowing ATI Vision to communicate with both.
As this is the first time the second OpenECU has been connected to the CAN bus, it uses the
default CCP settings. When the user selects strategy B in Vision, Vision uses the strategy
B CCP CAN identifiers but there is no OpenECU with matching CCP settings. Without any
response Vision shows the OpenECU for strategy B as offline.
Follow this procedure to program OpenECU B with strategy B for the first time:
1. Disconnect OpenECU A from the CAN bus. This prevents OpenECU A from interfering
with communications to OpenECU B.
2. Right click on strategy B and select Open File. The screen will change.
3. Select File -> Properties and change to the Device Settings tab in the new dialog.
Change the CRO CAN identifier to 1785 and the DTO CAN identifier to 1784, then select
File -> Save.
4. Change back to the Project tab (so you can see both strategy A and strategy B), right
click on strategy B and select Reload File. This brings the CRO and DTO changes into
strategy B.
OpenECU A
CRO: 1785
Strategy A DTO: 1784
USB CAN
CRO: 1785 ATI Hub
DTO: 1784
OpenECU B
5. Reprogram OpenECU B with strategy B (see Section B.3, “ATI Vision” and Section 4.5,
“Programming an ECU” for more).
6. Once reprogrammed, power cycle OpenECU B. ATI Vision will show OpenECU B as
offline.
7. Right click on strategy B and select Open File. Select File -> Properties, change to the
Device Settings tab in the new dialog, change the CRO CAN identifier to 1787 and the
DTO CAN identifier to 1786, then select File -> Save.
8. Change back to the Project tab (so you can see both strategy A and strategy B), right
click on strategy B and select Reload File.
OpenECU A
CRO: 1785
Strategy A DTO: 1784
USB CAN
CRO: 1785 ATI Hub
DTO: 1784
OpenECU B
Note
The above procedure is equally applicable when reprogramming a single OpenECU to
new CCP settings. Ensure there is only one OpenECU connected to the CAN bus, build
the application with the new CCP settings, import into Vision, adjust the CCP settings
in Vision to that of the connected OpenECU, reprogram the OpenECU and reset it,
then adjust the CCP settings in Vision to that of the application.
CCP seed/key security requires that a Win32 DLL is built containing a function which will
generate a key value from a seed value supplied by the ECU. The name and function
prototype are specified in the ASAP1A and ASAP2 standards to be
The following instructions assume the user is using version 5.1.2. These instructions were
transcribed against this version but it may be that these instructions match other versions
of the tool.
The instructions also assume that ES 580 CAN card is used. If another communications
device is used, the user will need to deviate from these instructions.
1. Start INCA and you will be presented with a window similar to the following:
2. Select the menu option Database->New to create a new database. This database will
contain the binary image of the built application and calibration and other items used to
calibrate the OpenECU device.
Type in a suitable name: the example here uses example_database and select OK.
Next, select the menu option Edit->Add->ECU Project (a2l) and browse to your
built application, e.g., step1_tool_inca.a2l. The example shows an older
step1_r12_g800 application.
Next, select the menu option Edit->Add->Workspace and accept the default name, then
select the menu option Project->Add Project/Dataset:
and a new dialog appears. Select the project you just added then OK. The main window
will have updated to show the project in window 5.
Select an appropriate CCP compatible device. In this example, the PC running INCA has
a ES 580 CAN card attached, so the related CCP item is selected.
3. Next, double click on the workspace item in window 1. If there is an error in the CCP
configuration or in the wiring to the OpenECU device, the INCA log window will show that
INCA could not communicate with the OpenECU device. If this occurs, check the CCP
settings and wiring.
If the memory pages dialog does not pop-up, the select the menu option Hardware-
>Manage memory pages
Select Flash programming, then do it. If this is the first time INCA has been used or if
OpenECU was installed without the option to Patch INCA, you will be asked to browse
to a ProF configuration file.
Note
The INCA tool makes a distinction between the base calibration (reference page)
and a derived calibration (working page). Be sure to download the reference page
to start with.
Select the "Install..." button and browse to the install location of OpenECU, .../
tools_integration/inca_prof and select OK.
This will have installed the INCA ProF configuration file for OpenECU. Select it then OK.
Select Flash strategy and calibration (or Flash strategy, calibration and tunes if using
Tunes in your application — the step1 application does not use Tunes), then OK.
Note
In order to reprogram or Flash the OpenECU device, the OpenECU device must be
in reprogramming mode. For details on how to enter reprogramming mode refer to
Section 4.5, “Programming an ECU”.
This brings up the ProF control flow dialog box which shows the progress of programming
the OpenECU device.
Press Close when it has finished and Close in the manage memory pages dialog.
and from the dialog that pops up, select those signals or calibrations to view. Here, the
stp_ect_state signal has been selected and will be updated every 100 milliseconds.
Select the Configure button, followed by the OK button on the next dialog.
Finally, to display the data of the selected item in real-time, select the menu option
Measurement->Start Visualisation. You will be presented with the current value of
stp_ect_state in real-time.
At this point, you have managed to connect ETAS INCA to OpenECU, download the step1
application and view one application signal in real-time. Please refer to the ETAS INCA user
manual for more details about how to use INCA.
The following instructions are for version 8.0. Other versions may differ.
The instructions also assume that CANcaseXL is used. If another communications device is
used, the user may need to deviate from these instructions.
1. Start CANape and you will be asked to accept a disclaimer. After this you will see the
following:
2. Select 'Create new project' and press 'OK'. You will then be asked for a project name.
Enter a suitable name, click 'Next' and then browse to a suitable directory to save the
project, click 'Next' and then 'Finish'. You should now see the following:
Select the menu option Device->New from database... and browse to where your
model_name_canape.a2l file is located and select Open. If the device is connected
correctly and configured with the appropriate baud rate then you should see no errors or
warning. The a2l file contains the CAN configuration as set by the model. It also has the
relevant information for the flash, cal and RAM locations. CANape will use these values
with no further configuration input required from the user.
If CCP seed/key security is required for an operation, the DLL implementing the
appropriate key-generation algorithm must be placed in the same directory as the
CANape project. Note that CCP seed/key security is disabled by default in the
model_name_canape.a2l file.
Having set up the project (and CCP security if required), select the menu
option Flash->Download file to flash... and browse to your built application, e.g.,
step1_m460_image_small.hex. Depending on the size of the memory region to be
flashed, it may be necessary to increase the flash clear timeout parameter in CANape.
At the bottom left of the window the progress bar should be seen to advance until
programming is complete.
The Simulink model name should be visible in the left hand pane under 'Measurement
signals'. Right click on the model name and select 'Insert signal' from the menu that
appears. The Database selection window should then appear, listing all of the model
signals and calibrateable values.
Double click on each signal of interest so that their text colour changes to blue. Close
both windows and accept changes and you will return to the main window. Now select
the menu option Display->Display windows->Numeric window, an empty numeric display
will appear. Right click on this numeric display and select 'Insert measurement signal...'
the following appears:
3. Next, right click and select 'Insert signal' on each parameter that you want to monitor in
the numeric window
At this point, you have managed to connect Vector CANape to OpenECU, downloaded the
step1 application and viewed some signals in real-time. Please refer to the Vector CANape
user manual for more details about how to use CANape.
CCP seed/key security requires that a Win32 DLL is built containing a function which will
generate a key value from a seed value supplied by the ECU. The name and function
prototype are specified in the ASAP1A and ASAP2 standards to be
Some calibration tools allow different function names to be used, but CANape does not.
Each seed/key algorithm must therefore be provided in a separate DLL and referenced
appropriately. Section 4.3.1.1 "CCP Parameters" of the CANape user manual specifies this
in more detail.
B.6. FreeCCP
FreeCCP is a command line tool which can program an OpenECU with a built application.
It requires a Vector or Kvaser CAN card.
This tool is provided free and unsupported by Pi Innovo. Users are permitted to use this
software for commercial and non-commercial purposes.
Note
On 64-bit Windows 7 PCs, FreeCCP does not currently work with Vector interfaces,
but does with Kvaser interfaces.
Note
FreeCCP is now deprecated, and so may be removed from future releases of
OpenECU. Please contact support if you would like a free trial of PiSnoop to get started
with OpenECU, even if you intend to migrate to a third-party calibration tool. See also
Section B.2, “PiSnoop”.
where <application_name> is replaced by the name of the application. For instance, with
the step1 application for the M670 target, the command to issue would be:
Note
The command can be run from either the Windows command line or MATLAB
command line. If running from the Windows command line, add the path to the
freeccp tool to the system PATH environment variable.
then the command to issue to download the step1 application using a Vector CAN card
would be:
CCP seed/key security is not supported by FreeCCP. FreeCCP cannot therefore carry out
operations for which the currently-running application requires security to be unlocked. This
may make it unsuitable for use with production-level software.
To check the CCP connection using a Vector CAN card, issue the command:
oe_freeccp -check
• when there is an existing body of C code which would take a significant amount of effort
to re-create as a Simulink model;
• when an existing algorithm written in C has been tested and proven to work correctly —
the code is at a mature stage and re-creating the code in Simulink means additional testing
is required;
• when an algorithm written in C code might be more efficient and easier to understand than
the equivalent created using Simulink blocks.
Existing or custom C code can be incorporated into a Simulink model using S-functions. S-
functions can be written in MATLAB, C, C++, Ada, or Fortran and except for the MATLAB
type function, the rest are compiled as a MEX-function using the MATLAB mex utility. An S-
function can be used with Simulink Coder and the code generated by Simulink Coder for S-
functions can be customized by writing a Target Language Compiler (TLC) file.
This section explains how to write and integrate a C type S-function into an OpenECU
Simulink model (OpenECU does not support C++, Ada or Fortran S-functions, or non-inlined
S-functions). S-functions with TLC files, are called inlined S-functions, while S-functions
without TLC files are non-inlined. For OpenECU models, a TLC file is required, which
improves the efficiency of code generation and helps reduce RAM usage.
Note
See “S-Functions and Code Generation” in MATLAB's help section for more
information.
C.2.2. Procedure
To create a S-function, begin by copying the files listed below from the directory:
xx_code.h
This file defines the interface to the C source code.
xx_code_wrapper.c
This file tells MATLAB how to simulate the S-function block.
xx_code_wrapper.tlc
This file tells MATLAB how to generate code for the S-function block.
xx_code.c
This file implement's the user's algorithms as C source code.
rtwmakecfg.m
This file tells MATLAB where the C source code is located.
The xx part of the file name represents the core function of the S-function and it's up to the
user to choose an appropriate name. If multiple S-functions are created then each function
should have a unique set of files.
As the OpenECU model load scripts add each of the data dictionary directories to MATLAB's
path, then by placing the files in a data dictionary directory MATLAB will be able to find the
S-function and the hand-written C code is located.
Note
Some versions of MATLAB and OpenECU cannot correctly deal with paths that include
spaces. Make sure the path of the model directory doesn’t have any spaces (e.g. a good
example is C:\TestModel\drc\; a bad example is C:\Documents and Settings
\Test Model\drc\).
/*
*****************************************************************************
* Step n:
* ...
******************************************************************************
*/
The number n is the step number and each step is explained below. Other sections of the
code are generic and do not need to be altered. Follow the steps below in sequence to create
a S-function which implements custom C code.
a. Replace the literal TPD_CODE_H with a name unique across all source
files, to protect against double inclusion.
b. Define the data types and assign names for the inports and outports of
the S-function.
Note
These are the name that will be used to pass data from Simulink
into the C code and from C code to Simulink via the inports and
outports.
Note
In this example, the S-function does not use any input arguments,
so the number of arguments is set to 0. For more information on
how to use input arguments, please refer to the S-function block’s
help section.
h. Get hold of storage locations of the data being sent from Simulink to the
S-function via the inports.
Note
The port numbers start from 0 and not 1. For more information
on the property functions, search for the section named “Writing
S-functions” or search using the property function name under
MATLAB's help.
j. Pass the data received from Simulink via the inports to the C code.
k. Pass the data received from the C code to Simulink via the outports.
Note
The variable should have a four letter prefix with the fourth letter
set to c (e.g. mbec_maximum_engine_speed). See the variable
naming requirements in section Section 5.2.5, “Naming rules”.
r. Pass the data received from Simulink via the inports to the C code.
t. Pass the data received from the C code to Simulink via the outports.
u. MEX Setup
mex –setup
• Then choose the number associated with the desired compiler and
when prompted with the question: “Are these correct?”, enter Y.
Note
This step need to be done once and MATLAB will remember these
settings each time it is opened.
mex xx_code_wrapper.c
• If there are no errors, MATLAB will compile and link the source files
into a DLL file but won’t give any confirmation that the compilation
was successful. The DLL file is used by Simulink to create the S-
function block with an appropriate number of inports and outports, and
to perform the C source code algorithms when simulating the model.
• If there are errors, MATLAB will display and errors in the command
window. Fix the errors and re-issue the previous command.
Note
These steps need to be done each time the S-function or algorithm
C code is altered for the new changes to take effect.
• Change MATLAB path to the model directory and open the model.
• Double-click on the block to open it. In the S-function Name field insert
the name of the wrapper i.e xx_code_wrapper.
• If there has been no problem with the previous steps, the inports and
outports on the S-function block will appear. The block is now ready
to be used when simulating or building the model.
• If the source files were not compiled and linked into a DLL, the
following error will be displayed “Error in S-function 'model directory/
model name/S-function name': S-function 'xx_code_wrapper' does
not exist”.
The S-function is now ready to be used when simulating or building the model. Each time the
C sources are modified, the S-function must be built manually by issing the mex command.
However, it is possible to build the S-function automatically by adding a callback function to
the S-function block. The advantage is that Simulink invokes the callback before the model is
simulated, updated or built, ensuring the S-function is up to date regardless of whether the C
sources have been altered or not. The disadvantage is that if the C sources are large, there
can be a noticable delay each time the model is updated, simulated or built.
cd ddd
mex xx_code_wrapper.c
cd ..
where ddd is replaced with the name of the data dictionary directory.
Fleet ECUs
Lower-cost that developer ECUs due to the lack of run-time calibration support. These
ECUs are intended to be used for fleet trials or production, and are not intended to
be used for bench or dyno activities, especially those that require calibration support.
Typically, fleet ECUs do not include external RAM.
Developer ECUs
Higher-cost that fleet ECUs due to support for run-time calibration. These ECUs are
intended to be used for development activities such as dyno cell calibration or HIL based
testing. Typically, developer ECUs do include external RAM.
Some configurations support running identical software on fleet and developer units. An
application can be built, run and calibrated on a developer ECU, then transfered to a fleet ECU
of the same family and type as the developer unit, and run unmodified. An example of this
would be memory configuration A for the M220, and memory configuration D for the M670.
The same application, calibration and RAM memory sizes are available with and without run-
time calibration support. An application built for M220 memory configuration A will run on
both M220 developer and fleet units without modification.
M110
Most of these configurations require the external RAM available with developer units. If an
application using such a memory configuration is loaded onto an ECU with no external tab
board RAM available, the ECU will entry reprogramming mode with a flash code of 1-1-7
(repeated resets).
M670
Other targets
Warning
OpenECU does not adhere to the ASAP2 rule which governs the length of identifiers.
OpenECU may generate identifiers with more than 32 characters.
Some older versions of software (prior to platform version 1.6.0, or prior to RPRG version
x.6.0) support a larger number of CCP commands. In addition to the commands above, these
older versions also supported the following commands:
OpenECU will interpret the master device ID information to determine how to setup the
Memory Transfer Address (MTA0) for later uploading.
a b
Position Description
Key = 4, ECU mod and issue numbers
The issue level represents a specific design of PCB. Changes to the issue level may have
an effect on the software version.
The modification level represents what changes were performed to the PCB after
manufacturing to correct issue level design mistakes. Changes to the modification level
should not have an effect on the software version.
0 The PCB issue level, range [0, 255]
1 The PCB modification level, range [0, 255]
Key = 5, Factory part number
For instance, the factory part number could be '450FT1034', where '450' represents the
part_num[0], 'F' represents the letter[0], 'T' represents the letter[1], and '1034' represents
the part_num[1].
0..1 First number of identifier, range [0, 65535]
2..3 Second number of identifier, range [0, 65535]
4..5 Characters used to separate identifier numbers, represented in ASCII,
range [A-Z]
Key = 6, Factory part number build type
0..1 The factory part number build type, represented in ASCII, range [A-Z]
a
All data is arranged in MSB format.
b
Not all keys are available on all ECUs.
This section explains the symptoms and the solution using examples of a system with an ATI
Hub and ATI Vision. Specific issues with ATI products are not addressed in this document as
are issues with other system configurations such as ATI's Kvaser and ETAS' INCA, although
the overall symptoms and resolutions remain the same.
Note
This guide is provided to help diagnose issues when connecting OpenECU with ATI
Vision, and is a reference only. Please direct technical support questions regarding ATI
products, to ATI. Pi can supply support for Pi products only.
If at the end of following this guide, the OpenECU module will not communicate to ATI Vision,
please get in touch with OpenECU technical support (see Appendix K, Contact information).
Front
Back
Power fuse
Power connector
15 pin D-type
Communications connector
Solution
2. Check that the 12V DC is applied on the power connector at the back of the ATI Hub.
Solution
1. Check that the USB cable between the ATI hub and the computer is connected
properly.
2. Ensure that the correct USB driver is installed on the computer (contact ATI Technical
Support for more details about the correct USB driver).
• Visually check for the response from actuators that are driven by the OpenECU
module (lamps, relays, DC motors, etc.) during power-up. When the observed actuator
response is not as expected, then the OpenECU module is not powered up correctly.
• Check that the 5V sensor reference output on the OpenECU module is present. When
the reference line voltage does not match the expected 5V, then the module is not
powered up correctly.
• Measure the current drawn by the OpenECU module (electrical current into all VPWR
input pins). When the total current is less than 250mA, then the module is not powered
up correctly.
Solution
Solution
1. Remove all devices from the CAN bus except the OpenECU module and the ATI Hub.
Note
When communications are established, then the cause may be in the
disconnected device(s). Terminating resistors, different CAN baud rate or
clashing CAN message ID's are potential causes. Further investigation will be
required but is outside the scope of this trouble shooting guide.
2. Check the 15 pin D-type connector on the back of the ATI Hub if fixed securely.
3. Check that the ATI CAN connections are fitted correctly. CAN-High (white) and CAN-
Low (blue) are connected to the corresponding pins of the OpenECU module.
• Ensure the Hub is connected to the Hub correctly (see Section G.3.2.2, “OpenECU
module is not connected to the ATI Hub correctly”).
Solution
2. Apply 18V DC to the FEPS input pin of the OpenECU module (i.e. use an external
power supply between the FEPS pin and ground).
3. Power up the OpenECU module (powering up with 18V applied to the FEPS pin, forces
the OpenECU module to enter reprogramming mode).
4. When communications is established, flash the module with the strategy that is known
to be working. Continue with the following steps:
b. Remove the 18V DC power from the FEPS input pin of the OpenECU module.
Note
Continuous module resets can be caused by a mistake in the strategy model
(e.g. divide by zero) or when a model takes too long to run in its allotted time
budget (e.g., a 1ms model rate takes longer than 1ms to complete). It is good
practice to review the source model for potential causes of the reset.
• Ensure the Hub is connected to the Hub correctly (see Section G.3.2.2, “OpenECU
module is not connected to the ATI Hub correctly”).
• Ensure the module does not reset continuously (see Section G.3.2.3, “OpenECU
module resets continuously”).
Solution
1. In ATI Vision, right click on “VNICAN” and select the menu option Properties.
3. Select a Bus Frequency of what is expected to match the strategy that is currently
flashed onto the module.
Note
When the version of the latest strategy is known, then the bus frequencies of
that strategy can be found by opening the strategy in ATI Vision and selecting
the menu option File > Properties. The frequency is displayed as “Baudrate” in
the Device Settings tab. If the strategy is unknown, then it will be any of the
following possible frequencies: 33.333, 50, 62.5, 83.333, 100, 125, 250, 500 or
1000 kBps. Select one at a time until communications are established.
4. When communications is still not established, then the most likely cause is a mismatch
of the CRO and DTO vales between the active strategy in the project and the strategy
that is currently flashed onto the module. See Section G.3.2.5, “CCP CRO and DTO
values do not agree with OpenECU” on how to change CRO and DTO values.
5. When communications is established, flash the module with the strategy that has the
new desired bus frequency.
7. In ATI Vision, right click on “VNICAN” and select the menu option Properties.
9. Select a “Bus Frequency” of the strategy that is flashed onto the module.
G.3.2.5. CCP CRO and DTO values do not agree with OpenECU
Troubleshoot
• Ensure the Hub is connected to the Hub correctly (see Section G.3.2.2, “OpenECU
module is not connected to the ATI Hub correctly”).
• Ensure the module does not reset continuously (see Section G.3.2.3, “OpenECU
module resets continuously”).
• Ensure the CAN baud rate is correct (see Section G.3.2.4, “CAN baud rate between
OpenECU and ATI disagree”).
Solution
Note
You will need to know the CRO and DTO values of the strategy that was
last successfully flashed onto module. These values can either be found in the
corresponding MATLAB model or from the corresponding strategy (VST) file. Use
steps 2 to 6 below to find out what the existing values are. Because the CRO
and DTO can be any CAN identifier number, it will be very difficult to establish
communications without knowing the values used in the strategy that is currently
flashed onto the modules.
1. Create a copy of the strategy file that needs to be flashed onto the module.
2. Opening it in ATI Vision and selecting the menu option File > Properties.
3. In the Device Settings tab, highlight CRO and press the Edit button. Enter the CRO
number of the strategy that is currently flashed onto the module and select the OK.
4. In the Device Settings tab, highlight DTO and press the Edit button. Enter the DTO
number of the strategy that is currently flashed onto the module and select the OK.
6. Attach the modified strategy file to the PCM in ATI Vision and make active.
8. Power cycle the module when flashing has completed (comms should no longer be
established).
9. Attach the version of the strategy file with the original CRO and DTO values to the
PCM in ATI Vision and make active.
• Ensure the Hub is connected to the Hub correctly (see Section G.3.2.2, “OpenECU
module is not connected to the ATI Hub correctly”).
• Ensure the module does not reset continuously (see Section G.3.2.3, “OpenECU
module resets continuously”).
• Ensure the CAN baud rate is correct (see Section G.3.2.4, “CAN baud rate between
OpenECU and ATI disagree”).
• Ensure the CCP CRO and DTO values are correct (see Section G.3.2.5, “CCP CRO
and DTO values do not agree with OpenECU”).
Solution
1. Check the directory where the Vision strategy file is located. If this directory does not
contain a DLL file and the strategy is known to require CCP seed/key security, then
copy the relevant file to this directory.
2. If the directory contains one or more DLL files but CCP seed/key security is still
not available, it is possible that the DLL file in this directory may have the correct
name but the wrong algorithm. (It may be the algorithm for a different manufacturer or
platform, for example). Locate the correct DLL file(s) providing CCP seed/key security
algorithms for this application, and copy the file(s) to this directory.
When the DDE tool generates a warning about a DDE, the entry will be read into MATLAB's
workspace but some of the attributes about the DDE may be changed. To remove the
warning, the user must change the entry and re-read the data dictionary into the workspace
using the command oe_read_build_list.
100. (error 100): unrecognised command line arguments, try -h or --help for
more.
The interface tool has detected that there are command line options which
mean nothing to the tool.
101. (error 101) file 'file name': could not open interface file for reading,
'error message'.
The interface tool could not read the interface file given by 'file name' and
the operating system's reason for not being able to do so is given by 'error
message'. Correct the reason for failure and try again.
102. (error 102) file 'file name': could not open AST debug file for writing,
'error message'.
The interface tool could not create or write to the first debug file called 'file
name' and the operating system's reason for not being able to do so is given
by 'error message'. Correct the reason for failure and try again.
103. (error 103) file 'file name': could not open AST debug file for writing,
'error message'.
The interface tool could not create or write to the second debug file called
'file name' and the operating system's reason for not being able to do so is
given by 'error message'. Correct the reason for failure and try again.
104. (error 104) file 'file name': could not open code file for writing, 'error
message'.
The interface tool could not create or write to the first code file called 'file
name' and the operating system's reason for not being able to do so is given
by 'error message'. Correct the reason for failure and try again.
105. (error 105) file 'file name': could not open code file for writing, 'error
message'.
The interface tool could not create or write to the second code file called file
name and the operating system's reason for not being able to do so is given
by 'error message'. Correct the reason for failure and try again.
106. (error 106) file 'file name': could not open m-script file for writing, 'error
message'.
The interface tool could not create or write to the MATLAB m-script file, call
file name and the operating system's reason for not being able to do so is
given by 'error message'. Correct the reason for failure and try again.
107. (error 107) file 'file name': could not open generic ASAP2 file for writing,
'error message'.
The interface tool could not create or write to the generic ASAP2 file called
file name and the operating system's reason for not being able to do so is
given by 'error message'. Correct the reason for failure and try again.
108. (error 108) file 'file name': could not open INCA ASAP2 file for writing,
'error message'.
The interface tool could not create or write to the ETAS INCA ASAP2 file
called file name and the operating system's reason for not being able to do
so is given by 'error message'. Correct the reason for failure and try again.
109. (error 109) file 'file name': could not open Vision ASAP2 file for writing,
'error message'.
The interface tool could not create or write to the ATI Vision ASAP2 file called
file name and the operating system's reason for not being able to do so is
given by 'error message'. Correct the reason for failure and try again.
110. (error 110): at least one command option required an ASAP2 file to be
generated but no MAP file or ELF information file was specified. Try -
h or --help for more information.
The interface tool has been asked to generate an ASAP2 file but has not
been told the MAP or ELF information file to derive the addresses of DDEs.
111. (error 111): the asap2 naming pattern must be one of 'prefix_name',
'prefix.name', 'prefix.name_prefix', 'name', 'name_prefix'.
The interface tool has been told to transform the DDE names when
generating an ASAP2 file, but the interface tool does not understand the
transformation required (there are only a few pre-determined transforms).
112. (error 112): the boolean type must be specified as 'u8' or 'float'.
The interface tool has been told to generate ASAP2 boolean types with a
specific type, but the interface tool does not understand the type provided.
113. (error 113): you may specify a Diab or GCC MAP file OR an ELF
information file as input, but not both.
The interface tool has been given more than one of a Diab MAP file, a GCC
MAP file, Diab ddump file, or a GCC objdump file as input but does not know
which to use. Specify only one MAP file or ELF information file as input.
114. (error 114): you cannot specify data dictionary generation using --
output-elf-contents without also specifying an ELF information file to
be read.
115. (error 115) file 'file name': could not open DDE file for writing, 'error
message'.
The interface tool could not write to the data dictionary file given by 'file name'
and the operating system's reason for not being able to do so is given by
'error message'. Correct the reason for failure and try again (the file may be
read-only or locked by another application).
116. (error 116) file 'file name': could not open [type of] file for writing, 'error
message'.
The interface tool could not create or write to the file specified by 'file name'
and the operating system's reason for not being able to do so is given by
'error message'. Correct the reason for failure and try again (the file may be
read-only or locked by another application).
117. (error 117): you cannot specify address list output using --output-
address-list without also specifying a ELF information file to be read.
The interface tool has been told which file to output the address list to, but
it has not been told which Diab ddump or GCC objdump file to read this
information from.
The interface tool has been told which compiler is being used, but it does
not recognise the compiler so identified.
119. (error 119) file 'file name': could not open output linker file for writing,
'error message'.
The interface tool could not write to the output linker file given by 'file name'
and the operating system's reason for not being able to do so is given by
'error message'. Correct the reason for failure and try again (the file may be
read-only or locked by another application).
120. (error 120): to generate a linker file output you must specify the
OpenECU installation base path using the --oe-base-path option.
The interface tool can only output linker file using the --output-linker-
file command line option if the --oe-base-path option is also used to
specify the path to the OpenECU installation.
121. (error 121) file 'file name': could not open linker source file for reading,
'error message'.
The interface tool could not read from the linker source file given by 'file
name' and the operating system's reason for not being able to do so is given
by 'error message'. Correct the reason for failure and try again.
122. (error 122): the compiler must be specified when outputting a linker file
for the 'target name' target.
For any target that supports more than one compiler, the interface tool needs
to be passed the compiler id using the --compiler-id command line
option when outputting the linker file using the --output-linker-file
option.
123. (error 123): no input program images. Please specify values for --img-
app and --img-cal.
124. (error 124): no diab mapfile. please specify value for --diab-mapfile.
125. (error 125): could not open s-record file for writing.
The tool tried to create the file specified by --output-s-rec , but failed.
This often means that the file already exists and is read-only, or the file was
specified in a non-existing directory.
126. (error 126): could not open application image file for reading.
The tool tried to read the file specified by --img-app , but failed. This often
means that the file does not exist.
127. (error 127): could not open calibration image file for reading.
The tool tried to read the file specified by --img-cal, but failed. This often
means that the file does not exist.
128. (error 128): could not open linker file excerpt for reading.
The tool tried to read the file specified by --ld-excerpt-file, but failed.
This often means that the file does not exist.
129. (error 129): cannot check data dictionary entity data types using --
check-dde-data-types.
The tool received an error when checking for the ELF file. When using the
--check-dde-data-types option, the ELF file must be specified.
The tool received an error while verifying the license. Verify that OpenECU
is installed correctly with a valid license.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
201. (error 201) file 'file name': could not close file.
The interface tool could not close the file given by 'file name' after the file
was opened to be read or written to. In this case, the interface tool may leave
a temporary file called 'file name' after the tool completes.
202. (error 202): found internal error — cannot remove file 'file name' when
the type of file is unknown.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
203. (error 203) file 'file name': could not delete temporary file.
The interface tool could not close the file given by 'file name' after the file
was opened to be read or written to. In this case, the interface tool may leave
a temporary file called 'file name' after the tool completes.
204. (error 204): found internal error — repeated file registration for 'file
name'.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
The interface tool could not read the mapfile given by 'file name' and the
operating system's reason for not being able to do so is given by 'error
message'. Correct the reason for failure and try again.
3001. (error 3001) file 'file name': label 'name' is not defined by 'map file' but
is required for ASAP2 generation.
The interface tool has read a DDE called 'name' from the DDE file called 'file
name' but cannot find the address of the DDE in the Diab MAP file called
'map file'. This often occurs because there is no extern C variable with the
name 'name' (either because the variable does not exist or because it is not
declared extern).
3002. (error 3002) file 'file name': label 'name' is not defined by 'file' but is
required for ASAP2 generation of DDE 'dde name'.
The interface tool has read a DDE called 'dde name' from the DDE file called
'file name' but cannot find the address of the DDE in the Diab MAP or ddump
file called 'file'. This often occurs because there is no extern C variable with
the name 'name' (either because the variable does not exist or because it
is not declared extern).
3003. (error 3003): found internal error while creating an ASAP2 entry for DDE
'dde name' — no X-axis DDE 'name' found.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
3004. (error 3004): found internal error while creating an ASAP2 entry for DDE
'dde name' — no Y-axis DDE 'name' found.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
3005. (error 3005): found internal error while creating an ASAP2 entry for DDE
'dde name' — DDE class 'type' is unsupported.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
3006. (error 3006): found internal error while searching for an 'os-native'
statement — not found but should be present.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
3007. (error 3007): found internal error while searching for task 'name'
required by an ATI shadow table — not found but should be present.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
3008. (error 3008): found internal error while creating a unique ASAP2
identifier for DDE 'dde name' — too many unique conversions.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
3009. (warning 3009) line 'number' of 'file name': the DDE name 'dde name' is
either too long for an ASAP2 identifier (max 32 characters), or clashes
with another identifier, and has been changed to 'short dde name' for
ASAP2 file generation.
The interface tool has read a DDE file called 'file name' and at line 'number'
has found a DDE called 'dde name' which is too long for an ASAP2 file.
The DDE has been changed to 'short dde name' which is guaranteed to be
unique and be less than 33 characters long.
3010. (warning 3010) file 'file name': label 'name' is not defined by 'map file'
but is required for ASAP2 generation, DDE not added to ASAP2 file.
The interface tool has read a DDE called 'name' from the DDE file called 'file
name' but cannot find the address of the DDE in the Diab MAP file called
'map file'. This often occurs because there is no extern C variable with the
name 'name' (either because the variable does not exist or because it is not
declared extern), or because the DDE file is out of date. The warning does
not stop generation of the ASAP2 file, but the DDE will not be added to the
ASAP2 file.
3011. (error 3011): found internal error while creating an ASAP2 entry for
DDE 'dde name' -- X-axis 'dde' must have at least two elements. (Note
unspecified array size in code is currently read as one element.)
3012. (error 3012): found internal error while creating an ASAP2 entry for DDE
'dde name' — X-axis DDE 'name' must be 'caxis' Class.
3013. (error 3013): found internal error while creating an ASAP2 entry for DDE
'dde name' — Y-axis DDE 'name' must be 'caxis' Class.
3014. (error 3014): found internal error while creating an ASAP2 entry for DDE
'dde name' -- Y-axis DDE 'name' must be 1-D array.
3015. (error 3015): found internal error while creating an ASAP2 entry for
DDE 'dde name' -- Y-axis 'dde' must have at least two elements. (Note
unspecified array size in code is currently read as one element.)
3016. (error 3016): found internal error while creating an ASAP2 entry for DDE
'%s' — Y-axis DDE '%s' must also be in C-style data dictionary
If the calibration map DDE 'dde name' is declared in a C-style data dictionary
file then the x-axis DDE 'name' must also be declared in a C-style data
dictionary. It is not possible to mix axis and map definitions between prefix
and C style data dictionaries.
3017. (error 3017): found internal error while creating an ASAP2 entry for
DDE 'dde name' — X-axis DDE 'name' must also be in C-style data
dictionary.
If the calibration map DDE 'dde name' is declared in a C-style data dictionary
file then the y-axis DDE 'name' must also be declared in a C-style data
dictionary. It is not possible to mix axis and map definitions between prefix
and C style data dictionaries.
3018. (error 3018): found internal error while creating an ASAP2 entry for DDE
'dde name' -- map array must be array.
The interface tool needs to generate an ASAP2 map definition but has found
an internal error.
3019. (error 3019): found internal error while creating an ASAP2 entry for DDE
'dde name' — 2D array but only Xaxis specified.
The interface tool needs to generate an ASAP2 map definition for a two-
dimensional calibration map DDE 'dde name' but only one axis has been
specified. Both the Xaxis and Yaxis columns must be specified.
3020. (error 3020): found internal error while creating an ASAP2 entry for DDE
'dde name' -- array size incompatible with axis size(s).
3021. (warning 3021) file 'file name': one-dimensional array expected for 'dde
name'; now treated as such.
3022. (error 3022): file 'file name': label 'dde name' according to 'file' has more
than 3 final array dimensions.
The interface tool can generate ASAP2 entities with up to 3 dimensions but
no more, because the ASAP2 syntax does not allow further dimensions.
However, the interface tool will break up arrays with more than 1 or 2
dimensions into multiple DDEs of smaller dimension. If this error occurs,
please contain OpenECU technical support.
For ASAP2 generation, C-style data dictionaries can only be used if a Diab
ddump or GNU objdumb ELF information file file is also specified (not just
a map file). Otherwise the tool cannot obtain the types and sizes of the
variables detailed in the data dictionary.
3024. (error 3024): found internal error while creating an ASAP2 entry for DDE
'dde name' -- X-axis DDE 'name' must be 1-D array.
3025. (warning 3025): string array 'dde name' had zero size, so a default size
of 'bytes' has been used, hence it may display incorrectly.
The DDE string 'dde name' has an equivalent C variable in the Diab ddump
file with no information about the string's size. The interface tool generates
an entry for the DDE but with a size 'bytes' long which probably does not
match the actual string length. To avoid this, use an explicit array size in the
C declaration.
3026. (error 3026): found internal error while creating an ASAP2 entry for DDE
'dde name' — too many array dimensions for map data.
3332. (error 3332) shadow table references task (task) but that task as not
been declared.
The shadow table entry must reference a declared task. This is the task
which is to carry out the calibration tool writes. Here a task is referenced
which has not been declared.
3333. (error 3333) more than four shadow-table statements are present.
The tool does not currently support more than four shadow table statements.
3334. (warning 3334) shadow table must have number of entries in the range
[1, 256].
The number of entries in the shadow table is not within the supported range.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
402. (error 402): while creating automatic adaptive DDE 'dde name' an
existing DDE of the same name was found — do not replicate adaptive
DDEs in DDE files.
The interface tool has tried to create an automatic adaptive DDE for the
corresponding DDE named 'dde name' but found that one is already present.
This situation occurs because one of the DDE files contains a definition for
a DDE that the interface tool requires — rename the DDE.
403. (error 403): there is no DDE for the adaptive 'adaptive name'.
The interface tool has read an interface file which declares some adaptive
data using the adaptive-list statement but there is no corresponding
DDE for the 'adaptive name'. Update one of the DDE files to include a
definition of the adaptive data.
404. (error 404): while creating automatic tune DDE 'dde name' an existing
DDE of the same name was found -- do not replicate tune DDEs in DDE
files.
The interface tool has tried to create an automatic Tune DDE for the
corresponding DDE named 'dde name' but found that one is already present.
This situation occurs because one of the DDE files contains a definition for
a DDE that the interface tool requires — rename the DDE.
405. (error 405): there is no DDE for the tune 'tune name'.
The interface tool has read an interface file which declares some Tune data
using the tune-list statement but there is no corresponding DDE for
the 'tune name'. Update one of the DDE files to include a definition of the
adaptive data.
406. (error 406): found internal error — could not find 'named' node.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
407. (error 407): found internal error — could not find 'named' declaration.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
The interface tool has read an interface file called 'file name' and found an
error at line 'number' containing a string without a closing quote, or a string
The interface tool has read an interface file called 'file name' and found an
error at line 'number' containing a comment without the final */ characters.
Change the interface file to complete the comment.
502. (error 502) line 'number' of 'file name': unexpected character 'letter'.
The interface tool has read an interface file called 'file name' and found an
error at line 'number' containing text which the tool does not expect to see.
503. (error 503) line 'number' of 'file name': could not read number.
The interface tool has read an interface file called 'file name' and at line
'number' the interface tool could not convert the text into a number. Adjust
the number to be valid and in the range [0, 2147483647].
504. (error 504) line 'number' of 'file name': number must be positive.
The interface tool has read an interface file called 'file name' and at line
'number' the interface tool found an unexpected negative number. Adjust the
number to be in the range [0, 2147483647].
505. (error 505) line 'number' of 'file name': number must be less than
2147483648.
The interface tool has read an interface file called 'file name' and at line
'number' found a number which was too large. Adjust the number to be in
the range [0, 2147483647].
506. (error 506) line 'number' of 'file name': cannot use the '-' character in
an identifier.
The interface tool has read an interface file called 'file name' and found a
'-' character as part of an identifier at line 'number'. Rename the identifier
without the '-' character.
The interface tool has found in internal error. Please contact OpenECU
support if this error occurs.
The interface tool has read an interface file called 'file name' and at line
'number' has found an identifier that has been used elsewhere in the
interface file. All identifiers must be unique.
602. (error 602) line 'number' of 'file name': identifier is more than 31
characters in length.
The interface tool has read an interface file called 'file name' and at line
'number' has found an identifier with more than 31 characters. All identifiers
must be limited to a maximum of 31 characters.
The interface tool has read an interface file called 'file name' and at line
'number' has found a syntax error.
604. (error 604) line 'number' of 'file name': unexpected end of file.
The interface tool has read an interface file called 'file name' and at line
'number' has encountered the end of the file while still expecting to see more
detail in the interface file. This may occur if there is a missing close brace
(}) in the file.
The interface tool could not read the DDE file named 'file name' and the
operating system's reason for not being able to do so is given by 'error
message'. Correct the reason for failure and try again.
800. (error 800) file 'file name': could not open units file for reading, 'error
message'.
The interface tool could not read the units file named 'file name' and the
operating system's reason for not being able to do so is given by 'error
message'. Correct the reason for failure and try again.
900. (error 900) line 'number' of 'file name': from within the 'compound'
statement, there is a missing 'assignment' statement.
The interface tool has read an interface specification file called 'file name'
and at line 'number' has found a compound statement with a missing
assignment statement called 'assignment'. In this case, the interface tool
is expecting the assignment statement to be present (i.e., the assignment
statement is not optional).
901. (error 901) file 'file name': within the interface file, there is a missing
'compound' statement.
The interface tool has read an interface specification file called 'file name'
and at line 'number' has found that the file is missing a compound statement
called 'compound'. In this case, the interface tool is expecting the compound
statement to be present (i.e., the statement is not optional).
1001. (error 1001): line 'number' of 'file name': 'dde name' is an invalid name
for a data dictionary entry (must be greater than 3 characters long).
All data dictionary entry names must be greater than 3 characters long.
Change the name so it is at least 4 characters in length.
1002. (error 1002): line 'number' of 'file name': 'dde name' is an invalid name
for a data dictionary entry (must be less than 256 characters long).
1003. (error 1003): line 'number' of 'file name': 'dde name' is an invalid name
for a prefix-style data dictionary entry (must not start with a digit or a
'_' character).
To provide compatibility with Simulink, prefix-style DDE names must not start
with an underscore. To provide compatibility with Simulink and C compilers,
prefix-style DDE names must not start with a digit.
1004. (error 1004): line 'number' of 'file name': 'dde name' is an invalid name
for a prefix-style data dictionary entry (must only use characters 'a'
through 'z', 'A' through 'Z', '0' through '9' or '_').
1005. (error 1005): line 'number' of 'file name': 'dde name' is an invalid name
for a calibration map (must end in '_x' or '_y' or '_z').
The tool has recognised that the DDE forms part of a calibration map but
does not conform to the rules for naming these entities. See Section 5.2.5,
“Naming rules” for more details.
1006. (error 1006): line 'number' of 'file name': 'dde name' is an invalid name
for an item which is not a calibration map (must not end in '_x' or '_y'
or '_z').
The tool has recognised that the DDE does not form part of a calibration
map and does not conform to the rules for naming these entities. See
Section 5.2.5, “Naming rules” for more details.
1007. (error 1007): line 'number' of 'file name': 'dde name' is a calibration but
has no value.
The entry is a calibration of some sort but does not contain a default
calibration value, which it must do.
1008. (error 1008): line 'number' of 'file name': 'dde name' has an invalid value
'text of value'.
The tool could not convert the text of the value into a numeric value. All
numeric values must be scalar and represent a real value. The following are
examples of valid values: 3.14, 10, 10., .001, 1e8, 3.14e-10, 0e0.
1009. (error 1009): line 'number' of 'file name': 'dde name' must be a vector
or a matrix surrounded by '[' and ']').
The tool has recognised that the entry forms part of a calibration map but
that the value or values supplied are not valid expressions, either of a vector
or of a matrix. Values for an axis (_x or _y) should be given as a vector.
Values for the data points (_z) should be given as a vector for 1-d maps or
as a matrix for 2-d maps.
vector
A vector takes the form [numbers separated by spaces]. An example of
a vector containing three elements would be: [10, 15, 20].
matrix
A matrix takes the form [vectors separated by semicolons]. An example
of a matrix containing three rows and columns would be: [1 2 3; 10 20
30; 100; 200; 300].
1010. (error 1010): line 'number' of 'file name': the row sizes for 'dde name'
differ."
The tool requires map axes and map data to match in size. For instance,
a 1-d map with 5 elements in the x-axis, requires 5 elements in the z-data.
Change the axis and data elements to match in size.
1011. (error 1011): line 'number' of 'file name': the row size for 'dde name'
must be at least 2 entries.
The tool requires that map axes and map data have at least 2 elements. For
instance, if a 1-d map had 1 element for the x-axis and therefore 1 element
for the z-data, the map lookup would be equivalent to a constant block.
1012. (error 1012): line 'number' of 'file name': the row data for 'dde name'
must be 1xN matrix.
The tool requires that any map axis be a vector (a 1xN matrix), the OpenECU
1-d and 2-d map lookup blocks do not work with other sized matrices.
1013. (error 1013): line 'number' of 'file name': the units for 'dde name' is too
long (must be less than 'number' characters long).
The units field must be less than 32 characters long by default so that it can
be exported into other file formats (e.g., ASAP2 file) without issues. Either
change the units so it contains less than 32 characters, or change the limit
using the Simulink Model Configuration Option 'Maximum data dictionary
entry name length'.
1014. (error 1014): line 'number' of 'file name': the units for 'dde name' cannot
contain single quote characters.
The units field must not contain single quote characters so that it can be
exported into other file formats (e.g., ASAP2 file) without issues.
1015. (error 1015): line 'number' of 'file name': the units for 'dde name' cannot
contain double quote characters.
The units field must not contain double quote characters so that it can be
exported into other file formats (e.g., ASAP2 file) without issues.
1016. (error 1016): line 'number' of 'file name': the description for 'dde name'
is too long (must be less than 256 characters long).
The description field must contain less than 256 characters so that it can be
exported into other file formats (e.g., ASAP2 file) without issues.
1017. (error 1017): line 'number' of 'file name': the description for 'dde name'
cannot contain single quote characters.
The description field must not contain single quote characters so that it can
be exported into other file formats (e.g., ASAP2 file) without issues.
1018. (error 1018): line 'number' of 'file name': the description for 'dde name'
cannot contain double quote characters.
The description field must not contain double quote characters so that it can
be exported into other file formats (e.g., ASAP2 file) without issues.
1019. (error 1019): line 'number' of 'file name': 'dde name' has an unspecified
type (must be one of: int8_T, S8, uint8_T, U8, int16_T, S16, uint16_T,
U16, int32_T, S32, uint32_T, U32, real_T, F32, BOOL).
The type of the DDE must be one of the types that MATLAB/Simulink/RTW
supports so that simulation and code generation can occur without error.
See Section 4.2.2.2, “Data dictionary files” for more.
1020. (error 1020): line 'number' of 'file name': 'dde name' has an invalid
type 'type text' (must be one of: int8_T, S8, uint8_T, U8, int16_T, S16,
uint16_T, U16, int32_T, S32, uint32_T, U32, real_T, F32, BOOL).
The type of the DDE has been specified but it is not one of the types
supported by MATLAB/Simulink/RTW. See Section 4.2.2.2, “Data dictionary
files” for more.
1021. (error 1021): line 'number' of 'file name': 'dde name' represents map
calibration data and must have a real_T or F32 type.
OpenECU 1-d and 2-d map lookup blocks only work with floating point types
(integer types are unsupported in these blocks). Change the type of the map
axis or map data to be real_T or F32.
1022. (error 1022): line 'number' of 'file name': 'dde name' has an invalid
number 'x' for the accuracy column.
The tool was expecting to find a number in the accuracy field but found
something else instead.
1023. (error 1023): line 'number' of 'file name': 'dde name' has a maximum
value but no minimum.
The tool expects to see both a minimum and a maximum for the DDE if
one or the other is present. The DDE must either have no minimum and
maximum specified or both.
1024. (error 1024): line 'number' of 'file name': 'dde name' has a minimum
value but no maximum.
The tool expects to see both a minimum and a maximum for the DDE if
one or the other is present. The DDE must either have no minimum and
maximum specified or both.
1025. (error 1025): line 'number' of 'file name': 'dde name' has an invalid
number 'x' for the minimum value.
The tool was expecting to find a number in the minimum field but found
something else instead.
1026. (error 1026): line 'number' of 'file name': 'dde name' has boolean type
so its minimum must be zero.
The type of the DDE is a boolean, so the minimum value must be zero but
the tool found a different value for the minimum field.
1027. (error 1027): line 'number' of 'file name': 'dde name' has an invalid
number 'x' for the maximum value.
The tool was expecting to find a number in the maximum field but found
something else instead.
1028. (error 1028): line 'number' of 'file name': 'dde name' has boolean type
so its maximum must be one.
The type of the DDE is a boolean, so the maximum value must be one but
the tool found a different value for the maximum field.
1029. (error 1029): line 'number' of 'file name': 'dde name' has an invalid
number 'x' for the scale value.
The tool was expecting to find a number in the scale field but found
something else instead.
1030. (error 1030): line 'number' of 'file name': 'dde name' has an invalid
number 'x' for the offset value.
The tool was expecting to find a number in the scale field but found
something else instead.
1032. (error 1032): line 'number' of 'file name': 'dde name' has a different
matrix size from the X-axis matrix size.
The tool has detected that the z-data matrix size in for the x-axis differs in
size from the x-axis. The size of the axes and data must match.
1033. (error 1033): line 'number' of 'file name': 'dde name' has a different
matrix size from the Y-axis matrix size.
The tool has detected that the z-data matrix size in for the y-axis differs in
size from the y-axis. The size of the axes and data must match.
1034. (error 1034): line 'number' of 'file name': 'dde name' has multiple rows
but no Y-axis data dictionary entry.
The tool has detected that the z-data for a map contains data for both the x
and y axes but no y-axis DDE has been declared.
1035. (error 1035): line 'number' of 'file name': 'dde name' does not have a
corresponding X-axis data dictionary entry.
The tool has detected that there is z-data for a map lookup but no
corresponding x-axis DDE has been declared.
1036. (error 1036): line 'number' of 'file name': 'dde name' must be a scalar.
The tool has read more than one value for the scalar calibration. Only one
value can be specified.
1037. (error 1037): line 'number' of 'file name': an unnamed column was found
— skipping entire data dictionary.
The tool has found a column without a name. This can occur if two tab
characters are placed next to each other
1038. (error 1038): line 'number' of 'file name': column 'name' is only allowed
in 'style'-style data dictionaries — skipping entire 'style'-style data
dictionary.
The tool has found a column in the title line of the data dictionary that it does
not recognise. The only valid column names in a prefix-style data dictionary
file are:
The only valid column names in a C-style data dictionary file are:
1039. (error 1039): line 'number' of 'file name': 'dde name' is an invalid Cref
for a data dictionary entry (must not start with a digit).
The tool has found an invalid name for the Cref column. This is an internal
error. Please contact OpenECU support.
1040. (error 1040): line 'number' of 'file name': 'dde name' is an invalid Cref
for a data dictionary entry (must only use characters 'a' through 'z', 'A'
through 'Z', '0' through '9' or '_').
The tool has found an invalid name for the Cref column. This is an internal
error. Please contact OpenECU support.
1041. (error 1041): line 'number' of 'file name': 'dde name' is a reserved name
for a data dictionary entry (must not use the 'mpl' prefix).
The tool has found a DDE with a name which starts with mpl. This prefix
is reserved for OpenECU use. Rename the DDE variable using a different
prefix.
1042. (error 1042): line 'number' of 'file name': the 'field_name' field must
be present in [style]-style data dictionaries — skipping entire data
dictionary.
The tool has found the title line but could not locate all the necessary fields/
columns. At a minimum, the following fields/columns must be present in
prefix-style data dictionaries:
1043. (error 1043): line 'number' of 'file name': 'dde name' is an invalid [object]
name for a data dictionary entry (must be greater than 3 characters
long).
1044. (error 1044): line 'number' of 'file name': 'dde name' is an invalid [object]
name for a data dictionary entry (must be less than 'number' characters
long).
1045. (error 1045): line 'number' of 'file name': 'dde name' is an invalid [object]
name for a data dictionary entry (must not start with a digit or a '_'
character).
Simulink and C compilers disallow names that start with a digit or '_'
character. Change the DDE name to start with a letter.
1046. (error 1046): line 'number' of 'file name': 'dde name' is an invalid [object]
name for a data dictionary entry (must only use characters 'a' through
'z', 'A' through 'Z', '0' through '9' or '_').
1047. (error 1047): line 'number' of 'file name': 'dde name' is an invalid [object]
name for a data dictionary entry (must not end in '_x' or '_y' or '_z').
The tool has recognised that the referenced enumeration looks like a map
DDE. Rename the enumeration reference so it does not end like a map.
1048. (error 1048): line 'number' of 'file name': 'dde name' is a reserved name
for a data dictionary enumeration entry (must not use the 'mpl' prefix).
The tool has found a DDE with an enumerated name which starts with mpl.
This prefix is reserved for OpenECU use. Rename the DDE variable using
a different prefix.
1049. (error 1049): line 'number' of 'file name': 'dde name' uses an
enumeration 'enum name' that is not declared in any data dictionary.
The tool has found an enumeration reference for the DDE named 'dde name'
that does not exist in any data dictionary. Change the enumeration reference
to a data dictionary entry that does exist.
1050. (error 1050): line 'number' of 'file name': 'dde name' uses an
enumeration 'enum_name' which has a non-scalar value.
1051. (error 1051): line 'number' of 'file name': 'dde name' uses enumerations
'enum_name' and 'enum_name' which have the same value.
The tool has found a data dictionary entry which refers to two enumerations
but both enumerations have the same value. Enumerations for one data
dictionary entry must have unique values.
1052. (error 1052): line 'number' of 'file name': 'dde name' has a value less
than its type allows.
The tool has found a value for a data dictionary entry which has a value
outside the range of its type.
1053. (error 1053): line 'number' of 'file name': 'dde name' has a value greater
than its type allows.
The tool has found a value for a data dictionary entry which has a value
outside the range of its type.
1054. (error 1054): line 'number' of 'file name': 'dde name' must not have a
scale value of zero.
The tool has found a DDE with a scaling factor of zero. This is disallowed, as
the reciprocal of the factor is used by OpenECU tools and calibration tools.
1055. (error 1055): line 'number' of 'file name': 'dde name' has no
corresponding DDE called 'z-data dde name'.
The tool has found a x-axis DDE without a corresponding z-axis DDE, both
are needed to create a 1-d map.
1056. (error 1056): line 'number' of 'file name': 'dde name' has no
corresponding DDE called 'z-data dde name'.
The tool has found a y-axis DDE without a corresponding z-axis DDE, both
are needed to create a 2-d map.
1057. (error 1057): line 'number' of 'file name': 'dde name' is a displayable
with a value.
The tool has found a displayable DDE with a value, only calibration DDEs
can have values.
1058. (error 1058): line 'number' of 'file name': 'dde name' has a minimum
smaller than its type allows.
The tool has found a DDE which has a minimum value less than the type of
the DDE can store. The minimum or type must be adjusted.
1059. (error 1059): line 'number' of 'file name': 'dde name' has a maximum
larger than its type allows.
The tool has found a DDE which has a maximum value greater than the type
of the DDE can store. The maximum or type must be adjusted.
1060. (error 1060): line 'number' of 'file name': 'dde name' has duplicated
enumeration 'enum name'."
The tool has found a DDE which has a repeated enumeration in the DDE's
enumeration list. Duplicated enumerations are disallowed.
1061. (error 1061): line 'number' of 'file name': 'class' is an invalid Class for
a data dictionary entry (must be one of: 'c', 'cmap', 'caxis', 'cstring',
'carray', 'd', 'darray').
The string 'class' given in the Class column is not one of the allowed types
for this DDE.
1062. (error 1062): line 'number' of 'file name': enum 'c identifier' has an
invalid byte size = 'bytes'.
The interface tool has found an enumeration with name 'c identifier' which
has a byte size it does not recognise. If this error occurs please contact
OpenECU technical support.
1063. (error 1063): line 'number' of 'file name': variable 'c identifier' is a
pointer; this is not supported for ASAP2 generation.
The interface tool can generate ASAP2 files but ASAP2 files cannot
represent pointers. DDE references to C variables which have pointer type
are therefore rejected.
1064. (error 1064): line 'number' of 'file name': variable 'c identifier' is a
bitfield; this is not supported for ASAP2 generation.
The interface tool cannot yet generate ASAP2 files that access bitfields.
Adjust the data structure to avoid using bitfields or copy the bitfields of
interest to other variables which are accessible.
1065. (error 1065): line 'number' of 'file name': variable 'c identifier' has a type
not currently supported for ASAP2 generation of 'value'.
The interface tool has found type information for a C variable that it does
not know how to handle. If this message occurs, please contact OpenECU
technical support.
1066. (error 1066): line 'number' of 'file name': variable 'c identifier' has class
cstring but is not a byte array.
A C-style DDE has been classed as a string but the type of the equivilent C
variable is not signed or unsigned char (wide characters are not supported).
Either change the C variable to have an appropriate type of change the class
of DDE.
1067. (error 1067): line 'number' of 'file name': variable 'dde name' is not class
cmap yet has Xaxis, Yaxis and/or Lookup entries.
A C-style DDE has information in the Xaxis, Yaxis or Lookup columns but the
DDE is not a calibration map. Only calibration maps should have information
in the Xaxis, Yaxis or Lookup columns.
1068. (error 1068): line 'number' of 'file name': variable 'dde name' used in
map must have real_T (float) type.
OpenECU 1-d and 2-d map lookup blocks only work with floating point types
(integer types are unsupported in these blocks). Change the type of the map
axis or map data to be real_T or F32.
1069. (error 1069): line 'number' of 'file name': variable 'dde name' has
Lookup entry 'name' which caused an unexpected error.
An internal error has occurred in the interface tool. If this error occurs, please
contact OpenECU technical support.
1070. (error 1070): line 'number' of 'file name': variable 'dde name' has x and
y Lookup entries 'string' but no Yaxis entry.
The calibration map with 'dde name' is 2d and has an x-axis Lookup DDE
but no y-axis Lookup DDE. Calibration maps must have a lookup DDE for
each map axis.
1071. (error 1071): line 'number' of 'file name': variable 'dde name' has
Lookup entry 'name' which is not found in ELF data.
The lookup DDE 'name' for calibration map DDE 'dde name' doesn't exist in
the Diab ddump file. Check that the spelling is correct, that the equivalent C
variable is declared and not optimised away by the compiler.
1072. (error 1072): line 'number' of 'file name': variable 'dde name' has
Lookup entry 'name' which has no corresponding DDE, removing
lookup variables from map.
The lookup DDE 'name' for calibration map DDE 'dde name' doesn't exist
as a DDE in any of the other DDE files. The lookup DDE must be declared
in one of the DDE files.
1073. (error 1073): line 'number' of 'file name': variable 'dde name' has
Lookup entry 'name' which does not have Class 'd'.
The lookup DDE 'name' for calibration map DDE 'dde name' is declared
as something other than a displayable (Class column set to 'd'). Only
displayable variables can be used as lookups to calibration maps.
1074. (error 1074): line 'number' of 'file name': variable 'dde name' has
Lookup entry 'name' which does not have type real_T (float).
The lookup DDE 'name' for a calibration map DDE 'dde name' must have
single precision floating point type to correctly match the C-API to the map
lookup functions.
1075. (error 1075): line 'number' of 'file name': variable 'dde name' has Xaxis
and Yaxis but only one Lookup entry; should have nothing or two.
The calibration map with 'dde name' is 2d and has one lookup DDE.
Calibration maps must have a lookup DDE for each map axis. Check that
the Lookup column does not specify only a y-axis lookup DDE.
1076. (error 1076): line 'number' of 'file name': 'dde name' is not found in the
ELF information file output, contains an out of range array index, or is
declared but not referenced in the source code.
A DDE is declared in the data dictionary but the corresponding varaible could
not be found in the Diab ddump or GNU objdump output file. Check the name
for spelling mistakes or add the corresponding variable to the application C
code.
1077. (error 1077): line 'number' of 'file name': map variable 'dde name' has
no Xaxis or Yaxis specified.
A calibration map specified by a C-style DDE has neither the Xaxis and Yaxis
DDEs specified. A 1d calibration map must have the Xaxis specified, a 2d
calibration map must have both the Xaxis and Yaxis specified.
1078. (error 1078): line 'number' of 'file name': 'dde name' is not found in
the ddump ELF file output, contains an out of range array index, or is
declared but not referenced in the source code.
The name for a C-style data dictionary entity wasn't present in the final linked
application image and therefore cannot be processed. Check the name for
spelling mistakes or add the corresponding variable to the application C
code.
1079. (error 1079): line 'number' of 'file name': 'dde name' is an invalid name
for a C-style data dictionary entry (must resolve to a C identifier).
The name for a C-style data dictionary entity doesn't conform to the allowed
scheme. The name of the DDE must be changed.
1080. (error 1080): line 'number' of 'file name': variable 'dde name' has
Lookup entry 'string' but should have one identifier or two separated
by a comma.
The Lookup column for DDE 'dde name' has an unexcepted value of 'string'.
Instead the Lookup column should have one DDE name or two DDE names
separated by a comma.
1081. (error 1081): line 'number' of 'file name': unexpected information at end
of line — skipping entire data dictionary.
The tool has found a DDE line containing more information that there are
columns. Remove the additional information and tab characters, or declare
an additional column in the title line of the DDE file.
1082. (error 1082): line 'number' of 'file name': 'dde name' is an invalid name
for a C-style data dictionary entry (must not start with a digit character).
To provide compatibility with C compilers, C-style DDE names must not start
with a digit.
1083. (error 1083): line 'number' of 'file name': 'dde name' is an invalid name
for a C-style data dictionary entry (must only use characters 'a' through
'z', 'A' through 'Z', '0' through '9' or '_', '.', '[', ']').
The interface tool accepts a subset of the C lanaguage syntax for variable
names, array and structure member access.
1085. (error 1085): line 'number' of 'file name': column 'name' is unrecognised
— skipping entire data dictionary.
The tool has found a column with a name it does not recognise, i.e., not one
of the allowed column names. The only valid column names in a prefix-style
data dictionary file are:
The only valid column names in a C-style data dictionary file are:
1086. (error 1086): line 'number' of 'file name': DDE 'dde name' has Lookup
entry 'string' but should have none, one or two identifiers separated
by a comma.
The Lookup column for DDE 'dde name' has an unexcepted value of 'string'.
Instead the Lookup column should have one DDE name or two DDE names
separated by a comma.
1087. (error 1087): line 'number' of 'file name': 'dde name' is a constant but
has no value.
The entry is a constant but does not contain a default value, which it must do.
1100. (error 1100) file 'file name': could not open 'ELF-type' output file for
reading, 'error message'.
The interface tool could not read the Diab ddump or GNU objdump file
named 'file name' and the operating system's reason for not being able to do
so is given by 'error message'. Correct the reason for failure and try again.
1101. (error 1101): file 'file name': variable with no name attribute in ELF
information file at line 'number'.
The interface tool has found an unnamed attribute in the Diab ddump or
GNU objdump file, something the tool was not expecting. If this error occurs
please contact OpenECU technical support.
1102. (error 1102): file 'file name': 'object' with no type attribute in ELF
information file at line 'number'.
1103. (error 1103): file 'file name': referenced ID not found in ELF information
file at line 'number'.
The interface tool has found a reference in the ELF information file with
no corresponding entry, as if the Diab ddump or GNU objdump file was
incomplete. If this error occurs please contact OpenECU technical support.
1104. (error 1104): file 'file name': nested array in ELF information file at line
'number'.
The interface tool has found a nested array reference in the Diab ddump or
GNU objdump file, something the tool was not expecting. If this error occurs
please contact OpenECU technical support.
1105. (error 1105): file 'file name': structure element with unreadable offset
in ELF information file at line 'number'.
The interface tool has found a structure member in the Diab ddump or GNU
objdump file but could not read the offset information, something the tool
was not expecting. If this error occurs please contact OpenECU technical
support.
1106. (error 1106): file 'file name': structure element with no offset in ELF
information file at line 'number'.
The interface tool has found a structure member that the Diab ddump or
GNU objdump file has no offset information for, something the tool was not
expecting. If this error occurs please contact OpenECU technical support.
1107. (error 1107): file 'file name': variable with no byte size in ELF
information file at line 'number'.
The interface tool has found a variable without size information in the Diab
ddump or GNU objdump file, something the tool was not expecting. If this
error occurs please contact OpenECU technical support.
1108. (error 1108): file 'file name': DIE with two identically named attributes
found.
The interface tool has found two identically named attributes in the contents
of the Diab ddump file 'file name'. This is an unexpected condition, please
contact OpenECU technical support if this message occurs.
1109. (error 1109): file 'file name': two DIEs with same tag 'name' found in
ELF information file.
The interface tool has found two identically named DIEs in the contents of
the Diab ddump or GNU objdump file 'file name'. This is an unexpected
condition, please contact OpenECU technical support if this message
occurs.
1110. (error 1110): auto-generated data dictionary output from the C-API has
been fed back in as input; this is disallowed to avoid the possibility of
attempting to write a file which is simultaneously being used as input.
The interface tool rejects attempts to read the autogenerated data dictionary
file the interface tool itself generates. Instead, the autogenerated data
dictionary entities of interest should be copied to a separate data dictionary
file and included.
1112. (error 1112): file 'file name': no match for 'dde name' in ELF information
file.
The interface tool found an array which was too small or could not find
an array element while decoding the 'dde name' DDE. Check that the 'dde
name' exists as a C variable and that the variable has not been optimised
away by the compiler.
1113. (error 1113): file 'file name': no match for 'dde name' in ELF information
file — array bound exceeded.
The interface tool has found a matching C variable for the DDE 'dde name'
but one of the array range specifiers in the DDE is outside the bounds of the
equivalent array range of the C variable.
1114. (error 1114): file 'file name': unexpected section type 'name' in ELF
information file.
The interface tool found an ELF section in the Diab ddump or GNU objdump
file it wasn't expecting. If this error occurs, please contact OpenECU
technical support.
1115. (error 1115): file 'file name': no debug variables or section information
found in ELF information file — is this a Diab 5.5.1.0 (or later) ddump
-Dht file?
The interface tool could read the Diab ddump or GNU objdump file but did
not find any C variable or ELF section information. Check that the correct
file was specified in the command line options.
1116. (error 1116): file 'file name': no match for 'dde name' in ELF information
file.
The interface tool could not find information about DDE 'dde name' in the
Diab ddump or GNU objdump output file. This may occur if there is no
equivilent C variable with the same name as the DDE.
1117. (error 1117): line 'number' of file 'file name': 'dde name' has an invalid
number 'number' for the sample rate value.
The interface tool expects the sample rate value to be a natural integer.
1118. (error 1118): line 'number' of file 'file name': the group for 'dde name'
cannot contain single quote characters.
The interface tool expects each group name to avoid the use of the single
quote character ', to avoid issues with ASAP2 validation by calibration tools.
1119. (error 1119): line 'number' of file 'file name': the group for 'dde name'
cannot contain double quote characters.
The interface tool expects each group name to avoid the use of the double
quote character ", to avoid issues with ASAP2 validation by calibration tools.
1120. (error 1120): line 'number' of file 'file name': the group for 'dde name'
is invalid (group must start with a '/' character).
The interface tool expects each group name to be empty or start with a /
character denoting the top of the hierachy. In this case, the group is not
empty, change the group string to start with a / character.
1121. (error 1200): line 'number' of file 'file name': there must be no more than
8 DAQ rasters defined for CCP messaging.
The platform software does not support more than 8 DAQ rasters. Reduce
the total number of rasters to 8 or less.
1122. (error 1201): line 'number' of file 'file name': the total size of the CCP
DAQ rasters must be no more than 254.
The CCP protocol does not support more than 254 ODTs for all of the defined
rasters. Reduce the size of each raster to total less than the allowed limit.
1123. (error 1202): line 'number' of file 'file name': the CCP DAQ raster name
'%s' must not be repeated.
When generating an ASAP2 file, the interface tool requires that the name of
each CCP DAQ raster is unique. This avoids situations where a calibration
tool displays the same raster name for different rasters, making the selection
of raster ambiguous.
1124. (error 1203): line 'number' of file 'file name': the CCP DAQ raster named
'raster-name' must have a rate not smaller than 5 milliseconds.
The platform software supports CCP DAQ rasters with a base period of 5
milliseconds. Increase the raster rate to be at least 5 milliseconds.
1125. (error 1204): line 'number' of file 'file name': the CCP DAQ raster named
'raster-name' must have a rate not exceeding 10 seconds.
The platform software supports CCP DAQ rasters with a maximum period
of 10 seconds. Reduce the raster rate to at least 10 seconds.
1126. (error 1205): line 'number' of file 'file name': the CCP DAQ raster named
'raster-name' must have a rate that is a multiple of 5 milliseconds.
The platform software supports CCP DAQ rasters with a period resolution
of 5 milliseconds. Adjust the raster rate to be a multiple of 5 milliseconds.
1127. (error 1206): line 'number' of file 'file name': the CCP DAQ raster named
'%s' must have have at least one ODT.
The platform software does supports CCP DAQ rasters with one or more
ODTs. Increase the raster size to at least 1.
1128. (warning 1207): line 'number' of file 'file name': the CCP DAQ raster rate
'%s' is repeated and may confuse some calibration tools.
Not all calibration tools support multiple CCP DAQ rasters with the same
periodic rate (for example, INCA v.5.1.2). Workaround the calibration tool
issue by changing the periodic rates of rasters to differ.
2001. (warning 2001): line 'number' of 'file name': 'dde name' has type 'type'
which supports at most 'x' digits of display after the decimal point.
The tool has detected that the type of the element can support a certain
number of digits after the decimal point, but the DDE accuracy field asks
for more digits to be displayed. The tool reduces the number of digits to be
displayed after the decimal point to the maximum supported by the type.
2002. (warning 2002): line 'number' of 'file name': 'dde name' has a value less
than the minimum specified.
The minimum specified for the DDE is greater than the minimum value given.
The minimum field is adjusted to the minimum of the values.
2003. (warning 2003): line 'number' of 'file name': 'dde name' has a minimum
greater than the maximum.
The tool was expecting to see a minimum value less than the maximum
value but this was not the case.
2004. (warning 2004): line 'number' of 'file name': 'dde name' has a value
greater than the maximum specified.
The maximum specified for the DDE is greater than the maximum value
given. The maximum field is adjusted to the maximum of the values.
The tool has read the unit 'units' more than once. The redundant copy (or
copies) can be removed from the units file.
A units file is present but it contains no unit definitions (the file contains
whitespace or comments only).
2007. (warning 2007): line 'number' of 'file name': the unit 'unit name' for DDE
'dde name' is not in the units file.
The tool has read a DDE with a unit definition that does not match any from
the units file. Edit the unit definition for that DDE to match any unit definition
in the units file, or extend the units file accordingly.
2008. (warning 2008): file 'file name': found an empty tabbed DDE file.
A tabbed DDE file is present but it contains no DDE definitions (the file
contains whitespace or comments only).
2009. (warning 2009): file 'file name': found repeated DDE 'dde name',
discarding DDE.
A repeated DDE named 'dde name' was found in file file name. The original
DDE is retained and the duplicate is ignored.
2010. (warning 2010): line 'number' of 'file name': variable 'c identifier' occurs
at more than one address.
The interface tool has found more than address in memory for the same
C variable and does not know which address to use. If this warning occurs
please contact OpenECU technical support.
2011. (warning 2011): line 'number' of 'file name': ignoring variable 'dde
name' for which no type information was obtained from the ELF
information file; this may occur if it is declared but not actually used
in source code, or if you specify a containing structure instead of a
specific element within it.
The tool has found a data dictionary entry which appears as if it were a
map but does not follow the naming convention specified in Section 5.2.5,
“Naming rules”.
2502. Warning (2502): 'dde_name' must be a 1xN vector. Skipping this DDE.
The tool has found a data dictionary entry which is an array or a axis DDE
but the data for the DDE isn't a vector (as required).
2503. Warning (2503): 'dde_name' must be a MxN matrix. Skipping this DDE.
The tool has found a data dictionary entry which is the z-data for a map but
the data for the DDE isn't a 2-D matrix (as required).
2504. Warning (2504): 'dde_name' the x-axis DDE 'dde_name' for map
'map_dde_name' must be a 1xN vector. Skipping this DDE.
The tool has found a data dictionary entry which has a x-axis DDE which
isn't a vector (as required).
2505. Warning (2505): 'dde_name' the size of the x-axis DDE 'dde_name' for
map 'map_dde_name' must be a 1xN vector (where N > 1). Skipping
this DDE.
The tool has found a data dictionary entry for an x-axis with only one element.
X-axis DDEs should have at least two elements.
2506. Warning (2506): 'dde_name' the size of the x-axis DDE 'dde_name'
differs from the number of columns in the map DDE 'map_dde_name'.
Skipping this DDE.
The tool has found a data dictionary entry for an x-axis which does not match
the size of the corresponding z-data map DDE.
2507. Warning (2507): 'dde_name' the y-axis DDE 'dde_name' for map
'map_dde_name' must be a 1xN vector. Skipping this DDE.
The tool has found a data dictionary entry which has a y-axis DDE which
isn't a vector (as required).
2508. Warning (2508): 'dde_name' the size of the y-axis DDE 'dde_name' for
map 'map_dde_name' must be a 1xN vector (where N > 1). Skipping
this DDE.
The tool has found a data dictionary entry for a y-axis with only one element.
Y-axis DDEs should have at least two elements.
2509. Warning (2509): 'dde_name' the size of the y-axis DDE 'dde_name'
differs from the number of columns in the map DDE 'map_dde_name'.
Skipping this DDE.
The tool has found a data dictionary entry for a y-axis which does not match
the size of the corresponding z-data map DDE.
The interface tool has read an interface specification file and found
a compound statement with a missing assignment statement called
'assignment'. In this case, the interface tool is expecting the assignment
statement to be present (i.e., the assignment statement is not optional).
950. (error 950): within the 'compound' statement, at least one of these
lists of statements must be provided completely (entries marked * are
already present):
The interface tool has read an interface specification file and found a
compound statement with a missing assignment statement. In this case, the
interface tool is expecting the compound statement to contain assignment
statements from one of the lists presented (i.e., some assignment
statements are not optional).
951. (error 951): within the interface file, there is a missing 'compound'
statement.
The interface tool has read an interface specification file and found that the
file is missing a compound statement called 'compound'. In this case, the
interface tool is expecting the compound statement to be present (i.e., the
statement is not optional). Missing assignment statements are marked by
the absence of an asterisk.
951. (error 951): within the interface file, at least one of these lists of
statements must be provided completely (entries marked * are already
present):
The interface tool has read an interface specification file and found a
compound statement with a missing assignment statement. In this case, the
interface tool is expecting the compound statement to contain assignment
statements from one of the lists presented (i.e., some assignment
statements are not optional). Missing assignment statements are marked by
the absence of an asterisk.
The interface tool has not been able to identify the target based on the
declarations given in the target-ecu statement. See error text emitted for
specific information.
The interface tool has found more than one target-ecu compound statement
in an interface file, where the tool was expecting only one.
The interface tool has found that required declarations were missing from
the target-ecu compound statement. See the error text emitted for further
details.
The interface tool has found a hw-issue-number outside the value range of
[0, 65535].
The interface tool has found a hw-option text string that was not three
characters long.
The interface tool has found more than one application compound statement
in an interface file, where the tool was expected only one.
This error code is emitted for a variety of issues with application statements.
See error text emitted for details of problem identified.
The interface tool has not found the stack-size statement in an interface file
(the tool was expecting one).
The interface tool has found a stack-size statement specifying less than 1024
bytes (the tool requires at least 1024 bytes to be specified).
The interface tool reports this error code for several different errors relating
to OS task declarations. See emitted error text for details of the problem
identified.
The interface tool has found more than 12 tasks specified in an os-native
compound statement (the tool expected less than 12).
The interface tool has found a task compound statement without a required
'name' statement.
3155. (error 3155): duplicate task name for task 'name' already exists.
The interface tool has found a task named 'name' more than once (all task
names must be unique).
3156. (error 3156): an existing task 'name' already has a priority of 'value'.
The interface tool has found a task with a priority of 'value' but the priority
value is not unique (all task priority values must be unique).
The interface tool has found a task with a period less than one millisecond
(the tool does not support task rates less than one millisecond).
The interface tool has found a task with a period greater than one hour (the
tool does not support task rates greater than one hour).
3163. (warning 3163): offset greater than twice period for task.
The interface tool has found a task with an offset (delay before first
execution) time that is more than twice the task period. This is allowed but
the warning is generated in case the long offset was specified accidentally.
The interface tool has found more than one top-dead-centre triggered
angular task. Currently only one such task is supported.
3167. (error 3167): tasks with a 'tdc-firing' trigger are only supported by (xxx)
targets.
The interface tool has found an angle-triggered task specified for an ECU
target which does not yet support angular tasks.
The interface tool has found more than one crank sync-point triggered
angular task. Currently only one such task is supported.
3169. (error 3169): tasks with a 'crank-sync-point' trigger are only supported
by (xxx) targets.
The interface tool has found an angle-triggered task specified for an ECU
target which does not yet support angular tasks.
The interface tool has found a resource compound statement with a repeated
name statement.
The interface tool has found a resource compound statement with a name
statement identical to another resource statement (all resource names must
be unique).
The interface tool has found a used-by-task statement which refers to a task
which is not specified.
3183. (error 3183): number of CAN receive messages is outside the range
[0,100].
3184. (error 3184): number of CAN transmit messages is outside the range
[0,100].
3191. (error 3191): more than one PGN pdu-datapage statement specified.
The interface tool has found a repeated ccp-messaging statement (the tool
expects only one).
The interface tool reports this error code for several reasons relating to CAN
Calibration Protocol statements. See error text emitted for details of problem.
3203. (error 3203): CCP CRO identifier of 'value' is outside the range [0,2047].
3204. (error 3204): CCP DTO identifier of 'value' is outside the range [0,2047].
The DTO identifier was specified to be in standard ID mode, and the interface
tool has found a dto statement with value outside the valid range.
3205. (error 3205): CCP CRO and DTO identifiers both have the same value
of 'value'.
The interface tool has found a cro and dto statement with identical CAN
identifier values (the CRO and DTO CAN identifiers must be unique).
3206. (error 3206): CCP station address identifier of 'value' is outside the
range [0,255].
The interface tool has found a station-address statement with value outside
the valid range.
3207. (error 3207): CCP bus 'value' is outside the range [0,2] supported by
target 'name'.
The interface tool has found a can-bus statement referring to a CAN bus
which isn't implemented by the target.
3208. (error 3208): CCP baud rate of 'value' kBps is not supported.
The interface tool has found more than one cro-ext-id statement in the c-
api interface file.
The interface tool has found more than one dto-ext-id statement in the c-
api interface file.
3211. (error 3211): CCP CRO identifier of 'value' is outside the range
[0,536870911].
The CRO identifier was specified to be in extended ID mode, but the cro
statement still specifes a value outside of the 29 bit range. range.
3212. (error 3212): CCP DTO identifier of 'value' is outside the range
[0,536870911].
The DTO identifier was specified to be in extended ID mode, but the dto
statement still specifes a value outside of the 29 bit range.
3223. (error 3223): J1939 CAN bus 'value' is outside the range [0,2] supported
by target 'name'.
The interface tool has found a can-bus statement referring to a CAN bus
which isn't implemented by the target.
3224. (error 3224): J1939 message buffer size 'value' is outside the range
[8,1785]")
3227. (error 3227): J1939 num-rx-tx value of 'value' is outside the range
[1,100].
The interface tool has found a num-rx-tx statement with value outside the
valid range.
The interface tool reports this error code for several different issues related
to J1939 declarations. See error text emitted for details of problem.
3241. (error 3241): J1939 node address of 'value' is reserved and cannot be
used in the list of DMx nodes.
The interface tool has found the address 254 or 255 in a listen-for-dm1-
message or listen-for-dm2-message statement (addresses 254 and 255 are
reserved by the J1939 protocol).
3242. (error 3242): J1939 node address of 'value' is an address of one of the
channels on this node.
3251. (error 3251): more than one J1939 this-node statement is present.
The interface tool has found a repeated this-node statement within a j1939-
messaging compound statement (the tool expects only one).
The interface tool reports this error code for several different issues related
to J1939 declarations. See error text emitted for details of problem.
3257. (error 3257): J1939 node function value of 'value' is outside range of
[0,255].
3259. (error 3259): J1939 node ecu-instance value of 'value' is outside range
of [0,7].
3271. (error 3271): more than one PGN size statement specified.
3276. (error 3276): J1939 PGN has a size outside the range of [0,1785] bytes.
3277. (error 3277): J1939 PGN has a size larger than the J1939 message
buffer.
The interface tool has found a more than one pgn-receive compound
statement with the same PGN (the tool expects only one).
The interface tool reports this error code for several different issues related
to J1939 PGN declarations. See error text emitted for details of problem.
3292. (error 3292): pdu-datapage value of 'value' is outside the range [0,1].
3293. (error 3293): pdu-format value of 'value' is outside the range [0,255].
3294. (error 3294): pdu-specific value of 'value' is outside the range [0,255].
3295. (error 3295): J1939 PGN has a PDU format less than 240 and a PDU
specific value that is non-zero.
The interface tool has found a more than one pgn-requested compound
statement with the same PGN (the tool expects only one).
The interface tool has found more than one PID with its j1979-8bit-id
statement set to the same identifier.
The interface tool has found more than one PID with its kwp-8bit-id statement
set to the same identifier.
The interface tool has found more than one PID with its iso-16bit-id statement
set to the same identifier.
The interface tool has found a DTE identifier 'id' more than once (DTE IDs
must be unique).
3301. (error 3301): more than one DTC storage statement specified.
The interface tool has found a dtc-data compound statement with a repeated
storage statement (the tool expects one).
3302. (error 3302): target 'name' does not support battery backed RAM
storage.
3303. (error 3303): DTCs are not supported for target 'name'.
The interface tool has found a dtc-data compound statement for a target
which does not support DTCs.
The interface tool has found a DME identifier 'id' more than once (DME IDs
must be unique).
The interface tool has found that the Monitor group ID 'id' defined for the DTE
is not defined (each DTE must be associated with a Monitor that exists).
The interface tool reports this error code for several issues relating to J1939
and ISO-15765 Diagnostic Trouble Codes. See error text emitted for details
of problem.
The interface tool has found a dtc- compound statement containing a name
statement specifying an identical name to another object (the tool expects
all names to be unique).
The interface tool has found a dtc compound statement containing a table
statement that refers to an unspecified table.
3314. (error 3314): J1939 DTC SPN value of 'value' is outside the range
[0,524287].
3315. (error 3315): J1939 DTC FMI value of 'value' is outside the range [0,31].
3316. (error 3316): J1939 DTC CM value of 'value' is outside the range [0,1].
The interface tool has found a DTE identifier 'id' more than once (DTE IDs
must be unique).
The interface tool has found a DME identifier 'id' more than once (DME IDs
must be unique).
The interface tool has found that the DME ID 'id' defined within the DTE is not
defined (each DTE should be associated with a DME that exists, otherwise
it is orphaned).
3320. (warning 3320): no DTEs have been defined for this DME 'id'
The interface tool has found that the DME ID 'id' has not been associated with
any DTE. This is allowed, but a warning is raised to check if it is intentional.
The interface tool has found that the same ID has been used for the Physical
and Functional Rx on ISO-15765 comms. This is currently allowed, but a
warning is raised in case this was unintentional.
3341. (error 3341): adaptive adaptive name has already been specified.
The interface tool has found more the same adaptive parameter name listed
more than once.
3345. (error 3345): more than one adaptive storage statement specified.
3346. (error 3346): target target_name does not support battery backed RAM
storage.
3351. (error 3351): Tunes are not supported for target 'name'.
The interface tool has found a tunes compound statement for a target which
does not support Tunes.
The interface tool has not found the os-native compound statement in an
interface file (the tool was expecting one).
The interface tool has found a task compound statement without a required
'priority' statement.
The interface tool has found a task compound statement for a periodic task
which has no (or zero) repetition time period specified.
The interface tool has found a task compound statement for a non-periodic
(e.g. angular) task which has a repetition time period specified.
The interface tool has found a task compound statement for a task which
has no C function specified.
3360. (error 3360): more than one DTC lamp state priority statement
specified.
The interface tool has found a dtc-data compound statement with a repeated
dtc-lamp-state-priority statement (the tool expects at most one).
3361. (error 3361): more than one DTC transition previously active to pending
statement specified.
The interface tool has found a dtc-data compound statement with a repeated
dtc-transition-prev-active-to-pending statement (the tool expects at most
one).
The interface tool has found a diagnostic PID with an out of range 16-bit ID
number.
The interface tool has found that the same ID has been used for the Physical
Rx and Tx IDs for ISO-15765 (the receive and transmit IDs have to be
different).
3404. (error 3404): ISO diagnostic tx buffer size must be in range [1, 4095]
The interface tool has found that the Tx buffer size defined for ISO-15765
is out of allowed range.
3405. (error 3405): ISO diagnostic rx buffer size must be in range [1, 4095]
The interface tool has found that the Rx buffer size defined for ISO-15765
is out of allowed range.
3406. (error 3406): more than one ISO Diagnostic can-bus statement
specified
The interface tool has found a repeated ccp-messaging statement (the tool
expects only one).
The interface tool has found a diagnostic PID with an out of range 8-bit ID
number.
The interface tool has found that the DM7 request buffer/ queue size is out
of allowed range.
The interface tool has found a more than one aecd compound statement
with the same AECD number (the tool expects only one).
The interface tool has found a test map position outside the permitted range
of [1, 64].
The interface tool has found a test ID outside the permitted range of [1,
0xFF].
The interface tool has found a test map position that has been assigned to
more than one test ID.
The interface tool has found a DTC time-to-derate value outside the
permitted range of [0, 225000] seconds.
3414. (error 3414): J1939 Suspect Parameter Number (SPN) out of range.
The interface tool has found a J1939 SPN outside the permitted range of
[0, 524287].
The interface tool has found the J1939 multiframe-priority value outside the
permitted range of [0, 7].
3416. (error 3416): ISO bus 'value' is outside the range [0,2] supported by
target 'name'.
The interface tool has found a can-bus statement referring to a CAN bus
which isn't implemented by the target.
3423. (error 3423): ISO diagnostic periodic ID base period must be in range
[20, 65530].
3430. (error 3430): DTC extended data record number 'value' is outside the
range [1,239].
The interface tool has found a DTC extended data record number outside
of the permitted range of [1,239].
The interface tool has found a target declaration in the target-ecu statement
for an interface file. The use of target declarations is now deprecated and
will become illegal in a future release. Please delete this declaration.
The interface tool has found a dte statement without the required dte-id or a
dme statement without the required dme-id statement.
The interface tool has found a routine statement without the required
iso-16bit-id statement.
The interface tool has found a routine statement that has the iso-16bit-id
statement set to a routine ID that is reserved by the platform software. Please
select a different routine ID.
The interface tool has found more than one UDS service $31 routine with its
iso-16bit-id statement set to the same identifier.
3506. (error 3506): Routine data byte length outside of range [0, 4095]
The interface tool has found that the byte length for a UDS service $31 data
item is out of allowed range of [0, 4095].
The interface tool has found a target declaration in the target-ecu statement
for an interface file. The use of target declarations is now deprecated and
will become illegal in a future release. Please delete this declaration.
3576. (error 3576): multiple security settings for CCP privilege level
The interface tool has found multiple security statements specifying settings
for the same CCP privilege level in the ccp-messaging statement for an
interface file. At most one security statement must exist for a CCP privilege
level.
3577. (error 3577): parameter 'dde-entry' missing from J1979 freeze frames
declaration
The interface tool has found the dde-entry declaration to be missing from
the declaration of a J1979 protocol freeze frame.
The interface tool has found the dde-entry declaration to be missing from
the declaration of a UDS protocol freeze frame.
3579. (error 3579): parameter 'dde-entry' missing from J1939 dm4 freeze
frame declaration.
The interface tool has found the dde-entry declaration to be missing from
the declaration of a J1939 protocol dm4 freeze frame.
3580. (error 3580): type option 'type' unknown, expecting one of: dm4, dm25.
The interface tool has found an invalid type declaration for a J1939 freeze
frame.
3581. (error 3581): type option 'type' unknown, expecting one of: snapshot.
The interface tool has found an invalid type declaration for a UDS freeze
frame.
The interface tool has been asked to generate a C-style DDE file from
the Diab ddump input file but a Diab MAP file has been specified instead.
Change from the MAP file to the ddump file.
The interface tool has identified that a data dictionary entry with a given
name was not found in the ELF file. This may indicate that the DDE is no
longer required and can be removed from the data dictionary. Or this may
indicate that Simulink Coder has not generated a variable for the DDE and
a change is necessary to the model or model configuration.
5002. (warning 5002): the automatically added DDE [name] is not defined by
[ELF-file], please contact OpenECU technical support.
The interface tool has identified that a data dictionary entry with a given name
was not found in the ELF file. The data dictionary entry was automatically
added by the C-API tool, and failures of this type are not expected. Please
contact OpenECU technical support if this warning occurs.
5003. (warning 5003): the DDE [name] is defined with data type [a] but the
ELF uses data type [b].
The interface tool has identified that a data dictionary entry with a given
name and given data type a, but that Simulink Coder generated a variable
using data type b. This can lead to the calibration tool incorrectly displaying
the value of a signal. To remove the warning, change the DDE data type to
match that generated by Simulink Coder.
Code generation
Communications
• XETK implementation
Diagnostic trouble codes and read/write parameter IDs are supported over
the ISO-15765 and SAE-J1939 protocols.
Target ECU
Added support for the M220-0AU target, which supports M220-0AU and
M220-XAU hardware options. This target differs from the M220-000
target in that it no longer supports any angular features, but adds
support for quadrature decode inputs, 3 phase hall decode inputs, and
a PWM output with synchronous analog input sampling. These new
features can be used with the following blocks pdx_QuadratureDecode,
pdx_QuadratureDecodeAndFrequencyInput, pdx_HallDecodeInput, and
pdx_PWMOutputWithSyncSampling. See the user guide for details on
each of the added interfaces.
OpenECU builds on, and utilises, various tools from third parties, including
C compilers, calibration tools and operating systems. See the third party tool
requirements section for a complete list of required and options software,
and the versions supported.
Added a new field to the PREG Retrieve Key block for the SimAPI to allow
users to be able to enter any generic key ID from the registry to retrieve it's
corresponding value. Fixes an issue where the serial number in modern
ECUs is not stored at the same key as the Legacy ECUs, and thus this
field now allows users to enter the key manually in order to get the correct
serial number depending on the ECU.
The pcx_qemptier_task was stopping even when there were still CAN
messages queued for transmit and the task was not able to be
rescheduled. The root cause was that the status variable controlling
the pcx_qemptier_task was being incorrectly cleared even when there
were CAN messages queued. This was because the read-modify-write
operation of the variable was not protected. This variable was being
altered from outside the interrupt context and was causing corruption
and inconsistent memory states. The issue was fixed by suspending the
scheduler around the read-modify-write of this status variable.
Previously, the mask parameters for the ppid_pid block did not accept
symbols and it would throw errors. A fix for this was identifid and applied.
these custom header files using Windows style "\" slashes instead of
"/" which caused the model to not build successfully. This issue was
fixed by reformatting "/" slashes with "\" slashes in all instances of the
ADD_INCLUDES variable.
Calibration
Added support for extended CCp IDs in A2L files for ATI Vision, INCA,
and Canape. When building an application with the CCP setting "Use SRC
extended ID" or "Use DTO extended ID" All A2L files that contain CCP
information now properly set bit 31.
Code generation
Support for MATLAB 2013 and 2014 has been removed. Support for RSIM
Simulink Code Generation has been removed.
This change fixes a build error where referenced models would not build
with the GCC compiler due to backslashes '\' in some of the file paths.
When using the put_Calmap2d block and building a model with the GCC
compiler, the auto generated code attaches a OE_CAL identifier to one of
the local variables used to call the C-API function for this block. In GCC this
OE_CAL identifier is a section attribute and thus they can not be specified
for local variables and the build fails. A fix was made to change how the
code was generated by the build process such that the OE_CAL attribute
is not used.
Fixed a problem that excluded data dictionary files if the model was using
a simulink data dictionary.
• Warn and omit prefix-style a2l variable names less than four
characters long
Communications
Fixed potential corruption of adjacent signals while packing fields that are
not byte-aligned.
Examples
The two pot demo with S-Function was previously implemented as a non-
inlined S-Function, which is not supported by the OpenECU developer
platform. This has been fixed, and the documentation updated. Further
changes were made to detect and raise an error if a non-inlined S-Function
is used within an application model, which could have undefined behavior.
Previously the signal names in the model referenced pin XG4 which was
not the correct pin used in the example for either target. The signal names
have now been left generic to avoid confusion.
Input/output drivers
Each target ECU is designed with a different set of input and output
conditioning circuitry. Interfaces provide access, from simple low-side digital
output drive to stepper motor output drive and crank trigger wheel input
decoding.
pdx_Monitor conflicts with the other functions that are available on the A4,
A13, B2, B3, B6, B13, B14, and B16 connector pins. Similar diagnostic
capabilities can be achieved using the other input blocks.
• DI Pulse Spacing
• When the commanded injection angle plus the cylinder offset crossed
a threshold (by advancing) which caused the timing to wrap from -360
to +360 (+ = retard), the injection would skip. Now resolved.
The angular output was observed to latch to the active state when:
Target ECU
Added warnings for when the selected tlc file does not match the
configuration model default.
Note
To enable this functionality, the ECU's firmware must be upgraded
to revision 2.9.0-r2020-1 or later. To upgrade the ECU's firmware
please contact OpenECU technical support as described in
Appendix K, Contact information.
User documentation
Previously, when the OpenECU Simulink User Guide was opened from
within MATLAB 2018 or higher, all images and CSS files could not be
found by MATLAB and resulted in formatting issues. A possible cause for
this could be that in newer versions of MATLAB some sort of check was
put into place that prevented it from accessing resources (such as images)
that are not in the same directory as the HTML files. A fix was made to
remedy this by setting the help location in MATLAB to a base folder that
has these images, CSS and HTML files as subdirectories, and also moving
the table of contents that links to each HTML file to this folder as-well.
Digital inputs XF3, Y34, and Z12 previously displayed a voltage range of
0V to 5V. Those pins have been corrected to say 0V to VPwr, but it has
been noted that 0V to 5V is preferred.
The note reads: Reading a Hall effect sensor may require an external pull
up resistor or a pull up resistor added as a custom option.
When the same PGN is received on multiple buses within the same
model iteration, including DM7 test requests or PG requests, unexpected
behavior may occur.
The M110 uses a SPI-to-CAN ASIC for CAN channels C and D. There
are known limitations on these CAN buses which can limit the message
When integrating OpenECU with the ETAS INCA calibration tool during
OpenECU installation, there is a problem with part of the installation
procedure. Selecting the Integration -> INCA-ProF Integration option
when choosing components to install is necessary to generate the target-
specific ProF configuration files in the OpenECU installed directory (under
tool_integration\inca_prof).
Instead the ProF files should be installed directly using the ETAS INCA tool
(after installing OpenECU) using the procedure described in the Appendix
of the OpenECU User Guide on how to use INCA with OpenECU (under
section “Supporting Tools”).
Note
To enable this functionality, the ECU's firmware must be upgraded
to revision 2.9.0-r2020-1 or later. To upgrade the ECU's firmware
please contact OpenECU technical support as described in
Appendix K, Contact information.
• Peak and hold injector outputs fails when an out of range current or
frequency request is made by the application
Current or frequency requests in the range specified by the user guide are
correctly generated.
Both the PG transmit and PG receive interfaces will report an error if the
CAN bus is detected as bus-off when the interface runs (as well as other
conditions). During testing, it has been shown that the bus-off condition is
not detected correctly and thus any bus-off condition does not contribute
to the error report. The application must determine the bus-off condition
using the CAN status interface rather than relying on the PG transmit and
receive interfaces for full error reporting.
DM30 does not currently report results correctly for DM7 TIDs 248-250.
All DM30 results are reported as if TID 247 (return all scaled test results
for one SPN) was requested, instead of reporting a single test result. The
suggested work around is for single tests to be reported via the generic
j1939_PGTransmit block.
See CR 8211 (F) for detail. It is still possible for a bad access to cause
an exception which will continue to occur until the flash operation has
completed. If it does, a continuous loop is effectively entered until the flash
operation is over. If that operation is an erase, it may take long enough for
a watchdog exception to take place. Therefore this issue remains open
for further action in future to address this scenario. Note however that this
type of exception pattern occurs only very rarely even if NULL is repeatedly
read during flash operations, so it is now very much less probable that a
customer application will cause a reset in the manner described.
Work around this issue by selecting the required group, closing the block
mask parameter dialog, opening the block mask parameter dialog again,
then select the required I/O channel.
During the build process, checks are performed in case any PGNs have
been duplicated. Unfortunately, these checks sometimes flag duplications
erroneously.
The Simulink interface does not prevent an application model from using
the same channels in both a Synchronised PWM output block and in
another PWM output block. It is up to the developer to avoid this erroneous
double assignment.
• Check for initial frequency does not allow for clock source
The check for initial frequency for Peak and Hold Injector, PWM and
SPWM blocks does not yet take into account the clock source selected.
So, for example, if the slow clock is selected and an initial frequency of
greater-than 40Hz is selected, an error will not be generated when the
model is updated. The frequency will however be clipped to the allowed
range at run-time.
There is a known issue with the J1939 protocol stack implemented in the
OpenECU platform:
• Support for ETAS INCA v5.1.2 has not been fully verified
The last time integration of OpenECU with INCA was tested was some
time back, when support for INCA was first introduced. Since then, ETAS
have produced newer versions of INCA but no further work to validate
integration has taken place.
KAPWR Keep Alive Power — apply power to this pin while the
module is is otherwise powered down to retain the values of
any adaptive data or Tunes until the module is next powered
up again (see the technical specification for each target for
details).
Hall Hall Effect Sensor — typical sensor used for cam and shaft
position sensing.
website
Support.OpenECU.com [http://Support.OpenECU.com]
If you still have questions after searching through the FAQ, or want to discuss sales or
proposals, you can contact main office:
Tel
+1 734 656 0140
Fax
+1 734 656 0141