Getting started with CANoe CANopen Version 1.0 02/05/2004

Application Note AN-ION-1-1201

Author(s) Kai Schmidt Restrictions Public Document Abstract This application note describes the main constituents of the CANoe CANopen option in Version 3.0 or higher. How to get started is also described in principle.

Table of Contents

1.0 Overview ...... 1 2.0 CANoe...... 1 2.1 Hook DLL ...... 1 2.2 CANopen NodeLayer DLL ...... 2 2.3 CANopen Scanner ...... 2 3.0 ProCANopen ...... 3 4.0 Sample Project Creation ...... 3 4.1 Principal Mode of Operation ...... 3 4.2 Development of a CANopen Network...... 4 4.2.1 Phase 1: Project planning of the Network...... 4 4.2.1.1 Specification of the Network Structure...... 4 4.2.1.2 Configuration of the Network ...... 5 4.2.2 Phase 2: Generation ...... 6 4.2.2.1 Batch Controlled Generation...... 6 4.2.2.2 Generation with PCO2CANoe ...... 7 4.2.3 Phase 3: Simulation ...... 7 5.0 Contacts ...... 8

1.0 Overview In this application note, the essential components and enhancements of the CANopen option are described with respect to the basic tool CANoe. Using an exemplary project, the procedures for and particularities of working with the CANoe CANopen option will be described. Emphasis is on the ProCANopen and CANoe tools.

2.0 CANoe The main task of CANoe in connection with the CANopen option is the simulation and comfortable analysis of CANopen networks. For this, the basic software contains the following enhancements, among others.

2.1 Hook DLL The hook DLL enables a CANopen-specific, textual display of the received data in the CANoe trace window. The trace window can thus be configured freely by users (see ).

Copyright © 2004 - Vector Informatik GmbH 1 Getting started with CANoe CANopen

Figure 1: Trace Window of the CANoe Environment

2.2 CANopen NodeLayer DLL With the CANopen NodeLayer DLL, the simulation of CANopen nodes (in the form of CAPL programs) is simplified. The DLL is configured via CAPL functions and enhances the nodes in the simulation setup with the following functionality: • Management of the complete object directory CAPL Node in • SDO and PDO support Simulation Setup Window • Network and configuration management CANopen Nodelayer DLL

CAN Bus

Figure 2: CANopen NodeLayer

2.3 CANopen Scanner The CANopen scanner can be added to the CANoe measurement setup. It evaluates the received CAN messages and displays the active nodes on the network.

Figure 3: CANopen Scanner

Application Note AN-ION-1-1201 2

Getting started with CANoe CANopen

3.0 ProCANopen

The scope of delivery of the CANopen option also includes the project planning tool ProCANopen. Using this tool, CANopen networks can be created and managed. In addition, direct access to the object directory of CANopen nodes connected to the network is possible. The interface between the network project planning in ProCANopen on the one hand and the simulation in CANoe on the other hand is formed by the generators listed below, which are a part of ProCANopen. • CANopen CAPL generator • CANopen Panel generator • CANopen CIF generator

4.0 Sample Project Creation In a few steps, the operating concept and procedure for project creation using the CANopen option shall be explained.

4.1 Principal Mode of Operation

Phase Work Procedure Produced Files

ProCANopen

Defining the Network Design PhasePhase 1: 1: Project Project Planning Planning CAN Database DCF-Files Configuring the Network

PhasePhase 2: 2: Generation Generation Generation Process

CAN Database + CAPL-Generation Environment variables CAPL-Files

Panel-Generation

Redesigning the Network Panels

CIF-Generation CIF-File

CANoe

Phase 3: Simulation Phase 3: Simulation Simulation and Analysis Import of the Network

Figure 4: Process of Network Development

Application Note AN-ION-1-1201 3

Getting started with CANoe CANopen

In the development of a CANopen network with the CANoe CANopen option, in phase 1 the design and subsequent configuration of the network occurs in ProCANopen. Here, the required network nodes are added step by step. The corresponding EDS files must be present for this. The configuration of the network, for example, the set-up of a NMT master, occurs dialog-based. On the basis of the data generated in phase 1, all files required for simulation are generated automatically during the generation process (phase 2): • CAPL Programs: For each network node, a CAPL program is generated that supports the functionality previously defined in ProCANopen. • Panels: During the simulation in CANoe, panels form the interface to users. They serve to control the simulated devices and to display process factors. For a quick simulation start with the CAPL programs created by the CAPL generator, node-specific panels are created by the panel generator automatically. • CIF File: The CIF file can be imported for easy and quick project creation in the CANoe simulation environment. When simulation in CANoe is complete, errors or weaknesses detected during simulation can be corrected, and passed through the process a second time to be checked.

4.2 Development of a CANopen Network The following basic conditions are specified for the exemplary development of the CANopen network: A network should be developed that includes a CANopen master and 2 CANopen slaves. The master should monitor the slaves during ongoing operation via "node guarding." The slaves represent two I/O devices with set-up communication relationships. Whether and how the slaves are configured by the master on "boot-up" should not be important for this example.

4.2.1 Phase 1: Project planning of the Network Open CANoe simulation tool and then start ProCANopen.

Note: using the CANopen toolbar, ProCANopen can be started directly from the CANoe environment.

4.2.1.1 Specification of the Network Structure After right-clicking on the node contained in the network, a context-sensitive menu appears from which you select the "Configuration" command in order to open the configuration dialog for the selected network node. On this dialog, make the following settings to set up the CANopen master: Dialog element Description "Name“ input box Entry of the node name "Node-ID“ input box Entry of a network-wide unique node number for the node. "Device type..." button Opens a dialog on which all available devices are listed in the form of EDS files. Here, select a master device -- for example "mcs2011m.eds" by Schleicher -- and then close the device selection with the "OK" button. Close the configuration of the master by clicking the "OK" button. Then add two additional nodes to the network using the command "Edit | New node." These network nodes represent two CANopen slaves that can be configured in a manner similar to that of the CANopen master. For assigning the device, use two I/O devices with digital inputs and outputs (e.g. "RIOK8IO.eds" by Schleicher). Your project should now look like the one shown in Figure 3.

Application Note AN-ION-1-1201 4

Getting started with CANoe CANopen

Figure 5: Project Structure Save the project using the command "File | Save."

4.2.1.2 Configuration of the Network In the following steps, the configuration of your CANopen network occurs. First, set up the node monitoring mechanism "node guarding" for the CANopen master. To do this, right-click on the master device and select the "Device access" command from the context-sensitive menu that appears. On the device access dialog which appears then, activate the "CANopenManager" tab card. To set up the "node guarding," proceed as follows: Dialog element Description "Detail" button Opens a dialog on which the configuration of the object "NMTStartup" (0x1F80) occurs. On this dialog, activate the "Bit 0" control box or click the "Normal master" button in order to assign the device the NMT master functionality. Close the dialog using the "OK" button. "Global" button The configuration of the "Guard time" and the "Retry factor" also occurs dialog-based. Activate the "Bit 2" control box and in the corresponding input boxes, enter the desired "Guard time" and "Retry factor." Then close the dialog using the "OK" button. "Slave assignment" list box There is then a listing of the parameters you have set. Now click the "Use on slaves" button. All relevant parameters are then stored in the slaves' DCF files. The assignment of the settings to the CANopen master occurs after clicking the "Accept" button. Close the "Device access" dialog using the "OK" button. Next you will set up the communication relationships for the slaves present on the network. Right-click on one of the slaves and select the "Graphic link" command from the context-sensitive menu that appears. Then left-click on the second slave. A dialog for creating the PDO mapping for both devices will appear. All map-capable objects are listed and can be linked with one another graphically by left-clicking. In which PDO the data is mapped at runtime is not interesting here since this conversion occurs through ProCANopen. Depending on the selected device types, you can now create any links.

Application Note AN-ION-1-1201 5

Getting started with CANoe CANopen

Figure 6: Graphic Linking Close the dialog using the "OK" button and save the project in order to complete the configuration of the network.

4.2.2 Phase 2: Generation For the network nodes present in the project, you have now made all settings that correspond to the basic conditions. If the hardware were physically present, a download of the configuration data by ProCANopen would now occur. If the devices -- as in this example -- are not present, then a simulation of the network by CANoe can occur nevertheless. For this, CAPL programs and panels are required that are incorporated into the CANoe simulation environment. The time-consuming, complex, and error-prone creation of CAPL models and node- specific panels is taken over by the generators contained in ProCANopen. Here we have two alternatives: The first method starts a batch file, that can be modified according to the project requirements. This allows flexible configuration and extension of the actions to be performed. As second alternative this batch can call the tool PCO2CANOE. This is a significant simplification and calls the generators with the most-often used parameters.

4.2.2.1 Batch Controlled Generation Start the generation process using the "Project | Update" command. In a DOS window, a list of the generated files will then appear. Specifically, these are: • node-specific CAPL program • node-specific panels • project-specific CIF file Close ProCANopen after the generation process has been completed.

Application Note AN-ION-1-1201 6

Getting started with CANoe CANopen

4.2.2.2 Generation with PCO2CANoe Start the generation process using the "Project | Update" command. This will call the dialog according to Figure 7.

Figure 7:Configuration Tool Pco2CANoe After “Generation” close the tool with “Close” and then close ProCANopen

4.2.3 Phase 3: Simulation In CANoe, using the "File | Configuration new..." command, create a new, empty configuration. End the simulation setup assistant that appears using the command "Cancel." It will not be necessary to create the simulation setup "by hand" or using the assistant. In the course of the generation, a configuration file (CIF file) was created that can be imported directly into the CANoe environment. To do this, execute the "File | Import" command from the main menu. On the dialog that appears next, change to the directory in which the ProCANopen project was saved previously. The file "Import.cif" that you take over using the "Open" command is located in this directory. Your configuration now contains all required network nodes in the form of CAPL programs (cf. simulation setup) and associated panels. Now save the CANoe project.

Note: Save the CANoe project in the same directory in which the ProCANopen project was saved. Background: on simulation start, the DCF files created by ProCANopen are loaded by the CAPL programs.

Now start the simulation using the "Start | Start" command from the main menu. The network nodes are set into the "operational" state by the master based on the configuration created previously in ProCANopen and monitored by "node guarding" (cf. trace window). The configuration should now look like the one depicted in Figure 8.

Application Note AN-ION-1-1201 7

Getting started with CANoe CANopen

Figure 8: CANoe Simulation Setup Finally, test the functionality of the PDOs set up by clicking an element that can be activated (for example a switch) on a panel. The corresponding PDO will be sent and the reaction should be discernible on another panel (lamp lights). This sample application should demonstrate how easily and quickly projected CANopen networks can be simulated using CANoe. If the complexity of the networks increases due to a greater number of devices, only the effort required for configuration of the network increases. To create the simulation data, the completely-automated generation process is started.

5.0 Contacts

Vector Informatik GmbH Vector CANtech, Inc. VecScan AB Ingersheimer Straße 24 39500 Orchard Hill Pl., Ste 550 Lindholmspiren 5 70499 Novi, MI 48375 41756 Göteborg USA Sweden Tel.: +49-711-80670-0 Tel: +1-248-449-9290 Tel: +46-31-764-7600 Fax: +49-711-80670-111 Fax: +1-248-449-9704 Fax: +46-31-764-7619 Email: [email protected] Email: [email protected] Email: [email protected]

Vector France SAS Vector Japan Co. Ltd. 168 Boulevard Camélinat Nishikawa Bld. 2F, 3-3-9 Nihonbashi 92240 Malakoff Chuo-ku Tokyo 103-0027 France Japan Tel: +33-1-4231-40 00 Tel: +81-3-3516-7850 Fax: +33-1-4231-40 09 Fax: +81-3-3516-7855 Email: [email protected] Email: [email protected]

Application Note AN-ION-1-1201 8