CN114338556A - Message forwarding method between CAN network and vehicle-mounted Ethernet and gateway system - Google Patents

Message forwarding method between CAN network and vehicle-mounted Ethernet and gateway system Download PDF

Info

Publication number
CN114338556A
CN114338556A CN202210014868.1A CN202210014868A CN114338556A CN 114338556 A CN114338556 A CN 114338556A CN 202210014868 A CN202210014868 A CN 202210014868A CN 114338556 A CN114338556 A CN 114338556A
Authority
CN
China
Prior art keywords
message
vehicle
messages
network
duration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210014868.1A
Other languages
Chinese (zh)
Inventor
吴凯
王峥
刘华
石江江
周伯寅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanchang Jiling New Energy Technology Co ltd
Original Assignee
Nanchang Jiling New Energy Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanchang Jiling New Energy Technology Co ltd filed Critical Nanchang Jiling New Energy Technology Co ltd
Priority to CN202210014868.1A priority Critical patent/CN114338556A/en
Publication of CN114338556A publication Critical patent/CN114338556A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention relates to the technical field of automobile networks, in particular to a message forwarding method and a gateway system between a CAN (controller area network) and a vehicle-mounted Ethernet. The message forwarding method comprises the following steps: starting timing from the first message to be cached, and acquiring the caching duration; judging whether the cache duration is less than the reference cache duration; when the cache duration is not less than the reference cache duration, forwarding all cached messages; when the cache duration is less than the reference cache duration, judging whether the number of all cached messages is less than the reference cache number; when the number of all cached messages is not less than the reference cache number, forwarding all cached messages; and when the number of all the cached messages is less than the reference caching number, continuing caching the messages. According to the message forwarding method, the number of CAN network frames and vehicle-mounted Ethernet packets in the bus network is reduced and the bandwidth utilization rate of the bus network is improved by the method of caching and forwarding the messages with consistent target addresses in a time-limited and limited manner.

Description

Message forwarding method between CAN network and vehicle-mounted Ethernet and gateway system
Technical Field
The invention relates to the technical field of automobile networks, in particular to a message forwarding method and a gateway system between a CAN (controller area network) and a vehicle-mounted Ethernet.
Background
In the field of automotive electronics and electrical architecture, on-board networks have been an important infrastructure. At present, the mainstream vehicle-mounted networks mainly include CAN, LIN, FlexRay, MOST and the like. Among them, the CAN bus network is the most widely used network standard in the automotive electronics industry. The CAN bus network has the advantages of high real-time performance, long transmission distance, strong anti-electromagnetic interference capability, low cost and the like, and the CAN bus CAN well meet the control data transmission requirements among the traditional vehicle-mounted ECUs. However, with the rapid development of semiconductor and information technology industries, the application of electronic control products and information products of automobiles in the whole automobile is increasing day by day, and the network bandwidth requirement for connecting the ECU is higher and higher. The next generation of automobiles is developing towards the direction of electromotion, networking, intellectualization and automation, and the vehicle-mounted Ethernet is produced under the background. The method can not only provide bandwidth of hundreds of megabytes or even gigabytes, but also reduce the cost of wire harnesses, and can connect the automobile with the existing Internet to construct an automobile networking ecology oriented to a service architecture.
The new generation of automotive networks is necessarily a network in which a CAN bus network and a vehicle ethernet coexist. Therefore, a gateway is needed to communicate the traditional CAN bus network data with the modern vehicle-mounted ethernet network data, but most of the existing gateways forward the vehicle-mounted ethernet packets based on one-to-one CAN network frames, and when a large amount of messages need to be transmitted, the number of the CAN network frames and the vehicle-mounted ethernet packets is too large due to excessive use of frame header headers, which causes a problem of low network bandwidth utilization rate.
Disclosure of Invention
Based on this, it is necessary to provide a method for forwarding a packet between a CAN network and a vehicle-mounted ethernet and a gateway system, which are based on a mechanism of buffer amount and duration, reduce the number of CAN network frames and vehicle-mounted ethernet packets, and improve the bandwidth utilization rate of a CAN bus network.
A message forwarding method between a CAN network and a vehicle-mounted Ethernet comprises the following steps:
providing reference cache duration and reference cache quantity;
starting timing from the first message to be cached, and acquiring the caching duration;
judging whether the cache duration is smaller than the reference cache duration;
when the cache duration is not less than the reference cache duration, forwarding all cached messages;
when the cache duration is less than the reference cache duration, judging whether the number of all cached messages is less than the reference cache number;
when the number of all cached messages is not less than the reference cache number, forwarding all cached messages;
and when the number of all cached messages is smaller than the reference cache number, continuing caching the messages.
In one embodiment, all the cached messages have the same destination address.
In one embodiment, the packet forwarding method further includes:
judging whether the target address of the new message is consistent with that of the first message;
and when the target address of the new message is inconsistent with the target address of the first message, taking the new message as a new first message.
In one embodiment, the packet forwarding method further includes:
the CAN frame message is packaged according to a method of placing the frame identifier, the data length and the data in a data area of the vehicle-mounted Ethernet packet in parallel.
A gateway system between a CAN network and a vehicle-mounted Ethernet uses the message forwarding method described in any one of the above embodiments to forward a message.
According to the message forwarding method and the gateway system between the CAN network and the vehicle-mounted Ethernet, the number of CAN network frames and vehicle-mounted Ethernet packets in the bus network is reduced and the bandwidth utilization rate of the bus network is improved by the method of caching and forwarding the messages with consistent target addresses in a time-limited and limited manner.
Drawings
FIG. 1 is a flow chart of a method for forwarding messages between a CAN network and a vehicular Ethernet network in one embodiment;
FIG. 2 is a diagram illustrating a message forwarding method between a CAN network and a vehicle Ethernet in one embodiment;
FIG. 3 is a diagram illustrating packaging of a CAN frame message according to one embodiment by sequentially juxtaposing a frame identifier, a data length, and data in a data field of an on-board Ethernet packet;
fig. 4 is a schematic diagram of a gateway system between a CAN network and a vehicle ethernet in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Fig. 1 is a flowchart of a message forwarding method between a CAN network and a vehicle-mounted ethernet in an embodiment, and as shown in fig. 1, the message forwarding method between the CAN network and the vehicle-mounted ethernet includes:
s10, providing a reference cache duration Tr and a reference cache number Nr;
specifically, the reference buffer duration Tr and the reference buffer number Nr may be selected according to the required bandwidth utilization rate of the CAN bus network and the message forwarding timeliness rate.
S20, starting timing from the first message to obtain the buffer time T;
s30, judging whether the cache duration T is smaller than the reference cache duration Tr;
s40, when the cache duration T is not less than the reference cache duration Tr, namely T is more than or equal to Tr, forwarding all cached messages and restarting to cache a new first message;
s50, when the cache duration T is less than the reference cache duration Tr, that is, T is less than Tr, judging whether the number N of all cached messages is less than the reference cache number Nr;
s60, when the number N of all the cached messages is not less than the number Nr of the reference cache, namely N is not less than Nr, forwarding all the cached messages and restarting caching a new first message;
s70, when the number N of all the buffered packets is smaller than the reference buffer number Nr, that is, N is smaller than Nr, continuing to buffer the packets until the new buffer duration is not smaller than the reference buffer duration Tr, or the new buffer number is not smaller than the reference buffer number Nr.
It should be noted that the present invention does not require to first determine the size relationship between the cache duration T and the reference cache duration Tr, or to first determine the size relationship between all the cached packet numbers N and the reference cache number Nr. Or judging whether the number N of all cached messages is smaller than the reference cache number Nr, when the number N of all cached messages is smaller than the reference cache number Nr, that is, N is smaller than Nr, judging whether the cache duration T is smaller than the reference cache duration Tr, and when the cache duration T is smaller than the reference cache duration Tr, that is, T is smaller than Tr, continuing to cache the messages; otherwise, all the cached messages are forwarded, and the caching of a new first message is restarted.
In one embodiment, all the cached messages have the same destination address.
In one embodiment, the packet forwarding method may further include:
judging whether the target address of the new message is consistent with that of the first message;
and when the target address of the new message is inconsistent with the target address of the first message, taking the new message as a new first message.
Specifically, according to the corresponding relationship between the source address and the target address, the messages with consistent target addresses are respectively cached and forwarded according to the message forwarding method.
Fig. 2 is a schematic diagram of a message forwarding method between a CAN network and a vehicle ethernet in an embodiment, as shown in fig. 2, and in an embodiment, as shown in fig. 4, the reference buffer number Nr is set to be 5, and the reference buffer duration Tr is set to be 5 ms. After a gateway between a CAN network and a vehicle-mounted Ethernet receives CAN frame messages 1 and messages 2 with the same target address, the gateway immediately sends out the vehicle-mounted Ethernet packets in which the messages 1 and the messages 2 are cached because no more messages are received and the reference caching time length Tr (5ms) is reached; when the gateway receives the CAN frame messages 3, 4, 5, 6 and 7 with the same destination address and the reference buffer number Nr (5), the gateway immediately sends out the Ethernet packets in which the messages 3, 4, 5, 6 and 7 are buffered even if the buffer time length T does not exceed 5 ms.
In one embodiment, the packet forwarding method may further include:
and packaging the CAN frame message according to a method of sequentially placing the frame identifier, the data length and the data in a data area of the vehicle-mounted Ethernet packet in parallel.
It should be noted that the present invention does not require the frame identifier, the data length, and the placement order of the data.
Fig. 3 is a schematic diagram of a CAN frame message packaged according to a method of placing a frame identifier, a data length and data in a data area of an on-vehicle ethernet packet in parallel, as shown in fig. 3, the data of the on-vehicle ethernet packet is composed of a destination address of 6 bytes, a source address of 6 bytes, a type of 2 bytes, data of 46 to 1500 bytes and a frame check of 4 bytes. The data of the CAN network consists of a start of frame bit SOF, an 11-bit CAN _ ID, a remote transmission request bit RTR, an ID extension bit IDE, an extension frame retention bit r, a data length DLC, 0 to 8 bytes of data, a cyclic redundancy check CRC, an acknowledgement bit ACK, and an end of frame bit EOF.
When a gateway between a CAN network and a vehicle-mounted Ethernet receives a CAN frame message which is sent by an ECU on a CAN bus and needs to be forwarded to the ECU at the vehicle-mounted Ethernet side, CAN _ ID, DLC and DATA in the CAN frame message are merged and placed in a DATA area of a vehicle-mounted Ethernet packet, a target address of a target ECU is configured, the CAN _ ID, DLC and DATA are sent to the vehicle-mounted Ethernet from an Ethernet port end of the gateway, and the target ECU receives and analyzes the CAN _ ID, DLC and DATA in the DATA area.
Similarly, when the gateway receives a vehicle-mounted Ethernet Data message which is sent by the ECU on the Ethernet and needs to be forwarded to the ECU on the CAN bus network side, the Data in the Data area is analyzed according to the formats of two bytes CAN _ ID, 1 byte DLC and 0 to 8 bytes of Data, a CAN bus network port needing to be forwarded is determined according to the CAN _ ID, DLC and Data are framed and sent to a target CAN bus network according to the CAN standard frame format, and the target ECU receives the CAN frame and then analyzes the Data length and the corresponding Data in the CAN frame.
A gateway system between a CAN network and a vehicle-mounted Ethernet uses the message forwarding method described in any one of the above embodiments to forward a message.
Specifically, the hardware interface has a CAN network interface and a vehicle-mounted Ethernet interface, and the software interface has a gateway function of bidirectional message routing of the CAN network interface and the vehicle-mounted Ethernet interface.
The gateway system receives the message from the CAN network interface and looks in the direction from the route to the Ethernet interface: after a CAN bus controller receives messages of a CAN bus, a gateway routing program caches DATA of the messages with consistent target addresses according to the corresponding relation between a source address and a target address, packages the DATA according to a method that a frame identifier CAN _ ID, a DATA length DLC and DATA DATA are combined and placed in a DATA area of a vehicle-mounted Ethernet message, and forwards the DATA to the vehicle-mounted Ethernet bus according to the conditions of the set reference cache number Nr and the set reference cache duration Tr.
Fig. 4 is a schematic diagram of a gateway system between a CAN network and a vehicle ethernet in an embodiment, and as shown in fig. 4, the gateway system between the CAN network and the vehicle ethernet may include:
the vehicle-mounted Ethernet-CAN gateway, a 100BASE-T1 vehicle-mounted Ethernet bus, an ECU hung on the bus, a power CAN and a vehicle body CAN bus network.
Specifically, on the vehicle-mounted Ethernet side, each node ECU is respectively connected with a single network port of the vehicle-mounted Ethernet-CAN gateway through a physical transceiver of 100BASE-T1 and a single-pair unshielded twisted pair. And the data exchange of the node ECU at the vehicle-mounted Ethernet side is realized through an Ethernet exchange module on the gateway.
Furthermore, one side of the CAN bus network CAN be provided with a plurality of CAN buses, and ECUs with the same functional domain are mounted on the same bus network and matched with corresponding bus baud rates. For example, a battery management system, a motor control unit MCU, a vehicle control unit VCU and the like are mounted on a CAN bus in a power domain, and the Baud rate of the bus of 500kbps is matched; and a vehicle body controller BCM, an air conditioner control ACM, an instrument panel ICM and the like are hung on a vehicle body area CAN bus, and the bus baud rate of 250kbps is matched. The data of the node ECU at the CAN bus side is realized through a CAN message forwarding module on the gateway.
And finally, the data on one side of the vehicle-mounted Ethernet and the data on one side of the CAN bus network are realized through a vehicle-mounted Ethernet-CAN conversion module.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (5)

1. A message forwarding method between a CAN network and a vehicle-mounted Ethernet is characterized by comprising the following steps:
providing reference cache duration and reference cache quantity;
starting timing from the first message to be cached, and acquiring the caching duration;
judging whether the cache duration is smaller than the reference cache duration;
when the cache duration is not less than the reference cache duration, forwarding all cached messages;
when the cache duration is less than the reference cache duration, judging whether the number of all cached messages is less than the reference cache number;
when the number of all cached messages is not less than the reference cache number, forwarding all cached messages;
and when the number of all cached messages is smaller than the reference cache number, continuing caching the messages.
2. The message forwarding method according to claim 1, wherein all the buffered messages have the same destination address.
3. The message forwarding method according to claim 2, wherein the message forwarding method further comprises:
judging whether the target address of the new message is consistent with that of the first message;
and when the target address of the new message is inconsistent with the target address of the first message, taking the new message as a new first message.
4. The message forwarding method according to claim 1, wherein the message forwarding method further comprises:
the CAN frame message is packaged according to a method of placing the frame identifier, the data length and the data in a data area of the vehicle-mounted Ethernet packet in parallel.
5. A gateway system between a CAN network and a vehicle-mounted Ethernet, characterized in that the message forwarding method according to claims 1-4 is used for forwarding the message.
CN202210014868.1A 2022-01-07 2022-01-07 Message forwarding method between CAN network and vehicle-mounted Ethernet and gateway system Pending CN114338556A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210014868.1A CN114338556A (en) 2022-01-07 2022-01-07 Message forwarding method between CAN network and vehicle-mounted Ethernet and gateway system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210014868.1A CN114338556A (en) 2022-01-07 2022-01-07 Message forwarding method between CAN network and vehicle-mounted Ethernet and gateway system

Publications (1)

Publication Number Publication Date
CN114338556A true CN114338556A (en) 2022-04-12

Family

ID=81025361

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210014868.1A Pending CN114338556A (en) 2022-01-07 2022-01-07 Message forwarding method between CAN network and vehicle-mounted Ethernet and gateway system

Country Status (1)

Country Link
CN (1) CN114338556A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115150187A (en) * 2022-07-28 2022-10-04 中汽创智科技有限公司 Vehicle-mounted bus message security detection method and device, vehicle-mounted terminal and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103684944A (en) * 2012-09-10 2014-03-26 西门子信号有限公司 Embedded gateway, railway monitoring system adopting gateway, and railway monitoring method
CN106528866A (en) * 2016-12-02 2017-03-22 郑州云海信息技术有限公司 Method, device and system for updating metadata
CN106961437A (en) * 2017-03-24 2017-07-18 华东师范大学 CAN and Ethernet hybrid network gateway network management device and its exchange method
CN107124344A (en) * 2017-04-28 2017-09-01 中车青岛四方车辆研究所有限公司 Train is changed and data storage control method with CAN ethernet communications
WO2018120705A1 (en) * 2016-12-29 2018-07-05 深圳前海弘稼科技有限公司 Data processing method, apparatus and system
CN109819524A (en) * 2017-11-22 2019-05-28 华为技术有限公司 Message processing method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103684944A (en) * 2012-09-10 2014-03-26 西门子信号有限公司 Embedded gateway, railway monitoring system adopting gateway, and railway monitoring method
CN106528866A (en) * 2016-12-02 2017-03-22 郑州云海信息技术有限公司 Method, device and system for updating metadata
WO2018120705A1 (en) * 2016-12-29 2018-07-05 深圳前海弘稼科技有限公司 Data processing method, apparatus and system
CN106961437A (en) * 2017-03-24 2017-07-18 华东师范大学 CAN and Ethernet hybrid network gateway network management device and its exchange method
CN107124344A (en) * 2017-04-28 2017-09-01 中车青岛四方车辆研究所有限公司 Train is changed and data storage control method with CAN ethernet communications
CN109819524A (en) * 2017-11-22 2019-05-28 华为技术有限公司 Message processing method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115150187A (en) * 2022-07-28 2022-10-04 中汽创智科技有限公司 Vehicle-mounted bus message security detection method and device, vehicle-mounted terminal and storage medium
CN115150187B (en) * 2022-07-28 2024-04-26 中汽创智科技有限公司 Vehicle-mounted bus message security detection method and device, vehicle-mounted terminal and storage medium

Similar Documents

Publication Publication Date Title
US10382221B2 (en) Communication method based on automotive safety integrity level in vehicle network and apparatus for the same
ES2929124T3 (en) Method for data transmission via a serial communication bus, correspondingly designed bus interface and correspondingly designed computer program
US7801173B2 (en) Communication message conversion apparatus and communication message conversion method
US10574348B2 (en) Method for time synchronization between communication nodes in network
US10153825B2 (en) Vehicle-mounted control device
WO2017090351A1 (en) Vehicle-mounted gateway device, electronic control device, and vehicle-mounted network system
US20200382597A1 (en) Vehicle diagnostic communication apparatus, system including the same and method thereof
KR20160096526A (en) Method for diagnosing network and apparatus for the same
CN114422289B (en) Method and device for transmitting CAN message of electric automobile
CN114545906A (en) Vehicle-mounted Ethernet gateway and vehicle
WO2024037303A1 (en) Vehicle diagnosis method, apparatus and device, readable storage medium and program product
CN114338556A (en) Message forwarding method between CAN network and vehicle-mounted Ethernet and gateway system
CN109660436B (en) Dual-CAN channel data processing method, gateway equipment and system
Cook et al. Controller area network (CAN)
CN115051975A (en) ECU remote upgrading method based on vehicle-mounted Ethernet
CN108880965B (en) Power CAN gateway for automatically driving automobile and implementation method thereof
Strobl et al. Using Ethernet over powerline communication in automotive networks
An et al. Analysis of CAN FD to CAN message routing method for CAN FD and CAN gateway
KR102362611B1 (en) Method for transmitting and receiving data in automotive network and apparatus for the same
Pradeep CAN-FD and ethernet create fast reliable automotive data buses for the next decade
KR20200041614A (en) Lightweight In-Vehicle Edge Gateway Method for essential for the Self-dignosis of an Autonomous Vehicle
KR20190081945A (en) Gateway for vehicle Ethernet communication and message routing method thereof
CN111163106B (en) High-speed network preprocessing device based on world gateway
CN114584590B (en) Data transmission method, system, device and storage medium
CN110505641B (en) Method for improving ZigBee master-slave communication polling efficiency by utilizing full-duplex UART communication and coordinator thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination