Resolving Siemens S7-400 Event ID 16#3842 on Profibus DP Encoders
When a Siemens SIMATIC S7-400 CPU (e.g. 6ES7416-2DP07) reports a flood of Event ID 16#3842 entries in the diagnostic buffer, each pointing to a single Profibus DP slave such as an absolute encoder, the symptom almost always points to a transient, repeatedly self-clearing module fault on that one slave. The difficulty is that only the outgoing "Module OK" event is recorded — never the incoming "Module Not OK" trigger that produced it. This reference decodes the event ID, instruments OB82 to capture the full diagnostic frame, and applies the physical-layer and EMC mitigations that eliminate the recurring interrupt in field service.
1. Problem Overview
On an S7-400 CPU 416-2DP, the diagnostic buffer is filled with a repeating event of the form:
Event 1 of 120: Event ID 16#3842
Module OK
Module type: Distributed I/O
Input address: 2011
User information available
Diagnostic interrupt from substitute
Requested OB: Diagnostic interrupt OB (OB82)
Priority class: 25
External error, Outgoing event
09:04:24.397 AM 05/01/2008
Key observations from a healthy-but-noisy Profibus DP network of 36 identical third-party absolute encoders:
- All 36 encoders share an identical STEP 7 hardware configuration (HW Config) and identical GSD file.
- Only the slave at diagnostic address 2011 produces the recurring 16#3842 event.
- The event is tagged "Outgoing" — the module is being reported as healthy again, not as having just failed.
- No corresponding "Module Not OK" or "Module Fault" entry for the same address is captured.
- The reported event continues to be appended while the line is in production, not only at startup.
- OB82 is being entered, but no application-side logic captures the OB82 local data, so the underlying cause is invisible to the control program.
The combination of these symptoms rules out a configuration error and strongly indicates a physical-layer or EMC defect that is local to a single Profibus node.
2. Decoding Event ID 16#3842
Siemens S7-400 diagnostic buffer event IDs follow a fixed hexadecimal scheme. For distributed I/O the high nibble 0x3_ identifies diagnostic events and the low two bytes describe the specific sub-event. The most common Profibus-related event IDs and their meanings are:
| Event ID | Meaning | Direction |
|---|---|---|
| 16#3841 | Diagnostic interrupt from substitute — Module Fault (Not OK) | Incoming |
| 16#3842 | Diagnostic interrupt from substitute — Module OK | Outgoing |
| 16#3843 | Diagnostic interrupt from substitute — Module failure (replacement) | Incoming |
| 16#3844 | Diagnostic interrupt from substitute — Module returns / no submodule fault | Outgoing |
| 16#39F0 | Watchdog timeout of a DP slave | Incoming |
| 16#39F1 | Watchdog timeout cleared | Outgoing |
| 16#3941 | Process interrupt lost | Incoming |
Event ID 16#3842 therefore decodes as:
- High nibble 0x38 = the event class is "diagnostic interrupt".
- Low byte 0x42 = the event is the "Module OK / outgoing" half of a diagnostic interrupt pair.
- Substitute = the source is a DP slave, not a central rack module. The CPU received the interrupt via the integrated DP master interface and forwarded it to OB82 with priority class 25.
The fact that 16#3842 is an outgoing diagnostic event means the slave has just transitioned from faulty back to healthy. The matching incoming event (typically 16#3841, 16#39F0, or another module-specific fault code) must have existed — but is not present in the buffer for the reason explained in the next section.
3. S7-400 Diagnostic Buffer Mechanics and Why Only Outgoing Events Appear
The S7-400 maintains a ring buffer of the most recent diagnostic events. The buffer is finite (typically the last 100 entries on a CPU 416 family); older entries are overwritten in FIFO order. Two important behavioral rules apply:
- Every state transition generates both an incoming and an outgoing event, but if the slave is unable to hold the fault state long enough — for example, a one-cycle Profibus glitch — the incoming event may be overwritten by the outgoing event when the buffer is dominated by high-rate events from the same slave.
- Some DP slave firmware versions collapse short-duration faults and emit only the outgoing 16#3842, treating the fault as a transient that the GSD file did not classify.
Combined, this explains why only 16#3842 is visible: the buffer is dominated by the 120+ entries from address 2011, and the brief incoming event is being pushed out of the ring before the engineer can view it. The "Event 1 of 120" header is the strongest indicator — the buffer is full of this single slave's outgoing transitions, and the incoming counterparts have already been rotated out.
SFC13 "DPNRM_DG" inside OB82 to read the standard 6-byte diagnostic frame plus any extended channel diagnostics at the moment the interrupt fires. The S7-1500 diagnostic interrupt OB has a closely related implementation and is documented in the Siemens TIA Portal documentation at Diagnostic interrupt OB (S7-1500) — STEP 7; the S7-400 implementation is functionally analogous.4. Instrumenting OB82 to Capture Interrupt Context
Default OB82 in STEP 7 contains only a temporary placeholder that acknowledges the interrupt and returns. To log the actual fault code, channel information, and slave status, replace OB82 with an instance that reads the OB82 local data and calls SFC13 to dump the slave's diagnostic frame. The local variable layout of OB82 is defined in the STEP 7 Online Help under "OB82 — Diagnostic Interrupt":
| OB82 local byte | Content | Notes |
|---|---|---|
| 0–3 | Event ID (e.g. 16#3842) | Same ID as in the diagnostic buffer |
| 4 | IO_FLAG (0 = incoming, 1 = outgoing) | Confirms direction of the event |
| 5 | Reserved | — |
| 6 | Module fault code (low byte) | From slave's diagnostic frame |
| 7 | Module fault code (high byte) | — |
| 8–11 | DP master system / DP slave logical address | 2011 decoded here |
Sample SCL body to deploy inside the project's OB82 instance (call SFC13 with the slave's diagnostic address to dump its current diagnostic frame):
DATA_BLOCK DB_OB82_Log
STRUCT
cnt : DWORD; // total entries captured
lastEvID : DWORD; // e.g. 16#3842
lastIO : BOOL; // 0 = in, 1 = out
lastAddr : WORD; // DP slave diagnostic address
lastFault : WORD; // fault code from OB82 bytes 6-7
diagData : ARRAY[0..63] OF BYTE; // output of SFC13
END_STRUCT
END_DATA_BLOCK
FUNCTION_BLOCK FB_OB82_Handle
VAR_TEMP
retVal : INT;
END_VAR
BEGIN
// OB82 temp data (declarations must be added in OB82 itself):
// LB0..LB3 = Event ID
// LB4 = IO_FLAG (0=incoming, 1=outgoing)
// LB6..LB7 = Fault code (low/high)
// LB8..LB11 = Address of the slave (logical I/O base address)
DB_OB82_Log.cnt := DB_OB82_Log.cnt + 1;
// Copy event id and flags from OB82 temp area into DB
// (use BLKMOV from the OB82 local temp area to the DB)
// Read full diagnostic frame of the offending slave.
// LADDR is the diagnostic address configured in HW Config
// (here 2011) entered directly as a WORD.
retVal := DPNRM_DG(
LADDR := W#16#7DB, // 2011 decimal
RET_VAL := MW 200,
RECORD := P#DB_OB82_Log.diagData DB 1000 BYTE 64,
BUSY := M 210.0);
END_FUNCTION_BLOCK
After loading this FB and wiring it into OB82, the engineer gets a timestamped record of the exact module fault code that caused each 16#3842 transition. If the OB82 local fault byte is zero on every entry, the slave issued only the "OK" half of the pair — which confirms the firmware-collapsing-transients theory and points the diagnosis toward the physical layer.
5. Profibus DP Physical Layer Inspection
Profibus DP uses RS-485 signalling. The most frequent cause of a single-node repeating interrupt on an otherwise healthy bus is poor signal integrity at the affected node. Inspect the following items in order, with the affected encoder (diagnostic address 2011) as the focus.
5.1 Connectors and Shield Termination
Use only Profibus-certified connectors (e.g. Siemens 6GK1500-0FC10 or equivalent IP20 D-sub, or 6GK1905-0AA00 IP67 M12) with integral terminating resistors that switch in only at the two physical ends of the segment. Verify the braided shield of the Profibus cable is bonded 360° to the connector backshell — pigtail shield terminations are the most common root cause of EMC-driven 16#3842 floods on encoder nodes.
5.2 Cable Specification
Use Profibus DP cable type A (characteristic impedance 135–165 Ω, capacitance < 30 pF/m, loop resistance 110 Ω/km, 0.64 mm² conductor). The maximum stub length per node is 0.3 m. Total bus length for type A cable at each standard baud rate is:
| Baud rate (kbit/s) | Max segment length (m) | Max stub length (m) |
|---|---|---|
| 9.6 | 1,200 | 0.3 |
| 19.2 | 1,200 | 0.3 |
| 45.45 | 1,200 | 0.3 |
| 93.75 | 1,200 | 0.3 |
| 187.5 | 1,000 | 0.3 |
| 500 | 400 | 0.3 |
| 1,500 | 200 | 0.3 |
| 3,000 | 100 | 0.3 |
| 6,000 | 100 | 0.3 |
| 12,000 | 100 | 0.3 |
Every repeater resets the segment length budget. If the offending encoder is at the end of a daisy chain that approaches the segment length limit at the configured baud rate, signal reflections on that node are highly probable and the slave firmware will report a watchdog or parameterization fault.
5.3 Termination and Topology
Each segment must have exactly two terminations (one at each end, ON). Three or more terminations overload the RS-485 drivers and present as intermittent faults that the DP master reports as diagnostic interrupts from the affected slaves. A 36-node network also exceeds the 32-node limit per segment and requires at least one repeater — verify that 2011's segment is properly sized and that termination is enabled only at the two physical endpoints of each segment.
6. EMC Mitigation Strategy
When a single Profibus slave repeatedly self-reports faults in a noisy industrial environment, the most cost-effective diagnostic path is a four-step EMC sweep:
- Measure waveform integrity. Connect a Profibus diagnostic tool (e.g. Softing Profibus Tester BC-700-PB, Indu-Sol PROFINET/Profibus diagnostics, or a Tektronix TDS3000 with Profibus triggering) to the segment containing the affected encoder. Look for amplitude asymmetry, edge ringing, and signal-to-noise ratio. Healthy signal must exceed 2.5 V peak-to-peak with rise time < 0.5 µs at 1.5 Mbit/s.
- Re-verify shield bonding. Strip 30–40 mm of the Profibus cable jacket, lay the braided shield flat on the backshell clamp, and re-tighten the clamp to manufacturer torque. Avoid shield pigtails longer than 25 mm. If a conductive EMC gland is in use, verify it makes full 360° contact with the cable jacket.
- Separate Profibus from power. Maintain at least 200 mm clearance between the Profibus cable and any VFD output cables or 480 V feeders. If crossings are unavoidable, cross at 90°. Do not run the Profibus cable and the encoder 24 V supply in the same bundle as motor power.
- Add a Profibus repeater or diagnostic repeater immediately upstream of the affected node. Diagnostic repeaters (e.g. Indu-Sol DB 9 / DB 9-LWL) isolate the segment and report per-segment statistics. They also act as galvanic isolation barriers that block common-mode noise coupling between the master and the affected slave.
7. Capturing and Decoding the Matching Incoming Event
After instrumenting OB82 as described in Section 4, the OB82 local fault bytes and SFC13 response will reveal the source. Typical decoded values seen in field service of third-party Profibus encoders are:
| Fault byte (OB82 LB7 or extended diag) | Meaning per Profibus DP standard (EN 61158 / IEC 61784) | First corrective action |
|---|---|---|
| 0x01 | Parameter assignment error — slave rejected configuration | Verify GSD version against slave firmware; re-import GSD |
| 0x02 | Configuration error — slot mismatch | Re-check HW Config slot assignment |
| 0x04 | Hardware fault (encoder internal) | Replace encoder |
| 0x08 | Watchdog timeout of the slave Profibus ASIC | Signal integrity — check shield, termination, cable length |
| 0x10 | Sensor/encoder supply overcurrent | Measure 24 V supply; add decoupling |
| 0x20 | Sensor/encoder cable broken | Inspect encoder cable run; test encoder |
| 0x40 | Slave is not ready for data transfer | Check 24 V and Profibus connector |
If the SFC13 result on a single instance shows 0x08 (watchdog) appearing repeatedly on address 2011 and nowhere else, the slave's Profibus ASIC is timing out — almost always signal integrity. If 0x20 (cable break) appears, the encoder itself is faulty or its internal sensor cable has been damaged. If 0x10 (overcurrent) appears, the 24 V supply is sagging or the encoder is drawing excessive inrush on power-up.
8. Verification and Long-Term Monitoring
After applying the corrective actions, perform the following verification sequence:
- Clear the diagnostic buffer in STEP 7 via "PLC > Clear/Reset Diagnostic Buffer".
- Run the line under normal load for a minimum of 8 hours (or one full production shift).
- Re-open the diagnostic buffer. The 16#3842 entries for address 2011 must be absent. A handful of other entries (e.g. startup events at cold start) is acceptable; a continuing flood is not.
- Check the OB82 instance DB counter — it should remain at zero during the test period.
- Pull the Profibus connector of the affected encoder to deliberately trigger a 16#3841/16#3842 pair. Confirm the new code now captures both incoming and outgoing events with non-zero fault bytes, proving OB82 is functioning correctly.
- Reconnect the encoder and confirm the bus recovers without residual entries.
For long-term health, deploy a Profibus diagnostic repeater with segment statistics (e.g. Indu-Sol DB 9) and record signal quality, bus errors, and retries in the SCADA. A rising bus-error count on a single segment is the early warning that another 16#3842 storm is forming — and gives maintenance a chance to act before the diagnostic buffer fills again.
9. Common Field-Confirmed Causes of Recurring 16#3842 on a Single Node
| Symptom pattern | Most likely cause | First corrective action |
|---|---|---|
| One slave, all times of day, no external triggers | Connector / shield defect at that node | Re-terminate shield 360°, re-torque D-sub screws |
| One slave, intermittent with VFD starts | EMC coupling from VFD output cable | Increase cable separation, add ferrite on Profibus cable |
| One slave, coincides with motor contactor closes | 24 V supply sag | Measure encoder supply under load, add decoupling diode |
| All slaves briefly at cold start | Default 65 s startup window not yet expired | Expected behaviour — no action needed |
| Slave replaced, new one now fails | Shield drain wire of new cable pigtailed | Re-terminate to 360° backshell |
| One slave at the physical end of the segment | Termination or stub length issue | Verify terminator ON at that node, shorten stub < 0.3 m |
| Multiple slaves, 16#3842 + 16#39F0 mixed | Excessive bus length or missing repeater | Add repeater; reduce baud rate to 500 kbit/s |
| Only one slave out of 36, fault byte 0x20 | Damaged encoder internal cable | Replace encoder |
10. FAQ
What does Event ID 16#3842 actually mean on an S7-400 CPU 416-2DP?
It is the "Module OK" half of a diagnostic interrupt from a Profibus DP slave. The high nibble 0x38 identifies the event class as diagnostic interrupt; the low byte 0x42 identifies the transition as the outgoing (returning to OK) side. The matching incoming event 16#3841 or 16#39F0 (watchdog) was overwritten from the diagnostic ring buffer because of the high event rate from that single slave.
Why do I only see the "Module OK" entry and never the "Module Not OK" entry?
The S7-400 diagnostic buffer is a finite ring (typically 100 entries on a CPU 416). When one slave floods the buffer with 100+ entries, the brief incoming event is overwritten by the next outgoing event before the engineer can view it. Some encoder firmware also collapses short transient faults and only emits the outgoing 16#3842. Deploying OB82 with SFC13 (DPNRM_DG) is the only way to capture the incoming side reliably.
Do I need to add code in OB82 to find the cause of 16#3842?
Yes. The default OB82 only acknowledges the interrupt and returns. You need to read the OB82 local data (event ID at LB0..LB3, IO_FLAG at LB4, fault bytes at LB6..LB7, DP slave address at LB8..LB11) and call SFC13 "DPNRM_DG" with the affected slave's diagnostic address (2011 in this example) to read the slave's current diagnostic frame. The returned fault byte tells you whether the root cause is a watchdog timeout, sensor cable break, hardware fault, or supply overcurrent.
How do I specify the LADDR input of SFC13 in STEP 7?
For SFC13 DPNRM_DG, the LADDR input takes the diagnostic address of the DP slave as a WORD — the address configured in HW Config is used directly. For a diagnostic address of 2011, use W#16#7DB (the hexadecimal representation of 2011 decimal). When called from a symbolic FBD/ST block, you can also use the symbolic name assigned to the slave's diagnostic address in HW Config.
Could the cause be EMC rather than configuration when 36 identical encoders are configured identically?
Yes — that is the most common outcome. If software configuration were the root cause, all 36 encoders would fault. A single-node repeating 16#3842 is almost always physical-layer: a connector, shield, termination, supply sag, or EMC coupling specific to that one node. The fastest diagnosis is a Profibus signal-quality measurement at the affected encoder and at the upstream repeater, plus an in-circuit check of the 24 V supply at the encoder terminals under load.
How many Profibus nodes can a single S7-400 DP master segment support?
A single RS-485 Profibus segment supports up to 32 nodes (master + slaves). The reported 36-encoder installation therefore requires at least one repeater to split the bus into two segments of 32 nodes or fewer. Address 2011's segment must be identified and the repeater's segmentation verified as part of the same diagnostic sweep.