0% found this document useful (0 votes)
483 views42 pages

CANoe QuickStartExport

This document provides an overview and quick start guide for CANoe software. It introduces the operating concept, windows, and basic functions for setting up CANoe to transmit and analyze CAN bus data. The guide walks through creating a simple configuration to send and receive messages, and introduces more advanced topics like working with databases, signal analysis, logging, and simulating distributed systems using CAPL programming.

Uploaded by

Chaos Xia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
483 views42 pages

CANoe QuickStartExport

This document provides an overview and quick start guide for CANoe software. It introduces the operating concept, windows, and basic functions for setting up CANoe to transmit and analyze CAN bus data. The guide walks through creating a simple configuration to send and receive messages, and introduces more advanced topics like working with databases, signal analysis, logging, and simulating distributed systems using CAPL programming.

Uploaded by

Chaos Xia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

CANoe Quick Start Guide (PDF Version)

This file is a PDF export of the Quick Start Guide of the CANoe help.
Version 16
CANoe Quick Start Guide (PDF Version) Table of Contents

Table of Contents

1 Overview 5
1.1 Operating Concept 5
1.2 Set Up CANoe 5
1.3 CAPL 5
2 Windows 6
2.1 Simulation Setup 6
2.2 Measurement Setup 7
2.3 Analysis Windows 7
3 Create a New Configuration 8
4 Set Up the Bus 9
4.1 Connect Channels on the Network Interface 9
4.2 Connect the Network Interface with Your Computer 9
4.3 Define the Bus Parameters 10
5 Transmit Data Without Database 12
5.1 Unit 1: Send a CAN Message 12
5.1.1 Insert a Visual Sequence 12
5.1.2 Save Your Configuration 14
5.1.3 Start the Measurement 14
5.1.4 Display In the Trace Window 14
5.2 Unit 2: Send a second CAN Message Cyclically 14
5.2.1 Insert a Second Visual Sequence 14
5.3 Further Data Sources 15
5.4 Analyze Data 16
5.4.1 Trace Window 16
5.4.2 Statistics Window 16
6 Work with Symbolic Data 18
6.1 Assign a Database 18
6.2 Display In the Trace Window 20
7 Analyze Signal Values in Data Window 21
7.1 Unit 3: Configure the Data Window 21
7.1.1 Add Signals In the Data Window 21
7.1.2 Display In the Data Window 22
8 Analyze Signal Responses in Graphics Window 24
8.1 Unit 4: Configure the Graphics Windows 24

© Vector Informatik GmbH 16 -2-


CANoe Quick Start Guide (PDF Version) Table of Contents

8.1.1 Add Signals In the Graphics Window 24


8.1.2 Display In the Graphics Window 24
9 Log a Measurement 26
9.1 Unit 5: Log CAN Data Traffic 26
9.1.1 Activate the Logging Branch 26
9.1.2 Configure the Logging File 26
9.1.3 Configure the Trigger Conditions 27
9.1.4 Start the Measurement 27
9.1.5 Open the Logging File 27
10 Evaluate a Logging File 28
10.1 Unit 6: Analyze Logged Data 28
10.1.1 Activate the Offline Mode 28
10.1.2 Choose the Data Source 28
10.1.3 Deactivate the Logging Branch 28
10.1.4 Play Back the Logging File 28
10.1.5 Analysis In Offline Mode 28
11 Create a CAPL Program 29
11.1 Unit 7: Create a CAPL Program 29
11.1.1 Preparation 29
11.1.2 Insert a CAPL Node 29
11.1.3 Configure the CAPL Node 29
11.1.4 Start the CAPL Browser 30
11.1.5 Insert a Variable 30
11.1.6 Create an on message Event Procedure 30
11.1.7 Create a Second on message Event Procedure 31
11.1.8 Create an on key Event Procedure 31
11.1.9 Save and Compile the Program 32
11.1.10 Display in the Write Window 32
12 Simulate Distributed Systems in CANoe 33
12.1 Working With System Variables 33
12.2 Unit 8: Create a Complete Configuration 33
12.2.1 Create the Database 34
12.2.2 Add the Database to the Configuration 35
12.2.3 Define System Variables 35
12.2.4 Create Panels 38
12.2.5 Add the Panels to the Configuration 39
12.2.6 Save the Configuration 39

© Vector Informatik GmbH 16 -3-


CANoe Quick Start Guide (PDF Version) Table of Contents

12.2.7 Create Network Node Models 40


12.2.8 Start the Measurement 42

© Vector Informatik GmbH 16 -4-


CANoe Quick Start Guide (PDF Version) 1 Overview

1 Overview

1.1 Operating Concept

If you start CANoe for the first time, and its functionality and controls are still completely new to you, the following
tour will help you to become familiar with its operating concept and its most important features.
For this tour you will first set up a very simple CAN bus where CANoe acts as both, sender and receiver.
2 Windows
3 Create a New Configuration
4 Set Up the Bus

1.2 Set Up CANoe

In the first step CANoe is configured as a data source, i.e. as a transmitting station. You will then learn about
CANoe analysis options by studying the generated data in the analysis windows afterwards.
In complex real systems CANoe typically also acts as sender and receiver. You can utilize the program as a data
source to transmit data to other controllers, but you can simultaneously use it to observe, log and evaluate the
data traffic on the CAN bus.
5 Transmit Data Without Database
6 Work with Symbolic Data
7 Analyze Signal Values in Data Window
8 Analyze Signal Responses in Graphics Window
9 Log a Measurement
10 Evaluate a Logging File

1.3 CAPL

In the last part of the tour you will become familiar with the CAPL programming language and create two network
nodes of a distributed system to solve a simple simulation task in CANoe.
11 Create a CAPL Program
12 Simulate Distributed Systems in CANoe

© Vector Informatik GmbH 16 -5-


CANoe Quick Start Guide (PDF Version) 2 Windows

2 Windows

If you open CANoe the first time a configuration with the desktops Trace, Configuration, and Analysis is
opened automatically.

Figure 1: Configuration with three desktops

CANoe has various analysis windows (Trace, Data, Graphics and Statistics Window) as well as a Measurement
Setup and a Simulation Setup that indicates the data flow and simultaneously allows to configure CANoe.
You can access all program windows via the ribbon.

Figure 2: Ribbon, Analysis tab

2.1 Simulation Setup

In the Simulation Setup the overall system is shown graphically with the CAN bus and all network nodes. The
simulated bus is represented by a red horizontal line. The blue line above symbolizes the real bus. The two
buses are connected to one another via the network interface. To transmit data from CANoe on the bus, insert
transmit blocks in the Simulation Setup, which must be connected by the red line.

© Vector Informatik GmbH 16 -6-


CANoe Quick Start Guide (PDF Version) 2 Windows

Figure 3: Bus symbol in Simulation Setup with context menu of the bus lines.

2.2 Measurement Setup

The data flow diagram of the CANoe Measurement Setup has a connection to the Simulation Setup on the left -
symbolized by the >> symbol - and various evaluation blocks on the right serving as data sinks. That is, the data
flow is from left to right. Connection lines and branches are drawn between the individual elements to clarify the
data flow.

In the data flow diagram you will also recognize small rectangles: . At these insertion points (hot spots) you
can insert additional function blocks for manipulating the data flow (filter, Replay Block or CAPL program blocks
with user-definable functions).

2.3 Analysis Windows

The information arriving at each evaluation block is displayed in the analysis window of the block. For example,
the Trace Window displays all information arriving at the Trace block, while the Graphics Window shows you
information arriving at the Graphics block.
The only exception is the Logging Block, which is not assigned to a window but rather a file in which the data
arriving at the block are logged.

© Vector Informatik GmbH 16 -7-


CANoe Quick Start Guide (PDF Version) 3 Create a New Configuration

3 Create a New Configuration

Make sure that you begin this tour with a new configuration. Select the CAN_500kBaud_2ch.tcn template via
the File ribbon tab|New, and click on Create Configuration.
The wizard is not needed for this tour.

Figure 4:File ribbon tab|New|Create Configuration.

A configuration with the desktops Trace, Configuration and Analysis is opened.

© Vector Informatik GmbH 16 -8-


CANoe Quick Start Guide (PDF Version) 4 Set Up the Bus

4 Set Up the Bus

To start up CANoe use a test setup that is independent of existing CAN bus systems with only two network
nodes. The two CAN controllers of your network interface can serve as the network nodes. As network interface
you can use the two CAN Controller of your network interface.

4.1 Connect Channels on the Network Interface

First, connect channel 1 and 2 on the network interface (D-Sub 9 connectors). For a high-speed network
interface you need a connection cable (CANcable) with two bus termination resistors of 120 Ω each. For a low-
speed interface you will simply need a 3-conductor cable to interconnect the pins of the two controllers that are
assigned to the bus lines CAN high, CAN low and ground.

Figure 5: Network interface VN1630 with connection cable

Consequently, the CAN bus that you use during this tour will consist of a short 2-conductor or 3-conductor cable
that connects the two CAN controllers of the CAN card to one another. This is necessary as a minimal
configuration, since the CAN protocol requires - in addition to a sender - at least one receiver that confirms the
correct receipt of messages with an acknowledge.

4.2 Connect the Network Interface with Your Computer

For external network interfaces, e.g. VN1630, use a USB cable to connect to the computer. Internal network
interfaces, e.g. VN1530, plug directly into your computer.

© Vector Informatik GmbH 16 -9-


CANoe Quick Start Guide (PDF Version) 4 Set Up the Bus

4.3 Define the Bus Parameters

Up to this point we have not considered definitions of bus parameters (Transmission speed, sampling point, etc.)
which must be set for each of the two participating controllers.

Step by Step Procedure


1. To do this, open the Simulation Setup (Configuration desktop or Simulation ribbon
tab|Simulation Setup) and right-click the square bus symbol with the Network CAN1
label.

Figure 6: Context menu of the computer card symbol

2. Choose the context menu command Network Hardware… and open the Network
Hardware Configuration dialog.

Figure 7:Network Hardware Configuration dialog

© Vector Informatik GmbH 16 - 10 -


CANoe Quick Start Guide (PDF Version) 4 Set Up the Bus

3. Then select CAN1|Setup from the configuration dialog for the first controller and type in the
value for the baud rate 100 kBaud. This makes sense for both high-speed and low-speed
buses. CANoe recommends default values for the controller registers, which you accept
with [OK].
When you do this - besides the transmission speed of 100 kBaud - you also implicitly define
other controller parameters (Sampling point, BTL cycles, and synchronization jump width).
For the overall system to function properly, the same exact values must be set for the
second controller CAN 2 (click + and Setup). When you exit the dialog, accept the values
with [OK].

With the [Driver…] button you can open the Vector Hardware Config dialog. There you can assign the
application channels to the real channels.

© Vector Informatik GmbH 16 - 11 -


CANoe Quick Start Guide (PDF Version) 5 Transmit Data Without Database

5 Transmit Data Without Database

Your current test setup still does not have a data source. So set up a data source which places information on the
bus cyclically.

5.1 Unit 1: Send a CAN Message

Task
Configure CANoe so that – after the measurement start – a CAN message with identifier 64 (hex)
is sent on the bus every 100 milliseconds. In this case the message should contain exactly four
data bytes with the values D8 (hex), D6 (hex), 37 (hex) and 0.

5.1.1 Insert a Visual Sequence

You can solve this task by inserting a visual sequence which transmits the message on the bus.

Step by Step Procedure


1. Open the Automation Sequences Window via the Simulation ribbon tab|Automation.
2. Create the visual sequence Message 1 with in the toolbar.

Figure 8: Configuration dialog for automation sequences

Note
To execute this visual sequence it must be activated in this dialog. Since the
sequence has no contents yet, it is displayed as invalid .

After it is created, the visual sequence Message 1 will be opened in the Visual Sequencer
automatically.

© Vector Informatik GmbH 16 - 12 -


CANoe Quick Start Guide (PDF Version) 5 Transmit Data Without Database

3. Enter the data of the message in the first row as follows:


Command: Set CAN Raw Frame (selection via list field)
Object:
Channel: CAN1
Identifier: 0x64
Selector: all data

Figure 9: Object properties of a raw message

Operator: =
Operand: D8 D6 37 00
Wait: 0
4. To send the message cyclically, you have to enter in the second row the following settings:
Command: Set CAN Cyclic Raw Frame (selection via list field)
Object:
Channel: CAN1
Identifier: 0x64
Selector: not available
Operator: cycle time (ms)
Operand: 100
Wait: 0

5. Activate with in the toolbar the replay of the sequence Message 1 until measurement
stop.
6. Activate with in the toolbar the automatic start of the sequence at the start of
measurement.

Figure 10: Sequence Window of Message 1

Cross Reference
You can find detailed information about the Automation Sequences or the Visual Sequencer in
the Help of CANoe.

© Vector Informatik GmbH 16 - 13 -


CANoe Quick Start Guide (PDF Version) 5 Transmit Data Without Database

5.1.2 Save Your Configuration

Before you start the measurement you should save the configuration that you have prepared to this point via the
File ribbon tab|Save. You can then reload this configuration at any time and resume your work precisely at this
point.

5.1.3 Start the Measurement

Start the measurement with on the Home ribbon tab. CANoe immediately begins to cyclically transmit the
message you have configured in the sequence Message 1.

5.1.4 Display In the Trace Window

In the Trace Window (Trace desktop or Analysis ribbon tab|Trace) you can see that the message is transmitted
via channel 1 (Transmit attribute Tx [= Transmit]) and received by the second controller (Receive attribute Rx [=
Receive]).

Figure 11: Trace Window

The first column shows the transmit time relative to the measurement start. The next column shows you which of
the two CAN channels was used to transmit.

5.2 Unit 2: Send a second CAN Message Cyclically

Task
Expand the configuration of the last task such that, additionally, a message with identifier 3FC
(hex) is transmitted every 500 milliseconds. The value of the first data byte of this message
should cyclically assume values from 1 to 5.

5.2.1 Insert a Second Visual Sequence

You can solve this task by inserting a second visual sequence Message 2 that transmits a new message on the
bus.

Stop the measurement with on the Home ribbon tab before entering the second sequence.
Sequence Message 2 must be defined as follows:

© Vector Informatik GmbH 16 - 14 -


CANoe Quick Start Guide (PDF Version) 5 Transmit Data Without Database

Figure 12: Sequence Window of Message 2

Activate with in the toolbar the periodic replay of the sequence Message 2 until measurement stop. Wait sets
the time between the execution of the single sequence steps.

Activate with in the toolbar the automatic start of the sequence at the start of measurement.

Start the measurement again with on the Home ribbon tab.

5.3 Further Data Sources

Besides the Visual Sequencer, CANoe offers additional block types as data sources.
With the Interactive Generator (IG) you can configure and send messages interactively while a
measurement is running. Additionally you can define Signal Generators.
With a Replay Block you can play back data on the bus that were logged with the CANoe logging function.
A program block allows you to integrate your own transmit functionalities – which may be quite complex –
into CANoe with the CAPL programming language.

Cross Reference
You can find detailed information about these block types in the help of CANoe.

© Vector Informatik GmbH 16 - 15 -


CANoe Quick Start Guide (PDF Version) 5 Transmit Data Without Database

5.4 Analyze Data

Analysis windows are used to analyze data generated by the Message 1 and Message 2 sequences from Unit
1 and Unit 2.

5.4.1 Trace Window

You have already learned about the Trace Window. Data that reach the Trace block of the Measurement Setup
are displayed here as CAN messages in bus based format. Besides the time stamp, this includes the number of
the CAN controller, the identifier, an attribute for differentiating transmitted and received messages, and the data
bytes of the CAN message.
You can configure the Trace Window – like all other analysis windows – from the context menu that is accessed
by a right click on the window or on the appropriate block.
Furthermore, the different buttons in the toolbar can be used to configure the Trace Window. For example, with
you can toggle from stationary mode to the scroll mode, in which each message arriving at the Trace block is
written to a new line.

With you can toggle between absolute and relative time representation. In relative time representation, the
time difference between two successive messages ("transmit interval") is shown in the first column. Of course, in
this display format it is also easy to find the transmit interval that you entered previously in the Visual Sequencer:
100 milliseconds.

5.4.2 Statistics Window

Another bus based window, the CAN Statistics Window (Analysis desktop or Analysis ribbon tab|Statistics),
provides an overview of bus data traffic. Displayed here are the total frequencies of data, remote and Error
Frames, bus loading and CAN controller status.
Since in our case Message 1 is sent every 100 ms and the Message 2 every 500 ms, the total frequency of all
messages is 12 frames per second. With an average data length of about 70 bits per frame, approx. 12 * 70 ≈ 840
bits are placed on the bus in one second. At a baud rate of 100 kbit/second the bus load in our example would be
on the order of magnitude of one percent.

© Vector Informatik GmbH 16 - 16 -


CANoe Quick Start Guide (PDF Version) 5 Transmit Data Without Database

Figure 13: CAN Statistics Window

© Vector Informatik GmbH 16 - 17 -


CANoe Quick Start Guide (PDF Version) 6 Work with Symbolic Data

6 Work with Symbolic Data

Before we discuss the remaining windows in detail, let us have a look at the capabilities offered by CANoe for the
symbolic description of data. Of primary interest in the analysis of CAN systems – besides bus-related
information such as messages, Error Frames and message frequencies – is information on useful data, i.e.
signals such as RPM, temperature and engine load, which are provided by individual controllers, and are sent on
the bus with the help of CAN messages.
To describe this information symbolically, CANoe provides you with the database format DBC and a database
editor with which you can read, create and modify CAN databases.

Cross Reference
Please refer to the CANdb++ manual and the CANdb++ help included with the CANoe product
for further information on the CANdb++ Editor.

6.1 Assign a Database

At this point we would like to assign a delivered database to the current CANoe configuration. This database will
be used to interpret the data bytes of the messages generated by the Visual Sequencer. You can find the
database POWERTRAIN.dbc in the directory CANoe Sample
Configurations\CAN\CANSystemDemo\CANdb.. The location of the directory depends on the installation.
In the Options dialog you can find the file location here:
File ribbon tab|Options|General|File Locations: Location of user data.

Step by Step Procedure


1. Stop the measurement to assign the database and open the Simulation Setup
(Configuration desktop or Simulation ribbon tab|Simulation Setup). In the System View
of the Simulation Setup, you can see a tree representation of the current configuration.

Figure 14: Simulation Setup with System View on the right.

2. Select Databases in the System View and open the Open dialog with the context menu
command Add….
3. Select in this dialog the above mentioned database.
4. If you click on the [OK] button, the new database is accepted for the current bus and
displayed in the System View.

© Vector Informatik GmbH 16 - 18 -


CANoe Quick Start Guide (PDF Version) 6 Work with Symbolic Data

Now open the database using the symbol on the Tools ribbon tab. The CANdb++ Editor is opened, and the
contents of the database POWERTRAIN.dbc are shown in the Overall View Window of the CANdb++ Editor.

Figure 15: Overall View Window of the CANdb++

Double click the Messages object type in the area on the left side of the Overall View Window. The subordinate
structural level is then also shown in this area, and the area on the right shows the available messages with their
system parameters (e.g. symbolic name, identifier, etc.).

Note
The CANdb++ Editor validates inputs and displays potential errors or issues in the Overall View
Window. In this database the symbol to the left of the message indicates that this message has
no assigned receiver node.

First, toggle the numbering format from decimal to hexadecimal via the Options│Settings menu path. We can
deduce from the symbolic names of the messages that the system under consideration involves a description of
communications in a rudimentary engine area system.
Click the message EngineData in the left area of the Overall View Window. The system parameters of signals
transmitted in this message are shown in the area on the right side of the Overall View Window.
The temperature EngTemp, for example, is a 7 bit signal. To obtain the physical value in degrees Celsius, the bit
value must be multiplied by the factor 2, and the offset 50 must be subtracted from the result.
The idle switch signal Idle Running in the last bit of the third data byte is a binary signal (one bit), which can
assume the value 0 or 1.

Note
With the help of this symbolic information the data contents of messages can now be interpreted
in CANoe. Please note that this is only practical if the database information describes the system

© Vector Informatik GmbH 16 - 19 -


CANoe Quick Start Guide (PDF Version) 6 Work with Symbolic Data

that you are currently observing. So you have to ensure that the database associated to the
configuration matches the real network.

6.2 Display In the Trace Window

Now you can see in the Trace Window the identifier and the symbolic message name.

Figure 16: Trace Window

Please note that the message you generated in the first task has the identifier 64 (hex). This agrees with the
identifier of the message EngineData.

© Vector Informatik GmbH 16 - 20 -


CANoe Quick Start Guide (PDF Version) 7 Analyze Signal Values in Data Window

7 Analyze Signal Values in Data Window

Besides the use of symbolic message names, the associated database can also be used to analyze signal
values. The purpose of the Data Window (Analysis desktop or Analysis ribbon tab|Data) is to assist in the study
of momentary signal values.
This explains why the Data Window is initially empty in a new configuration. The signal values to be displayed are
dependent inter alia upon information from the database. You as the user must decide which signal values
should be displayed.

7.1 Unit 3: Configure the Data Window

Task
Configure the Data Window to display the signal values of the message EngineData (ID 64 hex)
that is generated in the Simulation Setup.

7.1.1 Add Signals In the Data Window

For the display of signal values in the Data Window, you have to add signals.

Step by Step Procedure


1. With the Data Window context menu command Add Signals… open the Symbol
Selection dialog.
The tree view of the dialog allows you to search for a specific signal. Each database gets
one branch each for signals, messages and nodes.
2. Choose the EngineData message and select all signals of this message.

© Vector Informatik GmbH 16 - 21 -


CANoe Quick Start Guide (PDF Version) 7 Analyze Signal Values in Data Window

Figure 17: Selecting Signals with the Symbol Selection dialog

3. Close the dialog with [OK].


Now the signal names appear in the window.

7.1.2 Display In the Data Window

After the measurement start the sequence Message 1 begins to cyclically send the message EngineData with
data bytes D8, D6, 37 and 0 onto the bus. According to the message description in the database, the Data
Window in the Measurement Setup now interprets these byte values as engine speed, temperature and idle
switch and displays the appropriate signal values in the Data Window in physical units.

Figure 18: Data Window

© Vector Informatik GmbH 16 - 22 -


CANoe Quick Start Guide (PDF Version) 7 Analyze Signal Values in Data Window

With the help of the conversion formula in the database, engine speed is shown in RPM, while temperature is
shown in degrees centigrade (Celsius). The values of all three signals remain constant over time, since the
message is constantly transmitted with the same data bytes D8, D6, 37 and 0.

© Vector Informatik GmbH 16 - 23 -


CANoe Quick Start Guide (PDF Version) 8 Analyze Signal Responses in Graphics Window

8 Analyze Signal Responses in Graphics Window

While the Data Window displays momentary signal values, you can have the time sequences of signal values
displayed in the Graphics Window (Analysis desktop or Analysis ribbon tab|Graphics). After the end of
measurement the signal sequences are available for study by user-friendly analysis functions.

8.1 Unit 4: Configure the Graphics Windows

Example
Configure the Graphics Window so that signal values are displayed for message 3FC (hex) that
is generated in the Simulation Setup.

8.1.1 Add Signals In the Graphics Window

The second message generated in the Simulation Setup is also described in the associated database.

Step by Step Procedure


1. Open with the Graphics Window's context menu command Add Signals… the Symbol
Selection dialog.
In the database it will be apparent to you that the identifier 3FC is associated with the
symbolic message name GearBoxInfo containing the signals Gear, ShiftRequest and
EcoMode.
2. Choose the signals and confirm them with [OK].
In the Graphics Window you see that the signals are now entered in the legend on the left
side of the window.

8.1.2 Display In the Graphics Window

You can now observe the time sequences of these signals in the Graphics Window. After the measurement start
you observe that the signal Gear cyclically assumes values from 1 to 5, while the other two signals remain
constant over time.
For a useful display of the single gear values the Step connection type of the lines is suitable.

Step by Step Procedure


1. Mark Gear signal in the legend of the Graphics Window.
2. Select in the context menu Connection Type|Steps.
3. Start the measurement.

© Vector Informatik GmbH 16 - 24 -


CANoe Quick Start Guide (PDF Version) 8 Analyze Signal Responses in Graphics Window

Figure 19: Graphics Window

In the curve of the Gear signal you can see the five values that you entered in the sequence Message 2 as part of
unit 2. The values remain in the Graphics Window after the end of the measurement.

For this graphical display you have to select under the separate views of the Y-axes.

Cross Reference
The measurement functions that the window provides for post-analysis are described detailed in
the help of CANoe.

© Vector Informatik GmbH 16 - 25 -


CANoe Quick Start Guide (PDF Version) 9 Log a Measurement

9 Log a Measurement

CANoe has extensive logging functions for data logging. In the Measurement Setup (Configuration desktop or
Analysis ribbon tab|Measurement Setup) the logging branch is shown at the very bottom of the screen.

You can easily recognize it by the file icon , that symbolizes the logging file. The logging file is filled with
CAN data during the measurement.

9.1 Unit 5: Log CAN Data Traffic

Task
Log – in ASCII format – all CAN data traffic that is generated in a short measurement (approx. 20
seconds.) by the sequences.

9.1.1 Activate the Logging Branch

To log the data that arrives in CANoe Measurement Setup to a file, first stop the measurement and activate the
logging branch. Also remove the break that separates the Logging Block of a new configuration from the data
source. You can do this by double clicking the break symbol or with its context menu command Remove
Break.

9.1.2 Configure the Logging File

With the context menu command Logging File Configuration… of the file icon located at the far right of the
logging branch, you can open the configuration dialog.
Here you can enter the file name for the measurement log as well as its format.
Select ASCII format (ASC) here.

© Vector Informatik GmbH 16 - 26 -


CANoe Quick Start Guide (PDF Version) 9 Log a Measurement

Figure 20: Configuration dialog in the Logging Branch.

Logs in binary format (BLF) take up less space on your hard drive, but they cannot be read in normal text editors.
The program offline mode offers you the same evaluation options for logs in both formats.

9.1.3 Configure the Trigger Conditions

Besides the file icon, you can also specify trigger conditions for file logging in the Logging block. This is often
advisable, since frequently it is not the data traffic on the CAN bus over the entire measurement period that is of
interest, but rather only certain time intervals, e.g. when there are implausible signal values or when Error
Frames occur.
Open the Trigger Configuration dialog with the Logging Block context menu command Configuration….
To log the entire measurement the Entire measurement mode must be selected in the Trigger Configuration
dialog.

9.1.4 Start the Measurement

After the configuration of the logging file and the trigger condition start the measurement, which you stop again
after 20 seconds.

9.1.5 Open the Logging File

With the context menu command Open Logging File…of the file icon you can open the logged ASCII file.
Besides the logged messages you can see that statistical information was also logged. These lines correspond
exactly to the information that is displayed in the Statistics Window during a measurement.

© Vector Informatik GmbH 16 - 27 -


CANoe Quick Start Guide (PDF Version) 10 Evaluate a Logging File

10 Evaluate a Logging File

Logging files in ASCII format can indeed be viewed with text editors, but often it is more sensible to utilize the
capabilities that CANoe provides for offline analysis of logging files.

10.1 Unit 6: Analyze Logged Data

Task
Play back the logging file recorded for the last task in offline mode, and observe the signal
response in the Graphics Window.

10.1.1 Activate the Offline Mode

To solve this task, first switch CANoe to offline mode. For that select the Offline Mode on the Home ribbon tab,
or switch with a double click on the Online/Offline symbol in the Measurement Setup to offline mode. All
configuration settings are taken over to offline mode. In the Measurement Setup the bus symbol is displayed
deactivated and the data symbol is activated as data source.

10.1.2 Choose the Data Source

Select the logging file of the last task via the Configuration… context menu command of the file icon at the left of
the Measurement Setup.

10.1.3 Deactivate the Logging Branch

You have also to separate the Logging Block. You can do this by double clicking the hot spot symbol on the left of
the Logging Block or with the context menu of this hot spot.

10.1.4 Play Back the Logging File

You can now play back the measurement with the <F9> key or with on the Home ribbon tab. In contrast to
online mode, here CANoe also offers you the option of replaying the measurement in slow motion (Home ribbon
tab|Animate or <F8>) or in Single-Step mode (Home ribbon tab|Step or <F7>).

10.1.5 Analysis In Offline Mode

The same analysis functions are available to you in offline mode as in online mode. That is, the logged data are
displayed in bus based format in the Trace Window, while you can observe the log signal responses in the
Graphics Window. Of course, you can also insert filters or CAPL programs in the Measurement Setup to further
reduce the data or introduce additional user-defined analysis functions.

© Vector Informatik GmbH 16 - 28 -


CANoe Quick Start Guide (PDF Version) 11 Create a CAPL Program

11 Create a CAPL Program

CAPL is an event based programming language. Each CAPL program consists of event procedures, with which
you can react to external events (e.g. occurrence of specific messages on the CAN bus or activation of keys on
the computer keyboard). The CAPL Browser is described in detail in the help of CANoe. With its sub windows
("Panes") it allows you to create and edit CAPL programs quickly and easily.
In principle, you can also use your own text editor to create CAPL programs. CAPL programs are normal ASCII
files with the default name extension *.can, which must be compiled before the start of measurement using the
compiler provided with the CANoe product.

Cross Reference
You will find a complete description of the programming language together with numerous
detailed examples in the help of CANoe.

11.1 Unit 7: Create a CAPL Program

Task
Create a CAPL program with which you can count the number of messages of the type
EngineData (ID 64 hex) and output the counted number of messages to the Write Window in
response to a key press.

11.1.1 Preparation

First, switch CANoe back to online mode.


With the sequence Message 1 the EngineData messages is cyclically sent to the bus.

11.1.2 Insert a CAPL Node

First you must decide where you wish to insert your CAPL program in the data flow plan. Because this program is
only for analysis purposes and does not generate any messages itself, but only counts them, it is advisable to
insert the program in the Measurement Setup, perhaps before the Trace Window. In the hot spot context menu
choose the function Insert Program Node. A function block with the program symbol P now appears at the
selected point in the Measurement Setup.

11.1.3 Configure the CAPL Node

You can also access the node configuration dialog via the context menu Configuration…. First, select a
program name, e.g. COUNTER.can.

© Vector Informatik GmbH 16 - 29 -


CANoe Quick Start Guide (PDF Version) 11 Create a CAPL Program

11.1.4 Start the CAPL Browser

Start the CAPL Browser either from the configuration dialog [Edit...] button or directly by double clicking the
program block P in the Measurement Setup.

11.1.5 Insert a Variable

For your program you will first need an integer variable which counts the messages. For example, you could
name it counter. Go to the editor pane and enter this name in the variables block. The following should now
appear in this pane:

Example
variables
{
int counter;
}

Like all global variables, this variable is automatically initialized to zero at the start of measurement.

11.1.6 Create an on message Event Procedure

In the next step, this variable should be incremented whenever an EngineData message is registered. For this,
you must expand the CAPL program to include an event procedure of the type on message ("React to message
event"). To do this, click the CAN entry in the left tree view pressing the right mouse button. Open the submenu
New Event Handler. Then select the on message <new message> command.
Now a procedure template appears in the Procedures Text Editor. First replace the text <newMessage> by the
symbolic name EngineData, which you could also overtake directly from the database via the context menu
command Message from Database…. During compilation the CAPL compiler replaces the symbolic name by
the corresponding identifier 0x64.
Now you only need to define which actions should be performed when the event occurs. Since the program is to
count messages, the variable counter must be incremented whenever a message is registered. The complete
procedure appears as follows:

Example
on message EngineData
{
counter++;
output(this); // The EngineData value is displayed in the
// Trace Window
}

© Vector Informatik GmbH 16 - 30 -


CANoe Quick Start Guide (PDF Version) 11 Create a CAPL Program

11.1.7 Create a Second on message Event Procedure

To display all other measurement values in the Trace Window, insert the following procedure:

Example
on message*
{
output(this);
}

Note
Without this procedure the CAPL program would have the effect of a filter because only the
message EngineData would be transmitted to the Trace Window in the Measurement Setup.

11.1.8 Create an on key Event Procedure

As a last step, the output to the Write Window must still be implemented. Finally, the program should not just
count messages, but also keep track of how many messages have been counted.
The output to the Write Window should occur when the <a> key is pressed. For this, you must define another
event procedure for the event Press key <a>.
Now insert a Keyboard event in the CAPL program. To do this, click the System entry in the left tree view
pressing the right mouse button. Open the menu path New Event Handler|on key <newKey>. A new
procedure template will appear in the Procedures Text Editor, which you fill out as follows:

Example
on key 'a'
{
write("%d EngineData messages counted ",counter);
}

The format entry %d refers to the integer variable counter, which is entered after the comma. For the most part,
this format string conforms to the C function printf().

© Vector Informatik GmbH 16 - 31 -


CANoe Quick Start Guide (PDF Version) 11 Create a CAPL Program

11.1.9 Save and Compile the Program

That completes the program. Save it and then start the compiler either with the <F9> key, or the menu path
Compiler│Compile or by the button on the toolbar.
If you have made an error in creating the program, a message window will open showing you the error. Double
click this error notification to go to the location where the error occurred. After you have corrected it and saved the
program file again, recompile the program. Once the program has compiled without errors, the message
Compilation succeeded appears in the Output Window.

11.1.10 Display in the Write Window

Now start the measurement. The sequence Message 1 begins to cyclically transmit messages of the type
EngineData, which are now counted by your program. Whenever you press the <a> key the text n EngineData
messages counted can be seen in the Write Window, where n represents the number of messages counted.

© Vector Informatik GmbH 16 - 32 -


CANoe Quick Start Guide (PDF Version) 12 Simulate Distributed Systems in CANoe

12 Simulate Distributed Systems in CANoe

12.1 Working With System Variables

CANoe provides system variables to model the functional bus behavior of network nodes. These system
variables are described by events and states of the system environment (external pressure, temperature, switch
positions, etc.). You can observe and intentionally change these states - i.e. the values of the system variables -
on user-definable panels.
To work with system variables in CAPL you use the event procedure type on sysvar (React to change in
system variable). The CAPL functions SysGetVariableInt and SysSetVariableInt are used to read and
write system variables.
These language tools and symbolic access to the various variables defined in the database make it possible to
create simple prototypical network node models.

12.2 Unit 8: Create a Complete Configuration

Task
Create a complete CANoe configuration with two network node models and associated
periphery, i.e. panels. This should only involve implementation of distributed functions: After the
user activates a switch pressing the left mouse button, the first node informs the second node of
this action. The second node then activates an indicator lamp in its periphery.

Figure 21: Graphical Overview

A model for distributed systems can be created efficiently in CANoe in three steps:
Create the database with messages, signals and environment variables
Create the network node periphery, i.e. the panels
Create the network node models in CAPL
To prepare this task, select the CAN_500kBaud_2ch.tcn template via the File ribbon tab|New and click on
Create Configuration.

© Vector Informatik GmbH 16 - 33 -


CANoe Quick Start Guide (PDF Version) 12 Simulate Distributed Systems in CANoe

12.2.1 Create the Database

The first step involves creating a database which describes a significant aspect of the system: The exchange of
information between the two network nodes via the communication medium, i.e. the CAN bus.
The database message and signal objects are available for describing the exchange of information over the CAN
bus. The simple functionality of the example can be handled by a 1-bit signal which describes the state of the
switch at the first node. This signal is packed in a CAN message and is only transmitted if the switch state
changes (spontaneous transmission).
Now create a new database with message Msg1 and signal bsSwitch.

Step by Step Procedures

Create a New Database

1. Open with the symbol on the Tools ribbon tab the CANdb++ Editor.
2. Open the Template dialog via File|Create Database….
3. Select the CANoeTemplate.dbc template.
4. With [OK] you open the New Database File dialog.
Enter here the name of the new database (e.g. Database).
5. Close the dialog with [Save].
The new database is opened in the CANdb++ Editor.

Create a Message

Now create the message Msg1 with the identifier 100, which is to be transmitted by the first node.
1. Select Messages and open with the context menu command New… the configuration
dialog for the new message.
2. Enter the following values in the Definition page:
Name: Msg1
Typ: CAN Standard
ID: 0x100
DLC: 8
3. Close the dialog with [OK].

Create a Signal

Create the signal bsSwitch to describe the switch position and assign it to the message Msg1.
1. Select Signals and open with the context menu command New… the configuration dialog
for the new signal.
2. Enter the following values in the Definition page:
Name: bsSwitch
Length [Bit]: 1 (for the transmission of the states on=1 and out=0)
Byte Order: Intel
Value Type: Unsigned
Factor: 1
Offset: 0
Minimum: 0

© Vector Informatik GmbH 16 - 34 -


CANoe Quick Start Guide (PDF Version) 12 Simulate Distributed Systems in CANoe

Maximum: 1
3. Close the dialog with [OK].

Assign Signal to Message

You can assign the signal bsSwitch to the message Msg1 via drag and drop.

Figure 22: Message with assigned signal in the database

Save the database and close CANdb++ Editor.

12.2.2 Add the Database to the Configuration

In the Simulation Setup you can add the database. If you move the mouse pointer to Databases in the tree view
of the current configuration and press the right mouse button, you can run the context menu command Add.

12.2.3 Define System Variables

With the second step you have to describe the I/O interface between the nodes and their peripheries. For this
CANoe provides system variables. Each peripheral element (Switch, indicator lamp, slider, etc.) is wired to a
system variable, i.e. it is connected to the CAPL program for the network node.
In this example there are exactly two peripheral elements: A switch at the first node and an indicator lamp at the
second node. For this, two system variables must be created in the database, e.g. svLight and svSwitch.

Step by Step Procedure


1. Create the two system variables in the System Variable Configuration dialog. Open this
dialog via the Environment ribbon tab|System Variables.
2. Open the New System Variable dialog with .
Each system variable belongs to one particular namespace and is uniquely defined therein
(upper and lower case letters are distinguished).
3. Enter the following values for the system variable svLight:
Namespace: MyNamespace
Name: svLight
Data type: Integer

© Vector Informatik GmbH 16 - 35 -


CANoe Quick Start Guide (PDF Version) 12 Simulate Distributed Systems in CANoe

Figure 23: Definition of system variable svLight

4. Close the dialog with [OK].

© Vector Informatik GmbH 16 - 36 -


CANoe Quick Start Guide (PDF Version) 12 Simulate Distributed Systems in CANoe

Figure 24: Defined namespace with system variable

5. Open the New System Variable dialog via again and define the second system variable
svSwitch. Enter the following values:
Namespace: MyNamespace
Name: svSwitch
Data type: Integer
6. Close the dialog with [OK].
Now you can see that both system variables are assigned to the namespace
MyNamespace.
7. Close the dialog with [OK].

Cross Reference
You can find detailed information about system variables in the help of CANoe.

© Vector Informatik GmbH 16 - 37 -


CANoe Quick Start Guide (PDF Version) 12 Simulate Distributed Systems in CANoe

12.2.4 Create Panels

A separate application, the Panel Designer, is provided with CANoe for creating the node periphery. In the
current configuration, one separate panel must be created for each of the two nodes.

Cross Reference
Please refer to the help of CANoe for a detailed introduction into the Panel Designer.

Create the First Panel

The first panel has a single control, a switch.

Step by Step Procedure


1. You can start the Panel Designer with on the Tools ribbon tab of CANoe. This ensures
that the database is available.
A new panel will be opened automatically.
2. Enter in the Properties grid under Panel|Panel Name the name of the panel SWITCH. After
saving the panel this name will be displayed on the opened panel top left.
3. Select a Switch from the Toolbox of the Panel Designer and place it on the panel, e.g.
via drag and drop.
4. Configure the Switch in the Properties grid under Switch Values|State Count as a control
with 2 states.
5. Assign the Switch in the Properties grid under Settings|Mouse Activation Type the Left
mouse button.
6. Assign the Switch in the Properties grid under Appearance|Image File the image file
IOrgPushButton_2.bmp from CANoe directory CANoe Sample
Configurations\Programming\Bitmap_Library\Global\Switches_2States.
7. To display system variable in the Symbol Explorer you have to open the Filtered by list
and select Variables. Then drag the environment variable svSwitch from the Symbol
Explorer to the Switch on the panel.
8. Label the switch by selecting the Static Text display element from the Toolbox and place
it on the panel to the right of the Switch. Enter the label in the Properties grid of the Static
Text under General|Text.
9. You can change the size of the panel by clicking the panel border and dragging it. Try not to
size panels any larger than necessary, since available screen space is usually a very
limited and hence valuable resource.
10. Save the panel under the name SWITCH.xvp.
Add the panel in the Add to Project dialog to the CANoe configuration.

© Vector Informatik GmbH 16 - 38 -


CANoe Quick Start Guide (PDF Version) 12 Simulate Distributed Systems in CANoe

Create the Second Panel

The second panel has a small simple lamp as an indicating element.

Step by Step Procedure


1. Open a new panel with the menu path File|New Panel and select as panel name LIGHT.
2. Select a LED Control from the Toolbox (All) of the Panel Designer and place it on the
panel, e.g. via drag and drop.
3. Configure the LED Control in the Properties grid under Switch Values|State Count as a
display element with 2 states.
4. Assign the system variable svLight to the LED Control via drag and drop from the Symbol
Explorer.
5. Label the LED Control by selecting the Static Text display element from the Toolbox
(All) and place it on the panel to the right of the Switch. Enter the label in the Properties grid
of the Static Text under General|Text.
6. Save the panel under the name LIGHT.xvp.
Add the panel in the Add to Project dialog to the CANoe configuration.

12.2.5 Add the Panels to the Configuration

Figure 25: Panels in CANoe

12.2.6 Save the Configuration

Before creating the network node models, you should save the configuration you just created with on the
Home ribbon tab of CANoe.

© Vector Informatik GmbH 16 - 39 -


CANoe Quick Start Guide (PDF Version) 12 Simulate Distributed Systems in CANoe

12.2.7 Create Network Node Models

You create the network node models in the Simulation Setup. At the least, the model for the first node must
send a message when the switch is activated, and therefore it may not be inserted in the Measurement Setup.

Insert Two Network Nodes

In this example you need two network nodes in the Simulation Setup: The first node supplies the switch
position, and the second reacts to this by activating or deactivating a small lamp.
In the Simulation Setup click the bus lines to insert new network node models.

Figure 26: Inserting network nodes in the Simulation Setup

Configure the Nodes

You open the configuration dialog of the nodes with the context menu command Configuration…. Enter here
the node name (e.g. ECU 1 or ECU 2).
Open with [File…] the Open dialog. Enter here the name of the CAPL program that simulates the functionality of
the network node (e.g. ECU1.can or ECU2.can).

© Vector Informatik GmbH 16 - 40 -


CANoe Quick Start Guide (PDF Version) 12 Simulate Distributed Systems in CANoe

Figure 27: Configuration of network node ECU 1 in the Simulation Setup

Create the Used CAPL Programs

Double click on each node to open the CAPL Browser for the particular CAPL program. The first CAPL program
belongs to a node at whose periphery there is a switch. When the switch position changes, the program acquires
the new switch value and immediately outputs it on the bus:

Example
// Reaction to change of system variable svSwitch
on sysvar sysvar::MyNamespace::svSwitch {
// Declare a CAN message to be transmitted
message Msg1 msg;
// Read out the value of the light switch,
// Assign to the bus signal bsSwitch
msg.bsSwitch = SysGetVariableInt(sysvar::MyNamespace::svSwitch);
// Output message on bus (spontaneous transmission)
output(msg);
}

The second network node reacts to this message. The CAPL program reads the value of the bus signal for the
switch position and then activates or deactivates the indicator lamp at its periphery. Please note that the switch
value is only acquired via the signal value on the bus. The value of the environment variable svSwitch is not
known to this CAPL program. That is, the communication between the two nodes occurs via the bus:

© Vector Informatik GmbH 16 - 41 -


CANoe Quick Start Guide (PDF Version) 12 Simulate Distributed Systems in CANoe

Example
// Reaction to receipt of the CAN message M1
on message Msg1 {
// Read out a bus signal and
// set the system variable
SysSetVariableInt(sysvar::MyNamespace::svLight, this.bsSwitch);
}

12.2.8 Start the Measurement

Now start the measurement in CANoe. Whenever you activate the switch on Panel 1 the indicator lamp
illuminates. Whenever you turn the switch off, the indicator lamp goes off. The Trace Window shows you both the
bus communication (Spontaneous transmission of message Msg1 when the switch position changes) and the
values of system variables svSwitch and svLight.

Figure 28: Trace Window

© Vector Informatik GmbH 16 - 42 -

You might also like