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) |
|
| 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) |
– |
| Device and Update Management (DaUM) | ✔ | ✔ (if created with PLCnext Engineer 2023.6 or newer) |
– | – |
| PLCnext Engineer (IEC 61131‑3, C++, or C# programs) |
– | ✔ | – | – |
| OPC UA® Server (e.g. with UaExpert) | ✔ | ✔ | – | – |
| Proficloud | ✔ | ✔ (if created with PLCnext Engineer 2022.9 or newer) |
– | – |
| PLCnext Store | – | – | ✔ | – |
| IDeviceControlService of the C++ API | ✔ | – | – | – |
| SFTP software (e.g. WinSCP) | – | – | – | ✔ |
Updating the firmware
You can update the firmware conveniently by means of the Web-based Management on your controller. These are the steps:
- Open the regarding Web‑based Management page on your controller:
- In the WBM 2, navigate to the System → Update section.
- In the legacy WBM (up to firmware 2024.6) navigate to the Administration → Firmware Update section.
- Follow the instructions given there.
Updating from firmware versions before 2019.0 LTSUpdating from firmware versions before 2019.0 LTS
In firmware versions before 2019.0 LTS (the naming back then was like "1.02"), you can start the firmware update via the sudo update-plcnext shell script, which you will find in the file system of the controller.
- Download and unzip the firmware *.zip file (see Tool downloads).
- For older firmware, run the *.exe setup file to extract the *.raucb update file; newer firmware already contains the naked *.raucb update file.
- Open an SFTP client software (e.g., WinSCP) and log in to the controller as the
adminuser (see Connecting to the controller).
Security note: Use the default
adminuser password only for initial access and change it as soon as possible! - Copy the *.raucb update file to the /opt/plcnext/ directory (this is the home directory of the Linux®
adminuser). - Open the shell using a command line tool (e.g., PuTTY or Tera Term).
- Log in to the controller as the admin user here as well.
- Issue the update command; the name of the update script is the same for every controller:
sudo update-plcnext.- The script is available in the directory under /usr/sbin/.
- Under /usr/sbin/, you will also find symbolic links with the respective product designation in the name, e.g.,
sudo update-axcf2152.
The script executes the following operations:
- Stopping the PLCnext Technology process.
- Performing the firmware update.
- Rebooting the system and deleting the firmware container.
The behavior can also occur when the boot process is interrupted e.g. by power loss. In this case you will observe that the PLCnext Control boots with its previously installed firmware version. To prevent such unintended firmware downgrades, Phoenix Contact recommends that after a finally successful firmware update, the same firmware should be installed once again. This way both the active and the inactive boot partition will contain the same firmware version.
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.
Downgrading the firmware
For downgrading to a former firmware version (minimum is 2019.0 LTS), you can use the firmware update feature of the Web-based Management on your controller and just pick a release version prior to the one that is installed.
These are the steps:
- Reset to Default setting Type 1 (see the regarding description).
- Open the Web‑based Management on your controller.
- In the WBM 2, navigate to the System → Update section
(or in the legacy WBM to the Administration → Firmware Update section). - Follow the instructions given there.
PrepareForUpdate state machine
Availability see implementation overview below
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, those PLC applications can be updated by users via WBM 2 (System → Update page), and the same goes for updating directly via DaUM or via OPC UA®.
In addition, the WBM 2 Backup & restore mechanism depends on this PrepareForUpdateStateMachine.
Implementation
The following overview shows the implementation of the PrepareForUpdateStateMachine in tools and apps.
| Issued by | PrepareForUpdateStateMachine implemented |
| Web‑based Management | – not implemented – |
| Web‑based Management 2 (WBM 2) pages Update and Backup & restore |
firmware release 2025.0 or newer |
| Device and Update Management (DaUM) | firmware release 2023.0 LTS or newer; DaUM Windows® service 2023.3 |
| PLCnext Engineer (IEC 61131‑3, C++, or C# programs) | – not applicable – |
| 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 – |
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.
Related Topics