CN116980290B - Infrared communication upgrading method and device and electronic equipment - Google Patents

Infrared communication upgrading method and device and electronic equipment Download PDF

Info

Publication number
CN116980290B
CN116980290B CN202311229428.9A CN202311229428A CN116980290B CN 116980290 B CN116980290 B CN 116980290B CN 202311229428 A CN202311229428 A CN 202311229428A CN 116980290 B CN116980290 B CN 116980290B
Authority
CN
China
Prior art keywords
frame
upgrade
length
infrared
data frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311229428.9A
Other languages
Chinese (zh)
Other versions
CN116980290A (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.)
Beijing Smartchip Microelectronics Technology Co Ltd
Beijing Smartchip Semiconductor Technology Co Ltd
Original Assignee
Beijing Smartchip Microelectronics Technology Co Ltd
Beijing Smartchip Semiconductor 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 Beijing Smartchip Microelectronics Technology Co Ltd, Beijing Smartchip Semiconductor Technology Co Ltd filed Critical Beijing Smartchip Microelectronics Technology Co Ltd
Priority to CN202311229428.9A priority Critical patent/CN116980290B/en
Publication of CN116980290A publication Critical patent/CN116980290A/en
Application granted granted Critical
Publication of CN116980290B publication Critical patent/CN116980290B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/082Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B10/00Transmission systems employing electromagnetic waves other than radio-waves, e.g. infrared, visible or ultraviolet light, or employing corpuscular radiation, e.g. quantum communication
    • H04B10/11Arrangements specific to free-space transmission, i.e. transmission through air or vacuum
    • H04B10/114Indoor or close-range type systems
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The invention provides an infrared communication upgrading method, an infrared communication upgrading device and electronic equipment, and belongs to the technical field of communication. The method comprises the following steps: calculating the timing time of a timer according to the baud rate and the comparison result between the data length of an upgrade data frame to be sent and the length of a preset frame head, wherein the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded and at least comprises the frame head, upgrade information, a function code and a check bit; closing the infrared serial port receiving function, starting a timer, and broadcasting an upgrade data frame to a plurality of devices to be upgraded through infrared so as to ensure that the frame head of the upgrade data frame cannot be received; and when the timing time arrives, starting the infrared serial port receiving function. According to the invention, under the conditions of one-to-many wireless upgrading realized through infrared and normal infrared serial port communication, frame breaking processing is carried out on the infrared serial port received data, so that the self loop is avoided under the condition of not designing hardware, the complexity of hardware design is reduced, and the hardware cost is reduced.

Description

Infrared communication upgrading method and device and electronic equipment
Technical Field
The invention relates to the technical field of communication, in particular to an infrared communication upgrading method, an infrared communication upgrading device and electronic equipment.
Background
The upgrade of the low-power-consumption small-sized equipment is mostly carried out through the debugging serial port or the JTAG debugging line burn-in, which not only needs to be connected to a PC machine through a physical line, but also usually has the problem of whether the physical contact is good or not, because the connector is easily worn due to the fact that the line is frequently plugged and pulled out, poor contact is caused, and therefore the upgrade failure and the low upgrade rate are caused. If the data is updated in a full duplex infrared mode, the data transmitted and received by the transmitting head of the data is received by the receiving head of the data, so that a self-loop is generated, and the success rate of communication and updating is greatly reduced.
The current technical means usually solves the problem of infrared communication at the hardware level. For example, the infrared serial port is designed to be half duplex through circuit design in hardware design, so that the infrared serial port self-loop is avoided. But the full duplex infrared serial port is designed to be a half duplex serial port mode through hardware design, so that not only is the complexity of hardware design improved, but also the hardware cost is increased.
Disclosure of Invention
The embodiment of the invention aims to provide an infrared communication upgrading method, an infrared communication upgrading device and electronic equipment, which are used for solving the defects that the existing method is used for avoiding the self loop of an infrared serial port by designing the full duplex infrared serial port into a half duplex serial port mode through hardware design, but improving the complexity of hardware design and increasing the cost of hardware.
In order to achieve the above objective, an embodiment of the present invention provides an infrared communication upgrading method, which is applied to a control device provided with a full duplex infrared serial port, and the method includes:
calculating the timing time of a timer according to the baud rate and the comparison result between the data length of an upgrade data frame to be sent and the length of a preset frame header, wherein the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded and at least comprises the frame header, upgrade information, a function code and a check bit;
closing an infrared serial port receiving function, starting a timer, and broadcasting the upgrade data frame to a plurality of devices to be upgraded through infrared so as to ensure that the frame head of the upgrade data frame cannot be received;
and when the timing time is reached, starting an infrared serial port receiving function.
Optionally, the calculating the timing time of the timer according to the baud rate and the comparison result between the data length of the upgrade data frame to be sent and the preset frame header length includes:
and calculating the timing time of the timer based on the preset frame head length and the baud rate under the condition that the data length of the upgrade data frame to be transmitted is larger than the preset frame head length.
Optionally, the calculating the timing time of the timer according to the baud rate and the comparison result between the data length of the upgrade data frame to be sent and the preset frame header length includes:
and calculating the timing time of the timer based on the data length and the baud rate of the upgrade data frame under the condition that the data length of the upgrade data frame to be transmitted is smaller than or equal to the preset frame header length.
On the other hand, the embodiment of the invention also provides an infrared communication upgrading method which is applied to equipment to be upgraded provided with a full duplex infrared serial port, and the method comprises the following steps:
receiving an upgrade data frame sent by control equipment; the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded; the upgrade data frame at least comprises a frame head, upgrade information, a function code and a check bit;
performing frame verification on the frame header;
under the condition that the frame check result of the frame header is correct, carrying out frame check on the check bit;
identifying the function code under the condition that the frame check result of the check bit is correct;
and under the condition that the function code represents an upgrade instruction, receiving the upgrade information.
Optionally, after the frame header is subjected to frame verification, the method further includes:
and under the condition that the frame check result of the frame header is an error, not processing the upgrade data frame.
Optionally, the check bit includes: a crc check bit and/or an end bit, said performing a frame check on said check bit comprising:
performing frame check on the crc check bits; and/or
And performing frame verification on the ending bit.
On the other hand, the embodiment of the invention also provides an infrared communication upgrading device, which comprises:
the timing time calculation module is used for calculating the timing time of a timer according to the baud rate and the comparison result between the data length of an upgrade data frame to be sent and the length of a preset frame head, wherein the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded and at least comprises the frame head, upgrade information, a function code and a check bit;
the broadcasting module is used for closing the infrared serial port receiving function, starting a timer and broadcasting the upgrade data frame to a plurality of devices to be upgraded through infrared so as to ensure that the frame head of the upgrade data frame cannot be received;
and the receiving function starting module is used for starting the infrared serial port receiving function when the timing time arrives.
Optionally, the calculating the timing time of the timer according to the baud rate and the comparison result between the data length of the upgrade data frame to be sent and the preset frame header length includes:
and calculating the timing time of the timer based on the preset frame head length and the baud rate under the condition that the data length of the upgrade data frame to be transmitted is larger than the preset frame head length.
Optionally, the calculating the timing time of the timer according to the baud rate and the comparison result between the data length of the upgrade data frame to be sent and the preset frame header length includes:
and calculating the timing time of the timer based on the data length and the baud rate of the upgrade data frame under the condition that the data length of the upgrade data frame to be transmitted is smaller than or equal to the preset frame header length.
On the other hand, the embodiment of the invention also provides an infrared communication upgrading device, which comprises:
the upgrade data frame receiving module is used for receiving the upgrade data frame sent by the control equipment; the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded; the upgrade data frame at least comprises a frame head, upgrade information, a function code and a check bit;
the first frame checking module is used for performing frame checking on the frame header;
the second frame check module is used for carrying out frame check on the check bit under the condition that the frame check result of the frame header is correct;
the function code identification module is used for identifying the function code under the condition that the frame check result of the check bit is correct;
and the upgrade information receiving module is used for receiving the upgrade information under the condition that the function code represents the upgrade instruction.
Optionally, the infrared communication upgrading device further includes:
and the abandoning processing module is used for not processing the upgrading data frame under the condition that the frame check result of the frame header is an error.
Optionally, the check bit includes: a crc check bit and/or an end bit, said performing a frame check on said check bit comprising:
performing frame check on the crc check bits; and/or
And performing frame verification on the ending bit.
In another aspect, the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements the above-mentioned infrared communication upgrading method when executing the program.
In another aspect, the present invention also provides a machine-readable storage medium having stored thereon a computer program which, when executed by a processor, implements an infrared communication upgrading method as described above.
According to the technical scheme, the timing time of the timer is calculated according to the baud rate and the comparison result between the data length of the upgrade data frame to be sent and the preset frame head length; and closing the infrared serial port receiving function, starting a timer, broadcasting the upgrade data frame to a plurality of equipment to be upgraded through infrared so as to ensure that the frame head of the upgrade data frame cannot be received, and therefore, under the conditions of one-to-many wireless upgrade realized through infrared and normal infrared serial port communication, the frame breaking processing is carried out on the infrared serial port receiving data, the self loop is avoided under the condition of not through hardware design, the hardware design complexity is reduced, and the hardware cost is reduced.
Additional features and advantages of embodiments of the invention will be set forth in the detailed description which follows.
Drawings
The accompanying drawings are included to provide a further understanding of embodiments of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain, without limitation, the embodiments of the invention. In the drawings:
FIG. 1 is a schematic flow chart of an IR communication upgrading method according to the present invention;
FIG. 2 is a schematic diagram of a control device according to the present invention for performing an infrared communication upgrade on a plurality of devices to be upgraded;
FIG. 3 is a schematic diagram of compressing an original file to obtain an upgrade file according to the present invention;
FIG. 4 is a schematic diagram of packet transmission provided by the present invention;
FIG. 5 is a second flow chart of the method for upgrading infrared communication according to the present invention;
FIG. 6 is a schematic diagram of an upgrade data frame provided by the present invention;
FIG. 7 is a third flow chart of the method for upgrading infrared communication according to the present invention;
FIG. 8 is a schematic diagram of an IR upgrading device according to the present invention;
FIG. 9 is a second schematic diagram of an IR upgrading device according to the present invention;
fig. 10 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
The following describes the detailed implementation of the embodiments of the present invention with reference to the drawings. It should be understood that the detailed description and specific examples, while indicating and illustrating the invention, are not intended to limit the invention.
Method embodiment
Referring to fig. 1, an embodiment of the present invention provides an infrared communication upgrading method, which is applied to a control device provided with a full duplex infrared serial port, and the method includes:
step 101, calculating the timing time of the timer according to the baud rate and the comparison result between the data length of the upgrade data frame to be transmitted and the preset frame head length.
The control device in the embodiment of the invention is provided with a full duplex infrared serial port (or infrared transceiver) capable of simultaneously transmitting and receiving data, and before data transmission, the control device closes the infrared serial port receiving function. The control device can be a smart phone, a personal computer, a tablet personal computer, a smart television and the like.
The control device calculates the timing time of the timer according to the baud rate and the comparison result between the data length of the upgrade data frame to be sent and the preset frame head length. When the control equipment sends the upgrade data frame, the infrared serial port receiving function of the timing time is closed, so that the infrared serial port of the control equipment cannot receive the complete upgrade data frame, and the phenomenon of self-loop-back is avoided.
The upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded; the upgrade data frame at least comprises a frame head, upgrade information, a function code and a check bit. The header is provided with a predetermined data length, for example 4 bytes. In one embodiment, the frame format of the upgrade data frame includes a frame header + data length + function code + data field + crc check + end bit. The data length and the data field constitute the upgrade information and the crc checksum end bits constitute the check bits.
Step 102, turning off the infrared serial port receiving function, starting a timer, and broadcasting the upgrade data frame to a plurality of devices to be upgraded through infrared so as to ensure that the frame head of the upgrade data frame cannot be received.
Referring to fig. 2, after the timing time of the timer is calculated, the control device turns off the infrared serial port receiving function, turns on the timer, and simultaneously broadcasts the upgrade data frame to a plurality of devices to be upgraded through infrared, so as to ensure that the frame header of the upgrade data frame cannot be received. Wherein the timer refers to a software timer.
It should be noted that, in some embodiments, the control device compresses an original file (including a program image) sent to a plurality of devices to be upgraded, to obtain a compressed upgrade file. And dividing the compressed upgrade file into a plurality of data packets through sub-packet transmission, and sending the data packets to each device to be upgraded. Wherein each data packet comprises a plurality of upgrade data frames.
The control device can compress the original file through a miniLZO compression algorithm. The miniLZO decompression algorithm is a lightweight lossless decompression algorithm, is widely applied to network transmission, and is used for compressing application binary, and the specific compressed upgrade file format is shown in the following figure 3. The file length is the length of the storage address and the compressed program image; the file verification is the verification of the storage address and the compressed program image, and specifically adopts a sha-256 algorithm, which has better conflict avoidance, tamper resistance and higher security than the crc32 algorithm; the storage address is an address location where the upgrade file is stored on the storage medium of the device.
The transmission of the packetization is shown in fig. 4. Wherein, the 0 th packet only contains transmission information, and contains the total data packet number N and the size of each data packet; the 1 st-N packet contains data information and a crc32 check value.
The following describes an upgrade procedure for packet transmission by a control device in one embodiment:
s1, the control equipment broadcasts and transmits the 0 th packet data.
S2, the control equipment polls whether each equipment to be upgraded correctly receives the 0 th packet, and if the equipment which does not receive the 0 th packet exists, the control equipment jumps to S1.
S3, the control equipment broadcasts and transmits the rest N sub-packets.
And S4, the control equipment polls each equipment to be upgraded in turn whether the receiving is completed, if the packet loss exists, the packet loss is broadcasted and sent, and the step S4 continues to poll until all the polling is completed.
S5, the control equipment sends upgrading broadcasting, polls version numbers of the equipment to be upgraded after being upgraded, and checks whether the upgrading is successful or not.
And 103, starting an infrared serial port receiving function when the timing time arrives.
When the timing time of the timer arrives, the control device starts the infrared serial port receiving function to normally receive the data sent by the device to be upgraded. When the control equipment is used for transmitting the data of the upgrade data frame, the infrared serial port receiving function of the timing time is closed, so that the infrared serial port of the control equipment cannot receive the frame head of the upgrade data frame, namely cannot receive the complete upgrade data frame, the control equipment cannot process the upgrade data frame transmitted by the control equipment, frame breaking processing is realized, self-loop returning is avoided, and communication and upgrade success rate is improved.
According to the baud rate and the comparison result between the data length of the upgrade data frame to be sent and the preset frame head length, the timing time of the timer is calculated; and closing the infrared serial port receiving function, starting a timer, broadcasting the upgrade data frame to a plurality of equipment to be upgraded through infrared so as to ensure that the frame head of the upgrade data frame cannot be received, and therefore, under the conditions of one-to-many wireless upgrade realized through infrared and normal infrared serial port communication, the frame breaking processing is carried out on the infrared serial port receiving data, the self loop is avoided under the condition of not through hardware design, the hardware design complexity is reduced, and the hardware cost is reduced.
In other aspects of the embodiments of the present invention, step 101, calculating a timing time of a timer according to the baud rate and a comparison result between a data length of an upgrade data frame to be transmitted and a preset frame header length, includes: and calculating the timing time of the timer based on the preset frame head length and the baud rate under the condition that the data length of the upgrade data frame to be transmitted is larger than the preset frame head length.
Under the condition that the data length of the upgrade data frame to be sent is larger than the preset frame head length, the upgrade data frame to be sent meets the requirement, and the timing time of the timer is calculated according to the preset frame head length and the baud rate. When the upgrade data frame to be sent meets the requirement, the timing time of the timer is the transmission time of the frame head of the upgrade data frame. Therefore, when the control equipment transmits the data of the upgrade data frame, the infrared serial port receiving function of the transmission time of one frame head is closed, so that the infrared serial port of the control equipment cannot receive the frame head of the upgrade data frame, namely cannot receive the complete upgrade data frame, and the control equipment cannot process the upgrade data frame transmitted by itself, so that frame breaking processing is realized, and the self-loop is avoided. The invention avoids the self loop without hardware design, and reduces the complexity of hardware design and the cost of hardware.
Specifically, in the case where the data length of the upgrade data frame to be transmitted is greater than the preset frame header length, the timing time of the timer=the preset frame header length is 1000 bits per byte/baud rate. In one embodiment, the preset frame header length is 4 bytes, each byte has 10 bits, and the timing time of the timer=4×10×1000/baud rate.
In other aspects of the embodiments of the present invention, step 101, calculating a timing time of a timer according to the baud rate and a comparison result between a data length of an upgrade data frame to be transmitted and a preset frame header length, includes: and calculating the timing time of the timer based on the data length and the baud rate of the upgrade data frame under the condition that the data length of the upgrade data frame to be transmitted is smaller than or equal to the preset frame header length.
Under the condition that the data length of the to-be-sent upgrade data frame is smaller than or equal to the preset frame header length, the to-be-sent upgrade data frame is not in accordance with the requirement, and is not in the frame format of the preset upgrade data frame. Because the data length of the upgrade data frame to be sent is smaller than or equal to the preset frame header length at this time, if the timing time is calculated based on the preset frame header length and the baud rate, the time for closing the infrared serial port of the control device is too long, and the control device leaks data from the device to be upgraded. Therefore, in the case where the data length of the upgrade data frame to be transmitted is less than or equal to the preset frame header length, the control apparatus calculates the timing time of the timer based on the data length and the baud rate of the upgrade data frame. When the control device sends data, the control device does not receive a complete data frame, and the control device does not process the data sent by the control device, so that the control device is prevented from receiving the data while avoiding self-loop.
Specifically, in the case where the data length of the upgrade data frame to be transmitted is less than or equal to the preset frame header length, the timing time of the timer=the data length of the pre-upgrade data frame is 1000 bits per byte. Wherein the data length of the pre-upgrade data frame is represented by bytes. Such as 1 byte, 2 bytes, etc.
On the other hand, referring to fig. 5, an embodiment of the present invention further provides an infrared communication upgrading method, which is applied to a device to be upgraded provided with a full duplex infrared serial port, where the method includes:
step 201, receiving an upgrade data frame sent by a control device.
Specifically, the device to be upgraded is provided with a full duplex infrared serial port (or infrared transceiver). When the infrared serial port of the equipment to be upgraded is interrupted to receive a new upgrading data frame, the upgrading data frame is stored in a receiving buffer area, whether the data is one frame of data is judged according to the overtime, and if the new data is not received any more after the overtime, the received upgrading data frame is subjected to frame verification. The device to be upgraded may be various small devices with low power consumption. The upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded; the upgrade data frame at least comprises a frame head, upgrade information, a function code and a check bit.
In one embodiment, the upgrade data frame includes a frame header + a data length + a function code + a data field + a check bit. The data length is used to represent the data length of the upgrade data frame, and the function code is used to represent different instruction types sent by the control device, such as a parameter query instruction, a parameter setting instruction, an upgrade instruction, and the like. The data field is used to store upgrade information. The check bit is used for checking the accuracy and the safety of the upgrade data frame.
And 202, performing frame verification on the frame header.
And 203, performing frame verification on the verification bits when the frame verification result of the frame header is correct.
And 204, identifying the function code when the frame check result of the check bit is correct.
Step 205, receiving the upgrade information under the condition that the function code represents the upgrade instruction.
And the equipment to be upgraded performs frame verification on the frame header. Firstly judging whether the frame check result of the frame header is correct, if the frame check result of the frame header is correct, then checking the check bit, if the check bit is also correct, identifying the function code, and processing data according to the corresponding function code. For example, when the function code is 2, it indicates an upgrade instruction sent by the control device at this time, and upgrade information is received.
When the function code is another value, a different instruction is indicated. For example, when the function code is 0, the parameter inquiry instruction is indicated, and the device to be upgraded needs to reply the corresponding code to the control device. When the function code is 1, a set inquiry instruction is indicated, and the equipment to be upgraded needs to reply the corresponding code to the control equipment. If there is no corresponding function code, a code indicating that the received upgrade data frame is an erroneous frame is replied to in the correct frame format.
The equipment to be upgraded conveniently determines the upgrade data frames sent by the control equipment from a plurality of infrared signals in reality by carrying out frame check on the frame header and frame check on the check bit, thereby improving the accuracy and safety of the identification of the upgrade data frames and avoiding system faults caused by processing the received error data frames.
It should be noted that, the upgrade file is transmitted by the packetization sent by the control device. The following describes the device to be upgraded upgrading steps in one implementation:
step S1, the equipment to be upgraded receives the 0 th packet, checks the integrity of the packet, applies for a buffer area, and clears 0.
And S2, the equipment to be upgraded receives the data packet to the buffer area, judges whether the data packet is received completely or not, and records the data packet.
And S3, the equipment to be upgraded receives the polling instruction and replies according to the receiving condition.
And S4, checking the integrity of the upgrade package by the equipment to be upgraded.
And S5, the equipment to be upgraded receives the upgrade instruction, writes the data of the buffer area into the storage medium, and restarts.
In addition, the infrared receiving serial port of the equipment to be upgraded receives the upgrade message broadcast by the control equipment, and firstly performs frame verification, and then writes the upgrade message into the upgrade area of the equipment to be upgraded according to the frame number. After all the upgrade messages are sent, the equipment to be upgraded checks the integrity of upgrade information (upgrade program) of the upgrade area, if the equipment to be upgraded is incomplete, the equipment to be upgraded sends the upgrade information (upgrade program) to the control equipment in an infrared mode according to the serial numbers of the missing upgrade data frames, and the control equipment sends the missing upgrade data frames to the equipment to be upgraded.
In other aspects of the embodiments of the present invention, after performing the frame check on the frame header, step 202 further includes:
and 206, if the frame check result of the frame header is an error, not processing the upgrade data frame.
And under the condition that the frame check result of the frame header is an error, the fact that the received upgrade data frame does not meet the requirement at the moment is indicated, the equipment to be upgraded empties the receiving buffer area, the received upgrade data frame is not processed, and the efficiency of data identification on the upgrade data frame is improved. And the equipment to be upgraded does not process the upgrade data frame, and the upgrade data frame returns to the control equipment, because the control equipment closes the infrared serial port receiving function, the closing time is the time required by the transmission of the frame header, the receiving header of the infrared serial port of the control equipment cannot receive the frame header, and the frame breaking processing of the infrared serial port is realized, so that the self-loop-back can be avoided, and the communication and upgrading success rate is improved.
In other aspects of embodiments of the present invention, the check bits include: the crc check bits and/or the end bits. I.e. the check bits comprise the crc check bits, or the check bits comprise the end bits, or referring to fig. 6, the check bits comprise the crc check bits and the end bits. Performing frame check on the check bit includes:
performing frame check on the crc check bits; and/or
And performing frame verification on the ending bit.
In one embodiment, the device to be upgraded performs frame check on the crc check bits after the frame header check is correct. In another embodiment, the device to be upgraded performs frame verification on the end bit after the frame header is verified to be correct. Referring to fig. 7, in another embodiment, the device to be upgraded performs frame verification on the crc check bit after the frame header is verified correctly, and performs frame verification on the end bit if the frame verification result of the crc check bit is correct.
The equipment to be upgraded conveniently determines the upgrade data frame sent by the control equipment from a plurality of infrared signals in reality by carrying out frame check on the frame header and frame check on the crc check bit and the end bit, thereby further improving the accuracy and safety of the identification of the upgrade data frame and avoiding system faults caused by processing the received error data frame.
In summary, the invention realizes one-to-many wireless upgrade through infrared, has no physical connection line contact problem, greatly improves upgrade efficiency, saves upgrade time and reduces labor cost, and under the condition of ensuring normal infrared serial port communication, closes the infrared serial port receiving function for a period of time when transmitting upgrade data frames, realizes frame breaking processing of the infrared serial port receiving data, avoids self-loop, improves communication and upgrade success rate, and realizes avoiding self-loop without hardware design, reduces hardware design complexity and reduces hardware cost.
Device embodiment
Referring to fig. 8, in another aspect, an embodiment of the present invention further provides an infrared communication upgrading apparatus, including:
a timing time calculation module 801, configured to calculate a timing time of a timer according to a baud rate and a comparison result between a data length of an upgrade data frame to be sent and a preset frame header length, where the upgrade data frame is used for performing firmware upgrade on a device to be upgraded, and the upgrade data frame at least includes a frame header, upgrade information, a function code, and a check bit;
a broadcasting module 802, configured to close an infrared serial port receiving function, and start a timer, and broadcast the upgrade data frame to a plurality of devices to be upgraded through infrared, so as to ensure that a frame header of the upgrade data frame cannot be received;
the receiving function starting module 803 is configured to start the infrared serial port receiving function when the timing time arrives.
Optionally, the calculating the timing time of the timer according to the baud rate and the comparison result between the data length of the upgrade data frame to be sent and the preset frame header length includes:
and calculating the timing time of the timer based on the preset frame head length and the baud rate under the condition that the data length of the upgrade data frame to be transmitted is larger than the preset frame head length.
Optionally, the calculating the timing time of the timer according to the baud rate and the comparison result between the data length of the upgrade data frame to be sent and the preset frame header length includes:
and calculating the timing time of the timer based on the data length and the baud rate of the upgrade data frame under the condition that the data length of the upgrade data frame to be transmitted is smaller than or equal to the preset frame header length.
The infrared communication upgrading device comprises a processor and a memory, wherein the timing time calculation module 801, the broadcasting module 802, the receiving function starting module 803 and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel may be provided with one or more.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
On the other hand, referring to fig. 9, an embodiment of the present invention further provides an infrared communication upgrading device, including:
an upgrade data frame receiving module 901, configured to receive an upgrade data frame sent by a control device; the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded; the upgrade data frame at least comprises a frame head, upgrade information, a function code and a check bit;
a first frame checking module 902, configured to perform frame checking on the frame header;
a second frame checking module 903, configured to perform frame check on the check bit when the frame check result of the frame header is correct;
a function code identifying module 904, configured to identify the function code when the frame check result of the check bit is correct;
the upgrade information receiving module 905 is configured to receive the upgrade information when the function code characterizes the upgrade instruction.
Optionally, the infrared communication upgrading device further includes:
and the abandoning processing module is used for not processing the upgrading data frame under the condition that the frame check result of the frame header is an error.
Optionally, the check bit includes: a crc check bit and/or an end bit, said performing a frame check on said check bit comprising:
performing frame check on the crc check bits; and/or
And performing frame verification on the ending bit.
The infrared communication upgrading device includes a processor and a memory, where the upgrade data frame receiving module 901, the first frame checking module 902, the second frame checking module 903, the function code identifying module 904, the upgrade information receiving module 905, and the like are all stored as program units in the memory, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel may be provided with one or more.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
Fig. 10 illustrates a physical structure diagram of an electronic device, as shown in fig. 10, which may include: a processor 1010, a communication interface (Communications Interface) 1020, a memory 1030, and a communication bus 1040, wherein the processor 1010, the communication interface 1020, and the memory 1030 communicate with each other via the communication bus 1040. Processor 1010 may invoke logic instructions in memory 1030 to perform an infrared communication upgrade method comprising: calculating the timing time of a timer according to the baud rate and the comparison result between the data length of an upgrade data frame to be sent and the length of a preset frame header, wherein the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded and at least comprises the frame header, upgrade information, a function code and a check bit; closing an infrared serial port receiving function, starting a timer, and broadcasting the upgrade data frame to a plurality of devices to be upgraded through infrared so as to ensure that the frame head of the upgrade data frame cannot be received; when the timing time arrives, an infrared serial port receiving function is started; or,
receiving an upgrade data frame sent by control equipment; the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded; the upgrade data frame at least comprises a frame head, upgrade information, a function code and a check bit; performing frame verification on the frame header; under the condition that the frame check result of the frame header is correct, carrying out frame check on the check bit; identifying the function code under the condition that the frame check result of the check bit is correct; and under the condition that the function code represents an upgrade instruction, receiving the upgrade information.
Further, the logic instructions in the memory 1030 described above may be implemented in the form of software functional units and stored in a computer readable storage medium when sold or used as a stand alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program storable on a machine-readable storage medium, the computer program, when executed by a processor, is capable of performing an infrared communication upgrade method, the method comprising: calculating the timing time of a timer according to the baud rate and the comparison result between the data length of an upgrade data frame to be sent and the length of a preset frame header, wherein the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded and at least comprises the frame header, upgrade information, a function code and a check bit; closing an infrared serial port receiving function, starting a timer, and broadcasting the upgrade data frame to a plurality of devices to be upgraded through infrared so as to ensure that the frame head of the upgrade data frame cannot be received; when the timing time arrives, an infrared serial port receiving function is started; or,
receiving an upgrade data frame sent by control equipment; the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded; the upgrade data frame at least comprises a frame head, upgrade information, a function code and a check bit; performing frame verification on the frame header; under the condition that the frame check result of the frame header is correct, carrying out frame check on the check bit; identifying the function code under the condition that the frame check result of the check bit is correct; and under the condition that the function code represents an upgrade instruction, receiving the upgrade information.
In yet another aspect, the present invention provides a machine-readable storage medium having stored thereon a computer program which when executed by a processor is implemented to perform an infrared communication upgrade method, the method comprising: calculating the timing time of a timer according to the baud rate and the comparison result between the data length of an upgrade data frame to be sent and the length of a preset frame header, wherein the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded and at least comprises the frame header, upgrade information, a function code and a check bit; closing an infrared serial port receiving function, starting a timer, and broadcasting the upgrade data frame to a plurality of devices to be upgraded through infrared so as to ensure that the frame head of the upgrade data frame cannot be received; when the timing time arrives, an infrared serial port receiving function is started; or,
receiving an upgrade data frame sent by control equipment; the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded; the upgrade data frame at least comprises a frame head, upgrade information, a function code and a check bit; performing frame verification on the frame header; under the condition that the frame check result of the frame header is correct, carrying out frame check on the check bit; identifying the function code under the condition that the frame check result of the check bit is correct; and under the condition that the function code represents an upgrade instruction, receiving the upgrade information.
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. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention 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 and scope of the technical solutions of the embodiments of the present invention.

Claims (6)

1. An infrared communication upgrading method is characterized by being applied to control equipment provided with a full duplex infrared serial port, and the method comprises the following steps:
calculating the timing time of a timer according to the baud rate and the comparison result between the data length of an upgrade data frame to be sent and the length of a preset frame header, wherein the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded and at least comprises the frame header, upgrade information, a function code and a check bit;
closing an infrared serial port receiving function, starting a timer, and broadcasting the upgrade data frame to a plurality of devices to be upgraded through infrared so as to ensure that the frame head of the upgrade data frame cannot be received;
when the timing time arrives, an infrared serial port receiving function is started;
the calculating the timing time of the timer according to the baud rate and the comparison result between the data length of the upgrade data frame to be sent and the preset frame head length comprises the following steps:
calculating the timing time of a timer based on the preset frame header length and the baud rate under the condition that the data length of the upgrade data frame to be transmitted is larger than the preset frame header length; timing time of timer = preset frame header length × number of bits per byte × 1000/baud rate.
2. The method of claim 1, wherein calculating the timing time of the timer based on the baud rate and the comparison between the data length of the upgrade data frame to be transmitted and the preset frame header length comprises:
and calculating the timing time of the timer based on the data length and the baud rate of the upgrade data frame under the condition that the data length of the upgrade data frame to be transmitted is smaller than or equal to the preset frame header length.
3. An infrared communication upgrading device, comprising:
the timing time calculation module is used for calculating the timing time of a timer according to the baud rate and the comparison result between the data length of an upgrade data frame to be sent and the length of a preset frame head, wherein the upgrade data frame is used for carrying out firmware upgrade on equipment to be upgraded and at least comprises the frame head, upgrade information, a function code and a check bit;
the broadcasting module is used for closing the infrared serial port receiving function, starting a timer and broadcasting the upgrade data frame to a plurality of devices to be upgraded through infrared so as to ensure that the frame head of the upgrade data frame cannot be received;
the receiving function starting module is used for starting the infrared serial port receiving function when the timing time arrives;
the calculating the timing time of the timer according to the baud rate and the comparison result between the data length of the upgrade data frame to be sent and the preset frame head length comprises the following steps:
calculating the timing time of a timer based on the preset frame header length and the baud rate under the condition that the data length of the upgrade data frame to be transmitted is larger than the preset frame header length; timing time of timer = preset frame header length × number of bits per byte × 1000/baud rate.
4. The apparatus of claim 3, wherein the calculating the timing time of the timer based on the baud rate and the comparison between the data length of the upgrade data frame to be transmitted and the preset frame header length comprises:
and calculating the timing time of the timer based on the data length and the baud rate of the upgrade data frame under the condition that the data length of the upgrade data frame to be transmitted is smaller than or equal to the preset frame header length.
5. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the infrared communication upgrading method according to any of claims 1-2 when executing the program.
6. A machine readable storage medium having stored thereon a computer program which when executed by a processor implements the infrared communication upgrading method according to any of claims 1-2.
CN202311229428.9A 2023-09-22 2023-09-22 Infrared communication upgrading method and device and electronic equipment Active CN116980290B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311229428.9A CN116980290B (en) 2023-09-22 2023-09-22 Infrared communication upgrading method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311229428.9A CN116980290B (en) 2023-09-22 2023-09-22 Infrared communication upgrading method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN116980290A CN116980290A (en) 2023-10-31
CN116980290B true CN116980290B (en) 2024-01-26

Family

ID=88473428

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311229428.9A Active CN116980290B (en) 2023-09-22 2023-09-22 Infrared communication upgrading method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN116980290B (en)

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104933851A (en) * 2015-06-12 2015-09-23 合肥市徽腾网络科技有限公司 Electric meter data collector with infrared upgrade function and upgrade method thereof
CN104933853A (en) * 2015-07-07 2015-09-23 安徽瑞宏信息科技有限公司 Ammeter data acquisition unit with infrared upgrading function and upgrading method thereof
CN104954097A (en) * 2015-04-29 2015-09-30 上海林果实业股份有限公司 Audio communication device and encoding method
CN106877925A (en) * 2017-01-09 2017-06-20 深圳市欢创科技有限公司 A kind of point-to-point infrared communication method and system
WO2017113080A1 (en) * 2015-12-29 2017-07-06 深圳配天智能技术研究院有限公司 Slave station firmware update method, system, master station and slave station
CN206640575U (en) * 2017-04-12 2017-11-14 青岛金思特电子有限公司 The serial ports of maskable self-interference turns infrared communication circuit
CN107517053A (en) * 2017-07-07 2017-12-26 中兴软创科技股份有限公司 A kind of half-duplex is anti-to disturb infrared serial interface circuit certainly
CN210955475U (en) * 2020-03-18 2020-07-07 重庆信驰科技有限公司 Circuit mainboard with half-duplex infrared communication function
CN111538515A (en) * 2020-04-17 2020-08-14 杭州海兴电力科技股份有限公司 Method, device and equipment for upgrading electric energy meter program
CN114553262A (en) * 2022-02-22 2022-05-27 国网电力科学研究院有限公司 Electric energy data high-speed acquisition terminal and control method thereof
CN115756530A (en) * 2022-10-28 2023-03-07 深圳开鸿数字产业发展有限公司 Equipment upgrading method and device, storage medium, electronic equipment and server
CN115964067A (en) * 2022-12-30 2023-04-14 深圳市朗科智能电气股份有限公司 Method and device for realizing product upgrading based on infrared transmission and related components
CN116781211A (en) * 2023-06-21 2023-09-19 珠海格力电器股份有限公司 Equipment upgrading method and device, electronic equipment and storage medium

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104954097A (en) * 2015-04-29 2015-09-30 上海林果实业股份有限公司 Audio communication device and encoding method
CN104933851A (en) * 2015-06-12 2015-09-23 合肥市徽腾网络科技有限公司 Electric meter data collector with infrared upgrade function and upgrade method thereof
CN104933853A (en) * 2015-07-07 2015-09-23 安徽瑞宏信息科技有限公司 Ammeter data acquisition unit with infrared upgrading function and upgrading method thereof
WO2017113080A1 (en) * 2015-12-29 2017-07-06 深圳配天智能技术研究院有限公司 Slave station firmware update method, system, master station and slave station
CN106877925A (en) * 2017-01-09 2017-06-20 深圳市欢创科技有限公司 A kind of point-to-point infrared communication method and system
CN206640575U (en) * 2017-04-12 2017-11-14 青岛金思特电子有限公司 The serial ports of maskable self-interference turns infrared communication circuit
CN107517053A (en) * 2017-07-07 2017-12-26 中兴软创科技股份有限公司 A kind of half-duplex is anti-to disturb infrared serial interface circuit certainly
CN210955475U (en) * 2020-03-18 2020-07-07 重庆信驰科技有限公司 Circuit mainboard with half-duplex infrared communication function
CN111538515A (en) * 2020-04-17 2020-08-14 杭州海兴电力科技股份有限公司 Method, device and equipment for upgrading electric energy meter program
CN114553262A (en) * 2022-02-22 2022-05-27 国网电力科学研究院有限公司 Electric energy data high-speed acquisition terminal and control method thereof
CN115756530A (en) * 2022-10-28 2023-03-07 深圳开鸿数字产业发展有限公司 Equipment upgrading method and device, storage medium, electronic equipment and server
CN115964067A (en) * 2022-12-30 2023-04-14 深圳市朗科智能电气股份有限公司 Method and device for realizing product upgrading based on infrared transmission and related components
CN116781211A (en) * 2023-06-21 2023-09-19 珠海格力电器股份有限公司 Equipment upgrading method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN116980290A (en) 2023-10-31

Similar Documents

Publication Publication Date Title
CN102546784B (en) Method for conducting batch upgrading for device firmware based on controller area network (CAN) bus
CN106843942B (en) Wearable device and firmware upgrading method thereof
US7650388B2 (en) Wireless identification protocol with confirmation of successful transmission
CN110730104A (en) Method for upgrading multi-device batch firmware of mesh network device
US20050120384A1 (en) Methods and systems for enabling software and firmware downloads to high definition television appliances
CN110621011A (en) OTA firmware upgrading method and system based on Bluetooth device end
CN106886438A (en) System remote update method based on FPGA
CN106850241A (en) A kind of vehicle-mounted OBD terminals and its remote upgrade method
WO2017016282A1 (en) Software upgrading method and apparatus, and computer storage medium
CN113746892B (en) Remote upgrading method and wireless terminal equipment
CN101022473B (en) Method for automatic, identifying plate card configration and generating local data in exchanger
CN111752579A (en) Bluetooth terminal upgrading method and device, storage medium and electronic equipment
US7571374B2 (en) Method for transmitting and processing command and data
CN112104487A (en) Remote upgrading method for terminal of Internet of things, Internet of things master station and storage medium
CN111224837B (en) Method and system for automatically identifying CAN communication baud rate of vehicle ECU
US20040179517A1 (en) Wireless communication method and wireless communication device
CN116980290B (en) Infrared communication upgrading method and device and electronic equipment
CN111654451B (en) Message anti-replay method and electronic equipment
US7836234B2 (en) Communication in accordance with a master-slave communication protocol
US20210014006A1 (en) System and method for implementing a hybrid automatic repeat request process
KR101847824B1 (en) System and method for firmware update of smart key
EP3562149B1 (en) Software upgrade method and device
JP2011135281A (en) Software updating method of radio terminal, and wireless network
CN114579166A (en) Component module upgrading method, component module and financial robot
US8291143B1 (en) Single line communication

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