Parallel refreshing method based on vehicle-mounted Ethernet
Technical Field
The invention relates to the field of automobile data updating, in particular to a parallel refreshing method based on a vehicle-mounted Ethernet.
Background
In recent years, automobile technology has been rapidly developed. Advanced driving assistance system, unmanned system, interconnection function, intelligent cockpit are integrated into the automobile. These new technologies bring about a large increase in the amount of code, as represented by files with a capacity of ten megabits or even hundreds of megabits. This presents challenges to updating the entire vehicle system. In the traditional technology based on CAN communication as a backbone, as the communication rate of the CAN is generally 500kpbs, the transmission rate is slow, and the increasing data volume is difficult to meet.
Because the Ethernet communication rate CAN reach 100M or even 1000M, and because the Ethernet communication rate is far greater than the CAN communication rate. Parallel refresh can be realized in theory. The refreshing time can be greatly reduced, so that the updating time of the whole vehicle software is reduced, and better experience is provided for users.
Disclosure of Invention
In order to solve the technical problem, the application provides a parallel refreshing method based on a vehicle-mounted ethernet, which comprises the following steps:
s1, setting a parallel refresh frame in a refresh file, and selecting a corresponding CAN channel and unpacking the refresh file by a CAN controller;
s2, receiving parallel CAN refresh packed data uploaded by the Ethernet packing tool;
s3, unpacking the parallel CAN refreshing and packaging data and then sending the unpacked parallel CAN refreshing and packaging data to a corresponding CAN channel;
s4, receiving a response message of the CAN controller;
and S5, updating the corresponding ACK bit data, judging whether the ACK bit data in all the parallel refresh frames are updated correctly, and if not, executing the step S1 again.
In the technical scheme, the whole automobile is refreshed in parallel based on the communication rate of the Ethernet which is up to 100M or even 1000M, so that the refreshing time is greatly reduced, the software updating time of the whole automobile is reduced, and better experience is provided for users; the CAN channel is communicated with at least one ECU, and parallel refreshing of a plurality of ECUs is realized.
Preferably, the step S1 includes:
s1.1, configuring parameters of request frames in the parallel refresh frames according to the number of CAN buses supported by the whole vehicle architecture;
s1.2, selecting the corresponding CAN controller according to the request frame;
s1.3, the CAN controller selects a corresponding CAN channel refreshing process and unpacks the refreshing file.
Preferably, the format of the control header of the request frame is:
Number of CAN messages=X
wherein, X is a positive integer less than or equal to the number of CAN buses supported by the whole vehicle architecture.
Preferably, the CAN channels with the bit numbers of 1 to X are selected according to the data contained in the request frame, and all the remaining CAN channels are not used.
Preferably, the information data in the control header of the request frame includes Used bit data, Update bit data, and ACK bit data.
Preferably, step S2 is preceded by:
s2.1, the Ethernet packing tool obtains the parallel CAN data of the CAN channel and packs the parallel CAN data according to the parallel refresh frame format;
s2.2, the Ethernet packing tool uploads the parallel CAN refreshing packed data.
Preferably, the step S3 includes:
s3.1, unpacking the parallel CAN refreshing and packaging data to obtain a plurality of CAN messages;
and S3.2, sending the plurality of CAN messages to the CAN controller corresponding to the CAN channel.
Preferably, step S4 is preceded by:
s4.1, the CAN controller responds to the CAN message and generates a response message;
and S4.2, the CAN controller uploads the corresponding response message in the CAN channel.
Preferably, the response message in step S4.1 includes a response frame, and the format of the response frame is consistent with that of the request frame;
the information data in the control header of the response frame comprises Used bit data, Update bit data and ACK bit data.
Preferably, the step S5 includes:
s5.1, updating the ACK bit data, judging whether the ACK bit data correspond to the response message of the CAN channel, and updating the assignment of the ACK bit data to be 1 if the ACK bit data correspond to the response message of the CAN channel correctly; if the judgment result is that the data is corresponding to the error, updating the assignment of the ACK bit data to be 0;
and S5.2, judging whether all the assignments of the ACK bit data are 1, and if the judgment result is negative, re-executing the step S1.
In conclusion, the beneficial effects of the technical scheme are as follows:
1. based on the communication rate of the Ethernet up to 100M or even 1000M, the whole automobile is refreshed in parallel, the refreshing time is greatly reduced, the whole automobile software updating time is reduced, and better experience is provided for users.
2. In order to realize parallel refreshing, a parallel refreshing frame based on an Ethernet frame is designed, a control head is defined in a data part of the Ethernet frame, the control head comprises Used bit data, Update bit data and ACK bit data, and the CAN channel and the controller which specifically execute a refreshing task are determined.
3. Each CAN channel for executing the refreshing task is communicated with at least one ECU, and a plurality of CAN channels are refreshed in parallel to realize parallel refreshing of a plurality of ECUs.
Drawings
FIG. 1 is a flow chart of a parallel refreshing method based on a vehicle-mounted Ethernet according to the present invention;
FIG. 2 is a diagram illustrating a parallel refresh frame format according to the present invention;
FIG. 3 is a flowchart of step S1 according to the present invention;
FIG. 4 is a flowchart of step S2 of the present invention;
FIG. 5 is a flowchart illustrating step S3 according to the present invention;
FIG. 6 is a flowchart illustrating step S4 according to the present invention;
FIG. 7 is a flowchart illustrating step S4 according to the present invention;
fig. 8 is a physical connection schematic during the refresh process of the present invention.
Detailed Description
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. Unless otherwise defined, all terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that the conventional terms should be interpreted as having a meaning that is consistent with their meaning in the relevant art and this disclosure. The present disclosure is to be considered as an example of the invention and is not intended to limit the invention to the particular embodiments.
Examples
As shown in fig. 1 to 8, a parallel refreshing method based on a vehicle ethernet includes the following steps:
and S1, setting a parallel refresh frame in the refresh file, and selecting a corresponding CAN channel and unpacking the refresh file by the CAN controller.
As shown in fig. 8, firstly, in the entire automobile, the upper computer is connected to the central gateway through the ethernet, parallel refresh frames in the refresh file are set on the central gateway, that is, a controller program file requiring parallel refresh is selected, and program files corresponding to 4 controllers are selected, in this embodiment, four refresh files, namely, an ECU11, an ECU21, an ECU31, and an ECU41, are preferably selected, and each refresh file corresponds to one ECU, that is, a CAN controller, and it is described that each CAN channel may be correspondingly connected to a plurality of ECUs. And the CAN refreshing control program controls the corresponding CAN refreshing process and unpacks the refreshing file.
The step S1 includes:
s1.1, configuring parameters of request frames in the parallel refresh frames according to the number of CAN buses supported by the whole vehicle architecture.
In order to implement parallel refresh, a parallel refresh frame based on ethernet frames needs to be designed. As shown in fig. 2, the present invention is a schematic diagram of a parallel refresh frame format. The number of the CAN buses supported by the whole vehicle architecture is preferably 8 lines in the embodiment. A control header is defined in the data portion of the ethernet frame, the control header being 8 bytes in length. CAN frames followed by CAN1-CAN8, each of which is also 8 bytes long.
The control header format of the request frame is:
Number of CAN messages=X
wherein, X is a positive integer less than or equal to the number of CAN buses supported by the whole vehicle architecture. And selecting CAN channels with the bit numbers from 1 to X according to the data contained in the request frame, and leaving all the CAN channels unused. The information data in the control header of the request frame comprises Used bit data, Update bit data and ACK bit data. For example, Number of CAN messages =4, indicating that CAN1-CAN8 uses only CAN1-CAN4, and CAN5-CAN8 does not. Nor are the corresponding Used5-Used8, Update5-Update8, ACK5-ACK8 Used.
S1.2, selecting the corresponding CAN controller according to the request frame.
S1.3, the CAN controller selects a corresponding CAN channel refreshing process and unpacks the refreshing file.
S2.1, the Ethernet packing tool obtains the parallel CAN data of the CAN channel and packs the parallel CAN data according to the parallel refresh frame format. And packaging the 4 paths of parallel CAN data according to the format of the parallel refresh frame in an Ethernet packaging mode. The Ethernet packaging tool is a software tool which packages and packages data written by a programming language.
S2.2, the Ethernet packing tool uploads the parallel CAN refreshing packed data.
And S2, receiving the parallel CAN refresh packaging data uploaded by the Ethernet packaging tool. And the central gateway is connected with the Ethernet packing tool through an Ethernet protocol and receives the parallel CAN refresh packing data uploaded by the Ethernet packing tool.
And S3, unpacking the parallel CAN refreshing and packaging data and then sending the unpacked parallel CAN refreshing and packaging data to the corresponding CAN channel. After unpacking, the central gateway sends the corresponding CAN1-CAN4 message to the corresponding CAN1-CAN4 channel according to the corresponding relation, and the CAN controller responds the message
The step S3 includes:
s3.1, unpacking the parallel CAN refreshing and packaging data to obtain a plurality of CAN messages;
and S3.2, sending the plurality of CAN messages to the CAN controller corresponding to the CAN channel.
And S4, receiving the response message of the CAN controller.
The CAN controller response messages are respectively sent to the central gateway through CAN1-CAN4 channels, and the central gateway packages the four response messages.
The step S4 includes:
and S4.1, the CAN controller responds to the CAN message and generates the response message. The response message in the step S4.1 includes a response frame, and the format of the response frame is consistent with that of the request frame; the information data in the control header of the response frame comprises Used bit data, Update bit data and ACK bit data.
And S4.2, the CAN controller uploads the corresponding response message in the CAN channel.
And S5, updating the corresponding ACK bit data, judging whether the ACK bit data in all the parallel refresh frames are updated correctly, and if not, executing the step S1 again.
The step S5 includes:
s5.1, updating the ACK bit data, judging whether the ACK bit data correspond to the response message of the CAN channel, and updating the assignment of the ACK bit data to be 1 if the ACK bit data correspond to the response message of the CAN channel correctly; and if the judgment result is that the data is corresponding to the error, updating the assignment of the ACK bit data to be 0.
And S5.2, judging whether all the assignments of the ACK bit data are 1, and if the judgment result is negative, re-executing the step S1. This interaction is performed until the ECU11, ECU21, ECU31, and ECU41 refresh are complete.
Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various changes or modifications within the scope of the appended claims.