OTA upgrade method, device and Bluetooth device
By implanting the L2CAP protocol in the Bootloader program, the Bluetooth device directly parses data at the L2CAP layer and covers the original firmware storage area, solving the problem of waste of MCU resources in OTA upgrades, and achieving the effect of saving storage space and reducing costs.
Patent Information
- Application Number
- CN202510332796.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-03-20
AI Technical Summary
The OTA upgrade function of existing Bluetooth consumer electronic products requires the reservation of backup space, resulting in wasted MCU resources, and the original firmware cannot be directly covered during the OTA upgrade process, which increases product costs.
The L2CAP protocol is implanted in the Bootloader program. The Bluetooth device transmits wireless data with the host computer through the L2CAP protocol, directly analyzes data at the L2CAP layer, acquires new firmware and covers the original firmware storage area, avoiding transmission through the original firmware.
Save MCU resources, reduce storage space usage, reduce product costs, and no need to reserve backup areas, improving the efficiency of OTA upgrades.
Smart Images

Figure CN119847572B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to Bluetooth technology, and in particular to an OTA upgrade method, apparatus, and Bluetooth device. Background Art
[0002] In the consumer electronics sector, especially in small consumer electronics, MCU resources directly determine product price. However, to meet the ever-changing market environment, current products cannot make too many functional cuts, so a good balance must be struck between functional diversity and cost. OTA upgrade function is an indispensable feature of current Bluetooth consumer electronics products.
[0003] OTA (Over-The-Air) technology is abbreviated as "OTA" (Over-The-Air) technology. The firmware running on a device is downloaded from the cloud to the device using the Bluetooth SPP protocol, replacing the existing firmware. This process requires pre-allocated free Flash memory to store the new firmware obtained from the cloud. Once the new firmware is downloaded, it is transferred to the device using the Bootloader, effectively updating the existing device software. This feature allows for the upgrade of product features and the resolution of critical product issues, making the product more competitive. The core of this solution is the Bluetooth Serial Port Profile (SPP), which is based on the Bluetooth underlying layer, the RFCOMM (Radio Frequency Communication) protocol. It is an upper-layer service within Bluetooth technology and relies on the complete Bluetooth protocol. Therefore, this solution requires that the existing firmware contain a complete set of Bluetooth protocols. However, the bootloader is relatively small and cannot fully accommodate and run this complete set of Bluetooth protocols, resulting in wireless transmission limited to the existing firmware. Therefore, the original firmware cannot be directly skipped during the upgrade process, and a new area can only be opened up in the MCU to store the new firmware.
[0004] While the OTA upgrade function itself brings portability, it also requires additional MCU resources, leading to increased product costs. However, the backup space reserved during the OTA upgrade process is useless in non-OTA environments, resulting in a waste of resources in non-OTA environments. Summary of the Invention
[0005] The present application provides an OTA upgrade method, apparatus, and Bluetooth device.
[0006] According to a first aspect of the present application, the present application provides an OTA upgrade method, comprising:
[0007] After the Bluetooth device obtains information that the host computer has new firmware available for upgrade, it disconnects the current connection;
[0008] The Bluetooth device is started from the Bootloader program, and the L2CAP protocol is implanted in the Bootloader program. The Bluetooth device waits for the host computer to connect. After the connection is successful, the Bluetooth device performs the protocol interaction before the upgrade through the L2CAP protocol, performs wireless data transmission with the host computer based on the L2CAP protocol, and can directly parse the data at the L2CAP layer without going through the upper layer service, obtain the new firmware, and delete the original firmware stored in the MCU at the same time, and store the new firmware in the storage area of the original firmware;
[0009] The Bluetooth device boots from the new firmware, completing the upgrade process.
[0010] In the method involved in this application, the Bluetooth device is started from the Bootloader program, the L2CAP protocol is implanted in the Bootloader program, the Bluetooth device waits for the host computer to connect, and after the connection is successful, the protocol interaction before the upgrade is performed through the L2CAP protocol, wireless data transmission is performed with the host computer based on the L2CAP protocol, the new firmware is obtained, the original firmware stored in the MCU is deleted, and the new firmware is stored in the storage area of the original firmware, including:
[0011] A transmission flag is provided in the Bootloader program, and the Bootloader program is controlled to start from the transmission flag;
[0012] The Bluetooth device enters a connectable state, and after successfully connecting to the host computer, enters data download to obtain the new firmware;
[0013] The Bootloader program deletes the original firmware stored in the MCU and stores the new firmware in the storage area of the original firmware.
[0014] In the method involved in this application, the Bluetooth device is started from the Bootloader program, the L2CAP protocol is implanted in the Bootloader program, the Bluetooth device waits for the host computer to connect, and after the connection is successful, the protocol interaction before the upgrade is performed through the L2CAP protocol, wireless data transmission is performed with the host computer based on the L2CAP protocol, the new firmware is obtained, the original firmware stored in the MCU is deleted, and the new firmware is stored in the storage area of the original firmware, and further includes:
[0015] The Bluetooth device sends an instruction to negotiate with the host computer according to a private protocol to obtain verification information of the new firmware, wherein the verification information includes a verification code and firmware length;
[0016] After the new firmware is downloaded, the Bootloader program performs an integrity check on the new firmware according to the verification information.
[0017] In the method involved in this application, the Bluetooth device is started from the Bootloader program, the L2CAP protocol is implanted in the Bootloader program, the Bluetooth device waits for the host computer to connect, and after the connection is successful, the protocol interaction before the upgrade is performed through the L2CAP protocol, wireless data transmission is performed with the host computer based on the L2CAP protocol, the new firmware is obtained, the original firmware stored in the MCU is deleted, and the new firmware is stored in the storage area of the original firmware, and further includes:
[0018] After the Bootloader program performs integrity check on the new firmware, if it is found that the new firmware has an abnormality, the Bluetooth device re-downloads the new firmware.
[0019] In the method involved in this application, after the Bluetooth device obtains information that the host computer has new firmware available for upgrade, it disconnects the current connection, including:
[0020] After the Bluetooth device is started from the original firmware, it is connected to the host computer;
[0021] After the Bluetooth device obtains information that the host computer has new firmware available for upgrade, it negotiates with the host computer to start OTA upgrade;
[0022] The Bluetooth device notifies the host computer to disconnect and reconnect the Bluetooth device at a predetermined time.
[0023] According to a second aspect of the present application, the present application provides an OTA upgrade device, comprising:
[0024] The communication module is used to obtain information that new firmware is available for upgrade from the host computer and then disconnect the current connection;
[0025] A processing module is configured to start from a bootloader program, embed the L2CAP protocol in the bootloader program, wait for a host computer connection, and upon successful connection, perform pre-upgrade protocol interaction via the L2CAP protocol, perform wireless data transmission with the host computer based on the L2CAP protocol, and directly parse data at the L2CAP layer without going through upper-layer services, obtain the new firmware, delete the original firmware stored in the MCU, and store the new firmware in the storage area of the original firmware;
[0026] The upgrade module is used to start from the new firmware and complete the upgrade process.
[0027] In the device involved in this application, the processing module includes:
[0028] A setting unit, configured to set a transmission flag in the Bootloader program and control the Bootloader program to start from the transmission flag;
[0029] A download unit, configured to enable the Bluetooth device to enter a connectable state, and after successfully connecting to the host computer, to start data downloading and obtain the new firmware;
[0030] The processing unit is used to delete the original firmware stored in the MCU and store the new firmware in the storage area of the original firmware.
[0031] In the device involved in this application, the communication module includes:
[0032] A connection unit, configured to connect to the host computer after starting from the original firmware;
[0033] A negotiation unit, configured to obtain information that a host computer has new firmware available for upgrade and negotiate with the host computer to initiate an OTA upgrade;
[0034] The communication unit is used to notify the host computer to disconnect and reconnect the Bluetooth device at a predetermined time.
[0035] According to a third aspect of the present application, the present application provides an OTA upgrade device, comprising:
[0036] Memory, used to store programs,
[0037] The processor is configured to execute the program stored in the memory to implement the method described above.
[0038] According to a fourth aspect of the present application, the present application provides a Bluetooth device, comprising:
[0039] Memory, used to store programs,
[0040] The processor is configured to execute the program stored in the memory to implement the method described above.
[0041] Due to the adoption of the above technical solution, the beneficial effects of this application are:
[0042] The OTA upgrade method provided by the embodiment of the present application includes: after the Bluetooth device obtains the information that the host computer has new firmware available for upgrade, it disconnects the current connection; the Bluetooth device starts from the Bootloader program, and the L2CAP protocol is implanted in the Bootloader program; the Bluetooth device performs wireless data transmission with the host computer based on the L2CAP protocol, and can directly parse the data at the L2CAP layer without going through the upper-layer service, obtain the new firmware, and delete the original firmware stored in the MCU at the same time, and store the new firmware in the storage area of the original firmware; the Bluetooth device starts from the new firmware to complete the upgrade process. In this application, since the L2CAP protocol is implanted in the Bootloader program, the Bluetooth device performs wireless data transmission with the host computer based on the L2CAP protocol without going through the original firmware, so the original firmware can be directly overwritten without reserving a backup area, thereby saving MCU resources. In addition, since the L2CAP protocol is the underlying program in Bluetooth and does not rely on the complete Bluetooth protocol, the program can be small enough to be stored in the Bootloader program, thereby further reducing the storage space occupied in the MCU. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A flowchart of an OTA upgrade method according to an embodiment of the present application;
[0044] Figure 2 A flowchart of another implementation of the OTA upgrade method provided in an embodiment of the present application;
[0045] Figure 3 A flowchart of another embodiment of the OTA upgrade method provided in the embodiment of the present application;
[0046] Figure 4 A schematic diagram of program modules of an OTA upgrade device according to an embodiment of the present application;
[0047] Figure 5 A schematic diagram of the program modules of another embodiment of the OTA upgrade device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0048] The present invention will be further described in detail below by means of specific embodiments in conjunction with the accompanying drawings. Similar elements in different embodiments are numbered with associated similar elements. In the following embodiments, many detailed descriptions are provided to enable the present application to be better understood. However, those skilled in the art will readily appreciate that some of the features may be omitted in different circumstances, or may be replaced by other elements, materials, or methods. In some cases, some operations related to the present application are not shown or described in the specification. This is to avoid the core portion of the present application being overwhelmed by excessive descriptions, and for those skilled in the art, it is not necessary to describe these related operations in detail. They will fully understand the related operations based on the description in the specification and the general technical knowledge in the art.
[0049] In addition, the features, operations, or characteristics described in the specification may be combined in any appropriate manner to form various embodiments. Furthermore, the steps or actions in the method description may be reordered or adjusted in a manner readily apparent to those skilled in the art. Therefore, the various sequences in the specification and drawings are provided solely for the purpose of clearly describing a particular embodiment and are not intended to be mandatory, unless otherwise specified.
[0050] The serial numbers assigned to the components in this document, such as "first", "second", etc., are only used to distinguish the objects described and do not have any order or technical meaning.
[0051] In addition, the technical features and solutions described herein may be combined in any suitable manner in one or more embodiments. It will be readily apparent to those skilled in the art that the order of steps or operations in the methods described in the embodiments herein may be varied. Therefore, any order in the drawings and embodiments is for illustrative purposes only and does not imply a requirement to follow a specific order unless a specific order is explicitly stated.
[0052] The Bluetooth devices covered in this application include Bluetooth headsets, Bluetooth speakers, Bluetooth glasses, smart watches, smart bracelets, Bluetooth sensors, Bluetooth controllers, and mobile phones and tablets that use Bluetooth connections.
[0053] like Figure 1 As shown, the OTA upgrade method provided in the embodiment of the present application, one implementation thereof, includes the following steps:
[0054] Step 101: After the Bluetooth device obtains information that the host computer has new firmware available for upgrading, it disconnects the current connection.
[0055] The Bluetooth device starts, connects to the host computer, obtains information about the new firmware available for upgrade, and then disconnects the current connection. The Bluetooth device negotiates with the host computer to initiate an OTA upgrade, notifies the host computer to disconnect the current connection, and reconnects to the current Bluetooth device after a predetermined time.
[0056] Step 102: The Bluetooth device starts from the Bootloader program. The L2CAP protocol is implanted in the Bootloader program. The Bluetooth device performs wireless data transmission with the host computer based on the L2CAP protocol and can directly parse the data at the L2CAP layer without going through the upper layer service to obtain the new firmware. At the same time, the original firmware stored in the MCU is deleted and the new firmware is stored in the storage area of the original firmware.
[0057] After booting from the bootloader, the Bluetooth device waits for a connection to the host computer. Once connected, it uses the Logical Link Control and Adaptation Layer Protocol (L2CAP) to perform pre-upgrade protocol interactions. The bootloader program controls wireless data transmission between the Bluetooth device and the host computer, retrieves the host computer's new firmware, deletes the existing firmware, and stores the new firmware in the existing firmware area.
[0058] The L2CAP protocol is the underlying Bluetooth protocol. Data from upper-layer services must be encapsulated in L2CAP packets and then sent by the BTC (Bluetooth Controller). Therefore, this application can parse data directly at the L2CAP layer without going through upper-layer services (SPP\HFP, etc.). This underlying program occupies very little space and can therefore be stored directly in the Bootloader.
[0059] Existing OTA upgrades require downloading new firmware from the cloud via the SPP protocol within Bluetooth technology. The SPP protocol, based on the RFCOMM protocol, is an upper-layer service within Bluetooth technology and relies on the complete Bluetooth protocol. For example, the code for a complete Bluetooth protocol requires 800KB, while the code for the L2CAP protocol, which includes only the underlying Bluetooth services, only requires 80KB, significantly reducing MCU memory usage.
[0060] Current Bluetooth consumer electronics require a backup area for OTA upgrades because wireless transmission must be performed through the original firmware, making it impossible to overwrite the original firmware during the OTA upgrade process. Therefore, reserving a backup area is the only solution. However, in this application, because the L2CAP protocol is embedded in the bootloader program, the Bluetooth device uses the L2CAP protocol for wireless data transmission with the host computer, allowing the original firmware to be directly overwritten without reserving a backup area, thus saving MCU data.
[0061] Step 103: The Bluetooth device boots from the new firmware, completing the upgrade process.
[0062] The OTA upgrade method provided by the embodiment of the present application includes: after the Bluetooth device obtains the information that the host computer has new firmware available for upgrade, it disconnects the current connection; the Bluetooth device starts from the Bootloader program, and the L2CAP protocol is implanted in the Bootloader program; the Bluetooth device performs wireless data transmission with the host computer based on the L2CAP protocol, obtains the new firmware, and deletes the original firmware stored in the MCU at the same time, and stores the new firmware in the storage area of the original firmware; the Bluetooth device starts from the new firmware to complete the upgrade process. In this application, since the L2CAP protocol is implanted in the Bootloader program, the Bluetooth device performs wireless data transmission with the host computer based on the L2CAP protocol without going through the original firmware, so the original firmware can be directly overwritten without reserving a backup area, thereby saving MCU resources. In addition, since the L2CAP protocol is the underlying program in Bluetooth and does not rely on the complete Bluetooth protocol, the program can be small enough to be stored in the Bootloader program, thereby further reducing the storage space occupied in the MCU.
[0063] like Figure 2 As shown, step 101 may specifically include the following steps:
[0064] Step 1011: After the Bluetooth device starts from the original firmware, it connects to the host computer.
[0065] Step 1012: After the Bluetooth device obtains information that the host computer has new firmware available for upgrade, it negotiates with the host computer to start OTA upgrade.
[0066] Step 1013: The Bluetooth device notifies the host computer to disconnect and reconnect the Bluetooth device at a predetermined time. The predetermined time is an empirical value and can be set as needed. In one embodiment, the predetermined time is 5 seconds.
[0067] like Figure 3 As shown, step 102 may include the following steps:
[0068] Step 1021: Setting a transfer flag in the Bootloader program, and controlling the Bootloader program to start from the transfer flag;
[0069] Step 1022: The Bluetooth device enters a connectable state. After successfully connecting to the host computer, it enters data download to obtain the new firmware.
[0070] Step 1023: The Bootloader program deletes the original firmware stored in the MCU and stores the new firmware in the storage area of the original firmware.
[0071] In one embodiment, step 102 may further include the following steps:
[0072] The Bluetooth device sends instructions to negotiate with the host computer according to the private protocol to obtain the verification information of the new firmware, which includes the verification code and firmware length. After the new firmware is downloaded, the Bootloader program performs an integrity check on the new firmware based on the verification information.
[0073] In one embodiment, step 102 may further include the following steps:
[0074] After the Bootloader program performs integrity check on the new firmware, if it is found that the new firmware has an abnormality, the Bluetooth device re-downloads the new firmware.
[0075] Set the transmission flag in the Bootloader program, and the APP can control the headset to start from the transmission flag of the Bootloader. In the embodiment of the present application, the Bootloader can be controlled by the APP to start from the transmission flag. After the Bluetooth device enters the Bootloader program, it first initializes the hardware, then determines whether the system is started from the transmission flag and initializes the Bluetooth protocol, controls the headset to enter a connectable state and wait for the connection of the host computer, and after the connection is successful. According to the private protocol, send instructions to negotiate with the host computer to obtain the verification code, firmware length and other information of the new firmware, and then send an instruction request to enter the data packet download. The single package data will also be verified synchronously during the download process. After the new firmware is downloaded, the Bootloader verifies the new firmware of the entire package to ensure the integrity of the new firmware package.
[0076] like Figure 4 As shown, an embodiment of the present application provides an OTA upgrade device, one implementation of which may include a communication module 410, a processing module 420 and an upgrade module 430.
[0077] The communication module 410 is used to disconnect the current connection after obtaining information that the host computer has new firmware available for upgrading.
[0078] The processing module 420 is used to start from the Bootloader program. The L2CAP protocol is implanted in the Bootloader program. Wireless data transmission is performed with the host computer based on the L2CAP protocol. Data can be parsed directly at the L2CAP layer without going through upper-layer services to obtain new firmware. At the same time, the original firmware stored in the MCU is deleted and the new firmware is stored in the storage area of the original firmware.
[0079] After booting from the bootloader, the Bluetooth device waits for a connection to the host computer. Once connected, it uses the L2CAP protocol to perform pre-upgrade protocol interactions. The bootloader program controls wireless data transmission between the Bluetooth device and the host computer, retrieves the host computer's new firmware, deletes the existing firmware, and stores the new firmware in the existing firmware area.
[0080] The L2CAP protocol is the underlying Bluetooth protocol. Data from upper-layer services must be encapsulated in L2CAP packets and then sent by the BTC (Bluetooth Controller). Therefore, this application can parse data directly at the L2CAP layer without going through upper-layer services (SPP\HFP, etc.). This underlying program occupies very little space and can therefore be stored directly in the Bootloader.
[0081] Existing OTA upgrades require downloading new firmware from the cloud via the SPP protocol within Bluetooth technology. The SPP protocol, based on the RFCOMM protocol, is an upper-layer service within Bluetooth technology and relies on the complete Bluetooth protocol. For example, the code for a complete Bluetooth protocol requires 800KB, while the code for the L2CAP protocol, which includes only the underlying Bluetooth services, only requires 80KB, significantly reducing MCU memory usage.
[0082] Current Bluetooth consumer electronics require a backup area for OTA upgrades because wireless transmission must be performed through the original firmware, making it impossible to overwrite the original firmware during the OTA upgrade process. Therefore, reserving a backup area is the only solution. However, in this application, because the L2CAP protocol is embedded in the bootloader program, the Bluetooth device uses the L2CAP protocol for wireless data transmission with the host computer, allowing the original firmware to be directly overwritten without reserving a backup area, thus saving MCU data.
[0083] The upgrade module 430 is used to start from the new firmware and complete the upgrade process.
[0084] like Figure 5 As shown, in the OTA upgrade device provided in the embodiment of the present application, the processing module 420 may include:
[0085] The setting unit 421 is used to set a transfer flag in the Bootloader program and control the Bootloader program to start from the transfer flag;
[0086] Download unit 422 is used for the Bluetooth device to enter a connectable state, and after successfully connecting to the host computer, enter data download and obtain new firmware;
[0087] The processing unit 423 is configured to delete the original firmware stored in the MCU and store the new firmware in the storage area of the original firmware.
[0088] In one embodiment, the communication module 410 may include:
[0089] The connection unit 411 is used to connect to the host computer after starting from the original firmware;
[0090] The negotiation unit 412 is configured to obtain information that a new firmware is available for upgrading from the host computer and negotiate with the host computer to initiate an OTA upgrade;
[0091] The communication unit 413 is used to notify the host computer to disconnect and reconnect the Bluetooth device at a predetermined time. The predetermined time is an empirical value and can be set as needed. In one embodiment, the predetermined time is 5 seconds.
[0092] After the Bootloader program performs integrity check on the new firmware, if it is found that the new firmware has an abnormality, the Bluetooth device re-downloads the new firmware.
[0093] Set the transmission flag in the Bootloader program, and the APP can control the headset to start from the transmission flag of the Bootloader. In the embodiment of the present application, the Bootloader can be controlled by the APP to start from the transmission flag. After the Bluetooth device enters the Bootloader program, it first initializes the hardware, then determines whether the system is started from the transmission flag and initializes the Bluetooth protocol, controls the headset to enter a connectable state and wait for the connection of the host computer, and after the connection is successful. According to the private protocol, send instructions to negotiate with the host computer to obtain the verification code, firmware length and other information of the new firmware, and then send an instruction request to enter the data packet download. The single package data will also be verified synchronously during the download process. After the new firmware is downloaded, the Bootloader verifies the new firmware of the entire package to ensure the integrity of the new firmware package.
[0094] An embodiment of the present application provides an OTA upgrade device, one implementation of which includes a memory and a processor.
[0095] Memory, used to store programs,
[0096] The processor is configured to execute the program stored in the memory to implement the method described above.
[0097] An embodiment of the present application provides a Bluetooth device, in one implementation manner, including a memory and a processor.
[0098] Memory, used to store programs,
[0099] The processor is configured to execute the program stored in the memory to implement the method described above.
[0100] Those skilled in the art will understand that all or part of the steps of the various methods in the above embodiments can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium, which may include: read-only memory, random access memory, disk or CD, etc.
[0101] The above content is a further detailed description of the present application in conjunction with specific implementation methods, and the specific implementation of the present application cannot be considered to be limited to these descriptions. For ordinary technicians in the technical field to which the present application belongs, several simple deductions or substitutions can be made without departing from the concept of the present application.
Claims
1. An OTA upgrade method, characterized in that ,include: After the Bluetooth device obtains information that the host computer has new firmware available for upgrade, it disconnects the current connection; The Bluetooth device is started from the Bootloader program, and the L2CAP protocol is implanted in the Bootloader program. The Bluetooth device waits for the host computer to connect. After the connection is successful, the Bluetooth device performs the protocol interaction before the upgrade through the L2CAP protocol, performs wireless data transmission with the host computer based on the L2CAP protocol, and directly parses the data at the L2CAP layer without going through the upper layer service, obtains the new firmware, deletes the original firmware stored in the MCU, and stores the new firmware in the storage area of the original firmware; The Bluetooth device boots from the new firmware, completing the upgrade process.
2. The method according to claim 1, wherein The Bluetooth device is started from a Bootloader program, the Bootloader program is implanted with an L2CAP protocol, the Bluetooth device waits for a host computer to connect, and after a successful connection, performs protocol interaction before upgrading through the L2CAP protocol, performs wireless data transmission with the host computer based on the L2CAP protocol, obtains the new firmware, deletes the original firmware stored in the MCU, and stores the new firmware in a storage area of the original firmware, including: A transmission flag is provided in the Bootloader program, and the Bootloader program is controlled to start from the transmission flag; The Bluetooth device enters a connectable state, and after successfully connecting to the host computer, enters data download to obtain the new firmware; The Bootloader program deletes the original firmware stored in the MCU and stores the new firmware in the storage area of the original firmware.
3. The method according to claim 2, wherein The Bluetooth device is started from a Bootloader program, the Bootloader program is implanted with an L2CAP protocol, the Bluetooth device waits for a host computer to connect, and after the connection is successful, performs protocol interaction before the upgrade through the L2CAP protocol, performs wireless data transmission with the host computer based on the L2CAP protocol, obtains the new firmware, and simultaneously deletes the original firmware stored in the MCU, and stores the new firmware in the storage area of the original firmware, further comprising: The Bluetooth device sends an instruction to negotiate with the host computer according to a private protocol to obtain verification information of the new firmware, wherein the verification information includes a verification code and firmware length; After the new firmware is downloaded, the Bootloader program performs an integrity check on the new firmware according to the verification information.
4. The method according to claim 3, wherein The Bluetooth device is started from a Bootloader program, the Bootloader program is implanted with an L2CAP protocol, the Bluetooth device waits for a host computer to connect, and after the connection is successful, performs protocol interaction before the upgrade through the L2CAP protocol, performs wireless data transmission with the host computer based on the L2CAP protocol, obtains the new firmware, and simultaneously deletes the original firmware stored in the MCU, and stores the new firmware in the storage area of the original firmware, further comprising: After the Bootloader program performs integrity check on the new firmware, if it is found that the new firmware has an abnormality, the Bluetooth device re-downloads the new firmware.
5. The method according to claim 1, wherein After the Bluetooth device obtains information that the host computer has new firmware available for upgrading, it disconnects the current connection, including: After the Bluetooth device is started from the original firmware, it is connected to the host computer; After the Bluetooth device obtains information that the host computer has new firmware available for upgrade, it negotiates with the host computer to start OTA upgrade; The Bluetooth device notifies the host computer to disconnect and reconnect the Bluetooth device at a predetermined time.
6. An OTA upgrade device, characterized in that ,include: The communication module is used to obtain information that new firmware is available for upgrade from the host computer and then disconnect the current connection; a processing module, configured to start from a bootloader program, embed the L2CAP protocol in the bootloader program, wait for a host computer connection, and upon successful connection, perform pre-upgrade protocol interaction via the L2CAP protocol, perform wireless data transmission with the host computer based on the L2CAP protocol, parse data directly at the L2CAP layer without going through upper-layer services, obtain the new firmware, delete the original firmware stored in the MCU, and store the new firmware in the storage area of the original firmware; The upgrade module is used to start from the new firmware and complete the upgrade process.
7. The device according to claim 6, characterized in that The processing module includes: A setting unit, configured to set a transmission flag in the Bootloader program and control the Bootloader program to start from the transmission flag; A download unit, configured to enable the Bluetooth device to enter a connectable state, and after successfully connecting to the host computer, to start data downloading and obtain the new firmware; The processing unit is used to delete the original firmware stored in the MCU and store the new firmware in the storage area of the original firmware.
8. The device according to claim 6, wherein The communication module includes: A connection unit, configured to connect to the host computer after starting from the original firmware; A negotiation unit, configured to obtain information that a host computer has new firmware available for upgrade and negotiate with the host computer to initiate an OTA upgrade; The communication unit is used to notify the host computer to disconnect and reconnect the Bluetooth device at a predetermined time.
9. An OTA upgrade device, characterized in that: include: Memory, used to store programs, A processor, configured to execute the program stored in the memory to implement the method according to any one of claims 1 to 5.
10. A Bluetooth device, characterized in that: include: Memory, used to store programs, A processor, configured to execute the program stored in the memory to implement the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Realization method and system of Bluetooth function under Android recovery mode
CN104572078A