CP524 to CP340 Communication: S5-115 to S7-300 Gateway Setup
Integrating a legacy Siemens S5-115U PLC (with CP524 serial module) into a modern S7-300 (with CP340 serial module) requires bridging three generations of Siemens automation technology. The CP524 only supports point-to-point serial protocols (3964R, 3964, RK512, ASCII), while the S7-300 side has both legacy CP340/CP341 serial and modern CP343-1 Ethernet options. This reference documents the deterministic 3964R/RK512 path, the configuration of both CPs, the STEP 7 function block call surface, and the field-proven alternatives when the 3964R route is impractical.
1. Hardware Identification & Compatibility Matrix
| Component | Siemens MLFB / Part Number | Interface(s) | Role |
|---|---|---|---|
| S5-115U CPU 941B | 6ES5 941-7UB11 | TTY 20 mA (programming) | S5 controller with PG port |
| S5-115U CPU 943B | 6ES5 943-7UB11 | TTY 20 mA (programming) | S5 controller with PG port |
| S5-115U CPU 944B | 6ES5 944-7UB11 | TTY 20 mA (programming) | S5 controller with PG port |
| S5-115U CPU 945 | 6ES5 945-7UA11 | TTY 20 mA (programming) | High-end S5 controller |
| CP524 comm. processor | 6ES5 524-3UA15 (RS232 + TTY) | 1x RS232C (V.24), 1x TTY 20 mA | S5-115U serial front-end |
| CP340 RS232 | 6ES7 340-1AH02-0AE0 | 1x RS232C (V.24), 15-pin D-sub | S7-300 serial front-end |
| CP340 RS422/485 | 6ES7 340-1BH02-0AE0 | 1x RS422/RS485, 15-pin D-sub | S7-300 serial front-end (RS485 multi-drop) |
| CP340 TTY | 6ES7 340-1CH02-0AE0 | 1x TTY 20 mA | S7-300 serial front-end (legacy S5 link) |
| CP343-1 Lean | 6GK7 343-1CX10-0XE0 | RJ45 10/100 Mbit | S7-300 Ethernet (alternative path) |
| CP341 RS232 | 6ES7 341-1AH02-0AE0 | 1x RS232C, 15-pin D-sub | S7-300 serial with loadable drivers, RK512/3964R/ASCII |
The CP340 family is firmware-loadable for ASCII only; the 3964R and RK512 protocols are embedded in the module firmware. The CP341 supports loadable drivers, which is preferred for long-term 3964R work because Siemens has issued driver updates addressing initial CP340 3964R timing edge cases. For new installations that must keep the S5 in the loop, prefer CP341 over CP340.
2. Protocol Selection: 3964R vs. RK512 vs. AS511
| Layer / Property | AS511 | 3964R | RK512 (on 3964R) |
|---|---|---|---|
| OSI layer | Application | Datalink | Application (sits on 3964R) |
| Physical layer | TTY 20 mA current loop | RS232C (V.24) or TTY | RS232C (V.24) or TTY |
| Default baud | 9 600 bit/s | 9 600 bit/s (300 - 19 200 supported) | 9 600 bit/s (300 - 19 200 supported) |
| Frame integrity | BCC, command/response | BCC on raw data + DLE/NAK handshake | BCC on header + data, double-BCC |
| Max payload per block | 256 bytes | 1 024 bytes | 128 bytes per data record (256 bytes total per block including header) |
| Coordination flag handling | None (driver-level) | None | Optional coordination byte set/reset at partner |
| Supported commands | READ_DB, WRITE_DB, STATUS, STOP, START, ... | None defined (raw framed text) | SEND, FETCH, READ, WRITE, READ_WRITE, WRITE_READ |
| Hardware used on S5 | CPU programming port | CP524 (or AG 90/95/97) | CP524 (with COM PP RK512 profile) |
| Hardware used on S7 | CP340 TTY + custom FB or third-party driver | CP340 RS232 + FB2/FB3 or P_SND_300/P_RCV_300 | CP340 RS232 + FB7/FB8 (P_SND_RK, P_RCV_RK) |
| Typical use case | Programming, online, low-volume data | Free-formatted text with checksum | Structured data block access (DB read/write) |
For the question of reading and writing Data Blocks on the S5 from a S7-300, RK512 sitting on top of 3964R is the correct layered choice. 3964R alone gives you framed but untyped text. RK512 adds the typed commands (SEND, FETCH, READ, WRITE) and the address structure (DB number + DW offset + length) that map directly onto S5 data blocks.
3. CP524 Interface & RS232 Pinout
The CP524 provides two physical ports:
- COM1 (X1): RS232C (V.24), 25-pin male D-sub, used for the RK512/3964R link to the S7-300 CP340.
- COM2 (X2): TTY 20 mA current loop, 25-pin female D-sub, typically retained for the legacy InTouch or Movicon SCADA link.
RS232C pinout on the CP524 (X1, 25-pin D-sub, male):
| Pin | Signal | Direction (DTE view) | Description |
|---|---|---|---|
| 2 | TXD | Output | Transmitted data |
| 3 | RXD | Input | Received data |
| 4 | RTS | Output | Request to send |
| 5 | CTS | Input | Clear to send |
| 6 | DSR | Input | Data set ready |
| 7 | SGND | — | Signal ground |
| 8 | DCD | Input | Carrier detect (not used in 3964R, may be tied to DTR) |
| 20 | DTR | Output | Data terminal ready |
| 22 | RI | Input | Ring indicator (not used) |
For a CP524-to-CP340 null-modem cable, cross TXD/RXD, RTS/CTS, and DTR/DSR, and connect signal grounds. Pin 4 (RTS) on the CP524 must be looped back to pin 5 (CTS) on the same connector or crossed with the partner's CTS, depending on handshake mode (XON/XOFF is preferred for 3964R; with RTS/CTS selected in the COM PP image, the cable must cross the handshake lines). The CP524 supports four handshakes: none, XON/XOFF, RTS/CTS, RTS/CTS+XON/XOFF.
CP524 protocol configuration parameters (COM PP / COM 525 image):
| Parameter | Typical value for S7 CP340 | Range / notes |
|---|---|---|
| Baud rate | 9 600 bit/s | 300 / 600 / 1 200 / 2 400 / 4 800 / 9 600 / 19 200 |
| Data bits | 8 | 7 or 8 (RK512 mandates 8) |
| Parity | Even | None / Even / Odd (RK512 mandates Even) |
| Stop bits | 1 | 1 or 2 |
| Protocol | RK512 (3964R driver underneath) | 3964 / 3964R / RK512 / ASCII |
| Handshake | RTS/CTS | None / XON-XOFF / RTS-CTS |
| ZVZ (character delay) | 220 ms | 20 ms – 65 535 ms (3964R timer) |
| QVZ (acknowledge timeout) | 2 000 ms | 20 ms – 65 535 ms (increase for radio / long cable) |
| BW (block waiting time) | 5 000 ms | 1 s – 65 535 s |
| Max frame length | 1 024 bytes | Hard cap of CP524 EPROM image |
| Coordination byte (S5 side) | EB 0 / AB 0 | Any input/output byte; 1 byte coordination per direction |
4. 3964R Protocol Deep Dive
3964R is a Siemens point-to-point protocol that wraps an arbitrary byte stream between two RS232 endpoints. The frame format is:
[STX] [DLE][STX] <DATA, 0..1024 bytes, with embedded DLE doubled> [DLE][ETX] [BCC]
Control characters:
| Mnemonic | Hex | Function |
|---|---|---|
| STX | 02h | Start of text |
| ETX | 03h | End of text |
| DLE | 10h | Data link escape (used as positive ack, doubles within data) |
| NAK | 15h | Negative acknowledge |
Sender transmits STX. Receiver responds with DLE to grant the bus within the ZVZ (character delay) window. Sender then transmits the data block, escaping any embedded DLE as DLE DLE. After the final ETX and a one-character BCC (XOR of all data bytes after the start-DLE and before the end-DLE), the receiver responds with DLE (good) or NAK (bad) within the QVZ window. The CP524 automatically computes and validates the BCC; the S7 CP340 does the same when 3964R is selected in HW Config.
Three 3964R timer values control interoperability:
- ZVZ (ZeichenVerzugsZeit, character delay time): max gap between two consecutive characters inside a block. Default 220 ms. If exceeded, the receiver aborts and emits NAK.
-
QVZ (QuittungsVerzugsZeit, acknowledge delay time): max time the sender waits for
DLEafterSTX. Default 2 000 ms in CP524, 550 ms default in CP340. The two values must be made equal, with the longer one as the common denominator, or the partner with the shorter timer will time out before the partner with the longer one can answer. - BW (BlockWaitingTime): max time the receiver waits for the first character of a new block after granting the bus. Default 5 000 ms.
5. RK512 Application Layer
RK512 (released by Siemens in 1981) is the application layer that runs on top of 3964R. The CP524 on S5 and the CP340 on S7 both implement the RK512 command set:
| Command | Cmd byte (hex) | Function | Coordination flag toggled |
|---|---|---|---|
| SEND | AAh | Send a data block to partner (no echo back) | Yes (coord byte cleared by partner) |
| FETCH | A1h | Ask partner to send you a data block | Yes (coord byte set by partner) |
| READ | A2h | Read data block from partner (no coordination) | No |
| WRITE | A3h | Write data block to partner (no coordination) | No |
| READ_WRITE | A5h | Read partner block, then write your own | No |
| WRITE_READ | A4h | Write your block, then read partner's | No |
For SCADA tag polling the READ (A2h) and WRITE (A3h) commands are typically used; they are stateless, so a single failed transaction does not desynchronize a coordination byte. The FETCH command is the classic method the InTouch/Movicon SCADA used against the CP524: the SCADA sent FETCH, the CP524 placed the requested DB words in the response buffer.
RK512 request frame layout (sender to partner):
[3964R frame payload]
Byte 0 : 0x00 (start byte, reserved)
Byte 1 : Command (0xA2 READ, 0xA3 WRITE, 0xA1 FETCH, 0xAA SEND)
Byte 2 : 0x00 (subcommand, reserved)
Byte 3 : 0x00 (status field, 0 in request)
Byte 4 : 0x00 (length high)
Byte 5 : N (data length low, max 128 data bytes per record)
Byte 6 : DB (target S5 data block number, 0..255)
Byte 7 : 0x00 (DX flag 0 / DX number high)
Byte 8 : DBN (data block number low or DX number low)
Byte 9 : DW (start data word offset in DB, 0..2047)
Byte 10 : AM (amount of data words, 0..64)
Bytes 11..(11+2*N) : data (WRITE/SEND only)
Each RK512 data record carries at most 128 data bytes (64 data words) in the original specification; multiple records can be chained in one 3964R frame, but the CP524 in older firmware (V1.x) limits a frame to 1 record. The CP340 with RK512 driver accepts the same limit. When sizing data exchanges, plan for one 64-word block per call.
6. CP524 Configuration in COM PP / COM 525
Configuration steps (Windows XP/Win7 32-bit with COM PP V5.x):
- Connect the Siemens PG (or PC with COM PP) to the S5-115U programming port (TTY on the CPU front X2).
- Open COM PP, select CP524 in the Module dropdown.
- Set Slot to the physical CP524 slot in the S5 rack (typically 0..3 in the central rack CR).
- Configure the protocol image (RK512 profile):
Module : CP524
Slot : 0
COM1 protocol: RK512 3964R
COM1 baud : 9600
COM1 parity : EVEN
COM1 data bits: 8
COM1 stop : 1
COM1 handshake: RTS/CTS
ZVZ : 220 ms
QVZ : 4000 ms (must match CP340)
BW : 5000 ms
Coordination byte S5->S7 : EB0 (bit 0 = handshake flag)
Coordination byte S7->S5 : AB0 (bit 0 = handshake flag)
DB range : DB1..DB255 (configurable mask; restrict to your SCADA DBs)
- Save the image to an empty 27C256 EPROM with the PG prommer. The .S5 file is typically named
CP524.ROM. - Power down the S5 rack, pull the CP524, insert the EPROM in socket X3 (top of module), re-insert the CP524.
- Power up. The CP524 SF (red) and BF (yellow) LEDs should be off within 5 s of power-up; if the SF LED stays on, the EPROM checksum is wrong or the CP524 firmware is older than V3.0 and rejects the image.
7. CP340 Configuration in STEP 7 (HW Config)
In STEP 7 V5.5 / V5.6 the CP340 is configured in HW Config (or TIA Portal for newer projects):
- Insert CP340 (6ES7 340-1AH02-0AE0) at the next free slot in the S7-300 rack. The CP340 occupies 1 slot.
- Open the CP340 Properties dialog, Protocol tab.
- Set Protocol = 3964R for raw 3964R use, or RK512 if STEP 7 exposes it (in some HW Config versions, RK512 is a checkbox on top of 3964R).
- Set baud, parity, data bits, stop bits to match the CP524 exactly (9 600 / 8 / Even / 1).
- On the Interface tab, set Handshake = RTS/CTS (matches the CP524 cable).
- On the Parameters tab:
ZVZ (character delay) : 220 ms
QVZ (acknowledge timeout) : 4000 ms (matches CP524)
BW (block waiting time) : 5000 ms
Max frame length : 1024 bytes
Initial DLE / STX behavior : Send STX on send trigger
Retries on NAK : 3
Retries on no response : 3
Inter-character gap inside frame: disabled (driver handles)
- Compile and download the hardware configuration. After CPU restart, the CP340 will be in passive mode waiting for a request or for a CP/FB trigger.
8. STEP 7 Program: Sending and Receiving with FB2 / FB3
The CP340 library is shipped with STEP 7. The relevant blocks for 3964R/RK512 are:
| Block | Function | Direction |
|---|---|---|
| FB2 P_SND_300 / P_SND_RK | Send a 3964R frame or RK512 command | S7 -> partner |
| FB3 P_RCV_300 / P_RCV_RK | Receive a 3964R frame or RK512 response | partner -> S7 |
| FB7 P_SND_RK | Send RK512 command (alias on newer libs) | S7 -> partner |
| FB8 P_RCV_RK | Receive RK512 response (alias on newer libs) | partner -> S7 |
Instance DB and call example (STL):
// Data block of S5 to be read: DB 20 starting DW 0, length 32 words (= 64 bytes)
// Result buffer: DB100 in the S7-300, 32 words from offset 0
CALL FB7 , DB107 // P_SND_RK
REQ :=TRUE // start new request
R :=FALSE
LADDR :=256 // logical I/O base address of the CP340 (from HW Config)
R_TYP :=B#16#02 // RK512 type: 02 = READ (no coord)
DB :=20 // S5 data block number 20
DBNO :=0 // reserved, 0 for S5
DWNO :=0 // start data word offset in S5 DB20
ANZW :=32 // amount in data words (1..64)
QTY :=64 // amount in bytes (2 * ANZW)
DATA :=P#DB100.DBX0.0 BYTE 64 // ANY pointer to S7 buffer
LEN :=64
DONE :=M100.0
ERROR :=M100.1
STATUS :=MW102
CALL FB8 , DB108 // P_RCV_RK
EN_R :=TRUE
R :=FALSE
LADDR :=256
DATA :=P#DB101.DBX0.0 BYTE 64
LEN :=64
NDR :=M110.0
ERROR :=M110.1
STATUS :=MW112
Polling sequence: REQ rising-edge triggers an RK512 READ on the CP340. The CP340 sends the 3964R-framed RK512 READ command to the CP524, the CP524 returns the 64 bytes of DB20 from DW0..DW31, the CP340 returns them in DATA and sets NDR. On ERROR, evaluate STATUS against the CP340 status table.
8.1 CP340 status codes (subset)
| STATUS (hex) | Meaning | Typical cause |
|---|---|---|
| 0000h | OK | Successful transmit / receive |
| 0301h | QVZ timeout on STX | CP524 not asserting DLE within QVZ window |
| 0302h | BCC error on receive | Electrical noise; check shield, baud mismatch |
| 0308h | QVZ timeout on data block | Inter-character gap exceeded ZVZ |
| 0309h | ZVZ timeout inside frame | Data overrun in CP340 receiver; reduce baud or shorten block |
| 0808h | QVZ timeout waiting for partner | CP524 EPROM image mismatched, wrong protocol |
| 0E01h | Parameter LADDR wrong | CP340 base address incorrect in HW Config |
| 0F01h | No serial module at LADDR | CP340 not seated or not powered |
| 7000h | No job active (FB idle) | Expected on first scan |
9. S5-115 Side: Programmatic Read/Write of Data Blocks via CP524
The S5-115U does not need application code to handle the 3964R/RK512 frame: the CP524 firmware decodes the RK512 command and accesses the data blocks on its own. The S5 CPU only needs to expose the relevant data blocks (DB) and reserve input/output bytes for the optional coordination flags.
STEP 5 / S5-DOS program snippet (data exchange DB):
FB 100 // Custom FB: handle CP524 SF LED / coordinator polling
NAME : CP524_HANDLER
:U E 0.0 // CP524 ready signal (front panel "READY" contact)
:=A 0.0 // Mirror to output for SCADA visibility
:U M 100.0 // S7-300 command to read DB20 complete flag
:S A 0.1 // Pulse to CP524 coord byte
DB 20 // Application data exposed to S7
0: KF +0 ; Spare
2: KH 0000 ; Status word 1 (e.g., motor 1 running)
4: KH 0000 ; Status word 2 (motor 2 running)
6: KF +0 ; Counter 1
8: KF +0 ; Counter 2
10: KC 'S5 TO S7' ; Tag string (8 bytes)
20: KF +0
30: KF +0
For the CP524 to access DB20 on behalf of the S7, the DB must be open in the S5 program (at least one A or JU reference). The CP524 does not need to be referenced by the CPU; it owns the bus arbitration to the backplane. The S5-115 CPU only sees the CP524 as an I/O module occupying 32 input bytes and 32 output bytes (slot-decoded). The coordination flags live in the first byte of those I/O areas.
EB0 and AB0 by default; if you wire different bytes in COM PP, document them on the rack label. A stuck coordination byte will block all subsequent FETCH transactions until the partner clears it manually or the CP524 is rebooted.10. Alternative Path 1: AS511 over the S5 Programming Port
If the customer cannot or will not change the CP524 EPROM, the AS511 path is feasible. AS511 runs on the S5-115U's front-panel TTY 20 mA programming port, not on the CP524. A TTY-to-RS232 converter (e.g. Siko, P&S TTY-232 or a generic Stobra 9-pin converter) is wired to the CP340 TTY variant (6ES7 340-1CH02-0AE0).
AS511 frame format (simplified):
[0x00] [0x01] [0x49] [CMD] [DB# hi] [DB# lo] [DW# hi] [DW# lo] [LEN] [data...] [BCC]
CMD byte 0x49 = READ, 0x48 = WRITE, 0x12 = STATUS, 0x16 = STOP, 0x18 = START. Max 32 words (64 bytes) per request. Baud is fixed at 9 600 bit/s, even parity, 8 data bits, 1 stop bit. AS511 is not documented in any open Siemens manual; it is reverse-engineered and supported only by third-party drivers (e.g., LibNoDave for S5 supports AS511). On the S7-300 side, the CP340 TTY variant must be loaded with a generic ASCII driver (no 3964R) and a custom FB/FC must encode/decode the AS511 frame because Siemens does not ship an AS511 driver for the CP340.
11. Alternative Path 2: S7-300 as a Communication Gateway
Use case: a Movicon or WinCC SCADA needs to poll data from the S5-115, and the SCADA has no native AS511/3964R/RK512 driver. The S7-300 with CP340 acts as a protocol converter between RK512 on the S5 side and PROFINET/S7 on the SCADA side.
Configuration of the S7-300 as gateway:
- The S7-300 CPU 315-2 PN/DP (or CPU 314 + CP343-1) runs an OB1 cycle that calls
FB7 P_SND_RKandFB8 P_RCV_RKin a 100 ms OB35 cyclic interrupt. The S5 DBs are mirrored intoDB100on the S7-300. - The S7-300 exposes
DB100to the SCADA over S7 Comm (PUT/GET) or, with a CP343-1 Lean, over PROFINET to a WinCC RT / Movicon RT that has the Siemens S7 Comm driver. - SCADA polling rate can be 50–500 ms depending on the S5-115 CPU scan time. Do not poll faster than 50 ms: the RK512 transaction round-trip on a CP524 is 30–80 ms at 9 600 bit/s with a 64-byte block.
12. Alternative Path 3: Ethernet Gateways
When the customer is willing to invest in new hardware, two industrial Ethernet gateway families solve the problem without any RK512 work.
12.1 IBH Softec IBH Link S5 (AS511 to Ethernet)
The IBH Link S5 is a DIN-rail module that connects to the S5-115 programming port (TTY 20 mA) and exposes the S5 data blocks as Ethernet/TCP using IBH's S5Comm protocol. The companion IBH Link S7-300/PN connects to the S7-300 MPI/PROFINET port and bridges to the IBH Link S5 over Ethernet, presenting each S5 data block as a transparent S7 DB on the S7-300 side. Pros: no EPROM burning, no 3964R timing risk, RS232 cable distance replaced with 100 m Ethernet. Cons: new hardware cost, two IBH boxes.
12.2 Digi One SP IA (Serial Tunneling)
The Digi One SP IA industrial device server connects an RS232 or TTY device to Ethernet, presenting it as a virtual COM port or raw TCP socket. Digi's serial-tunnel application guide explains how to pair two Digi One SP units to extend a serial cable over Ethernet, which solves the physical distance problem (server room to PLC) without changing the protocol. The customer's Movicon SCADA sees a virtual COM port that is the S5-115's programming port, unchanged. This is the right answer when the SCADA has a working AS511 driver and the customer only needs to extend the cable distance.
13. Wiring & Cable Fabrication
For the 3964R/RK512 path the cable is a null-modem RS232 cable between CP524 COM1 (25-pin male) and CP340 (15-pin male). The CP340 is supplied with a 6ES7 340-1AH02-0AE0 wiring label that documents the 15-pin pinout.
| CP524 (25-pin D-sub male) signal | CP524 pin | —> | CP340 (15-pin D-sub male) pin | CP340 signal |
|---|---|---|---|---|
| TXD (out) | 2 | —> | 6 | RXD (in) |
| RXD (in) | 3 | —> | 5 | TXD (out) |
| RTS (out) | 4 | —> | 11 | CTS (in) |
| CTS (in) | 5 | —> | 10 | RTS (out) |
| DTR (out) | 20 | —> | 4 | DSR (in) |
| DSR (in) | 6 | —> | 8 | DTR (out) |
| SGND | 7 | —> | 1 + 9 | SGND (chassis) |
| DCD (in) | 8 | —> | 2 | DCD (out) |
| RI (in) | 22 | leave open | 9 | +5V pull-up (do not connect) |
Use shielded cable, shield connected to chassis ground (Pin 1 of the CP340) at one end only (CP340 end). Maximum cable length at 9 600 bit/s is 15 m per EIA-232; for longer runs drop to 4 800 bit/s and use a serial extender or switch to the IBH Softec Ethernet gateway.
14. Commissioning Procedure
- Bench test the cable. Use a break-out box or oscilloscope on TXD/RXD. Short TXD to RXD at one end; echo test verifies the physical layer.
- Verify CP524 EPROM. With the S5 in STOP, the CP524 SF LED must be off. If SF is on, EPROM is bad or the slot is wrong.
- Verify CP340 in HW Config. From STEP 7 online, right-click the CP340, select Module Information. The Diagnostic tab must show No fault; Operating mode = RUN; Interface = RS232; baud = 9600.
-
Loopback test from S7-300. Insert a wire from CP340 TXD (pin 5) to CP340 RXD (pin 6) at the CP340 connector. Call
FB2 P_SND_300with 16 bytes of known data. The matchingFB3 P_RCV_300call must return the same 16 bytes. This validates the CP340 in isolation before the CP524 is even involved. - Remove the loopback, plug in the CP524 cable. Power the S5 rack.
-
Online RK512 test from STEP 7. Use the RK512 test tool (in the CP340 library examples directory, file
RK512_TST.EXE) or write a short FC that callsFB7 P_SND_RKto read DB20 DW0..DW31. Expected response:STATUS = 0000h,DONE = TRUE,DB100populated with 64 bytes of S5 data. -
Document the timing. Time the round trip from
REQ = TRUEtoNDR = TRUEin the OB1 cycle counter. Expect 30–80 ms at 9 600 bit/s with a 64-byte block. If > 200 ms, suspect QVZ mismatch or electrical noise. -
Hand off to SCADA only after the loopback test, the bench test, and the on-line RK512 test all pass with
STATUS = 0000hfor 1 hour continuous polling.
15. Verification Matrix
| Check | Tool / Method | Pass criterion | Fail -> Next action |
|---|---|---|---|
| Cable TXD/RXD crossed | Multimeter continuity | 2-3, 3-2 closed | Rewire |
| Cable shield grounded at one end | Multimeter to chassis | < 1 ohm at CP340 end, > 1 Mohm at CP524 end | Move shield bond |
| CP524 SF LED off | Visual at power-up | Off within 5 s | Reburn EPROM |
| CP340 in RUN | STEP 7 online diag | Mode = RUN, no diagnostic interrupt | Re-seat module, re-download HW Config |
| CP340 loopback | FB2 / FB3 self-echo | 16 bytes echoed | Check LADDR base address |
| RK512 STATUS | FB7 DONE / STATUS | DONE = 1, STATUS = 0000h | Check 0008h = QVZ; 0301h/0302h = electrical; 0F01h = LADDR |
| S5 DB content | PG online on S5 | DB20 DW0..DW31 visible | Verify DB is open in S5 program (A or JU reference) |
| Round-trip time | Cycle counter in OB1 | 30–80 ms | > 200 ms = QVZ mismatch |
| 24 h soak | Continuous polling | 0 errors, 0 NAKs in 24 h | Increase QVZ, lower baud, check ground loops |
16. Troubleshooting Matrix
| Symptom | LED / STATUS | Root cause | Fix |
|---|---|---|---|
| No communication, CP340 SF red | SF on CP340 | Wrong protocol in HW Config (ASCII vs. 3964R) | Set Protocol = 3964R in HW Config and re-download |
| STATUS 0301h, 0808h, intermittent | QVZ timeout | CP524 QVZ (2000) > CP340 QVZ (550) | Set both to 4000 ms; redeploy EPROM |
| STATUS 0302h, every few transactions | BCC error | Baud mismatch or electrical noise | Verify both sides at 9600 8E1; check shield |
| STATUS 0308h on first poll, then OK | ZVZ on first character | CP340 starts sending before CP524 ready | Add 100 ms startup delay after CP524 power-up |
| STATUS 0E01h or 0F01h | Parameter error | Wrong LADDR in FB7/FB8 | Match LADDR to CP340 base address in HW Config |
| Communication OK in STOP, fails in RUN | S5 scan time > QVZ | Long OB1 cycle blocks CP524 from responding | Increase QVZ to 8000 ms; or restructure S5 program |
| FETCH command works, WRITE fails | RK512 coord byte stuck | Coordination byte mismatch | Reset EB0/AB0 on both sides, switch to READ/WRITE (no coord) |
| OK for 1 hour, then NAK flood | Buffer overrun in CP524 | CP524 EPROM image limits max frame | Reduce data length to 32 words per call |
| OK in bench test, fails in plant | Ground loop | Shield grounded at both ends | Remove shield bond at CP524 end |
| CP524 SF on power-up, even with valid EPROM | EPROM socket | Oxidized pins, cold joint | Reseat EPROM, clean with IPA, check socket |
17. Long-Term Migration Considerations
The S5-115U and CP524 were declared discontinued by Siemens in 2007 and have been out of active support since 2014. Spare-part availability is now limited to the second-hand market. When designing a new SCADA integration, plan a 3–5 year migration to a S7-1500 + ET200SP architecture, with the S7-300 (or an IBH Link S5) as a bridging gateway that can be decommissioned when the S5 is finally retired. The 3964R/RK512 link described in this document is an integration band-aid, not a long-term architecture.
For new SCADA projects that must connect to a S5-115, the recommended hierarchy is:
- First choice: IBH Link S5 + IBH Link S7-300/PN. PROFINET, no EPROM work, IBH support contract available.
- Second choice: CP524 + CP340 with 3964R/RK512 (this document). Free if hardware is in stock, but no Siemens support, fragile to electrical noise.
- Third choice: Two Digi One SP IA units as serial-tunnel. Solves distance only; does not solve the protocol problem.
- Last resort: Custom AS511 driver on CP340 TTY variant. Brittle, undocumented, not Siemens-supported.
Can a CP340 communicate directly with a CP524 over 3964R without an Ethernet gateway?
Yes. Set the CP524 to RK512/3964R on COM1 (RS232), set the CP340 to 3964R in STEP 7 HW Config, match baud 9 600 / 8 / Even / 1 and QVZ (4 000 ms on both), wire a null-modem cable. The S5 data blocks are accessible from S7-300 with FB7/FB8 P_SND_RK / P_RCV_RK. The CP340 does not need an Ethernet module in this configuration.
What is the difference between 3964 and 3964R?
3964R adds the BCC (block check character, XOR) on the data payload and the DLE/NAK positive/negative acknowledgment handshake. 3964 (without R) has no BCC and uses different idle-line rules. For CP524 <-> CP340 integration, use 3964R exclusively. 3964 is legacy and not supported by CP340.
Why does the CP524 need an EPROM and the CP340 does not?
The CP524 is an S5-115U era module without firmware flash. Its protocol, baud, and coordination byte map are burned into a 27C256 EPROM that is part of the module configuration. The CP340 is configured via STEP 7 software and stores its settings in on-board flash. Changing CP524 parameters requires a PG with the COM PP or COM 525 package and a prommer.
Can I use a CP341 instead of a CP340 for S5-115 communication?
Yes, and it is preferred. The CP341 has 8 KB of receive buffer (vs. 1 KB on the CP340), supports loadable drivers, and accepts firmware updates that have resolved edge cases in 3964R timing. MLFB 6ES7 341-1AH02-0AE0 (RS232) is the direct drop-in for the CP340 RS232 variant in HW Config.
How long can a 3964R cable be at 9 600 bit/s?
15 m per EIA-232 with a quality shielded cable. For longer distances, use a serial-to-Ethernet device server such as the Digi One SP IA on each end and tunnel the serial stream over TCP. For new installations, the IBH Link S5 + IBH Link S7-300 path eliminates the cable distance constraint entirely.
What status code means QVZ timeout on a CP340?
STATUS = 0301h indicates QVZ timeout waiting for the partner to acknowledge STX. STATUS = 0308h indicates QVZ timeout waiting for the partner to send the data block. Both point to mismatched QVZ values between CP340 and CP524; set both to 4 000 ms. STATUS = 0808h is the same QVZ timeout reported in the FB7/FB8 return word.
Is AS511 supported on the S7-300 CP340 TTY variant?
No. Siemens does not ship an AS511 driver for the CP340. AS511 must be implemented in the S7-300 user program as a custom ASCII frame encoder/decoder using the CP340 generic ASCII driver. This is fragile and not recommended. For a supported solution, use the IBH Link S5 to expose the S5 data blocks over PROFINET.