Method, system and device for transmitting software package to be upgraded of vehicle key
Patent Information
- Application Number
- CN202611122083.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-10-27
AI Technical Summary
[0004]为了克服现有技术中的缺陷,本发明实施例提供了一种车辆钥匙的待升级软件包的传输方法、升级方法及系统,能够解决传统钥匙升级时的效率低、易丢包、升级失败率高、依赖私有协议、升级过程易变砖的技术问题
[0051]本申请中的目标传输通道为基于L2CAP协议建立的COC面向连接通道,钥匙与主设备建立无线通信连接后,根据最大传输单元、最大分段长度及初始信用流控值与钥匙建立目标传输通道,主设备通过所述目标传输通道向钥匙传输待升级软件包,能够大幅提升单帧传输数据长度,减少传输过程中的分包数量,缩短升级耗时,同时,通过COC通道原生信用流控机制,能够避免钥匙端缓冲区溢出引发的丢包乱序问题,有效提升传输效率与稳定性。
Smart Images

Figure CN122994749A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle technology, and specifically to a method, method, and system for transmitting and upgrading a vehicle key's upgrade software package. Background Technology
[0002] Currently, firmware upgrades for car Bluetooth physical keys primarily use the GATT (General Attribute Protocol) data transmission method. Specifically, after the master device establishes a BLE connection with the Bluetooth key, it discovers the OTA upgrade service and corresponding data transmission characteristic values on the key end through the ATT protocol. Then, it sends the firmware data to the key end through the GATT channel. After receiving the data, the key end stores it in a designated location and restarts to complete the upgrade.
[0003] This approach has the following drawbacks: First, GATT single-frame data length is short, only about 20 bytes by default. Transmitting firmware of 200KB or more requires thousands to tens of thousands of packet splits, resulting in extremely low transmission efficiency and long processing time. Second, GATT lacks a native flow control mechanism. High-speed packet sending by the master device can easily lead to buffer overflow at the key end, causing packet loss and out-of-order issues. Third, it lacks the ability for automatic fragmentation and reassembly of the protocol stack. The application layer needs to write its own firmware unpacking and reassembly code, which can easily introduce software defects, resulting in a large development workload and poor stability. Furthermore, it relies on proprietary transmission protocols, resulting in low standardization, difficulty in cross-chip platform porting, and high maintenance costs. Summary of the Invention
[0004] To overcome the shortcomings of the prior art, embodiments of the present invention provide a method for transmitting, upgrading, and system for upgrading software packages of vehicle keys, which can solve the technical problems of low efficiency, easy packet loss, high upgrade failure rate, reliance on proprietary protocols, and easy bricking during the upgrade process in traditional key upgrades.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0006] The first aspect of this invention discloses a method for transmitting an upgrade software package for a vehicle key, comprising the following steps:
[0007] The main device establishes a wireless communication connection with the key, and obtains feature value data for the key's software package upgrade based on the wireless communication connection;
[0008] The upgrade parameters of the software package to be upgraded are obtained, and the channel parameters of the target transmission channel are obtained based on the upgrade parameters. The target transmission channel is used to transmit the software package to be upgraded. The channel parameters include the maximum transmission unit, the maximum segment length, and the initial credit flow control value.
[0009] Based on the feature value data, a connection request for the target transmission channel is sent to the key, and the target transmission channel is established with the key based on the channel parameters;
[0010] The software package to be upgraded is sent to the key based on the target transmission channel.
[0011] The target transmission channel is a connection-oriented COC channel established based on the L2CAP protocol. The COC channel supports large frame transmission. The master device transmits the software package to be upgraded to the key through the target transmission channel, which can significantly increase the data length of a single frame, reduce the number of packets in the transmission process, and shorten the upgrade time. At the same time, through the native credit flow control mechanism of the L2CAP COC channel, it can avoid packet loss and out-of-order problems caused by buffer overflow at the key end, effectively improving transmission efficiency and stability. The effect is particularly obvious when transmitting software packages of 200KB or more.
[0012] Optionally, sending the upgrade package to the key based on the target transmission channel further includes:
[0013] The upgrade package is encrypted, and the encrypted upgrade package is divided into multiple firmware blocks according to a preset length.
[0014] Each firmware block is encapsulated according to preset identification information, which includes the firmware block number and checksum.
[0015] Based on the target transmission channel, the encapsulated firmware blocks are sent to the key.
[0016] Optionally, sending the encapsulated multiple firmware blocks to the key based on the target transmission channel further includes:
[0017] Based on the maximum segment length, each encapsulated firmware block is divided into multiple data segments;
[0018] Multiple data segments are sent based on the initial credit flow control value.
[0019] By leveraging the native credit flow control of the target transmission channel, the transmitted software packages to be upgraded can be fragmented and reassembled using the protocol stack's native fragmentation and reassembly functions. This eliminates the need for additional packet splitting and reassembly logic to be developed at the application layer, reducing development complexity and minimizing software defects.
[0020] Optional, also includes:
[0021] Obtain the transmission status of the firmware block, including transmission completion and transmission interruption;
[0022] If the transmission of the firmware block is interrupted, the target transmission channel is re-established;
[0023] Obtain the first number, which is the number of the firmware block that has been sent;
[0024] The second number is obtained based on the first number, and the second number is the number of the unsent firmware block;
[0025] A firmware block with the second number is sent to the key based on the re-established target transmission channel.
[0026] By setting up a breakpoint resume mechanism, the transmission failure caused by signal fluctuations and link interruptions during the transmission of vehicle key software upgrade packages can be effectively solved, improving the stability and reliability of software package transmission and adapting to key upgrade scenarios in complex electromagnetic environments.
[0027] Optionally, the maximum transmission unit is 247 bytes to 512 bytes, the maximum segment length is 248 bytes, and the initial credit flow control value is 10 to 30.
[0028] A second aspect of this invention discloses a method for upgrading a vehicle key, comprising the following steps:
[0029] The key establishes a wireless communication connection with the master device, and configures feature value data for key software upgrades based on the wireless communication connection.
[0030] Obtain the channel parameters sent by the master device, the channel parameters including the maximum transmission unit, the maximum segment length, and the initial credit flow control value;
[0031] In response to the connection request from the master device, a target transmission channel is established with the master device based on the channel parameters;
[0032] The system receives the upgrade software package through the target transmission channel and verifies the received upgrade software package. If the verification passes, the upgrade software package is started.
[0033] After the key establishes a wireless communication connection with the master device, it uses feature value data to enable the master device to obtain the entry information required to establish the target transmission channel. Based on the obtained maximum transmission unit, maximum segment length, and initial credit flow control value, the key establishes a target transmission channel with the master device, making the communication parameters adapt to the current transmission requirements. By receiving the upgrade software package through the target transmission channel and performing verification, the integrity and correctness of the received data can be effectively guaranteed, improving the transmission efficiency and reliability during the key software upgrade process.
[0034] Optionally, the step of receiving the upgrade package based on the target transmission channel and verifying the received upgrade package, and then starting the upgrade package if the verification passes, further includes:
[0035] Receive multiple data segments, reassemble the multiple data segments to generate multiple firmware blocks, each firmware block carries identification information, the identification information includes the firmware block number and check code;
[0036] Based on the identification information, each received firmware block is verified, and the received firmware block number is recorded.
[0037] Optionally, the step of verifying each received firmware block based on the identification information and recording the received firmware block number further includes:
[0038] The key is configured with a first partition and a second partition, the first partition being used to store currently running software packages, and the second partition being used to store received software packages to be upgraded;
[0039] The received and verified firmware block is stored in the second partition;
[0040] After all firmware blocks have been received and verified, all firmware blocks in the second partition are reassembled to generate an upgrade package, and the integrity of the upgrade package is verified.
[0041] If the integrity check passes, switch the boot partition to the second partition and restart the key;
[0042] If the integrity check fails, the first partition remains the boot partition.
[0043] By storing the received and verified firmware block in the second partition instead of directly overwriting the currently running first partition, the existing software package in the first partition can be kept intact throughout the entire upgrade process. This dual-partition mechanism can avoid device failures caused by interruptions or data errors during the upgrade process, eliminate the risk of bricking the device, and improve the security and fault tolerance of the upgrade process.
[0044] Optional, also includes:
[0045] Obtain the battery voltage of the key and compare the battery voltage with a preset threshold;
[0046] When the battery voltage is less than a preset threshold, stop receiving and save the received firmware blocks;
[0047] When the battery voltage recovers to a level greater than or equal to a preset threshold, the remaining firmware blocks are received from the stop position.
[0048] By monitoring the battery voltage in real time and comparing it with a preset threshold, it can avoid data writing errors or device malfunctions that may occur if transmission continues under low voltage conditions. It can effectively avoid upgrade interruptions or failures caused by insufficient key battery power, thereby improving the upgrade success rate in low power scenarios. Furthermore, the save and resume transmission mechanism can avoid the time reduction caused by repeated transmissions.
[0049] The third aspect of the present invention discloses a vehicle key upgrade system, including a vehicle terminal and a key, the system being used to execute the method for transmitting and upgrading the vehicle key's upgrade software package as described in either the first or second aspect.
[0050] Due to the application of the above technical solution, the present invention has the following advantages compared with the prior art:
[0051] The target transmission channel in this application is a COC connection-oriented channel established based on the L2CAP protocol. After the key establishes a wireless communication connection with the master device, the target transmission channel is established with the key based on the maximum transmission unit, the maximum segment length, and the initial credit flow control value. The master device transmits the upgrade software package to the key through the target transmission channel, which can significantly increase the data length of a single frame, reduce the number of packets in the transmission process, and shorten the upgrade time. At the same time, through the native credit flow control mechanism of the COC channel, the packet loss and out-of-order problem caused by buffer overflow at the key end can be avoided, effectively improving transmission efficiency and stability.
[0052] To make the above and other objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 This is a flowchart of the method for transmitting the upgrade software package of the vehicle key provided in this embodiment;
[0055] Figure 2 This is a flowchart of the vehicle key upgrade method provided in this embodiment;
[0056] Figure 3 This is a block diagram of the vehicle key transmission and upgrade system provided in this embodiment;
[0057] Figure 4 This is a schematic diagram of the electronic device provided in this embodiment for implementing the vehicle key upgrade method. Detailed Implementation
[0058] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. In addition, the accompanying drawings of the present invention are only simple illustrations and are not depictions based on actual dimensions, as stated in advance.
[0059] In this invention, it should be noted that the terms "upper," "lower," "inner," "outer," "forward," "backward," "between," "near," and "farthest" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. These terms are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. It should also be noted that, unless otherwise explicitly specified and limited, the terms "installation" and "connection" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a direct connection or an indirect connection. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.
[0060] It should be understood that while terms such as "first," "second," and "third" may be used in this document to describe various components or signals, these components or signals should not be limited by these terms. These terms are primarily used to distinguish one component from another, or one signal from another. Furthermore, the term "or" as used herein should, as appropriate, include any combination of one or more of the related listed items.
[0061] Example 1: Refer to Figure 1 This embodiment provides a method for transmitting a vehicle key upgrade software package, including:
[0062] Step S11: The master device establishes a wireless communication connection with the key, and obtains feature value data for the key's software package upgrade based on the wireless communication connection.
[0063] The main device can be a vehicle-mounted host, a mobile phone, or a dedicated upgrade terminal. The key can be a vehicle's smart Bluetooth key or a physical remote key carried by the user. The software package is an executable program file, such as firmware, an application, a configuration file, or a data file. In this embodiment, a Bluetooth key is used as an example. The wireless communication connection is a BLE Bluetooth connection.
[0064] In one optional implementation, after the master device discovers the software package to be upgraded, it establishes a Bluetooth connection with the Bluetooth key, completes pairing and binding, and after successful binding, the master device completes control signaling interaction with the Bluetooth key through the L2CAP protocol.
[0065] It should be noted that both the master device and the Bluetooth key store BLE protocol stacks in their memory. The BLE protocol stack includes a link layer, an L2CAP protocol layer, and upper-layer protocol layers (such as ATT). In this embodiment, the master device is an in-vehicle host with an OTA application installed. The BLE protocol stack of the in-vehicle host is provided by the operating system, and its application layer calls the L2CAP protocol function of the protocol stack through the system API interface. The Bluetooth key contains a complete BLE 5.0 or higher version protocol stack, and its application layer uses the L2CAP protocol function by calling the standard API interface provided by the protocol stack.
[0066] The L2CAP protocol (Logical Link Control and Adaptation Layer Protocol) is located above the Link Layer and below the application layer protocol (GATT / ATT). It is used to provide data encapsulation and channel management services to the ATT layer and the application layer above, and to exchange physical layer data with the peer device through the Link Layer below.
[0067] In this embodiment, the Bluetooth key's server is configured with an OTA (Over-The-Air) dedicated service, used to announce to the master device that the key supports software upgrades via the target transmission channel. The OTA dedicated service contains at least one feature value, which carries an SPSM (Simplified Protocol / Service Multiplexer) value. The SPSM value is the service entry identifier of the L2CAP layer, used to indicate the entry point of the target transmission channel. After the master device establishes a Bluetooth connection with the Bluetooth key, it discovers the OTA dedicated service via the ATT protocol and reads the feature value carrying the SPSM value under the OTA dedicated service to determine which L2CAP layer entry point should be used to establish the target transmission channel.
[0068] Step S12: Obtain the upgrade parameters of the software package to be upgraded, and obtain the channel parameters of the target transmission channel based on the upgrade parameters. The target transmission channel is used to transmit the software package to be upgraded. The channel parameters include the maximum transmission unit, the maximum segment length, and the initial credit flow control value.
[0069] The upgrade parameters include the data size of the software package to be upgraded and the OTA upgrade time. For example, the data size of the software package to be upgraded is 300KB. The master device renegotiates the channel parameters of the target transmission channel during the OTA upgrade with the key based on the data size of the software package to be upgraded.
[0070] The maximum transmission unit (MTU) is configured to be 247 bytes to 512 bytes to limit the maximum size of a single SDU (Service Data Unit). The maximum transmission unit provided in this embodiment enables a single service data unit to carry more data, resulting in higher transmission efficiency, fewer packets, and shorter upgrade time compared to the traditional GATT transmission scheme.
[0071] The maximum segment length (MPS) is 248 bytes, which is used to control the granularity of protocol stack fragmentation. The protocol stack automatically completes fragmentation according to this segment length, so that each physical frame is fully transmitted, maximizing the utilization of air bandwidth.
[0072] The initial credit flow control value is 10 to 30, which is used to allocate an initial transmission permission to the master device by the Bluetooth key when the channel is established. This ensures that the master device can continuously send enough service data units, avoids efficiency reduction caused by frequent waiting, and ensures that the key end buffer is not over-occupied, thus achieving an optimal balance between transmission speed and security.
[0073] Optionally, before establishing the target transmission channel, the master device can also negotiate with the key to adjust the connection interval from the normal mode to the upgrade mode in order to further optimize the transmission rate.
[0074] Step S13: Based on the feature value data, send a connection request for the target transmission channel to the key, and establish the target transmission channel with the key based on the channel parameters.
[0075] The target transmission channel is the L2CAP COC channel. The L2CAP protocol natively supports multiple channel types, including the COC connection-oriented channel. The COC connection-oriented channel can support large frame transmission, provides a credit flow control mechanism, and the protocol stack automatically completes fragmentation and reassembly. This embodiment uses the above-mentioned characteristics of the COC connection-oriented channel to transmit the software package to be upgraded, so as to solve the shortcomings of the traditional GATT channel, which cannot transmit large frames, lacks flow control, and requires manual fragmentation and reassembly at the application layer. The effect is particularly obvious when transmitting software packages larger than 200KB. Furthermore, the L2CAP protocol is a Bluetooth key storage protocol, so it does not rely on proprietary transmission protocols, has a high degree of standardization, is easy to port across chip platforms, and has low maintenance costs.
[0076] After obtaining the SPSM value, the master device initiates an L2CAP COC connection request based on this value. This request carries the SPSM value obtained in step S1, as well as parameters negotiated in step S2, such as the maximum transmission unit, maximum segment length, and initial credit flow control value. Upon receiving the connection request, the Bluetooth key determines whether to accept the connection based on its own resource availability (such as RAM buffer size) and generates a connection response signaling to return to the master device. If the connection is accepted, the COC channel is successfully established.
[0077] Step S14: Send the software package to be upgraded to the key based on the target transmission channel.
[0078] In one optional implementation, this step further includes:
[0079] The upgrade package is encrypted, and the encrypted upgrade package is divided into multiple firmware blocks according to a preset length.
[0080] Each firmware block is encapsulated according to preset identification information, which includes the firmware block number and checksum.
[0081] Based on the target transmission channel, the encapsulated firmware blocks are sent to the key.
[0082] Optionally, the master device may use the AES-CCM encryption algorithm or the AES-GCM algorithm to encrypt the upgrade software package. The preset length may be 32KB, 64KB, or 128KB.
[0083] In one optional implementation, sending the encapsulated firmware blocks to the key based on the target transmission channel further includes: dividing each encapsulated firmware block into multiple data segments based on the maximum segment length, and sending the multiple data segments based on the initial credit flow control value.
[0084] Specifically, the application layer of the main device encrypts the software package to be upgraded and divides it into multiple firmware blocks of a preset length. Each firmware block is further encapsulated into multiple service data units after being identified. The size of a single service data unit does not exceed the maximum transmission unit. Subsequently, the L2CAP protocol of the main device automatically divides each service data unit into multiple protocol data units (PDUs) according to the maximum segment length. The protocol data units are the aforementioned data segments. Each data segment is transmitted to the Bluetooth key through the COC channel. During the transmission, the L2CAP protocol controls the transmission rate of the protocol data units based on the initial credit flow control value. The L2CAP credit flow control mechanism ensures that the main device will not send data at a rate higher than the processing capacity of the Bluetooth key, fundamentally preventing Bluetooth key buffer overflow and packet loss.
[0085] During transmission, firmware blocks are automatically fragmented and reassembled through the L2CAP COC channel. Compared with the existing method of data transmission via GATT, there is no need for the main device to develop its own packet subdivision logic. At the same time, relying on the credit flow control mechanism of the L2CAP protocol itself, data congestion or packet loss can be avoided, ensuring the stability and integrity of the transmission of the upgrade software package.
[0086] In an optional implementation, the transmission method in this embodiment further includes a breakpoint resumption mechanism. When data transmission is interrupted and restarted, it can resume transmission from the interrupted data without retransmitting the entire data package, thereby improving transmission efficiency. The specific steps are as follows:
[0087] Obtain the transmission status of the firmware block, including transmission completion and transmission interruption;
[0088] If the transmission of the firmware block is interrupted, the target transmission channel is re-established;
[0089] Obtain the first number, which is the number of the firmware block that has been sent;
[0090] The second number is obtained based on the first number, and the second number is the number of the unsent firmware block;
[0091] A firmware block with the second number is sent to the key based on the re-established target transmission channel.
[0092] Example 2: Refer to Figure 2 This embodiment provides a method for upgrading a vehicle key, including:
[0093] Step S21: The key establishes a wireless communication connection with the main device, and configures feature value data for key software upgrade based on the wireless communication connection;
[0094] Step S22: Obtain the channel parameters sent by the master device. The channel parameters include the maximum transmission unit, the maximum segment length, and the initial credit flow control value.
[0095] Step S23: In response to the connection request from the master device, establish a target transmission channel with the master device based on the channel parameters;
[0096] The connection request is an L2CAP COC channel connection request, which carries the SPSM value. The key accepts the connection request based on the SPSM value and negotiates with the master device to establish the target transmission channel.
[0097] Step S24: Receive the upgrade package based on the target transmission channel and verify the received upgrade package. If the verification passes, start the upgrade package.
[0098] The step of receiving the upgrade software package based on the target transmission channel, verifying the received upgrade software package, and starting the upgrade software package if the verification passes, further includes:
[0099] Receive multiple data segments, reassemble the multiple data segments to generate multiple firmware blocks, each firmware block carries identification information, the identification information includes the firmware block number and check code;
[0100] Based on the identification information, each received firmware block is verified, and the received firmware block number is recorded.
[0101] Specifically, after receiving and decrypting multiple data segments, the L2CAP layer of the Bluetooth key combines the data segments belonging to the same SDU in sequence according to the identification information to restore the complete SDU. After the reconstruction is completed, the L2CAP layer sends the complete SDU to the upper application layer. The upper application layer obtains the firmware block data, block number, and checksum from the complete SDU and performs block-by-block verification.
[0102] The verification code is a CRC32 verification code. In other optional implementations, it can also be verified using the MD5 verification algorithm.
[0103] After the firmware block-by-block verification is completed, it is stored in the designated location on the Bluetooth key. The specific process is as follows:
[0104] The key is configured with a first partition and a second partition, the first partition being used to store currently running software packages, and the second partition being used to store received software packages to be upgraded;
[0105] The received and verified firmware block is stored in the second partition;
[0106] After all firmware blocks have been received and verified, all firmware blocks in the second partition are reassembled to generate an upgrade package, and the integrity of the upgrade package is verified.
[0107] If the integrity check passes, switch the boot partition to the second partition and restart the key;
[0108] If the integrity check fails, the first partition remains the boot partition.
[0109] In one optional implementation, during the Bluetooth key firmware block reception process, the Bluetooth battery voltage is also monitored in real time to prevent firmware block reception failure due to low battery level. The specific process is as follows:
[0110] Obtain the battery voltage of the key and compare the battery voltage with a preset threshold;
[0111] When the battery voltage is less than a preset threshold, stop receiving and save the received firmware blocks;
[0112] When the battery voltage recovers to a level greater than or equal to a preset threshold, the remaining firmware blocks are received from the stop position.
[0113] Optionally, the preset threshold is 2.8V to 3.2V.
[0114] Example 3: Refer to Figure 3 This embodiment provides a vehicle key upgrade system, including a vehicle terminal and a key. The system is used to execute the transmission method and upgrade method of the vehicle key upgrade software package as described in the above embodiment.
[0115] In some alternative implementations, the system includes:
[0116] The communication unit is used to establish a wireless communication connection between the main device and the key;
[0117] The feature value acquisition unit is used to acquire feature value data for key software package upgrade based on the wireless communication connection;
[0118] The channel parameter negotiation unit is used to obtain the upgrade parameters of the software package to be upgraded, and obtain the channel parameters of the target transmission channel based on the upgrade parameters. The target transmission channel is used to transmit the software package to be upgraded. The channel parameters include the maximum transmission unit, the maximum segment length, and the initial credit flow control value.
[0119] The channel establishment unit is used to send a connection request for the target transmission channel to the key based on the feature value data, and to establish the target transmission channel with the key based on the channel parameters;
[0120] A sending unit is configured to send the software package to be upgraded to the key based on the target transmission channel;
[0121] The receiving verification unit is used to receive the upgrade software package based on the target transmission channel and verify the received upgrade software package. If the verification passes, the upgrade software package is started.
[0122] The startup switching unit is used to switch the boot partition to the second partition and restart the key after the integrity verification passes.
[0123] A voltage monitoring unit is used to acquire the battery voltage of the key and compare the battery voltage with a preset threshold.
[0124] Example 4: Refer to Figure 4 This application also provides an electronic device, which includes:
[0125] Memory for storing non-transitory computer-readable instructions; and
[0126] A processor for executing the computer-readable instructions such that, when the computer-readable instructions are executed by the processor, the method described above is implemented.
[0127] Example 5: This application also provides a computer-readable storage medium including computer instructions that, when executed on a device, cause the device to perform the method described above.
[0128] Specific embodiments have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.
Claims
1. A method for transmitting an upgrade software package for a vehicle key, characterized in that, Includes the following steps: The main device establishes a wireless communication connection with the key, and obtains feature value data for the key's software package upgrade based on the wireless communication connection; The upgrade parameters of the software package to be upgraded are obtained, and the channel parameters of the target transmission channel are obtained based on the upgrade parameters. The target transmission channel is used to transmit the software package to be upgraded. The channel parameters include the maximum transmission unit, the maximum segment length, and the initial credit flow control value. Based on the feature value data, a connection request for the target transmission channel is sent to the key, and the target transmission channel is established with the key based on the channel parameters; The software package to be upgraded is sent to the key based on the target transmission channel.
2. The method for transmitting the upgrade software package of the vehicle key according to claim 1, characterized in that, The step of sending the software package to be upgraded to the key based on the target transmission channel further includes: The upgrade package is encrypted, and the encrypted upgrade package is divided into multiple firmware blocks according to a preset length. Each firmware block is encapsulated according to preset identification information, which includes the firmware block number and checksum. Based on the target transmission channel, the encapsulated firmware blocks are sent to the key.
3. The method for transmitting the upgrade software package of the vehicle key according to claim 2, characterized in that, The step of sending the encapsulated multiple firmware blocks to the key based on the target transmission channel further includes: Based on the maximum segment length, each encapsulated firmware block is divided into multiple data segments; Multiple data segments are sent based on the initial credit flow control value.
4. The method for transmitting the upgrade software package of the vehicle key according to any one of claims 2 or 3, characterized in that, Also includes: Obtain the transmission status of the firmware block, including transmission completion and transmission interruption; If the transmission of the firmware block is interrupted, the target transmission channel is re-established; Obtain the first number, which is the number of the firmware block that has been sent; The second number is obtained based on the first number, and the second number is the number of the unsent firmware block; A firmware block with the second number is sent to the key based on the re-established target transmission channel.
5. The method for transmitting the upgrade software package of the vehicle key according to claim 1, characterized in that, The maximum transmission unit is 247 bytes to 512 bytes, the maximum segment length is 248 bytes, and the initial credit flow control value is 10 to 30.
6. A method for upgrading a vehicle key, characterized in that, Includes the following steps: The key establishes a wireless communication connection with the master device, and configures feature value data for key software upgrades based on the wireless communication connection. Obtain the channel parameters sent by the master device, the channel parameters including the maximum transmission unit, the maximum segment length, and the initial credit flow control value; In response to the connection request from the master device, a target transmission channel is established with the master device based on the channel parameters; The system receives the upgrade software package through the target transmission channel and verifies the received upgrade software package. If the verification passes, the upgrade software package is started.
7. The vehicle key upgrade method according to claim 6, characterized in that, The process of receiving the upgrade package based on the target transmission channel, verifying the received upgrade package, and activating the upgrade package if the verification passes, further includes: Receive multiple data segments, reassemble the multiple data segments to generate multiple firmware blocks, each firmware block carries identification information, the identification information includes the firmware block number and check code; Based on the identification information, each received firmware block is verified, and the received firmware block number is recorded.
8. The vehicle key upgrade method according to claim 7, characterized in that, The step of verifying each received firmware block based on the identification information and recording the received firmware block number also includes: The key is configured with a first partition and a second partition, the first partition being used to store currently running software packages, and the second partition being used to store received software packages to be upgraded; The received and verified firmware block is stored in the second partition; After all firmware blocks have been received and verified, all firmware blocks in the second partition are reassembled to generate an upgrade package, and the integrity of the upgrade package is verified. If the integrity check passes, switch the boot partition to the second partition and restart the key; If the integrity check fails, the first partition remains the boot partition.
9. The method for upgrading a vehicle key according to any one of claims 6 to 8, characterized in that, Also includes: Obtain the battery voltage of the key and compare the battery voltage with a preset threshold; When the battery voltage is less than a preset threshold, stop receiving and save the received firmware blocks; When the battery voltage recovers to a level greater than or equal to a preset threshold, the remaining firmware blocks are received from the stop position.
10. A vehicle key upgrade system, characterized in that, The system includes a vehicle terminal and a key, and is used to perform the method for transmitting and upgrading the upgrade software package of the vehicle key as described in any one of claims 1 to 9.