Topic: DMD0425

Help File Version: 2.10.0.636

Backup and Restore using a micro-SD Card (BRX-only)


The preferred method to create a backup image of the PLC contents on the BRX CPU's micro-SD Card is to use the System Backup (BACKUP) instruction, or using the Create PLC Image File utility in Do-more Designer. Image files are created on a micro-SD card with the intention of them being restored to a BRX PLC. Using a PLC image file on a micro-SD card this way allows a BRX CPU to be programmed without having to use Do-more Designer.

 

The PLC image file will minimally contain the Program section with all of the code-blocks, the complete System Configuration, and all of the user-supplied Documentation. It can optionally contain all of the memory blocks and heap items that are marked as retentive (except DST and ST memory). It can also optionally contain the PLC's current TCP/IP configuration. If this image will be restored to the same BRX CPU where the image is created, or a replacement CPU, then including the TCP/IP configuration is a reasonable choice.

Using the System Backup (BACKUP) instruction

This method allows image creation without the need for rebooting the PLC - which is required by the manual method described below. Because of the potential to select large amount of data to add to the image file, this instruction will NOT run to completion in one PLC scan. The image creation process is broken into multiple file operations that will be executed on successive scans. While this instruction is running there will be an increase in the scan time during each scan required to complete the backup. One potential issue with processing the backup over multiple scans occurs if the contents of the PLC memory is changing while the backup operation is being processed. The image file will contain the memory values on whatever scan that section of memory was written to the image file. Simply said, the backup operation DOES NOT create a snapshot of the contents of the PLC at a given time. To minimize the impact we recommend that you execute the Backup at a point when the memory contents of the PLC will not change until the completion of the Backup instruction.

Using the Create PLC Image File utility in Do-more Designer

This method allows the image file to be created on the PC running Do-more Designer The image can be archived on the PC or transferred to a micro-SD card so the image can be restored to a BRX PLC without having to use Do-more Designer.

Manually Create an Image File on a micro-SD Card Requires a PLC Reboot

Through the use of a special system register: $ImageBackup (DST389), the BRX CPU can create an image file on the micro-SD card that contains some or all of the contents of the PLC on the next PLC reboot.

Begin by installing a micro-SD card in the BRX CPU.

 

Set to value in $ImageBackup (DST389) with the options listed below to include the desired image contents.

 

On the next PLC reboot the requested contents will be written to the file "image.bin" and $ImageBackup will be cleared. During image generation, the LEDs will show a sweeping pattern up towards the micro-SD card slot. If there is an error, an error code will be written to $ImageBackup:W0, and the options will not be cleared.

 

Include this Content : Options are masked flags:

 

 

Flag

 

 

Description

 

IMAGE_OPT_PROGRAM

0x0001

Include all of the Program, the System Configuration, and all of the Documentation in the image.

 

IMAGE_OPT_RETENTIVE

0x0002

Include all of the retentive memory in the image. This option only applies when IMAGE_OPT_PROGRAM is set. Setting this option stores all current retentive memory contents in the image (except DST and ST). Without this option, existing retentive memory will be migrated where possible, same as with a normal program update from Do-more Designer.

 

IMAGE_OPT_IPCONFIG

0x0004

Include the PLC's TCP/IP configuration (IP Address, Subnet Mask, Gateway Address) in the image.

 

IMAGE_OPT_USERCONFIG

0x0008

Include the PLC's Password Configuration in the image.

 

IMAGE_OPT_PRODUCTID

0x0010

Include the current value in $ProductID (DST387) in the image, and verify that the PLC's value matches this when restoring. This is used to confirm that the image is correct for the product, and can also be used to prevent unauthorized duplication of OEM systems.

 

IMAGE_OPT_PASSWORD

0x0020

Include the password stored in $ImagePassword1 (DST391) and $ImagePassword2 (DST392). If included, the password is checked against the PLC's password configuration, and will require the proper permissions before restoring. The password stored in $ImagePassword1 & $ImagePassword2 is cleared after successful image generation. This is another feature to aid in protecting an OEM's intellectual property.

 


Process to Restore an Image File from a micro-SD Card (Requires an PLC Reboot)

You can have the CPU automatically restore all of the contents from a previously built image file (image.bin) on the next PLC reboot. The process follows:

 

Insert the micro-SD containing desired the image file named "image.bin" in the root folder.

 

Set the PLC mode switch to STOP (or set $ImageRestore (DST390) to a value of 1).

 

Reboot the PLC.

 

The contents of the image file will be restored during the first phase of the reboot. During the restore, the LEDs will show a sweeping pattern down from the micro-SD card. Any error codes will be written to $ImageRestore (DST390).

 


Error Codes for PLC Image Backup and Restore

 

Error codes

 

Code

 

Description

 

IMAGE_ERR_NOMEDIA

0x0001

There is no micro-SD card installed.

 

IMAGE_ERR_MEDIAFAILED

0x0002

The micro-SD card didn't mount correctly.

 

IMAGE_ERR_INVALIDDATA

0x0003

Image file contents are invalid.

 

IMAGE_ERR_INVALIDFILE

0x0004

Image filename is invalid.

 

IMAGE_ERR_NOPERMISSION

0x0005

The password in the image file referenced a user account that does not have a required permission.

 

IMAGE_ERR_WRONGPRODUCT

0x0006

The $ProductID value in the image file does not match the value in $ProductID (DST387) in the target CPU.

 

IMAGE_ERR_WRONGPLC

0x0007

The PLC type that was used to create the image file is not the same as the target PLC.

 

IMAGE_ERR_DRIVER

0x8000

If this bit is set, the lower byte contains a file system driver error code. This is always some form a file system error.

 

IMAGE_ERR_INVALIDOS

0x0009

The firmware in the PLC that was used to create the image file is later than the firmware than the target PLC. The target PLC must have a firmware version the same or later than that of the PLC where the image file was created. Note: If you want to include a particular version of the PLC firmware with the PLC contents, you should consider using the Generate DMLoader Image utility.

 

 


See Also:

Backup and Restore Overview

 

Backup Project

 

Restore From Backup

 

Backup and Restore using micro-SD Card (BRX only)

 

BACKUP - System Backup

 

Create PLC Image File

 


Related Topics:

Import Project

 

Export Project

 

Import Project Documentation

 

Export Project Documentation

 

Import Memory Data

 

Export Memory Data

 

Generate DMLoader Image

 

Migrate DirectSOFT Project

 

Project Auto-Save

 

Project Folder Settings