This page contains some things I learned while developing an 8051 PROFIBUS board and firmware a few years ago. I recently cleaned up the code and verified that it still works, using an SST PROFIBUS DP card in a PC. The design can be seen on the Profibus Projects page.

PROFIBUS was developed in Germany in the late 1980's and is widely used in Europe, and to lesser extent in the US, for factory automation and process control. Typical products are drives, robotics, actuators, scales, valves, pumps, and controllers. The availability of ASICs that handle the real-time network processing allow it to be used with 8-bit CPUs and thus embedded into small devices.

PROFIBUS is a well documented and open standard, based on IEC 61158 and IEC 61784. Sample code and courses are available for developers, as well as a good technical forum on the PROFIBUS International web site. See links below.

PROFIBUS International describes four implementations: PROFIBUS DP, PROFIBUS PA, PROFIsafe and PROFIdrive.

PROFIBUS DP, where DP stands for "decentralized periphery," is optimized for factory automation. Profibus PA is optimized for process automation, and the other two implementations are targeted toward safety applications and motion control.

Within PROFIBUS DP is DP-V0, DP-V1, and DP-V2. The original PROFIBUS DP-V0 employs strictly cyclic data exchange between a master and a number of slaves in a round-robin manner at a fixed speed. The DP-V1 extension added acyclic messages such as alarms. DP-V2 further added slave-to-slave messaging. The project described here uses the Siemens SPC3 ASIC, which is capable of DP-V0 and DP-V1.


With cyclic master slave data exchange at a fixed speed, and no possibility of message collisions, a slave device is always updated at some predictable rate. Thus PROFIBUS DP has the desirable trait of being deterministic.

PROFIBUS DP runs over copper or fiber. Over copper, it uses RS485 for its physical layer, and runs at speeds from 9600 baud to 12 Mbaud. It uses NRZ encoding, which means that when a series of 1 bits is being transmitted, the RS485 line "+" side stays high (does not return to zero) and the "-" side stays low. RS485 is a multidrop system where each slave device has an address, and only goes online to send a reply when addressed by the master, thus no collisions. RS485 devices share the same 2 wires, so it's important that the slave's transmitter does not turn on before the master's transmitter has turned off.

PROFIBUS implementation details are conveyed to the master by a "device description file" also known as a GSD file. This ASCII text file is read by the master configuration program, compiled, then downloaded into the master. The GSD file for a slave implementation specifies information such as whether the slave device handles a particular network speed, whether it is fail safe, its configuration parameters, and timing. GSD files have a naming convention that include a unique ident number as part of the file name. The ident number ranges from 0001 hex to FFFE hex and is assigned by the PNO (PROFIBUS Nutzerorganisation e.V. Germany). The use of the description file combined with automatic baud rate determination allows the PROFIBUS DP network to automatically detect and configure a slave that has just been connected.

PROFIBUS DP includes a number of features that make it attractive for systems that need to be reliable and deterministic, such as robot control. The features are rigidly enforced by the particular ASIC, such as the SPC3 used here.

When a PROFIBUS DP slave first comes up, it cannot exchange data. It must first be "parameterized" by the master, then "configured" by the master. These two transactions must be accomplished without error before data can be exchanged.

In the initial or parameterization state, the slave accepts only a parameterization message from the master. This contains information such as the slave identification number and timing parameters. The slave verifies these values, then moves to the configuration state. In this state the slave waits for a configuration message specifying the number of bytes or words to input and output with each data exchange message. Once this has been confirmed by the slave, the state moves to data exchange state where now the master and slave can exchange data. This requirement for parameterization and configuration enhances reliability because no data can be exchanged until the master and slave are in agreement as to the quantity of data to be exchanged and the slave's capabilities.

Both input and output data are transferred by the data exchange message. For example, the message from the master contains the master's "output data" and the reply from the slave then acks that message and includes the "input data" going from it to the master.

PROFIBUS DP associates certain predefined service access points, or SAPs, with certain types of messages. For example a parameterization message from the master is directed to SAP61. This is analogous to the use of "ports" in TCP/IP where a port is a field in the TCP header that refers to an endpoint used for a specific application message. Likewise, the SAP is a field in the header portion of the PROFIBUS DP message.

See the page on PROFIBUS ASICS for information on the ASIC interface.

Related Information