Troubleshooting
Why a Snap7 client cannot read a CPU 1507S software controller
Short answer
A Snap7 client reaches a CPU 1507S software controller with Rack 0 and Slot set to the CPU index in the TIA project, not the Ethernet-interface index. Once the session stands, reads still fail until the CPU permits PUT/GET communication and the target DB has optimized block access disabled, so its bytes sit at fixed absolute offsets. Fix routing first, access second, and change one setting at a time.

On this page
A Snap7-based collector pointed at a CPU 1507S running on an industrial PC, an IPC227E in the case at hand, fails for one of three reasons, and they come in a fixed order. First, the client must address the Ethernet interface that TIA assigned to controller communication. Second, the S7 session routes with Rack 0 and Slot set to the CPU's index in the project, never the interface index. Third, once the session stands, reads still fail until the CPU permits PUT/GET communication and the target DB is compiled without optimized block access. Diagnose by separating a session that never opens from a session that opens and then rejects every read: they have different fixes, and turning rack and slot on an already-established session burns the outage window for nothing.
Tell a refused session from a rejected read #
An S7 connection is a network address plus a logical destination inside the endpoint. The TCP connection carries it, the destination TSAP selects the CPU, and only then does the controller weigh each request against its protection settings and the requested block's layout. Classify what you see into one of four outcomes before touching anything:
- No TCP connection at all. The destination address is wrong, belongs to a different adapter on the PC, or a firewall drops the ISO-on-TCP port, TCP 102 (RFC 1006). Confirm which interface the device configuration assigns to the controller and that the client addresses that one.
- TCP connects, the S7 session does not open. A routing fault: the rack, slot or TSAP does not resolve to the software CPU. The fix is the CPU index as slot, covered next.
- Session established, every DB read refused. An access fault: the PUT/GET permission is off, the CPU sits at an access level that shuts that server function, or the requested DB is compiled with optimized access.
- Reads succeed but the values are wrong. A data fault: offsets, byte order or data-type interpretation disagree with the compiled block. Rebuild the collector's address list from the compiled offsets.
Record the connection result and the read result separately, and keep the client's diagnostic text. "Cannot connect" and "read refused" are different faults, and a client whose session already stands needs the access checks, not more routing changes.
Route the session with the CPU index as slot #
A Transport Service Access Point identifies the endpoint inside the device. A client that accepts only an IP address, rack and slot builds the destination TSAP from those fields, following the S7 convention: 0x0300 plus rack times 0x20 plus slot. Rack and slot are therefore routing inputs, not descriptions of hardware — nothing is slotted into an industrial PC. When you add a CPU 1507S to the PC's device configuration, TIA assigns the controller an index, and the Ethernet interface in the same configuration carries its own, different index. Feed the interface index to Snap7 and the session resolves to the wrong logical destination even with the correct IP address.
Commit to this mapping: Rack 0, with Slot equal to the CPU index. Test it with the demo client included in the full Snap7 package before you touch the collector, and change one field at a time — rack, slot or TSAP — so the result tells you which field was wrong.
The TSAP arithmetic, worked #
Example values: the project lists the software controller with CPU index 2 and its Ethernet interface with index 1. The client is configured with Rack 0 and Slot 2, so the destination TSAP is 0x0300 + 0 × 0x20 + 2 = 0x0302, written 03.02. Had you entered the interface index instead, the request would carry 03.01 and land on a destination nothing answers. If your integration exposes explicit TSAP fields rather than rack and slot, enter 03.02 there: same destination, one step less arithmetic.
Permit PUT/GET communication on the CPU #
PUT and GET are the S7 services a remote partner uses to write and read data areas, and on this CPU family the server function stays disabled until you permit it. Snap7 reads through exactly these services, so the collector needs the permission even though it only collects. In the CPU's protection settings, activate the option named "Permit access with PUT/GET communication from remote partner", then save, compile and download the configuration to the controller; the vendor's activation procedure for PUT/GET access shows the same sequence. Nothing changes until the downloaded configuration carries it.
One safety note, and it belongs here: the permission carries no per-partner authentication, and it opens writes as well as reads to everything that can reach the CPU. Keep the collector on the controlled OT segment, allow TCP 102 to the CPU only from the collector's address, and leave the cloud upload in the collector so the controller never faces an external network.
Disable optimized block access on the exchange DB #
An optimized DB lets the engineering system lay out memory for symbolic access only; no fixed absolute offsets exist for a byte-oriented client to aim at. Snap7 reads by absolute address — DB number, start byte, length — so the requested block must be compiled with optimized block access cleared. Open the DB's properties, clear that attribute, compile, and download the changed block; the compiled block then shows every tag's absolute offset, and those offsets are what the collector must use.
Give the collector its own exchange DB instead of reading process blocks. A dedicated block separates externally consumed data from control structures and gives you one place to freeze the layout.
Example: exchange DB 100, compiled without the attribute, holds a REAL as its first tag at offset 0.0. The collector reads DB 100 from byte 0, 4 bytes — one IEEE 754 single-precision value. Online the tag shows 12.5; on the wire that is the byte sequence 41 48 00 00 hex. One read that returns 12.5 proves the whole chain: route, permission, layout and interpretation.
The fix in order #
- Record the baseline: the interface and address in use, the CPU and interface indices, the client's current rack, slot and TSAP fields, and the target DB numbers and offsets.
- Confirm the endpoint: the address the client targets belongs to the interface the project assigns to controller communication, not merely to an adapter that answers ping on the PC.
- Set the route: Rack 0 with Slot equal to the CPU index, and prove the session with the demo client before changing anything else.
- Open the service: enable the PUT/GET permission, save, compile, download.
- Fix the layout: clear optimized block access on the exchange DB, compile, download, and copy the compiled offsets.
- Point the collector at the compiled addresses — DB number, start, length and data type per tag — then read one known tag and one naturally changing tag, and compare both against the online values. Reconnect once and confirm the collector resumes unaided.
The decision for each case #
- The session never opens although TCP connects: routing. Apply the CPU-index mapping above and retest with the demo client; leave the IP address and the permissions alone.
- The session opens and reads are refused: access. Enable the PUT/GET permission and clear optimized block access on the exchange DB, download both, then re-point the offsets.
- Reads work but values are wrong: data. Rebuild the address list from the compiled offsets and data types; routing and permissions are already correct.
- Reads are still refused after permission and layout: the CPU's configured access level is the remaining gate.
One working combination on record for this exact symptom: a CPU 1507S under TIA V14, read by Snap7 on 64-bit Windows 10, with reads succeeding only after the permission was enabled on the CPU and optimized access cleared on the target DB. Treat that as one data point for those versions; the same two settings exist at later TIA versions.
Questions asked
Is there a read-only version of the PUT/GET permission?
No. The switch enables the PUT/GET server function as a whole, so reads and writes become available together to every partner that can reach the CPU. Treat the collector's address list as the real write protection: hand it read offsets only, keep write offsets out of its configuration unless the application needs them, and filter S7 traffic down to the collector's address at the firewall.
The permission is enabled and compiled, so why are reads still refused?
Check which access level the CPU is set to. The vendor documents one access level in which the PUT/GET server function is disabled and cannot be re-enabled, so a CPU parked there refuses Snap7 no matter how the checkbox is set. Move the CPU to an access level that leaves the service available, compile, download the configuration, and repeat the single-tag read.
Which address does the collector use when it runs on the same industrial PC as the controller?
The address of the Ethernet interface the project assigns to controller communication, the same one a remote collector would use. The software controller publishes its S7 endpoint on that assigned interface, not on the loopback address, so a local collector still connects across it. A loopback attempt fails before any session exists and looks deceptively like a permissions problem.
Where do I find the CPU index in the project?
In the device configuration of the industrial PC, where the software controller was added; the index is assigned there. The Ethernet interface in the same configuration carries its own separate index, and the two are easy to confuse because both are small numbers. Read the value from the controller's own entry, put it in the collector's slot field, and record it with your baseline notes.
Does clearing optimized block access disturb the running program?
No. Program code that accesses the block symbolically keeps working unchanged; what changes is that the block now occupies fixed absolute addresses an external client can target. The conversion needs a compile and a download of the block, so schedule it in a planned stop, then re-read the offsets from the compiled block, because the layout after conversion is the one the collector must match.


