Resolving S7-1500 OPC UA Client Error 0x8012_0000 in TIA V16

David Krause9 min read
OPC / OPC UASiemensTroubleshooting
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

Problem Overview

When commissioning an S7-1500 CPU as an OPC UA Client in TIA Portal V16 Update 4, the instruction block (SFB "OPC_UA_Connect") may complete with BUSY = 0 and ERROR = 1, refusing to establish the secure channel to the target server even though tag import succeeds in the editor. The CPU returns the following diagnostic triple on the connection instance DB:

  • OPCUA_Status = 16#8601 — generic "Error during connect" wrapper reported by the FB layer.
  • OPCUA_Diag_Status = 16#8601 — identical wrapper, propagated from the lower stack.
  • OPCUA_Diag_Subfunction_Status = 16#8012_0000 — the actual root-cause status code from the OPC UA stack.

On its own, the manual only documents the outer 16#8601 code. Decoding the subfunction code is the key to a real fix: 16#8012_0000 maps to OPC UA standard status code BadCertificateInvalid (numeric value 0x80120000), meaning the certificate the client has been asked to trust is rejected by the runtime as malformed, expired, not yet valid, or self-signed without an installed trust anchor.

Important: The "16#" prefix in TIA Portal is a hexadecimal literal indicator. The value 0x80120000 is the literal numeric part of the OPC UA specification status code BadCertificateInvalid, defined in OPC UA Part 4. Do not strip the upper word — the low word 0x0000 is the standard code and the high word 0x8012 is the OPC UA namespace segment.

Affected Hardware and Software

Component Identifier / Version Notes
CPU 6ES7 516-3FN01-0AB0 (CPU 1516F-3 PN/DP) F-variant, fail-safe; OPC UA client capability requires firmware ≥ V2.8
CPU firmware V2.8.x or V2.9.x recommended OPC UA client is a licensed/feature-gated function on the S7-1500; firmware ≥ V2.8 is mandatory
Engineering system TIA Portal V16 Update 4 (or later V16 update) Behavior identical through V17/V18 unless otherwise noted
OPC UA client FB set OPC_UA_Connect, OPC_UA_Disconnect, OPC_UA_NamespaceGetIndexList, OPC_UA_ReadList, OPC_UA_WriteList, OPC_UA_MethodCall Distributed with TIA V16, located in the global library under "OPC UA Client"
Target server example S7-1200 (CPU 1214C, 1215C, 1217C) V4.4+ with OPC UA server activated, or CP 1543-1 V2.2+ Server-side certificate must also be valid and trusted at the client

Error Code Decoding

The OPC UA status triple is hierarchical. Always read the subfunction status first; the outer two words are usually just the wrapper from the FB layer.

Output parameter Observed value Meaning
OPCUA_Status (FB layer) 16#8601 Connection could not be established — see diagnostic sub-status
OPCUA_Diag_Status (FB layer) 16#8601 Same wrapper, propagated from stack call
OPCUA_Diag_Subfunction_Status 16#8012_0000 BadCertificateInvalid (OPC UA Part 4, status code table)

The high word 0x8012 identifies the OPC UA communication segment, while the low word 0x0000 is the symbolic index. The 0x8012_xxxx namespace is reserved by the OPC UA specification and is implemented verbatim in the SIMATIC OPC UA stack. A complete decoder is part of every OPC UA client DB instance as a comment block; the relevant OPC UA Part 4 status codes most often seen on a 1516F client are listed in the next section.

Common OPC UA Subfunction Codes

Status code (hex) Symbolic name Typical trigger on S7-1500
0x80120000 BadCertificateInvalid Server cert is malformed, expired, not yet valid, or wrong key usage
0x80130000 BadCommunicationError TCP/TLS handshake failed — usually firewall, wrong port, or unsupported SecurityPolicy
0x80140000 BadTimeout Server did not respond within the configured request timeout
0x80150000 BadSecurityPolicyRejected Client and server do not share a SecurityPolicy (e.g., None vs. Basic256Sha256)
0x801F0000 BadUnexpectedError Internal stack fault — contact Siemens support with the diagnostic buffer
0x80200000 BadRequestTimeout FB ran longer than its own watchdog; increase instance DB timeout parameter
0x80250000 BadServerUriInvalid ApplicationDescription.ApplicationUri does not match the server's certificate URI

Root Cause Analysis

During tag import, the TIA Portal editor uses the developer's local Windows certificate store and accepts the server certificate transiently. At runtime, the CPU holds its own certificate store in the project file system under System Memory > OPC UA, and the runtime OPC UA stack validates the server's certificate against the trust list in Global security settings > Certificate manager of the CPU. The 0x80120000 response means one of the following is true:

  1. The server certificate has not been installed into the CPU's trusted certificate store before download.
  2. The certificate was installed but the project was recompiled and downloaded without re-including the certificate folder, wiping the runtime trust list.
  3. The server certificate's validity window has expired or is not yet valid (clock drift between the engineering station and the PLC, or the server has been recertified).
  4. The server certificate uses an unsupported signature algorithm (e.g., MD5 or SHA-1) rejected by the OPC UA stack on the S7-1500.
  5. The client identity certificate (instance certificate of the OPC UA client on the 1516F) is missing or self-signed, so the server cannot verify the client's application URI during the OpenSecureChannel call.

Prerequisites

  • TIA Portal V16 Update 4 or later installed with the S7-1500 support package.
  • CPU 1516F-3 PN/DP online connection via PN/IE.
  • OPC UA server project with at least one exported DER (binary) certificate file, .der, for the server.
  • PLC has an OPC UA client runtime license available (CPU 1516F carries OPC UA client capability as standard from firmware V2.8 onward; verify under CPU properties → OPC UA → Runtime licenses).

Solution: Install and Trust the Server Certificate

The fix is to install the server certificate into the CPU's Trusted Certificates and Root Certification Authorities store and, if mutual TLS is configured, install the client's instance certificate on the server side. The procedure is fully aligned with the official Siemens OPC UA programming guide referenced in the support FAQ 109762770.

Step-by-step certificate trust configuration

  1. Open the S7-1500 project in TIA Portal V16 Update 4 and select the CPU in the project tree.
  2. Navigate to Properties → Protection & Security → Certificate manager.
  3. Switch the view to Trusted certificates and root certification authorities.
  4. Click Add and browse to the server certificate file (DER format, .der, exported from the OPC UA server project). The certificate will appear with issuer, subject, validity dates, and fingerprint.
  5. Confirm with OK. The certificate is now associated with the offline project.
  6. Compile the project (Hardware) and download to the CPU. TIA Portal will also push the trusted certificate to the runtime certificate store during download.
  7. If the CPU was already online and certificates were installed previously, force a Certificate manager → Update on the target system operation via Online → Certificate manager → Update.

Step-by-step client instance certificate configuration

  1. Open Properties → Protection & Security → Certificate manager → Device certificates.
  2. Generate a new client certificate (or import an existing PKI-issued one). Set Application URI to the value referenced in the OPC UA client's connect FB parameter — this URI must match the server's expectation for mutual TLS.
  3. Export the client certificate in DER format and install it in the Trusted store of the OPC UA server project.
  4. Recompile and download the CPU project.
Mutual TLS: The S7-1500 OPC UA client defaults to certificate-based client authentication when the server requires it. Skipping the client certificate exchange yields 0x80150000 or 0x80120000 depending on the server's stack behavior — always populate the client certificate store first, then the server's trust list.

OPC UA Client FB Wiring

The certificate work must be paired with a correct FB call. The minimum sequence in the S7-1500 user program (SCL) is shown below. The connect FB returns busy=0, error=0 when the secure channel is established and the session is open.

// OPC_UA_Connect instance: "dbOpcUaClient"
#dbOpcUaClient(REQ        := TRUE,
               Connection := "OpcUa_Conn_1",
               URI        := 'opc.tcp://192.168.0.20:4840',
               Timeout    := T#5s);

IF #dbOpcUaClient.BUSY = 0 AND #dbOpcUaClient.ERROR = 0 THEN
    // Trigger namespace index resolution
    #dbGetIndex(REQ := TRUE, Connection := "OpcUa_Conn_1");
    // Trigger cyclic read of imported tag list
    #dbReadList(REQ := TRUE, Connection := "OpcUa_Conn_1");
END_IF;

IF #dbOpcUaClient.ERROR = 1 THEN
    // Decoded on the HMI as alarm text
    #sStatusCode  := UINT_TO_STRING(#dbOpcUaClient.OPERATING_STATE);
    #sDiagCode    := UINT_TO_STRING(#dbOpcUaClient.DIAG_STATUS);
    #sSubCode     := DWORD_TO_HEX_STRING(#dbOpcUaClient.DIAG_SUBFUNCTION_STATUS);
END_IF;

Verification

  1. After the certificate is installed and the project is downloaded, set the connect FB REQ in the user program (or via the watch table forcing dbOpcUaClient.REQ := TRUE).
  2. Observe the instance DB outputs:
    • BUSY = 0, ERROR = 0, STATUS = 16#0000 — successful connection.
    • BUSY = 0, ERROR = 0, STATUS = 16#0000 with the next call to OPC_UA_ReadList returning data — session is fully usable.
  3. Read OPCUA_Diag_Subfunction_Status after the call. It must be 16#00000000 (Good) or, for an unsuccessful call, a different code from 16#8012_0000.
  4. Check the CPU diagnostic buffer for entries under OPC UA. A successful connect is logged with event ID Connection established (secure channel + session).
  5. Use an external OPC UA client (e.g., UA Expert) to validate the same server endpoint independently. This separates server-side issues (cert problem on the server) from client-side issues (cert trust on the 1516F).

Connection State Machine

The OPC UA client state machine on the S7-1500 is a strict subset of the OPC UA Part 4 secure channel lifecycle. The diagram below summarizes the transitions and the most common failure points.

IdleREQ=1 TCP connect(Hello / Ack) OpenSecureChannel(TLS + cert) Activesession OK Bad 0x8012_0000BadCertificateInvalid Bad 0x80150000Policy rejected certificate SecurityPolicy

Troubleshooting Matrix

Symptom Likely status code First action Reference
Connect fails with 0x8012_0000 immediately BadCertificateInvalid Re-export server cert and add to CPU trust list; download project This article
Connect fails after a working session, intermittent 0x80140000 BadTimeout Increase connect timeout; check network path; verify server not in failover FAQ 109762770
Connect fails with 0x80150000 BadSecurityPolicyRejected Align SecurityPolicy and MessageSecurityMode on both sides (e.g., Basic256Sha256 + SignAndEncrypt) TIA Portal V16 OPC UA server access
Connect succeeds, namespace read fails with 0x80250000 BadServerUriInvalid Match Application URI between CPU instance cert and server config OPC UA spec Part 4
Connect returns BUSY indefinitely 0x80200000 BadRequestTimeout Check session tokens; ensure disconnect is called on stop and cyclic call has watchdog Siemens OPC UA client manual

Related Configuration: S7-1200 as OPC UA Server

If the 1516F is connecting to an S7-1200 server, the same certificate workflow applies. The reference document S7-1200 OPC UA Server Documentation (PDF) describes how the server cert is generated and exported. Configuration of the S7-1500 as an OPC UA server (rather than client) requires TIA Portal V16 or higher, S7-1500 CPU firmware ≥ V2.8, and CP 1543-1 firmware ≥ V2.2 when the CP is used as the OPC UA endpoint. The same certificate trust chain concept applies symmetrically.

What does OPC UA status 16#8012_0000 mean on a SIMATIC S7-1500 OPC UA client?

It is the OPC UA standard status code BadCertificateInvalid. The runtime rejected the server certificate as malformed, expired, not yet valid, or untrusted. Install the server's DER certificate in Certificate manager → Trusted certificates of the CPU, recompile, and redownload. Verify with the connect FB instance DB showing ERROR = 0 and OPCUA_Diag_Subfunction_Status = 16#00000000.

How do I decode the outer 16#8601 status code on OPC_UA_Connect?

0x8601 is a generic FB-layer wrapper that simply means "the connection call failed, see the subfunction status". Always read OPCUA_Diag_Subfunction_Status (a DWORD) to obtain the actual OPC UA status. The high word 0x8012 is the OPC UA namespace and the low word 0x0000 is BadCertificateInvalid in this case.

Where are the OPC UA error codes for S7-1500 documented?

The S7-1500 OPC UA client error code list is included in the TIA Portal V16 OPC UA client library documentation and in the support FAQ 109762770. The base set of status codes is also standardized in OPC UA Part 4 (status code table) and is reproduced by the runtime verbatim.

Which firmware does the S7-1500 need to act as an OPC UA client?

Firmware V2.8 or higher is required on the S7-1500 CPU (this includes the 6ES7 516-3FN01-0AB0 used in the reported case). The OPC UA client feature is enabled in the CPU properties under OPC UA → Runtime licenses and requires the corresponding license on the SIMATIC Memory Card.

Do I need to also install the CPU's client certificate on the server?

Yes — if the server requires client certificate authentication. Export the CPU's instance certificate from Certificate manager → Device certificates in DER format, then install it in the server's Trusted Clients store. Missing client certs typically surface as 0x80120000 or 0x80150000 at the connect step.

Back to blog