Overview of the CP 1242-7 GPRS V2
The 6GK7242-7KX31-0XE0 CP 1242-7 GPRS V2 is Siemens' quad-band GSM/GPRS communications processor for the SIMATIC S7-1200 family. It plugs into the left bus of an S7-1200 CPU (firmware V2.2 or later) and provides a wireless path for TCP/IP, UDP, SMTP, and SMS traffic from the PLC program to mobile networks. For SMS-only applications, the module removes the need for an external GSM modem and serial cable: the program writes the message text in TIA Portal and the CP handles AT-command framing, SMSC routing, and PDU encoding.
This article walks through the full commissioning flow: hardware insertion, SIM handling, TIA Portal device configuration, the TC_SMS / TC_CON block parameters from the SIMATIC S7-1200 CP 1242-7 SMS / email library, and the SMSC (in Spanish: CSMS — Centro de Servicios de Mensajes Cortos) values required by the major Chilean mobile carriers. It supplements the official Siemens manual set — see the CP 1242-7 GPRS V2 Operating Instructions (English, edition 76) and the Manual de instrucciones CP 1242-7 V2 (Spanish, edition 78) — with the field-specific configuration details that the manual assumes are already known.
Key Specifications
| Parameter | Value |
|---|---|
| Article number (MLFB) | 6GK7242-7KX31-0XE0 |
| Frequency bands | GSM 850 / 900 / 1800 / 1900 MHz (quad-band) |
| GPRS class | Multi-slot class 10 (4Rx / 2Tx max) |
| SMS mode | PDU per GSM 03.40 / 03.38 |
| SIM interface | 1.8 V and 3 V mini-SIM (2FF) |
| Antenna connector | SMA female, 50 Ω |
| Power draw | Typical 200 mA @ 24 V DC, max 360 mA during TX burst |
| Backplane bus | Left-side S7-1200 I/O bus (slot 101, left of CPU) |
| Configuration software | TIA Portal V13 SP1 Update 4 or later; V14, V15, V15.1, V16, V17 supported |
| Required CPU firmware | S7-1200 CPU V2.2 or higher |
| Required library | "SIMATIC S7-1200 SMS / Email" ≥ V1.1 (TIA Portal global library) |
| CMs / CPs per S7-1200 | 1 (CM 1241 RS-xxx and CP 1242-7 cannot coexist on the same CPU stack) |
Prerequisites
-
Hardware
- S7-1200 CPU V2.2 or later, with one free slot to the left of the CPU (slot 101).
- Active mini-SIM (2FF) from a GSM/GPRS carrier with SMSC (CSMS) service enabled. The SIM PIN must be known — the CP can be configured with PIN = 0 ("no PIN") if the SIM is unlocked in a handset, but storing the PIN in the project is more robust against field SIM swaps.
- GSM antenna with SMA male connector. The Siemens 6NH9860-1AA00 quad-band antenna or any equivalent 50 Ω antenna with VSWR < 2.5:1 across the 900/1800 MHz bands is sufficient.
- 24 V DC supply wired to the CPU (the CP draws power through the bus; no separate terminals).
-
Software
- TIA Portal V14 SP1 minimum; V15, V15.1, V16, or V17 recommended for current libraries and HSPs.
- Siemens Support Package "SIMATIC S7-1200 CP 1242-7 SMS / Email" installed from Options > Manage Support Packages. Library version 1.1 (or later) is required to expose TC_SMS_4 / TC_CON_4 blocks under S7-1200 targets.
- HSP (Hardware Support Package) for the CP installed — the current HSP for your TIA Portal version unlocks the device in the hardware catalog at Communications modules > CP 1242-7. After installing, restart TIA Portal.
-
Network parameters from the carrier
- APN string (for GPRS keep-alive; SMS works even if APN is wrong, but TCP/UDP traffic will not).
- SMSC phone-number address (for Movistar, Entel, Claro, WOM Chile — see the dedicated section below).
Hardware Installation
- Power down the S7-1200 and remove the 24 V connector. The CP is hot-pluggable in theory, but Siemens recommends powering down to avoid bus-arbiter glitches on the first insertion.
- Remove the CPU door (the left-side blank cover) by pressing the release tab at the top and pulling outward.
- Insert the CP in the slot immediately to the left of the CPU. The connector engages with the bus tabs on the back of the CPU. Apply firm, even pressure until the latch clicks.
- Insert the SIM in the front-access SIM holder with the chamfered corner matching the silkscreen. Do not insert the SIM while power is on — the CP does not re-read the SIM hot.
- Attach the GSM antenna to the SMA connector on the top of the CP. Hand-tight only; over-torquing the SMA damages the bulkhead mount.
-
Apply 24 V and observe the front-panel LEDs:
- PWR — solid green after roughly 3 s.
- NET — flashes green while searching, becomes solid green when registered on the GSM network.
- DIAG — red at boot, clears within 5 s if no fault is present.
TIA Portal Device Configuration
Once the CP is in the rack at slot 101, TIA Portal exposes a properties tree. The SMS path is short — only three branches need attention.
- Device view > CP 1242-7 > Properties > "Web server access" — leave disabled. The web server is not required for SMS and only opens an attack surface.
-
Properties > "Mobile wireless settings":
- SIM PIN: enter the SIM PIN if the SIM is locked.
- Access point name (APN): leave blank for pure-SMS operation; fill with the carrier's APN only if you also want TCP/UDP or e-mail.
- Authentication: None for most Chilean carriers (Movistar, Entel, Claro all accept PAP/None for SMS-only SIMs).
- Properties > "Time-of-day synchronization" — disable. The CP does not need NTP for SMS, and disabling this prevents background GPRS dial attempts.
- Properties > "Security" — set the access password for the CP web pages only if you enabled the web server in step 1.
Installing the SMS / Email Library and Block Architecture
The TC_SMS_4, TC_CON_4, TM_MAIL_4, and TC_MAIL_4 function blocks are not in the standard TIA Portal instruction tree. You must install and open the global library:
- Options > Global libraries > Open library and select "SIMATIC S7-1200 SMS / Email".
- Drag the "Masters" > CP_1242_7_xx master copy into your project under Program blocks > System blocks > Library blocks.
- Place the call in a new FB, OB1, or OB35 as required. The library ships an instance DB; do not delete it.
Block roles:
- TC_SMS_4 — sends a single PDU-encoded SMS to a destination number, optionally overriding the project SMSC. This is the block you need for plain SMS.
- TC_CON_4 — opens / maintains an IP socket (TCP or UDP) between the CP and a remote server. Used for telemetry, not SMS. Required only if you also want a keep-alive data path.
- TC_DISCONNECT_4 — closes an open TC_CON_4 socket.
- TC_SMS_4 + TC_CON_4 in series — common for SCADA gateways that send a TCP packet and a confirming SMS on a single alarm event.
TC_CON Block: Connection Description
For SMS in the V2 firmware, the connection is implicit — the CP opens an internal link to the carrier's SMSC when TC_SMS_4 fires and tears it down after ACK. You do not normally call TC_CON_4 for an SMS path. However, the source thread surfaces a recurring failure: the TCON_WDC connection-description data block (used when you do want a TCP keep-alive socket to your own server) was declared as a scalar tag instead of a TCON_IP_V4 struct, so the FB kept returning STATUS = 16#80C8 ("Connection not configured").
The correct declaration in the FB static area is:
VAR
tcon_wdc : TCON_IP_V4; // connection description structure
sHostIp : STRING[15] := '192.168.1.50';
wHostPort : WORD := WORD#16#2300;
iConnect : INT;
END_VAR
Where:
| TCON_IP_V4 field | Required value | Meaning |
|---|---|---|
| InterfaceId | 16#0001 | Always 1 for the CP 1242-7 |
| ID | 16#0001..16#00FF | Local connection ID; must match TC_CON_4.ID |
| ConnectionType | 16#0B (TCP) or 16#0C (UDP) | Transport protocol |
| ActiveEstablished | TRUE for client, FALSE for server | Role of the local CP |
| RemoteAddress.ADDR[1..4] | e.g. 192,168,1,50 | Remote IPv4 octets (byte-by-byte, MSB = octet 1) |
| RemotePort | e.g. WORD#16#2300 (port 8960) | Remote TCP port (host byte order) |
| LocalPort | 0 for client | Local port (auto-assigned if 0) |
TC_SMS_4 Block: Sending a Text Message
The TC_SMS_4 block interface is the only one you need for plain SMS. Its REQ input is a rising-edge trigger; the block returns a "busy" status, completes in 4–8 s, and writes the result to its STATUS / STATUS_ID outputs.
| Pin | Type | Description |
|---|---|---|
| REQ | BOOL | Rising-edge start. Must be pulsed, not held. |
| ID | BYTE | Local connection ID (1..255). Must match the project value. |
| PHONE | STRING[20] | Destination number, E.164 format, e.g. '+569XXXXXXXX' |
| TEXT | STRING[160] | Message body. Max 160 GSM-7 chars or 70 UCS-2 chars. |
| SMSC | STRING[20] | Service-center address. Optional if configured in the project. |
| DONE | BOOL | TRUE for one cycle on success. |
| BUSY | BOOL | TRUE while the CP is still transmitting. |
| ERROR | BOOL | TRUE on any error. |
| STATUS | WORD | Local block status (16#0000 = OK, 16#7000 = no job, 16#80xx = error). |
| STATUS_ID | DWORD | CP-remote status; see diagnostics section. |
For a periodic heartbeat to a fleet of operators, the call in OB1 looks like this in Structured Text:
// TC_SMS_4 call — every 60 s
IF "heartbeat_1Hz" AND NOT "sms_block_busy" THEN
"sms_block_busy" := TRUE;
TC_SMS_4.REQ := TRUE;
TC_SMS_4.ID := 1;
TC_SMS_4.PHONE := '+56912345678';
TC_SMS_4.TEXT := 'Pump 1 trip. VFD 0.5 Hz below setpoint.';
TC_SMS_4.SMSC := ''; // use project SMSC
TC_SMS_4(REQ := FALSE); // clear REQ
TC_SMS_4(REQ := TRUE); // re-trigger the FB
END_IF;
IF TC_SMS_4.DONE OR TC_SMS_4.ERROR THEN
"sms_block_busy" := FALSE;
END_IF;
Sample Project Skeleton
For a typical alarm-routing application in a Chilean water-pump station, lay out the blocks as follows:
- OB1 (Main) — call FB_SmsDispatcher once per cycle.
- FB_SmsDispatcher (FB100) — instance DB100; scans a UDT of 16 alarm tags, generates a "PUMP nn FAULT" string, calls TC_SMS_4 once per pending alarm with a 60 s debounce.
- FB_BuildText (FB101) — formats the message; uses CONCAT and DINT_TO_STRING from the standard library to embed runtime data.
- DB_AlarmList (DB110) — array [1..16] of UDT_AlarmRecord: tag name, phone, last-sent timestamp, debounce count.
- TC_SMS_4 — single instance, called from FB_SmsDispatcher. The instance DB is created by the library automatically.
A minimal FB100 skeleton in Structured Text:
FUNCTION_BLOCK "FB_SmsDispatcher"
VAR
i : INT;
tnow : TIME;
fbSms : TC_SMS_4;
END_VAR
BEGIN
tnow := TIME_TCK();
FOR i := 1 TO 16 DO
IF "DB_AlarmList".rec[i].Active AND
(tnow - "DB_AlarmList".rec[i].tLastSent > T#60s) THEN
"DB_AlarmList".rec[i].tLastSent := tnow;
fbSms(REQ := TRUE,
ID := 1,
PHONE := "DB_AlarmList".rec[i].phone,
TEXT := 'PUMP FAULT: ' + "DB_AlarmList".rec[i].tag,
SMSC := '');
END_IF;
END_FOR;
END_FUNCTION_BLOCK
SMSC (CSMS) Configuration for Chilean Carriers
The user reported a configuration failure attributed to the CSMS (Spanish abbreviation for SMSC) for Chile. The CP needs a valid service-center address in +CCxxxxxxxxxx format to reach the carrier's SMS router. The commonly published SMSC values for the three Chilean carriers and the 4G newcomer WOM are:
| Carrier | SMSC address (project field) | Notes |
|---|---|---|
| Movistar Chile | +56917000170 | Older value +56917000017 is also accepted by some legacy SIMs. |
| Entel PCS | +56966000030 | Same prefix as some legacy "Banda Ancha Móvil" SIMs. |
| Claro Chile | +56919000030 | Often suffixed with /*TYPE=PLMN on legacy Nokia handsets; the CP does not need the suffix. |
| WOM Chile | +56965300005 | Valid since 2016; verify with the carrier before deploy. |
Steps to apply:
- In the TIA Portal device view, select the CP and open Properties > "SMS".
- Set "Service center address can be set by the program" to No if you want a single global SMSC for the project, or Yes if you intend to override per call.
- If No: enter the SMSC for your carrier in the "Service center address" field.
- If Yes: pass the SMSC as a parameter to TC_SMS_4.SMSC and leave the project field blank.
Phone Numbers and Message Encoding Rules
The CP uses the E.164 international format. Rules for Chile:
- Country code: +56.
- Mobile numbers: +56 9 XXXXXXXX — the 9 is part of the mobile numbering plan, not a trunk prefix.
- Landline numbers: +56 X XXXXXXX (no mobile "9" prefix).
- Leading zeros: do not include the "0" used to dial locally; the "+56" replaces it.
Example: a Movistar mobile you would dial nationally as 09 1234 5678 becomes +56912345678 in TC_SMS_4.PHONE.
Message length and character encoding:
- GSM-7 default alphabet: 160 characters per single SMS. Siemens recommends keeping messages under 153 characters to avoid silent truncation if the carrier prepends a UDH (e.g. multipart).
- UCS-2 (Unicode, e.g. accented Spanish or emoji): 70 characters max. The CP auto-detects UCS-2 if the text contains any character outside the GSM-7 set.
- Concatenation: the CP does not concatenate segments above 160 / 70 chars — the message is truncated and the STATUS = 16#80E1 ("Text too long") is returned.
Diagnostics, STATUS_ID Codes, and Common Pitfalls
| LED / STATUS_ID | Meaning | Remediation |
|---|---|---|
| PWR off | No 24 V to backplane | Check PM1207 output, verify the backplane connector. |
| NET slow flash (200 ms on / 1800 ms off) | Searching / SIM PIN error | Verify SIM PIN in project matches the SIM. |
| NET off, DIAG red | Hardware fault | Power cycle; if persistent, swap CP. |
| STATUS = 16#7000 | No job pending | Expected idle state. |
| STATUS = 16#80C7 | Bad parameter | Check TCON_IP_V4 octet order, ID range. |
| STATUS = 16#80C8 | Connection not configured | Re-check the project is compiled and downloaded to the CP, not just the CPU. |
| STATUS_ID = 16#80E0 | SMSC unknown | Set the SMSC field in project or in TC_SMS_4.SMSC. |
| STATUS_ID = 16#80E1 | Text too long | Trim to 160 / 70 chars. |
| STATUS_ID = 16#80E2 | Number malformed | Use E.164 format starting with "+". |
| STATUS_ID = 16#80E3 | Network failure / no SIM / no coverage | Check NET LED, antenna VSWR, SIM registration. |
| STATUS_ID = 16#80E4 | SIM busy / SMS store full | Power-cycle CP; check for stuck PDUs in the carrier's store-and-forward. |
| STATUS_ID = 16#80FF | Internal CP error | Update firmware; otherwise RMA. |
| Symptom | First check | Second check | Likely cause |
|---|---|---|---|
| NET LED never solid | Antenna and SIM | SIM PIN error in project | Wrong PIN / locked SIM |
| TC_SMS_4.ERROR immediately on REQ | STATUS_ID | Project SMSC field | Missing SMSC |
| STATUS = 16#80C8 | Project compile & download | TCON_IP_V4 declaration | DB type mismatch |
| Message sent but recipient gets nothing | Recipient's phone | Carrier SMSC routing | Wrong SMSC for that SIM's carrier |
| Some messages OK, others fail with 16#80E1 | Text length | Character set | Multi-byte GSM-7 extension chars |
| Module hot-resets when sending | PM load | Backplane current | Power supply undersized |
Field-deployment pitfalls observed in the field:
- APN without GPRS context. SMS works on the GSM control channel and does not need an APN. Many engineers enter a wrong APN, watch the CP "fail to attach" in the diagnostic tab, and conclude SMS is broken. The APN is only needed for TCP/UDP/SMTP paths.
- M2M APN vs consumer APN. Some Chilean carriers issue M2M SIMs on private APNs that route SMS to a different SMSC. If your consumer SIM works but the M2M SIM does not, ask the carrier for the M2M-specific SMSC.
- Multiplexing CP and CM. A S7-1200 CPU supports either a CM 1241 (RS-232/485) or a CP 1242-7 in the left stack, not both. Trying to add both at slot 101 will fail to compile.
- Firmware compatibility. Recent HSPs may require CPU firmware V4.4 minimum for some features. If you upgrade TIA Portal but not the CPU firmware, the CP can appear in the catalog but fail to download with "Target firmware not supported".
- SMSC for international roaming. When the SIM roams, the home SMSC still routes. The CP does not automatically pick up a visited-network SMSC; the value configured in the project (or in the TC_SMS_4 call) always wins.
Verification and Acceptance Test
- Compile the project and download the hardware configuration to the S7-1200. TIA Portal must be told to load to "PLC_1" with the CP as a target — the CP has its own firmware partition.
- Go online and select the CP. Online > Diagnostics > "Mobile wireless diagnostics" should show "Registered, Home network" within 30 s.
- Force a test message by writing a one-shot REQ to TC_SMS_4.PHONE = your own mobile number.
- Check the destination phone within 8 s. Latency is typically 3–5 s; failure mode is 20 s timeout.
- Confirm in the online block view that STATUS_ID = 16#0000 after DONE = TRUE.
- Repeat with TC_SMS_4.SMSC = empty to validate the project-level SMSC, then with TC_SMS_4.SMSC = the carrier address to validate the per-call override.
- Field test with the actual M2M SIM (not the bench SIM).
Acceptance test checklist:
- ✅ NET LED solid green within 60 s of power-up.
- ✅ TIA Portal Mobile wireless diagnostics reports "Registered, Home network".
- ✅ Test SMS to operator's own phone returns within 8 s.
- ✅ TC_SMS_4.STATUS = 16#0000, STATUS_ID = 16#0000 after DONE.
- ✅ Project file archived with HSP version, library version, and CP firmware version stamped into the project properties.
For firmware updates and recovery: if STATUS_ID = 16#80FF recurs and the CP does not recover after a power cycle, reflash the firmware via the SIMATIC Automation Tool or via Online > Accessible devices > CP > "Online & diagnostics" > "Firmware update" in TIA Portal. A corrupt firmware can be recovered by holding the service button for 10 s during power-up — this forces a bootloader reboot from the on-board image. The CP does not lose its project on firmware update; only the APN and PIN are preserved.
Frequently Asked Questions
What is the correct TC_SMS_4 ID range, and why does STATUS = 16#80C8 appear?
The ID must be in the range 1..255 (BYTE) and must match the connection ID configured in the CP's project. STATUS = 16#80C8 ("Connection not configured") almost always means the project was compiled but not downloaded to the CP, or the ID typed at the call site does not match the project value byte-for-byte. Re-trigger a download to the CP target and re-check the ID field.
Why does the CP register on the network but TC_SMS_4 returns 16#80E0 ("SMSC unknown")?
The SMSC is stored separately from the APN. If "Service center address can be set by the program" is set to No, the value in Properties > SMS > Service center address must be filled. If it is set to Yes, the value passed to TC_SMS_4.SMSC must be filled. Both blank = STATUS_ID = 16#80E0.
Can the same CP 1242-7 V2 send SMS and act as a TCP server at the same time?
Yes, but the TCP path requires the APN to be reachable and a GPRS context to be active. The SMS path is independent of GPRS attach, so a fault on the data path does not block SMS. In some carrier configurations, however, the SMSC and the data APN are on different network slices, so simultaneous SMS and TCP traffic can show independent delays.
What SMSC value should I use for Movistar, Entel, Claro, or WOM in Chile?
Common values: Movistar +56917000170, Entel +56966000030, Claro +56919000030, WOM +56965300005. Always confirm with the carrier's M2M helpdesk before deployment — operators may change SMSC addresses and may gate them by SIM type (consumer vs. M2M).
Do I need an APN configured for SMS-only operation?
No. SMS in GSM rides on the signalling channel (SDCCH/SACCH) and does not need a packet-data context. The APN field can be left blank if the application is SMS-only. Fill it in only if the same CP will also be used for TCP/UDP, SMTP, or HTTPS traffic.
How do I send a Unicode (Spanish accented) message?
Include the accented character in the TEXT string. The CP detects any character outside the GSM-7 base table and switches the encoding to UCS-2 automatically, dropping the message limit to 70 characters (or 80 if the text uses the GSM-7 extension table). If your text contains both GSM-7 and UCS-2 characters, the CP encodes the whole message as UCS-2.
Can I add a CP 1242-7 V2 next to a CM 1241 RS-485 on the same CPU?
No. The S7-1200 left bus supports a single communications module or processor at slot 101. To add both, drop one of them or move the second one to a different CPU on the same network. Mixing them at the same slot will fail to compile with a configuration error.
Why is my TC_CON_4 call returning 16#80C8 even though the IP and port are correct?
The most common cause is that the connection-description variable was declared as a plain BOOL or WORD instead of the TCON_IP_V4 structure. The FB needs a TCON_IP_V4-typed tag to read the interface ID, connection ID, octet-by-octet remote address, and ports. Re-declare the variable in the FB static area with the correct type and reload the project.