Problem Overview
When publishing MQTT data from a SIMATIC S7-1500 CPU to AWS IoT Core using the Siemens LMqtt_Publisher (or LMqttqdn variant) from the open-communication library referenced in Siemens Support entry 109748872 – "MQTT client for S7-1200/S7-1500", the FB returns error 80E4 on the status output even though the same X.509 certificates function correctly in external test clients such as MQTT.fx.
LMqtt_Publisher.status = 16#80E4 (decimal 32996). No CONNECT packet reaches the AWS IoT endpoint. TCP connect succeeds (port 8883), but TLS handshake fails at the certificate stage. mqtt.fx or aws-iot-device-sdk-v2 with the same *.pem.crt + *-private.pem.key pair works without modification.The error class 80E_ maps to the TLS/certificate processing layer inside the S7-1500 user-communication firmware. The lower 12 bits identify the specific certificate processing sub-state; 80E4 is the "certificates configured but trust chain / role assignment invalid" branch of the certificate manager.
Root Cause Analysis
Three independent defects combine to produce 80E4 on a fresh deployment:
-
Format defect: The PLC certificate store accepts only
PKCS#12 (.p12)bundles or pre-imported Siemens certificates. AWS IoT issues*.pem.crt+*-private.pem.keyin PEM form. They must be packed into a single .p12 container with OpenSSL before they can be associated with the CPU. - Role-mapping defect: TIA Portal's certificate manager distinguishes "Certificate of partner devices" (the broker's chain) and "Device certificates" (the CPU's own identity). Swapping these two roles — or assigning only one of them — is the most common cause of 80E4.
-
Subject-Alt-Name defect: The
validateSubjectAlternateNameOfServerflag intcpConnParamsmust reflect the AWS endpoint FQDN (for examplexxxxxxxxxxxxxx-ats.iot.eu-central-1.amazonaws.com). If the PLC cannot resolve the SAN, the handshake is aborted even though the chain is valid.
The combination of all three defects produces 80E4. Fixing any single defect still leaves the connection failing with a different TLS sub-error, so all three must be corrected in the order documented below.
Prerequisites
- SIMATIC S7-1500 CPU with firmware V2.5 or higher (open-communication TLS requires V2.0+; mutual TLS with X.509 chains is stable from V2.5; recommended V2.9.x for current TIA Portal V16/V17 compatibility).
- TIA Portal V16 or higher (Basic or Professional). V15.1 archives are read-only on V16, which is a frequent stumbling block when reusing example projects.
-
LMqtt_Publisher / LMqttqdn_Publisher FB library (current version 2.0.x; check the version column in the "Instructions" task card and use the latest revision of every
TCON,TSEND,TDISCONblock used inside the FB). - OpenSSL 1.1.1 or 3.x (Windows binaries from Shining Light Productions or built into Git for Windows).
- AWS IoT Core Thing already created with attached certificate and active policy. Required downloads from the AWS IoT console (Secure → Certificates → your certificate):
-
xxxxxxxxxx-certificate.pem.crt— device certificate -
xxxxxxxxxx-private.pem.key— device private key -
xxxxxxxxxx-public.pem.key— device public key (used for verification, not loaded into the PLC) - Amazon Root CA — see AWS IoT Core server authentication documentation. The current recommended CA for new deployments is Amazon Root CA 1; download from https://www.amazontrust.com/repository/AmazonRootCA1.pem.
-
- DNS server reachable from the CPU (use 8.8.8.8 or the plant DNS forwarder; the S7-1500 must resolve the AWS endpoint hostname for SAN matching).
Step 1 — Acquire and Validate AWS IoT Certificates
From the AWS IoT console, navigate to Manage → All devices → Things → <your thing> → Certificates. Download:
- The device certificate PEM file.
- The private key PEM file. Never re-download after the initial creation; AWS only stores the private key at creation time. If it was not saved, rotate the certificate.
- The Amazon Root CA 1 from the official trust repository.
Verify the certificate chain locally before touching the PLC:
openssl x509 -in xxxxxxxxxx-certificate.pem.crt -text -noout
openssl verify -CAfile AmazonRootCA1.pem xxxxxxxxxx-certificate.pem.crt
A successful verify returns xxxxxxxxxx-certificate.pem.crt: OK. If verification fails, the certificate was issued by an older CA chain (Starfield G2, VeriSign G3, etc.) — re-select the correct root CA per the AWS IoT server authentication reference.
Step 2 — Convert PEM to PKCS#12 with OpenSSL
The TIA Portal certificate manager imports a single .p12 file per device identity. Combine the device certificate and its private key into one encrypted container:
openssl pkcs12 -export \
-in xxxxxxxxxx-certificate.pem.crt \
-inkey xxxxxxxxxx-private.pem.key \
-out aws-thing.p12 \
-name aws-thing-cert \
-CAfile AmazonRootCA1.pem \
-caname amazon-root-ca-1 \
-chain
Flags used:
-
-export— emit PKCS#12. -
-in— device certificate. -
-inkey— device private key (PEM, RSA 2048-bit typical). -
-name— friendly name visible in the TIA Portal certificate manager. -
-CAfile/-caname/-chain— embed the issuing CA inside the bundle so the PLC can present a complete chain when mutual TLS is requested.
OpenSSL will prompt for an export password. The password is required at import time in TIA Portal. Use a strong password (≥ 16 chars) — it is stored in the TIA Portal project, not on the PLC, so complexity matters less than traceability. Do not add -passout pass: in production; the password is echoed to the shell history.
Validate the resulting file:
openssl pkcs12 -in aws-thing.p12 -info -nokeys -nodes | head -40
Confirm that -----BEGIN CERTIFICATE----- appears twice (device + CA) and that -----BEGIN PRIVATE KEY----- or -----BEGIN RSA PRIVATE KEY----- is present.
Step 3 — TIA Portal Certificate Manager Configuration
Open the project, then Project tree → Security → Certificate manager. The Siemens documentation "Using the TIA Portal certificate manager" describes the manager in detail. The configuration below assumes global certificate manager; the project-local manager exposes the same fields but is scoped to the active project only.
-
Import the Amazon Root CA 1. Right-click Trusted certificates and root certificate authorities → Import → select
AmazonRootCA1.pem. Set the usage to "TLS server certificate". The default issuer name is "Amazon / Starfield Services"; leave it untouched. -
Import the device certificate (P12). Right-click Device certificates → Import → select
aws-thing.p12. Enter the export password from Step 2. TIA Portal will create two entries: the device certificate and the embedded CA chain. -
Assign the certificate to the CPU. In the project tree, open Devices & networks → <S7-1500 CPU> → Properties → Security → Certificate manager. Two fields are mandatory:
- Certificate of partner devices → select the Amazon Root CA 1 entry.
- Device certificate → select the aws-thing-cert entry (the one bound to the device's own key).
- Compile the project and download the hardware configuration. The certificate IDs are now stored in the CPU; record the two numeric IDs — they are required for the data block in Step 4.
8883 endpoint. Swapping the two assignments is the most common reason for 80E4 because the CPU then presents the server's CA as its own identity, and AWS rejects the handshake.Step 4 — LMqtt_Publisher Data Block Configuration
Open the instance DB generated by the LMqtt_Publisher FB. The tcpConnParams structure is the only place where the certificate IDs, port, broker, and DNS are wired together. Populate it exactly as follows:
| DB element | Type | Value (example) | Notes |
|---|---|---|---|
connectType |
BOOL | TRUE | 1 = new connection, 0 = re-use existing |
ipVersion |
USINT | 4 | IPv4 (set to 6 only if AWS endpoint is reached via IPv6) |
port |
UINT | 8883 | AWS IoT TLS listener |
broker |
STRING[255] | 'xxxxxxxxxxxxxx-ats.iot.eu-central-1.amazonaws.com' | For LMqttqdn variant only; leave empty for LMqtt_Publisher |
HW_ID |
HW_IO | 269 | Hardware identifier of the PROFINET interface on the CPU |
validateSubjectAlternateNameOfServer |
BOOL | TRUE | Matches the AWS endpoint FQDN against the server certificate SAN |
idTlsServerCertificate |
UDInt | Amazon Root CA 1 ID from Step 3 | This is the partner certificate |
idTlsOwnCertificate |
UDInt | aws-thing-cert ID from Step 3 | This is the device certificate |
Observed status
|
Layer | Likely cause | Corrective action |
|---|---|---|---|
16#80E4 |
TLS / certificates | Wrong role mapping, P12 without chain, expired CA | Re-do Step 2 and Step 3; confirm OpenSSL -chain was used |
16#80E2 |
TLS / certificates | Own certificate missing or not yet downloaded to CPU | Re-download hardware configuration; verify certificate manager shows the P12 in green |
16#80E1 |
TLS / certificates | CPU firmware older than V2.0 on the affected interface | Update CPU firmware; TIA Portal will only allow TLS on CPUs V2.0+ |
16#80C3 |
TCP / DNS | DNS resolution failure or unreachable broker | Use Connection diagnostics for a raw TCP test on port 8883 |
16#80A7 |
TCP / port | Port 8883 blocked by firewall | Allow TCP/8883 to *.iot.<region>.amazonaws.com
|
16#80A1 |
TCP / interface | Wrong HW_ID
|
Inspect PROFINET interface properties for the hardware identifier |
16#0000 but no AWS message |
AWS / authorisation | Policy allows Connect but not Publish | Update IAM policy; check CloudWatch AWSIoTLogs |
| TLS error inside the ServerHello phase | S7-1500 firmware | Cipher suite mismatch | CPU firmware < V2.6 only offers TLS 1.0/1.1; AWS requires TLS 1.2 minimum. Update to V2.9.x |