Siemens CP342-5 PROFIBUS DP: Resolving 8F7FH and OFFLINE Errors

David Krause19 min read
ProfibusSiemensTroubleshooting
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

Siemens CP342-5 PROFIBUS DP: Resolving 8F7FH and OFFLINE Errors

The CP342-5 PROFIBUS communication processor for SIMATIC S7-300 commonly returns two related error patterns during commissioning, and both almost always point to the same root cause: the ANY pointer passed to DP_SEND (FC 1) or DP_RECV (FC 2) is incomplete. The two observable symptoms are DP_SEND reporting RETVAL = 16#8F7FH (internal error / illegal ANY reference) and DP_RECV reporting DPSTATUS = 16#11 (OFFLINE) with no application data being updated. This reference documents the ANY pointer syntax that resolves both conditions, the surrounding HWConfig work that makes the data flow visible, the diagnostic procedures that confirm correct operation, and the firmware / catalog information needed to substitute an equivalent module if the installed CP is end-of-life.

Scope. The block numbers and error codes below apply to the CP342-5 product family (6GK7 342-5DA0x-0XE0 and 6GK7 342-5DF0x-0XE0) under STEP 7 V5.5 SP2 and TIA Portal V13 through V20. The integrated DP interface on S7-300 CPUs uses SFC 14 / SFC 15 (DPRD_DAT / DPWR_DAT) and the CP443-5 Extended uses SFC 49 / SFC 50; those error code sets differ and are documented in the Siemens S7-CPs on PROFIBUS manual and the PROFIBUS with STEP 7 V13 function manual.

1. Affected Hardware and Firmware

The CP342-5 occupies one slot in the S7-300 rack and acts as an independent PROFIBUS DP master (or slave) with its own processor. Because data exchange with the CPU is mediated by the CP, the application is restricted to the FC 1 / FC 2 interface; the data does not appear in the process image and cannot be read with the standard L PEW / T PAW instructions used for the integrated DP interface.

Catalog Number Description Bus Interface Firmware (as shipped) Lifecycle
6GK7 342-5DA01-0XE0 CP342-5 RS485 (SUB-D) V2.0 Discontinued
6GK7 342-5DA02-0XE0 CP342-5 RS485 (SUB-D) V3.0 Discontinued
6GK7 342-5DA03-0XE0 CP342-5 RS485 (SUB-D) V6.0 Active
6GK7 342-5DF00-0XE0 CP342-5 FO Plastic / PCF fiber V1.0 Active (fiber variant)

STEP 7 V5.5 SP2 with HSP-0131 and TIA Portal V13 and later support all four catalog numbers. The CP342-5 remains visible in TIA Portal V20 if the project is migrated with the HSP; for new installations the recommended replacement is the CP343-5 (6GK7 343-5FA02-0XE0), which uses the identical FC 1 / FC 2 interface.

2. Root Cause: Incomplete ANY Pointer

The DP_SEND and DP_RECV blocks shipped with SIMATIC NET NCM S7 require an ANY pointer that fully qualifies the data area. A common misformat is to supply only the DB number — for example passing DB1 or P#DB1 as the source / destination. The CP driver interprets the missing byte count as an internal length error and returns 16#8F7FH; in parallel, the CP diagnostic buffer records a configuration-mismatch entry, which DP_RECV mirrors as DPSTATUS 16#11 (OFFLINE).

The correct ANY pointer format on the CP342-5 is:

P#DB<number>.DBX <byte offset>.0 BYTE <length in bytes>

Worked examples:

// Send 32 bytes from DB1 starting at byte 0
P#DB1.DBX 0.0 BYTE 32

// Receive 16 words from DB100 starting at byte 20
P#DB100.DBX 20.0 WORD 16   // length unit may be BYTE / WORD / DWORD

// Send a flag area
P#M 0.0 BYTE 16            // 16 bytes from MB0..MB15

// Receive into a global DB with the typical 1-byte input + 1-byte output device
P#DB2.DBX 0.0 BYTE 2

Three syntactic rules to honor:

  1. The DB number, byte offset, and byte count are all required. Omitting the byte count is the failure mode that returns 8F7FH.
  2. The byte count must be even. The CP342-5 transfers data in 16-bit words, and an odd byte count is rejected with 16#8F7FH.
  3. The byte count must be a compile-time constant. The CP342-5 does not support variable-length DP frames; redesign the slot or split into multiple DP_SEND calls if the payload length must change at runtime.
Cross-platform note. In TIA Portal V13 and later the ANY pointer is constructed via a Variant or Pointer type at the FB interface and is bound to the FC 1 / FC 2 input by the compiler. The visual editor prevents the malformed-P# pattern by enforcing the length field, which is why this fault shows up almost exclusively in STEP 7 V5.5 projects that pre-date the TIA Portal type system.

3. HWConfig Setup for the CP342-5

Before any DP_SEND / DP_RECV call returns valid data, the CP342-5 must be configured as a DP master in HWConfig and assigned a PROFIBUS address that does not collide with any other bus node. The procedure below applies to STEP 7 V5.5; the TIA Portal equivalent is documented in the Configuring PROFIBUS DP (S7-300, S7-400, S7-1500) reference.

  1. Open the S7 project in SIMATIC Manager and switch to HWConfig.
  2. Insert the S7-300 rack and add the power supply, CPU, and signal modules. Save and compile.
  3. From the catalog, navigate to SIMATIC 300 > CP-300 > PROFIBUS > CP342-5 and drag the module to an open slot. Slot 4 is conventional, but any free slot is permitted.
  4. Double-click the CP342-5 to open its properties. On the General tab, click Properties next to the PROFIBUS interface and assign an address. Address 2 is the most common default for the master; slaves are typically 3..32.
  5. Set the PROFIBUS network to the highest baud rate supported by every node — 1.5 Mbit/s on a clean cable, 12 Mbit/s only when every slave is rated for it. Confirm the profile (DP) and the operating mode (DP master).
  6. Click OK and save / compile the hardware configuration. The CP342-5 is visible online as an active node once the project is downloaded.

On the first online connection, the CP342-5 LED stack reports its state:

LED Steady Flashing Off
SF (red) Group fault — see diagnostic buffer Configuration mismatch No fault
BF (red) Bus fault — no token or short Bus fault — node not reached Bus healthy
RUN (green) CP in RUN CP startup CP stopped

The logical base address reported in HWConfig under Addresses is the value to pass as CPLADDR to FC 1 / FC 2. For an S7-300 in slot 4 the address is W#16#0100; moving the CP moves the base address according to the S7-300 fixed address map (slots 1..11 map to 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40 bytes of input area per slot).

4. Installing the Vendor GSD File

Third-party DP slaves do not appear in the SIMATIC catalog. They are added to the HWConfig library by installing the vendor GSD file. For a generic 8-channel digital I/O block the GSD is typically named DP-Slave.gsd or a vendor-specific equivalent; the file is supplied with the device on a CD or downloaded from the manufacturer portal.

  1. In HWConfig open Options > Install GSD File... (STEP 7 V5.5) or Options > Manage device description files (TIA Portal).
  2. Browse to the directory that contains the GSD and the accompanying bitmap. Click Install. SIMATIC Manager copies the GSD into the project's STEP7\S7DATA\GSD directory.
  3. Close and reopen HWConfig. The slave now appears in the catalog under PROFIBUS DP > Additional Field Devices > <Vendor>.
  4. If the slave is also shipped with a type file (.typ) and a bitmap (.bmp), install them in the same step. Without the bitmap the slave appears in HWConfig as a generic icon and the slot is not visible at runtime.
Version pinning. A GSD revision that is newer than the slave firmware can declare slots the slave does not support. After installing the GSD, the on-line topology view (PG online > accessible nodes) will show the slave in no parameterization state if a slot is missing — fix by removing the offending slot from HWConfig, not by downgrading the GSD.

5. Configuring the 8x Digital I/O Slot

Drag the slave from the catalog to the PROFIBUS line and assign a unique bus address. In the slave's slot table, add modules that match the physical device. For a typical 8-channel digital I/O block the configuration is two 1-byte modules (one input, one output) — the 8 DI / 8 DO interpretation in the GSD declares 1 byte per direction, not 8 bytes.

Slot Module (GSD designation) Direction Length in HWConfig Mapping in CP342-5 process image
0 8 DI (1 byte) Input 1 byte Byte 0
1 8 DO (1 byte) Output 1 byte Byte 0

Compile and download the hardware configuration. The CP342-5 transitions from OFFLINE (DPSTATUS 16#11) to OPERATE (DPSTATUS 16#00) once the parameterization frame is acknowledged. The transition is observable in the PG online topology view and in the CPU diagnostic buffer (event ID W#16#0A21, DP master entered OPERATE).

S7-300 CPU FC1/FC2 CP342-5 DP Master Addr 2 Slave 1 8 DI / 8 DO Slave 2 8 DI / 8 DO PROFIBUS DP segment — terminated at both ends, max 32 nodes per segment

6. DP_SEND / DP_RECV Block Calls

The CP342-5 uses FC 1 (DP_SEND) and FC 2 (DP_RECV) from the SIMATIC NET library. The block interface in STEP 7 V5.5 is:

CALL  "DP_SEND"        // FC 1
   CPLADDR   := W#16#0100   // logical base address from HWConfig
   SEND      := P#DB1.DBX 0.0 BYTE 32
   DONE      := M10.0
   ERROR     := M10.1
   STATUS    := MW12

CALL  "DP_RECV"        // FC 2
   CPLADDR   := W#16#0100
   RECV      := P#DB2.DBX 0.0 BYTE 32
   NDR       := M20.0
   ERROR     := M20.1
   STATUS    := MW22
   DPSTATUS  := MB24

The CPLADDR is the logical base address of the CP module from HWConfig (right-click the CP > Object Properties > Addresses). For a CP342-5 in slot 4 the default is W#16#0100; if the CP is moved, the address follows the slot per the S7-300 fixed address map. The blocks must be called from OB1 (or a higher-priority OB if deterministic latency is required). The DONE / ERROR / STATUS outputs are only valid for one scan; latch them into flags if a fault must be inspected from HMI.

For an 8 DI / 8 DO device the SEND length is 2 (one output byte) and the RECV length is 2 (one input byte). The P#DB2.DBX 0.0 BYTE 32 used in the snippet above is only valid if the master is configured to exchange 32 bytes per direction — confirm the value matches the sum of all slot lengths in HWConfig.

7. Error Code Reference

The two error patterns central to this reference are 8F7FH and DPSTATUS 16#11, but the full set returned by the CP342-5 covers DP parameterization, bus, and application errors. The table below is taken from the SIMATIC NET NCM S7 block help and applies to all CP342-5 firmware versions from V2.0 onward.

RETVAL / STATUS Source Meaning Typical Remedy
16#0000 DP_SEND / DP_RECV Job completed without error
16#8F7F DP_SEND / DP_RECV Internal error — illegal ANY pointer or invalid CPLADDR Fix P# syntax; verify CPLADDR matches HWConfig
16#8090 DP_SEND / DP_RECV CP not in DP mode (operating mode switch mis-set) Set CP to "DP master" in HWConfig
16#80A0 DP_RECV Receive buffer shorter than configured slot Increase RECV length to match configured slot
16#80B0 DP_SEND / DP_RECV DP master not in OPERATE Resolve bus fault, then restart CP
16#80C0 DP_RECV No new data available Informational; not a fault
16#80C1 DP_SEND Output area is being initialized Wait one DP cycle and retry
16#80C2 DP_SEND Output area locked by another job Sequence DP_SEND calls; do not overlap
16#80C3 DP_RECV Resources exhausted Reduce call frequency or batch size

The DPSTATUS byte returned by DP_RECV is a snapshot of the CP's internal DP state machine:

DPSTATUS State Cause Remedy
16#00 OPERATE Bus running, slaves parameterized
16#01 STOP CP in STOP Run switch on CP; restart CPU
16#11 OFFLINE CP not yet in DP mode or configuration mismatch Re-download HWConfig; verify slave address
16#21 CLEAR Master in CLEAR (no slaves reached) Check bus termination, addresses, baud rate
16#31 BAUD SEARCH Master scanning for baud rate Informational during startup
16#80 BUS FAULT Physical bus error (short, termination) Inspect cable, terminators, shielding
16#C0 CONFIG FAULT Slave configured but not present Match HWConfig to physical nodes
16#C1 PARAM FAULT Slave rejected parameterization Verify GSD revision against slave FW
16#C2 CONFIG MISMATCH Configured slot does not match slave Reconcile slot table in HWConfig

8. DPSTATUS Byte Evaluation

When DPSTATUS = 16#11, the CP is in OFFLINE — typically because the master has not yet started parameterization or because a configuration error prevents it. Three things to verify, in order:

  1. CP operating mode. In HWConfig, open the CP342-5 properties and confirm the operating mode is DP master, not No DP or S7 communication. A mis-set mode causes DPSTATUS = 16#11 immediately after download.
  2. CPU-CP link. The CP342-5 is not a "transparent" DP device. It must be linked to the CPU as a partner in the S7 project. If the link is missing, the CP never receives a start command and remains offline. The link is visible in NetPro as a blue line between the CPU and the CP; if it is grey or absent, drag a connection from the CPU to the CP.
  3. Slot length match. The byte count in the ANY pointer must equal the total length of the configured slots. For an 8 DI / 8 DO device (1 byte in + 1 byte out), the receive pointer must be P#DBx.DBX 0.0 BYTE 2 (not BYTE 32 unless more slots are configured). A mismatch causes the CP to report config mismatch and stay offline.
DPSTATUS state machine — CP342-5 OFFLINE 16#11 BAUD SEARCH 16#31 OPERATE 16#00 start param ok bus fault

9. Alternative Integration Modes

The CP342-5 supports three PROFIBUS roles. Choosing the wrong role is a common reason DPSTATUS stays at 16#11 even when the bus hardware is intact.

Role HWConfig Setting Block Interface Use Case
DP master "DP master" with slaves in the line FC 1 / FC 2 (DP_SEND / DP_RECV) CP drives a DP line of I/O devices
DP slave "DP slave" with mapped slots FC 1 / FC 2 (DP_SEND / DP_RECV) CP is a slave of a higher-level master
S7 communication "S7 communication" only (no DP) FB 8 / FB 9 (USEND / URCV) or PUT / GET Direct S7-CPU-to-CPU exchange

If the application only needs S7-CPU-to-CPU exchange, the CP can be set to S7 communication and the DP_SEND / DP_RECV calls are no longer required. The integrated DP interface on the S7-300 CPU remains available for separate slaves. Mixing modes (DP master on the CP and S7 communication on the same CP) is permitted but requires both sets of blocks to be present in OB1.

10. PROFIBUS Cable and Termination

DPSTATUS 16#80 (bus fault) and repeated 8F7FH errors that reappear after every restart are almost always caused by cabling, not by software. The CP342-5 uses a Type A PROFIBUS cable (twisted, shielded, 150 Ω nominal impedance) and requires terminating resistors at both ends of every segment.

Baud Rate Max Segment Length (Type A) Stub Length (max per node) Notes
9.6 kbit/s 1200 m 6.6 m Rarely used
187.5 kbit/s 1000 m 6.6 m Common in process I/O
1.5 Mbit/s 200 m 6.6 m Default for most DP segments
3 Mbit/s 100 m 6.6 m Specialized motion
6 Mbit/s 100 m 6.6 m Specialized motion
12 Mbit/s 100 m 6.6 m Requires 12 Mbit/s-rated slaves
Termination. Each end of a segment must have the bus terminator switch ON. The CP342-5 has a built-in terminator on its SUB-D port, but it is off by default and must be enabled if the CP sits at the end of the segment. A common commissioning error is to enable the terminator on a CP that sits mid-segment — this collapses the signal and the BF LED lights red immediately.

11. Timing and Watchdog

The DP cycle time on a CP342-5 master is set by the DP cycle parameter in HWConfig under CP342-5 Properties > Operating Mode > DP Master. The minimum cycle is 1 ms; the maximum is 65.5 s. The cycle is independent of the OB1 scan time — the CP has its own processor and runs the bus in parallel to the user program.

t Param Req Ack Data exchange T_DP — DP cycle time Req Ack Data exchange T_DP — next cycle Flt Watchdog DP cycle repeats at T_DP; failure to Ack within watchdog period drops DPSTATUS to 16#80

The DP watchdog is configured per slave in HWConfig under Slave Properties > Parameter Assignment. The default is 250 ms for cyclic slaves. If a slave misses a single Ack, the CP342-5 reports a diagnostic interrupt and continues with the next slave; if it misses a full watchdog interval, the CP removes the slave from the cyclic poll and DP_RECV reports 16#C2 (config mismatch) for the affected slot.

12. Diagnostic Buffer Event IDs

Every PROFIBUS transition on the CP342-5 is recorded in the CPU diagnostic buffer. The events below are the ones most useful for isolating a 8F7FH or 16#11 condition.

Event ID (hex) Meaning Trigger Operator Action
W#16#0A21 DP master entered OPERATE First successful parameterization Informational; reference for start-up time
W#16#0A22 DP master left OPERATE Watchdog, bus short, or STOP Look for paired event with 0A21 to find dropped slave
W#16#0A31 DP slave parameterized Slot successfully ack'd Informational
W#16#0A41 DP slave reports diagnostic interrupt Wire-break, over-temp, lost channel Read slave DS0 / DS1 records
W#16#0A81 DP slave not found Address conflict or slave off-line Verify bus address and power
W#16#0A91 DP slave parameter error GSD / firmware mismatch Reconcile GSD version
W#16#0AA1 DP slave config mismatch Slot length or module ID does not match Fix HWConfig slot table
W#16#3942 CP342-5 firmware download completed Firmware update Cycle power on the CP

13. Verification Procedure

Once the HWConfig and the FC 1 / FC 2 calls are corrected, verify the data flow in this sequence:

  1. Download HWConfig and the program blocks. Confirm the CP transitions to RUN (green LED steady, SF and BF off).
  2. Open the variable table and force the eight outputs to a known pattern, e.g. 1010 1010 (binary). With a watch table on the corresponding bits, the slave LEDs should mirror the pattern within one DP cycle (typically 1..10 ms at 1.5 Mbit/s).
  3. Toggle the eight inputs on the slave and verify that the bits appear in the receive DB within one DP cycle. The NDR (new data received) flag on DP_RECV should pulse every cycle.
  4. Read STATUS and DPSTATUS. Both should be 16#0000 and 16#00 respectively when the bus is idle and the slave is responding.
  5. Power-cycle the slave to force a fault. STATUS / DPSTATUS should report 16#80B0 (master not in OPERATE) briefly, then clear automatically when the slave re-joins the bus.
  6. Disconnect the bus terminator. BF should light red within one watchdog interval. Reconnect; BF should clear after the next successful poll.

14. Troubleshooting Matrix

Symptom Most Likely Cause First Check Remedy
RETVAL = 16#8F7F on DP_SEND ANY pointer missing byte count Inspect P# syntax in the FC 1 call Use P#DBn.DBX 0.0 BYTE n
DPSTATUS = 16#11 (OFFLINE) CP not in DP mode or HWConfig mismatch Check CP operating mode in HWConfig Set to "DP master" and re-download
BF LED steady, all slaves off-line Bus cable short or termination missing Measure A-B line, check terminator switches Add or move terminators, replace cable
BF LED flashing 0.5 Hz, single slave off-line Slave address conflict or wrong GSD Compare address with HWConfig Re-assign address; reinstall GSD
RETVAL = 16#80A0 on DP_RECV RECV length shorter than configured slot Sum configured slot lengths Increase P# length
RETVAL = 16#8090, DPSTATUS = 16#01 CP run/stop switch is STOP Inspect CP run switch Move switch to RUN, restart CPU
Inputs always 0, outputs unresponsive CPU-CP link missing in S7 project Right-click CP, Properties, S7 connection Add a connection to the CPU; download
STATUS = 16#80C1 on first call Output area initializing Wait one cycle, call again No action required
RETVAL cycles between 16#0000 and 16#8F7F DP_SEND called from multiple OBs with different pointers Search project for FC 1 calls Consolidate into a single OB
DPSTATUS = 16#C1 (param fault) on a 3rd-party slave GSD revision newer than slave firmware Read slave firmware version Match GSD to firmware; remove unsupported slots
Diagnostic buffer reading. The CPU diagnostic buffer records every transition into and out of DP_OPERATE with event IDs W#16#0A21 / W#16#0A22. If the buffer shows repeated "DP master entered OPERATE" entries interspersed with "DP master left OPERATE", the most common cause is a slave that drops off the bus at random — check connector strain relief and the shield ground connection.

15. Migration to CP343-5 and TIA Portal

For new installations the recommended drop-in replacement is the CP343-5 (6GK7 343-5FA02-0XE0). It uses the same FC 1 / FC 2 block interface, so the application program does not change. For migration to TIA Portal V20 the CP342-5 device proxy is preserved by installing HSP-0131 and re-importing the HWConfig. The diagnostic buffer IDs, status codes, and DP state machine are identical between the two modules; existing troubleshooting procedures apply unchanged.

The CP343-5 differs in three areas:

  • Default logical base address is W#16#0180 (slot 8) instead of W#16#0100 (slot 4).
  • Integrated Web server for diagnostics over Ethernet — accessible at the IP address assigned in HWConfig.
  • Additional S7 communication slots, allowing the same module to drive DP and exchange S7 messages in parallel without an additional CP.

Frequently Asked Questions

Why does DP_SEND return 16#8F7FH even though the bus LED is green?

The 8F7FH code is an internal error inside the FC 1 driver, not a bus error. It indicates the ANY pointer passed to DP_SEND is malformed — typically the byte count is missing. Correct the pointer to P#DB1.DBX 0.0 BYTE 32 (or whatever length matches the configured slots) and the call will return 16#0000.

What does DPSTATUS 16#11 mean on the CP342-5?

DPSTATUS 16#11 is the OFFLINE state. The CP is in DP master mode but is not actively exchanging data — usually because the operating mode is mis-set, the CPU-CP link is missing, or the configured slot lengths do not match the physical slaves. Verify each item in order; the first unfixed item blocks the bus from entering OPERATE.

Can I use SFC 14 / SFC 15 (DPRD_DAT / DPWR_DAT) with the CP342-5?

No. SFC 14 and SFC 15 are reserved for the integrated DP interface on the S7-300 CPU. The CP342-5 has its own processor and exposes data only through FC 1 (DP_SEND) and FC 2 (DP_RECV) from the SIMATIC NET library. Calling SFC 14/15 against the CP342-5 logical address will return 16#80A0 (address error).

How long should the ANY pointer byte count be for a 16-bit DP slave?

For a single 1-byte input and 1-byte output, the receive length is 2 bytes and the send length is 2 bytes. For a slave that uses 4 words in and 4 words out, the length is 8 bytes in each direction. The byte count must be even; an odd count is rejected with 16#8F7FH.

What replacement module should I use for an end-of-life CP342-5?

The CP343-5 (6GK7 343-5FA02-0XE0) is the drop-in successor for new projects. It uses the same FC 1 / FC 2 block interface, so the application program does not need to change. Migration to TIA Portal V20 requires the HSP-0131 hardware support package to keep the CP342-5 visible in the device catalog.

Back to blog