Configuring SMS over IP on S7-1200 CPU 1212 with the M875 Telecontrol Component in TIA Portal
Engineers integrating an S7-1200 CPU 1212 into a remote-monitoring application frequently need an SMS-over-IP path that works when the public Internet is reachable but the plant LAN is not. The reference architecture pairs a Siemens S7-1200 station with the M875 telecontrol component (commonly implemented with the SCALANCE M875 industrial mobile router) and a Telecontrol Server Basic (TCSB) instance that forwards alarms via an SMPP-capable SMS gateway. This article consolidates the configuration, programming, and verification steps required to make that path operational in TIA Portal, with concrete block interfaces, sample SCL code, parameter tables, and a troubleshooting matrix.
1. SMS-over-IP Architecture Overview
The end-to-end path is short, but each hop has its own parameters and failure modes:
Key hop characteristics:
| Hop | Protocol | Default Port | Direction |
|---|---|---|---|
| CPU ↔ CP 1242-7 | S7 internal backplane | — | Bidirectional |
| CP 1242-7 ↔ SCALANCE M875 | Ethernet (TCP/IP) | — | Bidirectional |
| M875 ↔ TCSB (Telecontrol) | TCP (Telecontrol protocol) | 2777 (default, configurable) | Outbound from station |
| TCSB ↔ SMSC | SMPP v3.4 / SMTP-to-SMS | 2775 (SMPP) / 25/465/587 (SMTP) | Outbound from server |
Two architectural decisions drive the rest of the configuration:
- Direct SMS via CSD/GSM — older method, the CP 1242-7 sends SMS directly to an SMSC over a CSD data call. Obsolete in most regions because 2G CSD is being decommissioned; not recommended for new deployments.
- SMS via TCSB and SMPP gateway (recommended) — the CP 1242-7 establishes a permanent or on-demand GPRS/LTE tunnel to Telecontrol Server Basic, and TCSB forwards the message via SMPP to a commercial SMS gateway. This is the path covered here.
2. Hardware Prerequisites and Component Selection
Verify every item before commissioning. A missing firmware update is the most common cause of "TCS cannot establish connection" faults on otherwise correct projects.
| Component | Article number | Minimum FW / SW | Notes |
|---|---|---|---|
| S7-1200 CPU 1212 DC/DC/DC or DC/DC/RLY | 6ES7212-1xxx-0XB0 | Firmware V4.4 or higher | FW V4.2 lacks some telecontrol instruction set enhancements. |
| CP 1242-7 GPRS module | 6GK7242-7KX30-0XE0 | Firmware V3.4.x | Required for telecontrol on S7-1200; module provides SIM slot, antenna SMA. |
| CP 1243-7 LTE (alternative to CP 1242-7) | 6GK7243-7KX30-0XE0 | Firmware V3.3.x or higher | Recommended for new builds; LTE band support depends on variant. |
| SCALANCE M875 industrial router | 6GK5875-x (variant dependent) | FW as shipped; update via Web Based Management | Provides firewall, NAT, optional OpenVPN/IPsec to corporate control center. |
| SIM card (industrial-grade) | — | — | Static APN recommended for M2M; PIN disabled unless SIM supports it. |
| TIA Portal | — | V16 Update 4 or higher (V17 / V18 / V19 acceptable) | Older V15 SP1 misses TCSB V3.x block revisions. |
| Telecontrol Server Basic | 6AV2170-xxxxx | V3.5 or higher | Install on Windows Server 2016/2019/2022 with .NET Framework 4.7.2+. |
| SMPP provider account | — | — | Customer-supplied; obtain hostname, port, system ID, password, source TON/NPI. |
3. Network Topology and IP Planning
The address plan must accommodate three segments without overlap:
| Segment | Typical subnet | Devices |
|---|---|---|
| Plant LAN (S7-1200 side) | 192.168.0.0/24 | CPU 1212 (192.168.0.1), CP 1242-7 (192.168.0.2), engineering PG |
| SCALANCE M875 internal | 192.168.1.0/24 | M875 LAN side (192.168.1.1), M875 WAN side (DHCP from mobile carrier) |
| TCSB / control center | 10.0.0.0/24 | TCSB server (10.0.0.10), SMPP relay host |
Configure the M875 as the default gateway for the CP 1242-7. In the CP 1242-7 properties under "Ethernet interface > IP protocol > Router", enter 192.168.1.1 as the default router and the carrier-supplied DNS servers. If you use the CP 1243-7 LTE as an alternative to the M875, the CP itself acts as the mobile interface and the routing entry becomes 0.0.0.0 0.0.0.0 <CP-as-router-IP>.
4. SCALANCE M875 Industrial Router Configuration
Access the Web Based Management (WBM) at https://192.168.1.1. Default credentials are on the device label; change them on first login.
4.1 Mobile interface
- Interfaces > Mobile: set APN, Username, and Password as supplied by the M2M carrier.
- Disable PIN if the SIM is provisioned without one (most industrial M2M SIMs are).
- Set Connection mode to "Permanent connection" so the TCSB tunnel stays established; this reduces SMS latency from tens of seconds to under two.
- Enable Data roaming only if cross-border operation is required.
4.2 Firewall rules
| Action | Service | Source | Destination |
|---|---|---|---|
| ACCEPT | TCP 2777 (Telecontrol) | 192.168.1.0/24 (CP 1242-7) | TCSB public IP |
| ACCEPT | TCP 443 (WBM, outbound) | M875 itself | Siemens update server (optional) |
| DROP | any | WAN | 192.168.0.0/16, 10.0.0.0/8 |
4.3 VPN (optional, recommended for sensitive sites)
For an IPsec tunnel back to the corporate control center, define the remote subnet (10.0.0.0/24) as a phase-2 selector. The CP 1242-7 will then route TCS-bound traffic through the encrypted tunnel without further changes on the CPU side. Refer to the SCALANCE M875 operating instructions in the SIMATIC NET manual collection for the IPsec parameter set.
5. TIA Portal Project Setup for S7-1200
- Create a new project in TIA Portal V17 or higher; choose "Add new device > SIMATIC S7-1200 > CPU 1212" matching the article number suffix (DC/DC/DC vs DC/DC/RLY).
- Set the CPU's IP address to
192.168.0.1/24; subnet mask255.255.255.0; router192.168.0.1(no router on the CPU itself). - In the device catalog, locate "Communication > CP 1242-7" (article 6GK7242-7KX30-0XE0). Drag it into the same S7-1200 station; TIA Portal auto-assigns slot 1 next to the CPU.
- Configure the CP IP address to
192.168.0.2/24and the default router to the M875 LAN address192.168.1.1. - Insert the Telecontrol interface of the CP and choose "Telecontrol Server Basic" as the connection target.
5.1 Telecontrol configuration in the CP properties
| Parameter | Recommended value | Comment |
|---|---|---|
| Station number | 1 (unique per TCSB) | TCSB matches this against the registered station |
| TCSB project number | 1 (default) | Set to match the TCSB project ID |
| TCSB server address | FQDN or public IP of TCSB | Resolve via DNS; static IP preferred |
| TCSB port | 2777 | Default; must match TCSB listener |
| Connection mode | Permanent (always online) | Lowest SMS latency |
| TLS | Enabled (TLS 1.2) | Required for firmware V3.3+ when targeting TCSB V3.4+ |
| Authentication key | 32-byte hex string | Identical key in CP and TCSB |
6. Telecontrol Server Basic Installation and SMS Configuration
Refer to the entry Communication between RTUs with S7-1200 and Telecontrol Server Basic for the canonical installation sequence. Key points for SMS use:
- Install TCSB on a dedicated Windows Server. Activate the "Alarm-SMS via SMPP" option during setup.
- Import the station setup file exported from TIA Portal (
.tcs). The wizard maps the CP's station number to the TCSB station and ingests the authentication key automatically. - Open TCSB Configuration > SMS Gateway and enter:
| Field | Value |
|---|---|
| SMPP host | smpp.provider.example |
| SMPP port | 2775 |
| System ID | provided by SMSC operator |
| Password | provided by SMSC operator |
| Source address (TON/NPI) | 1/1 (international) or 5/0 (alphanumeric) |
| Bind type | Transceiver (TX/RX) |
| Throughput (SMS/min) | 30 (conservative default) |
| Encoding | GSM 7-bit default, UCS-2 fallback for Unicode |
- Test the SMPP bind via the "Test connection" button. A success log entry confirms the SMS path is operational before any PLC code is written.
- Define at least one SMS recipient list and bind it to the station so that triggered alarms reach the right phone numbers.
7. S7-1200 SMS Program: Library Integration
The S7-1200 telecontrol library is shipped with TIA Portal under Libraries > Global Libraries > Telecontrol. It contains the FBs and DBs required to send messages. Reference it explicitly in the project to avoid copy-paste errors.
7.1 Library overview
| Block | Type | Role |
|---|---|---|
| TC_CONFIG | FB (DB-backed) | Writes runtime parameters (SMSC address, station name) to the CP |
| TC_SMS | FB (DB-backed) | Sends one SMS through the established telecontrol connection |
| TC_RECV | FB (DB-backed) | Optional: receives operator commands from TCSB |
| TC_STAT | FB (DB-backed) | Reads telecontrol connection diagnostics |
| TC_DB | DB | Shared instance data store for the FBs above |
7.2 Add the library
- In TIA Portal: Options > Global libraries > Open library > "Telecontrol_S7_1200".
- Drag
TC_SMSandTC_CONFIGinto the project "Program blocks" folder. - Open the "Telecontrol interface" of the CP 1242-7, switch to the "Message configuration" tab, and enable the events that should generate an SMS (binary tags, analog thresholds, acknowledgement messages).
7.3 SCL sample: SMS sender wrapper
The following SCL FB wraps TC_SMS with a one-shot trigger, status decoding, and a debounce on success so the same alarm cannot generate duplicate messages within a 60-second window.
FUNCTION_BLOCK "FB_SMS_Alarm"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
VAR
TC_SMS_Inst : TC_SMS;
iTC_DB : TC_DB;
bTrigger : BOOL;
sPhone : STRING[20]; // international format, e.g. "+4917xxxxxxxx"
sText : STRING[160]; // GSM 7-bit: 160 chars; UCS-2: 70 chars
bEdge : BOOL; // rising-edge memory
tonDebounce : TON; // 60 s lockout after a successful send
rtEdge : R_TRIG;
END_VAR
BEGIN
rtEdge(CLK := bTrigger, Q => bEdge);
tonDebounce(IN := TC_SMS_Inst.DONE, PT := T#60s);
IF bEdge AND NOT tonDebounce.Q THEN
TC_SMS_Inst.REQ := TRUE;
TC_SMS_Inst.ID := 1;
TC_SMS_Inst.PHONE := sPhone;
TC_SMS_Inst.TEXT := sText;
ELSE
TC_SMS_Inst.REQ := FALSE;
END_IF;
TC_SMS_Inst(
REQ := TC_SMS_Inst.REQ,
ID := TC_SMS_Inst.ID,
PHONE := TC_SMS_Inst.PHONE,
TEXT := TC_SMS_Inst.TEXT,
DONE => TC_SMS_Inst.DONE,
BUSY => TC_SMS_Inst.BUSY,
ERROR => TC_SMS_Inst.ERROR,
STATUS => TC_SMS_Inst.STATUS);
END_FUNCTION_BLOCK
Call the wrapper from an alarm OB (e.g. OB82 or a cyclic OB with edge detection on the process tag) and route the STATUS word into the HMI diagnostic screen.
7.4 TC_SMS STATUS word decoding
| STATUS (hex) | Meaning | Action |
|---|---|---|
| 0000 | Job accepted, no error | Wait for DONE |
| 7001 | Busy, job in progress | Poll again on next cycle |
| 80A1 | No telecontrol connection | Check M875 online, CP LEDs, firewall rules |
| 80A2 | Authentication failed | Verify the 32-byte key matches between CP and TCSB |
| 80A3 | TCSB rejected message | Check SMPP bind, recipient list, and TCSB event log |
| 80B0 | SMS buffer full on CP | Reduce send rate; only one SMS in flight at a time per FB |
| 80C1 | Phone number invalid | Re-format to E.164, e.g. "+4917xxxxxxxx" |
| 80C2 | Text length exceeds 160 GSM-7 chars | Truncate or switch to UCS-2 with explicit length handling |
8. SMS Trigger Logic and Acknowledgment
Trigger the SMS from event-driven OBs to keep scan-time impact minimal:
- OB82 (diagnostic interrupt) — module fault, SM 1231 wire break, CP 1242-7 signal loss.
- OB1 (cyclic, edge detected) — process alarms such as tank level > high-high or motor overload.
- Time-of-day — daily status report at 07:00 local time using OB10.
For two-way acknowledgment, configure TC_RECV to accept a designated SMS keyword ("ACK") from any authorized number. Map TC_RECV.TEXT into a string compare block and set the corresponding process tag to acknowledge the alarm.
TC_RECV to a hard-coded allow-list of phone numbers and ignore all others.9. Verification and Diagnostics
- CP online diagnostics. In TIA Portal, mark the CP 1242-7, choose "Online & diagnostics", then "Telecontrol". Confirm "Connection state: Connected" and the active TCP socket to the TCSB public IP on port 2777.
- TCSB station status. Open TCSB Configuration > Stations. The station should show green "connected" with the last message timestamp recent.
- SMPP test send. From TCSB Configuration > SMS Gateway, click "Send test SMS". A delivered message confirms the operator path independently of the PLC.
-
End-to-end PLC test. Set a breakpoint at the
bTriggerinput ofFB_SMS_Alarmand force TRUE for one cycle. Observe DONE=TRUE and the STATUS word. The phone receives the message within 2–10 s for a permanent connection. - HMI alarm log. Confirm the alarm appears in the WinCC Unified or Comfort Panel alarm view with the SMS status mapped.
10. Troubleshooting Matrix
| Symptom | First checkpoint | Second checkpoint | Resolution |
|---|---|---|---|
| CP "No connection" within 30 s of boot | M875 mobile LED steady green? | CP diagnostic buffer entry "DNS failure" or "TCP timeout"? | Verify APN, antenna, and DNS servers; check M875 firewall blocks outbound 2777 |
| Connection established but SMS never arrives | TC_SMS DONE TRUE, STATUS 0000? | TCSB event log: "SMPP submit_sm_resp OK"? | If submit_sm accepted but phone silent: check SMPP provider delivery receipt and operator SMSC routing |
| TC_SMS ERROR TRUE, STATUS 80A2 | Compare key string in CP vs TCSB | — | Re-export and re-import the station configuration; do not retype |
| STATUS 80C1 (phone invalid) | String contains leading "+" and country code? | — | Force E.164 format on the HMI input or in the FB |
| STATUS 80C2 (text too long) | LEN(sText) output | — | Limit to 160 GSM-7 characters or switch to UCS-2 and limit to 70 |
| Latency > 30 s | CP connection mode set to "On demand"? | — | Switch to "Permanent" in CP telecontrol properties |
| TCSB "Bind failed" on SMS gateway | SMPP host reachable (ping from TCSB host)? | System ID and password match? | Open TCP 2775 outbound on TCSB firewall; check SMSC for source IP allow-list |
| Some Unicode characters replaced by "?" | Encoding set to GSM 7-bit? | — | Switch to UCS-2 in TCSB SMPP binding and rebuild message |
11. Security, Firewall, and Mobile Operator Settings
- TLS 1.2 minimum. Force TLS 1.2 on the CP 1242-7 to match TCSB V3.4+. TLS 1.0/1.1 are deprecated and rejected by many SMSC gateways.
- Private APN. Use a private APN with carrier-side IP filtering whenever possible to deny public Internet access from the SIM.
- Source TON/NPI. Use TON=1 (international) and NPI=1 (E.164) unless your SMPP provider explicitly requires alphanumeric originator.
- SMS length. Concat SMS (>160 chars) is supported via SMPP UDH but requires provider enablement; expect per-segment billing.
- Audit trail. Enable TCSB audit logging and forward the log to a central SIEM; the "submit_sm_resp" line per message is sufficient for compliance review.
12. Performance, Limits, and Best Practices
| Parameter | Limit / recommendation |
|---|---|
| Concurrent SMS in flight per CP | 1 (serialized by the telecontrol stack) |
| SMS throughput TCSB | 30 SMS/min default; up to 600 SMS/min with bulk license |
| TCSB station count | Up to 5,000 stations per V3.5 server |
| TCSB event buffer | 50,000 events on disk (default), expandable |
| GSM-7 message length | 160 characters (single), 153 per segment (concat) |
| UCS-2 message length | 70 characters (single), 67 per segment (concat) |
| Permanent connection keepalive | 60 s (default), tuned to 30 s on poor links |
For deeper background on the telecontrol CPs and their S7-1200 integration, see the Telecontrol CPs overview in the SIMATIC S7-1200 manual collection, and the SMS-specific sample program documented in Siemens support entry 58638283.
What is the default TCP port for the S7-1200 telecontrol connection to TCSB?
TCP 2777 is the default and must be opened outbound from the SCALANCE M875 to the TCSB public IP. Change it only if your control-center firewall blocks 2777, and update both sides to match.
Which firmware must the CP 1242-7 run to send SMS through TCSB?
Use firmware V3.3.x or higher on the CP 1242-7 (article 6GK7242-7KX30-0XE0). TIA Portal V16 Update 4 or higher is required to download this firmware, and the CP firmware must be upgraded before downloading the configuration.
How is the 32-byte authentication key generated and verified?
The key is generated once in TIA Portal under the CP 1242-7 telecontrol properties and is stored in the project. TIA Portal's "Export telecontrol configuration" writes the same key into the .tcs import file used by TCSB. The key must match byte-for-byte; retype errors cause STATUS 80A2 ("Authentication failed") at runtime.
Can the CPU 1212 send SMS without a CP 1242-7?
No. The telecontrol stack and the GSM/LTE physical interface live on the CP 1242-7 or CP 1243-7. The CPU 1212 has no integrated modem and no SMS instruction set of its own; it relies on the CP for the SMS path and only exchanges data with the CP via the backplane.
What SMS status word indicates the message reached the operator's SMSC?
TC_SMS STATUS 0000 with DONE TRUE confirms the CP handed the message to TCSB. The SMPP-level confirmation (submit_sm_resp OK) is visible in the TCSB event log; the mobile-termination receipt from the operator requires your SMSC provider's delivery receipt feature and is not part of the S7-1200 STATUS word.
Why does my SMS take 30 seconds or longer even though the link is "permanent"?
Check that the CP telecontrol "Connection mode" is set to Permanent (always online), not On demand. With On demand, the CP tears down the TCP socket after the keepalive timeout and must re-establish it before each message, adding 20–60 s of latency.
Can I send Unicode (e.g. Cyrillic, Chinese) SMS from the S7-1200?
Yes. Configure the TCSB SMPP binding with UCS-2 encoding and supply the text in UCS-2 (or in a STRING the FB converts internally). Note that UCS-2 messages are limited to 70 single-segment characters, not 160.