CN116841591B - Firmware upgrading method, system and medium of metering equipment - Google Patents

Firmware upgrading method, system and medium of metering equipment Download PDF

Info

Publication number
CN116841591B
CN116841591B CN202311098951.2A CN202311098951A CN116841591B CN 116841591 B CN116841591 B CN 116841591B CN 202311098951 A CN202311098951 A CN 202311098951A CN 116841591 B CN116841591 B CN 116841591B
Authority
CN
China
Prior art keywords
firmware
upgrading
upgrade
metering equipment
data packet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311098951.2A
Other languages
Chinese (zh)
Other versions
CN116841591A (en
Inventor
王生
郑烽华
王溅
李敏
严伟峰
董秋影
谢栋
张露
岳崇峣
许科益
庞昊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Juyuan Intelligent Technology Co ltd
Original Assignee
Hangzhou Juyuan Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Juyuan Intelligent Technology Co ltd filed Critical Hangzhou Juyuan Intelligent Technology Co ltd
Priority to CN202311098951.2A priority Critical patent/CN116841591B/en
Publication of CN116841591A publication Critical patent/CN116841591A/en
Application granted granted Critical
Publication of CN116841591B publication Critical patent/CN116841591B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a firmware upgrading method, a system and a medium of metering equipment, wherein in the method, a system background determines target metering equipment corresponding to recorded data from the metering equipment and sends summary information of a firmware file corresponding to an upgrading task to the target metering equipment with the upgrading task; the system background sends a data packet corresponding to the firmware file to the target metering equipment based on the preset sending order until the current sending order reaches the maximum sending order corresponding to the firmware file, and sends a firmware checking instruction to the target metering equipment; the target metering equipment performs integrity check on the received data packet for firmware upgrade, calculates a cyclic redundancy check result of the data packet for firmware upgrade, and feeds back an upgrade completion result to a system background; and recording an upgrading result of the corresponding target metering equipment as upgrading success by the system background under the condition that the version information is consistent with the version information corresponding to the firmware file. The normal upgrading of the metering equipment is guaranteed.

Description

Firmware upgrading method, system and medium of metering equipment
Technical Field
The application relates to the technical field of automation, in particular to a firmware upgrading method, a system and a medium of metering equipment.
Background
Along with the rapid development of the internet of things technology, the metering system has wide application in various industries. The management of multiple metering devices by the system background is particularly important, for example, the management of water meters, electric meters and the like. Currently, metering systems have very limited firmware information sent to the metering device for upgrade purposes, typically including version information and firmware download address information.
However, judging whether the hardware of the metering device is matched with the hardware of the metering device only by the version information is inaccurate, and the metering device is easy to function abnormally or damage after being upgraded; and the background of the system and the metering device usually need to handshake and exchange commands for multiple times, the efficiency is low, errors and file loss easily occur in the transmission process, a notification mechanism is lacked, the metering system cannot confirm whether the device successfully receives complete firmware and the like, and the metering system completely depends on a failure retry mechanism of the device.
In view of the above problems, an effective technical solution is currently needed.
Disclosure of Invention
The utility model provides a firmware upgrading method, system and medium of metering equipment, through perfect the interactive logic of system backstage and metering equipment in the upgrading process, ensure the normal upgrading of metering equipment, through using the fractional data package transmission firmware file, support breakpoint continuous transmission, reduce the package risk of losing of firmware file, promote transmission efficiency simultaneously.
In a first aspect, the present application provides a firmware upgrade method of a metering device, applied to a firmware upgrade system of the metering device, where the firmware upgrade system of the metering device includes a system background and at least one metering device, the system background and the metering device communicate through a mobile network, and the firmware upgrade method of the metering device includes:
when the system background receives the record data, determining a target metering device from the at least one metering device based on a device identifier carried by the record data, and sending summary information of a firmware file corresponding to an upgrade task to the target metering device under the condition that the target metering device has the upgrade task to be executed;
when the target metering equipment receives the summary information, matching the summary information with a preset upgrading condition, and sending an upgrading permission result corresponding to the matching result to the system background;
when the system background receives the upgrade permission result, sending a data packet corresponding to a firmware file to the target metering equipment based on a preset sending order under the condition that the upgrade permission result is allowable to upgrade until the current sending order reaches the maximum sending order corresponding to the firmware file, and sending a firmware checking instruction to the target metering equipment;
When the target metering equipment receives a firmware checking instruction, integrity checking is carried out on the received data packet for firmware upgrading, a cyclic redundancy check result of the data packet for firmware upgrading is calculated under the condition that the data packet for firmware upgrading does not have a missing data packet, and an upgrading completion result is fed back to the system background under the condition that the cyclic redundancy check result is correct;
when the system background receives the upgrading completion result, a version inquiry instruction is sent to the target metering equipment;
when the target metering equipment receives the version inquiry instruction, version information corresponding to the current firmware is sent to the system background;
when the system background receives the version information, under the condition that the version information is consistent with the version information corresponding to the firmware file, the upgrading result of the corresponding target metering equipment is recorded as successful upgrading.
Optionally, when the system background receives the upgrade permission result, the method further includes:
and under the condition that the upgrade permission result is that the upgrade is not allowed, recording the upgrade result of the target metering equipment as upgrade failure, and sending a dormancy command to the target metering equipment.
Optionally, the sending, based on the preset sending order, the data packet corresponding to the firmware file to the target metering device includes:
determining a current sending sequence corresponding to the recently sent data packet and a corresponding reply result according to the recorded sending progress information;
in the case where the current transmission order is smaller than the maximum transmission order corresponding to the firmware file,
if the reply result is invalid or the reply result is not received within a preset time length, sending a data packet corresponding to the current sending sequence to the target metering equipment;
and if the reply result is valid, the current sending order is increased to obtain a target sending order, the target sending order is updated to the sending progress information, and a data packet corresponding to the target sending order is sent to the target metering equipment.
Optionally, after the integrity check is performed on the received data packet for firmware upgrade, the method further includes:
when the data packet for firmware upgrade has a missing data packet, the target metering equipment sends a position sequence corresponding to the missing data packet to the system background;
and after receiving the position sequence, the system background sends a data packet corresponding to the position sequence to the target metering equipment.
Optionally, after the calculating the cyclic redundancy check result of the data packet for firmware upgrade, the method further includes:
sending an upgrade data exception message to the system background under the condition that the cyclic redundancy check result has errors;
and after the system background receives the data exception message, recording the upgrading result of the target metering equipment as upgrading failure.
Optionally, when the system background receives the version information, the method further includes:
and recording an upgrading result of the corresponding target metering equipment as upgrading failure under the condition that the version information is inconsistent with the version information corresponding to the firmware file.
Optionally, the firmware upgrading method of the metering device further includes:
and when the preset period is reached, checking the execution condition of the upgrading task.
Optionally, the summary information of the firmware file includes manufacturer information, hardware stripes, software version, firmware length, packet number and firmware CRC information.
In a second aspect, the present application provides a firmware upgrade system of a metering device, the firmware upgrade system of the metering device comprising: the device comprises a memory and a processor, wherein the memory comprises a program of a firmware upgrading method of the metering device, and the program of the firmware upgrading method of the metering device realizes the following steps when being executed by the processor:
When the background of the control system receives record data, determining target metering equipment from at least one metering equipment based on equipment identification carried by the record data, and sending summary information of a firmware file corresponding to an upgrade task to the target metering equipment under the condition that the upgrade task to be executed exists in the target metering equipment;
when the target metering equipment is controlled to receive the summary information, matching the summary information with a preset upgrading condition, and sending an upgrading permission result corresponding to the matching result to the system background;
when the system background is controlled to receive the upgrade permission result, sending a data packet corresponding to a firmware file to the target metering equipment based on a preset sending order under the condition that the upgrade permission result is allowable to upgrade until the current sending order reaches the maximum sending order corresponding to the firmware file, and sending a firmware checking instruction to the target metering equipment;
when the target metering equipment is controlled to receive a firmware checking instruction, carrying out integrity checking on a received data packet for firmware upgrading, calculating a cyclic redundancy check result of the data packet for firmware upgrading under the condition that the data packet for firmware upgrading does not have a missing data packet, and feeding back an upgrading completion result to the system background under the condition that the cyclic redundancy check result is correct;
When the system background is controlled to receive the upgrading completion result, a version inquiry instruction is sent to the target metering equipment;
when the target metering equipment is controlled to receive the version inquiry instruction, version information corresponding to the current firmware is sent to the system background;
when the system background is controlled to receive the version information, under the condition that the version information is consistent with the version information corresponding to the firmware file, the upgrading result of the corresponding target metering equipment is recorded as successful upgrading.
In a third aspect, the present application further provides a computer readable storage medium, where the computer readable storage medium includes a firmware upgrade method program of a metering device, where the firmware upgrade method program of the metering device, when executed by a processor, implements the steps of the firmware upgrade method of the metering device according to any embodiment of the present application.
When the background of the system receives the record data, determining target metering equipment from at least one metering equipment based on equipment identification carried by the record data, and sending summary information of a firmware file corresponding to an upgrade task to the target metering equipment under the condition that the upgrade task to be executed exists in the target metering equipment; when receiving the summary information, the target metering equipment matches the summary information with a preset upgrading condition and sends an upgrading permission result corresponding to the matching result to a system background; when the system background receives the upgrade permission result, under the condition that the upgrade permission result is that upgrade is allowed, transmitting a data packet corresponding to the firmware file to the target metering equipment based on a preset transmission order until the current transmission order reaches the maximum transmission order corresponding to the firmware file, and transmitting a firmware checking instruction to the target metering equipment; when the target metering equipment receives a firmware checking instruction, carrying out integrity checking on the received data packet for firmware upgrading, calculating a cyclic redundancy check result of the data packet for firmware upgrading under the condition that the data packet for firmware upgrading does not have a missing data packet, and feeding back an upgrading completion result to a system background under the condition that the cyclic redundancy check result is correct; when the system background receives the upgrade completion result, a version inquiry instruction is sent to target metering equipment; when receiving the version inquiry command, the target metering equipment sends version information to a system background; when the system background receives the version information, under the condition that the version information is consistent with the version information corresponding to the firmware file, the upgrading result of the corresponding target metering equipment is recorded as successful upgrading. The method and the device have the advantages that the normal upgrading of the metering device is guaranteed by improving the interactive logic between the system background and the metering device in the upgrading process, the breakpoint continuous transmission is supported by using the fractional data packet to transmit the firmware file, the packet loss risk of the firmware file is reduced, and meanwhile the transmission efficiency is improved.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the embodiments of the application. The objectives and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a firmware upgrade method of a metering device according to an embodiment of the present application;
FIG. 2 is a flowchart of a firmware upgrade method of another metering device according to an embodiment of the present application;
fig. 3 is a flowchart of a method for sending a data packet corresponding to a firmware file according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for processing missing data packets according to an embodiment of the present disclosure;
Fig. 5 is a flowchart of a method for performing cyclic redundancy check of a data packet according to an embodiment of the present application;
FIG. 6 is a flowchart of a method for handling version information inconsistencies provided in an embodiment of the present application;
FIG. 7 is a flowchart of a firmware upgrade method of another metering device according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a firmware upgrade system of a metering device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
It should be noted that like reference numerals and letters refer to like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
Referring to fig. 1, a flowchart of a firmware upgrade method of a metering device according to an embodiment of the present application is provided. The firmware upgrading method of the metering equipment is applied to a firmware upgrading system of the metering equipment, and the firmware upgrading system of the metering equipment comprises a system background and at least one metering equipment, wherein the system background and the metering equipment are communicated through a mobile network. The firmware upgrading method of the metering equipment comprises the following steps:
and step S101, when the system background receives the record data, determining a target metering device from at least one metering device based on the device identifier carried by the record data, and sending the summary information of the firmware file corresponding to the upgrade task to the target metering device under the condition that the upgrade task to be executed exists in the target metering device.
It should be noted that, the system background ensures that communication and data exchange can be performed with various devices efficiently and stably, including selecting an appropriate communication protocol to ensure efficient and reliable data transmission between the devices and the system; being able to identify and manage various devices connected to the system; collecting data from the equipment or sending a control instruction to the equipment; the state of the equipment can be monitored in real time, and whether the equipment is online, normally works, and the electric quantity is in a state; there may be instances where the connection is unstable or temporarily interrupted. Fault tolerance mechanisms and redundancy strategies are considered to ensure stability and reliability of the system. The system background can communicate with metering equipment through NB-IoT (such as telecom or mobile), and the tasks of data transmission, software upgrading and the like are completed. The metrology device may be a device for measuring, detecting and evaluating various amounts of physical, chemical, electromagnetic, optical, acoustic, etc. Metering devices are commonly used in laboratory, industrial, scientific, medical, energy, etc. fields for obtaining accurate, repeatable measurements, such as water meters, electricity meters, etc. In addition, with the continuous advancement of technology, new measurement techniques and methods are continuously emerging. Upgrading the metering device can introduce more advanced measurement techniques, improving measurement accuracy and precision to accommodate new measurement requirements. For example, higher automation and faster response speed can be achieved by upgrading the metering device, which can improve work efficiency, reduce operating time and human intervention, and thereby improve production efficiency and data acquisition efficiency, including hardware upgrades and software upgrades. For example, the digital and networked functions can be introduced through upgrading, so that the acquisition, transmission and analysis of data are facilitated, and intelligent production and decision making are promoted. After the system background receives the record data reported by the metering equipment, the target metering equipment can be confirmed, whether the target metering equipment has an upgrade task to be executed or not is checked, and the summary information of the firmware file corresponding to the upgrade task is pushed to the target metering equipment.
Specifically, the firmware file includes a file header and firmware content, where the file header includes manufacturer identification, hardware stripes, software version, firmware CRC, and firmware length information. The manufacturer identification is 4 bytes ASCII codes (for example: 1296), the hardware stripe is composed of important device models and other information on a water meter circuit board, the information comprises a singlechip, a communication module and the like, the model information is connected into a character string, the character string is separated by an 'vertical line', a unique code can be generated by using an SHA-256 hash function, the unique code at the moment is usually binary data with a fixed length, and then Base64 coding conversion is carried out to obtain a readable unique code; the software version consists of 2 bytes (e.g., 0125); firmware CRC consists of 2 bytes (e.g., 719 a); firmware content is 4 bytes long (e.g., 0001e 800); finally, the firmware content is added. Optionally, the user may upload a firmware upgrade file in a firmware management function of the system background, and fill in a software version and remark information; in addition, an upgrade task is created in a firmware upgrade function of a system background, and equipment and corresponding firmware to be upgraded are designated;
step S102, when the target metering equipment receives the summary information, the summary information is matched with a preset upgrading condition, and an upgrading permission result corresponding to the matching result is sent to a system background.
It should be noted that the summary information may include manufacturer information, hardware stripes, software version, firmware length, packet number, and firmware CRC information. The preset upgrade condition may be to confirm whether the hardware condition meets the upgrade requirement or confirm whether the software version meets the upgrade requirement. The firmware file corresponding to the upgrade task is set for the target metering device which has completed the hardware upgrade, so that the target metering device needs to confirm whether the hardware upgrade corresponding to the hardware stripe in the received summary information is completed or not, and if the target metering device does not complete the corresponding hardware upgrade, the summary information is not matched with the preset upgrade condition. In addition, there may be a case that the target metering device has completed the latest firmware upgrade, and the software version in the received summary information may be consistent with or lower than the current software version of the target metering device, so that the target metering device does not need to perform the corresponding firmware upgrade, and the summary information is considered to be not matched with the preset upgrade condition. After confirming whether the summary information is matched with the preset upgrading conditions, sending an upgrading permission result to a system background according to the confirmation result.
And step S103, when the system background receives the upgrade permission result, sending a data packet corresponding to the firmware file to the target metering equipment based on a preset sending order under the condition that the upgrade permission result is that the upgrade is permitted, and sending a firmware checking instruction to the target metering equipment until the current sending order reaches the maximum sending order corresponding to the firmware file.
In one embodiment, fig. 2 is a flowchart of a firmware upgrade method of another metering device according to an embodiment of the present application, as shown in fig. 2, when an upgrade permission result is received by a system background, the method further includes:
step S1031, when the upgrade permission result is that the upgrade is not allowed, records the upgrade result of the target metering device as upgrade failure, and sends a sleep command to the target metering device.
It should be noted that, whether to upgrade is determined based on the reply of the target metering device, so that the error upgrade of the target metering device can be effectively avoided, and the risk of abnormality of the target metering device is reduced.
In one embodiment, fig. 3 is a flowchart of a method for sending a data packet corresponding to a firmware file according to an embodiment of the present application, as shown in fig. 3, in step S103, the sending, based on a preset sending order, of the data packet corresponding to the firmware file to a target metering device includes:
Step S10321, determining the current sending order corresponding to the recently sent data packet and the corresponding reply result according to the recorded sending progress information;
step S10322, when the current sending order is smaller than the maximum sending order corresponding to the firmware file;
step S10323, if the reply result is invalid or the reply result is not received within a preset time period, sending a data packet corresponding to the current sending sequence to the target metering equipment;
step S10324, if the reply result is valid, the current sending order is incremented to obtain the target sending order, and updated to the sending progress information, and the data packet corresponding to the target sending order is sent to the target metering device.
It should be noted that, in the prior art, an FTP transmission mode is generally adopted, multiple handshakes and command exchange are required, the efficiency is low, and time is wasted; and FTP is unreliable, error and file loss are easy to occur in the transmission process, a notification mechanism is not provided, and the system cannot confirm whether the equipment successfully receives complete firmware and the like, and the system completely depends on a failure retry mechanism of the equipment. Therefore, the embodiment of the application can adopt a TCP private protocol, and the firmware file is transmitted by using the fragments to support breakpoint continuous transmission. The preset sending sequence may be a sending sequence of a data packet corresponding to the firmware file, the target metering device replies to the system background after receiving the data packet each time, and the system background only sends the next packet data after confirming the reply result of the target metering device. In a specific implementation process, the system background checks the transmission progress of the target metering device, confirms the transmission order corresponding to the data packet which is transmitted recently, defaults to the 0 th packet when the data packet which is transmitted recently does not exist, judges whether the current transmission order corresponding to the current transmission progress is smaller than 121 packets in total if the 24 th data packet which is transmitted recently exists, and transmits the 25 th data packet next (namely, increases the current transmission order by 1) if the current transmission order is smaller than 121 packets in total. Sometimes, under the conditions of weak signals, network congestion and the like, the system background can not receive the response of the metering equipment within a preset time period, or the verification of the reply result is wrong, the result is invalid, and when the metering equipment reports data next time, the system background can repeatedly send the 24 th data packet corresponding to the current sending sequence; when the reply result is received to be effective, the system background increases the current sending sequence and continues to send the next packet of data, namely the 25 th data packet; if the current sending order (such as 121 th packet) is greater than or equal to the total number of data packets (such as 121 total), the next stage is performed. Therefore, the background of the system adopts a mode of sequential sending and synchronous response, so that the next data packet can be issued after the confirmation is received, and the packet loss can be effectively avoided.
Step S104, when the target metering equipment receives a firmware checking instruction, integrity checking is carried out on the received data packet for firmware upgrading, a cyclic redundancy check result of the data packet for firmware upgrading is calculated under the condition that the data packet for firmware upgrading does not have a missing data packet, and the upgrading completion result is fed back to the background of the system under the condition that the cyclic redundancy check result is correct.
It should be noted that, the target metering device performs integrity check on the data packet for firmware upgrade, so that the problem of upgrade failure caused by packet loss can be effectively prevented, and meanwhile, performs cyclic redundancy check on the data packet for firmware upgrade, where the cyclic redundancy check can be used for detecting and verifying the integrity and accuracy of data. The system background generates a check code by operating on the data, and then attaches the check code to the data for transmission. After the metering equipment receives the data, the same cyclic redundancy check algorithm is executed to calculate a check code, the check code is compared with the received check code, and if the check code is consistent with the received check code, the fact that no error occurs in the data in the transmission process is indicated; if not, it indicates that the data may have been corrupted or corrupted. The introduction of cyclic redundancy check can provide further guarantee for successful upgrades, effectively coping with situations that may be subject to noise, distortion or other interference during data transmission. The cyclic redundancy check may employ CRC-16, CRC-32, etc., and the check code is typically 16 bits, 32 bits, etc.
In one embodiment, fig. 4 is a flowchart of a method for processing a missing data packet according to an embodiment of the present application, as shown in fig. 4, after performing integrity check on a received data packet for firmware upgrade, further includes:
step S1041, when a data packet for firmware upgrade has a missing data packet, the target metering device sends a position sequence corresponding to the missing data packet to a system background;
step S1042, after receiving the position order, the system background sends a data packet corresponding to the position order to the target meter and the measuring device.
It should be noted that, by feeding back the position sequence of the missing data packet to the system background, the system background can resend the data packet corresponding to the position sequence, so as to effectively ensure the integrity of the data packet corresponding to the firmware file.
In one embodiment, fig. 5 is a flowchart of a method for performing cyclic redundancy check on a data packet according to an embodiment of the present application, as shown in fig. 5, after calculating a cyclic redundancy check result of a data packet for firmware upgrade, further includes:
step S1043, sending an upgrade data exception message to a system background when the cyclic redundancy check result is wrong;
Step S1044, after the system background receives the data exception message, recording the upgrade result of the target metering device as upgrade failure.
It should be noted that, without a data packet passing through the cyclic redundancy check, it is noted that data anomalies may occur in the content of the data packet during the transmission process, which may be caused by interference of external bad factors, and the reason needs to be further checked, and the upgrade result of the corresponding target metering device may be recorded as anomalies first.
And step 105, when the system background receives the upgrade completion result, a version inquiry instruction is sent to the target metering equipment.
And step S106, when the target metering equipment receives the version inquiry instruction, version information is sent to the system background.
And step S107, when the system background receives the version information, recording the upgrading result of the corresponding target metering equipment as upgrading success under the condition that the version information is consistent with the version information corresponding to the firmware file.
In one embodiment, fig. 6 is a flowchart of a method for handling inconsistent version information provided in the embodiment of the present application, as shown in fig. 6, while the system background receives version information, the method further includes:
step S1071, recording the upgrade result of the corresponding target metering device as upgrade failure when the version information is inconsistent with the version information corresponding to the firmware file.
It should be noted that, since there may be a version that is not updated to the latest after the target metering device finishes the version upgrade, the system background still can receive the upgrade completion result, so the system background needs to actively query the target metering device for version information to determine whether the version information is consistent with the firmware file, and if so, the success of the upgrade can be confirmed, and if not, the failure of the upgrade can be confirmed, and the re-upgrade process or shutdown troubleshooting is needed.
When the system background receives the record data, determining a target metering device from at least one metering device based on a device identifier carried by the record data, and sending summary information of a firmware file corresponding to an upgrade task to the target metering device under the condition that the target metering device has the upgrade task to be executed; when receiving the summary information, the target metering equipment matches the summary information with a preset upgrading condition and sends an upgrading permission result corresponding to the matching result to a system background; when the system background receives the upgrade permission result, under the condition that the upgrade permission result is that upgrade is allowed, transmitting a data packet corresponding to the firmware file to the target metering equipment based on a preset transmission order until the current transmission order reaches the maximum transmission order corresponding to the firmware file, and transmitting a firmware checking instruction to the target metering equipment; when the target metering equipment receives a firmware checking instruction, carrying out integrity checking on the received data packet for firmware upgrading, calculating a cyclic redundancy check result of the data packet for firmware upgrading under the condition that the data packet for firmware upgrading does not have a missing data packet, and feeding back an upgrading completion result to a system background under the condition that the cyclic redundancy check result is correct; when the system background receives the upgrade completion result, a version inquiry instruction is sent to target metering equipment; when receiving the version inquiry command, the target metering equipment sends version information to a system background; when the system background receives the version information, under the condition that the version information is consistent with the version information corresponding to the firmware file, the upgrading result of the corresponding target metering equipment is recorded as successful upgrading. The method and the device have the advantages that the normal upgrading of the metering device is guaranteed by improving the interactive logic between the system background and the metering device in the upgrading process, the breakpoint continuous transmission is supported by using the fractional data packet to transmit the firmware file, the packet loss risk of the firmware file is reduced, and meanwhile the transmission efficiency is improved.
Fig. 7 is a flowchart of another firmware upgrade method of a metering device according to an embodiment of the present application, as shown in fig. 7, further including:
and step S108, checking the execution condition of the upgrade task when a preset period is reached.
It should be noted that, the system will check the execution condition of the firmware upgrade task at regular time, including the upgrade progress of each water meter in the task, and when the task is completed (success or failure) by all water meters, the firmware upgrade task is completed. The system supports simultaneous upgrading of a plurality of water meters, supports simultaneous operation of a plurality of firmware tasks, and can only complete corresponding upgrading tasks according to the creation time sequence of the firmware upgrading tasks.
Referring to fig. 8, a firmware upgrade system of a metering device is further disclosed, including a memory 21 and a processor 22, where the processor 22 includes a processor of a system background and a processor of the metering device, the memory 21 includes a program of a firmware upgrade method of the metering device, and when the program of the firmware upgrade method of the metering device is executed by the processor 22, the following steps are implemented:
when the background of the control system receives record data, determining target metering equipment from at least one metering equipment based on equipment identification carried by the record data, and sending summary information of a firmware file corresponding to an upgrade task to the target metering equipment under the condition that the upgrade task to be executed exists in the target metering equipment;
When the target metering equipment is controlled to receive the summary information, matching the summary information with a preset upgrading condition, and sending an upgrading permission result corresponding to the matching result to the system background;
when the system background is controlled to receive the upgrade permission result, sending a data packet corresponding to a firmware file to the target metering equipment based on a preset sending order under the condition that the upgrade permission result is allowable to upgrade until the current sending order reaches the maximum sending order corresponding to the firmware file, and sending a firmware checking instruction to the target metering equipment;
when the target metering equipment is controlled to receive a firmware checking instruction, carrying out integrity checking on a received data packet for firmware upgrading, calculating a cyclic redundancy check result of the data packet for firmware upgrading under the condition that the data packet for firmware upgrading does not have a missing data packet, and feeding back an upgrading completion result to the system background under the condition that the cyclic redundancy check result is correct;
when the system background is controlled to receive the upgrading completion result, a version inquiry instruction is sent to the target metering equipment;
When the target metering equipment is controlled to receive the version inquiry instruction, version information corresponding to the current firmware is sent to the system background;
when the system background is controlled to receive the version information, under the condition that the version information is consistent with the version information corresponding to the firmware file, the upgrading result of the corresponding target metering equipment is recorded as successful upgrading.
By improving the interaction logic between the system background and the metering equipment in the upgrading process, normal upgrading of the metering equipment is guaranteed, the firmware file is transmitted by using the fractional data packet, breakpoint continuous transmission is supported, the packet loss risk of the firmware file is reduced, and meanwhile the transmission efficiency is improved. It should be noted that, the firmware upgrading system of the metering device may have the same beneficial effects as the execution body of the firmware upgrading method of the metering device in any embodiment of the present application.
The invention also provides a computer readable storage medium, wherein the readable storage medium comprises a firmware upgrading method program of the metering device, and when the firmware upgrading method program of the metering device is executed by a processor, the steps of the firmware upgrading method of the metering device are realized.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above described device embodiments are only illustrative, e.g. the division of the units is only one logical function division, and there may be other divisions in practice, such as: multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. In addition, the various components shown or discussed may be coupled or directly coupled or communicatively coupled to each other via some interface, whether indirectly coupled or communicatively coupled to devices or units, whether electrically, mechanically, or otherwise.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units; can be located in one place or distributed to a plurality of network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present invention may be integrated in one processing unit, or each unit may be separately used as one unit, or two or more units may be integrated in one unit; the integrated units may be implemented in hardware or in hardware plus software functional units.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware related to program instructions, and the foregoing program may be stored in a readable storage medium, where the program, when executed, performs steps including the above method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk or an optical disk, or the like, which can store program codes.
Alternatively, the above-described integrated units of the present invention may be stored in a readable storage medium if implemented in the form of software functional modules and sold or used as separate products. Based on such understanding, the technical solution of the embodiments of the present invention may be embodied in essence or a part contributing to the prior art in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, ROM, RAM, magnetic or optical disk, or other medium capable of storing program code.

Claims (4)

1. The firmware upgrading method of the metering equipment is applied to a firmware upgrading system of the metering equipment, the firmware upgrading system of the metering equipment comprises a system background and at least one metering equipment, and the system background and the metering equipment are communicated through a mobile network, and is characterized in that the firmware upgrading method of the metering equipment comprises the following steps:
when the system background receives the record data, determining a target metering device from the at least one metering device based on a device identifier carried by the record data, and sending summary information of a firmware file corresponding to an upgrade task to the target metering device under the condition that the target metering device has the upgrade task to be executed;
when the target metering equipment receives the summary information, matching the summary information with a preset upgrading condition, and sending an upgrading permission result corresponding to the matching result to the system background;
when the system background receives the upgrade permission result, sending a data packet corresponding to a firmware file to the target metering equipment based on a preset sending order under the condition that the upgrade permission result is allowable to upgrade until the current sending order reaches the maximum sending order corresponding to the firmware file, and sending a firmware checking instruction to the target metering equipment;
When the target metering equipment receives a firmware checking instruction, integrity checking is carried out on the received data packet for firmware upgrading, a cyclic redundancy check result of the data packet for firmware upgrading is calculated under the condition that the data packet for firmware upgrading does not have a missing data packet, and an upgrading completion result is fed back to the system background under the condition that the cyclic redundancy check result is correct;
when the system background receives the upgrading completion result, a version inquiry instruction is sent to the target metering equipment;
when the target metering equipment receives the version inquiry instruction, version information corresponding to the current firmware is sent to the system background;
when the system background receives the version information, recording an upgrading result of the corresponding target metering equipment as successful upgrading under the condition that the version information is consistent with the version information corresponding to the firmware file;
and when the system background receives the upgrade permission result, the method further comprises the following steps:
recording the upgrade result of the target metering equipment as upgrade failure and sending a dormancy command to the target metering equipment under the condition that the upgrade permission result is that upgrade is not allowed;
The sending the data packet corresponding to the firmware file to the target metering device based on the preset sending order comprises the following steps:
determining a current sending sequence corresponding to the recently sent data packet and a corresponding reply result according to the recorded sending progress information;
in the case where the current transmission order is smaller than the maximum transmission order corresponding to the firmware file,
if the reply result is invalid or the reply result is not received within a preset time length, sending a data packet corresponding to the current sending sequence to the target metering equipment;
if the reply result is valid, the current sending order is increased to obtain a target sending order, the target sending order is updated to the sending progress information, and a data packet corresponding to the target sending order is sent to the target metering equipment;
after the integrity check is performed on the received data packet for firmware upgrade, the method further comprises:
when the data packet for firmware upgrade has a missing data packet, the target metering equipment sends a position sequence corresponding to the missing data packet to the system background;
after receiving the position sequence, the system background sends a data packet corresponding to the position sequence to the target metering equipment;
After the calculation of the cyclic redundancy check result of the data packet for firmware upgrade, the method further comprises:
sending an upgrade data exception message to the system background under the condition that the cyclic redundancy check result has errors;
after the system background receives the data exception message, recording an upgrading result of the target metering equipment as upgrading failure;
and when the system background receives the version information, the method further comprises the following steps:
recording an upgrading result of the corresponding target metering equipment as upgrading failure under the condition that the version information is inconsistent with the version information corresponding to the firmware file;
the firmware upgrading method of the metering device further comprises the following steps:
and when the preset period is reached, checking the execution condition of the upgrading task.
2. The firmware upgrade method of the metering device of claim 1, wherein the summary information of the firmware file includes manufacturer information, hardware stripes, software version, firmware length, packet number, and firmware CRC information.
3. A firmware upgrade system for a metering device, the firmware upgrade system comprising: the device comprises a memory and a processor, wherein the memory comprises a program of a firmware upgrading method of the metering device, and the program of the firmware upgrading method of the metering device realizes the following steps when being executed by the processor:
When the background of the control system receives record data, determining target metering equipment from at least one metering equipment based on equipment identification carried by the record data, and sending summary information of a firmware file corresponding to an upgrade task to the target metering equipment under the condition that the upgrade task to be executed exists in the target metering equipment;
when the target metering equipment is controlled to receive the summary information, matching the summary information with a preset upgrading condition, and sending an upgrading permission result corresponding to the matching result to the system background;
when the system background is controlled to receive the upgrade permission result, sending a data packet corresponding to a firmware file to the target metering equipment based on a preset sending order under the condition that the upgrade permission result is allowable to upgrade until the current sending order reaches the maximum sending order corresponding to the firmware file, and sending a firmware checking instruction to the target metering equipment;
when the target metering equipment is controlled to receive a firmware checking instruction, carrying out integrity checking on a received data packet for firmware upgrading, calculating a cyclic redundancy check result of the data packet for firmware upgrading under the condition that the data packet for firmware upgrading does not have a missing data packet, and feeding back an upgrading completion result to the system background under the condition that the cyclic redundancy check result is correct;
When the system background is controlled to receive the upgrading completion result, a version inquiry instruction is sent to the target metering equipment;
when the target metering equipment is controlled to receive the version inquiry instruction, version information corresponding to the current firmware is sent to the system background;
when the system background is controlled to receive the version information, recording an upgrading result of the corresponding target metering equipment as upgrading success under the condition that the version information is consistent with the version information corresponding to the firmware file;
and when the system background receives the upgrade permission result, the method further comprises the following steps:
recording the upgrade result of the target metering equipment as upgrade failure and sending a dormancy command to the target metering equipment under the condition that the upgrade permission result is that upgrade is not allowed;
the sending the data packet corresponding to the firmware file to the target metering device based on the preset sending order comprises the following steps:
determining a current sending sequence corresponding to the recently sent data packet and a corresponding reply result according to the recorded sending progress information;
in the case where the current transmission order is smaller than the maximum transmission order corresponding to the firmware file,
If the reply result is invalid or the reply result is not received within a preset time length, sending a data packet corresponding to the current sending sequence to the target metering equipment;
if the reply result is valid, the current sending order is increased to obtain a target sending order, the target sending order is updated to the sending progress information, and a data packet corresponding to the target sending order is sent to the target metering equipment;
after the integrity check is performed on the received data packet for firmware upgrade, the method further comprises:
when the data packet for firmware upgrade has a missing data packet, the target metering equipment sends a position sequence corresponding to the missing data packet to the system background;
after receiving the position sequence, the system background sends a data packet corresponding to the position sequence to the target metering equipment;
after the calculation of the cyclic redundancy check result of the data packet for firmware upgrade, the method further comprises:
sending an upgrade data exception message to the system background under the condition that the cyclic redundancy check result has errors;
after the system background receives the data exception message, recording an upgrading result of the target metering equipment as upgrading failure;
And when the system background receives the version information, the method further comprises the following steps:
recording an upgrading result of the corresponding target metering equipment as upgrading failure under the condition that the version information is inconsistent with the version information corresponding to the firmware file;
the firmware upgrading method of the metering device further comprises the following steps:
and when the preset period is reached, checking the execution condition of the upgrading task.
4. A computer readable storage medium, characterized in that a firmware upgrade method program of a metering device is included in the computer readable storage medium, which when executed by a processor, implements the steps of the firmware upgrade method of a metering device according to any one of claims 1 to 2.
CN202311098951.2A 2023-08-30 2023-08-30 Firmware upgrading method, system and medium of metering equipment Active CN116841591B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311098951.2A CN116841591B (en) 2023-08-30 2023-08-30 Firmware upgrading method, system and medium of metering equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311098951.2A CN116841591B (en) 2023-08-30 2023-08-30 Firmware upgrading method, system and medium of metering equipment

Publications (2)

Publication Number Publication Date
CN116841591A CN116841591A (en) 2023-10-03
CN116841591B true CN116841591B (en) 2023-12-26

Family

ID=88163789

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311098951.2A Active CN116841591B (en) 2023-08-30 2023-08-30 Firmware upgrading method, system and medium of metering equipment

Country Status (1)

Country Link
CN (1) CN116841591B (en)

Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102314369A (en) * 2011-10-09 2012-01-11 杭州先锋电子技术股份有限公司 Self-upgrade method for equipment in remote online monitoring system
CN102546784A (en) * 2011-12-29 2012-07-04 深圳市迈进科技有限公司 Method based on controller area network (CAN) bus and used for conducting batch upgrading for device firmware
CN105204911A (en) * 2015-10-15 2015-12-30 成都艾克尔特医疗科技有限公司 Method and system for upgrading firmware of vital sign monitoring bracelet
CN105591824A (en) * 2016-01-14 2016-05-18 杭州赫智电子科技有限公司 Method and system for firmware upgrade
CN109358883A (en) * 2018-11-05 2019-02-19 珠海格力电器股份有限公司 Programme upgrade method, system and application system, storage medium
CN109857443A (en) * 2019-01-25 2019-06-07 深圳市泰比特科技有限公司 A kind of upgrade method and system of shared motor bicycle whole-control system
CN109976784A (en) * 2019-01-24 2019-07-05 金卡智能集团股份有限公司 Intelligent internet of things measuring instrument remote firmware updating method and system
CN110119280A (en) * 2018-02-06 2019-08-13 深圳市帝迈生物技术有限公司 The method and device of more firmware upgrades
CN113934442A (en) * 2021-09-30 2022-01-14 青岛海尔科技有限公司 Software upgrading method and device
CN114398050A (en) * 2021-12-03 2022-04-26 北京罗克维尔斯科技有限公司 Charging pile software upgrading method, device, equipment and storage medium
CN116069373A (en) * 2022-11-30 2023-05-05 浪潮(山东)计算机科技有限公司 BMC firmware upgrading method, device and medium thereof
CN116382746A (en) * 2023-03-31 2023-07-04 苏州浪潮智能科技有限公司 Firmware upgrading method, device, equipment and medium
CN116382753A (en) * 2023-03-31 2023-07-04 南京嗯哇智能科技有限公司 High-reliability remote upgrading method for equipment firmware based on network
CN116483416A (en) * 2023-04-10 2023-07-25 天固信息安全系统(深圳)有限公司 Firmware online upgrading method, server and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020188934A1 (en) * 2001-06-12 2002-12-12 Nortel Networks Limited Method and system for upgrading existing firmware on third party hardware
CN111552491A (en) * 2020-04-22 2020-08-18 北京小马智行科技有限公司 Method, device and storage medium for upgrading firmware of transfer equipment of mobile carrier

Patent Citations (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102314369A (en) * 2011-10-09 2012-01-11 杭州先锋电子技术股份有限公司 Self-upgrade method for equipment in remote online monitoring system
CN102546784A (en) * 2011-12-29 2012-07-04 深圳市迈进科技有限公司 Method based on controller area network (CAN) bus and used for conducting batch upgrading for device firmware
CN105204911A (en) * 2015-10-15 2015-12-30 成都艾克尔特医疗科技有限公司 Method and system for upgrading firmware of vital sign monitoring bracelet
CN105591824A (en) * 2016-01-14 2016-05-18 杭州赫智电子科技有限公司 Method and system for firmware upgrade
CN110119280A (en) * 2018-02-06 2019-08-13 深圳市帝迈生物技术有限公司 The method and device of more firmware upgrades
CN109358883A (en) * 2018-11-05 2019-02-19 珠海格力电器股份有限公司 Programme upgrade method, system and application system, storage medium
CN109976784A (en) * 2019-01-24 2019-07-05 金卡智能集团股份有限公司 Intelligent internet of things measuring instrument remote firmware updating method and system
CN109857443A (en) * 2019-01-25 2019-06-07 深圳市泰比特科技有限公司 A kind of upgrade method and system of shared motor bicycle whole-control system
CN113934442A (en) * 2021-09-30 2022-01-14 青岛海尔科技有限公司 Software upgrading method and device
CN114398050A (en) * 2021-12-03 2022-04-26 北京罗克维尔斯科技有限公司 Charging pile software upgrading method, device, equipment and storage medium
CN116069373A (en) * 2022-11-30 2023-05-05 浪潮(山东)计算机科技有限公司 BMC firmware upgrading method, device and medium thereof
CN116382746A (en) * 2023-03-31 2023-07-04 苏州浪潮智能科技有限公司 Firmware upgrading method, device, equipment and medium
CN116382753A (en) * 2023-03-31 2023-07-04 南京嗯哇智能科技有限公司 High-reliability remote upgrading method for equipment firmware based on network
CN116483416A (en) * 2023-04-10 2023-07-25 天固信息安全系统(深圳)有限公司 Firmware online upgrading method, server and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于无线分包传输的气象站固件无感升级方法;黄飞龙;谭晗凌;陈冰怀;;计算机测量与控制;28(1);166-169、174 *

Also Published As

Publication number Publication date
CN116841591A (en) 2023-10-03

Similar Documents

Publication Publication Date Title
CN110554930B (en) Data storage method and related equipment
CN111258900A (en) Interface test script generation method, system, equipment and storage medium
CN112130881A (en) Firmware remote upgrading method and device
CN114449018B (en) Automatic log file uploading method and system for power acquisition terminal
CN112114876A (en) Equipment control method, system, electronic equipment and storage medium
CN112380046B (en) Calculation result verification method, system, device, equipment and storage medium
CN110677211B (en) Time synchronization method and device and power acquisition terminal
CN110740071A (en) network interface monitoring method, device and system
CN112631628A (en) Singlechip upgrading method, singlechip and storage medium
CN112100081A (en) Upgrade test method and device based on double-core intelligent electric meter and computer equipment
CN116841591B (en) Firmware upgrading method, system and medium of metering equipment
KR101350059B1 (en) Apparatus and method for upgrading meter firmware
CN117391099A (en) Data downloading and checking method and system for smart card and storage medium
CN115604095A (en) Network equipment configuration method and system
CN112181444B (en) DSP multi-core data programming method based on 1553B bus
CN110620800A (en) Method and device for synchronously processing configuration data of power secondary system across safety zones
KR20200053850A (en) Method for updating BMS software of an energy storage system having different internal and external communication methods
CN114531289A (en) System interaction method based on artificial intelligence and related equipment
KR20220077485A (en) Remote meter reading system and its firmware upgrade method
CN113682964B (en) Equipment parameter management and recovery method, platform, device, crane and system
CN113141366B (en) Message submitting method and device, storage medium and electronic equipment
CN116248745A (en) Anesthesia machine communication method, anesthesia machine communication device, anesthesia machine communication equipment, anesthesia machine communication computer equipment and anesthesia machine storage medium
CN111597063A (en) Method for testing reliability of software upgrading file of electric energy meter
CN101594253B (en) Method and system for single board upgrading
CN117348900A (en) Electric energy meter matching upgrading method and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant