Updating firmware and automation projects
Updating in general
In agile development, updating is a crucial task. In PLCnext Technology there are many ways to perform updates:
| Means... | ...for updating | |||
| firmware | PLCnext Engineer projects | PLCnext apps | ACF or PLM components (manual download) | |
| Device and Update Management (DaUM) | ✔ | ✔ (if created with PLCnext Engineer 2023.6 or newer) | – | – | 
| OPC UA® Server (e.g. with UaExpert) | ✔ | ✔ | – | – | 
| Proficloud | ✔ | ✔ (if created with PLCnext Engineer 2022.9 or newer) | – | – | 
| PLCnext Store | – | – | ✔ | – | 
| Web‑based Management | ✔ | – | ✔ | – | 
| Web‑based Management 2 (WBM 2) pages Update and Backup & restore | ✔ | ✔ (if created with PLCnext Engineer 2025.0 or newer) | ✔ (Offline installation from PLCnext Store) | – | 
| PLCnext Engineer (IEC 61131‑3, C++, or C# programs) | – | ✔ | – | – | 
| SFTP software (e.g. WinSCP) | – | – | – | ✔ | 
Note: In order to update to a current firmware release, a firmware version 2022.0 LTS or newer must be installed on the controller. Firmware versions 2021.9 and before will not accept the *.raucb firmware update file.
- Coming from devices running on 2019.0 LTS up to 2021.9 firmware, first update to the 2022.0 LTS release.
- After restarting under firmware 2022.0 LTS, update to the newer release.
PrepareForUpdate state machine
Availability see implementation overview
Starting with releases 2023.3 of the Device and Update Management (DaUM), a state machine named PrepareForUpdateStateMachine began to play a central role in a growing number of scenarios of updating firmware or automation programs on your PLCnext Control.
For programming a PLC application, developers should know how to handle the "handshaking" processes depending on the PrepareForUpdateStateMachine, by adding proper variables, publishing them in their config files, and setting up status/error notifications. Afterwards, their PLC applications can be updated by users via WBM 2 (System → Update page), and the same goes for updating via DaUM or via OPC UA® directly.
In addition, the Backup & restore mechanism by means of the WBM 2  (System → Backup & restore page) depends on this PrepareForUpdateStateMachine.
Implementation
The following overview shows the implementation of the PrepareForUpdateStateMachine in tools and apps.
| Issued by | PrepareForUpdateStateMachineimplemented | 
| Device and Update Management (DaUM) | firmware release 2023.0 LTS or newer; DaUM Windows® service 2023.3 | 
| OPC UA® Server (e.g. via UaExpert) | firmware release 2023.3 or newer | 
| Proficloud | firmware release 2024.0 LTS or newer | 
| PLCnext Store | – not applicable – | 
| Web‑based Management | – not implemented, see WBM 2 – | 
| Web‑based Management 2 (WBM 2) pages Update and Backup & restore | firmware release 2025.0 or newer | 
| PLCnext Engineer (IEC 61131‑3, C++, or C# programs) | – not applicable – | 
Coupling between PrepareForUpdateStateMachine and PlcState
Before and during update processes, the current state of the controller needs to be switched on demand. For example, before stopping the PLC for a firmware update on the controller, the processes in the production plant need to go into an intermediary holding state. For such an action, the basic PLC state wouldn't suffice. Therefore, update processes in PLCnext Technology from now on rely on the PrepareForUpdateStateMachine, which is based on the OPC UA standard.
In the Idle state of the PrepareForUpdateStateMachine, the controller can switch between the states of the PlcState machine (for all details see full description of the PlcState machine). 
Updating is triggered by a Prepare command; if it needs to be cancelled during Preparing state, an Abort command brings the machine back to the Idle state.
In the PreparedForUpdate state, switching the PlcState is prohibited by the PlcState:Suspended flag, and therefore firmware updates, backups or restore actions can be performed. 
By issuing a Resume command, the PrepareForUpdateStateMachine is brought back to the Idle state. 
How applications work with the state machine
These are the usual "handshaking" procedures:
- During transition from IdletoPreparingstate, PLC applications are informed by aPreparerequest and can react to that by invoking a procedure to pause operation. The duration of the operation is not restricted in any way. Therefore, a manual methodForcePrepareis available in case the application doesn't react any more after aPreparerequest. Once the preparation is completed the PLC application informs theSoftwareUpdatecomponent about being in thePreparedForUpdatestate. Then theSoftwareUpdatecomponent stops the PLC (resulting inPlcState::Stop) and the update process can be performed.
- During transition from PreparingtoResumingstate, PLC applications are informed by aResumerequest and can react to that by invoking a procedure to resume operation. The duration of the resuming operation is not restricted. Once resuming is completed the PLC application informs theSoftwareUpdatecomponent about being in theIdlestate.
- Whenever the SoftwareUpdatecomponent needs to abort a current operation that relies on thePrepareForUpdateStateMachine, PLC applications are informed by anAbortrequest. PLC applications should instantly abort the operation in question so the state machine goes to theIdlestate. Note: For use in theResumingstate, theAbortrequest is not yet specified in OPC UA® DI.