Program upgrading method of power distribution terminal

Through FTP protocol and CRC verification, the cross-upgrade of the APP and Bootloader of the power distribution terminal is realized, which solves the problems of slow upgrade speed, high packet loss rate and high operation and maintenance cost in the existing technology, and improves the upgrade success rate and operation and maintenance efficiency. , simplifying the operation and maintenance process, and retaining iteration records for easy rollback.

CN118519655APending Publication Date: 2024-08-20TIANJIN HAOYUAN HUINENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410689688.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-08-20

AI Technical Summary

Technical Problem

The existing software upgrade method of power distribution terminals is limited by the communication medium, link signal quality and environmental factors, resulting in slow upgrade speed, high packet loss rate during transmission, and low success rate; the programmer upgrade method is highly dependent and easy to The equipment is damaged and the operation and maintenance cost is high; it is difficult to iterate the Bootloader program, the iteration record is invisible, and rollback is difficult.

Method used

Use FTP protocol to connect to the power distribution terminal through network cables, reserve storage space as an upgrade area, use CRC check to ensure file integrity, and achieve cross-upgrade of APP and Bootloader without the need for a programmer. Upgrade records are retained for easy traceability and rollback.

Benefits of technology

It improves the upgrade speed, reduces the packet loss rate and operation and maintenance costs, simplifies the upgrade process, realizes convenient iteration of Bootloader and clarity of program iteration records, and facilitates quick rollback.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118519655A_ABST
    Figure CN118519655A_ABST
Patent Text Reader

Abstract

The invention provides a program upgrading method for a power distribution terminal. The upgrading process is mainly divided into four parts, namely a preparation stage, a downloading stage, an upgrading stage and a verification stage. The method has the advantages that the FTP is used, the upgrading speed is increased, the packet loss rate in the transmission process is reduced, and the upgrading success rate is increased. Program upgrading uses a network cable, does not need a programmer, is simple and rapid, improves operation and maintenance efficiency, and reduces operation and maintenance cost. According to the method and the device, a cross upgrading mode is adopted, and the Bootloader is upgraded. The program iteration record is complete and clear, the original data file is reserved, and fast rollback is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of power distribution terminal program upgrade, and in particular relates to a program upgrade method for a power distribution terminal. Background Art

[0002] The distribution terminal is an important part of the distribution automation system. Its full name is the distribution monitoring terminal, including the distribution feeder terminal unit (FTU), the distribution switch terminal unit (DTU), the distribution transformer terminal unit (TTU), and the distribution remote terminal unit (RTU). The distribution terminal has functions such as remote control, telemetry, telesignaling, and fault detection. It can communicate with the distribution automation master station to provide the operating status and various parameters of the distribution system for monitoring and control. These functions include monitoring the switch status, power parameters, phase-to-phase faults, ground faults, and parameters at the time of fault, and executing the commands issued by the distribution master station to adjust and control the distribution equipment. The purpose of the distribution terminal is to achieve fault location, fault isolation, and rapid restoration of power supply to non-fault areas. With the development of distribution network technology and the scale of power grids, the distribution network load has become complex and diverse. The iterative upgrade of software can improve the refined management of the power system, simplify operation and maintenance operations, and reduce the workload of fault handling. Convenient and stable software upgrades help improve the efficiency and quality of operation and maintenance.

[0003] The existing software upgrade method has the following disadvantages:

[0004] Remote upgrades using the master station through protocols are limited by many factors such as communication media, communication link signal quality, transmission distance, weather environment, etc., resulting in slow upgrade speeds and high packet loss rates during transmission, leading to low upgrade success rates.

[0005] Using a burner to upgrade the program is highly dependent on the burner, and the power distribution terminal needs to be removed from the installation location and then the shell is disassembled before the burn-in upgrade can be performed. After the upgrade is completed, it needs to be reinstalled. It is easy to cause damage to the equipment and the operation and maintenance cost is high.

[0006] The upgrade of Bootloader program is highly dependent on the burner, and the master station cannot upgrade the Bootloader program through the protocol. In addition, the upgrade method of the burner is very inconvenient, making the iteration of Bootloader program difficult.

[0007] Program iteration records are invisible and program rollback is difficult. Summary of the invention

[0008] In view of this, the present invention aims to provide a program upgrade method for a power distribution terminal to solve at least one problem existing in the above-mentioned prior art.

[0009] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0010] A method for upgrading a program of a power distribution terminal comprises the following steps:

[0011] S1. Preparation stage:

[0012] A storage space is reserved on the distribution terminal operation system for storing new upgrade files; the storage space is an upgrade area, and the upgrade area exists in a file system built based on the flash chip;

[0013] S2, download phase:

[0014] The host computer is connected to the power distribution terminal equipment using a network cable, and enters the file system of the power distribution terminal through the FTP protocol after verifying that the user name and password are correct;

[0015] After that, store the APP upgrade file or Bootloader upgrade file and upgrade configuration file that need to be upgraded in the upgrade area, and enter the upgrade phase after restarting the power distribution terminal equipment;

[0016] S3, Upgrade phase:

[0017] Each time the power distribution terminal device starts, the Bootloader will be run first, and the APP will be guided to start running after the Bootloader detects that the running environment is correct;

[0018] When the Bootloader is running, it will detect whether to upgrade the APP, and when the APP is running, it will detect whether to upgrade the Bootloader;

[0019] S4, verification phase:

[0020] Regardless of APP or Bootloader, after the entire upgrade is completed, the upgrade file will not be deleted. The upgrade record and original file will be retained to facilitate the traceability and tracking of the distribution terminal program iteration.

[0021] Further, in step S1, the distribution terminal program of the distribution terminal operation system runs on a 2MB flash on an MCU chip, whose starting address is 0x08000000, and the flash area is divided into two areas, A and B. The space from address 0x08080001 to address 0x08200000, a total of 1536KB, is designed as area A for the operation of APP, and from address 0x08000000 to address 0x08080000 is area B, a total of 512KB of space, for the operation of Bootloader.

[0022] Furthermore, in step S3, the APP is upgraded in the Bootloader, including:

[0023] When the Bootloader is running, it will search for APP upgrade files and APP upgrade configuration files in the upgrade area. If found, the APP upgrade action will be executed:

[0024] First, use CRC check to check the integrity of the APP upgrade file and the correctness of the APP upgrade configuration file. If there are no problems, the APP upgrade file will be divided into packets and copied frame by frame from the upgrade area to area A through the parallel bus. After all data has been copied, the upgrade configuration file will be deleted to mark the completion of the upgrade operation.

[0025] Furthermore, in step S3, the Bootloader is upgraded in the APP, including:

[0026] After the APP is booted by the old Bootloader, it will search the upgrade area to see if there is a new Bootloader upgrade file and a new Bootloader upgrade configuration file. When the new Bootloader upgrade file and the new Bootloader upgrade configuration file are retrieved, the new Bootloader upgrade action will be executed:

[0027] Use CRC check to check the integrity of the new Bootloader upgrade file. After checking that the new Bootloader upgrade configuration file is correct, the new Bootloader upgrade file is divided into packets and copied frame by frame from the upgrade area to area B through the parallel bus. After all data has been copied, delete the upgrade configuration file to mark the completion of the upgrade operation.

[0028] Furthermore, in step S3, during the upgrade process, the upgrade file is verified by CRC verification, and the upgrade file structure is divided into a 64-byte header structure and n bytes of program body data;

[0029] The header structure is divided into 6 parts, including a 4-byte digital signature, a 5-byte file name CRC16 check value, a 42-byte reserved area, a 4-byte CRC32 check value for file length, time stamp, and program body data, a 4-byte file length, and a 4-byte time stamp.

[0030] Furthermore, in step S4, if an upgrade failure occurs during the APP upgrade process, the power distribution terminal will not be shut down directly, but the APP will be guided to perform a trial run during the Bootloader running stage;

[0031] If the APP cannot be started and operated normally, it will no longer be guided to start and the operator will be prompted by a flashing indicator light. The distribution terminal has an abnormal operation. At this time, the operator can try to upgrade again, or roll back the APP through the upgrade records and original files of previous upgrade records to keep the distribution terminal in a stable operating state at all times.

[0032] Compared with the prior art, the program upgrade method of a power distribution terminal described in the present invention has the following advantages:

[0033] The program upgrade method of a power distribution terminal described in the present invention uses the FTP protocol to improve the upgrade speed, reduce the packet loss rate during the transmission process, and improve the upgrade success rate. The program upgrade of the present invention uses a network cable, does not require a burner, is simple and fast, improves operation and maintenance efficiency, and reduces operation and maintenance costs. The present invention adopts a cross-upgrade method to achieve the upgrade of the Bootloader. The program iteration record of the present invention is complete and clear, retains the original data file, and is convenient for quick rollback. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:

[0035] Figure 1 This is a schematic diagram of the APP and Bootloader upgrade process according to an embodiment of the present invention;

[0036] Figure 2 This is a schematic diagram of flash space distribution according to an embodiment of the present invention;

[0037] Figure 3 The figure is a schematic diagram of the upgrade file structure according to an embodiment of the present invention. DETAILED DESCRIPTION

[0038] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0039] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and the like are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", and the like may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.

[0040] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood by specific circumstances.

[0041] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0042] Glossary:

[0043] FTP protocol (File Transfer Protocol) is a standard protocol for transferring files on the network. It is usually used to transfer files between a client and a server. The FTP protocol uses two ports for communication, one for control connection (the default port is 21) and the other for data transfer (the default port is 20).

[0044] like Figures 1 to 3 As shown, a method for upgrading a program of a power distribution terminal comprises the following steps:

[0045] S1, preparation stage;

[0046] S2, downloading stage;

[0047] S3, upgrade stage;

[0048] S4. Verification phase.

[0049] Preparation stage: First, a portion of storage space needs to be reserved on the distribution terminal operation system for storing new upgrade files. This portion of storage space is usually called the "upgrade area", which exists in the file system built on the flash chip.

[0050] Download stage: The host computer uses a network cable to connect to the power distribution terminal device, and enters the file system of the power distribution terminal through the FTP protocol after verifying that the username and password are correct. Then, the APP upgrade file or Bootloader upgrade file and upgrade configuration file that need to be upgraded are stored in the "upgrade area" in the file system, and the upgrade stage can be entered after restarting the power distribution terminal device.

[0051] Upgrade phase: Each time the power distribution terminal device starts, the Bootloader will be run first. After the Bootloader detects that the operating environment is correct, it will guide the APP to start running. When the Bootloader is running, it will detect whether to upgrade the APP, and when the APP is running, it will detect whether to upgrade the Bootloader.

[0052] Upgrade the APP in the Bootloader. When the Bootloader is running, it will search the "upgrade area" of the file system to see if there are APP upgrade files and APP upgrade configuration files. If they are found, the APP upgrade action will be executed: first use CRC verification to check the integrity of the APP upgrade file and the correctness of the APP upgrade configuration file. If there are no problems, the APP upgrade file will be divided into packets and copied frame by frame from the "upgrade area" to area A through the parallel bus. After all data are copied, the upgrade configuration file will be deleted to mark the completion of the upgrade operation.

[0053] Upgrade the Bootloader in the APP. After the APP is booted by the old Bootloader, it will search for new Bootloader upgrade files and new Bootloader upgrade configuration files in the "upgrade area" of the file system. When the new Bootloader upgrade files and new Bootloader upgrade configuration files are retrieved, the new Bootloader upgrade action is executed: use CRC verification to check the integrity of the new Bootloader upgrade file. After checking that the new Bootloader upgrade configuration file is correct, the new Bootloader upgrade file is divided into packets and copied frame by frame from the "upgrade area" to area B through the parallel bus. After all data are copied, the upgrade configuration file is deleted to mark the completion of the upgrade operation.

[0054] During the upgrade process, CRC verification is used to verify the upgrade file, and the upgrade file structure is divided into a 64-byte header structure and n bytes of program body data. The header structure is divided into 6 parts, including a 4-byte digital signature, a 5-byte file name CRC16 check value, a 42-byte reserved area, a 4-byte file length, time mark, program body data CRC32 check value, a 4-byte file length, and a 4-byte time mark. Through digital signature recognition and two CRC checks, it is effectively guaranteed that the upgrade file source is reliable, has not been tampered with, and the file data is complete and correct.

[0055] Verification phase: Regardless of APP or Bootloader, after the entire upgrade is completed, the upgrade file will not be deleted, and its upgrade record and original file will be retained to facilitate the tracing and tracking of the power distribution terminal program iteration. If an upgrade failure occurs during the APP upgrade process, the power distribution terminal will not be shut down directly, but during the Bootloader operation phase, the APP will be guided to run a trial run. If it cannot be started and run normally, the APP will no longer be guided to start and the operator will be prompted by a flashing indicator light. The power distribution terminal has an abnormal operation. At this time, the operator can try to upgrade again, or roll back the APP through the upgrade records and original files of previous upgrade records to keep the power distribution terminal in a stable operating state at all times.

[0056] The present invention uses the FTP protocol to improve the upgrade speed, reduce the packet loss rate during the transmission process, and improve the upgrade success rate. The program upgrade of the present invention uses a network cable, does not require a burner, is simple and fast, improves operation and maintenance efficiency, and reduces operation and maintenance costs. The present invention adopts a cross-upgrade method to achieve the upgrade of the Bootloader. The program iteration record of the present invention is complete and clear, retains the original data file, and is convenient for rapid rollback.

[0057] This method runs the power distribution terminal program on a 2MB flash on an MCU chip, with a starting address of 0x08000000. This area is divided into two areas, A and B. The space from address 0x08080001 to address 0x08200000, a total of 1536KB, is designed as area A, which is used for the operation of the power distribution terminal user program (APP). The space from address 0x08000000 to address 0x08080000 is area B, a total of 512KB of space, which is used for the operation of the APP bootloader.

[0058] This method adopts a cross-upgrade method, that is, the Bootloader can be detected and upgraded in the APP, and the APP can be detected and upgraded in the Bootloader, realizing dual upgrades of the APP and the Bootloader. Use a network cable to connect the power distribution terminal and transfer the upgrade file through the FTP protocol to ensure that the upgrade file is transmitted quickly and stably during the upgrade process, while getting rid of the dependence on the burner and reducing the operation and maintenance cost.

[0059] Example 1

[0060] APP upgrade: Use DTU to upgrade the "app_2024_02_02.bin" file, and the configuration file is "upgrade.txt". The IP of DTU is 192.168.1.2. Use a network cable to connect the DTU network port, use the FTP tool to connect to 192.168.1.2, enter the DTU file system, transfer the upgrade file "app_2024_02_02.bin" to the ".. / Upgrade" folder (upgrade area), edit the upgrade.txt file, modify the upgrade path configuration in the upgrade.txt file to " / Upgrade / app_2024_02_02.bin", and transfer the upgrade.txt file to the ".. / Upgrade" folder. Restart DTU after completion.

[0061] After restarting, the program enters the Bootloader and performs the following steps:

[0062] 1. Check whether the APP upgrade configuration file exists. If not, exit the upgrade and execute steps 9 and 10.

[0063] 2. Check whether the APP upgrade configuration file exists in the upgrade path. If it does not exist, exit the upgrade and execute steps 9 and 10.

[0064] 3. If the configuration file and upgrade file exist, check whether the digital signature "0x88886666" is correct. If not, exit the upgrade and execute steps 9 and 10.

[0065] 4. Use CRC to check whether the file name including the extension is consistent with the CRC16 check value in the upgrade file. If they are inconsistent, exit the upgrade and execute steps 9 and 10.

[0066] 5. Use CRC to check whether the file length, time stamp, program body data and CRC32 check value in the file are consistent. If they are inconsistent, exit the upgrade and execute steps 9 and 10.

[0067] 6. Copy the program data to area A.

[0068] 7. Delete the configuration file to mark the end of the upgrade and soft restart the DTU.

[0069] 8. After restarting, the Bootloader does not detect the APP upgrade file and enters the next stage.

[0070] 9. Enter the APP operating environment detection and APP trial operation stage. If the detection fails, the indicator light flashes and the APP startup is terminated.

[0071] 10. After successful detection, enter the APP.

[0072] Bootloader upgrade: Use DTU to upgrade the "BOOT_2024_02_02.bin" file. The configuration file is "upgrade.txt". The IP of DTU is 192.168.1.2. Use a network cable to connect the DTU network port, use the FTP tool to connect to 192.168.1.2, enter the DTU file system, transfer the upgrade file "BOOT_2024_02_02.bin" to the ".. / Upgrade" folder (upgrade area), edit the upgrade.txt file, modify the upgrade path configuration in the upgrade.txt file to " / Upgrade / BOOT_2024_02_02.bin", and transfer the upgrade.txt file to the ".. / Upgrade" folder. After completion, restart DTU.

[0073] 1. The configuration file for the upgrade is detected as the BOOT upgrade configuration file. Enter the APP operating environment detection and APP trial operation phase. If the detection fails, the indicator light flashes and the APP startup is terminated. If the detection is successful, enter the APP.

[0074] 2. The APP starts and detects the BOOT upgrade configuration file, and starts the Bootloader upgrade.

[0075] 3. Check the Bootloader upgrade configuration file to see if the file in the upgrade path exists. If it does not exist, exit the upgrade and enter the DTU operation stage.

[0076] 4. If the configuration file and upgrade file exist, check whether the digital signature "0x88886666" is correct. If not, exit the upgrade and enter the DTU operation stage.

[0077] 5. Use CRC to check whether the file name including the extension is consistent with the CRC16 check value in the upgrade file. If they are inconsistent, exit the upgrade and enter the DTU operation stage.

[0078] 6. Use CRC to check whether the file length, time stamp, program body data and CRC32 check value in the file are consistent. If they are inconsistent, exit the upgrade and enter the DTU operation stage.

[0079] 7. Copy the program data to area B.

[0080] 8. Delete the configuration file to mark the end of the upgrade and soft restart the DTU.

[0081] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for upgrading a program of a power distribution terminal, characterized in that: The following steps are involved: S1. Preparation stage: A storage space is reserved on the distribution terminal operation system for storing new upgrade files; the storage space is an upgrade area, and the upgrade area exists in a file system built based on the flash chip; S2, download phase: The host computer is connected to the power distribution terminal equipment using a network cable, and enters the file system of the power distribution terminal through the FTP protocol after verifying that the user name and password are correct; After that, store the APP upgrade file or Bootloader upgrade file and upgrade configuration file that need to be upgraded in the upgrade area, and enter the upgrade phase after restarting the power distribution terminal equipment; S3, Upgrade phase: Each time the power distribution terminal device starts, the Bootloader will be run first, and the APP will be guided to start running after the Bootloader detects that the running environment is correct; When the Bootloader is running, it will detect whether to upgrade the APP, and when the APP is running, it will detect whether to upgrade the Bootloader; S4, verification phase: Regardless of APP or Bootloader, after the entire upgrade is completed, the upgrade file will not be deleted. The upgrade record and original file will be retained to facilitate the traceability and tracking of the distribution terminal program iteration.

2. A method for upgrading a power distribution terminal according to claim 1, characterized in that: The distribution terminal program of the distribution terminal operation system runs in a 2MB flash on an MCU chip, with a starting address of 0x08000000. The flash area is divided into two areas, A and B. The space from address 0x08080001 to address 0x08200000, a total of 1536KB, is designed as area A for APP operation, and from address 0x08000000 to address 0x08080000 is area B, a total of 512KB of space, for Bootloader operation.

3. A method for upgrading a power distribution terminal according to claim 1, characterized in that: In step S3, the APP is upgraded in the Bootloader, including: When the Bootloader is running, it will search for APP upgrade files and APP upgrade configuration files in the upgrade area. If found, the APP upgrade action will be executed: First, use CRC check to check the integrity of the APP upgrade file and the correctness of the APP upgrade configuration file. If there are no problems, the APP upgrade file will be divided into packets and copied frame by frame from the upgrade area to area A through the parallel bus. After all data has been copied, the upgrade configuration file will be deleted to mark the completion of the upgrade operation.

4. A method for upgrading a power distribution terminal program according to claim 1, characterized in that: In step S3, the Bootloader is upgraded in the APP, including: After the APP is booted by the old Bootloader, it will search the upgrade area to see if there is a new Bootloader upgrade file and a new Bootloader upgrade configuration file. When the new Bootloader upgrade file and the new Bootloader upgrade configuration file are retrieved, the new Bootloader upgrade action will be executed: Use CRC check to check the integrity of the new Bootloader upgrade file. After checking that the new Bootloader upgrade configuration file is correct, the new Bootloader upgrade file is divided into packets and copied frame by frame from the upgrade area to area B through the parallel bus. After all data has been copied, delete the upgrade configuration file to mark the completion of the upgrade operation.

5. A method for upgrading a power distribution terminal program according to claim 3 or 4, characterized in that: In step S3, during the upgrade process, the upgrade file is verified by CRC verification, and the upgrade file structure is divided into a 64-byte header structure and n bytes of program body data; The header structure is divided into 6 parts, including a 4-byte digital signature, a 5-byte file name CRC16 check value, a 42-byte reserved area, a 4-byte CRC32 check value for file length, time stamp, and program body data, a 4-byte file length, and a 4-byte time stamp.

6. A method for upgrading a power distribution terminal program according to claim 1, characterized in that: In step S4, if an upgrade failure occurs during the APP upgrade process, the power distribution terminal will not be shut down directly, but the APP will be guided to perform a trial run during the Bootloader running stage; If the APP cannot be started and operated normally, it will no longer be guided to start and the operator will be prompted by a flashing indicator light. The distribution terminal has an abnormal operation. At this time, the operator can try to upgrade again, or roll back the APP through the upgrade records and original files of previous upgrade records to keep the distribution terminal in a stable operating state at all times.