Firmware and project update with OPC UA® using UaExpert

Available from firmware version 2022.0 LTS

This topic shows how to update a project or the firmware of a PLCnext device using the OPC UA® sample client UaExpert.

Note: To perform the following steps the user role SoftwareUpdate or Admin is required.

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 to 2021.9 firmware, first update to the 2022.0 LTS release.
  • After restarting under firmware 2022.0 LTS, update to the newer release.
  1. Enable SOFTWARE UPDATE via the WBM
    1. Start a web browser and open the WBM of the PLCnext device.
    2. On the System Services tab enable the SOFTWARE UPDATE feature (see also Configuration - System Services).
      SoftwareUpdate-Enable.png
  2. Connect with UaExpert
    1. Open UaExpert and connect to the PLCnext device. 
      ↪ With an activated SOFTWARE UPDATE feature, the SoftwareUpdate node is visible under the node of your PLCnext device (for firmware updates) and under the project node (for project updates) which is located right below the PLCnext device node. It might be necessary to rebrowse if it was opened before.
      SoftwareUpdate-SoftwareUpdateNode.png
  3. Determine current firmware version or project version number:
    Below the Loading object, the CurrentVersion object describes which firmware or project version is currently installed.
    SoftwareUpdate-CurrentVersion.png
  4. Transfer a new version
    1. Firmware update: Search for a compatible new firmware (e.g. from the product page of your controller on the Phoenix Contact website)
    2. Project update: Export a new project *.zip file from PLCnext Engineer:

      Note: To make sure that software or firmware files downloaded via internet have not been corrupted or tampered, perform an integrity check of the downloaded files. You can find further information in Integrity check of downloaded files

      1. Enter the version information in your PLCnext Engineer project in Version History under Description.
      2. Export your PLCnext Engineer project *.zip file via File → Export → Export PLCnext Engineer Software Package or Export PLCnext Engineer Software Package (with sources).  
    3. Transfer the *.raucb (firmware update) or *.zip (project update) file using the FileTransfer object → Write from local file... .
      SoftwareUpdate-Transfer.png
      ↪ During the transfer, the software package is verified. If the file does not match, a bad result code is returned and an error message can be found in the ErrorMessage variable:
      SoftwareUpdate-ErrorMessage.png
  5. Verify transferred version
    1. Below the Loading object, the PendingVersion object describes the firmware or project file that was previously transferred.
      Note: Transfer and installation are separate steps. They can be performed independently or even using different OPC UA clients.
      SoftwareUpdate-PendingVersion.png
  6. Subscribing the UpdateStatus
    1. For the whole installation process it is recommended to subscribe the UpdateStatus variable. It informs the user what the installation currently does and also informs about errors that occur during the installation.
      SoftwareUpdate-UpdateStatus.png 
  7. Determine the update behavior
    1. Before the update is started, the client may want to know how the device will behave during the update. To do this the method GetUpdateBehavior can be called via ...Call. Details about the pending version need to be specified in order to get the behavior of that version.
      SoftwareUpdate-GetUpdateBehavior.png

      KeepsParameters

      This is always true because the PLCnext device does not loose its memory during installation.

      WillDisconnect

      This is true if the network communication gets lost. The client shall be prepared to loose its OPC UA® connection after calling install.

      RequiresPowerCycle

      This is always false because PLCnext devices can reboot on its own.

      WillReboot

      This is true if the device restarts as part of the installation. It might be important if other devices are located behind an integrated switch and are not accessible for that time.

      NeedsPreparation

      This is true if the device needs to be stopped using the PrepareForUpdateStateMachine.

  8. Preparing for the update
    1. Before the new firmware can be installed or the project can be updated, the device needs to stop operating. This is done using the PrepareForUpdateStateMachine. Calling Prepare stops the PLC program.
      SoftwareUpdate-Prepare.png
    2. If preparation succeeds, the PrepareForUpdateStateMachine transitions into the state PreparedForUpdate. If an error occurred during preparation, the message is shown in the UpdateStatus and the PrepareForUpdateStateMachine transitions into the state Error. With a call to Resume, the error is confirmed and the state machine transitions back to Idle state.
      SoftwareUpdate-Prepared.png
  9. Start the installation
    1. The installation is started by calling the InstallSoftwarePackage method on the InstallationStateMachine. During installation the progress can be seen as string in the UpdateStatus variable and as integer in the PercentComplete variable.
      SoftwareUpdate-InstallSoftwarePackage.png
  10. Verify proper installation
    1. To determine if the installation really installed the new version (and did not revert due to installation issues), it is required to verify that the information in CurrentVersion has changed.
      SoftwareUpdate-CurrentVersionNew.png
  11. Resume operation
    1. After all update tasks are complete, the device is allowed to resume its operation. This is done by calling Resume on the PrepareForUpdateStateMachine.
      SoftwareUpdate-Resume.png
  12. Evaluating the device health
    1. To determine that the device is operating after the installation, the DeviceHealth property can be evaluated as a last step. The health state should be NORMAL.
      SoftwareUpdate-DeviceHealt.png

That's it.

 

 


• Published/reviewed: 2024-05-06   ★  Revision 068 •