A strategy and device for firmware upgrade based on CAN network

By adopting subcontracting and verification strategies in the CAN network and combining the ‘steady-state triggering’ strategy, the problem of high failure rate of firmware upgrade in on-board equipment is solved, and a higher success rate and system stability are achieved.

CN115766446BActive Publication Date: 2025-04-08YANTAI CHUNGWAY NEW ENERGY TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211421236.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-14
Publication Date
2025-04-08
Estimated Expiration
2042-11-14

AI Technical Summary

Technical Problem

When using CAN network to upgrade firmware, the upgrade failure rate is high, especially if there is a problem with one frame during data transmission, it needs to be upgraded again, which is inefficient.

Method used

A firmware upgrade strategy based on CAN network is proposed. Through subcontracting and verification strategies, it is possible to determine whether the reception is accurate during transmission. The "steady-state triggering" strategy is used to solve the data synchronization problem caused by CAN communication errors.

Benefits of technology

It improves the success rate of firmware upgrades, from the original 90% to more than 99.9%, reduces the increase in transmission time and improves the robustness and robustness of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115766446B_ABST
    Figure CN115766446B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of network technology, and in particular to a strategy and device based on CAN network firmware upgrade, wherein the upgrade strategy comprises the following steps: a concentrator obtains a firmware upgrade package through a 4G network, verifies the integrity of the package, stores the package in a RAM, sends whoamI, obtains all node IDs in the CAN network, calculates the total number of firmware packets to be sent, and broadcasts the number to the CAN network according to instructions; the present invention proposes a packetization strategy, a verification strategy and a packet transmission completion judgment strategy when transmitting a large amount of data in the CAN network, and can judge whether the reception is accurate during the upgrade process, and the number of frames used for verification does not increase too much, which has little effect on the time of the firmware upgrade, and adopts a "steady-state trigger" strategy to solve the data synchronization problem between the concentrator and the node caused by the CAN communication error, which has obvious advantages compared with the prior art, and greatly improves the robustness and robustness of the system at the cost of increasing very little transmission time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network technology, and in particular to a strategy and device based on CAN network firmware upgrade. Background Art

[0002] With the development of science and technology, the rise of electronic products, more and more in-vehicle electronic products, and now almost all in-vehicle electronic devices are smart devices, such as car navigation, car audio, etc. In-vehicle devices generally use CAN network for communication, and CAN communication is a short packet communication, and the data part is fixed to 8 bytes. Therefore, when transmitting large amounts of data such as firmware, if the method of checking each frame is used, the efficiency will inevitably be reduced. Therefore, the method of checking after all transmissions are completed is now generally adopted. This method has obvious defects. If there is a problem with one frame, it needs to be upgraded again. Summary of the invention

[0003] The purpose of the present invention is to provide a strategy and device based on CAN network firmware upgrade to solve the problem of high failure rate of CAN network firmware upgrade of vehicle-mounted equipment.

[0004] To achieve the above object, the present invention provides the following technical solution: a strategy based on CAN network firmware upgrade, wherein the upgrade strategy comprises the following steps:

[0005] S1. The concentrator obtains the firmware upgrade package through the 4G network, verifies the integrity of the package, stores it in RAM, sends who amI, obtains all node IDs in the CAN network, calculates the total number of firmware packets that need to be sent, and broadcasts the number to the CAN network according to the instruction;

[0006] S2. The concentrator sends the first firmware packet in the form of broadcast, and sends 64 frames continuously. The concentrator waits for 2ms. At this time, according to the steady-state trigger strategy, the node determines that the firmware packet has been received. The concentrator sends the packet verification data. If the node determines that the verification is correct, it returns a correct instruction and puts the firmware packet in the appropriate position in the RAM. If the node determines that the verification is wrong, it returns an error instruction. The concentrator will send the firmware packet to the ID again. When the number of errors is greater than the set number, the upgrade will be exited until all nodes receive the firmware packet correctly.

[0007] S3. Send firmware packets in sequence until all firmware are sent, send upgrade instructions, and the node writes the firmware to FLASH, then the upgrade is completed.

[0008] Preferably, in step S1, the total number of firmware packets is the total length divided by 512, and if the number is not divisible, 1 is added.

[0009] Preferably, in step S1, the CAN module of the micro control unit has 64 mailboxes and can continuously receive 64 frames.

[0010] Preferably, in step S1, the firmware is split into 512 bytes, with 8 bytes per frame, for a total of 64 frames, to achieve optimal CAN network utilization.

[0011] Preferably, in step S2, during the process of sending the firmware packet, the interval between frames is 100uS.

[0012] Preferably, in step S2, a timer is set. If the timer is cleared within the specified time, it will not be triggered. Otherwise, it will be triggered. The steady-state trigger threshold is set to 1mS. During the sending of the firmware packet, it will not be triggered. If there is no frame for more than 1mS, it will be triggered. If the node does not receive a frame, the trigger condition still holds, and synchronization between the concentrator and the node can be achieved.

[0013] Preferably, in step S2, the number of errors is set to 5 times.

[0014] A device for upgrading firmware based on a CAN network is composed of a concentrator, a micro control unit and a timer.

[0015] Compared with the prior art, the present invention has the following beneficial effects:

[0016] The present invention proposes a packetization strategy, a verification strategy and a packet transmission completion judgment strategy when transmitting a large amount of data in a CAN network. During the upgrade process, it can be determined whether the reception is accurate. The frames used for verification are not increased too much, which has little impact on the time of firmware upgrade. In addition, a "steady-state trigger" strategy is adopted to solve the data synchronization problem between the concentrator and the node caused by CAN communication errors. Compared with the prior art, it has obvious advantages. At the cost of increasing very little transmission time, the robustness and robustness of the system are greatly improved, and the success rate of a single firmware upgrade is increased from 90% to more than 99.9%. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 This is a schematic diagram of the main process of firmware upgrade in the present invention;

[0018] Figure 2 It is a schematic diagram of the firmware upgrade sub-process in the present invention. DETAILED DESCRIPTION

[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0020] Embodiment 1:

[0021] A strategy for firmware upgrade based on CAN network, the upgrade strategy includes the following steps:

[0022] S1. The concentrator obtains the firmware upgrade package through the 4G network, verifies the integrity of the package, stores it in RAM, sends who amI, obtains all node IDs in the CAN network, and calculates the total number of firmware packets to be sent. The total number of firmware packets is the total length divided by 512. If it is not divisible, add 1 and broadcast the number to the CAN network according to the instruction;

[0023] S2, the concentrator sends the first firmware packet in the form of broadcast, and sends 64 frames continuously. The concentrator waits for 2ms. At this time, according to the steady-state trigger strategy, the node determines that the firmware packet has been received, and the concentrator sends the packet verification data. In the process of sending the firmware packet, the interval between frames is 100uS. If the node determines that the verification is correct, it returns the correct instruction and puts the firmware packet in the appropriate position in the RAM. If the node determines that the verification is wrong, it returns the error instruction. The concentrator will send the firmware packet to the ID again. When the error is greater than the set number, the upgrade will be exited until all nodes receive the firmware packet correctly;

[0024] S3. Send firmware packets in sequence until all firmware are sent, send upgrade instructions, and the node writes the firmware to FLASH, then the upgrade is completed.

[0025] Embodiment 2:

[0026] A strategy for firmware upgrade based on CAN network, the upgrade strategy includes the following steps:

[0027] S1. The concentrator obtains the firmware upgrade package through the 4G network, verifies the integrity of the package, stores it in RAM, sends who amI, obtains all node IDs in the CAN network, and calculates the total number of firmware packets to be sent. The total number of firmware packets is the total length divided by 512. If it is not divisible, it is increased by 1, and the number is broadcast to the CAN network according to the instruction. The CAN module of the microcontroller unit (MCU) has 64 mailboxes and can receive 64 frames continuously;

[0028] S2, the concentrator sends the first firmware packet in the form of broadcast, and sends 64 frames continuously. The concentrator waits for 2ms. At this time, according to the steady-state trigger strategy, the node determines that the firmware packet has been received, and the concentrator sends the packet verification data. In the process of sending the firmware packet, the interval between frames is 100uS. If the node determines that the verification is correct, it returns the correct instruction and puts the firmware packet in the appropriate position in the RAM. If the node determines that the verification is wrong, it returns the error instruction. The concentrator will send the firmware packet to the ID again. After the error is greater than the set number of times, the upgrade will be exited until all nodes correctly receive the firmware packet. A timer is set. If the timer is cleared within the specified time, it will not be triggered. Otherwise, it will be triggered. The steady-state trigger threshold is set to 1mS. In the process of sending the firmware packet, it will not be triggered. If there is no frame for more than 1mS, it will be triggered. If the node does not receive a frame, the trigger condition is still established, which can achieve synchronization between the concentrator and the node.

[0029] S3. Send firmware packets in sequence until all firmware are sent, send upgrade instructions, and the node writes the firmware to FLASH, then the upgrade is completed.

[0030] Embodiment three:

[0031] A strategy for firmware upgrade based on CAN network, the upgrade strategy includes the following steps:

[0032] S1. The concentrator obtains the firmware upgrade package through the 4G network, verifies the integrity of the package, stores it in RAM, sends who amI, obtains all node IDs in the CAN network, and calculates the total number of firmware packets to be sent. The total number of firmware packets is the total length divided by 512. If it is not divisible, add 1, and broadcast the number to the CAN network according to the instruction. The CAN module of the microcontroller (MCU) has 64 mailboxes and can receive 64 frames continuously. The firmware is split into 512 bytes, 8 bytes per frame, a total of 64 frames, to achieve the best CAN network utilization rate;

[0033] S2, the concentrator sends the first firmware packet in the form of broadcast, and sends 64 frames continuously. The concentrator waits for 2ms. At this time, according to the steady-state trigger strategy, the node determines that the firmware packet has been received, and the concentrator sends the packet verification data. In the process of sending the firmware packet, the interval between frames is 100uS. If the node determines that the verification is correct, it returns the correct instruction and puts the firmware packet in the appropriate position in the RAM. If the node determines that the verification is wrong, it returns the error instruction. The concentrator will send the firmware packet to the ID again. After the error is greater than the set number of times, it exits the upgrade until all nodes correctly receive the firmware packet. Set a timer. If the timer is cleared within the specified time, it will not be triggered. Otherwise, it will be triggered. Set the steady-state trigger threshold to 1mS. In the process of sending the firmware packet, it will not be triggered. If there is no frame for more than 1mS, it will be triggered. If the node does not receive a frame, the trigger condition is still established, which can achieve synchronization between the concentrator and the node.

[0034] S3. Send firmware packets in sequence until all firmware are sent, send upgrade instructions, and the node writes the firmware to FLASH, then the upgrade is completed.

[0035] The upgrade strategy proposed by the present invention has the following advantages:

[0036] 1. During the upgrade process, you can determine whether the reception is accurate.

[0037] 2. The number of frames used for verification has not increased too much, so it has little impact on the firmware upgrade time.

[0038] 3. Adopt the "steady-state trigger" strategy to solve the data synchronization problem between the concentrator and the node caused by CAN communication errors.

[0039] Glossary:

[0040] 1. Firmware packet: The CAN module of the MCU has 64 mailboxes and can receive 64 frames continuously. Here, the firmware is split into 512 bytes, 8 bytes per frame, and a total of 64 frames. This can achieve the best CAN network utilization rate.

[0041] 2. Steady-state trigger: Set a timer. If the timer is cleared within the specified time, it will not be triggered. Otherwise, it will be triggered. In the process of sending firmware packets, the interval between frames is 100uS. Here, the steady-state trigger threshold is set to 1mS. Therefore, in the process of sending firmware packets, it will not be triggered. If there is no frame for more than 1mS, it will be triggered. If the node does not receive a frame, the trigger condition still holds, and synchronization between the concentrator and the node can be achieved.

[0042] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements. Although embodiments of the present invention have been shown and described, it is understood by those of ordinary skill in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the attached claims and their equivalents.

Claims

1. A strategy based on CAN network firmware upgrade, characterized by: The upgrade strategy includes the following steps: S1. The concentrator obtains the firmware upgrade package through the 4G network, verifies the integrity of the package, stores it in RAM, sends whoamI, obtains all node IDs in the CAN network, calculates the total number of firmware packets that need to be sent, and broadcasts the number to the CAN network according to the instruction; S2. The concentrator sends the first firmware packet in the form of broadcast, and sends 64 frames continuously. The concentrator waits for 2ms. At this time, according to the steady-state trigger strategy, the node determines that the firmware packet has been received. The concentrator sends the packet verification data. If the node determines that the verification is correct, it returns a correct instruction and puts the firmware packet in the appropriate position in the RAM. If the node determines that the verification is wrong, it returns an error instruction. The concentrator will send the firmware packet to the ID again. When the number of errors is greater than the set number, the upgrade will be exited until all nodes receive the firmware packet correctly. Among them, when sending firmware packets, the interval between frames is 100uS; In addition, in the clearing timer, a timer is set. The clearing timer will not be triggered within the specified time, otherwise it will be triggered. The steady-state trigger threshold is set to 1mS. It will not be triggered during the sending of firmware packets, but it will be triggered if there is no frame for more than 1mS. If the node does not receive a certain frame, the trigger condition is still established, which can achieve synchronization between the concentrator and the node; Furthermore, the number of errors was set to 5; S3. Send firmware packets in sequence until all firmware are sent, send upgrade instructions, and the node writes the firmware to FLASH, then the upgrade is completed.

2. A CAN network-based firmware upgrade strategy according to claim 1, characterized in that: In step S1, the total number of firmware packets is the total length divided by 512, and if the number is not divisible, 1 is added.

3. A CAN network-based firmware upgrade strategy according to claim 1, characterized in that: In step S1, the CAN module of the microcontroller unit has 64 mailboxes and can continuously receive 64 frames.

4. The strategy for firmware upgrade based on CAN network according to claim 1, characterized in that: In the step S1, the firmware is split into 512-byte frames, each frame is 8 bytes, and a total of 64 frames are used to achieve the best CAN network utilization rate.

5. A device based on a CAN network firmware upgrade strategy according to any one of claims 1 to 4, characterized in that: The device is composed of a concentrator, a micro control unit and a timer.

Citation Information

Patent Citations

  • Intelligent meter firmware upgrade method and equipment, and storage medium

    CN109002303A

  • CAN network child node remote firmware upgrading method based on motion control system

    CN112099810A