Configuring FDL Communication on Siemens S7-300 with CP 342-5

David Krause11 min read
S7-300SiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview

Fieldbus Data Link (FDL) is the Layer-2 service set defined by IEC 61158/EN 50170 Volume 2 (PROFIBUS). It exposes the PROFIBUS bus as a deterministic, peer-to-peer data channel between stations without requiring a DP master/slave cycle. On the S7-300 platform, FDL is delivered through the CP 342-5 communications processor (catalog number 6GK7 342-5DA02-0XE0) and is driven from user logic by the standard blocks FC5 AG_SEND and FC6 AG_RECV shipped with the SIMATIC NET library.

This guide walks through commissioning an FDL link between two CPU 315-2 DP stations (6ES7 315-2AF02-0AB0) using two CP 342-5 modules, including hardware addressing, STEP 7 / NetPro configuration, FC5/FC6 parameterization, status-code interpretation, and verification.

FDL is a peer-to-peer protocol, not a DP slave. The CP 342-5 FDL firmware operates independently of the integrated DP master on the CPU 315-2 DP; both interfaces can coexist on the same PROFIBUS segment when the bus parameters are consistent.

Protocol Background: Where FDL Sits in the PROFIBUS Stack

FDL implements PROFIBUS Layer 2 (Fieldbus Data Link). It provides connection-oriented and connectionless services:

  • SDA (Send Data with Acknowledge) – connection-oriented, acknowledged.
  • SRD (Send and Request Data with Reply) – connection-oriented, used by S7 FDL by default.
  • SDN (Send Data with No acknowledge) – broadcast/multicast.
  • CSRD (Cyclic Send and Request Data) – cyclic polling.

On the S7 side, the default FDL connection uses SRD semantics with a fixed maximum user payload of 240 bytes per telegram. Each CP 342-5 supports up to 16 simultaneous FDL connections, and the CP can simultaneously operate as a DP master, DP slave, or FDL station through the same physical interface (electrical RS-485 via the 9-pin D-sub, or fiber-optic on the FO variant).

Prerequisites

Before configuring FDL, verify the following hardware, firmware, and software baseline:

Item Specification
CPU SIMATIC S7-300 CPU 315-2 DP, MLFB 6ES7 315-2AF02-0AB0 (firmware V2.6 or higher recommended)
Communications processor SIMATIC NET CP 342-5, MLFB 6GK7 342-5DA02-0XE0 (firmware V5.0 or higher)
Engineering software STEP 7 V5.5 + SP4 or STEP 7 V5.6 with SIMATIC NET S7 libraries; alternatively TIA Portal V16+ with ET 200 clean or SIMATIC S7-300 CPU packages
Library blocks FC5 (AG_SEND / AG_LSEND) and FC6 (AG_RECV / AG_LRECV) from SIMATIC NET library
PROFIBUS cable PROFIBUS DP cable (purple), 9.6 kbps to 12 Mbps, terminated with 9-pin D-sub connectors, switchable termination resistors at both ends
Bus topology Line topology, max 32 stations per segment, max segment length dependent on baud rate (1,200 m @ 9.6 kbps; 100 m @ 12 Mbps)
Power supply PS 305 or PS 307 sized for the S7-300 station load
Two CP 342-5 modules do not require external PROFIBUS termination if both ends of the segment terminate; always power-cycle the stations before commissioning so each CP reads its parameter set during startup.

Hardware Configuration and Module Addressing

Insert the CP 342-5 into a free slot of the S7-300 rack (slot 4 through 11 are valid, slot 3 reserved for IM). In the STEP 7 hardware catalog, locate SIMATIC 300 > CP 300 > PROFIBUS > CP 342-5 and drag the module matching the catalog number to the rail.

  1. Open the CP 342-5 properties dialog and assign a unique PROFIBUS address (e.g., station A = PROFIBUS address 2, station B = 3).
  2. Set the transmission rate consistently across all stations on the segment (commonly 1.5 Mbps for FDL links).
  3. Note the I/O start address of the CP. The diagnostic/status area appears in the process image. The example uses LADDR = W#16#FFB (= 4091 decimal), which is the system default for CP 342-5 placed in slot 4; adjust if your slot assignment differs.
  4. For the FDL operating mode, leave the CP in "No DP" or "DP master" if DP must run concurrently; FDL services are independent of the DP role.

Save and compile the hardware configuration (Station > Save and Compile). Repeat for the second CPU.

STEP 7 / NetPro Connection Setup

FDL connections are configured graphically in NetPro, which is launched from the SIMATIC Manager (or from the project tree in TIA Portal under Devices & Networks > Networks view).

  1. Open NetPro for station A. Drag a PROFIBUS subnet across the network view if one does not exist.
  2. Select the CP 342-5 of station A, right-click and choose Insert New Connection.
  3. In the connection dialog, set the partner to "unspecific" or to the partner CP 342-5 of station B. The connection type is FDL connection.
  4. Specify the partner PROFIBUS address (in our example, partner address 3 when configuring from station A's perspective).
  5. Assign the local connection ID. The ID is referenced by FC5 and FC6. In the example, ID = 2; valid IDs on a single CP 342-5 range from 1 to 16.
  6. Set the maximum send/receive length. The default 240 bytes is recommended unless the application requires less.
  7. Compile NetPro and download the connection configuration to both stations.

The compiled NetPro database is stored in the system data blocks (SDB) of the CPU. On startup, the CPU passes the connection parameters to the CP, which then autonomously establishes the SRD handshake on PROFIBUS.

Programmatic Interface: FC5 AG_SEND and FC6 AG_RECV

The SIMATIC NET library delivers two function blocks per connection:

  • FC5 AG_SEND – transfers a user buffer to the CP for transmission.
  • FC6 AG_RECV – reads received data from the CP into a user buffer.

Place FC5 and FC6 from the SIMATIC_NET_CP library into the S7 program. Below is a working OB1 example matching the parameters used in the field reference. Flags are deliberately chosen for clarity; replace with your project's tag names.

// OB1 - Cyclic OB (OB1)
// Trigger send every OB1 cycle (use a clock bit like M0.7 for 1 Hz)
// Pos-edge of M0.7 generates send pulse

      A   M    0.7          // 1-second clock bit (e.g. from CPU clock memory)
      FP  M    82.7         // edge memory bit
      =   M    82.0         // send trigger pulse

// --- FC5 AG_SEND ---------------------------------------------------
      CALL FC    5
        ACT    :=M82.0      // 1 = trigger send
        ID     :=2           // FDL connection ID from NetPro
        LADDR  :=W#16#FFB    // CP 342-5 logical base address (slot 4 default)
        SEND   :=P#DB80.DBX20.0 BYTE 10  // source DB / start / length
        LEN    :=10          // bytes to send (max 240)
        DONE   :=M82.1       // 1 = send completed without error
        ERROR  :=M82.2       // 1 = error occurred
        STATUS :=DB82.DBW2   // 16-bit status word

// --- FC6 AG_RECV ---------------------------------------------------
      CALL FC    6
        ID     :=2           // FDL connection ID from NetPro
        LADDR  :=W#16#FFB    // CP 342-5 logical base address
        RECV   :=P#DB82.DBX20.0 BYTE 90  // receive buffer
        NDR    :=M82.3       // 1 = new data received
        ERROR  :=M82.4       // 1 = error occurred
        STATUS :=DB82.DBW4   // 16-bit status word
        LEN    :=DB82.DBW6   // actual received length in bytes
LADDR must match the slot address assigned in HW Config. If the CP is in a slot other than 4, recompute the address from STEP 7. Mismatches between LADDR and the configured base address are the single most common cause of status 0x80B1 ("logical base address invalid").

FC5 / FC6 Parameter Reference

Parameter Direction Type Description
ACT (FC5) IN BOOL Edge-triggered send request; the block transmits once per rising edge.
ID IN INT Connection identifier from NetPro (1–16 per CP).
LADDR IN WORD Logical base address of the CP 342-5 (hex).
SEND / RECV IN POINTER / ANY Pointer to source (SEND) or destination (RECV) data area.
LEN (FC5) IN INT Number of bytes to transmit.
DONE OUT BOOL Send completed successfully.
NDR OUT BOOL New data received (FC6).
ERROR OUT BOOL 1 = error; STATUS contains the diagnostic code.
STATUS OUT WORD Detailed status / error code (see section below).
LEN (FC6) OUT INT Actual length of received telegram in bytes.

FDL Status and Error Codes

The STATUS word returns Siemens-standard diagnostics. The two-byte structure breaks into event class (high byte) and event number (low byte). Common values encountered when commissioning CP 342-5 FDL:

STATUS (hex) Meaning Corrective Action
0000 No error / job complete None required.
0070 Send job executing Normal transient; wait for DONE.
0x80A1 User buffer too small for received data Increase RECV length or reduce partner LEN.
0x80A2 Receive buffer still occupied Reduce OB1 cycle time or use OB35 to call FC6 more frequently.
0x80B1 Logical base address invalid Verify LADDR matches HW Config slot address.
0x80C1 Connection not configured / SDB missing Re-compile NetPro and download SDBs.
0x80C3 FDL connection temporarily unavailable Check PROFIBUS cable, partner CP online state, baud rate.
0x80D1 Send resource occupied Avoid calling FC5 faster than the bus can transmit; insert acknowledgment check.
0x8181 FDL protocol error (negative ACK from partner) Inspect partner STATUS, check for length mismatch > 240 bytes.
0x8281 Partner not reachable / timeout Verify partner PROFIBUS address, cable, termination, station in RUN.

Additional codes are listed in the SIMATIC NET programming manual; refer to MN_FDL-API_76 (Siemens FDL Programming Interface manual) for the full diagnostic set.

Baud Rate and Segment Length Limits

PROFIBUS segment length is dictated by the configured transmission rate. Use the table below when designing FDL links that may share the segment with DP masters:

Baud Rate Max Segment Length (electrical)
9.6 kbps 1,200 m
19.2 kbps 1,200 m
187.5 kbps 1,000 m
500 kbps 400 m
1.5 Mbps 200 m
3 Mbps 100 m
6 Mbps 100 m
12 Mbps 100 m

Verification and Commissioning Checks

After downloading the hardware configuration, NetPro connection, and user program, walk through this verification sequence:

  1. Bring both CPUs to RUN. Confirm the CP 342-5 SF LED is off and the BF LED is off.
  2. Open SIMATIC Manager > PLC > Monitor/Modify and force a 1 Hz pulse on M0.7.
  3. Observe M82.1 (DONE) toggling on station A and M82.3 (NDR) toggling on station B. If both toggle, the FDL link is operational.
  4. Cross-check DB82.DBW6 (received length) on station B equals 10 bytes.
  5. Reverse direction by forcing M0.7 on station B; confirm station A receives.
  6. Use CP Diagnostics in STEP 7 to view connection state, telegram counters, and error statistics (transmitted OK / transmitted errors / received OK / received errors).
Determinism tip: FC5 and FC6 are best called from a time-controlled OB (OB35) rather than OB1 to decouple send cadence from program scan time. A 100 ms cycle on OB35 is typical for FDL polling.

Troubleshooting Matrix

Symptom Likely Cause Fix
BF LED on CP 342-5 No PROFIBUS activity / baud rate mismatch Set identical baud rate on every station; check terminating resistors at both ends.
SF LED on CP 342-5 Configuration error or duplicate station address Recompile HW Config, ensure each station has a unique PROFIBUS address.
DONE never set, STATUS = 0x80B1 LADDR mismatch with HW Config Update LADDR to actual slot address (e.g. W#16#FFC for slot 5).
DONE toggles but partner NDR never toggles Partner CPU in STOP or SDBs not downloaded Put partner CPU in RUN; download NetPro SDBs to partner station.
NDR toggles but length = 0 Partner LEN parameter mismatched Align FC5 LEN with FC6 RECV capacity.
Intermittent STATUS = 0x8281 EMC noise or loose connector Re-seat D-sub connectors, verify shield bonding, route cable away from VFD power cables.
STATUS = 0x8181 after firmware update CP firmware incompatible with STEP 7 project version Match CP firmware with STEP 7 / SIMATIC NET version; update GSD or library if needed.
STATUS = 0x80C1 after restart SDBs not present in CPU NetPro > PLC > Download > "Connection Configuration" to download SDBs.

Migration Notes and Alternatives

FDL is mature but increasingly replaced by PROFINET (open user communication via TCON / TSEND / TRECV) on new installations. When migrating from FDL to PROFINET:

  • Replace CP 342-5 with CP 343-1 Lean / CP 343-1 Advanced, or use the onboard PN interface of newer CPUs.
  • Substitute FC5 / FC6 with TCON, TSEND, TRECV, TDISCON from the standard IEC library.
  • Recreate the point-to-point connection in the TIA Portal network view as a TCP or ISO-on-TCP connection.
  • Verify a documented migration path using Siemens entry 17596048 (FDL S5 to S7 configuration) for cross-generational guidance.

For mixed-vendor PROFIBUS ecosystems where a Beckhoff EL6731 acts as an FDL gateway, the Beckhoff EL6731 FDL interface documentation describes ADS-based access to FDL telegrams. For TIA Portal-based S7-300 engineering, the TIA Portal FDL setup reference details the TCON_FDL system data type and direct parameter assignment.

What is the maximum payload of an FDL telegram on CP 342-5?

The maximum user payload per FDL telegram is 240 bytes (SRD service). Configure SEND/RECV buffers and the LEN parameter accordingly; values above 240 bytes return STATUS = 0x80A1 on receive or 0x8181 on send.

How many FDL connections can a single CP 342-5 handle?

Each CP 342-5 supports up to 16 simultaneously configured FDL connections, identified by IDs 1 through 16. Connection IDs are local to the CP and must match between NetPro and the FC5/FC6 ID parameter.

Why does LADDR = W#16#FFB keep returning STATUS = 0x80B1?

The base address 0xFFB (decimal 4091) is the STEP 7 default for CP 342-5 placed in slot 4. If the module sits in a different slot, compute the actual start address from HW Config (e.g. slot 5 typically yields 0xFFC). Update LADDR to match the configured value, recompile, and reload.

Can FC5 AG_SEND and FC6 AG_RECV coexist with DP on the same CP 342-5?

Yes. FDL services operate independently of the DP master/slave role. Configure both the DP and the FDL connection in NetPro; the CP arbitrates bus access transparently. Ensure all stations agree on bus parameters and baud rate to avoid DP bus fault propagation.

Should FC5 / FC6 be called from OB1 or a time-driven OB?

For deterministic FDL traffic, call FC5/FC6 from a cyclic interrupt OB such as OB35 (default 100 ms). OB1 execution time varies with the user program, which can stretch send cadences and cause STATUS = 0x80D1 when send resources are re-issued faster than the CP can transmit.

Back to blog