CN117908932A - Intelligent sensor upgrading method and device, intelligent sensor and storage medium - Google Patents

Intelligent sensor upgrading method and device, intelligent sensor and storage medium Download PDF

Info

Publication number
CN117908932A
CN117908932A CN202311850662.3A CN202311850662A CN117908932A CN 117908932 A CN117908932 A CN 117908932A CN 202311850662 A CN202311850662 A CN 202311850662A CN 117908932 A CN117908932 A CN 117908932A
Authority
CN
China
Prior art keywords
upgrade
check code
code
intelligent sensor
area
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.)
Pending
Application number
CN202311850662.3A
Other languages
Chinese (zh)
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.)
Hunan Zhifenling Technology Co ltd
Original Assignee
Hunan Zhifenling 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 Hunan Zhifenling Technology Co ltd filed Critical Hunan Zhifenling Technology Co ltd
Priority to CN202311850662.3A priority Critical patent/CN117908932A/en
Publication of CN117908932A publication Critical patent/CN117908932A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/654Updates using techniques specially adapted for alterable solid state memories, e.g. for EEPROM or flash memories
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0056Systems characterized by the type of code used
    • H04L1/0061Error detection codes
    • 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/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • 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 

Landscapes

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

Abstract

The application relates to the technical field of sensors, and discloses an intelligent sensor upgrading method and device, an intelligent sensor and a storage medium. The method comprises the following steps: detecting whether an erasable programmable read-only memory of the intelligent sensor contains an upgrade mark or not when the intelligent sensor is started; if the upgrade mark is included, receiving a complete upgrade package and a corresponding first check code from an upper computer through a preset YMODEM protocol, and storing the upgrade package into a backup storage area of the intelligent sensor; calculating a second check code of a complete code area corresponding to the upgrade package stored in the backup storage area, and judging whether the first check code is identical to the second check code; if the first check code is the same as the second check code, copying the complete code area to an application program working area of the intelligent sensor, and jumping to the code of the complete code area after the application program working area executes the upgrade. Not only the instantaneity and convenience of the intelligent sensor upgrade are improved, but also the upgrade maintenance cost is further reduced, and the efficiency is improved.

Description

Intelligent sensor upgrading method and device, intelligent sensor and storage medium
Technical Field
The present application relates to the field of sensor technologies, and in particular, to an intelligent sensor upgrading method and apparatus, an intelligent sensor, and a storage medium.
Background
An intelligent sensor is a device with sensing, computing and communication capabilities that is capable of sensing physical quantities or events in an environment in real time and converting them into digital signals that can be used for analysis, control or communication. Different from the traditional sensor technology, the sensor technology is realized by pursuing the perfection of the sensor itself and carefully designing and debugging each link of the sensor, and the sensor technology is realized by combining a micro processor/a micro computer. The development direction is also from single monitoring, single function to multi-function and multi-variable detection fusion, from the passive form of signal conversion to active information processing, from individual components to networking and systemization. However, the current intelligent sensor cannot be updated and maintained after leaving the factory, and can only be returned to the factory for maintenance or be disassembled destructively, so that when the update and maintenance requirements exist, the current intelligent sensor cannot be maintained in real time and conveniently, and further the overall maintenance cost is increased and the efficiency is low.
Disclosure of Invention
The technical problems of the traditional intelligent sensor are that the upgrading and maintaining mode is poor in instantaneity, high in cost and low in efficiency.
In order to solve the technical problems, a first technical scheme adopted by the embodiment of the application is as follows: the intelligent sensor upgrading method comprises the following steps: when the intelligent sensor is started, detecting whether an erasable programmable read-only memory of the intelligent sensor contains an upgrade mark or not; if the upgrade mark is included, receiving a complete upgrade package and a corresponding first check code from an upper computer through a preset YMODEM protocol, and storing the upgrade package to a backup storage area of the intelligent sensor; calculating a second check code of a complete code area corresponding to the upgrade package stored in a backup storage area, and judging whether the first check code is identical to the second check code; and if the first check code is the same as the second check code, copying the complete code area to an application program working area of the intelligent sensor, and jumping to the code of the complete code area after the application program working area is upgraded.
Optionally, the step of receiving the complete upgrade package and the corresponding first check code from the upper computer through a preset YMODEM protocol includes: after the intelligent sensor receives the initial identifier, sending a confirmation character to the upper computer, and initializing a packet sequence number, a memory buffer pointer and an error count; receiving a data packet with a preset byte size and a corresponding third check code sent by the upper computer, and storing the data packet into a memory buffer area; calculating a fourth check code of the data packet, and judging whether the third check code is identical to the fourth check code; if the third check code is the same as the fourth check code, writing the data packet into the storage backup area, and sending a confirmation data packet to the upper computer; and the step of receiving the data packet with the preset byte size and the corresponding third check code sent by the upper computer and sending the confirmation data packet to the upper computer is circulated until the intelligent sensor receives the complete upgrade packet.
Optionally, after the step of calculating the fourth check code of the data packet and determining whether the third check code is the same as the fourth check code, the method further includes: if the third check code is different from the fourth check code, a negative acknowledgement data packet is sent to the upper computer, and the error count is increased by 1; after receiving the complete upgrade package, judging whether the error count is greater than a preset error count threshold; and if the error count is greater than the preset error count threshold, erasing the upgrading mark and jumping to the code before the upgrading is executed in the application program working area.
Optionally, after the step of determining whether the error count is greater than a preset error count threshold, the method further includes: and if the error count is smaller than or equal to the preset error count threshold, jumping to execute the second check code for calculating the complete code area corresponding to the upgrade package stored in the backup storage area.
Optionally, the step of detecting whether the erasable programmable read-only memory of the smart sensor contains an upgrade flag when the smart sensor is started, includes: when the intelligent sensor is started, the system interrupt function is closed, and the general input and output function is initialized and configured; and reading in an upgrade flag bit from the erasable programmable read-only memory, and judging whether upgrade operation is required according to the upgrade flag bit.
Optionally, after the step of jumping to the application program working area to execute the upgraded code of the complete code area, the method further includes: starting an upgrade monitoring thread to monitor whether an upgrade command is received; and when the upgrade command is received, jumping to the step of executing the step of detecting whether the erasable programmable read-only memory of the intelligent sensor contains an upgrade mark or not, and closing the application program.
Optionally, after the step of calculating the second check code of the complete code area corresponding to the upgrade package stored in the backup storage area and determining whether the first check code is the same as the second check code, the method further includes: if the first check code is different from the second check code, sending a check failure message to the upper computer, and re-initiating an upgrade package retransmission operation by the upper computer after receiving the check failure message so as to repeatedly execute the step of upgrade package transmission; or acquiring a unique identification mark of the upgrade package, and automatically increasing the number of upgrade failures corresponding to the upgrade package by 1; when the upgrade failure times corresponding to the upgrade package are larger than a preset upgrade failure times threshold, setting the upgrade package as a fault upgrade package; and if the unique identification mark of the new upgrade package received by the intelligent sensor at the next time is the same as the unique identification mark of the fault upgrade package, not executing the upgrade process, and jumping to the code before the upgrade is executed by the application program working area.
In order to solve the technical problems, a second technical scheme adopted by the embodiment of the application is as follows: provided is an intelligent sensor upgrade apparatus, including: the upgrade mark detection module is used for detecting whether the erasable programmable read-only memory of the intelligent sensor contains an upgrade mark or not when the intelligent sensor is started; the upgrade package transmission module is used for receiving a complete upgrade package and a corresponding first check code from an upper computer through a preset YMODEM protocol if the upgrade package transmission module comprises an upgrade mark, and storing the upgrade package to a backup area of the intelligent sensor; the upgrade package verification module is used for calculating a second verification code of the complete code area corresponding to the upgrade package stored in the backup area and judging whether the second verification code is identical to the first verification code or not; and the upgrade package copying module is used for copying the complete code area to the application program working area of the intelligent sensor if the complete code area is the same, and jumping to the code of the complete code area after the application program working area is upgraded.
In order to solve the above technical problems, a third technical solution adopted in the embodiment of the present application is: provided is an intelligent sensor including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the smart sensor upgrade method as described above.
In order to solve the above technical problems, a fourth technical solution adopted in the embodiment of the present application is: there is provided a non-volatile computer readable storage medium storing computer executable instructions that, when executed by a smart sensor, cause the smart sensor to perform a smart sensor upgrade method as described above.
In contrast to the related art, the present application detects whether an erasable programmable read-only memory of an intelligent sensor contains an upgrade flag when the intelligent sensor is started; if the upgrade mark is included, receiving a complete upgrade package and a corresponding first check code from an upper computer through a preset YMODEM protocol, and storing the upgrade package to a backup storage area of the intelligent sensor; calculating a second check code of a complete code area corresponding to the upgrade package stored in a backup storage area, and judging whether the first check code is identical to the second check code; and if the first check code is the same as the second check code, copying the complete code area to an application program working area of the intelligent sensor, and jumping to the code of the complete code area after the application program working area is upgraded. Not only the instantaneity and convenience of the intelligent sensor upgrade are improved, but also the upgrade maintenance cost is further reduced, and the efficiency is improved.
Drawings
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements, and in which the figures of the drawings are not to scale, unless expressly stated otherwise.
FIG. 1 is a schematic diagram of an application environment of an intelligent sensor upgrading method according to an embodiment of the present application;
FIG. 2 is a schematic flow chart of an upgrade method of an intelligent sensor according to an embodiment of the present application;
FIG. 3 is another flow chart of an upgrade method for an intelligent sensor according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an upgrade apparatus for an intelligent sensor according to an embodiment of the present application;
fig. 5 is a schematic diagram of a hardware structure of an intelligent sensor for executing an upgrade method of the intelligent sensor according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
It should be noted that, if not in conflict, the features of the embodiments of the present application may be combined with each other, which are all within the protection scope of the present application. In addition, while the division of functional blocks is performed in a device diagram and the logic sequence is shown in a flowchart, in some cases, the steps shown or described may be performed in a different order than the block division in a device diagram or the sequence in a flowchart.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The term "and/or" as used in this specification includes any and all combinations of one or more of the associated listed items.
Referring to fig. 1, fig. 1 is a schematic view of an application environment of an intelligent sensor upgrading method according to an embodiment of the present application. The intelligent sensor 10 is connected with the upper computer 20 through a network, wherein the connection modes include but are not limited to RS-232, RS-485, ethernet and the like. The intelligent sensor 10 includes a Boot loader for initializing system hardware, loading and starting an application program, and an App application program for implementing a specific function of the system by a software part developed according to specific application requirements. It should be noted that, the number of the intelligent sensors 10 and the upper computer 20 in fig. 1 is merely illustrative, and any number of the intelligent sensors and the upper computer 20 may be expanded in the practical application process.
With continued reference to fig. 2, fig. 2 is a flow chart of an upgrade method for an intelligent sensor according to an embodiment of the present application, which specifically includes:
S10, when the intelligent sensor is started, detecting whether the erasable programmable read-only memory of the intelligent sensor contains an upgrade mark.
As an alternative embodiment, the step S10 specifically includes: first, when the intelligent sensor is started, the system interrupt function is turned off, and the general input output function is initialized and configured. Then, the upgrade flag bit is read from an erasable programmable read-Only Memory (ELECTRICALLY ERASABLE PROGRAMMABLE READ-Only Memory, E2 PROM), and whether the upgrade operation is required is judged according to the upgrade flag bit. The interrupt function of the system is a mechanism for allowing an external device or a system event to interrupt normal program execution in the running process of the intelligent sensor so as to process urgent or higher-priority tasks, the interrupt can be used for processing hardware faults, input/output operations, timer events and the like, but the upgrading process needs to ensure the atomicity and consistency of the program execution, and other interrupts can be prevented from interfering with the execution of the upgrading process by closing the system interrupt function, so that the integrity and the correctness of data in the upgrading process are ensured.
As an example, the upgrade flag in the smart sensor may include a file name of the upgrade package, the number of data packages of the upgrade package, and a CRC16 check code, etc., for example, the upgrade flag for the transmitter may be "sensor31.binp065 aelb", "sensor31.bin" indicating the file name of the upgrade package, "p065" indicating the number of data packages of the upgrade package is 65, "aelb" indicating the CRC16 check code of the data package, and for example, the upgrade flag for the display may be "led31.bin p050 aelb", "led31.bin" indicating the file name of the upgrade package, "p050" indicating the number of data packages of the upgrade package is 50, "aelb" indicating the CRC16 check code of the data package. Wherein CRC16 (Cyclic Redundancy Check, CRC) is a check algorithm that generates a fixed length 16-bit check code for detecting and verifying errors in data transmission or storage.
And S20, if the upgrade mark is included, receiving a complete upgrade package and a corresponding first check code from the upper computer through a preset YMODEM protocol, and storing the upgrade package into a backup storage area of the intelligent sensor.
As an alternative embodiment, the step S20 specifically includes:
s21, after the intelligent sensor receives the initial identifier, a confirmation character is sent to the upper computer, and the packet sequence number, the memory buffer pointer and the error count are initialized.
S22, receiving a data packet with a preset byte size and a corresponding third check code sent by the upper computer, and storing the data packet into the memory buffer area. Each data packet with the preset byte size sent by the upper computer has a unique sequence number, the unique sequence number can be set as a packet sequence number, the intelligent sensor can inform the upper computer of the successfully received data packet according to the unique sequence number, and then the upper computer can determine the data packet needing to be subjected to retransmission operation according to the feedback result so as to complete data packet transmission.
As an alternative embodiment, the data packet is formed by a packet header and packet body data group layer, the packet header and packet body data may be 5 bytes, the packet body data may be 128 bytes or 1024 bytes, so the preset byte size of the data packet may be 333 bytes or 1029 bytes.
S23, calculating a fourth check code of the data packet, and judging whether the third check code is identical with the fourth check code. And each data packet divided into the upgrade packets is checked, so that the stability and the safety of data packet transmission can be further improved.
And S24, if the third check code is the same as the fourth check code, writing the data packet into the storage backup area, and sending the confirmation data packet to the upper computer. After receiving the acknowledgement data packet, the upper computer can check whether each data packet of the upgrade packet is correctly received by the intelligent sensor according to the acknowledgement data packet, and if the data packet with the reception error exists, retransmission is needed.
S25, circularly receiving the data packet with the preset byte size and the corresponding third check code sent by the upper computer until the intelligent sensor receives the complete upgrade packet, and sending the confirmation data packet to the upper computer. Because the system interrupt function is already closed in the initial starting stage of the intelligent sensor, the execution process of the step S25 is not interrupted, the stability of the transmission of the upgrade package is further ensured, the execution is not forced to be interrupted because of the system interrupt, the probability of occurrence of transmission errors is reduced, and the probability of success of the upgrade is further improved.
As another alternative embodiment, after step S23, the method further includes: .
S26, if the third check code is different from the fourth check code, a negative acknowledgement data packet is sent to the upper computer, and the error count is increased by 1;
S27, after receiving the complete upgrade package, judging whether the error count is larger than a preset error count threshold value;
and S28, if the error count is greater than a preset error count threshold, erasing the upgrading mark and jumping to the code before the upgrading is executed in the application program working area.
In YMODEM protocols, each data packet uses a CRC check code to verify the integrity of the data, so as to ensure that no error occurs in the data transmission process, and the whole data file also has a CRC check code for verifying the integrity of the whole file.
As another preferred embodiment, after the step of determining whether the error count is greater than a preset error count threshold, the method further includes: if the error count is smaller than or equal to the preset error count threshold, the method jumps to execute the second check code of the complete code area corresponding to the upgrade package stored in the backup storage area.
S30, calculating a second check code of the complete code area corresponding to the upgrade package stored in the backup storage area, and judging whether the first check code is identical to the second check code.
As an optional implementation manner, if the first check code is different from the second check code, sending a check failure message to the upper computer, and after receiving the check failure message, the upper computer re-initiates an upgrade packet retransmission operation to repeatedly execute the step of upgrade packet transmission; or acquiring a unique identification mark of the upgrade package, and automatically increasing the number of upgrade failures corresponding to the upgrade package by 1. Then, when the upgrade failure times corresponding to the upgrade package are larger than a preset upgrade failure times threshold, setting the upgrade package as a fault upgrade package; if the unique identification mark of the new upgrade package received by the next intelligent sensor is the same as the unique identification mark of the fault upgrade package, the upgrade process is not executed, and the code before the upgrade is executed in the application program working area is skipped.
As another alternative implementation manner, the first check code and the second check code are both check codes based on CRC16 algorithm, and other data check algorithms can be selected or new data check algorithms can be designed according to technical requirements in a more specific implementation process so as to further improve data security.
And S40, if the first check code is the same as the second check code, copying the complete code area to an application program working area of the intelligent sensor, and jumping to the code of the complete code area after the application program working area is upgraded.
As an alternative embodiment, after step S40, further includes: and starting an upgrade monitoring thread to monitor whether an upgrade command is received, when the upgrade command is received, jumping from the current application program to the step of executing the detection of whether the erasable programmable read-only memory of the intelligent sensor contains an upgrade mark, and closing the current application program, namely the intelligent sensor can also receive the upgrade command in the running process to enter an upgrade flow.
As an example, as shown in fig. 3, fig. 3 is a flowchart of an execution step after an App application receives an upgrade command during operation, and when the App application receives the upgrade command, it switches to an upgrade processing flow, and when it does not receive the upgrade command, it continues to execute a current business flow.
According to the intelligent sensor upgrading method provided by the embodiment of the application, when the intelligent sensor is started, whether the erasable programmable read-only memory of the intelligent sensor contains an upgrading mark or not is detected; if the upgrade mark is included, receiving a complete upgrade package and a corresponding first check code from an upper computer through a preset YMODEM protocol, and storing the upgrade package into a backup storage area of the intelligent sensor; calculating a second check code of a complete code area corresponding to the upgrade package stored in the backup storage area, and judging whether the first check code is identical to the second check code; if the first check code is the same as the second check code, copying the complete code area to an application program working area of the intelligent sensor, and jumping to the code of the complete code area after the application program working area executes the upgrade. Not only the instantaneity and convenience of the intelligent sensor upgrade are improved, but also the upgrade maintenance cost is further reduced, and the efficiency is improved.
With continued reference to fig. 4, fig. 4 is a schematic structural diagram of an intelligent sensor upgrade apparatus 400 according to an embodiment of the present application, including:
An upgrade flag detection module 401, configured to detect, when an intelligent sensor is started, whether an erasable programmable read-only memory of the intelligent sensor contains an upgrade flag;
The upgrade package transmission module 402 is configured to receive a complete upgrade package and a corresponding first check code from an upper computer through a preset YMODEM protocol if the upgrade package transmission module includes an upgrade flag, and store the upgrade package to a backup area of the intelligent sensor;
the upgrade package verification module 403 is configured to calculate a second verification code of a complete code area corresponding to the upgrade package stored in a backup area, and determine whether the second verification code is the same as the first verification code;
And the upgrade package copying module 404 is used for copying the complete code area to the application program working area of the intelligent sensor if the complete code area is the same, and jumping to the code of the complete code area after the application program working area executes upgrade.
Optionally, the upgrade package transmission module 402 is specifically configured to send a confirmation character to the upper computer after the intelligent sensor receives the start identifier, and initialize a package sequence number, a memory buffer pointer, and an error count; receiving a data packet with a preset byte size and a corresponding third check code sent by the upper computer, and storing the data packet into a memory buffer area; calculating a fourth check code of the data packet, and judging whether the third check code is identical to the fourth check code; if the third check code is the same as the fourth check code, writing the data packet into the storage backup area, and sending a confirmation data packet to the upper computer; and the step of receiving the data packet with the preset byte size and the corresponding third check code sent by the upper computer and sending the confirmation data packet to the upper computer is circulated until the intelligent sensor receives the complete upgrade packet.
Optionally, the upgrade packet transmission module 402 is further configured to send a negative acknowledgement packet to the upper computer and increment the error count by1 if the third check code is different from the fourth check code; after receiving the complete upgrade package, judging whether the error count is greater than a preset error count threshold; and if the error count is greater than the preset error count threshold, erasing the upgrading mark and jumping to the code before the upgrading is executed in the application program working area.
Optionally, the upgrade package transmission module 402 is further configured to skip to execute the calculation of the second check code of the complete code area corresponding to the upgrade package stored in the backup storage area if the error count is less than or equal to the preset error count threshold.
Optionally, the upgrade flag detection module 401 is specifically configured to close a system interrupt function and initialize a configuration general input/output function when the intelligent sensor is started; and reading in an upgrade flag bit from the erasable programmable read-only memory, and judging whether upgrade operation is required according to the upgrade flag bit.
Optionally, the intelligent sensor upgrade apparatus 400 further includes an upgrade monitor module, where the upgrade monitor module is specifically configured to start an upgrade monitor thread to monitor whether an upgrade command is received; and when the upgrade command is received, jumping to the step of executing the step of detecting whether the erasable programmable read-only memory of the intelligent sensor contains an upgrade mark or not, and closing the application program.
Optionally, the intelligent sensor upgrade apparatus 400 further includes an upgrade failure module, where the upgrade failure module is specifically configured to send a verification failure message to the upper computer if the first verification code is different from the second verification code, and the upper computer re-initiates an upgrade packet retransmission operation after receiving the verification failure message, so as to repeatedly execute the step of transmitting the upgrade packet; or acquiring a unique identification mark of the upgrade package, and automatically increasing the number of upgrade failures corresponding to the upgrade package by 1; when the upgrade failure times corresponding to the upgrade package are larger than a preset upgrade failure times threshold, setting the upgrade package as a fault upgrade package; and if the unique identification mark of the new upgrade package received by the intelligent sensor at the next time is the same as the unique identification mark of the fault upgrade package, not executing the upgrade process, and jumping to the code before the upgrade is executed by the application program working area.
It should be noted that, the intelligent sensor upgrading device can execute the intelligent sensor upgrading method provided by the embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. Technical details which are not described in detail in the embodiment of the intelligent sensor upgrading device can be seen in the intelligent sensor upgrading method provided by the embodiment of the application.
With continued reference to fig. 5, fig. 5 is a schematic hardware structure diagram of an intelligent sensor 500 for performing an upgrade method of the intelligent sensor according to an embodiment of the application, and as shown in fig. 5, the intelligent sensor 500 includes:
one or more processors 510 and a memory 520, one processor 510 being illustrated in fig. 5.
The processor 510 and the memory 520 may be connected by a bus or otherwise, for example in fig. 5.
The memory 520 is used as a non-volatile computer readable storage medium for storing non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions/modules corresponding to the smart sensor upgrade method in the embodiment of the present application. The processor 510 executes various functional applications and data processing of the smart sensor by running non-volatile software programs, instructions and modules stored in the memory 520, i.e., implements the method of upgrading the smart sensor of the method embodiment described above.
Memory 520 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created according to the use of the smart sensor upgrade apparatus, etc. In addition, memory 520 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 520 may optionally include memory located remotely from processor 510, which may be connected to the smart sensor upgrade via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The one or more modules are stored in the memory 520 and when executed by the one or more processors 510 perform the smart sensor upgrade method of any of the method embodiments described above, e.g., perform method steps S10-S40 of fig. 2 described above, to implement the functions of modules 401-404 of fig. 4.
The product can execute the method provided by the embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. Technical details not described in detail in this embodiment may be found in the methods provided in the embodiments of the present application.
Embodiments of the present application provide a non-transitory computer readable storage medium storing computer executable instructions for execution by one or more processors, such as one of the processors 510 of fig. 5, to cause the one or more processors to perform the smart sensor upgrade method of any of the method embodiments described above, such as performing method steps S10 through S40 of fig. 2 described above, to implement the functions of modules 401-404 of fig. 4.
Embodiments of the present application provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by the smart sensor, enable the smart sensor to perform the smart sensor upgrade method in any of the method embodiments described above, e.g. to perform method steps S10 to S40 in fig. 2 described above, implementing the functions of modules 401-404 in fig. 4.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
From the above description of embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus a general purpose hardware platform, or may be implemented by hardware. Those skilled in the art will appreciate that all or part of the processes implementing the methods of the above embodiments may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and where the program may include processes implementing the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (Random Access Memory, RAM), or the like.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting; the technical features of the above embodiments or in the different embodiments may also be combined within the idea of the application, the steps may be implemented in any order, and there are many other variations of the different aspects of the application as described above, which are not provided in detail for the sake of brevity; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application.

Claims (10)

1. An intelligent sensor upgrading method is characterized by comprising the following steps:
When the intelligent sensor is started, detecting whether an erasable programmable read-only memory of the intelligent sensor contains an upgrade mark or not;
if the upgrade mark is included, receiving a complete upgrade package and a corresponding first check code from an upper computer through a preset YMODEM protocol, and storing the upgrade package to a backup storage area of the intelligent sensor;
Calculating a second check code of a complete code area corresponding to the upgrade package stored in a backup storage area, and judging whether the first check code is identical to the second check code;
And if the first check code is the same as the second check code, copying the complete code area to an application program working area of the intelligent sensor, and jumping to the code of the complete code area after the application program working area is upgraded.
2. The method for upgrading an intelligent sensor according to claim 1, wherein the step of receiving the complete upgrade package and the corresponding first check code from the upper computer through a preset YMODEM protocol comprises:
After the intelligent sensor receives the initial identifier, sending a confirmation character to the upper computer, and initializing a packet sequence number, a memory buffer pointer and an error count;
Receiving a data packet with a preset byte size and a corresponding third check code sent by the upper computer, and storing the data packet into a memory buffer area;
Calculating a fourth check code of the data packet, and judging whether the third check code is identical to the fourth check code;
if the third check code is the same as the fourth check code, writing the data packet into the storage backup area, and sending a confirmation data packet to the upper computer;
And the step of receiving the data packet with the preset byte size and the corresponding third check code sent by the upper computer and sending the confirmation data packet to the upper computer is circulated until the intelligent sensor receives the complete upgrade packet.
3. The method for upgrading an intelligent sensor according to claim 2, wherein after the steps of calculating a fourth check code of the data packet and determining whether the third check code is identical to the fourth check code, further comprising:
if the third check code is different from the fourth check code, a negative acknowledgement data packet is sent to the upper computer, and the error count is increased by 1;
after receiving the complete upgrade package, judging whether the error count is greater than a preset error count threshold;
and if the error count is greater than the preset error count threshold, erasing the upgrading mark and jumping to the code before the upgrading is executed in the application program working area.
4. The method of claim 3, further comprising, after the step of determining whether the error count is greater than a preset error count threshold:
And if the error count is smaller than or equal to the preset error count threshold, jumping to execute the second check code for calculating the complete code area corresponding to the upgrade package stored in the backup storage area.
5. The smart sensor upgrade method according to claim 1, wherein the step of detecting whether the erasable programmable read-only memory of the smart sensor contains an upgrade flag when the smart sensor is started, comprises:
when the intelligent sensor is started, the system interrupt function is closed, and the general input and output function is initialized and configured;
And reading in an upgrade flag bit from the erasable programmable read-only memory, and judging whether upgrade operation is required according to the upgrade flag bit.
6. The smart sensor upgrade method according to claim 1, wherein after the step of jumping to the application program work area to execute the upgraded code of the complete code area, further comprising:
starting an upgrade monitoring thread to monitor whether an upgrade command is received;
and when the upgrade command is received, jumping to the step of executing the step of detecting whether the erasable programmable read-only memory of the intelligent sensor contains an upgrade mark or not, and closing the application program.
7. The method for upgrading an intelligent sensor according to claim 1, wherein after the step of calculating a second check code of a complete code area corresponding to the upgrade package stored in the backup storage area and determining whether the first check code is identical to the second check code, the method further comprises:
If the first check code is different from the second check code, sending a check failure message to the upper computer, and re-initiating an upgrade package retransmission operation by the upper computer after receiving the check failure message so as to repeatedly execute the step of upgrade package transmission;
Or acquiring a unique identification mark of the upgrade package, and automatically increasing the number of upgrade failures corresponding to the upgrade package by 1; when the upgrade failure times corresponding to the upgrade package are larger than a preset upgrade failure times threshold, setting the upgrade package as a fault upgrade package; and if the unique identification mark of the new upgrade package received by the intelligent sensor at the next time is the same as the unique identification mark of the fault upgrade package, not executing the upgrade process, and jumping to the code before the upgrade is executed by the application program working area.
8. An intelligent sensor upgrading device, characterized by comprising:
The upgrade mark detection module is used for detecting whether the erasable programmable read-only memory of the intelligent sensor contains an upgrade mark or not when the intelligent sensor is started;
the upgrade package transmission module is used for receiving a complete upgrade package and a corresponding first check code from an upper computer through a preset YMODEM protocol if the upgrade package transmission module comprises an upgrade mark, and storing the upgrade package to a backup area of the intelligent sensor;
the upgrade package verification module is used for calculating a second verification code of the complete code area corresponding to the upgrade package stored in the backup area and judging whether the second verification code is identical to the first verification code or not;
And the upgrade package copying module is used for copying the complete code area to the application program working area of the intelligent sensor if the complete code area is the same, and jumping to the code of the complete code area after the application program working area is upgraded.
9. An intelligent sensor, comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
10. A non-transitory computer readable storage medium storing computer executable instructions which, when executed by a smart sensor, cause the smart sensor to perform the method of any one of claims 1-7.
CN202311850662.3A 2023-12-28 2023-12-28 Intelligent sensor upgrading method and device, intelligent sensor and storage medium Pending CN117908932A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311850662.3A CN117908932A (en) 2023-12-28 2023-12-28 Intelligent sensor upgrading method and device, intelligent sensor and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311850662.3A CN117908932A (en) 2023-12-28 2023-12-28 Intelligent sensor upgrading method and device, intelligent sensor and storage medium

Publications (1)

Publication Number Publication Date
CN117908932A true CN117908932A (en) 2024-04-19

Family

ID=90693846

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311850662.3A Pending CN117908932A (en) 2023-12-28 2023-12-28 Intelligent sensor upgrading method and device, intelligent sensor and storage medium

Country Status (1)

Country Link
CN (1) CN117908932A (en)

Similar Documents

Publication Publication Date Title
CN106569847B (en) Method for vehicle-mounted system to realize IAP remote upgrade based on mobile network
CN109189445B (en) Method for upgrading program of equipment of Internet of things
CN106843942B (en) Wearable device and firmware upgrading method thereof
US10274919B2 (en) Method, device and computer program product for programming a plurality of control units
CN111158751B (en) Windows environment deployment method, electronic device and storage medium
WO2022116088A1 (en) Firmware data processing method and apparatus
JP5198154B2 (en) Fault monitoring system, device, monitoring apparatus, and fault monitoring method
CN114281394A (en) Method, system, equipment and medium for fast on-line upgrading program
US12095510B1 (en) Infrared communication method and apparatus, storage medium and electronic apparatus
CN114489732A (en) Method and device for updating FPGA (field programmable Gate array) firmware of equipment and electronic equipment
CN112181444B (en) DSP multi-core data programming method based on 1553B bus
CN117908932A (en) Intelligent sensor upgrading method and device, intelligent sensor and storage medium
CN109582379B (en) Programmable logic controller system based on microkernel operating system and control method
CN103631611A (en) Method and equipment for updating optical transmitter and receiver
CN106658688B (en) System and method for realizing GSM module control in single chip microcomputer
CN114815700A (en) Satellite-borne SAR on-orbit work program control system and method
CN102884744A (en) Method and device for securing data packets to be transmitted via an interface
CN112559349B (en) Program running method and running device
CN112527342A (en) Method, device and equipment for upgrading application-programmable IAP (inter-Integrated Access Point) firmware
CN116069372A (en) Controller, software upgrading method and device thereof, readable storage medium and electric appliance
CN111506330A (en) Program updating method and device, star affair computer and storage medium
CN111813597A (en) Air conditioner
CN115604251A (en) File breakpoint continuous transmission method, device, equipment and readable storage medium
CN117032825A (en) Method and device for loading software of airborne electronic equipment, storage medium and aircraft
CN117170704B (en) Remote upgrading method and device based on hardware IIC

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