Resolving S7 Connection Resource Errors on S7-300 with Ewon

David Krause11 min read
Industrial NetworkingSiemensTroubleshooting
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

Resolving S7 Connection Resource Errors on S7-300 with an Ewon Gateway

When an ET200S IM151-8 PN CPU (PROFINET interface) must exchange data with a SIMATIC S7-300 CPU 312 (MPI/DP interface) through an HMS Networks Ewon remote-access router, the natural assumption is that the Ewon can act as a transparent S7 router. In practice the device is a protocol converter/gateway, not an S7 router, and TIA Portal will block the second PLC-to-PLC S7 connection with a "There are no connection resources available" diagnostic, even when the S7-300 reports six resources configured and zero used. This reference documents the root cause, the diagnostic path, and the supported remediation using the Ewon's BASIC scripting engine.

Affected Components and Firmware

Component Role Relevant Versions / Catalog Numbers
SIMATIC ET200S IM151-8 PN/DP CPU PROFINET controller, S7 client 6ES7151-8AB01-0AB0 (and successor 6ES7151-8AB02-0AB0); firmware V3.x
SIMATIC S7-300 CPU 312 MPI/DP interface, S7 server 6ES7312-1AE14-0AB0; firmware V3.3
Ewon Cosy 141 (MPI variant) Ethernet ↔ MPI gateway EC51460-00MA; firmware 14.x
TIA Portal Engineering V15.1 or later (V16/V17 recommended for routing diagnostics)
The CPU 312 family has only one combined MPI/DP interface. It cannot act as a PROFINET device and does not perform S7 routing from PROFINET to MPI natively. Any "routing" attempt is therefore a TIA Portal configuration, not a CPU capability.

Root Cause: S7 Routing Is Not the Same as Protocol Conversion

The S7-300 CPU 312 advertises routing capability only across its own interfaces (MPI/DP ↔ internal backplane). When you attempt to bind an S7 connection from the ET200S PN CPU to the S7-312 in TIA Portal, the compiler must reserve a connection resource on the S7-312 for the partner endpoint. The Ewon sits between the two networks as an Ethernet-to-MPI bridge, but it does not insert itself into the S7 routing table the way a CP343-1 or a SCALANCE would. The result is a hard error: the CPU resource count is technically free, yet TIA Portal reports the slot as exhausted because the routing path is invalid.

Per the Ewon's published protocol list, the supported bridging pairs are MODBUS TCP ↔ MODBUS RTU, XIP ↔ UNITELWAY, EtherNet/IP ↔ DF1, FINS TCP ↔ FINS Hostlink, and ISOTCP ↔ PPI/MPI. ISO-on-TCP (the transport for S7 communication) to MPI bridging is therefore possible in principle, but it is handled at the Ewon application layer, not by the S7 routing engine of either PLC. This is the critical distinction.

S7-300 CPU 312 Connection Resource Model

The CPU 312 ships with a fixed pool of six connection resources, allocated dynamically among four roles:

Resource Role Default Reservation Configurable In
PG (programming device) 1 reserved Hardware → CPU properties → Communication
OP (HMI / Ewon tag polling) 0 to 3 reserved Same dialog
S7 connection Remaining Same dialog
Routing 1 implicit if used Same dialog (must be enabled)

When TIA Portal shows "0 used," it is reporting the number of currently established connections. The reservation for an S7 routing slot is performed at compile time. If the ET200S-to-S7-312 path cannot be resolved through a routable subnet (PROFINET ↔ MPI is not natively routable on a CPU 312), the reservation is rejected even though the runtime counter is still zero. Always check the connection diagnostics under Online → Accessible nodes and read the resource allocation from the CPU's web server (or TIA Online → Diagnostics → Connection resources) before drawing conclusions from the offline view.

Diagnostic Procedure

  1. Open TIA Portal and load the project containing PLC_2 (S7-312), PLC_4 (ET200S IM151-8 PN CPU), and PC_System_1.
  2. Right-click the S7-312 device → Compile → Hardware (rebuild all). Note the exact error text for the PLC_4 → PLC_2 connection.
  3. In the device properties of the S7-312, open Communication → Connection resources and confirm the per-role reservation (PG, OP, S7, routing).
  4. Go online to the S7-312 and read Diagnostics → Connection overview. The runtime table shows live state; cross-check it against the offline reservation.
  5. Verify the Ewon's MPI port is configured at 187.5 kbps, station address 0 (default), and the same MPI bus profile (MPI, not PROFIBUS-DP) used by the S7-312.
  6. From the Ewon web interface, open Devices → MPI/Serial → Status and confirm the S7-312 is online and that tags can be polled manually. This proves the bridge layer works.
  7. Open the Ewon Event Log; look for MPI bus errors, address conflicts, or token retries. These consume implicit connection slots on the CPU.
If step 6 succeeds but step 2 still fails, the issue is confirmed as a TIA Portal S7 routing configuration, not an Ewon bridging limitation.

Solution: Ewon BASIC Scripting per KB-0113

HMS Networks' official response for exchanging data between two PLCs through an Ewon (when one is reachable only via MPI and the other only via Ethernet) is to use the Ewon's BASIC scripting engine to copy tag values between the two networks. The reference document is KB-0113-0-EN: Exchange Data Between Different PLCs.

The script does not create an S7 connection; it creates a poll-and-write loop using the Ewon's built-in I/O server. The Ewon appears to the S7-312 as an HMI/OP (consuming one OP connection resource) and to the ET200S PN CPU as an ISOTCP partner.

Step 1 — Create the S7-300 Tags on the Ewon

In the Ewon web interface go to Tags → Configuration and add the tags from the S7-312 you want to read. Use the S7/MPI driver:

Tag Name Ewon IO Server Address Polling (ms) Direction
DB1_DBD0 SIEMENS S7 MPI DB1, DBD0, REAL 500 Read from S7-312
DB1_DBD4 SIEMENS S7 MPI DB1, DBD4, REAL 500 Read from S7-312
MW10 SIEMENS S7 MPI MW10, INT 1000 Read from S7-312

Step 2 — Create the ET200S Tags on the Ewon

Add the corresponding write tags against the ET200S PN CPU using the S7 ISO-on-TCP (ISOTCP) IO server. The ET200S must allow PUT/GET access (default on IM151-8 PN CPUs from firmware V3.0 onward; enable under Properties → Protection → Permit access with PUT/GET).

Tag Name Ewon IO Server Address Polling (ms) Direction
PLC4_IN_REAL0 SIEMENS S7 ISOTCP DB1, DBD0, REAL 500 Write to ET200S
PLC4_IN_REAL1 SIEMENS S7 ISOTCP DB1, DBD4, REAL 500 Write to ET200S
PLC4_IN_INT0 SIEMENS S7 ISOTCP MW10, INT 1000 Write to ET200S

Step 3 — BASIC Script (INIT section)

Open Scripting → BASIC IDE and create a new script. The pattern below mirrors KB-0113 and copies values every cycle. Polling intervals are tuned to avoid overloading the MPI bus; keep them ≥250 ms.

REM --- KB-0113 data exchange between S7-312 (MPI) and ET200S (ISOTCP) ---
REM %TagName% references resolve at runtime to the value of the Ewon tag.

FUNCTION CopyS7ToET200()
  PLC4_IN_REAL0@ = DB1_DBD0@
  PLC4_IN_REAL1@ = DB1_DBD4@
  PLC4_IN_INT0@  = MW10@
END FUNCTION

REM --- Periodic execution: 500 ms ---
SETSYS SYS, "LOADPRJ"
TPI$ = "500"
ONTIMER 1, TPI$

EVENT ONTIMER 1
  CopyS7ToET200()
ENDEVENT

For reverse direction (ET200S → S7-312), declare write tags on the MPI side and read tags on the ISOTCP side, then add the symmetric assignment in the script.

Use the Ewon's built-in tag qualifier system (alarm/alive) to detect communication loss on either side. A stalled ONTIMER with a stale tag value is the fastest way to surface an MPI bus error to the ET200S application.

Why the TIA Portal Connection Can Stay Disabled

Leave the PLC_4 → PLC_2 S7 connection disabled in TIA Portal. The data flow is now Ewon ↔ S7-312 (one OP slot) and Ewon ↔ ET200S (one ISOTCP slot), not an S7 routed connection. The CPU 312 connection resource pool remains free for the PG, for PC_System_1 HMI traffic, and for any future legitimate S7 partners. This also eliminates the "no connection resources available" compile error, because the offending configuration no longer exists.

Alternative Architectures

If the polling latency of the BASIC script is unacceptable, evaluate these alternatives in order of cost and effort:

  1. Add a CP343-1 Lean (6GK7342-1AL10-0XA0) to the S7-300 rack. This gives the S7-300 a PROFINET interface and lets TIA Portal build a true routed S7 connection from the ET200S. The Ewon then becomes a pure remote-access path for engineering, not a data broker.
  2. Replace the CPU 312 with a CPU 315-2 PN/DP (6ES7315-2EH14-0AB0). This provides an integrated PROFINET port and supports more S7 connection resources (typically 14), removing the OP slot pressure that the Ewon's polling imposes.
  3. Use an S7-1200 or S7-1500 as the head-end with an integrated PROFINET interface, and treat the existing CPU 312 as a PROFIBUS-DP slave or a third-party device over MPI. This is the cleanest long-term path but requires rewriting the S7-300 program as a PROFIBUS-DP slave (or migrating it).
  4. Use the Ewon's MQTT publish/subscribe feature (firmware 14.2+) to expose tag values to an MQTT broker; the ET200S application reads them via a Java/Node-RED service. This decouples both PLCs from the Ewon's I/O server loop and is the most scalable for plant-wide rollouts.

Verification and Commissioning

  1. Force a value into S7-312 DB1.DBD0 from TIA Portal (Monitor & Modify). Within 500 ms, observe the corresponding value appear in the ET200S DB1.DBD0 via online watch.
  2. Reverse the test: write to the ET200S tag and verify the S7-312 receives it within one polling interval.
  3. Open the Ewon's Real Time Logs and confirm the ONTIMER event fires at the expected rate. Missing firings indicate a scripting engine stall (typically due to an unhandled error in a tag poll).
  4. Check Devices → MPI/Serial → Statistics on the Ewon. Token retries, CRC errors, or address conflicts will degrade the polling loop and must be zero for production release.
  5. Validate the connection resource count on the S7-312 from the TIA Portal online diagnostics: PG + 1 OP (Ewon) + 1 OP (PC_System_1) + spare = 6. The spare slot is the one that previously appeared "free but unavailable"; it is now correctly accounted for.
  6. Document the data latency budget in the project FDS. Typical observed values for the BASIC script loop are 250–1500 ms depending on tag count and polling interval.

Troubleshooting Matrix

Symptom Likely Cause Action
"No connection resources available" on compile Invalid S7 routing path; CPU 312 cannot route PROFINET to MPI Remove the routed S7 connection; implement BASIC script data exchange
Ewon MPI tag shows --BAD-- CPU 312 protection level blocks PUT/GET, or MPI bus error Set CPU 312 protection to "No protection" for Ewon partner; check MPI baud rate and address
BASIC script ONTIMER does not fire Syntax error or I/O server uninitialized Check Ewon event log; confirm tags have valid values before the first ONTIMER cycle
Stale data after MPI cable disconnect Alarm qualifier not configured Enable the "alive" qualifier on each polled tag and handle the alarm in the BASIC script
ET200S PUT/GET rejected Access protection enabled on IM151-8 PN CPU Enable "Permit access with PUT/GET from remote partner" in TIA Portal device properties
Connection resource count is wrong on offline view TIA Portal does not reflect runtime OP slot occupancy Go online to the CPU and read connection resources from the diagnostics buffer
MPI bus errors on Ewon Termination or shielding issue on the MPI cable Add terminating resistors at both ends; verify shield grounding

Key Constraints and Field Caveats

  • The CPU 312 maximum of six connection resources is a hard hardware limit; it cannot be expanded by firmware, options, or CPs.
  • Every Ewon OP/MPI tag poll counts as one OP connection on the S7-300. The script loop must not exceed the reserved OP slots, or the S7-300 will drop the Ewon's MPI session.
  • For data rates above 50 tags or sub-200 ms latency, the BASIC scripting engine becomes a bottleneck. Switch to a CP343-1 Lean or a CPU 315-2 PN/DP.
  • The Ewon's MPI port is at 187.5 kbps by default. If the S7-300 MPI network is at 19.2 kbps or 1.5 Mbps (PROFIBUS-DP), reconfigure the Ewon's MPI profile to match, or the CPU will reject the connection.
  • Remote access (Talk2M) and the data-exchange script can coexist, but be aware that a firmware update on the Ewon resets the I/O server configuration. Always back up the project with Configuration → Backup before upgrading.

Why does TIA Portal say "no connection resources available" when the S7-312 reports 0 used?

The S7-312 has six connection slots reserved at compile time, not at runtime. TIA Portal performs the reservation when it builds the routed S7 connection, and because the CPU 312 cannot natively route PROFINET to MPI, the reservation is rejected even though no live connection occupies the slot. Read the live occupancy from Online → Diagnostics → Connection resources on the CPU itself, not from the offline device properties.

Can the Ewon Cosy 141 act as a transparent S7 router between PROFINET and MPI?

No. The Cosy 141 is a protocol converter, not an S7 router. It supports ISOTCP ↔ PPI/MPI bridging at the application layer, but it does not insert itself into the S7 routing path. For transparent S7 routing, add a CP343-1 Lean to the S7-300 or upgrade to a CPU 315-2 PN/DP.

How many S7 connection resources does a CPU 312 have?

Six total, shared dynamically among PG, OP, S7, and routing roles. The split is configurable in CPU Properties → Communication → Connection resources. The default leaves one slot reserved for PG, leaving five for OP/S7/routing. A CPU 312 cannot be expanded beyond six.

What is the recommended polling interval for Ewon BASIC scripts over MPI?

Keep individual tag polls at 500–1000 ms and avoid polling more than 20–30 tags in a single ONTIMER cycle. The MPI bus is half-duplex at 187.5 kbps and cannot sustain aggressive polling without token retries. For sub-200 ms latency, replace the CPU 312 with a CPU 315-2 PN/DP and use native S7 communication.

Where do I find the official Ewon data-exchange guide for two different PLCs?

The reference document is KB-0113-0-EN: Exchange Data Between Different PLCs, published by HMS Networks. It contains the BASIC scripting template, recommended I/O server settings, and example tag configurations for ISO-on-TCP to MPI bridging.

Back to blog