CN110621011B - OTA firmware upgrading method and system based on Bluetooth device side - Google Patents

OTA firmware upgrading method and system based on Bluetooth device side Download PDF

Info

Publication number
CN110621011B
CN110621011B CN201910866642.2A CN201910866642A CN110621011B CN 110621011 B CN110621011 B CN 110621011B CN 201910866642 A CN201910866642 A CN 201910866642A CN 110621011 B CN110621011 B CN 110621011B
Authority
CN
China
Prior art keywords
firmware
ota
data packet
chunk
bluetooth equipment
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
CN201910866642.2A
Other languages
Chinese (zh)
Other versions
CN110621011A (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 Fangyan Juxing Technology Co ltd
Original Assignee
Beijing Fangyan Juxing 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 Fangyan Juxing Technology Co ltd filed Critical Beijing Fangyan Juxing Technology Co ltd
Priority to CN201910866642.2A priority Critical patent/CN110621011B/en
Publication of CN110621011A publication Critical patent/CN110621011A/en
Application granted granted Critical
Publication of CN110621011B publication Critical patent/CN110621011B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/22Processing or transfer of terminal data, e.g. status or physical capabilities
    • H04W8/24Transfer of terminal data
    • H04W8/245Transfer of terminal data from a network towards a terminal

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application discloses a Bluetooth device end-based OTA firmware upgrading method and system, which comprises a step of starting OTA upgrading, wherein a Bluetooth device end receives an OTA request upgrading data packet sent by a terminal, reads locally stored breakpoint resume firmware data and judges whether version numbers and check values in the upgrading data packet and the breakpoint resume firmware data are corresponding and consistent; if not, the Bluetooth equipment terminal downloads the OTA firmware; downloading the OTA firmware, namely waiting for receiving a first chunk data packet of the OTA firmware by a Bluetooth device end to update OTA firmware data, sequentially receiving the rest chunk data packets of the OTA firmware, and downloading the OTA firmware according to the identification of the rest chunk data packets; and the Bluetooth equipment terminal receives an upgrading command sent by the terminal and upgrades the Bluetooth equipment terminal based on the downloaded OTA firmware. The invention realizes the breakpoint continuous transmission function and ensures the integrity of the transmitted OTA firmware.

Description

OTA firmware upgrading method and system based on Bluetooth device end
Technical Field
The application relates to the technical field of Bluetooth, in particular to a Bluetooth device side-based OTA firmware upgrading method and system.
Background
With the rapid development of the internet of things, various wireless communication protocols, such as Zigbee, bluetooth, WIFI, and the like, are popular in the field of the internet of things. These wireless communication protocols have respective advantages and disadvantages, and by virtue of the advantages of easy connection, low power consumption, low cost, no need of an additional gateway or a route for relaying, etc., bluetooth Low Energy (BLE) devices have been widely applied to electronic devices used by people in daily life.
Meanwhile, the requirements of the internet of things equipment on system functions and performance are continuously improved, and online upgrade (OTA) is very important for batched internet of things terminal equipment in order to eliminate system defects or perfect functions.
Although BLE has many advantages, the disadvantages of this wireless communication protocol are: the rate at which the wireless communication protocol transfers has to be sacrificed in order to more fully realize its ability to lower power consumption.
The disadvantages of the BLE device are not obvious since it is the BLE device itself that is designed to cope with low frequency and small data volume scenarios, but the disadvantages of the BLE device are revealed to implement the OTA function, i.e. if the user wants to perform a complete OTA upgrade on a BLE device, it takes a long time to wait, the user's terminal device cannot leave the range of the BLE device during the OTA, otherwise the OTA upgrade process is terminated, and thus the OTA upgrade needs to be performed again.
Disclosure of Invention
It is an object of the present application to overcome the above problems or to at least partially solve or mitigate the above problems.
According to one aspect of the application, a Bluetooth device-side-based OTA firmware upgrading method is provided, and the method comprises the following steps:
s10, starting an OTA upgrading step, wherein the OTA upgrading starting step comprises the following substeps S11-S13;
s11, the Bluetooth equipment end receives an OTA request upgrading data packet sent by the terminal;
s12, the Bluetooth equipment side reads the locally stored breakpoint continuous transmission firmware data;
s13, the Bluetooth equipment end judges whether the version number and the check value in the OTA request upgrading data packet and the breakpoint resuming firmware data are corresponding and consistent; if not, the Bluetooth equipment terminal downloads the OTA firmware;
s20, downloading OTA firmware, wherein the step of downloading the OTA firmware comprises the following substeps S21-S23;
s21, the Bluetooth equipment terminal waits for receiving a first chunk data packet of the OTA firmware to update the OTA firmware data;
s22, the Bluetooth equipment end sequentially receives the residual chunk data packets of the OTA firmware and judges whether the received chunk data packets are the last data packets or not according to the identification of the residual chunk data packets;
s23, the Bluetooth equipment terminal judges whether the OTA firmware is complete and can normally run, and if so, the OTA firmware is downloaded;
and S30, the Bluetooth equipment end receives the upgrading command sent by the terminal and upgrades the Bluetooth equipment end based on the downloaded OTA firmware.
Optionally, the OTA firmware upgrading method further includes the following steps:
and S40, the Bluetooth equipment terminal initializes the state data of the OTA firmware according to the received abnormal data of the OTA firmware and feeds back the information of the abnormal data of the OTA firmware to the terminal.
Optionally, the upgrade request data packet includes a new firmware version number, a total size of the new firmware, and a new firmware check value;
the breakpoint resume firmware data comprises a version number of the downloaded firmware, a check value of the downloaded firmware and a downloaded offset.
Optionally, the OTA firmware upgrade method is characterized in that the OTA upgrade starting further includes the following substeps:
s14: the Bluetooth equipment end constructs a second reply data packet; the offset field of the second reply data packet is the downloaded offset, and the Bluetooth equipment end judges whether the total size of the new firmware is consistent with the downloaded offset;
if not, the Bluetooth equipment end enters a breakpoint continuous transmission state and then jumps to S22;
if yes, the Bluetooth device enters a state that OTA firmware is downloaded and an upgrading command is waited, and then the process goes to S30.
Optionally, the starting of the OTA upgrade further includes the following sub-steps:
the Bluetooth equipment end judges whether the version number of the new firmware is consistent with the version number of the downloaded firmware and whether the check value of the new firmware is consistent with the check value of the downloaded firmware:
if yes, jumping to S14;
if not, the Bluetooth equipment end restarts downloading the OTA firmware; specifically, the bluetooth device end constructs a first recovery data packet, where the first recovery data packet includes the size of the OTA firmware packet transmitted each time and a first expected firmware offset; the offset of the first reply packet is 0.
Optionally, the waiting for receiving the first chunk packet of the OTA firmware by the bluetooth device end to update the OTA firmware data specifically includes:
if the offset in the chunk data packet received by the Bluetooth equipment end is not equal to 0 in the state that the Bluetooth equipment end downloads the new firmware, jumping to S40;
if the offset of the received first chunk data packet is equal to 0, the Bluetooth device side initializes the breakpoint to continuously transmit the firmware data, stores the binary information in the first chunk data packet, and calculates the cumulative check value of the current chunk data packet.
Optionally, the determining, according to the identifier of the remaining chunk data packet, whether the received chunk data packet is the last data packet specifically includes:
the Bluetooth device end detects the identifier of the chunk data packet, if the identifier of the data packet is equal to 1, the chunk data packet is the last data packet of the OTA firmware, and then the step is switched to S23;
if the flag is equal to 0, it indicates that this chunk packet is not the last packet data, and the process loops to step S22 until the flag of the chunk packet is equal to 1.
Optionally, before determining whether the connected chunk data packet is the last data packet according to the identifier of the remaining chunk data packet, the method further includes an effective detection step, specifically:
the Bluetooth device end sequentially receives the residual chunk data packets of the OTA firmware to determine whether each of the residual chunk data packets is complete;
if not, namely the Bluetooth equipment end detects that at least one abnormal data exists in the residual chunk data packets, skipping to S40;
if yes, that is, each chunk data packet in the remaining chunk data packets is detected to be normal, the bluetooth device end stores the binary information of the chunk data packet, the offset of the current chunk data packet and the accumulated calculation check value.
Optionally, the method for detecting whether each chunk data packet in the remaining chunk data packets is complete includes:
and the Bluetooth equipment end accumulates each received chunk data packet to obtain an accumulated calculation check value until the last chunk data packet is received to obtain a final check value, and if the final check value is completely the same as the new firmware check value, each chunk data packet in the remaining chunk data packets is determined to be complete. According to another aspect of the application, an OTA firmware upgrading system based on a bluetooth device side is provided, and the system comprises the bluetooth device side and a terminal;
the Bluetooth equipment end receives an OTA request upgrading data packet sent by the terminal; the Bluetooth device side reads locally stored breakpoint continuous transmission firmware data; the Bluetooth equipment terminal judges whether the version number and the check value in the OTA request upgrading data packet and the breakpoint continuous transmission firmware data are correspondingly consistent; if not, the Bluetooth equipment terminal downloads the OTA firmware;
the Bluetooth device end waits for receiving a first chunk data packet of the OTA firmware to update the OTA firmware data; the Bluetooth equipment end sequentially receives the residual chunk data packets of the OTA firmware, and judges whether the received chunk data packets are the last data packets or not according to the identification of the residual chunk data packets; the Bluetooth equipment terminal judges whether the OTA firmware is complete and can normally run, and if so, the OTA firmware is downloaded;
and the Bluetooth equipment terminal receives an upgrading command sent by the terminal and upgrades the Bluetooth equipment terminal based on the downloaded OTA firmware.
According to the OTA firmware upgrading method and system based on the Bluetooth equipment end, the Bluetooth equipment end judges whether the version number and the check value in the OTA request upgrading data packet and the breakpoint resume firmware data are corresponding and consistent or not, and combines a breakpoint resume system mechanism, so that the technical problem that the OTA firmware needs to be downloaded again due to the fact that the OTA firmware is too large, the OTA firmware is too long in transmission time between the Bluetooth equipment end and the terminal, and abnormity occurs in the midway of transmitting the OTA firmware is solved, and therefore the breakpoint resume function is achieved;
in addition, in this embodiment, the check value is calculated according to the accumulation by comparing the new firmware check value with the calculated check value, so that the problem that the integrity of the transmitted OTA firmware cannot be guaranteed in the transmission process of the OTA firmware is solved.
The above and other objects, advantages and features of the present application will become more apparent to those skilled in the art from the following detailed description of specific embodiments thereof, taken in conjunction with the accompanying drawings.
Drawings
Some specific embodiments of the present application will be described in detail hereinafter by way of illustration and not limitation with reference to the accompanying drawings. The same reference numbers in the drawings identify the same or similar elements or components. Those skilled in the art will appreciate that the drawings are not necessarily to scale. In the drawings:
fig. 1 is a flowchart illustrating a bluetooth device-based OTA firmware upgrading method according to an embodiment of the present application;
fig. 2 is a flowchart illustrating a bluetooth device-based OTA firmware upgrading method according to another embodiment of the present application;
fig. 3 is a schematic structural diagram of a bluetooth device-based OTA firmware upgrading system according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a computing device according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present application.
Detailed Description
Fig. 1 is a flowchart illustrating a method for upgrading OTA firmware based on a bluetooth device according to an embodiment of the present application, where as shown in fig. 1, the method for upgrading OTA firmware according to an embodiment of the present application may include:
s10, starting an OTA upgrading step, wherein the starting of the OTA upgrading comprises the following substeps S11-S13;
s11, the Bluetooth equipment end receives an OTA request upgrading data packet sent by the terminal;
s12, the Bluetooth equipment side reads locally stored breakpoint continuous transmission firmware data;
s13, the Bluetooth equipment terminal judges whether the version number and the check value in the OTA request upgrading data packet and the breakpoint continuous transmission firmware data are correspondingly consistent; if not, the Bluetooth equipment terminal downloads the OTA firmware;
s20, downloading the OTA firmware, wherein the downloading of the OTA firmware comprises the following substeps S21-S23:
s21, the Bluetooth device end waits for receiving a first chunk data packet of the OTA firmware to update the OTA firmware data;
s22, the Bluetooth device end sequentially receives the residual chunk data packets of the OTA firmware and judges whether the received chunk data packets are the last data packets according to the marks of the residual chunk data packets;
s23, the Bluetooth device side judges whether the OTA firmware is complete and can normally run; if yes, downloading OTA firmware;
and S30, the Bluetooth equipment end receives the upgrading command sent by the terminal and upgrades the Bluetooth equipment end based on the downloaded OTA firmware.
Further, the OTA firmware upgrading method also comprises a step S40 that the Bluetooth device side initializes the state data of the OTA firmware according to the received abnormal data of the OTA firmware and feeds back the information of the abnormal data to the terminal.
Fig. 2 is a flowchart illustrating a bluetooth device-based OTA firmware upgrading method according to another embodiment of the present application; the terminal in this embodiment takes a mobile phone APP as an example for description, and referring to fig. 2, the OTA firmware upgrading method specifically includes the following steps:
s10, starting an OTA upgrading step, wherein the OTA upgrading starting step comprises the following substeps S11-S13;
s11: the Bluetooth equipment end receives an OTA request upgrading data packet sent by a mobile phone APP;
specifically, firstly, a mobile phone APP sends an OTA request upgrading data packet to a Bluetooth device end, and the Bluetooth device end receives the request upgrading data packet; the upgrade request data packet in this embodiment further includes various data of the firmware to be upgraded of the mobile phone APP, for example: data such as a new firmware version number (new _ version), a new firmware total size (total _ len), and a new firmware check value (new _ crc 16);
s12, the Bluetooth equipment side reads the locally stored breakpoint continuous transmission firmware data;
the breakpoint resume firmware data comprises data such as a version number (down _ version) of downloaded firmware, a check value (down _ crc 16) of the downloaded firmware, a downloaded offset (down _ offset), and the like;
s13, the Bluetooth equipment terminal judges whether the version number and the check value in the OTA request upgrading data packet and the breakpoint continuous transmission firmware data are correspondingly consistent; if not, the Bluetooth equipment terminal downloads the OTA firmware;
specifically, the bluetooth device side determines whether the new firmware version number (new _ version) is consistent with the version number (down _ version) of the downloaded firmware and whether the new firmware verification value (new _ crc 16) is consistent with the verification value (down _ crc 16) of the downloaded firmware;
if yes, the newly downloaded firmware is the same as the original downloaded firmware, and S14 is skipped;
if not, the newly downloaded firmware is different from the original downloaded firmware, so that the bluetooth device end enters the step S20 of downloading the OTA firmware, that is, the bluetooth device end needs to restart downloading the OTA firmware; specifically, the bluetooth device may construct a first recovery packet, where a field of an offset of the first recovery packet is 0;
optionally, the first reply data packet further includes a size (chunksize) of the OTA firmware packet for each transmission, and a first expected firmware offset (expect _ offset 1).
S14, the Bluetooth equipment end constructs a second reply data packet; the offset field of the second reply data packet is the downloaded offset down _ offset, and the bluetooth device determines whether the total size (total _ len) of the new firmware is consistent with the downloaded offset (down _ offset);
if the firmware is completely transmitted, the original downloaded firmware of the Bluetooth equipment end is indicated, and only an upgrading command needs to be sent to the mobile phone APP, at this time, the Bluetooth equipment end enters a state that the OTA firmware is completely downloaded to wait for the upgrading command, and then the Bluetooth equipment end jumps to S30;
if not, the original downloaded firmware of the bluetooth device end is not transmitted, at this time, the bluetooth device end enters a breakpoint continuous transmission state, and then the process jumps to S22.
Optionally, the second reply packet also includes a size (chunk) of each OTA firmware packet transmitted, a second expected firmware offset (expect _ offset 2); wherein the first desired firmware offset amount (expect _ offset 1) is the same as the second desired firmware offset amount (expect _ offset 2).
S20, downloading the OTA firmware, wherein the step of downloading the OTA firmware comprises the following substeps 21-S24:
s21, the Bluetooth equipment terminal waits for receiving a first chunk data packet of the OTA firmware to update the OTA firmware data;
in this embodiment, if the newly downloaded firmware of the bluetooth device end is different from the originally downloaded firmware, the mobile APP resends the chunk data packet (block data packet) of the OTA firmware, and the bluetooth device end downloads the chunk data packet to enter a state of downloading the new firmware;
optionally, the chunk data packet further includes: the identity of the last chunk packet (isend), the size of the current binary stream data of the OTA firmware (binaryze), the third expected firmware offset (expect _ offset 3) (i.e., the offset of the current chunk packet), and the binary information of the OTA firmware (binary).
Specifically, the bluetooth device side waits to receive the first chunk packet of the OTA firmware (i.e., the packet with offset = 0); if the offset in the chunk data packet received by the bluetooth device end is not equal to 0 in the state that the bluetooth device end downloads the new firmware, jumping to S40; if the received first chunk data packet offset is equal to 0, the Bluetooth device side initializes the locally stored breakpoint to continuously transmit firmware data, stores binary information binary in the first chunk data packet into an OTA firmware storage region, and calculates the cumulative check value (cur _ crc) of the current chunk data packet so as to store and update the OTA firmware data;
s22, the Bluetooth device end sequentially receives the remaining chunk data packets (namely all the chunk data packets except the first chunk data packet) of the OTA firmware to detect whether each of the remaining chunk data packets is valid;
if not, namely when at least one abnormal data is detected in the residual chunk data packets, jumping to S40;
if yes, namely, each chunk data packet in the remaining chunk data packets is detected to be normal, the bluetooth device side firstly saves the binary information binary of the chunk data packet to a storage area of new OTA firmware, and locally saves a third expected firmware offset (expect _ offset 3) (namely, an expected firmware offset of the current chunk data packet) and an accumulation calculation check value (cur _ crc) for use in breakpoint transmission; after the bluetooth device is powered off and restarted, taking the third expected firmware offset (expect _ offset 3) as the downloaded offset (down _ offset) in step S12; similarly, the cumulative-computed check value (cur _ crc) is used as the check value (down _ crc 16) of the downloaded firmware in step S12.
Wherein the detecting whether each of the remaining chunk data packets is valid is realized by checking the integrity of the entire chunk data packet:
specifically, after all OTA firmware is downloaded, the integrity of the entire chunk data packet is checked, and since the new firmware check value new _ crc16 in the update request packet sent by the mobile phone APP in step S11 is the check value crc16 of the entire new firmware, and the check value is calculated after traversing the entire new firmware in sequence with chunk as a step, the bluetooth device side performs cumulative calculation after receiving each chunk data packet to obtain a cumulative calculated check value (cur _ crc), until receiving the last chunk data packet, obtains a final check value end _ crc16, compares the final check value end _ crc16 with the new firmware check value new _ crc16 in step S11, and when the two values are completely the same, it is determined that the entire chunk data packet is complete, and further determines that each chunk data packet in the remaining chunk data packets is valid.
The value of the third desired firmware offset (expect _ offset 3) in this implementation varies depending on the size chunksize of the received chunk packet; for example, when the current chunk =512 is received by the bluetooth device, after receiving the first chunk data packet, the expect _ offset3=512, and if the second chunk data packet is received, the expect _ offset3=1024, and so on.
It should be noted that, because most of the local storage behaviors of the bluetooth device end are directly operating the flash, and the life of the flash is limited, if data is written frequently, data read-write abnormality can be caused quickly; therefore, preferably, before saving the third expected firmware offset (expect _ offset 3) and the cumulative calculated check value (cur _ crc), a saving strategy can be further formulated to prolong the service life of the flash; the storage policy in this embodiment is: after receiving the chunk packet N times (for example, 20 times) or after receiving the chunk packet M bytes (for example, 20 KB), the bluetooth device side is configured to store the third expected firmware offset (expect _ offset 3) and the accumulated checksum value (cur _ crc).
Then, the Bluetooth device end judges whether the data packet is the last data packet according to the identifier (isend) of the chunk data packet;
specifically, the bluetooth device detects the identifier (isend) of the chunk data packet, and if the identifier (isend) of the data packet is equal to 1, it indicates that the chunk data packet is the last data packet of the OTA firmware, and then jumps to S23; if the identifier (isend) of the packet is equal to 0, indicating that the chunk packet is not the last packet data, S22 is executed in a loop until the identifier (isend) of the chunk packet is equal to 1.
S23, the Bluetooth device end judges whether the OTA firmware is complete according to the accumulated calculation check value and the new firmware check value, and if the OTA firmware is effective and complete, the OTA component is downloaded; if the OTA firmware is incomplete and/or invalid, the process jumps to S40.
Specifically, the bluetooth device compares the accumulated calculation check value (cur _ crc) with the new firmware check value (new _ crc 16) received in S11, so as to check whether the downloaded OTA firmware is valid and complete; that is, the final verification value end _ crc16 is compared with the new firmware verification value new _ crc16 in step S11, and if the two values are identical, it indicates that the downloaded OTA firmware is complete in the transmission process.
Further, in another embodiment, when the OTA firmware is complete, whether the OTA firmware can normally operate on the current bluetooth device may be determined according to a preset checking manner; it can be understood that the preset checking mode can be a user-defined format or a checking mode provided by a manufacturer of the bluetooth device.
And S30, the Bluetooth equipment end receives an upgrading command sent by the mobile phone APP and upgrades the Bluetooth equipment end based on the downloaded OTA firmware.
Specifically, the bluetooth device end receives an upgrade command sent by a mobile phone APP and upgrades the bluetooth device end based on downloaded OTA firmware includes the following sub-steps:
s31, the Bluetooth equipment terminal executes an OTA upgrading interface;
s32, initializing the OTA firmware state;
s32, clearing the local breakpoint continuous transmission information;
and S32, restarting the Bluetooth equipment terminal to finish OTA upgrading of the Bluetooth equipment terminal.
Optionally, in another embodiment, the data content detected and received by the bluetooth device end is inconsistent with the expected data content, and enters an abnormal state or the bluetooth connection is disconnected, in this state, the OTA firmware upgrading method of this embodiment further includes S40, where the bluetooth device end initializes the state data of the OTA firmware according to the received abnormal data of the OTA firmware and feeds back information of the abnormal data to the mobile phone APP; the inconsistency between the content of the data detected and received by the bluetooth device end and the expectation refers to that a format of a protocol of the data detected and received by the bluetooth device end is abnormal in a transmission process, for example, the transmitted data is not encapsulated according to a format of a protocol document, so that a data analysis error of the bluetooth device end is caused or a current state machine of the bluetooth device is abnormal.
The state data of the OTA firmware includes, for example: data such as state data of an OTA state machine, global variables stored by equipment and the like; the information of the abnormal data is, for example, an error code (error) corresponding to the abnormal data.
The beneficial effect of this embodiment is:
the Bluetooth device side of the embodiment judges whether the version number and the check value in the OTA request upgrading data packet and the breakpoint resume firmware data are corresponding and consistent or not, and combines a breakpoint resume system mechanism, thereby solving the technical problem that the OTA firmware needs to be downloaded again when the OTA firmware is too long in time of transmitting the OTA firmware between the Bluetooth device side and the terminal and abnormality occurs in the midway of transmitting the OTA firmware due to too large OTA firmware, and realizing the breakpoint resume function;
in addition, in the embodiment, the check value is calculated according to the accumulation by comparison with the new firmware check value, so that the problem that the integrity of the transmitted OTA firmware cannot be ensured in the transmission process of the OTA firmware is solved.
Based on the same inventive concept, as shown in fig. 3, the embodiment of the present application further provides an OTA firmware upgrade system based on a bluetooth device end, where the OTA firmware upgrade system includes a bluetooth device end and a terminal;
the Bluetooth equipment end receives an OTA request upgrading data packet sent by the terminal; the Bluetooth equipment side reads locally stored breakpoint continuous transmission firmware data; the Bluetooth equipment terminal judges whether the version number and the check value in the OTA request upgrading data packet and the breakpoint continuous transmission firmware data are correspondingly consistent; if not, the Bluetooth equipment terminal downloads the OTA firmware;
the Bluetooth device end waits for receiving a first chunk data packet of the OTA firmware to update the OTA firmware data; the Bluetooth equipment end sequentially receives the residual chunk data packets of the OTA firmware, and judges whether the received chunk data packets are the last data packets or not according to the identification of the residual chunk data packets; the Bluetooth equipment terminal judges whether the OTA firmware is complete and can normally run, and if so, the OTA firmware is downloaded;
and the Bluetooth equipment terminal receives an upgrading command sent by the terminal and upgrades the Bluetooth equipment terminal based on the downloaded OTA firmware.
The system provided by this embodiment may execute the method provided by any of the OTA firmware upgrade methods, and the detailed process is described in the method embodiment and is not described herein again.
An embodiment of the present application also provides a computing device, which, with reference to fig. 4, comprises a memory 620, a processor 610 and a computer program stored in said memory 620 and executable by said processor 610, the computer program being stored in a space 630 for program code in the memory 620, the computer program realizing the method step 631 according to the invention when executed by the processor 610.
The embodiment of the application also provides a computer readable storage medium. Referring to fig. 5, the computer readable storage medium comprises a storage unit for program code provided with a program 631' for performing the method steps according to the invention, which program is executed by a processor.
Embodiments of the present application further provide a computer program product containing instructions. Which, when run on a computer, causes the computer to carry out the steps of the method according to the invention.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware, or any combination thereof. When implemented in software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed by a computer, cause the computer to perform, in whole or in part, the procedures or functions described in accordance with the embodiments of the application. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the components and steps of the various examples have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be understood by those skilled in the art that all or part of the steps in the method according to the above embodiments may be implemented by a program instructing a processor, and the program may be stored in a computer-readable storage medium, where the storage medium is a non-transitory (non-transitory) medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid state disk, a magnetic tape (magnetic tape), a floppy disk (floppy disk), an optical disk (optical disk), and any combination thereof.
The above description is only for the preferred embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present application should be covered within the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (7)

1. An OTA firmware upgrading method based on a Bluetooth device end comprises the following steps:
s10, starting an OTA upgrading step, wherein the OTA upgrading starting step comprises the following substeps S11-S13;
s11, the Bluetooth equipment end receives an OTA request upgrading data packet sent by the terminal;
s12, the Bluetooth equipment side reads locally stored breakpoint continuous transmission firmware data;
s13, the Bluetooth equipment terminal judges whether the version number and the check value in the OTA request upgrading data packet and the breakpoint continuous transmission firmware data are correspondingly consistent;
s20, downloading OTA firmware, wherein the step of downloading the OTA firmware comprises the following substeps S21-S23;
s21, the Bluetooth equipment terminal waits for receiving a first chunk data packet of the OTA firmware to update the OTA firmware data;
s22, the Bluetooth device end sequentially receives the residual chunk data packets of the OTA firmware and judges whether the received chunk data packets are the last data packets according to the marks of the residual chunk data packets;
s23, the Bluetooth device side judges whether the OTA firmware is complete and can normally run, and if so, downloads the OTA firmware;
s30, the Bluetooth equipment end receives an upgrading command sent by the terminal and upgrades the Bluetooth equipment end based on the downloaded OTA firmware;
the upgrade request data packet comprises a new firmware version number, a new firmware total size and a new firmware check value;
the breakpoint continuous transmission firmware data comprises a version number of downloaded firmware, a check value of the downloaded firmware and a downloaded offset;
the step S13 further includes the following substeps:
the Bluetooth equipment terminal judges whether the version number of the new firmware is consistent with the version number of the downloaded firmware and whether the check value of the new firmware is consistent with the check value of the downloaded firmware:
if yes, jumping to S14;
if not, the Bluetooth equipment end restarts downloading the OTA firmware; specifically, the bluetooth device end constructs a first recovery data packet, where the first recovery data packet includes the size of the OTA firmware packet transmitted each time and a first expected firmware offset; the offset field of the first reply packet is 0;
s14: the Bluetooth equipment end constructs a second reply data packet; the Bluetooth equipment end judges whether the total size of the new firmware is consistent with the downloaded offset or not;
if not, the Bluetooth equipment end enters a breakpoint continuous transmission state and then jumps to S22;
if yes, the Bluetooth device enters a state that OTA firmware is downloaded and an upgrading command is waited, and then the process goes to S30.
2. The OTA firmware upgrade method of claim 1, further comprising the steps of:
and S40, the Bluetooth equipment terminal initializes the state data of the OTA firmware according to the received abnormal data of the OTA firmware and feeds back the information of the abnormal data of the OTA firmware to the terminal.
3. The OTA firmware upgrade method of claim 2, wherein:
the step of the bluetooth device terminal waiting for receiving the first chunk data packet of the OTA firmware to update the OTA firmware data specifically includes:
if the offset in the chunk data packet received by the Bluetooth equipment end is not equal to 0 in the state that the Bluetooth equipment end downloads the new firmware, jumping to S40;
if the offset of the received first chunk data packet is equal to 0, the Bluetooth equipment side initializes the breakpoint to continuously transmit the firmware data, stores binary information in the first chunk data packet, and calculates the cumulative check value of the current chunk data packet.
4. The OTA firmware upgrade method of claim 3, wherein:
the specifically determining whether the received chunk data packet is the last data packet according to the identifier of the remaining chunk data packet includes:
the Bluetooth device end detects the identifier of the chunk data packet, if the identifier of the data packet is equal to 1, the chunk data packet is the last data packet of the OTA firmware, and then the step is switched to S23;
if the flag is equal to 0, it indicates that this chunk packet is not the last packet data, and the process loops to step S22 until the flag of the chunk packet is equal to 1.
5. The OTA firmware upgrade method according to claim 1, wherein before determining whether the received chunk data packet is the last data packet according to the identifier of the remaining chunk data packet, the method further comprises an effective detection step, specifically:
the Bluetooth device end sequentially receives the residual chunk data packets of the OTA firmware to determine whether each of the residual chunk data packets is complete;
if not, namely the Bluetooth equipment end detects that at least one abnormal data exists in the residual chunk data packets, skipping to S40;
if yes, that is, each chunk data packet in the remaining chunk data packets is detected to be normal, the bluetooth device end stores the binary information of the chunk data packet, the offset of the current chunk data packet and the accumulated calculation check value.
6. The OTA firmware upgrade method of claim 5, wherein the method for determining whether each of the remaining chunk packets is complete is:
and the Bluetooth equipment end accumulates each received chunk data packet to obtain an accumulated calculation check value until the last chunk data packet is received to obtain a final check value, and if the final check value is completely the same as the new firmware check value, each chunk data packet in the remaining chunk data packets is determined to be complete.
7. A bluetooth device-side based OTA firmware upgrade system which performs firmware upgrade using the OTA firmware upgrade method according to any one of claims 1 to 6, and comprises a bluetooth device side and a terminal;
the Bluetooth equipment end receives an OTA request upgrading data packet sent by the terminal; the Bluetooth device side reads locally stored breakpoint continuous transmission firmware data; the Bluetooth equipment terminal judges whether the version number and the check value in the OTA request upgrading data packet and the breakpoint continuous transmission firmware data are correspondingly consistent; if not, the Bluetooth equipment terminal downloads the OTA firmware;
the Bluetooth device end waits for receiving a first chunk data packet of the OTA firmware to update the OTA firmware data; the Bluetooth device end sequentially receives the residual chunk data packets of the OTA firmware, and judges whether the received chunk data packets are the last data packets according to the identification of the residual chunk data packets; the Bluetooth equipment terminal judges whether the OTA firmware is complete and can normally run, and if so, the OTA firmware is downloaded;
and the Bluetooth equipment terminal receives an upgrading command sent by the terminal and upgrades the Bluetooth equipment terminal based on the downloaded OTA firmware.
CN201910866642.2A 2019-09-12 2019-09-12 OTA firmware upgrading method and system based on Bluetooth device side Active CN110621011B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910866642.2A CN110621011B (en) 2019-09-12 2019-09-12 OTA firmware upgrading method and system based on Bluetooth device side

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910866642.2A CN110621011B (en) 2019-09-12 2019-09-12 OTA firmware upgrading method and system based on Bluetooth device side

Publications (2)

Publication Number Publication Date
CN110621011A CN110621011A (en) 2019-12-27
CN110621011B true CN110621011B (en) 2022-11-04

Family

ID=68923287

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910866642.2A Active CN110621011B (en) 2019-09-12 2019-09-12 OTA firmware upgrading method and system based on Bluetooth device side

Country Status (1)

Country Link
CN (1) CN110621011B (en)

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111314895A (en) * 2020-01-17 2020-06-19 杭州涂鸦信息技术有限公司 Bluetooth-based wireless upgrading method and device, server and electronic equipment
CN111478751B (en) * 2020-03-30 2023-03-24 百富计算机技术(深圳)有限公司 Data breakpoint continuous transmission method and device and terminal equipment
CN111459536A (en) * 2020-03-31 2020-07-28 Tcl移动通信科技(宁波)有限公司 Mobile terminal Bluetooth firmware updating method and device, terminal equipment and storage medium
CN111800767B (en) * 2020-06-15 2024-04-05 易兆微电子(杭州)股份有限公司 System and method for realizing OTA upgrading of terminal product based on BNEP Bluetooth
CN111954207B (en) * 2020-07-17 2023-05-05 易兆微电子(杭州)股份有限公司 BNEP Bluetooth-based OTA upgrading system and upgrading method thereof
CN112087515B (en) * 2020-09-10 2022-05-27 苏州德姆斯信息技术有限公司 Aerial upgrading system and aerial upgrading method for terminal firmware
CN112230951B (en) * 2020-09-24 2024-05-10 易兆微电子(杭州)股份有限公司 System and method for realizing mouse OTA upgrading based on BNEP Bluetooth
CN112188480B (en) * 2020-09-29 2023-03-10 北京百瑞互联技术有限公司 Method, device and storage medium for OTA (over the air) upgrade of Bluetooth equipment by utilizing LC3 audio codec
CN112383908A (en) * 2020-11-24 2021-02-19 无锡寰芯微电子科技有限公司 Bluetooth device upgrading method and system
CN113099439A (en) * 2021-03-29 2021-07-09 上海闻泰信息技术有限公司 OTA upgrade pressure test method, device, computer equipment and storage medium
CN113239361A (en) * 2021-05-06 2021-08-10 国家计算机网络与信息安全管理中心 Firmware safety detection method, device, equipment and storage medium
CN113590151A (en) * 2021-07-01 2021-11-02 福建野小兽健康科技有限公司 Method and system for OTA (over the air) upgrade of Bluetooth equipment
CN115021873A (en) * 2022-06-13 2022-09-06 浙江大华技术股份有限公司 Data retransmission method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104809250A (en) * 2015-05-19 2015-07-29 福建新大陆电脑股份有限公司 Loose type data consistency checking method
CN108038356A (en) * 2017-12-08 2018-05-15 北京联盛德微电子有限责任公司 A kind of guard method of ROM and two level BOOT to user software
CN109542485A (en) * 2018-11-20 2019-03-29 北京千丁互联科技有限公司 A kind of firmware upgrade method and its device based on bluetooth BLE equipment end
CN109951842A (en) * 2019-03-19 2019-06-28 厦门市思芯微科技有限公司 A kind of bluetooth firmware method during upgrading for retaining BLE title and MAC Address
CN110096294A (en) * 2019-05-07 2019-08-06 柏科智能(厦门)科技有限公司 It is a kind of can break-point radio upgrade MCU application program method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105993147B (en) * 2014-07-23 2019-03-05 华为技术有限公司 A kind of terminal staging method and relevant device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104809250A (en) * 2015-05-19 2015-07-29 福建新大陆电脑股份有限公司 Loose type data consistency checking method
CN108038356A (en) * 2017-12-08 2018-05-15 北京联盛德微电子有限责任公司 A kind of guard method of ROM and two level BOOT to user software
CN109542485A (en) * 2018-11-20 2019-03-29 北京千丁互联科技有限公司 A kind of firmware upgrade method and its device based on bluetooth BLE equipment end
CN109951842A (en) * 2019-03-19 2019-06-28 厦门市思芯微科技有限公司 A kind of bluetooth firmware method during upgrading for retaining BLE title and MAC Address
CN110096294A (en) * 2019-05-07 2019-08-06 柏科智能(厦门)科技有限公司 It is a kind of can break-point radio upgrade MCU application program method

Also Published As

Publication number Publication date
CN110621011A (en) 2019-12-27

Similar Documents

Publication Publication Date Title
CN110621011B (en) OTA firmware upgrading method and system based on Bluetooth device side
CN110096294B (en) Method for wirelessly upgrading MCU application program at any breakpoint
CN106325929B (en) Firmware upgrading method, firmware upgrading device, refrigerator and server
EP2456257B1 (en) Method and system for upgrading wireless data card
CN106201586B (en) System upgrading method, terminal and system based on OTA
KR101541112B1 (en) FOTA system and the method
US9471300B2 (en) Wireless firmware upgrades to an alarm security panel
CN110730104A (en) Method for upgrading multi-device batch firmware of mesh network device
CN110659046A (en) Firmware upgrading method, terminal, charging box, earphone and storage medium
CN105530130A (en) Method and device for upgrading Over-The-Air downloading technology
CN110543321A (en) OTA (over the air) upgrading method, device, terminal and computer readable storage medium
CN102646043A (en) Method and device for upgrading mobile terminal software and mobile terminal
JPWO2009078285A1 (en) Wireless terminal, non-volatile memory of wireless terminal, and fail-safe storage method of diagnostic information
CN111273924B (en) Software updating method and device
CN114840242A (en) System upgrading method and device of electronic equipment and readable storage medium
CN112416411A (en) Upgrading method and device, equipment terminal, server and computer readable medium
CN113094064A (en) Gateway software module upgrading method, device, equipment and storage medium
CN104580360A (en) System and method for updating firmware through heterogeneous network
CN104333856A (en) Method for switching network of Java SIM card, SIM card, server and system
CN106912037A (en) A kind of OTA upgrade methods and device
CN113064611B (en) Method for realizing data analysis software upgrading aiming at wireless equipment and updating method thereof
KR101559058B1 (en) Method for upgrading software of mobile terminal and mobile terminal device using the same
CN111246447A (en) eUICC signed data management method, eUICC signed data management module, eUICC signed data management terminal and eUICC signed data management storage medium
KR101206639B1 (en) Server and Method for updating firmware in Mobile communication terminal
CN115167907A (en) Terminal equipment upgrading method, server, electronic equipment and storage medium

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