Sie sind auf Seite 1von 25

PNDriver V2.

1
Quick Start Guide for
IOT2040

SIMATIC IOT2040
https://support.industry.siemens.com/cs/ww/en/view/109761191
Warranty and liability

Warranty and liability

Note The Application Examples are not binding and do not claim to be complete
regarding the circuits shown, equipping and any eventuality. The Application
Examples do not represent customer-specific solutions. They are only intended
to provide support for typical applications. You are responsible for ensuring that
the described products are used correctly. These Application Examples do not
relieve you of the responsibility to use safe practices in application, installation,
operation and maintenance. When using these Application Examples, you
recognize that we cannot be made liable for any damage/claims beyond the
liability clause described. We reserve the right to make changes to these
Application Examples at any time without prior notice.
If there are any deviations between the recommendations provided in these
Application Examples and other Siemens publications – e.g. Catalogs – the
contents of the other documents have priority.

We do not accept any liability for the information contained in this document.
Any claims against us – based on whatever legal reason – resulting from the use of
the examples, information, programs, engineering and performance data etc.,
described in this Application Example shall be excluded. Such an exclusion shall
not apply in the case of mandatory liability, e.g. under the German Product Liability
Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life,
body or health, guarantee for the quality of a product, fraudulent concealment of a
 Siemens AG 2018 All rights reserved

deficiency or breach of a condition which goes to the root of the contract


(“wesentliche Vertragspflichten”). The damages for a breach of a substantial
contractual obligation are, however, limited to the foreseeable damage, typical for
the type of contract, except in the event of intent or gross negligence or injury to
life, body or health. The above provisions do not imply a change of the burden of
proof to your detriment.
Any form of duplication or distribution of these Application Examples or excerpts
hereof is prohibited without the expressed consent of the Siemens AG.

Security Siemens provides products and solutions with industrial security functions that
informa- support the secure operation of plants, systems, machines and networks.
tion In order to protect plants, systems, machines and networks against cyber
threats, it is necessary to implement – and continuously maintain – a holistic,
state-of-the-art industrial security concept. Siemens’ products and solutions only
form one element of such a concept.
Customer is responsible to prevent unauthorized access to its plants, systems,
machines and networks. Systems, machines and components should only be
connected to the enterprise network or the internet if and to the extent necessary
and with appropriate security measures (e.g. use of firewalls and network
segmentation) in place.
Additionally, Siemens’ guidance on appropriate security measures should be
taken into account. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them
more secure. Siemens strongly recommends to apply product updates as soon
as available and to always use the latest product versions. Use of product
versions that are no longer supported, and failure to apply latest updates may
increase customer’s exposure to cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial
Security RSS Feed under http://www.siemens.com/industrialsecurity.

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 2
Table of contents

Table of contents
Warranty and liability ................................................................................................... 2
1 Task ..................................................................................................................... 4
1.1 Overview............................................................................................... 4
1.2 Components overview .......................................................................... 5
2 Application Example ......................................................................................... 6
2.1 Download the required software .......................................................... 6
2.2 Load / Unload the PN Device Driver .................................................... 7
2.2.1 Load the PN Device Driver ................................................................... 7
2.2.2 Unload the PN Device Driver ............................................................... 8
2.3 Create a TIA Portal project ................................................................... 8
2.4 Run “test_app” .................................................................................... 16
3 Develop own applications............................................................................... 22
4 Checklist ........................................................................................................... 24
5 Related links ..................................................................................................... 25
6 History............................................................................................................... 25
 Siemens AG 2018 All rights reserved

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 3
1 Task

1 Task
1.1 Overview
Introduction
This example shows how to:
 Download the Yocto Realtime Image and the PN Driver
 Load the precompiled PN Device Driver onto the SIMATIC IOT2040
 Create a TIA Portal project with the IOT2040 acting as Profinet Controller
 Run the provided “test_app” application to read and write PN I/O data.

This documentation does not show how to:


 Install the Yocto Realtime Image on a µSD card

rd
Use 3 party applications like putty or WinSCP in detail
 Compile the PN Device Driver
 Develope own applications using the PN Driver Lib
 Debug PN Driver applications
 Siemens AG 2018 All rights reserved

Target group of the documentation


These compact instructions are intended for software developers and should help
them to run the delivered PNDriver and the example program in a very short
amount of time. This requires the following basic knowledge:
 User expertise in the IOT2000 operating system and general handling of the
IOT2000
 Experience with PROFINET IO systems
 Basic knowledge of the configuring software STEP 7, TIA Portal
 General knowledge of automation technology

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 4
1 Task

1.2 Components overview


The Figure 1-1 contains all the components which are part of this Getting Started.

Image / Driver: Example Image 2.2 RT and PN Driver can be downloaded and
have to be written / copied to the IOT2000

HSP / TIA Portal: The HSP0258 for the PN Driver V2.1 can be downloaded and
has to be installed in TIA V15. In TIA V15.1 the PN Driver 2.1 is already included.
The TIA Portal has to be used in order to define the hardware configuration and
generate the XML file which is required by the PN Driver on the IOT2000

Application example: The test_app is also part of the downloaded PN Driver and
is delivered in source files as well as ready-to-use binary. If you want to use the
sources to change the test_app you have to use Eclipse with the existing SDK to
develop and compile the test_app. The generated binary has to be copied to the
IOT2000.
Otherwise you can copy the existing test_app binary to the IOT2000 as described
in chapter 2.4.
 Siemens AG 2018 All rights reserved

How to deal with all these components is described in the whole chapter 2.

Figure 1-1

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 5
2 Application Example

2 Application Example
This chapter shows the first steps dealing with the PN Driver making use of the
delivered example “test_app”.

2.1 Download the required software


To use the PN Driver on the IOT2040 you need to use the IOT2000 Realtime
Image, which can be downloaded here.
On the same page you can download the PN Driver for the IOT2000, the entire
documentation about the PN Driver and its interfaces and this document.

The HSP0258 for the PN Driver V2.1 for TIA V15 can be downloaded here.

Write the IOT2000 Realtime Image to a µSD card and plug it into the IOT2040.
The Image has the static IP address 192.168.200.1 on X1 (eth0) and is set to dhcp
on X2 (eth1) by default.

Use the interface X1 to get connected via putty. The interface X2 is occupied by
the PN Device Driver.
 Siemens AG 2018 All rights reserved

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 6
2 Application Example

2.2 Load / Unload the PN Device Driver


2.2.1 Load the PN Device Driver

To load the PN Device Driver the following steps are needed:

1. Extract the downloaded folder “PN_Driver_IOT2000”

2. Copy the file PNDevDrv_32.ko from the extracted folder


“PN_Driver_IOT2000\ko” to the IOT2000 into the directory /usr/src (use
WinSCP or a USB flash drive)

3. Link the kernel module. To do so, enter the following command:


ln –s /usr/src/PnDevDrv_32.ko /lib/modules/4.4.105-cip15-rt10

4. After having linked PnDevDrv_32.ko, execute:


depmod –a
After this command the PN Dev Driver is loaded automatically with every boot.

5. Copy the file pndev.rules from the extracted folder “PN_Driver_IOT2000\ko” to


 Siemens AG 2018 All rights reserved

the IOT2000 into the directory /etc/udev/rules.d

Restart the IOT2040 to make the changes take place. To do so, enter:
reboot

6. To check if the PNDevDrv is installed correctly enter:


lsmod

Figure 2-1

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 7
2 Application Example

2.2.2 Unload the PN Device Driver

You can unload the PN Device Driver kernel module, enter:


rmmod PnDevDrv_32

To load the PN Device Driver once again change to the directory where the
PNDevDrv_32.ko is stored (e.g /usr/src) with
cd /usr/src
And run the command
insmod PnDevDrv_32.ko

2.3 Create a TIA Portal project

NOTE Steps 1 and 2 are only required with TIA V15.


The PN Driver 2.1 is integrated as of TIA V15.1.

1. Install the HSP in TIA Portal V15


Figure 2-2
 Siemens AG 2018 All rights reserved

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 8
2 Application Example

Figure 2-3
 Siemens AG 2018 All rights reserved

Figure 2-4

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 9
2 Application Example

Figure 2-5
 Siemens AG 2018 All rights reserved

Figure 2-6

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 10
2 Application Example

2. Create new TIA Portal project

3. Add the PN Driver from the Hardware catalog


a. Go to Devices & networks -> Network view
b. Go to Hardware catalog -> PC systems -> Communications modules -
> PROFINET/Ethernet -> PROFINET Driver and choose the
PROFINET Driver V2.1
Figure 2-7
 Siemens AG 2018 All rights reserved

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 11
2 Application Example

4. Choose IOT2000 as device


a. Go the Device view of the PN Driver and click on the slot module
b. In the Hardware catalog go to Communication modules ->
PROFINET/Ethernet -> Interface submodules and choose IOT20x0
Figure 2-8
 Siemens AG 2018 All rights reserved

5. Set IP address of the IOT2000


In TIA Portal the PROFINET interface is X1.
Please note that the PN Driver occupies X2 of the IOT2000!
Figure 2-9

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 12
2 Application Example

6. Add some distributed IO, e.g ET200SP module with some IOs
Figure 2-10

7. Set the IP address of the Distributed IO


Figure 2-11
 Siemens AG 2018 All rights reserved

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 13
2 Application Example

8. Assign device name of Distributed IO


Figure 2-12
 Siemens AG 2018 All rights reserved

Figure 2-13

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 14
2 Application Example

9. Press Compile in TIA Portal – an XML file will be generated


Figure 2-14

The generated XML file is located under


C:\Users\<Users>\Documents\Automation\<Projectname>\AdditionalFiles\PNDriver
and is named
<StationName>.<DeviceName>.PNDriverConfiguration.xml
The file location can easily be opened by clicking on the green arrow in TIA Portal
(see red frame in the screenshot above).
 Siemens AG 2018 All rights reserved

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 15
2 Application Example

2.4 Run “test_app”

NOTE You have to set the interface X2 (eth1) of the IOT2000 to the static IP you have
assigned to the PN Driver in TIA Portal!

Open the test_app


1. Copy the folder “test_app_bin” from the extracted folder to the IOT2000 into
a directory of your choice (e.g /media)
2. Copy your generated XML file to the folder
/media/test_app_bin/PNDriverBase_TestApp on the IOT2000
3. Name it exactly like the example XML already existing in this folder
(Station_1.PN Driver_1.PNDriverConfiguration.xml)
4. Remove the example XML file
5. Go to the folder test_app_linux
cd /media/test_app_bin
6. Make the test_app executable
chmod +x test_app
7. Run test_app
 Siemens AG 2018 All rights reserved

./test_app

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 16
2 Application Example

Figure 2-15
 Siemens AG 2018 All rights reserved

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 17
2 Application Example

Use the test app


Use the following commands within the “test_app” to control the PN Driver:

1. Press 2 to Start the PN Device Driver and choose a network adapter which is
used for the PN Driver (cannot be used for other things afterwards)
Figure 2-16
 Siemens AG 2018 All rights reserved

2. Press 0 to choose the network adapter of the IOT2000 (it is always the
interface X2 (eth1)
Figure 2-17

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 18
2 Application Example

3. Press 5 to open the PN Driver

Figure 2-18
 Siemens AG 2018 All rights reserved

4. Press 9 to set the PN Driver to the mode “Operate”


Figure 2-19

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 19
2 Application Example

When the PN mode has been successfully set to “Operate” was successful and the
configuration is correct, the LEDs of the Distributed IO stop flashing and show that
everything is OK. The test_app gives the feedback you can see in the following
screenshot:
Figure 2-20
 Siemens AG 2018 All rights reserved

5. Press 16 to read/write IO data


a. Press 1 to write:
i. Choose Q address of Byte you want to writeb
ii. Type in the value you want to write (Hex)
iii. After that, press 0 for status GOOD
Figure 2-21

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 20
2 Application Example

b. Press 2 to read:
i. Choose I address of byte you want to read
ii. After that. press 0 for status GOOD
Figure 2-22
 Siemens AG 2018 All rights reserved

You can find the IO addresses of the Distributed IO in the TIA Portal.
Go to the Device view of the PN Driver and click on Properties -> General
Go to PROFINET interface [X1] -> Overview of addresses
Figure 2-23

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 21
3 Develop own applications

3 Develop own applications


This chapter is not providing an entire instruction on how to develop own Profinet
applications for the IOT2000. It should describe the needed steps after testing the
delivered pre-compiled “test_app” and where to find the documentations about the
development.

Further documentation about the engineering interfaces of the PN Driver and the
IO Base user programming interface can be found in the delivered documents in
the folder PN_Driver_IOT2000\doc\manual:
 pn_driver_engineering_interface_manual_en-US.pdf
 pn_driver_IO-Base_user_programming_interface_en-US.pdf

Linux environment
You can use a Linux machine to develop Profinet application for the IOT2000 using
Eclipse.
The Eclipse project for the “test_app” is delivered as well, so you can use that as a
starting base for further developments.
How to do that is described in the document “pn_driver_v2_1_quick_start_en-US”
in chapter 4.4 in the folder PN_Driver_IOT2000\doc\manual.
 Siemens AG 2018 All rights reserved

Windows environment
You also can use a Windows machine to develop Profinet application for the
IOT2000 using Eclipse. Therefore it is needed that you have installed Eclipse and
the SDK for the IOT2000 in version 2.2.0.
You can download the SDK and documentation how to use it here.

To use the delivered Eclipse project for the “test_app” under Windows you have to
do some additional steps. These steps are describes in the following:

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 22
3 Develop own applications

1. Download and install mingw


a. Download mingw-get.exe from mingw.org

Figure 3-1 – Download Button


 Siemens AG 2018 All rights reserved

b. Install “mingw-get.exe”
c. Open “MinGW Installer” from Desktop
d. Select “mingw-developer-toolkit”
e. Click on Installation -> Apply Changes
The installer will download the necessary files

2. Import the delivered “test_app” project to Eclipse


It is located under “PN_Driver_IOT2000_based_on_V2.2.0\pn-test-
app_eclipse_project”

3. Configure the “test_App” project in Eclipse


a. Go to Project -> Properties -> C/C++ Build -> Environment
BUILD_ENV_BAT: Change the path to <Your Windows SDK
path>/environment-setup-i586-nlp-32-poky-linux.bat file
MINGW_MYSY_DIR: Change to your MinGWmysy folder (normally it is
already correct)
POKY_HOME: Change to <Your Windows SDK path>/sysroots/i586-nlp-
32-poky-linux

b. Go to Project -> Properties -> C/C++ Build -> Tool Chain Editor
Current Toolchain: IOT2000 Chain
Current Builder: Gnu Make Builder

After that you can build the “test_app” and the binary can be found in your project
folder in the Eclipse workspace under /src/examples/test_app/iot2000.

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 23
4 Checklist

4 Checklist
This chapter contains a checklist which summarizes all important steps in this
application example.

Table 3-1
No. Action
1. Load PN Driver
2. Create TIA Portal project and Compile
3. Copy XML file generated with Compile to the IOT
4. Run test_app
 Siemens AG 2018 All rights reserved

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 24
5 Related links

5 Related links
Table 4-1
Topic
\1\ SIMATIC IOT2000 forum
www.siemens.com/iot2000-forum
\2\ SIMATIC IOT2000 Setting Up
https://support.industry.siemens.com/tf/ww/en/posts/155642/
\3\ PROFINET driver V2.1
https://support.industry.siemens.com/cs/ww/en/view/109760216
\4\ SIMATIC IOT2000 Getting Started
https://support.industry.siemens.com/tf/ww/en/posts/155643

6 History
Table 5-1
 Siemens AG 2018 All rights reserved

Version Date Modifications


V1.0 10/2018 First version

SIMATIC IOT2000 PN Driver


Entry ID: 109761191, V1.0, 10/2018 25

Das könnte Ihnen auch gefallen