Configuring a SIMATIC S7-400 as SNTP Server to Clear SINAMICS S120 Alarm A1097
1. Problem Overview: Alarm A1097 on SINAMICS S120
SINAMICS S120 firmware raises alarm A1097 when the NTP/SNTP client function inside the Control Unit (CU320-2, CU310-2, CU305, etc.) cannot complete a time synchronization handshake with the configured server. The drive logs the alarm in its alarm buffer and the drive time-of-day clock continues running on the last accepted value. The user-visible symptom is:
- Drive alarm buffer:
A1097 (N) NTP server cannot be reached - Status word / r3102 indicates the NTP server state as not synchronized
- Time stamping in the SINAMICS alarm log drifts from the controller time
The alarm is reported as a warning, not a fault, but it disables the auditable timestamp chain that the higher-level S7 expects from a synchronized drive fleet. Most cases reported against an S7-400 acting as the server root cause back to one of three categories:
- The SNTP server FB on the PLC is not actually listening on the expected UDP/123 socket (LocDevID/port mismatch, OUC connection not opened, FB not enabled).
- The S120 NTP client is configured against an IP that does not match the PLC port on which the FB is bound.
- Network path or ACL filters drop UDP/123 between the Control Unit and the S7-400 CPU port.
2. Architecture and Protocol Stack
The Siemens SNTP server library for SIMATIC S7-300/S7-400 implements a stripped-down SNTPv4 server on top of the standard ISO transport / UDP open user communication (OUC) primitives. The relevant stack is:
| Layer | Implementation in S7-400 | Notes |
|---|---|---|
| Application | FB1000 SNTP_SERVER from Siemens library 82203451 |
Cyclic call in OB1, startup reset in OB100 |
| Transport | UDP, port 123 (RFC 4330 SNTP) | Library wraps the TCON/TDIS/TUSEND/TRCV calls |
| Network | Ethernet on integrated PROFINET/IE port | IP address must be reachable from S120 NTP client |
| Link | 100/1000 Mbit, RJ45 or SFP per CPU variant | CPU 410-5H: ports X5, X8 (PN/IE); CPU 416: ports X1, X2 |
The server function uses passive open user communication. The S120 NTP client initiates the request; the S7-400 server replies from the same port 123 socket. The library FB therefore does not require firewall punches beyond UDP/123 between both devices.
3. Affected Components and Required Firmware
| Component | Minimum firmware / version | Notes |
|---|---|---|
| SIMATIC S7-400 CPU (tested: CPU 410-5H, CPU 416-3 PN/DP) | Firmware V8.x or later recommended; library also runs on V6 | CPU 410-5H with integrated PN/IE: ports X5 (PROFINET) and X8 (PN/IE) |
| STEP 7 / TIA Portal | STEP 7 V5.5 SP4+ for classic blocks; TIA V15.1+ for the library import | Library 82203451 ships FBs/Functions for both |
| SINAMICS S120 Control Unit (CU320-2, CU310-2) | Firmware V4.x, V5.x, V5.4 SP3+ | NTP client always present; no licensing required |
| Starter / Startdrive commissioning tool | Startdrive V15.1+ for V5.x firmware; Starter V5.4 for V4.x | Used to write p3100…p3103 and r3102 |
| Siemens SNTP server library | Entry ID 82203451 | Contains FB1000 SNTP_SERVER, FB1001 helper, DB1000, UDTs, examples |
4. Prerequisites
- The S7-400 CPU is fully commissioned: hardware configuration loaded, IP addresses assigned per port, time-of-day set to UTC or local with the correct time zone configured in HW Config (CPU properties → Time-of-day → Time zone).
- The S120 Control Unit is online and accessible from Starter/Startdrive. The drive must not be in an active fault state that blocks parameter writes (clear F-class faults first).
- Network connectivity is verified with a simple
pingfrom the S120 service interface or from a PC in the same subnet to the S7-400 port that will host the SNTP server. - The library 82203451 is unzipped and imported into the STEP 7 / TIA project. The library supplies:
FB1000 SNTP_SERVER-
DB1000as the instance DB template (copy per server instance if multiple ports are used) -
UDT 1000for the configuration structure - Helper FBs for time conversion
- User rights to load the modified program into the CPU and to perform a CPU restart (OB100 logic requires a restart to take effect on the Startup reset path).
5. SNTP Server Library Setup on the S7-400
The library's example project demonstrates the canonical wiring. The four required calls are summarized in the table below; each must be present for the FB to leave the initialization state and accept client requests.
| Step (FAQ §4.4) | OB | Logic | Purpose |
|---|---|---|---|
| 1 | OB1 | Cyclic call of FB1000 SNTP_SERVER with DB1000
|
Runs the receive/dispatch loop, replies to client requests |
| 2 | OB1 | Set / hold the Enable input (e.g. M1.0) permanently TRUE for the run-time of the server |
Enables the FB; without it the server stays in idle and ignores requests |
| 3 | OB100 | Reset the Startup variable in DB1000 (e.g. DB1000.Startup := FALSE) |
Clears the cold-start flag so the FB initializes the OUC connection on the first OB1 pass |
| 4 | OB1 | Re-evaluate / pulse the Startup bit on the first cycle or drive it from the Enable (see library manual page 20 §4.4 for the exact pattern) | Triggers the TCON open of the UDP socket |
DB1000 to fire that connect exactly once. If OB100 is missing, the FB will still come up but will report STATUS = W#16#80C3 (resource permanently busy / no connection) on the first scan, and never recover without a manual reset. This is the most common reason a "program without errors" still yields A1097 on the drive side.5.1 Marker bit M1.0 explained
The Enable input on the FB is a standard BOOL. The library example hard-wires it to M1.0. There is no reserved or special meaning; the engineer can route it to any BOOL, e.g. M1.0, DB1000.Enable, or a tag from a user HMI. The bit must remain TRUE while the server is required.
6. LocDevID Selection per CPU Port
The LocDevID input on the FB tells the S7-400 communication stack which integrated Ethernet interface the SNTP server socket must bind to. The value is a one-byte hexadecimal literal; assigning the wrong value causes the FB to either open on a different port (and the drive cannot reach the IP it was given) or to report local resource not available.
| S7-400 CPU family | Integrated port | LocDevID (hex) | LocDevID (decimal) | Default IP range on this port |
|---|---|---|---|---|
| S7-400 (classic) CPU 41x PN | Port X1 (PN/IE) | 16#01 | 1 | Per HW config |
| S7-400 (classic) CPU 41x PN | Port X2 (PN/IE, optional) | 16#02 | 2 | Per HW config |
| CPU 410-5H / CPU 410E | Port X5 (PROFINET, first interface) | 16#05 | 5 | Per HW config |
| CPU 410-5H / CPU 410E | Port X8 (PROFINET, second interface) | 16#08 | 8 | Per HW config |
| CP 443-1 / CP 443-1 Advanced | External IE port | Use the CP's own LocDevID from its properties (typically 16#0B or 16#FE) | varies | Per CP config |
To identify the LocDevID of a given integrated port:
- Open the hardware configuration in STEP 7 / TIA Portal.
- Select the port object (e.g. PN/IE X8 of the CPU 410E).
- In the properties dialog, switch to the Addresses or Interface tab and note the Interface ID / System ID / LocDevID shown. On CPU 410 hardware this matches the Xn port number: X5 → 5, X8 → 8.
- Enter the value as a hex literal at the FB input, e.g.
iLocDevID := 16#08for port X8 on a CPU 410E.
7. OUC Connection Configuration
The library uses an internally declared connection DB that is referenced by the FB's ConnID input. The ConnID is the standard STEP 7 OUC connection identifier (not the TCON instance DB number).
- Valid range for ConnID: 1 … 16 for integrated IE ports (per S7-400 communication resource limits). Values above 16 typically return
STATUS = W#16#8085 / W#16#80A4. - Use a unique ConnID per active SNTP server instance. If the same S7-400 is to serve multiple subnets from multiple ports, assign one ConnID per port (e.g. ConnID = 1 on X5, ConnID = 2 on X8).
- The library ships an example
DB1001with the connection parameters. Either load the example or declare aTCON_IP_RFCUDT yourself with the following minimum content:-
InterfaceId := w#16#1(LocDevID encoded as required by the FB; consult the FB source for the exact mapping) -
ConnType := 17#0E(UDP, per TCON IP RFC variant) -
ActiveEst := TRUE(active = the FB will periodically refresh) - Local port 123, remote port 123, remote IP = 0.0.0.0 for an SNTP server that must accept any client
-
8. Wiring FB1000 in OB1 and OB100
Below is the minimum call pattern (in STEP 7 FBD notation; equivalent STL is documented in the library manual page 20).
// OB1 - cyclic
CALL FB1000, DB1000
iLocDevID := 16#08 // CPU 410E port X8, change to 16#05 for X5
iConnID := 2 // 1...16, must be unique on the CPU
iEnable := M1.0 // permanent TRUE while server is required
iStartup := DB1000.Startup // edge-driven, see below
oStatus := MW100 // status word for HMI / diagnostics
oLastError := MW102 // most recent non-fatal status
oServerTime := DB1000.SrvTime // echoed UTC time for verification
// OB100 - startup
SET
R DB1000.Startup // one-shot, cleared on every restart
The Startup edge is generated by a one-shot logic: on the very first OB1 pass after the OB100 reset, the bit is briefly TRUE, the FB opens the OUC connection, and on the next pass the FB itself resets the bit. The library manual page 20 §4.4 lists the exact RLO sequence (sections 3 and 4 of that paragraph) — both OB1 and OB100 calls are required.
9. SINAMICS S120 NTP Client Configuration
The drive side is configured with a small set of parameters. Exact parameter numbers are firmware-dependent; for V5.x the standard set is summarized below. Always cross-check the values against the parameter manual of the installed firmware version.
| Parameter | Meaning | Typical value for S7-400 as server | Notes |
|---|---|---|---|
| p3100[0] | Activate NTP synchronization | 1 (active, UTC) | 0 = inactive, 1 = NTP, 2 = SIMATIC time format |
| p3101[0] | NTP server IP address (4 octets as parameter indices) | 192.168.0.10 (example, must match the S7-400 port used for LocDevID) | Drive encodes the four octets into p3101[0..3] |
| p3102 | Index / time-zone offset (seconds) | 0 for UTC, 3600 for CET (winter) | Match the S7-400 time zone configured in HW Config |
| p3103 | NTP update interval (seconds) | 10 to 60 | Sub-minute intervals are not recommended on slow links |
| r3102[0] | NTP status / last synchronization time | read-only | Bit fields indicate server reachable and time valid |
To clear the existing A1097 alarm, perform a parameter save (copy RAM to ROM, p0971 = 1) and a CU restart so the NTP client daemon reinitializes. After the restart, monitor r3102[0]; the bits for server reachable and time synchronized should clear the alarm automatically within one update interval.
10. Root Cause Matrix for A1097
| Symptom on S120 / FB | Most likely root cause | Where to look | Fix |
|---|---|---|---|
| A1097 immediately, drive never synchronizes; PLC program compiles with no errors | OB100 startup reset missing → FB never opens UDP socket | Library manual page 20 §4.4; check OB100 contains the Startup reset | Add the OB100 call (section 3 of the FAQ) |
| A1097 continues; CPU diagnostic buffer shows resource not available / connection error | ConnID out of range (e.g. 99) or LocDevID pointing at a port with no IP configured | STEP 7 hardware configuration, port properties | Use ConnID 1..16; set LocDevID to match the port with the configured IP |
| A1097 only on one of multiple drives; other drives sync fine | Drive p3101[0..3] IP octets swapped or p3100 = 0 | Drive parameter list in Starter/Startdrive | Correct p3101 octets; set p3100 = 1 |
| Drive and PLC on different subnets; A1097 persistent | Routing/ACL blocks UDP/123; or the S7-400 port IP is on a different VLAN than the drive | Switch config, PLC port IP, drive interface | Open UDP/123 in ACL; align VLAN / subnet |
A1097 with periodic resync, status word FB1000 shows W#16#80C3
|
LocDevID refers to a CP that is not slotted or is in STOP | CP diagnostic buffer | Slot the CP, set its LocDevID, bring to RUN |
| A1097 appears after firmware update on S120 | Parameter mapping changed; p3100/p3101 reset to default | Compare parameters pre/post update | Re-enter NTP parameters; save and restart CU |
| A1097 intermittent, drive loses sync for hours at a time | SNTP update interval (p3103) too long for application; or OUC connection is being torn down by keep-alive | p3103, FB oStatus trace | Reduce p3103 to 10 s; verify oStatus remains 0 |
11. Step-by-Step Resolution Procedure
- Confirm the S7-400 firmware and port assignment. Note the IP address of the port that will host the SNTP server (e.g. CPU 410E X8 = 192.168.0.10). The drive's NTP client must target exactly this IP.
- Import the library from entry 82203451 into the STEP 7 / TIA project. Open the example S7 program and copy the FB1000 call into your project.
-
Set the FB inputs:
-
iLocDevID= 16#08 for X8 (or 16#05 for X5, 16#01 for X1, 16#02 for X2 on classic CPUs) -
iConnID= a free ID in 1..16 -
iEnable= a permanent TRUE bit, e.g.M1.0
-
-
Insert the OB100 logic to reset the Startup variable in
DB1000. Without this step the FB never opens the UDP socket. -
Insert the OB1 logic that calls
FB1000and that pulses the Startup bit on the first pass after restart (per the library manual page 20 §4.4 sections 3 and 4). - Compile and download the modified program to the CPU. Perform a STOP → RUN transition (or a full restart) so OB100 executes.
-
Verify on the CPU side by opening the online view of
DB1000and checking:-
oStatus = W#16#0000(no error) -
oServerTimeupdates each second
oStatusis non-zero, the value maps to a standard TUSEND/TRCV status (e.g.W#16#80A4= connection resource problem;W#16#80C3= local resource busy). -
- Configure the SINAMICS S120 NTP client: p3100 = 1, p3101[0..3] = IP octets of the S7-400 port used in step 3, p3102 = UTC offset in seconds, p3103 = update interval in seconds. Save and restart the CU.
- Watch the S120 alarm buffer: A1097 should clear within one update interval (default 10 s). If it persists, re-check the matrix in section 10.
12. Verification and Diagnostics
To confirm end-to-end synchronization, capture the following:
-
PLC side:
DB1000.oServerTimeandDB1000.oStatusin the VAT or in an HMI. Status must beW#16#0000; the time must increment once per second. -
Network side: capture UDP/123 with Wireshark on a mirrored port. Look for a periodic client request from the S120 Control Unit MAC and a server reply from the S7-400 port MAC. The S120 requests every
p3103seconds; absence of the reply means the FB socket is not bound. -
Drive side:
r3102[0]in Starter/Startdrive online. The bit pattern reports server reachable, time synchronized, and stratum. A non-zero stratum with the synchronized bit set means the S7-400 is being used as a valid time source. - CPU diagnostic buffer: must contain no entries of class communication error referencing ConnID used in step 3.
Why does the S120 keep raising A1097 even though the S7-400 program has no compile errors?
The most common reason is a missing OB100 reset of the Startup bit in DB1000. Without it, FB1000 never opens the UDP/123 socket, so the S120 NTP client never receives a reply. Add the OB100 call (sections 3 and 4 of the library manual page 20 §4.4) and perform a CPU restart.
What LocDevID do I use for port X5 or X8 of a CPU 410-5H / CPU 410E?
Use 16#05 for port X5 and 16#08 for port X8 on a CPU 410 family. The value matches the physical port number and is required for the FB to bind the SNTP server to the correct Ethernet interface.
Which ConnID range is valid for the SNTP server FB on an integrated IE port?
1 to 16 for the integrated PROFINET/IE ports of an S7-400 CPU. Values outside this range (e.g. the often-quoted 99) are rejected by the communication resource manager and keep the FB in connection establishment, leaving A1097 active on the drive.
Which SINAMICS S120 parameters activate the NTP client?
For V5.x firmware set p3100[0] = 1 to activate NTP synchronization, p3101[0..3] to the four IP octets of the S7-400 port used for the server, p3102 to the UTC offset in seconds, and p3103 to the update interval in seconds. Save with p0971 = 1 and restart the CU. Always confirm the parameter list against the S120 List Manual for the installed firmware version.
Can the S7-400 be both an NTP client (to a higher-level server) and an SNTP server (to the drives) at the same time?
Yes. The NTP client side of the S7-400 is configured in HW Config (CPU properties → Time-of-day → NTP mode) per the TIA Portal Time-of-day synchronization in NTP mode documentation. The SNTP server FB1000 from library 82203451 then distributes that synchronized time to the S120 line-up. Use a different LocDevID and ConnID for the client and server sides to avoid port-binding conflicts.