0% found this document useful (0 votes)
22 views8 pages

Pbmaster-Rtlws11 - Open ProfibusDP Implementation

An Open Implementation of Profibus DP

Uploaded by

Adrian Clark
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)
22 views8 pages

Pbmaster-Rtlws11 - Open ProfibusDP Implementation

An Open Implementation of Profibus DP

Uploaded by

Adrian Clark
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/ 8

An Open Implementation of Profibus DP

TRAN Duy Khanh, Pavel PISA, Petr SMOLIK


Czech Technical University in Prague, Faculty of Electrical Engineering
Department of Control Engineering
Karlovo namesti 13, 121 35, Praha 2
[email protected]
http://www.pbmaster.org

Abstract
This paper presents a project named PBMaster, which provides an open implementation of the
Profibus DP (Process Field Bus Decentralized Peripherals). The project implements a software imple-
mentation of this very popular fieldbus used in factory automation. Most Profibus solutions, especially
those implementing the master station, are based on ASICs, which require bespoke hardware to be built
solely for the purpose of Profibus from the outset. Conversely, this software implementation can run on
a wide range of hardware, where the UART and RS-485 standards are present.

1 Motivation 2 PBMaster project

Into this marketplace, PBMaster [1] comes with its


Profibus is a fieldbus that can be used both in solution within the field of this popular industrial
production automation and process automation and bus. The project is still under extensive develop-
which has become a global market leader. World- ment, but aims to offer a cheap solution that will
wide, over 28 million Profibus devices were in- make it possible to use Profibus not only in commer-
stalled by the end of 2008. cial applications, but also in universities, homes or
semi-professional applications. The key to achieving
Although the Profibus was initially standard-
these objectives is in using common inexpensive
ized in the late 1980s it is not easy to find mate-
hardware and open source software.
rials to help design and system engineers develop
new products. Despite many interesting features Initially, the project aimed to offer a solution
like deterministic media access or fast data exchange, for connecting common personal computers running
Profibus still seems to be only in the domain of pro- Linux to this industrial bus. Now, it runs on
fessional applications and commercial solutions. The several operating systems (Linux, FreeBSD and
main reason is probably due to the high price of all NetBSD) and sys-less embedded hardware based on
Profibus products, whether hardware or software so- the ARM architecture. The objectives are to offer
lutions. multi-platform drivers, libraries and applications ca-
pable of carrying out the master, slave and analyzer
Commercial solutions commonly need special
functions of the Profibus. In the future the project
hardware, and the software is mostly proprietary
will try to offer a complex and inexpensive software
- which also significantly increases the price of
based solution for applications using Profibus.
Profibus applications. In addition, the primary sup-
ported platform for these solutions is the operating The following picture describes the software
system MS Windows. Support for Unix-like systems structure of the PBMaster project. We will take a
is very low. closer look at each component later in this paper.
for the purpose of Profibus. It is also one of the
means by which the solution can be made inexpen-
sive. The software implementation can run on hard-
ware integrating UART (Universal Asynchronous
Receiver/Transceiver ) circuits with RS-485 output,
the physical standard used by Profibus DP. The cur-
rent version supports three types of hardware. We
will discuss them in the following sections.

4.1 RS-232/RS-485 Converter

The converter offers an economic solution in order to


connect a PC to a Profibus network. The essential
requirement is for the connected PC to have a serial
FIGURE 1: Software structure
port, which could be a problem as modern computers
lack this communication port. The electric level of
RS-232, generated by the common PC, is converted
3 Open source vs. Profibus using this dongle to RS-485, used by Profibus DP.
patents The dongle is powered directly from the serial port
of the PC. It is the reason why the converter is very
small with very few components integrated. The lack
The project was established to offer an open imple- of external power supply limits use of the dongle in
mentation with all the components to be released very extensive networks with long cabling; further-
under the GNU GPL v.2 or a later version. Earlier more, it’s not possible to use cable termination and
this year distribution of the source code was the number of nodes on the network is limited to
been suspended due to patent problems prevent- around 10 nodes.
ing the distribution of the implementation under an
open-source license. The patents appeared this year A highest attainable Profibus speed of
even though they were applied in 1992. Two of the 19200 bit/s is another limit of this converter. The
three patents related to the Profibus implementa- limitation is caused by differences in speeds sup-
tion affect the FDL master implementation within ported by RS-232 of the personal computer and the
the PBMaster project. speeds supported by Profibus DP. This converter
can be run in mode Master and Analyzers. It is a
Despite very positive feedback from the Profibus very low cost solution. All schematic and assembly
experts after the presentation of the project at materials are available in the project’s repository.
the Profibus Conference in Krakow in July 2009,
the PI (Profibus International organization) and
patent holders declared they did not want to support
the community and repeated that Profibus is an
“open” but not “open-source” standard. The
PI grants rights for using the patents to Profibus
members. This means the PI members can use
PBMaster’s implementation. The situation unfortu-
nately does not allow distribution of the master im-
plementation, which covers a significant part of the
project, in the community until the patents are valid.

4 Hardware System Structure


As mentioned before, implementing the standard by
software makes it possible to run on a wide range
of hardware including that which was not designed FIGURE 2: RS-232/RS-485 Converter
4.2 PCI based cards was 500 kbit/s (limited by the transceiver). It is
expected to achieve a Profibus speed 1.5 Mbit/s or
In order to achieve higher speeds it is necessary to higher with a faster transceiver. The software runs
use some UART integrated extension cards. The cur- on a target without operating system. It is a robust
rent drivers support PCI based cards integrating the solution and can be used in Master or experimentally
OX16C954 chip, probably the fastest UART inte- in Slave mode.
grated circuit with a PCI interface on the market.
It is a high performance UART with 128 byte FI-
FOs by Oxford Semiconductor. The IC integrates a
16C550 compatible UART offering an ample FIFO
size and many other interesting features. One of the
most important features is the maximal bus speed
of 15 Mbit/s in normal mode and 60 Mbit/s in ex-
ternal clock mode. Using this IC the drivers achieve
a communication speed of 12 Mbit/s, the max-
imal speed of Profibus DP. The PCI card contains
up to four ports. Each port can run in Master or
Analyzers mode up to 12 Mbit/s independently of
the others. The PCI card does not allow usage in
the Bit analyzer mode at the moment as there is no
built-in hardware support (could be added easily).
FIGURE 4: Embedded Board Integrating an
ARM LPC 2148

This very tiny module integrating ARM7 by At-


mel offers many interesting interfaces like Ether-
net, USB 2.0, SPI, I2C, CAN transceiver, UART
+ RS-232/RS-485 transceivers etc. It runs FreeR-
TOS, a highly portable real-time operating system.
Profibus support for this module is under develop-
ment and is expected to achieve very high speeds
thanks to the DMA channel and very high speed RS-
485 transceiver.

FIGURE 3: UART Integrated PCI Card

4.3 ARM based boards

Having the option to use the Profibus drivers on


an embedded system is especially interesting. This
option makes connecting to the Profibus network
easy, cheap and removes the need for big hardware
support. Reading sensors and controlling actuators
would be very easy and available for common appli-
cations like home automation, robot controlling or FIGURE 5: ARM7 board running FreeR-
even control of a production line. The embedded TOS
system offers a lot of options for creating a bridge
between different standards, as the micro-controllers
usually offer many types of interfaces. 5 Device Drivers
The following figure shows a board integrating
an LPC 2148 ARM with UART interfaces by NXP Almost all hardware needs software to support the
Semiconductors. The highest tested Profibus speed functionality it was designed for. In our case, this
takes the form of a device driver implementing low- cate using a file or a socket, the API between
level support called FDL (Fieldbus Data Link ). Most an application and a kernel is unified, as well
of the hardware supported solutions use ASICs to as the API between an interface module and
implement this FDL layer. In contrast, the PB- the core module.
Master solution is implemented solely by software.
Along with the FDL layer the drivers cover also the
low-level part of the Profibus analyzer and UART
Bit/Byte analyzers. The software structure was de-
6 FDL API
signed to be as modular as possible. The modularity
allows porting to other platforms without extensive Once the drivers are installed, communication with
modification of the base part. The created frame- another station on the bus is provided by sending
work offers a simple way to write driver support for bytes in the raw form directly to the Profibus de-
new hardware. vice. Even thought it is simple to realize communi-
cation in this way, the fact that a developer needs to
The current driver design is divided into three groups understand frame structures, and even the Profibus
of modules: specification, make it unsuitable and inconvenient for
most application developers. Hence an API was de-
The core module – (pbmcore) – is the main driver veloped to offer a unified and simple mechanism to
implementing the basic device data structure, access the Profibus network.
chip related defines, a bit/byte stack imple-
mentation and the most important part, the The API is provided in the form of a library.
Profibus FDL stack. The implementation of The library offers a unified system and architecture-
Profibus covers Finite State Machines of an independent programming interface handling the
FDL Master station, FDL Slave station, low- transfer between FDL applications and Profibus sta-
level part of the Profibus Frame Analyzer and tions.
UART Bit/Byte Analyzer. The project had a plan to fully support the
The module is platform and hardware indepen- FDL programming interface by Siemens. In the
dent and by itself does nothing but offer func- end, backwards support was not implemented due to
tions to other chip drivers. This allows use of the proprietary license of that programming inter-
several chip drivers simultaneously without any face. Nonetheless, the project’s API partly supports
code redundancy. In addition it makes possible backward compatibility with the Siemens’s FDL pro-
supporting new hardware without deep knowl- gramming interface. Everything related to Siemens’s
edge about the Profibus standard. Request Block should be removed as the library does
not work with that structure. Replace the Request
Chip drivers – (pbm 950pci, pbm 8250, ..) – im-
Block with a buffer. This backward support is imple-
plement basic I/O operations with real
mented as macros calling the proper API functions
hardware like chip initialization, read, write
described previously. Mapping between the project’s
etc. The chip module, upon loading, registers
API and the API by Siemens is listed below:
to the core module these basic operations and
provides hardware and system dependent sup- pbm open SCP open
port for things such as resource allocation or pbm close SCP close
interrupt registration. The remaining actions pbm write SCP send
are controlled by the core module through the pbm read poll SCP receive
state machine. pbm errno SCP get errno
User space interface module – (pbm fdl ) – the
third group of modules implements an inter-
face between user applications and the FDL 7 Profibus DP
layer in the kernel space. Currently, the mod-
ule is a character device but in the future The Profibus DP (Decentralized Peripherals) layer
a socket module will be developed to allow is based on top of the FDL layer. There are three
communication using a socket-based technique. groups of specification for the DP layer. The ba-
An application writes its request to, and reads sic version DPV0 should be supported by all DP
responses from, the device. This data is passed devices which involve support for Cyclic Data Ex-
to the core module and then is addressed cor- change and Diagnostics. The DPV1 extensions are
rectly to an appropriate chip device. Regard- an integral part of the Profibus PA specification pro-
less of whether the user chooses to communi- viding Acyclic Data Exchange, Process Alarm Han-
dling etc. Extension DPV2 introduces additional en- designed to be fast, reliable and modular. Thanks to
hancements that are used in high-speed servos and its modularity, it will be more simple to integrate
drives and in functional safety systems. DPV0 will new features into the program so it could become
be supported by the project and its implementation a versatile industrial bus control and monitoring pro-
is under development. This will be an important step gram. The current version supports Profibus Frame
for certification of the implementation. analyzer and UART Bit/Byte analyzer.

8 TCP/IP Server
Until now, the software supported only Unix-like op-
erating systems or embedded ARM based systems.
With the server, any station supporting TCP/IP can
connect to the Profibus network remotely.

FIGURE 7: Profibus FDL/DP Analyzer

The main window contains menus, tool bars, side


bar, debug window and tabs with specific functions.
The global buttons like Start Capture, Refresh View,
FIGURE 6: Client-Server Architecture Timestamp settings affect only the visible tab. The
debug window is collective for all tabs. The side
The figure illustrates a client-server model. The bar shows information about the nodes. Several tabs
server is installed on the machine along with the de- of the same type can be present at the same time.
vice drivers. The device drivers implement installed The analyzer offers other interesting features like on-
nodes on the bus in several modes. The server pro- line view during capture, offline view of saved files
vides access to devices created by the drivers over and timestamp display in five formats. Timestamp
the Internet network. On one side it uses the FDL can be in absolute time, time difference between data,
programming interface for accessing those devices. time from the start of capture, bit time difference be-
On the other side socket communications are estab- tween data and bit time from the start of capture.
lished to serve the client demanding remote access to Capture trigger, view filter and statistics of captured
devices. data will be implemented in the next version.

9 Bus Analyzer and Monitor


Applications in industry often demand for tracking
problems on the fieldbus. The problems can be di-
agnosed and localized by listening to and analyz-
ing communication on the bus. By analyzing the
captured data, it is possible to detect problems like
frames with errors (often caused by signal reflection),
station inactivity, address collisions, too short Slot
Times of the Master stations, even bad timing of
stations.
This section introduces a graphical analyzer and
monitoring program. The program was written in
QT and as with other components of the project, was FIGURE 8: Bit Analyzer
All addresses are specified using the URL mech- FIGURE 9: Xfce Desktop with Profibus Util-
anism (Uniform Resource Locator). A URL iden- ities
tifier could be pbm://server.pbmaster.org:11000/0,
file:///dev/pbmaster0 or simply /dev/pbmaster0.
Imagine having an environment supporting
The first URL refers to a device number 0 on a re-
Profibus and other UART utilities in just a few min-
mote server using port number 11000, the latter two
utes. There is no need for installation, no manual
refer to a local file.
configuration required - just put the Live CD into
your drive and reboot the computer.

10 Live Linux CD
The PBMaster project is an effort to develop and
maintain an open-source implementation of Profibus 11 An Overview of Applica-
DP. Running in open-source software has also disad- tions
vantages. Probably the biggest disadvantage is that
almost everyone using computers is familiar with
commercial operating systems like MS Windows or The figure shows a model production line running
Mac OS, but not everyone has experience nor the Profibus using PBMaster. The drivers implement a
ability to get on with Linux, BSDs, etc. Despite master station with an integrated PCI card, based on
rapid improvements and the spreading use of open- an OX16PCI954 chip, running at 1.5 Mbit/s. It is
source software, applications based on commercial possible to run up to 12 Mbit/s without any problem.
software and MS Windows are still dominant and The speed limitation is caused by one slave station.
this situation applies especially for Profibus indus- Actuators and sensors are connected to slave stations
try. by WAGO.
That is why the project has developed a Live
Linux CD offering an easy way to use the Profibus
solution without need for software installation. It
is not necessary to install any operating system nor
other program - just plug in the hardware, insert the
Live CD and start working with Profibus.
The CD is based on the Debian Lenny [6] dis-
tribution. It contains utilities and useful tools like
Xfce desktop environment and its programs, Firefox
internet browser, Kate text editor, Openoffice.org of-
fice suite, OpenSSH client and server, GCC compiler
collection and Make utilities, Midnight Commander,
Vim editor, GIT, CVS, SVN, media player and many
more programs including all necessary libraries to
compile the project’s components. The number of
packages in total is more than 750.
FIGURE 10: A Model Production Line

The figure shows several Profibus networks. One


network consists of an ARM based board running
in master mode, a slave station with digital in-
puts/outputs and an analyzer running in bit mode.
The network communication speed is 500 kbit/s.
The second network consists of two Profibus nodes
communicating at 12 Mbit/s. One node simulates a
master station, the second node runs in frame ana-
lyzer mode. The rest 4 unconnected ports are mas-
ters running at 187.5 kbit/s, 500 kbit/s, 1.5 Mbit/s
and 6 Mbit/s. All nodes run simultaneously.
which is used to distinguish between data charac-
ters and protocol control information. The physi-
cal layer consists of one twisted pair of leads and
RS-485 transceivers. The project is developed and
maintained by Pavel Pisa and Petr Smolik. For more
information please refer to the project homepage.
ProfiM [5] is a project implementing simulation
of master stations using only UART integrated PCI
cards or a simple converter of RS-232/RS-485. It
leads to an inexpensive solution as there is no need
of any expensive proprietary hardware nor software.
In addition it offers an FDL programming interface
compatible with the API by Siemens. The project
supports only Windows OS. One of the disadvan-
tages is that the project has been inactive since 2004.
FIGURE 11: Master-Slave Communication
The driver was not designed to be modular and from
and Bus Monitoring
my point of view it is inefficient and even the stabil-
The figure shows two Profibus networks. There is ity of the driver is not favorable. The project was
one master, one slave and one bit analyzer on the first developed by Pavel Trnka and maintained by Petr
network running at 19200 bit/s. The second network Smolik. For more information please refer to the
consists of one master and one frame analyzer sta- project homepage.
tion running at 12 Mbit/s. Data from the analyzer
is sent over the Internet network to the analyzer and
monitoring program running on a notebook. More 13 Compiling with OMK
examples can be found on the project’s website [2].
At present, the device drivers are built inside the
source code directory using system’s default make
scheme. On the other hand, the project’s applica-
tions are built out of the source tree using Make sys-
tem called OMK (Ocera Make System [7]).
OMK [3] is a Make system developed and main-
tained by Pavel Pisa and Michal Sojka from the De-
partment of Control Engineering at Czech Techni-
cal University in Prague under the OCERA project.
The main objective of the OMK system is to simplify
compilation of components on the host machine as
well as cross compilation for the target. In addition
the system provides for a better directory and file
structure. The make system allows building out of
FIGURE 12: Remote Bus Monitoring source trees and storing results of the compilation in
a separate directory structure to simplify testing and
program installation.
12 Friendly projects A key solution is to have a central Makefile with
compilation rules for most sub-components and com-
I would like to mention two projects, uLan and ponents. This solution allows faster and smoother
ProfiM, which have similar objectives as PBMas- changes to the system, such as kernel updates. Hav-
ter. Some solutions and ideas used in PBMaster have ing most rules in a central file, Makefiles in source
been taken from these projects. directories can be very simple.
The project uLan [4] provides a 9-bit multi- OMK was not designed to support the BSD sys-
master message oriented communication protocol, tems. A number of changes have been made in order
which is transferred over the RS-485 link. Charac- to use this make system on FreeBSD and NetBSD.
ters are transferred in the same way as for the RS- Although not all OMK features are available yet un-
232 asynchronous transfer except for the parity bit, der FreeBSD/NetBSD, it is possible to compile all
project’s applications using this system. The OMK tation. The software runs on Linux, FreeBSD and
system is particularly useful for cross-compiling to NetBSD operating systems as well as ARM based
the final architecture (e.g. embedded ARM). embedded systems. A few open hardware solutions
are also available.
There are many applications, where Profibus
14 Advantages and disadvan- can help to make our life more comfortable. The
tages Profibus can be use for example in automatic door
systems, power saving systems, temperature regula-
tion in buildings, etc. Application of this open so-
One of the advantages and a strong point of the
lution may be appreciated by universities and com-
project is based on the modular design of the soft-
panies, as it is currently necessary to have very ex-
ware. It makes the implementation portable and
pensive commercial hardware and software for any
multi-platform. The software achieves 12 Mbit/s
experimentation with Profibus.
with very good performance. Thanks to the software
implementation, applications based on RS-485 could Despite these achievements, there are still many
be switched to use the Profibus, therefore it is not problems to be solved to facilitate use in professional
necessary to invent a new protocol in the application applications. The future objective is to implement
based on this physical standard. the Profibus DPV0 layer and to create an unofficial
certification of the implementation. Even though the
There are of course many disadvantages of the
slave abstraction layer is working, there is still a lot
software implementation. Even though it works re-
of work to be done to improve it. The project will
liably in most cases, it is not possible to guarantee
extend support for new hardware and operating sys-
fully deterministic responses on common operating
tems like FreeRTOS and MS Windows. Libraries,
systems due to their design (e.g. when the CPU is
graphical analyzer and other applications will be im-
occupied by handling a lot of interrupts from another
proved.
devices). This could be solved by using Real-Time
operating systems (tested on Linux with Real-Time The problems related to Profibus are very com-
Preempt patches). Another option to achieve fully plex and much effort is required to overcome them.
deterministic responses is to use embedded boards My hope is that this project will make more people
without operating system. familiar with this popular fieldbus solution, so the ex-
tent of use of the Profibus standard would not be lim-
This is a software implementation without hard-
ited only to commercial applications. The software
ware support. It means there is no oscilloscope mode
implementation can spread the use of the stan-
nor speed detection by analyzing the signal. Another
dard to applications, where hardware supported so-
very important disadvantage is that this implemen-
lutions are inconvenient or not possible.
tation is not yet certified (under development).

15 Conclusion and Future References


Work [1] PBMaster Project, Tran Duy Khanh,
http://www.pbmaster.org
An open implementation of Profibus has been pre- [2] PBMaster - Wiki Pages, Tran Duy Khanh,
sented throughout this paper. One of the stated http://wiki.pbmaster.org
goals for the project was the creation of multi-
platform software capable of running on systems with [3] OMK Project, Pavel Pisa, Michal Sojka,
operating systems as well as embedded boards with- http://rtime.felk.cvut.cz/omk/, CTU in Prague
out OS. The components were designed to facilitate
[4] uLan Project, Pavel Pisa, Petr Smolik,
porting to new platforms. The software is imple-
http://cmp.felk.cvut.cz/∼pisa/ulan/ul drv.html,
mented to be fast, reliable and requiring minimal
CTU in Prague
system resources.
[5] ProfiM - Profibus Master, Pavel Trnka, Petr
Currently, the project offers an implementation
Smolik, http://profim.sourceforge.net, CTU in
of Profibus FDL master stations, FDL slave stations,
Prague
Profibus FDL/DP frame analyzer, bit and byte ana-
lyzer for UART based bus, an FDL programming in- [6] Debian Project, http://wiki.debian.org/DebianLive
terface, Live Linux CD, a TCP/IP server for remote
[7] OCERA Project, http://www.ocera.org
access, a set of examples and free Profibus documen-

You might also like