CN108494818B - Online upgrading method for photovoltaic data acquisition gateway equipment - Google Patents

Online upgrading method for photovoltaic data acquisition gateway equipment Download PDF

Info

Publication number
CN108494818B
CN108494818B CN201810138134.8A CN201810138134A CN108494818B CN 108494818 B CN108494818 B CN 108494818B CN 201810138134 A CN201810138134 A CN 201810138134A CN 108494818 B CN108494818 B CN 108494818B
Authority
CN
China
Prior art keywords
upgrading
gateway equipment
program
message
service center
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.)
Expired - Fee Related
Application number
CN201810138134.8A
Other languages
Chinese (zh)
Other versions
CN108494818A (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.)
Xi'an Rongsheng Zhihui Electronic Technology Co ltd
Original Assignee
Xi'an Rongsheng Zhihui Electronic 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 Xi'an Rongsheng Zhihui Electronic Technology Co ltd filed Critical Xi'an Rongsheng Zhihui Electronic Technology Co ltd
Priority to CN201810138134.8A priority Critical patent/CN108494818B/en
Publication of CN108494818A publication Critical patent/CN108494818A/en
Application granted granted Critical
Publication of CN108494818B publication Critical patent/CN108494818B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Medical Informatics (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Information Transfer Between Computers (AREA)
  • Computer And Data Communications (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses an online upgrading method of photovoltaic data acquisition gateway equipment, which is characterized in that upgrading program data are sent to the gateway equipment from a cloud data service center, so that the gateway equipment completes online upgrading; the method comprises the following steps: the method comprises the following steps: the cloud data service center sends upgrading information to the gateway equipment through an MQTT message transmission protocol; step two: the cloud data service center transmits the upgrading program data to the gateway equipment through MQTT message transmission protocol sub-packets; step three: and copying the upgrading program data in the external FLASH of the gateway equipment to the internal space of the single chip microcomputer of the gateway equipment, and completely reading the upgrading program data in the internal space of the single chip microcomputer of the gateway equipment. The invention can realize online high-reliability upgrading, even if the network is disconnected and the equipment is powered off in the upgrading process, the gateway equipment can not work due to program loss, and the safety of the upgrading process is ensured.

Description

Online upgrading method for photovoltaic data acquisition gateway equipment
Technical Field
The invention belongs to the field of photovoltaic data acquisition monitoring, relates to an upgrading method of photovoltaic data acquisition gateway equipment, and particularly relates to an online upgrading method of photovoltaic data acquisition gateway equipment.
Background
Photovoltaic power generation is a clear new forms of energy power generation mode, has no secondary pollution, erects portably, and later stage is with low costs, advantage such as lasting income time length. The household distributed photovoltaic power generation system takes a roof and open ground as carriers, and utilizes the terrain resources to the maximum extent, so that the photovoltaic power generation system can be propelled by families and buildings as units, and the acceptance degree of photovoltaic new energy is greatly improved. In the photovoltaic collection system, due to the upgrading and improving requirements of the programs of the gateway equipment, an upgrading interface needs to be reserved. The internal firmware of the existing photovoltaic collection monitoring equipment is fixed when leaving a factory, program updating cannot be carried out, or off-line upgrading or factory returning upgrading can only be carried out through specific program upgrading equipment, a photovoltaic collection monitoring equipment part with WIFI/GPRS has a network upgrading mode, but the upgrading reliability is guaranteed only by adopting an error correction mechanism of a network, and the problem that the collection monitoring equipment cannot be normally started or works due to upgrading failure probability exists under the conditions that the network is accidentally disconnected, the power supply of the equipment is unstable and the like.
Disclosure of Invention
Aiming at the defects and shortcomings in the prior art, the invention provides an online upgrading method of photovoltaic data acquisition gateway equipment, which overcomes the defect of poor reliability of the existing photovoltaic data acquisition equipment during upgrading.
In order to achieve the purpose, the invention adopts the following technical scheme:
the invention provides an online upgrading method of photovoltaic data acquisition gateway equipment, which is characterized in that upgrading program data are sent to the gateway equipment from a cloud data service center, so that the gateway equipment completes online upgrading; the method comprises the following steps:
the method comprises the following steps: starting an upgrading process: the cloud data service center sends upgrading information to the gateway equipment through an MQTT message transmission protocol, the gateway equipment receives and decodes the upgrading information to judge whether the upgrading information meets the requirements, if the upgrading information meets the requirements, the gateway equipment enters an upgrading mode to return to confirm the upgrading information and executes the second step, and if not, the gateway equipment returns to reject the upgrading information;
step two: the upgrading program data sending process comprises the following steps: the cloud data service center transmits the upgrading program data to the gateway equipment through MQTT message transmission protocol sub-packets, the gateway equipment writes the upgrading program data into external FLASH of the gateway equipment after receiving and checking the upgrading program data until all upgrading program data packets are successfully received, and the third step is executed;
step three: the gateway equipment upgrading process comprises the following steps: and copying the upgrading program data in the external FLASH of the gateway equipment to the internal space of the single chip microcomputer of the gateway equipment, completely reading the upgrading program data in the internal space of the single chip microcomputer of the gateway equipment, executing the restarting of the gateway equipment again, and sending upgrading success or upgrading failure information to the cloud data service center by the gateway equipment to finish upgrading operation.
The invention also has the following distinguishing technical characteristics:
optionally, the external FLASH is divided into a first region, a second region and a third region; the first area is used for storing the flag quantity related to the upgrade, and the flag quantity related to the upgrade comprises: the method comprises the following steps that a new upgrading program mark, a CRC16 check code of a new upgrading program, the length of the upgrading program, the version number of the upgrading program, a successful upgrading program mark, an upgrading information reporting mark, the length of a backup area program and a CRC16 check code of the backup area program exist; the flags of the flag amount related to the upgrade change with the state of the upgrade process; the region two is used for storing received upgrading program data; the third area is used for storing a backup area program; the backup area program is an original program stored when the external FLASH leaves the factory; the GPRS module of the gateway equipment is used as a data communication carrier; the internal space of the gateway equipment singlechip is used for reading upgrading program data and upgrading the gateway equipment.
Optionally, the step one includes the steps of:
a1: the gateway equipment ID, GPRS base station information and power station auxiliary information are uploaded to a cloud end data service center through a GPRS module and an MQTT message transmission protocol, and the gateway equipment is authenticated with the cloud end data service center;
a2: the method comprises the steps that a cloud data service center sends upgrading information to gateway equipment through an MQTT message transmission protocol, wherein the upgrading information comprises a message theme and message content, the message theme is a station name/UPDATA, and the message content is a gateway equipment ID, a version number of an upgrading program, a length of the upgrading program and a CRC16 check code;
a3: after the gateway equipment receives and confirms the message subject in the step A2, decoding and judging whether the gateway equipment ID in the message content is consistent with the gateway equipment ID of the gateway equipment, if so, executing the step A4, otherwise, returning a message of refusing to upgrade;
a4: the gateway equipment judges whether the version number of the upgrading program in the message content is consistent with the version number of the existing program, if so, the gateway equipment returns the upgrading refusing message, otherwise, the gateway equipment executes the step A5;
a5: the gateway equipment judges whether the length of the upgrading program in the message content is larger than the maximum program length allowed by the gateway equipment, if so, the gateway equipment also returns a message of refusing to upgrade, otherwise, the gateway equipment returns a message of confirming the upgrade, and the gateway equipment enters an upgrading mode.
Optionally, the second step includes the following steps:
b1: when the cloud data service center receives the upgrading refusing message, displaying the upgrading refusing message beside the gateway equipment corresponding to the page of the cloud data service center; after receiving the upgrade confirmation message, the cloud data service center transmits the upgrade program data in packets, wherein the maximum length of each packet is 4Kbyte, the message subject of each packet of the upgrade program data is a station name/UPDATA, and the message content is a gateway device ID, the upgrade process starting time, the version number of the upgrade program, the length of the upgrade program, the upgrade program data packet length in the message frame, the upgrade data packet CRC16 check code and the upgrade program data; the upgrading process starting time is provided by an MQTT message transmission protocol issued by a cloud data service center, the version number of an upgrading program and the length of the upgrading program are obtained after the cloud data service center reads the version number of the existing program, the length of an upgrading program data packet in the message frame is obtained by calculating after the cloud data service center automatically subpackages overlong upgrading program data, and a CRC16 check code of the upgrading data packet is obtained by calculating by the cloud data service center according to the upgrading program data packet in the message frame through a CRC16 method;
b2: after confirming that upgrading enters an upgrading mode, the gateway equipment starts an overtime timer, if the gateway equipment ID is judged to be the own gateway equipment ID after receiving a message with a station name/UPDATA message as a message subject sent by a cloud data service center within the time of the timer, the message content is read, firstly, a CRC16 check code is calculated and compared with a CRC16 check code of an upgrading data packet in the message content, if the message content is successful, the step B3 is executed, otherwise, a frame failure message is returned, and the frame failure message adopts the time of sending the message by the cloud data service center and the gateway equipment ID as the message content;
b3: the gateway equipment writes the received upgrading program data into a second area of the external FLASH according to the offset address, then carries out external FLASH reading operation and recalculates a CRC16 check code, returns a frame success message to the cloud data service center after verification is passed, and returns a frame failure message if the frame success message and the frame failure message adopt the time of sending the message by the cloud data service center and the gateway equipment ID as message contents;
b4: the corresponding process of the cloud data service center decodes the successful message of the frame returned by the gateway equipment after receiving the successful message of the frame, and whether the response is the latest upgrading program data packet is determined according to the time of sending the message by the cloud data service center in the message content and the ID of the gateway equipment; if yes, sending an upgrading program data packet of the next frame of upgrading program data, and repeating the process until all upgrading program data packets of the upgrading program data are successfully sent; if the cloud data service center receives the frame failure message, retry the steps B1, B2 and B3, and after the retry times are more than 3, close the upgrading process of the gateway device and prompt upgrading failure beside the corresponding gateway device on the page of the cloud data service center.
Optionally, the third step includes the following steps:
c1: reading the upgrading program data in the second region of the external FLASH, performing CRC16 verification, marking the existence of a new upgrading program in the first region of the external FLASH to be 1 after successful verification, writing corresponding information into a CRC16 verification code of the new upgrading program in the first region, the length of the upgrading program and the version number of the upgrading program, and then starting a restart command;
c2: reading all information of an external FLASH area I by the gateway equipment, when a new upgrading program mark is 1, reading upgrading program data content in the external FLASH area II, performing CRC16 verification, copying the content of the area II into a single-chip microcomputer internal space of the gateway equipment after the content of the upgrading program data in the external FLASH area II is consistent with a CRC16 verification code of a new upgrading program in the area I, completely reading the upgrading program data in the single-chip microcomputer internal space of the gateway equipment after the copying is completed, performing CRC16 verification again, covering the upgrading program data into a backup area program of an external FLASH area III after the upgrading program data passes the CRC16 verification, re-copying the backup area program of the area III into the single-chip microcomputer internal space of the gateway equipment if any step of the updating program fails after restarting, and otherwise, executing a step C3;
c3: updating the version number of the program to the version number of the latest upgrading program, marking the existing new upgrading program in the first area as 0, updating the program length of the backup area in the first area and the CRC16 check code of the backup area program into corresponding parameters of the latest upgrading program, then marking the success flag of the upgrading program in the first area and the reporting flag of upgrading information as 1, and then jumping to the single chip microcomputer internal space program of the gateway equipment to execute the user program;
c4: reading an upgrading program success mark and an upgrading information reporting mark in an external FLASH area I, when the upgrading information reporting mark is 1, using UPDATA as a message subject, sending the upgrading program success mark, a current program version number, time of sending a message by a last frame data center and gateway equipment ID information as message contents to a cloud data service center, judging whether the time information and the gateway equipment ID are consistent with the last frame upgrading program data sending message of the process again when an upgrading process of the cloud data service center receives the message subject of the UPDATA and analyzes that the message contents are upgrading failure or upgrading success, and displaying the upgrading success or failure message and the current equipment version number on a page of the cloud data service center if the time information and the gateway equipment ID are consistent with the last frame upgrading program data sending message to finish upgrading operation.
Compared with the prior art, the invention has the beneficial technical effects that:
the upgrading method of the invention uses GPRS as a data communication carrier, uses TCP/IP as a network protocol, sends and confirms an upgrading data packet through an MQTT message transmission protocol, uses an additional external FLASH to store an original program backup and a new upgrading program, adopts a CRC16 verification and external FLASH verification mechanism, starts the upgrading program after correctly receiving all upgrading data, restarts the gateway after the upgrading program determines that the external FLASH is completely and correctly rewritten, or uses a backup program to recover the gateway and informs an online upgrading server of the upgrading state of equipment.
In the online upgrading system, the external FLASH is adopted to store the program upgrading state, the program to be upgraded and the backup program, and the verification mechanism and the response mechanism are combined to ensure the program safety under the conditions of network failure, power failure and the like.
(III) in the online upgrading system, an operator of the cloud data service center can set retry times, overtime time and whether to try upgrading again after upgrading fails; the online upgrading system and the upgrading method of the photovoltaic data acquisition gateway equipment can realize online high-reliability upgrading, and even if the network is disconnected in the upgrading process and the equipment is powered off, the gateway equipment cannot work due to program loss, so that the safety of the upgrading process is ensured.
Detailed Description
The following describes in detail specific embodiments of the present invention. It should be understood that the detailed description and specific examples, while indicating the present invention, are given by way of illustration and explanation only, not limitation.
In order to solve the reliable on-line upgrading requirement of the photovoltaic data acquisition gateway equipment for users and eliminate the possibility of upgrading failure caused by external adverse environments such as accidental disconnection of a network, unstable power supply and the like, the invention provides an upgrading method of an on-line upgrading system of the photovoltaic data acquisition gateway equipment, the method uses GPRS as a data communication carrier, uses TCP/IP as a network protocol, sending down and confirming the upgrading program data packet through MQTT message transmission protocol, using extra external FLASH to store original program backup and new upgrading program data, adopting CRC16 checking and FLASH checking mechanism, and starting the upgrading program after correctly receiving all upgrading program data, restarting the gateway after the upgrading program determines that the external FLASH is completely and correctly rewritten, and otherwise, recovering the gateway by using the backup program and informing the online upgrading server of the upgrading state of the equipment.
The invention discloses an online upgrading method of photovoltaic data acquisition gateway equipment, which is characterized in that upgrading program data are sent to the gateway equipment from a cloud data service center, so that the gateway equipment completes online upgrading; the method comprises the following steps:
the method comprises the following steps: starting an upgrading process: the cloud data service center sends upgrading information to the gateway equipment through an MQTT message transmission protocol, the gateway equipment receives and decodes the upgrading information to judge whether the upgrading information meets the requirements, if the upgrading information meets the requirements, the gateway equipment enters an upgrading mode to return to confirm the upgrading information and executes the second step, and if not, the gateway equipment returns to reject the upgrading information;
step two: the upgrading program data sending process comprises the following steps: the cloud data service center transmits the upgrading program data to the gateway equipment through MQTT message transmission protocol sub-packets, the gateway equipment writes the upgrading program data into external FLASH of the gateway equipment after receiving and checking the upgrading program data until all upgrading program data packets are successfully received, and the third step is executed;
step three: the gateway equipment upgrading process comprises the following steps: and copying the upgrading program data in the external FLASH of the gateway equipment to the internal space of the single chip microcomputer of the gateway equipment, completely reading the upgrading program data in the internal space of the single chip microcomputer of the gateway equipment, executing the restarting of the gateway equipment again, and sending upgrading success or upgrading failure information to the cloud data service center by the gateway equipment to finish upgrading operation.
Through the technical scheme, the operator can also set retry times, timeout time and whether to try upgrading again after upgrading fails. On the basis of the method for upgrading the photovoltaic acquisition gateway equipment, online high-reliability upgrading can be achieved, even if a network is disconnected in the upgrading process and the equipment is powered off, the gateway equipment cannot work due to program loss, and the safety of the upgrading process is guaranteed. The gateway equipment in the photovoltaic equipment monitoring system can be upgraded on line in a GPRS mode; the universal Internet of things message transmission protocol MQTT message transmission protocol is adopted, so that the system can be conveniently integrated in the existing cloud data service; the program upgrading state is stored by adopting an external FLASH, the program to be upgraded and the backup program are combined with a verification mechanism and a response mechanism, and the program safety under the conditions of network failure, power failure and the like is ensured.
The present invention is not limited to the following embodiments, and all equivalent changes based on the technical solutions of the present invention fall within the protection scope of the present invention. The present invention will be described in further detail with reference to examples.
Example 1:
the embodiment discloses an online upgrading method for photovoltaic data acquisition gateway equipment, which is characterized in that upgrading program data are sent to the gateway equipment from a cloud data service center, so that the gateway equipment completes online upgrading; the method comprises the following steps:
the method comprises the following steps: starting an upgrading process: the cloud data service center sends upgrading information to the gateway equipment through an MQTT message transmission protocol, the gateway equipment receives and decodes the upgrading information to judge whether the upgrading information meets the requirements, if the upgrading information meets the requirements, the gateway equipment enters an upgrading mode to return to confirm the upgrading information and executes the second step, and if not, the gateway equipment returns to reject the upgrading information;
step two: the upgrading program data sending process comprises the following steps: the cloud data service center transmits the upgrading program data to the gateway equipment through MQTT message transmission protocol sub-packets, the gateway equipment writes the upgrading program data into external FLASH of the gateway equipment after receiving and checking the upgrading program data until all upgrading program data packets are successfully received, and the third step is executed;
step three: the gateway equipment upgrading process comprises the following steps: and copying the upgrading program data in the external FLASH of the gateway equipment to the internal space of the single chip microcomputer of the gateway equipment, completely reading the upgrading program data in the internal space of the single chip microcomputer of the gateway equipment, executing the restarting of the gateway equipment again, and sending upgrading success or upgrading failure information to the cloud data service center by the gateway equipment to finish upgrading operation.
Specifically, the external FLASH is divided into a first area, a second area and a third area; a first area for storing a quantity of flags associated with an upgrade, the quantity of flags associated with an upgrade comprising: the method comprises the following steps that a new upgrading program mark, a CRC16 check code of a new upgrading program, the length of the upgrading program, the version number of the upgrading program, a successful upgrading program mark, an upgrading information reporting mark, the length of a backup area program and a CRC16 check code of the backup area program exist; the flags of the flag amount related to the upgrade change with the state of the upgrade process; the region two is used for storing received upgrading program data; the third area is used for storing a backup area program; the backup area program is an original program stored when the external FLASH leaves the factory; the GPRS module of the gateway equipment is used as a data communication carrier; the internal space of the gateway equipment singlechip is used for reading upgrading program data and upgrading the gateway equipment.
In this embodiment, the first step includes the following steps:
a1: the gateway equipment ID, GPRS base station information and power station auxiliary information are uploaded to a cloud end data service center through a GPRS module and an MQTT message transmission protocol, and the gateway equipment is authenticated with the cloud end data service center;
a2: the method comprises the steps that a cloud data service center sends upgrading information to gateway equipment through an MQTT message transmission protocol, wherein the upgrading information comprises a message theme and message content, the message theme is a station name/UPDATA, and the message content is a gateway equipment ID, a version number of an upgrading program, a length of the upgrading program and a CRC16 check code;
a3: after the gateway equipment receives and confirms the message subject in the step A2, decoding and judging whether the gateway equipment ID in the message content is consistent with the gateway equipment ID of the gateway equipment, if so, executing the step A4, otherwise, returning a message of refusing to upgrade;
a4: the gateway equipment judges whether the version number of the upgrading program in the message content is consistent with the version number of the existing program, if so, the gateway equipment returns the upgrading refusing message, otherwise, the gateway equipment executes the step A5;
a5: the gateway equipment judges whether the length of the upgrading program in the message content is larger than the maximum program length allowed by the gateway equipment, if so, the gateway equipment also returns a message of refusing to upgrade, otherwise, the gateway equipment returns a message of confirming the upgrade, and the gateway equipment enters an upgrading mode.
Specifically, the second step comprises the following steps:
b1: when the cloud data service center receives the upgrading refusing message, displaying the upgrading refusing message beside the gateway equipment corresponding to the page of the cloud data service center; after receiving the upgrade confirmation message, the cloud data service center transmits the upgrade program data in packets, wherein the maximum length of each packet is 4Kbyte, the message subject of each packet of the upgrade program data is a station name/UPDATA, and the message content is a gateway device ID, the upgrade process starting time, the version number of the upgrade program, the length of the upgrade program, the upgrade program data packet length in the message frame, the upgrade data packet CRC16 check code and the upgrade program data; the upgrading process starting time is provided by an MQTT message transmission protocol issued by a cloud data service center, the version number of an upgrading program and the length of the upgrading program are obtained after the cloud data service center reads the version number of the existing program, the length of an upgrading program data packet in the message frame is obtained by calculating after the cloud data service center automatically subpackages overlong upgrading program data, and a CRC16 check code of the upgrading data packet is obtained by calculating by the cloud data service center according to the upgrading program data packet in the message frame through a CRC16 method;
b2: after confirming that upgrading enters an upgrading mode, the gateway equipment starts an overtime timer, if the gateway equipment ID is judged to be the own gateway equipment ID after receiving a message with a station name/UPDATA message as a message subject sent by a cloud data service center within the time of the timer, the message content is read, firstly, a CRC16 check code is calculated and compared with a CRC16 check code of an upgrading data packet in the message content, if the message content is successful, the step B3 is executed, otherwise, a frame failure message is returned, and the frame failure message adopts the time of sending the message by the cloud data service center and the gateway equipment ID as the message content;
b3: the gateway equipment writes the received upgrading program data into a second area of the external FLASH according to the offset address, then carries out external FLASH reading operation and recalculates a CRC16 check code, returns a frame success message to the cloud data service center after verification is passed, and returns a frame failure message if the frame success message and the frame failure message adopt the time of sending the message by the cloud data service center and the gateway equipment ID as message contents;
b4: the corresponding process of the cloud data service center decodes the successful message of the frame returned by the gateway equipment after receiving the successful message of the frame, and whether the response is the latest upgrading program data packet is determined according to the time of sending the message by the cloud data service center in the message content and the ID of the gateway equipment; if yes, sending an upgrading program data packet of the next frame of upgrading program data, and repeating the process until all upgrading program data packets of the upgrading program data are successfully sent; if the cloud data service center receives the frame failure message, retry the steps B1, B2 and B3, and after the retry times are more than 3, close the upgrading process of the gateway device and prompt upgrading failure beside the corresponding gateway device on the page of the cloud data service center.
In this embodiment, the third step includes the following steps:
c1: reading the upgrading program data in the second region of the external FLASH, performing CRC16 verification, marking the existence of a new upgrading program in the first region of the external FLASH to be 1 after successful verification, writing corresponding information into a CRC16 verification code of the new upgrading program in the first region, the length of the upgrading program and the version number of the upgrading program, and then starting a restart command;
c2: reading all information of an external FLASH area I by the gateway equipment, when a new upgrading program mark is 1, reading upgrading program data content in the external FLASH area II, performing CRC16 verification, copying the content of the area II into a single-chip microcomputer internal space of the gateway equipment after the content of the upgrading program data in the external FLASH area II is consistent with a CRC16 verification code of a new upgrading program in the area I, completely reading the upgrading program data in the single-chip microcomputer internal space of the gateway equipment after the copying is completed, performing CRC16 verification again, covering the upgrading program data into a backup area program of an external FLASH area III after the upgrading program data passes the CRC16 verification, re-copying the backup area program of the area III into the single-chip microcomputer internal space of the gateway equipment if any step of the updating program fails after restarting, and otherwise, executing a step C3;
c3: updating the version number of the program to the version number of the latest upgrading program, marking the existing new upgrading program in the first area as 0, updating the program length of the backup area in the first area and the CRC16 check code of the backup area program into corresponding parameters of the latest upgrading program, then marking the success flag of the upgrading program in the first area and the reporting flag of upgrading information as 1, and then jumping to the single chip microcomputer internal space program of the gateway equipment to execute the user program;
c4: reading an upgrading program success mark and an upgrading information reporting mark in an external FLASH area I, when the upgrading information reporting mark is 1, using UPDATA as a message subject, sending the upgrading program success mark, a current program version number, time of sending a message by a last frame data center and gateway equipment ID information as message contents to a cloud data service center, judging whether the time information and the gateway equipment ID are consistent with the last frame upgrading program data sending message of the process again when an upgrading process of the cloud data service center receives the message subject of the UPDATA and analyzes that the message contents are upgrading failure or upgrading success, and displaying the upgrading success or failure message and the current equipment version number on a page of the cloud data service center if the time information and the gateway equipment ID are consistent with the last frame upgrading program data sending message to finish upgrading operation.

Claims (2)

1. The method is characterized in that upgrading program data are sent to the gateway equipment from a cloud data service center, so that the gateway equipment completes online upgrading; the method comprises the following steps:
the method comprises the following steps: starting an upgrading process: the cloud data service center sends upgrading information to the gateway equipment through an MQTT message transmission protocol, the gateway equipment receives and decodes the upgrading information to judge whether the upgrading information meets the requirements, if the upgrading information meets the requirements, the gateway equipment enters an upgrading mode to return to confirm the upgrading information and executes the second step, and if not, the gateway equipment returns to reject the upgrading information;
step two: the upgrading program data sending process comprises the following steps: the cloud data service center transmits the upgrading program data to the gateway equipment through MQTT message transmission protocol sub-packets, the gateway equipment writes the upgrading program data into external FLASH of the gateway equipment after receiving and checking the upgrading program data until all upgrading program data packets are successfully received, and the third step is executed;
step three: the gateway equipment upgrading process comprises the following steps: copying upgrading program data in an external FLASH of the gateway equipment to an internal space of a single-chip microcomputer of the gateway equipment, completely reading the upgrading program data in the internal space of the single-chip microcomputer of the gateway equipment, executing the restarting of the gateway equipment again, and sending upgrading success or upgrading failure information to a cloud data service center by the gateway equipment to finish upgrading operation;
the external FLASH is divided into a first area, a second area and a third area; the first area is used for storing the flag quantity related to the upgrade, and the flag quantity related to the upgrade comprises: the method comprises the following steps that a new upgrading program mark, a CRC16 check code of a new upgrading program, the length of the upgrading program, the version number of the upgrading program, a successful upgrading program mark, an upgrading information reporting mark, the length of a backup area program and a CRC16 check code of the backup area program exist; the flags of the flag amount related to the upgrade change with the state of the upgrade process; the region two is used for storing received upgrading program data; the third area is used for storing a backup area program; the backup area program is an original program stored when the external FLASH leaves the factory; the GPRS module of the gateway equipment is used as a data communication carrier; the internal space of the gateway equipment singlechip is used for reading upgrading program data and upgrading the gateway equipment;
the first step comprises the following steps:
a1: the gateway equipment ID, GPRS base station information and power station auxiliary information are uploaded to a cloud end data service center through a GPRS module and an MQTT message transmission protocol, and the gateway equipment is authenticated with the cloud end data service center;
a2: the method comprises the steps that a cloud data service center sends upgrading information to gateway equipment through an MQTT message transmission protocol, wherein the upgrading information comprises a message theme and message content, the message theme is a station name/UPDATA, and the message content is a gateway equipment ID, a version number of an upgrading program, a length of the upgrading program and a CRC16 check code;
a3: after the gateway equipment receives and confirms the message subject in the step A2, decoding and judging whether the gateway equipment ID in the message content is consistent with the gateway equipment ID of the gateway equipment, if so, executing the step A4, otherwise, returning a message of refusing to upgrade;
a4: the gateway equipment judges whether the version number of the upgrading program in the message content is consistent with the version number of the existing program, if so, the gateway equipment returns the upgrading refusing message, otherwise, the gateway equipment executes the step A5;
a5: the gateway equipment judges whether the length of an upgrading program in the message content is larger than the maximum program length allowed by the gateway equipment, if so, the gateway equipment also returns an upgrading refusing message, otherwise, the gateway equipment returns an upgrading confirming message, and the gateway equipment enters an upgrading mode;
the third step comprises the following steps:
c1: reading the upgrading program data in the second region of the external FLASH, performing CRC16 verification, marking the existence of a new upgrading program in the first region of the external FLASH to be 1 after successful verification, writing corresponding information into a CRC16 verification code of the new upgrading program in the first region, the length of the upgrading program and the version number of the upgrading program, and then starting a restart command;
c2: reading all information of an external FLASH area I by the gateway equipment, when a new upgrading program mark is 1, reading upgrading program data content in the external FLASH area II, performing CRC16 verification, copying the content of the area II into a single-chip microcomputer internal space of the gateway equipment after the content of the upgrading program data in the external FLASH area II is consistent with a CRC16 verification code of a new upgrading program in the area I, completely reading the upgrading program data in the single-chip microcomputer internal space of the gateway equipment after the copying is completed, performing CRC16 verification again, covering the upgrading program data into a backup area program of an external FLASH area III after the upgrading program data passes the CRC16 verification, re-copying the backup area program of the area III into the single-chip microcomputer internal space of the gateway equipment if any step of the updating program fails after restarting, and otherwise, executing a step C3;
c3: updating the version number of the program to the version number of the latest upgrading program, marking the existing new upgrading program in the first area as 0, updating the program length of the backup area in the first area and the CRC16 check code of the backup area program into corresponding parameters of the latest upgrading program, then marking the success flag of the upgrading program in the first area and the reporting flag of upgrading information as 1, and then jumping to the single chip microcomputer internal space program of the gateway equipment to execute the user program;
c4: reading an upgrading program success mark and an upgrading information reporting mark in an external FLASH area I, when the upgrading information reporting mark is 1, using UPDATA as a message subject, sending the upgrading program success mark, a current program version number, time of sending a message by a last frame data center and gateway equipment ID information as message contents to a cloud data service center, judging whether the time information and the gateway equipment ID are consistent with the last frame upgrading program data sending message of the process again when an upgrading process of the cloud data service center receives the message subject of the UPDATA and analyzes that the message contents are upgrading failure or upgrading success, and displaying the upgrading success or failure message and the current equipment version number on a page of the cloud data service center if the time information and the gateway equipment ID are consistent with the last frame upgrading program data sending message to finish upgrading operation.
2. The upgrading method according to claim 1, characterized in that said step two comprises the steps of:
b1: when the cloud data service center receives the upgrading refusing message, displaying the upgrading refusing message beside the gateway equipment corresponding to the page of the cloud data service center; after receiving the upgrade confirmation message, the cloud data service center transmits the upgrade program data in packets, wherein the maximum length of each packet is 4Kbyte, the message subject of each packet of the upgrade program data is a station name/UPDATA, and the message content is a gateway device ID, the upgrade process starting time, the version number of the upgrade program, the length of the upgrade program, the upgrade program data packet length in the message frame, the upgrade data packet CRC16 check code and the upgrade program data; the upgrading process starting time is provided by an MQTT message transmission protocol issued by a cloud data service center, the version number of an upgrading program and the length of the upgrading program are obtained after the cloud data service center reads the version number of the existing program, the length of an upgrading program data packet in the message frame is obtained by calculating after the cloud data service center automatically subpackages overlong upgrading program data, and a CRC16 check code of the upgrading data packet is obtained by calculating by the cloud data service center according to the upgrading program data packet in the message frame through a CRC16 method;
b2: after confirming that upgrading enters an upgrading mode, the gateway equipment starts an overtime timer, if the gateway equipment ID is judged to be the own gateway equipment ID after receiving a message with a station name/UPDATA message as a message subject sent by a cloud data service center within the time of the timer, the message content is read, firstly, a CRC16 check code is calculated and compared with a CRC16 check code of an upgrading data packet in the message content, if the message content is successful, the step B3 is executed, otherwise, a frame failure message is returned, and the frame failure message adopts the time of sending the message by the cloud data service center and the gateway equipment ID as the message content;
b3: the gateway equipment writes the received upgrading program data into a second area of the external FLASH according to the offset address, then carries out external FLASH reading operation and recalculates a CRC16 check code, returns a frame success message to the cloud data service center after verification is passed, and returns a frame failure message if the frame success message and the frame failure message adopt the time of sending the message by the cloud data service center and the gateway equipment ID as message contents;
b4: the corresponding process of the cloud data service center decodes the successful message of the frame returned by the gateway equipment after receiving the successful message of the frame, and whether the response is the latest upgrading program data packet is determined according to the time of sending the message by the cloud data service center in the message content and the ID of the gateway equipment; if yes, sending an upgrading program data packet of the next frame of upgrading program data, and repeating the process until all upgrading program data packets of the upgrading program data are successfully sent; if the cloud data service center receives the frame failure message, retry the steps B1, B2 and B3, and after the retry times are more than 3, close the upgrading process of the gateway device and prompt upgrading failure beside the corresponding gateway device on the page of the cloud data service center.
CN201810138134.8A 2018-02-10 2018-02-10 Online upgrading method for photovoltaic data acquisition gateway equipment Expired - Fee Related CN108494818B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810138134.8A CN108494818B (en) 2018-02-10 2018-02-10 Online upgrading method for photovoltaic data acquisition gateway equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810138134.8A CN108494818B (en) 2018-02-10 2018-02-10 Online upgrading method for photovoltaic data acquisition gateway equipment

Publications (2)

Publication Number Publication Date
CN108494818A CN108494818A (en) 2018-09-04
CN108494818B true CN108494818B (en) 2021-02-05

Family

ID=63340380

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810138134.8A Expired - Fee Related CN108494818B (en) 2018-02-10 2018-02-10 Online upgrading method for photovoltaic data acquisition gateway equipment

Country Status (1)

Country Link
CN (1) CN108494818B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110399154B (en) * 2019-08-07 2023-05-19 成都易明半导体有限公司 Firmware program batch upgrading system and method for LED street lamp controller

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007118405A1 (en) * 2006-04-19 2007-10-25 Huawei Technologies Co., Ltd. Device, system and method for carrying out remote software upgrading
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
CN103095826A (en) * 2013-01-10 2013-05-08 上海斐讯数据通信技术有限公司 Method of upgrading protection of gateway equipment
CN105117253A (en) * 2015-08-27 2015-12-02 常州大学 BootLoader based remote upgrade method for UV LED (Ultraviolet Light Emitting Diode) curing system
CN105553730A (en) * 2015-12-22 2016-05-04 新余未来宽带技术有限公司 Implementing method and implementing device for upgrade of gateway type EoC terminal firmware

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007118405A1 (en) * 2006-04-19 2007-10-25 Huawei Technologies Co., Ltd. Device, system and method for carrying out remote software upgrading
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
CN103095826A (en) * 2013-01-10 2013-05-08 上海斐讯数据通信技术有限公司 Method of upgrading protection of gateway equipment
CN105117253A (en) * 2015-08-27 2015-12-02 常州大学 BootLoader based remote upgrade method for UV LED (Ultraviolet Light Emitting Diode) curing system
CN105553730A (en) * 2015-12-22 2016-05-04 新余未来宽带技术有限公司 Implementing method and implementing device for upgrade of gateway type EoC terminal firmware

Also Published As

Publication number Publication date
CN108494818A (en) 2018-09-04

Similar Documents

Publication Publication Date Title
CN110096294B (en) Method for wirelessly upgrading MCU application program at any breakpoint
CN111145523B (en) Method for upgrading micropower wireless communication module in electricity consumption information acquisition system
CN109101261A (en) A kind of the remote online upgrade method and system of data acquisition transmission instrument terminal
CN106874054B (en) Method and system for on-line upgrading module program in repeater
CN105740034A (en) System and method for upgrading firmware of MCU on line
CN105511929A (en) Remote wireless upgrading method for equipment
CN100525206C (en) Realizing method and system for automatic restoring equipment fault
CN107450945A (en) A kind of firmware update of virtual reality device
CN109842523A (en) A kind of firmware upgrade method, device, equipment and storage medium
CN104102519A (en) Firmware updating method of rack-mounted server and device thereof
CN107656751A (en) User program upgrade method and device
CN108494818B (en) Online upgrading method for photovoltaic data acquisition gateway equipment
US20170171355A1 (en) Method for transferring a new software version to at least one electricity meter via a communication network
CN104021014A (en) Firmware upgrading method based on double-CPU system
CN112822654A (en) Remote measuring terminal machine based on FTP remote firmware upgrading function and control method thereof
CN113542318B (en) Equipment fault repairing method
CN113660317A (en) Vehicle-mounted terminal remote upgrading method based on FTP protocol
CN113342375A (en) Method and system for upgrading intelligent terminal under gateway
CN104618802A (en) Mobile terminal, network set-top box based on Android and system recovery method thereof
CN115113901A (en) Remote upgrading method, device and medium for electric control software of intelligent household appliance
CN103150223A (en) Method for preventing epon terminal equipment from being damaged and epon terminal equipment
CN100353321C (en) System with primary application and spare program and starting method
CN114745740B (en) Intelligent household appliance upgrading system and method
CN102710666B (en) RADIUS (remote authentication dial in user service) client overtime treating method in WLAN (wireless local area network) system
CN205540695U (en) System for MCU online upgrade firmware

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20210205

Termination date: 20220210

CF01 Termination of patent right due to non-payment of annual fee