Overview
CPU-to-CPU communication over PROFIBUS DP is a standard requirement when two SIMATIC S7-300 stations must exchange process data deterministically. The configuration described here is a typical mixed configuration:
- Station 1: S7-300 CPU 315-2 DP (6ES7315-2AG10-0AB0) plus a CP 342-5 communications processor (e.g., 6GK7342-5DF00-0XE0) on the backplane.
- Station 2: S7-300 CPU 315-2 DP (6ES7315-2AG10-0AB0) with the integrated DP interface on the CPU.
The CP 342-5 is an external PROFIBUS interface module that the CPU 315-2 DP cannot use as a passive "backplane extension" for I/O. The CP must be configured either as a DP master or DP slave and the two stations then exchange data using the CP services or, for master-to-master, an interposed DP/DP coupler.
This article consolidates the four realistic options, identifies the correct system function blocks (SFCs) and function blocks (FBs), and shows the hardware and software configuration flow inside STEP 7 V5.5 / SIMATIC Manager.
Prerequisites
| Item | Specification |
|---|---|
| STEP 7 (SIMATIC Manager) | V5.5 SP4 or later, with installed optional package "SIMATIC S7-CP PtP/DP" for CP 342-5 |
| Firmware of CPU 315-2 DP | V2.6 (6ES7315-2AG10-0AB0) or V3.3 for the 6ES7315-2AH14-0AB0 variant |
| CP 342-5 | 6GK7342-5DA02-0XE0 or 6GK7342-5DF00-0XE0 with firmware V5.x |
| GSD file | SIEM80A9.GSD for older CP 342-5; for current CP variants the device is integrated in the STEP 7 hardware catalog |
| PROFIBUS cable | 2-wire shielded, RS-485, 9.6 kbit/s up to 12 Mbit/s; bus terminators ON at both segment ends |
| Connector | 6ES7972-0BA12-0XA0 (with PG port) or 6ES7972-0BB12-0XA0 (without PG port) |
Communication Method Comparison
Four practical options exist. The choice depends on whether the two CPUs must act as peers or whether one side is purely a data source.
| Method | Interface | Topology | Blocks Required | Max. Data Volume | Direction |
|---|---|---|---|---|---|
| 1. DP master ↔ DP slave | CP 342-5 (master) on Station 1 ↔ integrated DP on Station 2 (slave) | Single segment, both on same bus | FC 1 / FC 2 in the CP 342-5 user program; no SFCs in the user CPU required for the link itself | Up to 244 bytes per slot, up to 32 slots | Bidirectional (configurable slots) |
| 2. Master ↔ Master | DP/DP coupler (6ES7158-0AD01-0XA0) between two DP segments | Two physical segments joined by coupler | FC 1 / FC 2 in each CP; coupler configured with GSD file | Up to 244 bytes input + 244 bytes output per direction | Bidirectional, fully isolated |
| 3. MPI global data | MPI/DP port of the CPU | MPI bus, no CP needed | System configuration of global data tables in STEP 7; SFC 60 / SFC 61 not used | Max. 32 GD packets, up to 22 bytes each | Broadcast (publisher-subscriber) |
| 4. MPI S7 communication | MPI/DP port of the CPU | MPI bus | SFC 67 (X_GET), SFC 68 (X_PUT) on the client; SFC 66 (X_ABORT) optional | Up to 76 bytes per call (X_PUT) | Client / server, request-response |
Method 1 - Master/Slave on the DP Port (Recommended for S7-300)
The simplest and most common configuration is to run the CP 342-5 in Station 1 as a DP master and the integrated DP interface of CPU 315-2 DP in Station 2 as a DP slave. This avoids the need for a DP/DP coupler, but the two stations must share the same PROFIBUS segment and bus address space.
Hardware Configuration in STEP 7
- Insert a SIMATIC 300 station and add the CPU 315-2 DP (rack 0, slot 2).
- Open the DP port properties and set the operating mode to DP master. Define the PROFIBUS subnet with the bus parameters profile "Standard" or "DP" and assign a unique master address (default: 1).
- Add the CP 342-5 to the same station. Right-click the CP, choose Properties > Operating Mode, and select DP master if the CP is in Station 1, or DP slave if it is in Station 2.
- Assign the CP 342-5 to the same PROFIBUS subnet as the CPU's integrated DP port. Each node must have a unique PROFIBUS address on the segment (1...125).
Configuring the Slave I/O Slots
- Open the DP master system of Station 1 in HW Config.
- Drag the Station 2 CPU 315-2 DP from the catalog into the master system. The slave is inserted at the next free PROFIBUS address.
- Insert the desired I/O slots: from the catalog select CPU 315-2 DP > Slave > Universal module or use the predefined modules (DI, DQ, AI, AQ). Each slot can carry up to 16 bytes.
- For each slot, choose alignment: "Input" = data read by the master, "Output" = data sent by the master to the slave, "Input/Output" = bidirectional.
Programming the Data Exchange (FC 1 / FC 2)
Unlike PROFIBUS DP that uses the I/O image directly, communication via the CP 342-5 is "DPV1 services"-based and must be triggered in the user program. Two function blocks are provided in the STEP 7 library "SIMATIC_NET_CP > CP 300 > Blocks":
- FC 1 "DP_SEND" (also called "AG_SEND" in older projects): transfers data from the CPU to the CP for transmission.
- FC 2 "DP_RECV" (also called "AG_RECV"): receives data from the CP and writes it to the CPU.
Sample call in STL (master station, write 8 bytes to slave PROFIBUS address 2):
// Call FC 1 - DP_SEND
CALL FC 1
CPLADDR := W#16#100 // Logical address of the CP 342-5
SEND := P#DB10.DBX0.0 BYTE 8
DONE := M 50.0
ERROR := M 50.1
STATUS := MW 52
// Call FC 2 - DP_RECV
CALL FC 2
CPLADDR := W#16#100
RECV := P#DB11.DBX0.0 BYTE 8
NDR := M 53.0
ERROR := M 53.1
STATUS := MW 54
RD_LEN := MW 56
The CPLADDR must match the logical base address of the CP 342-5 module; this is visible in HW Config under the module's I/O addresses (e.g., 256 decimal = W#16#100). The STATUS word follows IEC 61131-3 conventions: bit 15 set = error class, bit 7..0 = event number.
Programming the Slave Side (Station 2)
On the DP slave CPU 315-2 DP, the data simply appears in the process image configured for the slots. No FC 1/FC 2 call is required because the slave is a "passive" DP slave. Reading and writing is done with normal L/T operations on the configured I/O addresses (or via the partial process image).
Method 2 - Master-to-Master via DP/DP Coupler
When both stations need to remain DP masters - typically because each side also owns local distributed I/O - a DP/DP coupler must be installed. The Siemens part number is 6ES7158-0AD01-0XA0 (current variant). It has two electrically isolated DP interfaces and is configured as a DP slave to each master on its respective segment.
Configuration
- Install the GSD file "SIEM80F0.GSD" (for the 6ES7158-0AD01) into STEP 7: Options > Install GSD File.
- Refresh the hardware catalog; insert the "DP/DP Coupler" into the master system of each station.
- For each side, configure the maximum of 16 input bytes and 16 output bytes (or up to 244 bytes each if using the larger DPV1 variant). The byte offset on one side must mirror the offset on the other side - data byte 0 on master A is byte 0 on master B, and so on.
- Compile and download the hardware configuration to both stations.
Programming on Both Sides
The coupler is "transparent" to the application. On each side, the configured input/output areas of the coupler appear in the I/O area of the corresponding master. Data exchange is performed using FC 1 / FC 2 on each CP 342-5 in the same way as Method 1, except the CP now talks to a slave whose slave address is the coupler's address on that segment.
Method 3 - MPI Global Data Communication
When the two CPUs are on the same MPI bus and only small amounts of data need to be broadcast, the built-in global data (GD) mechanism is the simplest option. No CP 342-5 is required; the data rides on the integrated MPI/DP port of the CPU.
- In SIMATIC Manager, right-click the MPI/DP subnet and choose Define Global Data.
- Add both CPUs to the GD table.
- For each CPU row, specify the GD packet: choose a memory area (M, DB, I, Q) and length (1 to 22 bytes per packet, max. 32 packets total).
- Mark the data source (publisher) and the receivers (subscribers). The CPU automatically handles the broadcast - no SFCs are called in the user program.
The transmission cycle is configured separately for each GD packet (1 to 255 MPI scan cycles). Status words can be assigned to monitor the transfer; SF (send fault) and RF (receive fault) bits indicate bus problems.
Method 4 - S7 Communication over MPI (X_GET / X_PUT)
For larger or more structured exchanges on the MPI port, the X-routines implement a client-server model. The CP 342-5 manual distinguishes them from the FC 1 / FC 2 DP services.
| SFC | Name | Function |
|---|---|---|
| SFC 67 | X_GET | Read data from a partner CPU (server side = passive, no SFC required) |
| SFC 68 | X_PUT | Write data to a partner CPU (server side = passive, no SFC required) |
| SFC 66 | X_ABORT | Abort an active X_GET or X_PUT job |
| SFC 69 | X_ABORT | Test the connection status (newer revisions) |
Example: reading 20 bytes from DB 5 of the partner CPU at MPI address 2:
CALL SFC 67
REQ := TRUE
CONT := TRUE
DEST_ID := W#16#2 // MPI address of the partner
VAR_ADDR:= P#DB5.DBX0.0 BYTE 20
RET_VAL := MW 100
BUSY := M 102.0
RD_LEN := MW 104
Each SFC call is non-blocking; the BUSY bit must be checked, and the call must be repeated with the same REQ=FALSE until BUSY=FALSE. Up to 4 parallel jobs are permitted per CPU.
Configuration of the PROFIBUS Subnet
Common parameter recommendations for a two-station CPU-to-CPU link:
| Parameter | Recommended Value | Notes |
|---|---|---|
| Baud rate | 1.5 Mbit/s or 12 Mbit/s | 12 Mbit/s only for short segments (≤ 10 m) and CP 342-5 firmware V5+ |
| Highest PROFIBUS address | 126 | Default; do not lower unless you can guarantee the segment is small |
| Profile | DP | Selects standard DP bus parameters; "Standard" is acceptable for ≤ 1.5 Mbit/s |
| Bus terminator | ON at both ends only | Connectors in the middle of the segment must have terminator OFF |
| Repeater | 6ES7972-0AA01-0XA0 if segment > 1000 m at 9.6 kbit/s | Max 9 repeaters in series |
Diagnostics and Error Code Reference
The CP 342-5 returns diagnostic information in the STATUS word of FC 1 / FC 2 and in the module's diagnostic buffer (accessible via PLC > Module Information). The most common events:
| STATUS (hex) | Meaning | Remedy |
|---|---|---|
| 0000 | Job completed without error | No action |
| 0F01 / 0F02 | CP not yet ready, or in start-up | Wait until CP 342-5 finishes initialization; check SF LED |
| 0A0A | No DP slave found on the configured address | Check PROFIBUS address, cable, terminator, and slave power |
| 0E01 / 0E02 | Configuration mismatch between master and slave | Compare slot configuration in HW Config; verify GSD version |
| 8015 / 8016 | Resource bottleneck on CP (max jobs exceeded) | Reduce parallelism, increase scan time, or add a second CP |
| 8085 / 8086 | CP firmware error | Update CP 342-5 firmware, then power-cycle |
LEDs on the CP 342-5 indicate the link state:
- SF (red): Group error - PROFIBUS wiring, slave diagnostics, or configuration error.
- BF (red): Bus fault - cable break, missing terminator, or slave power off.
- RUN (green): CP is in RUN, PROFIBUS active.
- STOP (yellow): CP is in STOP - no cyclic exchange takes place.
Verification
- In HW Config, click "Save and Compile" (Ctrl+S). No errors should be reported for the configured PROFIBUS system.
- Download the hardware configuration to both stations.
- Switch the CP 342-5 to RUN using the mode selector: MRES → STOP → RUN (hold RUN until the green RUN LED stays on).
- Trigger a test data write from Station 1 (master) and read the value at the configured I/O address in Station 2. Use a VAT or watch table to monitor both directions simultaneously.
- In PLC > Module Information > Diagnostic Buffer of the CP 342-5, verify that no diagnostic events are pending.
Troubleshooting Matrix
| Symptom | Likely Cause | Action |
|---|---|---|
| BF LED permanently on | Cable break or slave not powered | Measure voltage on segment, verify terminator, check slave 24 V supply |
| SF LED on, BF off | Configuration mismatch | Compare HW Config of master and slave; ensure identical alignment (input/output) |
| STATUS = 0E01 | Wrong PROFIBUS address on slave | Check DIP switch on slave; should match the address assigned in HW Config |
| Data is old/stale | FC 2 not being called or called with wrong CPLADDR | Verify CPLADDR matches the logical address of the CP in HW Config; ensure FC 2 is in OB1 |
| One direction only works | Slot alignment asymmetric | Reconfigure all slots as "Input/Output" on both sides, or check the byte count on both ends |
| Intermittent communication drops | EMC interference or bad connector | Check shield grounding, replace connector, ensure segment is not longer than specified for the baud rate |
| Master-to-master data does not appear | DP/DP coupler byte offset mismatch | Mirror input/output offsets on both sides of the coupler |
Field-Proven Caveats
- The CP 342-5 has its own processor; it does not extend the CPU's I/O. The CPU must explicitly call FC 1 / FC 2 for any data to be moved - the bus will not run on its own.
- When a CPU 315-2 DP uses its integrated DP port, the maximum number of DP slaves is 32, not counting the CP 342-5 in Station 1 if the CP is on a separate segment.
- MPI global data is broadcast-only; no acknowledgement, no retry, no error recovery. Use SFC 67 / SFC 68 for reliable peer-to-peer on MPI.
- The CP 342-5 requires the optional package "SIMATIC S7-CP PtP/DP" installed in STEP 7 to display its blocks (FC 1, FC 2) in the library.
- For data volumes above 244 bytes per cycle, use S7 communication (SFC 15 / SFC 14 for PUT/GET) over Industrial Ethernet (CP 343-1 Lean) instead of PROFIBUS.
Which PROFIBUS role should the CP 342-5 be configured as for a CPU 315-2 DP to CPU 315-2 DP link?
Use the CP 342-5 as a DP master in Station 1 and the integrated DP interface of the CPU 315-2 DP in Station 2 as a DP slave. Configure the slave I/O slots in HW Config and use FC 1 (DP_SEND) and FC 2 (DP_RECV) in the master station's user program.
Can two DP masters exchange data without a DP/DP coupler?
No, native master-to-master communication on a single PROFIBUS segment is not defined in the PROFIBUS standard. To couple two DP masters, install a Siemens 6ES7158-0AD01-0XA0 DP/DP coupler between the two physical segments. Each master then sees the coupler as a DP slave.
What is the difference between SFC 60 / SFC 61 and SFC 67 / SFC 68?
SFC 60 and SFC 61 are used for SEND/RECEIVE on CP 342-5 (DP communication), while SFC 67 (X_GET) and SFC 68 (X_PUT) implement S7 communication (client-server) typically over the MPI port. Use SFC 67 / SFC 68 when you need reliable read/write of partner CPU data, and FC 1 / FC 2 for cyclic DP slot exchange.
Why does the BF LED on my CP 342-5 stay on even though the cable is connected?
Most commonly because the bus terminator is missing at one or both ends of the segment, the slave has no 24 V supply, or the PROFIBUS address of the slave does not match the configuration. Enable online diagnostics in STEP 7 (PLC > Module Information > Diagnostic Buffer) to see the exact event; a status of 0A0A indicates "slave not found".
Can MPI Global Data be used for more than 22 bytes?
No, each GD packet is limited to 22 bytes. The maximum configuration is 32 packets, giving a theoretical maximum of 704 bytes - but the practical recommendation is to switch to S7 communication (SFC 67 / SFC 68) or PROFIBUS S7 services if you exceed a few hundred bytes.