WO2023134428A1 - Can通信方法、电子设备及can通信系统 - Google Patents

Can通信方法、电子设备及can通信系统 Download PDF

Info

Publication number
WO2023134428A1
WO2023134428A1 PCT/CN2022/141599 CN2022141599W WO2023134428A1 WO 2023134428 A1 WO2023134428 A1 WO 2023134428A1 CN 2022141599 W CN2022141599 W CN 2022141599W WO 2023134428 A1 WO2023134428 A1 WO 2023134428A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
node
bus
message identifier
communication matrix
Prior art date
Application number
PCT/CN2022/141599
Other languages
English (en)
French (fr)
Inventor
周艳
邱建
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023134428A1 publication Critical patent/WO2023134428A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40006Architecture of a communication node
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Definitions

  • the application belongs to the technical field of communication, and in particular relates to a CAN communication method, electronic equipment and a CAN communication system.
  • the controller area network (CAN) communication system can be widely used in automotive internal communication and other industrial field scenarios.
  • the CAN communication system may include a CAN bus, and at least two electronic control units (electronic control unit, ECU) or micro control units (micro controller unit, MCU) connected to the CAN bus.
  • ECU electronic control unit
  • MCU micro controller unit
  • each ECU/MCU transmits and receives data on the CAN bus according to a predefined communication matrix. Newly added hardware devices cannot be connected to the CAN bus and cannot communicate with other ECUs/MCUs on the CAN bus.
  • the embodiment of the present application provides a CAN communication method, electronic equipment and CAN communication system, which can solve the problem that in the existing CAN communication system, the newly added hardware equipment cannot be connected to the CAN bus, and cannot communicate with other ECU/MCU on the CAN bus communication problem.
  • the embodiment of the present application provides a CAN communication method, which is applied to a CAN communication system of a controller area network.
  • the CAN communication system includes a first device, a second device, a CAN bus, and at least one device connected to the CAN bus.
  • Two CAN nodes, the at least two CAN nodes include a first CAN node and a second CAN node, the first device is connected to the first CAN node through a communication network, and the second CAN node is used to control the
  • the CAN communication system is provided with a virtual communication matrix, and the virtual communication matrix is obtained by expanding the original communication matrix of the CAN communication system according to the first device, and the method may include:
  • the first CAN node acquires first data, the first data is sent by the first device, and the first data is used to instruct the second device to perform a corresponding interactive operation;
  • the first CAN node determines whether the first data is data allowed to be sent on the CAN bus according to the virtual communication matrix
  • the first CAN node When the first data is data that is allowed to be sent on the CAN bus, the first CAN node sends the first data to the CAN bus, so that the second CAN node transmits the data from the CAN bus Acquire the first data, and control the second device to perform a corresponding interactive operation according to the first data.
  • the first device when the first device needs to be added to the CAN bus, the first device can be connected to the first CAN node in the CAN communication system through the communication network, and can be connected to the CAN communication system according to the first device.
  • the original communication matrix is expanded to obtain a virtual communication matrix, so that the first device can be dynamically added to the CAN communication system according to the virtual communication matrix, so that the first device can communicate with other CAN nodes on the CAN bus through the first CAN node, so that The first device can send the first data to the CAN bus through the first CAN node, so that the second CAN node can obtain the first data sent by the first device from the CAN bus, and can control the corresponding second device to execute according to the first data
  • Interactive operation realizes the purpose of the first device interacting with other devices on the CAN bus, expands the application range of the CAN communication system, and improves user experience.
  • the at least two CAN nodes further include a third CAN node, and the method may further include:
  • the first CAN node acquires second data from the CAN bus, the second data is sent by the third CAN node, and the second data is used to instruct the first device to perform a corresponding interactive operation ;
  • the first CAN node determines whether the second data is data that is allowed to be received by the first device according to the virtual communication matrix
  • the first CAN node When the second data is data that the first device is allowed to receive, the first CAN node sends the second data to the first device, so that the first device according to the second data Perform the appropriate interaction.
  • the third CAN node and the second CAN node may be the same CAN node or different CAN nodes.
  • the first CAN node can obtain the second data sent by other CAN nodes from the CAN bus, and can send the second data to the first device according to the virtual communication matrix, so that the first The device can perform corresponding interactive operations according to the second data, realize the purpose of interaction between other devices on the CAN bus and the first device, expand the application range of the CAN communication system, and improve user experience.
  • the virtual communication matrix is based on the original communication matrix, adding the definition of the first message identifier and the message identifier of the data received by the first interaction device Adding the first message identifier, and/or on the basis of the original communication matrix, adding the definition of the second message identifier and adding in the CAN node where the data sent by the second interaction device is received said first CAN node;
  • the first message identifier is a message identifier of data that is allowed to be sent by the first device
  • the second message identifier is a message identifier of data that is allowed to be received by the first device
  • the first interactive device and the second interactive device are devices that interact with the first device in the CAN communication system
  • the first interactive device includes the second device
  • the first A second interactive device includes said second device.
  • first reserved data and/or second reserved data are also defined in the virtual communication matrix, and the first reserved data is to allow the first device to pass through the first CAN node in the The data sent on the CAN bus, the second reserved data is data that allows the first device to obtain from the CAN bus through the first CAN node.
  • the first device in order to avoid the illegal use of the CAN bus by the first device to ensure the security of the CAN communication system, when the first device is added to the CAN communication system, the first device can be allowed to receive data and/or data allowed to be sent. That is, the MsgID of the data that the first device is allowed to send and/or the specific content of the data that is allowed to be sent can be restricted through the virtual communication matrix, and/or the MsgID of the data that the first device is allowed to receive and/or the specific content of the data that is allowed to be received can be restricted.
  • the specific content is limited, so as to limit the data that the first device allows to send to the CAN bus, and/or limit the data that the first device allows to obtain from the CAN bus, so as to prevent the first device from sending malicious data to the CAN bus and reduce malicious
  • the security threat brought by the data to the CAN communication system can prevent the data transmitted in the CAN bus from being leaked or illegally tampered with, and improve the security of the CAN communication system.
  • the first CAN node determines whether the first data is data allowed to be sent on the CAN bus according to the virtual communication matrix, which may include:
  • the first CAN node obtains the message identifier of the first data
  • the first CAN node determines whether the message identifier of the first data is the first message identifier defined in the virtual communication matrix
  • the first CAN node determines that the first data is allowed to be sent on the CAN bus.
  • the first CAN node after the first CAN node receives the first data, it can perform a safety protection check according to the first MsgID defined in the virtual communication matrix, that is, it can obtain the MsgID in the first data, and determine Whether the MsgID of the first data is the first MsgID defined in the virtual communication matrix.
  • the first CAN node may determine that the first data is allowed to be sent on the CAN bus, and send the first data to the CAN bus.
  • the first CAN node will not send the first data to the CAN bus, so as to avoid forwarding the malicious data sent by the first device to the CAN bus, reducing the impact on The CAN communication system brings security threats and improves the security of the CAN communication system.
  • the first CAN node determines whether the first data is data allowed to be sent on the CAN bus according to the virtual communication matrix, which may include:
  • the first CAN node obtains the message identifier of the first data
  • the first CAN node determines whether the message identifier of the first data is a first message identifier defined in the virtual communication matrix, and determines whether the first data is a message identifier defined in the virtual communication matrix
  • the first CAN node determines that the first data is allow data to be sent on the CAN bus.
  • the first CAN node after the first CAN node receives the first data, it can perform a security protection check according to the first MsgID and the first reserved data defined in the virtual communication matrix, that is, the first data can be obtained MsgID and specific content in the first data, and determine whether the MsgID of the first data is the first MsgID defined in the virtual communication matrix and whether the specific content is the first reserved data defined in the virtual communication matrix.
  • the first CAN node can determine that the first data is allowed on the CAN bus and send the first data to the CAN bus.
  • the first CAN node will not send the first data to the CAN bus, so as to avoid forwarding the malicious data sent by the first device to the CAN bus, reducing the impact on The security threat brought by the CAN communication system improves the security of the CAN communication system.
  • the first CAN node sending the first data to the CAN bus may include:
  • the first CAN node encapsulates the first data according to the data structure corresponding to the CAN bus to obtain third data;
  • the first CAN node sends the third data to the CAN bus.
  • the transmission protocol between the first device and the first CAN node can be modified, that is, the MsgID and data segment corresponding to the CAN data frame can be added to the first data transmitted based on the communication network ( data) content. Therefore, when the first data sent by the first device needs to be sent to the CAN bus, the MsgID and the content of the data segment (data) in the first data can be obtained, and the MsgID and data can be processed according to the data structure corresponding to the CAN bus. The content of the segment (data) is encapsulated to obtain third data that can be broadcast on the CAN bus, so that the data sent by the first device can be broadcast on the CAN bus.
  • the first CAN node determines whether the second data is data that is allowed to be received by the first device according to the virtual communication matrix, which may include:
  • the first CAN node obtains the message identifier of the second data
  • the first CAN node determines whether the message identifier of the second data is a second message identifier defined in the virtual communication matrix
  • the first CAN node determines that the second data is data that is allowed to be received by the first device.
  • the first CAN node after the first CAN node receives the second data, it can perform security protection checks according to the second MsgID defined in the virtual communication matrix, so as to prevent the data transmitted in the CAN bus from being leaked or stolen. Illegal tampering improves the security of the CAN communication system.
  • the first CAN node determines whether the second data is data that is allowed to be received by the first device according to the virtual communication matrix, which may include:
  • the first CAN node obtains the message identifier of the second data
  • the first CAN node determines whether the message identifier of the second data is a second message identifier defined in the virtual communication matrix, and determines whether the second data is a message identifier defined in the virtual communication matrix The second reserved data;
  • the first CAN node determines that the second data is Allow the first device to receive data.
  • the first CAN node after the first CAN node receives the second data, it can perform security protection checks according to the second MsgID and the second reserved data defined in the virtual communication matrix, so as to avoid transmission in the CAN bus The data is leaked or illegally tampered with, improving the security of the CAN communication system.
  • the first CAN node sending the second data to the first device may include:
  • the first CAN node encapsulates the second data according to the data structure corresponding to the communication network to obtain fourth data;
  • the first CAN node sends the fourth data to the first device.
  • the MsgID and the content of the data segment (data) in the second data can be obtained, and according to the first
  • the data structure corresponding to the communication network between the device and the first CAN node encapsulates the MsgID and the content of the data segment (data) to obtain data that can be transmitted to the first device through the communication network.
  • the embodiment of the present application provides a CAN communication method, which is applied to a CAN communication system of a controller area network.
  • the CAN communication system includes a first device, a second device, a CAN bus, and at least one device connected to the CAN bus.
  • Two CAN nodes, the at least two CAN nodes include a first CAN node and a second CAN node, the first device is connected to the first CAN node through a communication network, and the second CAN node is used to control the
  • the CAN communication system is provided with a virtual communication matrix, and the virtual communication matrix is obtained by expanding the original communication matrix of the CAN communication system according to the first device, and the method may include:
  • the first CAN node acquires second data from the CAN bus, the second data is sent by the second CAN node, and the second data is used to instruct the first device to perform a corresponding interactive operation ;
  • the first CAN node determines whether the second data is data that is allowed to be received by the first device according to the virtual communication matrix
  • the first CAN node When the second data is data that the first device is allowed to receive, the first CAN node sends the second data to the first device, so that the first device according to the second data Perform the appropriate interaction.
  • the at least two CAN nodes further include a third CAN node, and the method may further include:
  • the first CAN node acquires first data, the first data is sent by the first device, and the first data is used to instruct the second device to perform a corresponding interactive operation;
  • the first CAN node determines whether the first data is data allowed to be sent on the CAN bus according to the virtual communication matrix
  • the first CAN node When the first data is data that is allowed to be sent on the CAN bus, the first CAN node sends the first data to the CAN bus, so that the third CAN node transmits the data from the CAN bus Acquire the first data, and control the second device to perform a corresponding interactive operation according to the first data.
  • the virtual communication matrix is based on the original communication matrix, adding the definition of the first message identifier and the message identifier of the data received by the first interaction device Adding the first message identifier, and/or on the basis of the original communication matrix, adding the definition of the second message identifier and adding in the CAN node where the data sent by the second interaction device is received said first CAN node;
  • the first message identifier is a message identifier of data that is allowed to be sent by the first device
  • the second message identifier is a message identifier of data that is allowed to be received by the first device
  • the first interactive device and the second interactive device are devices that interact with the first device in the CAN communication system
  • the first interactive device includes the second device
  • the first A second interactive device includes said second device.
  • first reserved data and/or second reserved data are further defined in the virtual communication matrix, and the first reserved data is to allow the first device to pass through the The data sent by the first CAN node on the CAN bus, and the second reserved data is data that allows the first device to obtain from the CAN bus through the first CAN node.
  • the first CAN node determines whether the first data is data allowed to be sent on the CAN bus according to the virtual communication matrix, which may include:
  • the first CAN node obtains the message identifier of the first data
  • the first CAN node determines whether the message identifier of the first data is the first message identifier defined in the virtual communication matrix
  • the first CAN node determines that the first data is allowed to be sent on the CAN bus.
  • the first CAN node determines whether the first data is data allowed to be sent on the CAN bus according to the virtual communication matrix, which may include:
  • the first CAN node obtains the message identifier of the first data
  • the first CAN node determines whether the message identifier of the first data is a first message identifier defined in the virtual communication matrix, and determines whether the first data is a message identifier defined in the virtual communication matrix
  • the first CAN node determines that the first data is allow data to be sent on the CAN bus.
  • the first CAN node sending the first data to the CAN bus may include:
  • the first CAN node encapsulates the first data according to the data structure corresponding to the CAN bus to obtain third data;
  • the first CAN node sends the third data to the CAN bus.
  • the first CAN node determines whether the second data is data that is allowed to be received by the first device according to the virtual communication matrix, which may include:
  • the first CAN node obtains the message identifier of the second data
  • the first CAN node determines whether the message identifier of the second data is a second message identifier defined in the virtual communication matrix
  • the first CAN node determines that the second data is data that is allowed to be received by the first device.
  • the first CAN node determines whether the second data is data that is allowed to be received by the first device according to the virtual communication matrix, which may include:
  • the first CAN node obtains the message identifier of the second data
  • the first CAN node determines whether the message identifier of the second data is a second message identifier defined in the virtual communication matrix, and determines whether the second data is a message identifier defined in the virtual communication matrix The second reserved data;
  • the first CAN node determines that the second data is Allow the first device to receive data.
  • the first CAN node sending the second data to the first device may include:
  • the first CAN node encapsulates the second data according to the data structure corresponding to the communication network to obtain fourth data;
  • the first CAN node sends the fourth data to the first device.
  • the embodiment of the present application provides a CAN communication device, which is applied to a CAN communication system of a controller area network.
  • the CAN communication system includes a first device, a second device, a CAN bus, and at least one device connected to the CAN bus.
  • Two CAN nodes, the at least two CAN nodes include a first CAN node and a second CAN node, the first device is connected to the first CAN node through a communication network, and the second CAN node is used to control the
  • the CAN communication system is provided with a virtual communication matrix, and the virtual communication matrix is obtained by expanding the original communication matrix of the CAN communication system according to the first device, and the device may include:
  • a first data acquisition module configured to acquire first data, the first data is sent by the first device, and the first data is used to instruct the second device to perform a corresponding interactive operation;
  • a first data determination module configured to determine whether the first data is data allowed to be sent on the CAN bus according to the virtual communication matrix
  • a first data sending module configured to send the first data to the CAN bus when the first data is data that is allowed to be sent on the CAN bus, so that the second CAN node transmits the data from the CAN bus
  • the CAN bus acquires the first data, and controls the second device to perform corresponding interactive operations according to the first data.
  • the at least two CAN nodes further include a third CAN node
  • the device may further include:
  • the second data acquisition module is configured to acquire second data from the CAN bus, the second data is sent by the third CAN node, and the second data is used to instruct the first device to perform the corresponding interactive operation;
  • a second data determining module configured to determine whether the second data is data that is allowed to be received by the first device according to the virtual communication matrix
  • a second data sending module configured to send the second data to the first device when the second data is data that is allowed to be received by the first device, so that the first device transmits the second data according to the first device
  • the two data perform corresponding interactive operations.
  • the virtual communication matrix is based on the original communication matrix, adding the definition of the first message identifier and the message identifier of the data received by the first interaction device Adding the first message identifier, and/or on the basis of the original communication matrix, adding the definition of the second message identifier and adding in the CAN node where the data sent by the second interaction device is received said first CAN node;
  • the first message identifier is a message identifier of data that is allowed to be sent by the first device
  • the second message identifier is a message identifier of data that is allowed to be received by the first device
  • the first interactive device and the second interactive device are devices that interact with the first device in the CAN communication system
  • the first interactive device includes the second device
  • the first A second interactive device includes said second device.
  • first reserved data and/or second reserved data are further defined in the virtual communication matrix, and the first reserved data is to allow the first device to pass through the The data sent by the first CAN node on the CAN bus, and the second reserved data is data that allows the first device to obtain from the CAN bus through the first CAN node.
  • the first data determination module may include:
  • a first identifier obtaining unit configured to obtain a message identifier of the first data
  • a first identifier determining unit configured to determine whether the packet identifier of the first data is a first packet identifier defined in the virtual communication matrix
  • the first data determining unit is configured to determine that the first data is allowed to be sent on the CAN bus when the message identifier of the first data is the first message identifier.
  • the first data determination module may further include:
  • a second identifier obtaining unit configured to obtain a message identifier of the first data
  • a second identifier determining unit configured to determine whether the packet identifier of the first data is a first packet identifier defined in the virtual communication matrix, and determine whether the first data is the virtual communication the first reserved data defined in the matrix;
  • the second data determining unit is configured to determine the first data when the message identifier of the first data is the first message identifier and the first data is the first reserved data.
  • Data is data allowed to be sent on said CAN bus.
  • the first data sending module may include:
  • the first data encapsulation unit is used for encapsulating the first data according to the data structure corresponding to the CAN bus to obtain the third data;
  • a first sending unit configured to send the third data to the CAN bus.
  • the second data determination module may include:
  • a third identifier obtaining unit configured to obtain a message identifier of the second data
  • a third identifier determining unit configured to determine whether the packet identifier of the second data is a second packet identifier defined in the virtual communication matrix
  • a third data determining unit configured to determine that the second data is data that is allowed to be received by the first device when the packet identifier of the second data is the second packet identifier.
  • the second data determination module may include:
  • a fourth identifier obtaining unit configured to obtain a message identifier of the second data
  • a fourth identifier determining unit configured to determine whether the packet identifier of the second data is a second packet identifier defined in the virtual communication matrix, and determine whether the second data is the virtual communication Second reserved data defined in the matrix;
  • a fourth data determining unit configured to determine the second data when the message identifier of the second data is the second message identifier and the second data is the second reserved data
  • the data is data that the first device is allowed to receive.
  • the second data sending module may include:
  • a second data encapsulation unit configured to encapsulate the second data according to a data structure corresponding to the communication network to obtain fourth data
  • a second sending unit configured to send the fourth data to the first device.
  • the embodiment of the present application provides a CAN communication device, which is applied to a CAN communication system of a controller area network.
  • the CAN communication system includes a first device, a second device, a CAN bus, and at least one device connected to the CAN bus.
  • Two CAN nodes, the at least two CAN nodes include a first CAN node and a second CAN node, the first device is connected to the first CAN node through a communication network, and the second CAN node is used to control the
  • the CAN communication system is provided with a virtual communication matrix, and the virtual communication matrix is obtained by expanding the original communication matrix of the CAN communication system according to the first device, and the device may include:
  • the second data acquisition module is configured to acquire second data from the CAN bus, the second data is sent by the second CAN node, and the second data is used to instruct the first device to perform the corresponding interactive operation;
  • a second data determining module configured to determine whether the second data is data that is allowed to be received by the first device according to the virtual communication matrix
  • a second data sending module configured to send the second data to the first device when the second data is data that is allowed to be received by the first device, so that the first device transmits the second data according to the first device
  • the two data perform corresponding interactive operations.
  • the at least two CAN nodes further include a third CAN node
  • the device further includes:
  • a first data acquisition module configured to acquire first data, the first data is sent by the first device, and the first data is used to instruct the second device to perform a corresponding interactive operation;
  • a first data determination module configured to determine whether the first data is data allowed to be sent on the CAN bus according to the virtual communication matrix
  • a first data sending module configured to send the first data to the CAN bus when the first data is data allowed to be sent on the CAN bus, so that the third CAN node is sent from the CAN bus
  • the CAN bus acquires the first data, and controls the second device to perform corresponding interactive operations according to the first data.
  • the virtual communication matrix is based on the original communication matrix, adding the definition of the first message identifier and the message identifier of the data received by the first interaction device Adding the first message identifier, and/or on the basis of the original communication matrix, adding the definition of the second message identifier and adding in the CAN node where the data sent by the second interaction device is received said first CAN node;
  • the first message identifier is a message identifier of data that is allowed to be sent by the first device
  • the second message identifier is a message identifier of data that is allowed to be received by the first device
  • the first interactive device and the second interactive device are devices that interact with the first device in the CAN communication system
  • the first interactive device includes the second device
  • the first A second interactive device includes said second device.
  • first reserved data and/or second reserved data are further defined in the virtual communication matrix, and the first reserved data is to allow the first device to pass through the The data sent by the first CAN node on the CAN bus, and the second reserved data is data that allows the first device to obtain from the CAN bus through the first CAN node.
  • the first data determination module may include:
  • a first identifier obtaining unit configured to obtain a message identifier of the first data
  • a first identifier determining unit configured to determine whether the packet identifier of the first data is a first packet identifier defined in the virtual communication matrix
  • the first data determining unit is configured to determine that the first data is allowed to be sent on the CAN bus when the message identifier of the first data is the first message identifier.
  • the first data determination module may further include:
  • a second identifier obtaining unit configured to obtain a message identifier of the first data
  • a second identifier determining unit configured to determine whether the packet identifier of the first data is a first packet identifier defined in the virtual communication matrix, and determine whether the first data is the virtual communication the first reserved data defined in the matrix;
  • the second data determining unit is configured to determine the first data when the message identifier of the first data is the first message identifier and the first data is the first reserved data.
  • Data is data allowed to be sent on said CAN bus.
  • the first data sending module may include:
  • a first data encapsulation unit configured to encapsulate the first data according to the data structure corresponding to the CAN bus to obtain third data
  • a first sending unit configured to send the third data to the CAN bus.
  • the second data determination module may include:
  • a third identifier obtaining unit configured to obtain a message identifier of the second data
  • a third identifier determining unit configured to determine whether the packet identifier of the second data is a second packet identifier defined in the virtual communication matrix
  • a third data determining unit configured to determine that the second data is data that is allowed to be received by the first device when the packet identifier of the second data is the second packet identifier.
  • the second data determination module may include:
  • a fourth identifier obtaining unit configured to obtain a message identifier of the second data
  • a fourth identifier determining unit configured to determine whether the packet identifier of the second data is a second packet identifier defined in the virtual communication matrix, and determine whether the second data is the virtual communication Second reserved data defined in the matrix;
  • a fourth data determining unit configured to determine the second data when the message identifier of the second data is the second message identifier and the second data is the second reserved data
  • the data is data that the first device is allowed to receive.
  • the second data sending module may include:
  • the second data encapsulation unit is configured to encapsulate the second data according to the data structure corresponding to the communication network to obtain fourth data;
  • a second sending unit configured to send the fourth data to the first device.
  • the embodiment of the present application provides a CAN communication system, including a first device, a second device, a CAN bus, and at least two CAN nodes connected to the CAN bus, and the at least two CAN nodes include the first A CAN node and a second CAN node, the first device is connected to the first CAN node through a communication network, the second CAN node is used to control the second device, and the CAN communication system is provided with a virtual A communication matrix, the virtual communication matrix is obtained by extending the original communication matrix of the CAN communication system according to the first device;
  • the first device is configured to send first data to the first CAN node, and the first data is used to instruct the second device to perform a corresponding interactive operation;
  • the first CAN node is used to acquire first data, and determine whether the first data is data allowed to be sent on the CAN bus according to the virtual communication matrix;
  • the first CAN node is further configured to send the first data to the CAN bus;
  • the second CAN node is configured to obtain the first data from the CAN bus, and control the second device to perform corresponding interactive operations according to the first data.
  • the at least two CAN nodes further include a third CAN node
  • the third CAN node is used to send second data to the CAN bus, and the second data is used to instruct the first device to perform a corresponding interactive operation;
  • the first CAN node is further configured to obtain the second data from the CAN bus, and determine whether the second data is data that is allowed to be received by the first device according to the virtual communication matrix;
  • the first CAN node is further configured to send the second data to the first device;
  • the first device is configured to receive the second data, and perform a corresponding interaction operation according to the second data.
  • the virtual communication matrix is based on the original communication matrix, adding the definition of the first message identifier and the message identifier of the data received by the first interaction device Adding the first message identifier, and/or on the basis of the original communication matrix, adding the definition of the second message identifier and adding in the CAN node where the data sent by the second interaction device is received said first CAN node;
  • the first message identifier is a message identifier of data that is allowed to be sent by the first device
  • the second message identifier is a message identifier of data that is allowed to be received by the first device
  • the first interactive device and the second interactive device are devices that interact with the first device in the CAN communication system
  • the first interactive device includes the second device
  • the first A second interactive device includes said second device.
  • first reserved data and/or second reserved data are further defined in the virtual communication matrix, and the first reserved data is to allow the first device to pass through the The data sent by the first CAN node on the CAN bus, the second reserved data is data that allows the first device to obtain from the CAN bus through the first CAN node.
  • the first CAN node is also used to acquire the message identifier of the first data, and determine whether the message identifier of the first data is the first one defined in the virtual communication matrix.
  • message identifier ;
  • the first CAN node is further configured to determine that the first data is allowed to be sent on the CAN bus.
  • the first CAN node is further configured to obtain the message identifier of the first data, and determine whether the message identifier of the first data is the first one defined in the virtual communication matrix. A message identifier, and determining whether the first data is the first reserved data defined in the virtual communication matrix;
  • the first CAN node is further configured to determine the first A data is data that is allowed to be sent on the CAN bus.
  • the first CAN node is further configured to encapsulate the first data according to the data structure corresponding to the CAN bus to obtain third data, and send the third data to the CAN bus.
  • the first CAN node is also used to obtain the message identifier of the second data; determine whether the message identifier of the second data is the second message defined in the virtual communication matrix text identifier;
  • the first CAN node is further configured to determine that the second data is data that is allowed to be received by the first device.
  • the first CAN node is also used to obtain the message identifier of the second data; determine whether the message identifier of the second data is the second defined in the virtual communication matrix a message identifier, and determining whether the second data is the second reserved data defined in the virtual communication matrix;
  • the first CAN node is further configured to determine the first The second data is the data that the first device is allowed to receive.
  • the first CAN node is further configured to encapsulate the second data according to the data structure corresponding to the communication network to obtain fourth data, and send the fourth data to the first device .
  • the first device is connected to the first CAN node in a multi-connection manner.
  • a rate adjustment buffer is set in the first CAN node, and the rate adjustment buffer is used to store the first data acquired by the first CAN node.
  • the embodiment of the present application provides a CAN communication system, including a first device, a second device, a CAN bus, and at least two CAN nodes connected to the CAN bus, and the at least two CAN nodes include the first A CAN node and a second CAN node, the first device is connected to the first CAN node through a communication network, the second CAN node is used to control the second device, and the CAN communication system is provided with a virtual A communication matrix, the virtual communication matrix is obtained by extending the original communication matrix of the CAN communication system according to the first device;
  • the second CAN node is used to send second data to the CAN bus, and the second data is used to instruct the first device to perform a corresponding interactive operation;
  • the first CAN node is used to obtain the second data from the CAN bus, and determine whether the second data is data that is allowed to be received by the first device according to the virtual communication matrix;
  • the first CAN node is further configured to send the second data to the first device;
  • the first device is configured to receive the second data, and perform a corresponding interaction operation according to the second data.
  • the at least two CAN nodes further include a third CAN node
  • the first device is configured to send first data to the first CAN node, and the first data is used to instruct the second device to perform a corresponding interactive operation;
  • the first CAN node is used to acquire first data, and determine whether the first data is data allowed to be sent on the CAN bus according to the virtual communication matrix;
  • the first CAN node is further configured to send the first data to the CAN bus;
  • the third CAN node is configured to obtain the first data from the CAN bus, and control the second device to perform a corresponding interactive operation according to the first data.
  • the virtual communication matrix is based on the original communication matrix, adding the definition of the first message identifier and the message identifier of the data received by the first interaction device Adding the first message identifier, and/or on the basis of the original communication matrix, adding the definition of the second message identifier and adding in the CAN node where the data sent by the second interaction device is received said first CAN node;
  • the first message identifier is a message identifier of data that is allowed to be sent by the first device
  • the second message identifier is a message identifier of data that is allowed to be received by the first device
  • the first interactive device and the second interactive device are devices that interact with the first device in the CAN communication system
  • the first interactive device includes the second device
  • the first A second interactive device includes said second device.
  • first reserved data and/or second reserved data are further defined in the virtual communication matrix, and the first reserved data is to allow the first device to pass through the The data sent by the first CAN node on the CAN bus, the second reserved data is data that allows the first device to obtain from the CAN bus through the first CAN node.
  • the first CAN node is also used to acquire the message identifier of the first data, and determine whether the message identifier of the first data is the first one defined in the virtual communication matrix.
  • message identifier ;
  • the first CAN node is further configured to determine that the first data is allowed to be sent on the CAN bus.
  • the first CAN node is further configured to obtain the message identifier of the first data, and determine whether the message identifier of the first data is the first one defined in the virtual communication matrix. A message identifier, and determining whether the first data is the first reserved data defined in the virtual communication matrix;
  • the first CAN node is further configured to determine the first A data is data that is allowed to be sent on the CAN bus.
  • the first CAN node is further configured to encapsulate the first data according to the data structure corresponding to the CAN bus to obtain third data, and send the third data to the CAN bus.
  • the first CAN node is also used to obtain the message identifier of the second data; determine whether the message identifier of the second data is the second message defined in the virtual communication matrix text identifier;
  • the first CAN node is further configured to determine that the second data is data that is allowed to be received by the first device.
  • the first CAN node is also used to obtain the message identifier of the second data; determine whether the message identifier of the second data is the second defined in the virtual communication matrix a message identifier, and determining whether the second data is the second reserved data defined in the virtual communication matrix;
  • the first CAN node is further configured to determine the first The second data is the data that the first device is allowed to receive.
  • the first CAN node is further configured to encapsulate the second data according to the data structure corresponding to the communication network to obtain fourth data, and send the fourth data to the first device .
  • the first device is connected to the first CAN node in a multi-connection manner.
  • a rate adjustment buffer is set in the first CAN node, and the rate adjustment buffer is used to store the first data acquired by the first CAN node.
  • the embodiment of the present application provides an electronic device, the electronic device is provided with a CAN communication system, and the CAN communication system includes a first device, a second device, a CAN bus, and a CAN bus connected to the CAN bus At least two CAN nodes, the at least two CAN nodes include a first CAN node and a second CAN node, the first device is connected to the first CAN node through a communication network, and the second CAN node is used to control
  • the second device, the CAN communication system is provided with a virtual communication matrix, the virtual communication matrix is obtained by expanding the original communication matrix of the CAN communication system according to the first device, and the first CAN node It is used to implement the CAN communication method described in any one of the first aspect or the second aspect above.
  • the electronic device may be an automobile, an industrial device, an artificial intelligence device, and the like.
  • the embodiment of the present application provides an electronic device, including a memory, a processor, a controller, and a transceiver, the controller is used to control the transceiver to receive data on the CAN bus, and the received data Stored in the memory or sent to the processor, the controller is also used to obtain data from the processor or the memory, and control the transceiver to send the obtained data to the CAN bus, the memory Stored in a computer program that can run on the processor, when the processor executes the computer program, the electronic device implements the CAN communication method described in any one of the first aspect or the second aspect .
  • the embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a computer, the computer realizes the above-mentioned first aspect or the first aspect.
  • an embodiment of the present application provides a computer program product, which, when the computer program product is run on an electronic device, causes the electronic device to execute the CAN communication method described in any one of the first aspect or the second aspect.
  • Fig. 1 is the structural representation of the data of CAN bus broadcast
  • Fig. 2 is a schematic structural diagram of a CAN communication system provided by an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of data propagated based on the UDP protocol provided by the embodiment of the present application.
  • Fig. 4 is a schematic flowchart of a CAN communication method provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a CAN communication system provided by another embodiment of the present application.
  • FIG. 6 is a schematic flow chart of a CAN communication method provided by another embodiment of the present application.
  • Fig. 7 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the term “if” may be construed, depending on the context, as “when” or “once” or “in response to determining” or “in response to detecting “.
  • the phrase “if determined” or “if [the described condition or event] is detected” may be construed, depending on the context, to mean “once determined” or “in response to the determination” or “once detected [the described condition or event] ]” or “in response to detection of [described condition or event]”.
  • references in the specification of the present application to "one embodiment” or “some embodiments” etc. mean that a particular feature, structure or characteristic described in connection with the embodiment is included in one or more embodiments of the present application.
  • appearances of the phrases “in one embodiment,” “in some embodiments,” “in other embodiments,” “in other embodiments,” etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean “one or more but not all embodiments” unless specifically stated otherwise.
  • the terms “including”, “comprising”, “having” and variations thereof mean “including but not limited to”, unless specifically stated otherwise.
  • the steps involved in the CAN communication method provided in the embodiment of the present application are only examples, and not all steps are mandatory steps, or not the contents of each information or message are mandatory, during use It can be increased or decreased as needed.
  • the same step or steps or messages having the same function can be referred to and used in different embodiments.
  • the CAN communication system can be widely used in automotive internal communication and other industrial field scenarios.
  • the CAN communication system may include a CAN bus, and at least two ECUs/MCUs connected to the CAN bus, that is, each ECU/MCU can be connected to the CAN bus to become a CAN node of the CAN bus when working.
  • each CAN node can send data on the CAN bus
  • other CAN nodes can receive data broadcast on the CAN bus.
  • the data broadcast on the CAN bus is the data sent by the CAN node on the CAN bus.
  • the ECU/MCU connected to the CAN bus described above is only an exemplary explanation, and should not be interpreted as a display of the embodiment of the application.
  • the connection to the CAN bus can also be physical devices such as other micro-processing units. .
  • each data frame (hereinafter referred to as CAN data frame) broadcast on the CAN bus can include a start (start of frame, SOF) segment, an arbitration (arbitration field, AF) segment, a control segment, a data ( data) segment, cyclic redundancy check (cyclic redundancy check, CRC) segment, response (acknowledge, ACK) segment and end of frame (EOF) segment.
  • the content of the AF segment is mainly the message identifier (message identifier, MsgID) corresponding to the CAN data frame.
  • MsgID message identifier
  • the MsgID determines the priority of the CAN data frame transmission, and also determines whether other CAN nodes will receive the CAN data frame. .
  • the original communication matrix defines which CAN data frames of MsgID can be received by each ECU/MCU in electronic equipment such as automobiles, and/or which CAN data frames of MsgID can be sent, that is, each ECU/MCU needs to follow the original communication matrix
  • the definition can send and receive data.
  • the new device when it is necessary to add a new device to the CAN communication system, since the new device is not defined in the original communication matrix, that is to say, which MsgID CAN data frames the new device can receive is not defined in the original communication matrix, And/or CAN data frames of which MsgID can be sent, etc., and the new device generally does not have a CAN bus interface, so that the new device cannot be connected to the CAN bus, and cannot communicate with the CAN node (ie ECU/MCU) on the CAN bus Communication, so that the new device cannot interact with other devices on the CAN bus, etc., which greatly affects the user experience.
  • the CAN node ie ECU/MCU
  • the embodiment of the present application provides a CAN communication method, electronic equipment and CAN communication system.
  • the first device when a new device (hereinafter referred to as the first device) needs to be added to the CAN bus, it can Connect the first device to a certain CAN node in the CAN communication system (hereinafter referred to as the first CAN node), and expand the original communication matrix of the CAN communication system according to the first device to obtain a virtual communication matrix.
  • the definition of the first device can be added in the virtual communication matrix, that is, the MsgID of the data that the first device can send can be added (hereinafter the MsgID of the data that the first device can send is called the first message identifier, that is, first MsgID), and/or the definition of the MsgID of the data that can be received (hereinafter the MsgID of the data that can be received by the first device is referred to as the second message identifier, that is, the second MsgID), and can be based on the first MsgID and / or the second MsgID modifies the MsgID of the data that the interactive device can receive, and/or modifies the CAN node that the data sent by the interactive device can be received (that is, adding the first CAN node connected to the first device), etc.
  • interactive The device is a device that needs to interact with the first device in the CAN communication system, so that the first device can be dynamically added to the CAN communication system according to
  • CAN communication method provided in the embodiment of the present application can be applied to automobiles, industrial equipment, artificial intelligence equipment, and the like.
  • the related concepts involved in the embodiment of the present application will be described below by taking the application of the CAN communication method to automobiles as an example.
  • the original communication matrix is a communication matrix defined by the manufacturer according to the equipment that the car has when it leaves the factory, that is, the original communication matrix defines the MsgID and/or CAN data frames that can be received by each ECU/MCU corresponding to the equipment that the car has when it leaves the factory.
  • the MsgID of the CAN data frame that can be sent to realize the communication between various devices in the car through the CAN bus. It should be understood that one ECU/MCU can be used to manage one or more devices, therefore, one ECU/MCU can receive multiple CAN data frames with different MsgIDs and/or can send multiple CAN data frames with different MsgIDs.
  • the virtual communication matrix is an expansion of the original communication matrix according to the newly added first device in the embodiment of the present application.
  • the obtained communication matrix that is, the virtual communication matrix can be based on the original communication matrix, adding the first MsgID and /or the definition of the second MsgID, and modify the MsgID of the data that the interactive device can receive according to the first MsgID and/or the second MsgID, and/or modify the CAN node that the data sent by the interactive device can be received, etc.
  • the interactive device is a device that needs to interact with the first device in the CAN communication system, so that the first device can be added to the CAN communication system according to the virtual communication matrix, so that it can interact with the original devices in the CAN bus.
  • adding the definition of the first MsgID refers to adding the MsgID of the data that the first device can send, or refers to adding the MsgID of the data that the first device can send and adding in the corresponding MsgID according to the data that the first device can send
  • the relevant content of the signal that the first device can send enables the first device to send the data of the first MsgID to the CAN bus.
  • Adding the definition of the second MsgID refers to the data that can be obtained according to the needs of the first device, and the first CAN node corresponding to the first device is added to the CAN nodes that can receive the data, or refers to the data that can be obtained according to the needs of the first device Data, add the relevant content of the signal corresponding to the first device in the MsgID corresponding to the data (for example, add the relevant content of the signal that the first device can receive in the MsgID), so that the first device can obtain the second device from the CAN bus MsgID data.
  • the first device can be connected to the first CAN node in the CAN communication system through the communication network to add the first device to the CAN through the first CAN node.
  • Communication Systems Exemplarily, the first device can send a registration request to the first CAN node through the communication network to register the first MsgID and/or the second MsgID corresponding to the first device, so that the first device can send data through the first CAN node To the CAN bus, so that other CAN nodes can obtain the data sent by the first device from the CAN bus, or enable the first device to obtain the data sent by other CAN nodes from the CAN bus through the first CAN node, so that the first device can communicate with CAN interact with other devices in the communication system.
  • the first MsgID corresponding to the first device may be determined according to the MsgID reserved and available in the CAN communication system when the first device is connected to the first CAN node, for example, the MsgID reserved and available in the CAN communication system may be Any one or more are determined to be the first MsgID of the first device.
  • the second MsgID corresponding to the first device may be determined according to the MsgID of the data that the first device needs to interact with that can send to the first device (that is, the data that the first device can receive).
  • the aromatherapy device when it is necessary to add an aromatherapy device to the CAN communication system, the aromatherapy device can be connected to the vehicle ECU through the communication network, so as to add the aromatherapy device to the CAN communication system through the vehicle ECU.
  • the first MsgID (such as 0x0A4) corresponding to the aromatherapy device can be determined according to the available MsgID reserved in the CAN communication system, and/or the corresponding interactive device (such as the air conditioner, ECU1, etc. )
  • the MsgID of the data that can be sent to the aromatherapy device determines the second MsgID corresponding to the aromatherapy device.
  • the air conditioner can be modified , ECU1, etc., the data sent by CAN nodes can be received, etc., to expand the original communication matrix, and obtain the virtual communication matrix shown in Table 1.
  • the signals corresponding to each MsgID in Table 1 can be used to limit the data allowed to be sent by the MsgID.
  • Table 1 only the message name, message identifier (ie MsgID), message length (byte (byte)), signal name, signal description, signal length (unit is bit (bit)) of CAN data frame ), the CAN node that can send the CAN data frame and the CAN node that can receive the CAN data frame are used as examples. It should not be understood as a limitation to the embodiment of the application.
  • the CAN data frame can also include message type, For the message sending type, message cycle time, signal arrangement format, etc., the specific content can refer to the description of the existing communication matrix.
  • FIG. 2 shows a schematic structural diagram of a CAN communication system provided by an embodiment of the present application.
  • the CAN communication system may include a CAN bus, and at least two CAN nodes connected to the CAN bus (in Figure 2, CAN node 1, CAN node 2, CAN node 3 and CAN node 4 are taken as examples) .
  • each CAN node can be a micro-processing unit such as an ECU or MCU.
  • the first device and the first CAN node in at least two CAN nodes can be connected through the communication network (taking CAN node 3 as the first CAN node as an example in Figure 2 for example) sex instructions) connection.
  • a virtual communication matrix may be set according to the first MsgID and/or the second MsgID corresponding to the first device, so as to transmit and receive data according to the virtual communication matrix.
  • the specific content of the virtual communication matrix reference may be made to the foregoing description, which will not be repeated here.
  • the third device may also be connected to a certain CAN node among the at least two CAN nodes through the communication network.
  • a virtual communication matrix can be set according to the first MsgID and/or the second MsgID corresponding to the first device, and the first MsgID and/or the second MsgID corresponding to the third device, so that according to the virtual communication Matrix to send and receive data.
  • the CAN node connected to the third device may be the same as or different from the first CAN node connected to the first device.
  • the process of adding the first device to the CAN communication system is similar to the process of adding the third device to the CAN communication system, and the following will take adding the first device to the CAN communication system as an example for illustration.
  • the first device may be connected to the first CAN node through a wired communication network such as a universal serial bus (universal serial bus, USB) interface or Ethernet (ethernet), or may be connected through a wireless local area network (wireless local area networks, WLAN) (such as wireless fidelity (Wi-Fi) network), Bluetooth (bluetooth, BT), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) or 2G/3G/ A wireless communication network such as 4G/5G is connected to the first CAN node.
  • a wired communication network such as a universal serial bus (universal serial bus, USB) interface or Ethernet (ethernet)
  • WLAN wireless local area networks
  • Wi-Fi wireless fidelity
  • Bluetooth bluetooth, BT
  • NFC near field communication technology
  • infrared technology infrared, IR
  • a wireless communication network such as 4G/5G is connected to the first CAN node.
  • the first CAN node may be specifically set by technicians according to actual scenarios.
  • a technician may set the first CAN node according to the communication network supported by the first device and the communication network supported by each CAN node.
  • the CAN node supporting Ethernet connection among the at least two CAN nodes may be set as the first CAN node.
  • the CAN node supporting Bluetooth connection among the at least two CAN nodes may be set as the first CAN node.
  • the CAN node supporting WiFi connection among the at least two CAN nodes may be set as the first CAN node.
  • the first device after the first device is connected to the first CAN node through the communication network, it can send a registration request to the first CAN node to register the first MsgID and/or the second MsgID corresponding to the first device, so that it can pass
  • the first CAN node forwards the data sent by the first device to the CAN bus, and/or can obtain the data required by the first device from the CAN bus through the first CAN node and forward it to the first device. That is to say, the dynamic communication matrix corresponding to the first device can be recorded in the first CAN node, and the dynamic communication matrix recorded by the first CAN node can be combined with the original communication matrix of the CAN bus system to form a dynamic virtual communication matrix, to Synchronize distributed information.
  • the first CAN node may carry a safety protection check, so as to determine whether the data sent by the first device can be sent to the CAN bus through the safety protection check, and/or determine whether the data broadcast on the CAN bus is sent by the first device The data that is allowed to be fetched.
  • the communication between the first device and the first CAN node can be modified.
  • Transmission protocol that is, the MsgID corresponding to the CAN data frame and the content of the data segment (data) can be added to the data transmitted based on the communication network. Therefore, when the data sent by the first device needs to be sent to the CAN bus, the data can be obtained MsgID and the contents of the data segment (data), and encapsulate the contents of the MsgID and the data segment (data) according to the structure shown in Figure 1 to obtain the CAN data frame.
  • the contents of the MsgID and the data segment (data) in the CAN data frame can be obtained, and the MsgID and the data segment (data) can be processed according to the corresponding transmission protocol of the communication network ( data) to obtain data that can be transmitted through the communication network, so that the data can be sent to the first device through the communication network.
  • the first device when the first device is connected to the first CAN node through a communication network such as Ethernet or WiFi, data can be exchanged between the first device and the first CAN node through a user datagram protocol (UDP) protocol. send and receive.
  • UDP user datagram protocol
  • FIG. 3 shows a schematic structural diagram of data transmitted based on the UDP protocol provided by the embodiment of the present application.
  • each frame of data in the UDP protocol (hereinafter referred to as a UDP data frame) may include a source port, a destination port, a packet length, a packet type, a data segment, and a check segment.
  • the data segment of the UDP data frame may include a UDP header and a UDP datagram.
  • the UDP protocol between the first device and the first CAN node may be modified. That is, the contents of the MsgID and the data segment (data) in the CAN data frame can be added to the UDP data frame.
  • the first device can divide the UDP datagram of the UDP data frame into three fields, the first field can be used to store the content of MsgID in the CAN data frame, and the second field can be used to store the data in the CAN data frame
  • the third field can be a padding segment.
  • the first CAN node can obtain the contents of the MsgID and the data segment (data) in the UDP data frame, and follow the The structure shown in FIG. 1 encapsulates the content of MsgID and data segment (data) in the UDP data frame into a CAN data frame. Then, the first CAN node can forward the encapsulated CAN data frame to the CAN bus.
  • the first CAN node can obtain the contents of the MsgID and the data segment (data) in the CAN data frame, and convert the CAN data frame according to the structure shown in Figure 3
  • the MsgID and the content of the data segment (data) are encapsulated into a UDP data frame.
  • the first CAN node may forward the encapsulated UDP data frame to the first device through a communication network such as Ethernet or WiFi.
  • the CAN communication method provided by the embodiment of the present application will be described by taking the connection between the first device and the first CAN node via Ethernet as an example.
  • FIG. 4 shows a schematic flowchart of a CAN communication method provided by an embodiment of the present application. As shown in Figure 4, the method may include:
  • the first device sends first data to the first CAN node.
  • the first data is used by a second device to perform an interactive operation.
  • the second device is a device in a CAN communication system.
  • the first CAN node determines, according to the virtual communication matrix, that the first data is data that can be sent on the CAN bus.
  • the first CAN node sends the first data to the CAN bus.
  • the second CAN node acquires the first data broadcast on the CAN bus, and the second CAN node is a CAN node corresponding to the second device.
  • the second CAN node controls the second device to perform an interactive operation according to the first data.
  • the first device when the first device needs to interact with the second device in the CAN communication system, the first device can send the data of the structure shown in Figure 3 to the first CAN node via Ethernet (the embodiment of the present application will
  • the data sent by the first device is referred to as first data), that is, the first data may be a UDP data frame.
  • the first CAN node may perform a safety protection check.
  • the first CAN node can obtain the MsgID and data in the first data, and can determine whether the first data is data that can be sent on the CAN bus according to the MsgID and the virtual communication matrix in the first data, that is, determine whether the first data can be sent on the CAN bus. Whether the MsgID of a data is the MsgID defined in the virtual communication matrix.
  • the first CAN node When the MsgID of the first data is not the MsgID defined in the virtual communication matrix, the first CAN node will not send the first data to the CAN bus, so as to avoid forwarding the malicious data sent by the first device to the CAN bus, and bring a negative impact on the CAN communication system come security threats and reduce the security of the CAN communication system.
  • the first CAN node can encapsulate the MsgID and data in the first data according to the structure shown in FIG.
  • the data that is, the third data may be a CAN data frame corresponding to the first data, that is, the first data and the third data have the same content but different formats.
  • the first CAN node may send the third data to the CAN bus to broadcast the third data on the CAN bus.
  • the second CAN node in the CAN communication system (such as the ECU/MCU corresponding to the second device) can obtain the third data from the CAN bus, and can control the second device according to the third data A corresponding interaction operation is performed, so that the first device can interact with the second device.
  • CAN node 1 can be used to manage device A, and the MsgID of the data that CAN node 1 can receive includes the first MsgID.
  • the first device may send the first data to the CAN node 3 through the communication network.
  • the CAN node 3 After the CAN node 3 receives the first data, it obtains the MsgID and data in the first data, and determines that the first data is the data that can be sent on the CAN bus according to the virtual communication matrix and the MsgID in the first data. Therefore, the CAN node 3.
  • the MsgID and data in the first data may be encapsulated to obtain the third data, that is, to obtain a CAN data frame, and send the third data to the CAN bus.
  • the CAN node 1 determines that the first data is the data that can be received by itself according to the virtual communication matrix (i.e. the MsgID of the data that the CAN node 1 can receive).
  • the third data can be acquired from above, and the device A can be controlled to perform the corresponding interactive operation according to the third data, so as to realize the interaction between the first device and the device A.
  • the second CAN node corresponding to the second device can send data to the CAN bus (hereinafter the data sent by the second CAN node is referred to as the second data) to broadcast second data on the CAN bus.
  • the first CAN node may determine whether the second data is data receivable by the first device according to the second MsgID corresponding to the first device.
  • the first device after the first device is connected to the first CAN node through the communication network, it can register the first MsgID and/or the second MsgID corresponding to the first device with the first CAN node, so the first CAN node can record the first
  • the dynamic communication matrix corresponding to the device records the first MsgID and/or the second MsgID corresponding to the first device, so that it can be determined according to the second MsgID whether the second data can be received by the first device.
  • the first CAN node can obtain the second data from the CAN bus, and can obtain the first MsgID and data in the second data. Then, the first CAN node can encapsulate the MsgID and data in the second data according to the structure shown in Figure 3 to obtain the fourth data after the second data is encapsulated, that is, the fourth data can be UDP data corresponding to the second data frame, that is to say, the content of the second data is the same as that of the fourth data, but the format is different. Then, the first CAN node can forward the fourth data to the first device, so that the first device can perform a corresponding interaction operation according to the fourth data, thereby realizing the interaction between the second device and the first device.
  • CAN node 2 can be used to manage device B.
  • the second MsgID corresponding to the first device may include the MsgID of the second data.
  • the CAN node 2 can send the second data to the CAN bus to broadcast the second data on the CAN bus.
  • the CAN node 3 When broadcasting the second data on the CAN bus, the CAN node 3 determines that the second data is the data that the first device can receive according to the second MsgID corresponding to the first device, at this time, the CAN node 3 can obtain the second data from the CAN bus , and obtain the MsgID and data in the second data. Then, the CAN node 3 can encapsulate the MsgID and data in the second data to obtain the encapsulated fourth data, and send the fourth data to the first device through the communication network, so that the first device can The corresponding interaction operation is performed, so as to realize the interaction between device B and the first device.
  • FIG. 5 shows a schematic structural diagram of a CAN communication system provided by another embodiment of the present application.
  • the CAN communication system can include at least two CAN buses (in Figure 5, CAN bus 1 and CAN bus 2 are used as examples for illustration), at least two CAN nodes (in Figure 5, CAN nodes 1, The CAN node 2, the CAN node 3, the CAN node 4 and the CAN node 5 are used as examples to illustrate) and the gateway.
  • CAN node 1, CAN node 2 and CAN node 3 are connected to CAN bus 1
  • CAN node 4 and CAN node 5 are connected to CAN bus 2
  • CAN bus 1 and CAN bus 2 are respectively connected to a gateway.
  • each CAN node can be a micro-processing unit such as an ECU or MCU.
  • the gateway can forward data on different CAN buses, for example, the gateway can forward the data broadcast on CAN bus 1 to CAN bus 2, or can forward the data broadcast on CAN bus 2 to CAN bus 1. It should be understood that the gateway can also communicate with the cloud server, for example, the gateway can send data to the cloud server, or can receive data from the cloud server.
  • the first device and the first CAN node in at least two CAN nodes can be connected through the communication network (taking CAN node 3 as the first CAN node as an example in Figure 5 for example) sex instructions) connection.
  • a virtual communication matrix may be set according to the first MsgID and/or the second MsgID corresponding to the first device, so as to transmit and receive data according to the virtual communication matrix.
  • FIG. 6 shows a schematic flowchart of a CAN communication method provided by another embodiment of the present application. As shown in Figure 6, the method may include:
  • the first device sends first data to the first CAN node.
  • the first data is used by a second device to perform an interactive operation, and the second device is a device in a CAN communication system.
  • the first CAN node determines, according to the virtual communication matrix, that the first data is data that can be sent on the CAN bus.
  • the first CAN node sends the first data to the first CAN bus.
  • the first CAN bus broadcasts first data.
  • the gateway acquires the first data, and forwards the first data to the second CAN bus.
  • the second CAN bus broadcasts the first data.
  • the second CAN node acquires the first data broadcast on the second CAN bus, where the second CAN node is a CAN node corresponding to the second device.
  • the second CAN node controls the second device to perform an interactive operation according to the first data.
  • the first device when the first device needs to interact with the second device in the CAN communication system, and the second device is connected to a different CAN bus from the first CAN node, for example, the first CAN node is connected to the A CAN bus, when the second device is connected to the second CAN bus, the first device can send the first data with the structure shown in Figure 3 to the first CAN node via Ethernet, that is, the first data can be a UDP data frame.
  • the first CAN node may perform a safety protection check.
  • the first CAN node can obtain MsgID and data in the first data, and determine whether the first data is data that can be sent on the first CAN bus according to the MsgID in the first data and the virtual communication matrix, that is, determine Whether the MsgID of the first data is the MsgID defined in the virtual communication matrix.
  • the first CAN node When the MsgID of the first data is not the MsgID defined in the virtual communication matrix, the first CAN node will not send the first data to the first CAN bus, so as to avoid forwarding the malicious data sent by the first device to the first CAN bus.
  • the CAN communication system brings security threats and reduces the security of the CAN communication system.
  • the first CAN node can encapsulate the MsgID and data in the first data according to the structure shown in Figure 1 to obtain the encapsulated third data, namely The third data may be CAN data frames. Then, the first CAN node sends the third data to the first CAN bus to broadcast the third data on the first CAN bus. At this time, the gateway may forward the third data broadcast on the first CAN bus to the second CAN bus, so as to broadcast the third data on the second CAN bus.
  • the second CAN node in the CAN communication system (for example, the second ECU corresponding to the second device) can obtain the third data from the second CAN bus, and control according to the third data
  • the second device performs a corresponding interaction operation, so that the first device can interact with the second device.
  • the CAN node 4 may be used to manage the device D, and the MsgID of the data received by the CAN node 4 may include the first MsgID.
  • the first device may send the first data to the CAN node 3 through the communication network.
  • the CAN node 3 After the CAN node 3 receives the first data, it obtains the MsgID and data in the first data, and determines that the first data is the data that can be sent on the CAN bus 1 according to the virtual communication matrix and the MsgID in the first data.
  • the CAN The node 3 may encapsulate the MsgID and data in the first data to obtain the encapsulated third data, that is, obtain a CAN data frame, and send the third data to the CAN bus 1 .
  • the gateway may forward the third data broadcast on the CAN bus 1 to the CAN bus 2 to broadcast the third data on the CAN bus 2 .
  • the CAN node 4 determines that the first data is data that can be received by itself according to the virtual communication matrix (i.e. the MsgID of the data that the CAN node 4 can receive).
  • the third data is acquired on the bus 2, and the device D can be controlled to perform a corresponding interaction operation according to the third data, so as to realize the interaction between the first device and the device D.
  • the second device in the CAN communication system needs to interact with the first device, and the second device is connected to a different CAN bus from the first CAN node, for example, the first CAN node is connected to the first CAN bus
  • the second CAN node corresponding to the second device may send the second data to the second CAN bus, so as to broadcast the second data on the second CAN bus.
  • the gateway can forward the second data broadcast on the second CAN bus to the first CAN bus to broadcast the second data on the first CAN bus, and the first CAN node can determine the second data according to the second MsgID corresponding to the first device. Whether the second data is data that can be received by the first device.
  • the first CAN node can obtain the second data from the first CAN bus, and obtain MsgID and data in the second data. Then, the first CAN node may encapsulate MsgID and data in the second data according to the structure shown in FIG. 3 to obtain encapsulated fourth data, that is, the fourth data may be a UDP data frame. Then, the first CAN node can forward the fourth data to the first device, so that the first device can perform a corresponding interaction operation according to the fourth data, thereby realizing the interaction between the second device and the first device.
  • the specific data and/or data that the first device is allowed to receive can also be specified. Or limit the specific data that is allowed to be sent.
  • the first CAN node may pass the security protection check to restrict the specific data that the first device is allowed to receive and/or the specific data that is allowed to be sent.
  • the signal that can be sent by the first MsgID can be defined in the virtual communication matrix, so as to allow the first MsgID to send data (hereinafter, the data that is allowed to be sent is referred to as the first reserved data) Restriction is performed, thereby restricting the data that the first device is allowed to send.
  • the signals that the first device can receive may be limited in the virtual communication matrix, so as to limit the data that the first device is allowed to receive (hereinafter, the data that is allowed to receive is referred to as second reserved data).
  • the first device can only send the first reserved data to the CAN bus, and/or can only obtain the second reserved data from the CAN bus, so as to prevent the first device from sending malicious data to the CAN bus, and/or avoid the second A device leaks or tampers with the data broadcast on the CAN bus, improving the security of the CAN communication system.
  • the first CAN node may perform a safety protection check.
  • the first CAN node can determine whether the MsgID of the first data is the MsgID defined in the virtual communication matrix, and determine whether the first data is the first reserved data in the virtual communication matrix, for example, the first data can be Analyze the message header and content of the message to determine the signal corresponding to the first data, so as to determine whether the first data is the first reserved data in the virtual communication matrix.
  • the first CAN node may not send the first data to the CAN bus, that is, it may The first data is not broadcast on the CAN bus, so as to prevent the first device from sending malicious data to the CAN bus, which poses a security threat to the CAN communication system, thereby reducing the security of the CAN communication system.
  • the first CAN node can perform a check on the first data according to the structure shown in Figure 1
  • the MsgID and data are encapsulated to obtain the encapsulated third data, and send the third data to the CAN bus. Therefore, other CAN nodes in the CAN communication system can obtain third data from the CAN bus according to the virtual communication matrix, and can control corresponding devices to perform corresponding interactive operations according to the third data.
  • the first CAN node may perform a safety protection check.
  • the first CAN node may determine whether the second data is the second reserved data in the virtual communication matrix, that is, determine whether the second data broadcast on the CAN bus is data that the first device can obtain from the CAN bus.
  • the first CAN node may not send the second data to the first device to avoid CAN The data transmitted in the bus is leaked or illegally tampered with, reducing the security of the CAN communication system.
  • the first CAN node can obtain the second data from the CAN bus, and can encapsulate the MsgID and data in the second data according to the structure shown in Figure 3 , obtain the fourth data, and send the fourth data to the first device through the communication network, so that the first device can perform a corresponding interactive operation according to the fourth data.
  • the first device is connected to the first CAN node through a communication network such as Ethernet, Bluetooth or WiFi, so as to join the CAN communication system through the first CAN node, and due to the real-time reliability of the communication network
  • the real-time reliability of the shielded twisted pair of the CAN bus is often not as high as that of the CAN bus. Therefore, in the embodiment of the present application, the communication layer of the first device and the communication layer of the first CAN node can be modified to improve the connection between the first device and the first CAN node. Real-time reliability between CAN nodes, and/or enhanced tolerance to delay jitter.
  • connection mode between the first device and the first CAN node can be modified, for example, the connection mode between the first device and the first CAN node can be modified to a multi-connection mode, so as to pass multiple connection to improve real-time reliability between the first device and the first CAN node.
  • connection protocols such as media redundancy protocol (media redundancy protocol, MRP), parallel redundancy protocol (parallel redundancy protocol, PRP), or high-availability seamless redundancy (high-availability seamless redundancy, HSR).
  • MRP media redundancy protocol
  • PRP parallel redundancy protocol
  • HSR high-availability seamless redundancy
  • redundant information, error correction code or fountain code, etc. may be added to the beginning segment of the first data sent by the first device, and/or redundant information may be added to the end segment of the first data , error correction code or fountain code, etc., to improve the real-time reliability between the first device and the first CAN node through redundancy implementation, error correction, recovery, and the like.
  • a rate adjustment buffer can be constructed at the communication layer of the first CAN node, so as to obtain the first data sent by the first device through the rate adjustment buffer, and after determining that the correct first data arrives, the The first data is sent to the CAN bus, so as to reduce the delay that may be caused by retransmission and enhance the fault tolerance of delay jitter.
  • the first CAN node can reduce the transmission rate to the CAN bus.
  • the rate at which the CAN bus sends the first data may, for example, buffer the first data through a rate adjustment buffer, and send the first data to the CAN bus at a lower rate.
  • the rate at which the first CAN node sends the first data to the CAN bus may be specifically determined according to actual scenarios, which is not specifically limited in this embodiment of the present application.
  • the virtual communication matrix in the CAN communication system can be upgraded and updated according to the actual application scenario, for example, some content defined in the virtual communication matrix can be added or deleted according to the actual application scenario that will appear in the future, and/or the virtual communication matrix can be modified. Part of the content of the definition, etc., to meet the use requirements of possible application scenarios in the future, which can effectively improve the user experience.
  • the driving recorder when it is necessary to add a driving recorder to the CAN communication system of the car, the driving recorder can be connected to a certain CAN node in the CAN communication system (such as the vehicle ECU) through a communication network (such as on-board Ethernet or USB) , so that the driving recorder can interact with the body control domain ECU in the CAN communication system through the vehicle ECU, so that in the event of an emergency collision, the vehicle body control domain ECU can send a photo request to the driving recorder to start the driving recorder. Taking pictures, or when the driving recorder detects pedestrians or vehicles approaching, it can send a danger reminder to the body control domain ECU, so that the body control domain ECU can perform corresponding operations to avoid accidents.
  • a certain CAN node in the CAN communication system such as the vehicle ECU
  • a communication network such as on-board Ethernet or USB
  • the virtual communication matrix may refer to the first MsgID corresponding to the driving recorder defined on the basis of the original communication matrix of the car (ie the MsgID of the data that the driving recorder can send).
  • the virtual communication matrix also defines the second MsgID corresponding to the driving recorder (that is, the MsgID of the data that the driving recorder can receive, for example, it can include the data sent by the vehicle body control domain ECU, etc.
  • the sent data can be received by the CAN node (for example, modify the CAN node that the "photographing request" can be received to include the driving recorder), etc.
  • the virtual communication matrix can also define the data that the driving recorder can receive (such as a photo request, etc.) and the data that can be sent (such as danger reminders, etc.).
  • the driving recorder after the driving recorder is connected to the vehicle ECU through a communication network such as the vehicle Ethernet or USB, the driving recorder can send a registration request to the vehicle ECU to register the first MsgID and the first MsgID corresponding to the driving recorder with the vehicle ECU. 2.
  • MsgID which is to inform the ECU of the vehicle through registration, the MsgID of the data that the driving recorder can send and the MsgID of the data that can be received.
  • the vehicle body control domain ECU can send data (such as a photo request) to the CAN bus to inform the driving recorder to take a photo.
  • the vehicle ECU determines that the data is the data that the driving recorder can receive according to the second MsgID corresponding to the driving recorder and the MsgID of the data, and according to the virtual communication matrix (that is, the data that the driving recorder defined in the virtual communication matrix can receive) data) to determine that the data is receivable by the driving recorder, therefore, the vehicle ECU can obtain the data from the CAN bus, and convert the data into UDP data frames according to the structure shown in Figure 3. Then, the vehicle ECU can send the UDP data frame to the driving recorder through a communication network such as the vehicle Ethernet or USB. After the driving recorder receives the UDP data frame, it can take pictures.
  • the driving recorder when the driving recorder detects that pedestrians or vehicles are close, the driving recorder can send data (such as danger reminders) to the vehicle ECU through a communication network such as on-board Ethernet or USB, so as to inform the vehicle body of the perceived dangerous situation Control domain ECU.
  • the car-machine ECU determines that the data is data that can be broadcast on the CAN bus according to the MsgID of the data and the virtual communication matrix (that is, the data that can be sent by the driving recorder defined in the virtual communication matrix). Therefore, the car-machine ECU can Send the data to the CAN bus to broadcast the data on the CAN bus.
  • the ECU in the body control domain obtains the data from the CAN bus according to the MsgID of the data it can receive, and performs corresponding interactive operations based on the data, such as actively increasing the braking force, etc., to prevent accidents.
  • the robot can be connected to a certain CAN node (such as the vehicle ECU) in the CAN communication system through a communication network (such as WiFi), so that the robot can pass through the vehicle ECU. Interact with the body control domain ECU in the CAN communication system.
  • a certain CAN node such as the vehicle ECU
  • a communication network such as WiFi
  • the virtual communication matrix can define the second MsgID corresponding to the robot (that is, the MsgID of the data that the robot can receive, for example, it can include the data sent by the body control domain ECU). MsgID of the data), and at the same time, the CAN node that can receive the data sent by the body control domain ECU, etc. has been modified, that is, the vehicle ECU corresponding to the robot is added, so that the robot can obtain the data sent by the vehicle body control domain ECU through the vehicle ECU. The data.
  • the robot after the robot is connected to the vehicle ECU through a communication network such as WiFi, the robot can send a registration request to the vehicle ECU to register the second MsgID corresponding to the robot with the vehicle ECU, that is, notify the vehicle ECU through registration, and the robot can receive The MsgID of the data.
  • a communication network such as WiFi
  • the ECU of the vehicle determines that the data is the data that the robot needs to receive according to the second MsgID corresponding to the robot and the MsgID of the data. , and according to the virtual communication matrix (that is, the data that the robot can receive defined in the virtual communication matrix), it is determined that the data is the data that the robot can receive. Therefore, the car-machine ECU can obtain the data from the CAN bus, and according to the data shown in Figure 3 The structure converts that data into a UDP data frame. Then, the vehicle ECU can send the UDP data frame to the robot through a communication network such as WiFi. After the robot receives the UDP data frame, it can broadcast the status of the window or the temperature inside the car, etc., or it can give an alarm that the window is not closed or the temperature is too high or too low.
  • a communication network such as WiFi
  • the embodiment of the present application also provides a CAN communication device, and each module of the device can correspond to each step of the CAN communication method.
  • FIG. 7 shows a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device 7 may include at least one processor 70, at least one memory 71, a controller 72 (also referred to as a CAN controller) and a transceiver 73, and the transceiver may include a receiver and/or a transmitter device.
  • the processor 70 may be connected to the controller 72 and the memory 71 respectively, and the controller 72 is also connected to the memory 71 and the transceiver 73 respectively.
  • the memory 71 can store data such as application data and computer programs.
  • the processor 70 refers to a device with computing capability, for example, the processor may be a Microcontroller Unit (MCU), a Central Processing Unit (Central Processing Unit, CPU) and the like.
  • the processor 70 can read and execute the computer program from the memory 71, so that the electronic device 7 implements the steps in any of the above method embodiments.
  • the processor 70 can also process the application data in the memory 71 and so on.
  • the controller 72 can control the receiver to receive data on the CAN bus, and store the received data into the memory 71 or send it to the processor 70 .
  • the controller 72 can also acquire data from the processor 70 or the memory 71, and control the transmitter to send the data on the CAN bus.
  • the controller 72 may be set inside the processor 70, or outside the processor 70 (in FIG. 7, the controller 72 is set outside the processor 70 as an example for illustration).
  • the memory 71 may be set inside the processor 70 or outside the processor 70 (in FIG. 7, the memory 71 is set outside the processor 70 as an example for illustration).
  • the embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a computer, the computer implements the steps in any of the above method embodiments .
  • An embodiment of the present application provides a computer program product, which enables the electronic device to implement the steps in any of the foregoing method embodiments when the computer program product is run on the electronic device.
  • the integrated unit is realized in the form of a software function unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the procedures in the method of the above-mentioned embodiments in the present application can be completed by instructing related hardware through a computer program.
  • the computer program can be stored in a computer-readable storage medium.
  • the computer program When executed by a processor, the steps in the above-mentioned various method embodiments can be realized.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form.
  • the computer-readable storage medium may include at least: any entity or device capable of carrying computer program codes to the device/electronic device, recording medium, computer memory, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), electrical carrier signals, telecommunication signals, and software distribution media.
  • entity or device capable of carrying computer program codes to the device/electronic device
  • recording medium computer memory
  • read-only memory read-only memory, ROM
  • random access memory random access memory
  • electrical carrier signals telecommunication signals
  • software distribution media such as U disk, mobile hard disk, magnetic disk or optical disk, etc.
  • computer readable storage media may not be electrical carrier signals and telecommunication signals based on legislation and patent practice.
  • the disclosed device/electronic equipment and method can be implemented in other ways.
  • the device/electronic device embodiments described above are only illustrative.
  • the division of the modules or units is only a logical function division.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

本申请适用于通信技术领域,尤其涉及CAN通信方法、电子设备及CAN通信系统。该方法中,当需要增加第一设备至CAN总线时,可以通过通信网络将第一设备与CAN通信系统中的第一CAN节点连接,并根据第一设备对CAN通信系统的原始通信矩阵进行扩展,得到虚拟通信矩阵,以根据虚拟通信矩阵动态增加第一设备至CAN通信系统,使得第一设备可以通过第一CAN节点与CAN总线上的其他CAN节点进行通信,即使得第一设备可以通过第一CAN节点向CAN总线发送第一数据,以根据第一数据可以与CAN总线上的其他设备进行交互,极大地扩展了CAN通信系统的应用范围,提升用户体验。

Description

CAN通信方法、电子设备及CAN通信系统
本申请要求于2022年01月14日提交国家知识产权局、申请号为202210046889.1、申请名称为“CAN通信方法、电子设备及CAN通信系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于通信技术领域,尤其涉及CAN通信方法、电子设备及CAN通信系统。
背景技术
控制器局域网(controller area network,CAN)通信系统可以广泛应用于汽车内部通信和其他工业领域场景。CAN通信系统可以包括CAN总线,以及至少两个与CAN总线连接的电子控制单元(electronic control unit,ECU)或者微控制单元(micro controller unit,MCU)等。目前,CAN通信系统中,各ECU/MCU均是根据预先定义的通信矩阵在CAN总线上进行数据收发,新增的硬件设备无法接入CAN总线,无法与CAN总线上的其他ECU/MCU通信。
发明内容
本申请实施例提供了一种CAN通信方法、电子设备及CAN通信系统,可以解决现有的CAN通信系统中,新增的硬件设备无法接入CAN总线,无法与CAN总线上的其他ECU/MCU通信的问题。
第一方面,本申请实施例提供了一种CAN通信方法,应用于控制器局域网CAN通信系统,所述CAN通信系统包括第一设备、第二设备、CAN总线以及与所述CAN总线连接的至少两个CAN节点,所述至少两个CAN节点包括第一CAN节点和第二CAN节点,所述第一设备通过通信网络与所述第一CAN节点连接,所述第二CAN节点用于控制所述第二设备,所述CAN通信系统中设置有虚拟通信矩阵,所述虚拟通信矩阵为根据所述第一设备对所述CAN通信系统的原始通信矩阵进行扩展得到,所述方法可以包括:
所述第一CAN节点获取第一数据,所述第一数据是所述第一设备发送的,所述第一数据用于指示所述第二设备执行相应的交互操作;
所述第一CAN节点根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据;
当所述第一数据为允许在所述CAN总线上发送的数据时,所述第一CAN节点向所述CAN总线发送所述第一数据,以使得所述第二CAN节点从所述CAN总线获取所述第一数据,并根据所述第一数据控制所述第二设备执行相应的交互操作。
在上述的CAN通信方法中,当需要增加第一设备至CAN总线时,可以通过通信网络将第一设备与CAN通信系统中的第一CAN节点连接,并可以根据第一设备对CAN通信系统的原始通信矩阵进行扩展,得到虚拟通信矩阵,以根据虚拟通信矩阵可以动态增加第一设备至CAN通信系统,使得第一设备可以通过第一CAN节点与CAN总线上的其他CAN节点进行通信,从而使得第一设备可以通过第一CAN节点向CAN总线发送第一数据,以使得第二CAN节点可以从CAN总线获取第一设备发送的第一数据,并可以根据第一数据控制对应的第二设备执行交互操作,实现第一设备与CAN总线上的其他设备进行交互的目的,扩展CAN通信系统的应用范围,提升用户体验。
在一种可能的实现方式中,所述至少两个CAN节点还包括第三CAN节点,所述方法还可以包括:
所述第一CAN节点从所述CAN总线上获取第二数据,所述第二数据是所述第三CAN节点发送的,所述第二数据用于指示所述第一设备执行相应的交互操作;
所述第一CAN节点根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据;
当所述第二数据为允许所述第一设备接收的数据时,所述第一CAN节点向所述第一设备发送所述第 二数据,以使得所述第一设备根据所述第二数据执行相应的交互操作。
应理解,第三CAN节点与第二CAN节点可以为同一CAN节点,也可以为不同的CAN节点。
在该实现方式提供的CAN通信方法中,第一CAN节点可以从CAN总线上获取其他CAN节点发送的第二数据,并可以根据虚拟通信矩阵将第二数据发送给第一设备,以使得第一设备可以根据第二数据执行相应的交互操作,实现CAN总线上的其他设备与第一设备进行交互的目的,扩展CAN通信系统的应用范围,提升用户体验。
在一种可能的实现方式中,所述虚拟通信矩阵是在所述原始通信矩阵的基础上,增加对第一报文标识符的定义以及在第一交互设备接收的数据的报文标识符中增加所述第一报文标识符,和/或是在所述原始通信矩阵的基础上,增加对第二报文标识符的定义以及在第二交互设备发送的数据被接收的CAN节点中增加所述第一CAN节点;
其中,所述第一报文标识符为允许所述第一设备发送的数据的报文标识符,所述第二报文标识符为允许所述第一设备接收的数据的报文标识符,所述第一交互设备和所述第二交互设备为所述CAN通信系统中与所述第一设备进行交互的设备,所述第一交互设备包括所述第二设备,和/或所述第二交互设备包括所述第二设备。
示例性的,所述虚拟通信矩阵中还定义有第一预留数据和/或第二预留数据,所述第一预留数据为允许所述第一设备通过所述第一CAN节点在所述CAN总线上发送的数据,所述第二预留数据为允许所述第一设备通过所述第一CAN节点从所述CAN总线获取的数据。
在该实现方式提供的CAN通信方法中,为避免第一设备对CAN总线的非法使用,以确保CAN通信系统的安全性,在将第一设备加入CAN通信系统时,可以对第一设备允许接收的数据和/或允许发送的数据进行限制。即可以通过虚拟通信矩阵对第一设备允许发送的数据的MsgID和/或允许发送的数据的具体内容进行限制,和/或对第一设备允许接收的数据的MsgID和/或允许接收的数据的具体内容进行限制,从而对第一设备允许向CAN总线发送的数据进行限制,和/或对第一设备允许从CAN总线获取的数据进行限制,避免第一设备发送恶意数据至CAN总线,降低恶意数据对CAN通信系统带来的安全威胁,避免CAN总线中传输的数据被泄露或者被非法篡改,提高CAN通信系统的安全性。
在一个示例中,所述第一CAN节点根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据,可以包括:
所述第一CAN节点获取所述第一数据的报文标识符;
所述第一CAN节点确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符;
当所述第一数据的报文标识符为所述第一报文标识符时,所述第一CAN节点确定所述第一数据为允许在所述CAN总线上发送的数据。
在该实现方式提供的CAN通信方法中,第一CAN节点接收到第一数据后,可以根据虚拟通信矩阵中定义的第一MsgID进行安全防护检查,即可以获取第一数据中的MsgID,并确定第一数据的MsgID是否为虚拟通信矩阵中所定义的第一MsgID。当第一数据的MsgID是虚拟通信矩阵中所定义的第一MsgID时,第一CAN节点可以确定第一数据为允许在CAN总线上发送的数据,并向CAN总线发送第一数据。而当第一数据的MsgID不是虚拟通信矩阵中定义的第一MsgID时,第一CAN节点将不向CAN总线发送第一数据,以避免将第一设备发送的恶意数据转发至CAN总线,降低对CAN通信系统带来安全威胁,提高CAN通信系统的安全性。
在另一个示例中,所述第一CAN节点根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述 CAN总线上发送的数据,可以包括:
所述第一CAN节点获取所述第一数据的报文标识符;
所述第一CAN节点确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符,以及确定所述第一数据是否为所述虚拟通信矩阵中定义的第一预留数据;
当所述第一数据的报文标识符为所述第一报文标识符,且所述第一数据为所述第一预留数据时,所述第一CAN节点确定所述第一数据为允许在所述CAN总线上发送的数据。
在该实现方式提供的CAN通信方法中,第一CAN节点接收到第一数据后,可以根据虚拟通信矩阵中定义的第一MsgID和第一预留数据进行安全防护检查,即可以获取第一数据中的MsgID和具体内容,并确定第一数据的MsgID是否为虚拟通信矩阵中所定义的第一MsgID以及具体内容是否为虚拟通信矩阵中所定义的第一预留数据。当第一数据的MsgID是虚拟通信矩阵中所定义的第一MsgID,且具体内容为虚拟通信矩阵中所定义的第一预留数据时,第一CAN节点可以确定第一数据为允许在CAN总线上发送的数据,并向CAN总线发送第一数据。而当第一数据的MsgID不是虚拟通信矩阵中定义的第一MsgID时,第一CAN节点将不向CAN总线发送第一数据,以避免将第一设备发送的恶意数据转发至CAN总线,降低对CAN通信系统带来的安全威胁,提高CAN通信系统的安全性。
示例性的,所述第一CAN节点向所述CAN总线发送所述第一数据,可以包括:
所述第一CAN节点根据所述CAN总线对应的数据结构,对所述第一数据进行封装,得到第三数据;
所述第一CAN节点向所述CAN总线发送所述第三数据。
在该实现方式提供的CAN通信方法中,可以修改第一设备与第一CAN节点之间的传输协议,即可以在基于通信网络传输的第一数据中增加CAN数据帧对应的MsgID和数据段(data)的内容。因此,在需要将该第一设备发送的第一数据发送至CAN总线时,可以获取第一数据中的MsgID和数据段(data)的内容,并可以根据CAN总线对应的数据结构对MsgID和数据段(data)的内容进行封装,得到可以在CAN总线上广播的第三数据,以使得第一设备发送的数据可以在CAN总线上广播。
在一个示例中,所述第一CAN节点根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据,可以包括:
所述第一CAN节点获取所述第二数据的报文标识符;
所述第一CAN节点确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符;
当所述第二数据的报文标识符为所述第二报文标识符时,所述第一CAN节点确定所述第二数据为允许所述第一设备接收的数据。
在该实现方式提供的CAN通信方法中,第一CAN节点接收到第二数据后,可以根据虚拟通信矩阵中定义的第二MsgID进行安全防护检查,以避免CAN总线中传输的数据被泄露或者被非法篡改,提高CAN通信系统的安全性。
在另一个示例中,所述第一CAN节点根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据,可以包括:
所述第一CAN节点获取所述第二数据的报文标识符;
所述第一CAN节点确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符,以及确定所述第二数据是否为所述虚拟通信矩阵中定义的第二预留数据;
当所述第二数据的报文标识符为所述第二报文标识符,且所述第二数据为所述第二预留数据时,所述第一CAN节点确定所述第二数据为允许所述第一设备接收的数据。
在该实现方式提供的CAN通信方法中,第一CAN节点接收到第二数据后,可以根据虚拟通信矩阵中定义的第二MsgID和第二预留数据进行安全防护检查,以避免CAN总线中传输的数据被泄露或者被非法篡改,提高CAN通信系统的安全性。
示例性的,所述第一CAN节点向所述第一设备发送所述第二数据,可以包括:
所述第一CAN节点根据所述通信网络对应的数据结构,对所述第二数据进行封装,得到第四数据;
所述第一CAN节点向所述第一设备发送所述第四数据。
在该实现方式提供的CAN通信方法中,为使得第二CAN节点发送的第二数据可以被第一设备接收,可以获取第二数据中的MsgID和数据段(data)的内容,并根据第一设备与第一CAN节点之间的通信网络所对应的数据结构,对MsgID和数据段(data)的内容进行封装,得到可以通过通信网络传输给第一设备的数据。
第二方面,本申请实施例提供了一种CAN通信方法,应用于控制器局域网CAN通信系统,所述CAN通信系统包括第一设备、第二设备、CAN总线以及与所述CAN总线连接的至少两个CAN节点,所述至少两个CAN节点包括第一CAN节点和第二CAN节点,所述第一设备通过通信网络与所述第一CAN节点连接,所述第二CAN节点用于控制所述第二设备,所述CAN通信系统中设置有虚拟通信矩阵,所述虚拟通信矩阵为根据所述第一设备对所述CAN通信系统的原始通信矩阵进行扩展得到,所述方法可以包括:
所述第一CAN节点从所述CAN总线上获取第二数据,所述第二数据是所述第二CAN节点发送的,所述第二数据用于指示所述第一设备执行相应的交互操作;
所述第一CAN节点根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据;
当所述第二数据为允许所述第一设备接收的数据时,所述第一CAN节点向所述第一设备发送所述第二数据,以使得所述第一设备根据所述第二数据执行相应的交互操作。
在一种可能的实现方式中,所述至少两个CAN节点还包括第三CAN节点,所述方法还可以包括:
所述第一CAN节点获取第一数据,所述第一数据是所述第一设备发送的,所述第一数据用于指示所述第二设备执行相应的交互操作;
所述第一CAN节点根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据;
当所述第一数据为允许在所述CAN总线上发送的数据时,所述第一CAN节点向所述CAN总线发送所述第一数据,以使得所述第三CAN节点从所述CAN总线获取所述第一数据,并根据所述第一数据控制所述第二设备执行相应的交互操作。
在一种可能的实现方式中,所述虚拟通信矩阵是在所述原始通信矩阵的基础上,增加对第一报文标识符的定义以及在第一交互设备接收的数据的报文标识符中增加所述第一报文标识符,和/或是在所述原始通信矩阵的基础上,增加对第二报文标识符的定义以及在第二交互设备发送的数据被接收的CAN节点中增加所述第一CAN节点;
其中,所述第一报文标识符为允许所述第一设备发送的数据的报文标识符,所述第二报文标识符为允许所述第一设备接收的数据的报文标识符,所述第一交互设备和所述第二交互设备为所述CAN通信系统中与所述第一设备进行交互的设备,所述第一交互设备包括所述第二设备,和/或所述第二交互设备包括所述第二设备。
在另一种可能的实现方式中,所述虚拟通信矩阵中还定义有第一预留数据和/或第二预留数据,所述第一预留数据为允许所述第一设备通过所述第一CAN节点在所述CAN总线上发送的数据,所述第二预留数据为允许所述第一设备通过所述第一CAN节点从所述CAN总线获取的数据。
在一个示例中,所述第一CAN节点根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据,可以包括:
所述第一CAN节点获取所述第一数据的报文标识符;
所述第一CAN节点确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符;
当所述第一数据的报文标识符为所述第一报文标识符时,所述第一CAN节点确定所述第一数据为允许在所述CAN总线上发送的数据。
在另一个示例中,所述第一CAN节点根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据,可以包括:
所述第一CAN节点获取所述第一数据的报文标识符;
所述第一CAN节点确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符,以及确定所述第一数据是否为所述虚拟通信矩阵中定义的第一预留数据;
当所述第一数据的报文标识符为所述第一报文标识符,且所述第一数据为所述第一预留数据时,所述第一CAN节点确定所述第一数据为允许在所述CAN总线上发送的数据。
示例性的,所述第一CAN节点向所述CAN总线发送所述第一数据,可以包括:
所述第一CAN节点根据所述CAN总线对应的数据结构,对所述第一数据进行封装,得到第三数据;
所述第一CAN节点向所述CAN总线发送所述第三数据。
在一个示例中,所述第一CAN节点根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据,可以包括:
所述第一CAN节点获取所述第二数据的报文标识符;
所述第一CAN节点确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符;
当所述第二数据的报文标识符为所述第二报文标识符时,所述第一CAN节点确定所述第二数据为允许所述第一设备接收的数据。
在另一个示例中,所述第一CAN节点根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据,可以包括:
所述第一CAN节点获取所述第二数据的报文标识符;
所述第一CAN节点确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符,以及确定所述第二数据是否为所述虚拟通信矩阵中定义的第二预留数据;
当所述第二数据的报文标识符为所述第二报文标识符,且所述第二数据为所述第二预留数据时,所述第一CAN节点确定所述第二数据为允许所述第一设备接收的数据。
示例性的,所述第一CAN节点向所述第一设备发送所述第二数据,可以包括:
所述第一CAN节点根据所述通信网络对应的数据结构,对所述第二数据进行封装,得到第四数据;
所述第一CAN节点向所述第一设备发送所述第四数据。
第三方面,本申请实施例提供了一种CAN通信装置,应用于控制器局域网CAN通信系统,所述CAN通信系统包括第一设备、第二设备、CAN总线以及与所述CAN总线连接的至少两个CAN节点,所述至少两个CAN节点包括第一CAN节点和第二CAN节点,所述第一设备通过通信网络与所述第一CAN节点连接,所述第二CAN节点用于控制所述第二设备,所述CAN通信系统中设置有虚拟通信矩阵,所述虚拟通信矩阵为根据所述第一设备对所述CAN通信系统的原始通信矩阵进行扩展得到,所述装置可以包括:
第一数据获取模块,用于获取第一数据,所述第一数据是所述第一设备发送的,所述第一数据用于指示所述第二设备执行相应的交互操作;
第一数据确定模块,用于根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据;
第一数据发送模块,用于当所述第一数据为允许在所述CAN总线上发送的数据时,向所述CAN总线发送所述第一数据,以使得所述第二CAN节点从所述CAN总线获取所述第一数据,并根据所述第一数据控制所述第二设备执行相应的交互操作。
在一种可能的实现方式中,所述至少两个CAN节点还包括第三CAN节点,所述装置还可以包括:
第二数据获取模块,用于从所述CAN总线上获取第二数据,所述第二数据是所述第三CAN节点发送的,所述第二数据用于指示所述第一设备执行相应的交互操作;
第二数据确定模块,用于根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据;
第二数据发送模块,用于当所述第二数据为允许所述第一设备接收的数据时,向所述第一设备发送所述第二数据,以使得所述第一设备根据所述第二数据执行相应的交互操作。
在一种可能的实现方式中,所述虚拟通信矩阵是在所述原始通信矩阵的基础上,增加对第一报文标识符的定义以及在第一交互设备接收的数据的报文标识符中增加所述第一报文标识符,和/或是在所述原始通信矩阵的基础上,增加对第二报文标识符的定义以及在第二交互设备发送的数据被接收的CAN节点中增加所述第一CAN节点;
其中,所述第一报文标识符为允许所述第一设备发送的数据的报文标识符,所述第二报文标识符为允许所述第一设备接收的数据的报文标识符,所述第一交互设备和所述第二交互设备为所述CAN通信系统中与所述第一设备进行交互的设备,所述第一交互设备包括所述第二设备,和/或所述第二交互设备包括所述第二设备。
在另一种可能的实现方式中,所述虚拟通信矩阵中还定义有第一预留数据和/或第二预留数据,所述第一预留数据为允许所述第一设备通过所述第一CAN节点在所述CAN总线上发送的数据,所述第二预留数据为允许所述第一设备通过所述第一CAN节点从所述CAN总线获取的数据。
在一个示例中,所述第一数据确定模块,可以包括:
第一标识符获取单元,用于获取所述第一数据的报文标识符;
第一标识符确定单元,用于确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符;
第一数据确定单元,用于当所述第一数据的报文标识符为所述第一报文标识符时,确定所述第一数据为允许在所述CAN总线上发送的数据。
在另一个示例中,所述第一数据确定模块,还可以包括:
第二标识符获取单元,用于获取所述第一数据的报文标识符;
第二标识符确定单元,用于确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符,以及确定所述第一数据是否为所述虚拟通信矩阵中定义的第一预留数据;
第二数据确定单元,用于当所述第一数据的报文标识符为所述第一报文标识符,且所述第一数据为所述第一预留数据时,确定所述第一数据为允许在所述CAN总线上发送的数据。
示例性的,所述第一数据发送模块,可以包括:
第一数据封装单元,用于根据所述CAN总线对应的数据结构,对所述第一数据进行封装,得到第三 数据;
第一发送单元,用于向所述CAN总线发送所述第三数据。
在一个示例中,所述第二数据确定模块,可以包括:
第三标识符获取单元,用于获取所述第二数据的报文标识符;
第三标识符确定单元,用于确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符;
第三数据确定单元,用于当所述第二数据的报文标识符为所述第二报文标识符时,确定所述第二数据为允许所述第一设备接收的数据。
在另一个示例中,所述第二数据确定模块,可以包括:
第四标识符获取单元,用于获取所述第二数据的报文标识符;
第四标识符确定单元,用于确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符,以及确定所述第二数据是否为所述虚拟通信矩阵中定义的第二预留数据;
第四数据确定单元,用于当所述第二数据的报文标识符为所述第二报文标识符,且所述第二数据为所述第二预留数据时,确定所述第二数据为允许所述第一设备接收的数据。
示例性的,所述第二数据发送模块,可以包括:
第二数据封装单元,用于根据所述通信网络对应的数据结构,对所述第二数据进行封装,得到第四数据;
第二发送单元,用于向所述第一设备发送所述第四数据。
第四方面,本申请实施例提供了一种CAN通信装置,应用于控制器局域网CAN通信系统,所述CAN通信系统包括第一设备、第二设备、CAN总线以及与所述CAN总线连接的至少两个CAN节点,所述至少两个CAN节点包括第一CAN节点和第二CAN节点,所述第一设备通过通信网络与所述第一CAN节点连接,所述第二CAN节点用于控制所述第二设备,所述CAN通信系统中设置有虚拟通信矩阵,所述虚拟通信矩阵为根据所述第一设备对所述CAN通信系统的原始通信矩阵进行扩展得到,所述装置可以包括:
第二数据获取模块,用于从所述CAN总线上获取第二数据,所述第二数据是所述第二CAN节点发送的,所述第二数据用于指示所述第一设备执行相应的交互操作;
第二数据确定模块,用于根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据;
第二数据发送模块,用于当所述第二数据为允许所述第一设备接收的数据时,向所述第一设备发送所述第二数据,以使得所述第一设备根据所述第二数据执行相应的交互操作。
在一种可能的实现方式中,所述至少两个CAN节点还包括第三CAN节点,所述装置还包括:
第一数据获取模块,用于获取第一数据,所述第一数据是所述第一设备发送的,所述第一数据用于指示所述第二设备执行相应的交互操作;
第一数据确定模块,用于根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据;
第一数据发送模块,用于当所述第一数据为允许在所述CAN总线上发送的数据时,向所述CAN总线发送所述第一数据,以使得所述第三CAN节点从所述CAN总线获取所述第一数据,并根据所述第一数据控制所述第二设备执行相应的交互操作。
在一种可能的实现方式中,所述虚拟通信矩阵是在所述原始通信矩阵的基础上,增加对第一报文标识符的定义以及在第一交互设备接收的数据的报文标识符中增加所述第一报文标识符,和/或是在所述原始通 信矩阵的基础上,增加对第二报文标识符的定义以及在第二交互设备发送的数据被接收的CAN节点中增加所述第一CAN节点;
其中,所述第一报文标识符为允许所述第一设备发送的数据的报文标识符,所述第二报文标识符为允许所述第一设备接收的数据的报文标识符,所述第一交互设备和所述第二交互设备为所述CAN通信系统中与所述第一设备进行交互的设备,所述第一交互设备包括所述第二设备,和/或所述第二交互设备包括所述第二设备。
在另一种可能的实现方式中,所述虚拟通信矩阵中还定义有第一预留数据和/或第二预留数据,所述第一预留数据为允许所述第一设备通过所述第一CAN节点在所述CAN总线上发送的数据,所述第二预留数据为允许所述第一设备通过所述第一CAN节点从所述CAN总线获取的数据。
在一个示例中,所述第一数据确定模块,可以包括:
第一标识符获取单元,用于获取所述第一数据的报文标识符;
第一标识符确定单元,用于确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符;
第一数据确定单元,用于当所述第一数据的报文标识符为所述第一报文标识符时,确定所述第一数据为允许在所述CAN总线上发送的数据。
在另一个示例中,所述第一数据确定模块,还可以包括:
第二标识符获取单元,用于获取所述第一数据的报文标识符;
第二标识符确定单元,用于确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符,以及确定所述第一数据是否为所述虚拟通信矩阵中定义的第一预留数据;
第二数据确定单元,用于当所述第一数据的报文标识符为所述第一报文标识符,且所述第一数据为所述第一预留数据时,确定所述第一数据为允许在所述CAN总线上发送的数据。
示例性的,所述第一数据发送模块,可以包括:
第一数据封装单元,用于根据所述CAN总线对应的数据结构,对所述第一数据进行封装,得到第三数据;
第一发送单元,用于向所述CAN总线发送所述第三数据。
在一个示例中,所述第二数据确定模块,可以包括:
第三标识符获取单元,用于获取所述第二数据的报文标识符;
第三标识符确定单元,用于确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符;
第三数据确定单元,用于当所述第二数据的报文标识符为所述第二报文标识符时,确定所述第二数据为允许所述第一设备接收的数据。
在另一个示例中,所述第二数据确定模块,可以包括:
第四标识符获取单元,用于获取所述第二数据的报文标识符;
第四标识符确定单元,用于确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符,以及确定所述第二数据是否为所述虚拟通信矩阵中定义的第二预留数据;
第四数据确定单元,用于当所述第二数据的报文标识符为所述第二报文标识符,且所述第二数据为所述第二预留数据时,确定所述第二数据为允许所述第一设备接收的数据。
示例性的,所述第二数据发送模块,可以包括:
第二数据封装单元,用于根据所述通信网络对应的数据结构,对所述第二数据进行封装,得到第四数 据;
第二发送单元,用于向所述第一设备发送所述第四数据。
第五方面,本申请实施例提供了一种CAN通信系统,包括第一设备、第二设备、CAN总线以及与所述CAN总线连接的至少两个CAN节点,所述至少两个CAN节点包括第一CAN节点和第二CAN节点,所述第一设备通过通信网络与所述第一CAN节点连接,所述第二CAN节点用于控制所述第二设备,所述CAN通信系统中设置有虚拟通信矩阵,所述虚拟通信矩阵为根据所述第一设备对所述CAN通信系统的原始通信矩阵进行扩展得到;
所述第一设备用于向所述第一CAN节点发送第一数据,所述第一数据用于指示所述第二设备执行相应的交互操作;
所述第一CAN节点用于获取第一数据,并根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据;
当所述第一数据为允许在所述CAN总线上发送的数据时,所述第一CAN节点还用于向所述CAN总线发送所述第一数据;
所述第二CAN节点用于从所述CAN总线获取所述第一数据,并根据所述第一数据控制所述第二设备执行相应的交互操作。
在一种可能的实现方式中,所述至少两个CAN节点还包括第三CAN节点;
所述第三CAN节点用于向所述CAN总线发送第二数据,所述第二数据用于指示所述第一设备执行相应的交互操作;
所述第一CAN节点还用于从所述CAN总线上获取所述第二数据,并根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据;
当所述第二数据为允许所述第一设备接收的数据时,所述第一CAN节点还用于向所述第一设备发送所述第二数据;
所述第一设备用于接收所述第二数据,并根据所述第二数据执行相应的交互操作。
在一种可能的实现方式中,所述虚拟通信矩阵是在所述原始通信矩阵的基础上,增加对第一报文标识符的定义以及在第一交互设备接收的数据的报文标识符中增加所述第一报文标识符,和/或是在所述原始通信矩阵的基础上,增加对第二报文标识符的定义以及在第二交互设备发送的数据被接收的CAN节点中增加所述第一CAN节点;
其中,所述第一报文标识符为允许所述第一设备发送的数据的报文标识符,所述第二报文标识符为允许所述第一设备接收的数据的报文标识符,所述第一交互设备和所述第二交互设备为所述CAN通信系统中与所述第一设备进行交互的设备,所述第一交互设备包括所述第二设备,和/或所述第二交互设备包括所述第二设备。
在另一种可能的实现方式中,所述虚拟通信矩阵中还定义有第一预留数据和/或第二预留数据,所述第一预留数据为允许所述第一设备通过所述第一CAN节点在CAN总线上发送的数据,所述第二预留数据为允许所述第一设备通过所述第一CAN节点从CAN总线获取的数据。
在一个示例中,所述第一CAN节点还用于获取所述第一数据的报文标识符,并确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符;
当所述第一数据的报文标识符为所述第一报文标识符时,所述第一CAN节点还用于确定所述第一数据为允许在所述CAN总线上发送的数据。
在另一个示例中,所述第一CAN节点还用于获取所述第一数据的报文标识符,并确定所述第一数据 的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符,以及确定所述第一数据是否为所述虚拟通信矩阵中定义的第一预留数据;
当所述第一数据的报文标识符为所述第一报文标识符,且所述第一数据为所述第一预留数据时,所述第一CAN节点还用于确定所述第一数据为允许在所述CAN总线上发送的数据。
示例性的,所述第一CAN节点还用于根据所述CAN总线对应的数据结构,对所述第一数据进行封装,得到第三数据,并向所述CAN总线发送所述第三数据。
在一个示例中,所述第一CAN节点还用于获取所述第二数据的报文标识符;确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符;
当所述第二数据的报文标识符为所述第二报文标识符时,所述第一CAN节点还用于确定所述第二数据为允许所述第一设备接收的数据。
在另一个示例中,所述第一CAN节点还用于获取所述第二数据的报文标识符;确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符,以及确定所述第二数据是否为所述虚拟通信矩阵中定义的第二预留数据;
当所述第二数据的报文标识符为所述第二报文标识符,且所述第二数据为所述第二预留数据时,所述第一CAN节点还用于确定所述第二数据为允许所述第一设备接收的数据。
示例性的,所述第一CAN节点还用于根据所述通信网络对应的数据结构,对所述第二数据进行封装,得到第四数据,并向所述第一设备发送所述第四数据。
可选的,所述第一设备与所述第一CAN节点之间通过多连接方式连接。
可选的,所述第一CAN节点中设置有速率调节缓冲区,所述速率调节缓冲区用于存储所述第一CAN节点获取的所述第一数据。
第六方面,本申请实施例提供了一种CAN通信系统,包括第一设备、第二设备、CAN总线以及与所述CAN总线连接的至少两个CAN节点,所述至少两个CAN节点包括第一CAN节点和第二CAN节点,所述第一设备通过通信网络与所述第一CAN节点连接,所述第二CAN节点用于控制所述第二设备,所述CAN通信系统中设置有虚拟通信矩阵,所述虚拟通信矩阵为根据所述第一设备对所述CAN通信系统的原始通信矩阵进行扩展得到;
所述第二CAN节点用于向所述CAN总线发送第二数据,所述第二数据用于指示所述第一设备执行相应的交互操作;
所述第一CAN节点用于从所述CAN总线上获取所述第二数据,并根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据;
当所述第二数据为允许所述第一设备接收的数据时,所述第一CAN节点还用于向所述第一设备发送所述第二数据;
所述第一设备用于接收所述第二数据,并根据所述第二数据执行相应的交互操作。
在一种可能的实现方式中,所述至少两个CAN节点还包括第三CAN节点;
所述第一设备用于向所述第一CAN节点发送第一数据,所述第一数据用于指示所述第二设备执行相应的交互操作;
所述第一CAN节点用于获取第一数据,并根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据;
当所述第一数据为允许在所述CAN总线上发送的数据时,所述第一CAN节点还用于向所述CAN总线发送所述第一数据;
所述第三CAN节点用于从所述CAN总线获取所述第一数据,并根据所述第一数据控制所述第二设备执行相应的交互操作。
在一种可能的实现方式中,所述虚拟通信矩阵是在所述原始通信矩阵的基础上,增加对第一报文标识符的定义以及在第一交互设备接收的数据的报文标识符中增加所述第一报文标识符,和/或是在所述原始通信矩阵的基础上,增加对第二报文标识符的定义以及在第二交互设备发送的数据被接收的CAN节点中增加所述第一CAN节点;
其中,所述第一报文标识符为允许所述第一设备发送的数据的报文标识符,所述第二报文标识符为允许所述第一设备接收的数据的报文标识符,所述第一交互设备和所述第二交互设备为所述CAN通信系统中与所述第一设备进行交互的设备,所述第一交互设备包括所述第二设备,和/或所述第二交互设备包括所述第二设备。
在另一种可能的实现方式中,所述虚拟通信矩阵中还定义有第一预留数据和/或第二预留数据,所述第一预留数据为允许所述第一设备通过所述第一CAN节点在CAN总线上发送的数据,所述第二预留数据为允许所述第一设备通过所述第一CAN节点从CAN总线获取的数据。
在一个示例中,所述第一CAN节点还用于获取所述第一数据的报文标识符,并确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符;
当所述第一数据的报文标识符为所述第一报文标识符时,所述第一CAN节点还用于确定所述第一数据为允许在所述CAN总线上发送的数据。
在另一个示例中,所述第一CAN节点还用于获取所述第一数据的报文标识符,并确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符,以及确定所述第一数据是否为所述虚拟通信矩阵中定义的第一预留数据;
当所述第一数据的报文标识符为所述第一报文标识符,且所述第一数据为所述第一预留数据时,所述第一CAN节点还用于确定所述第一数据为允许在所述CAN总线上发送的数据。
示例性的,所述第一CAN节点还用于根据所述CAN总线对应的数据结构,对所述第一数据进行封装,得到第三数据,并向所述CAN总线发送所述第三数据。
在一个示例中,所述第一CAN节点还用于获取所述第二数据的报文标识符;确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符;
当所述第二数据的报文标识符为所述第二报文标识符时,所述第一CAN节点还用于确定所述第二数据为允许所述第一设备接收的数据。
在另一个示例中,所述第一CAN节点还用于获取所述第二数据的报文标识符;确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符,以及确定所述第二数据是否为所述虚拟通信矩阵中定义的第二预留数据;
当所述第二数据的报文标识符为所述第二报文标识符,且所述第二数据为所述第二预留数据时,所述第一CAN节点还用于确定所述第二数据为允许所述第一设备接收的数据。
示例性的,所述第一CAN节点还用于根据所述通信网络对应的数据结构,对所述第二数据进行封装,得到第四数据,并向所述第一设备发送所述第四数据。
可选的,所述第一设备与所述第一CAN节点之间通过多连接方式连接。
可选的,所述第一CAN节点中设置有速率调节缓冲区,所述速率调节缓冲区用于存储所述第一CAN节点获取的所述第一数据。
第七方面,本申请实施例提供了一种电子设备,所述电子设备中设置有CAN通信系统,所述CAN通 信系统包括第一设备、第二设备、CAN总线以及与所述CAN总线连接的至少两个CAN节点,所述至少两个CAN节点包括第一CAN节点和第二CAN节点,所述第一设备通过通信网络与所述第一CAN节点连接,所述第二CAN节点用于控制所述第二设备,所述CAN通信系统中设置有虚拟通信矩阵,所述虚拟通信矩阵为根据所述第一设备对所述CAN通信系统的原始通信矩阵进行扩展得到,所述第一CAN节点用于执行上述第一方面或第二方面中任一项所述的CAN通信方法。
其中,电子设备可以为汽车、工业设备和人工智能设备等。
第八方面,本申请实施例提供了一种电子设备,包括存储器、处理器、控制器以及收发器,所述控制器用于控制所述收发器在CAN总线上接收数据,并将接收到的数据存储至所述存储器或者发送给所述处理器,所述控制器还用于从所述处理器或者所述存储器获取数据,并控制所述收发器向CAN总线上发送获取的数据,所述存储器中存储有可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时,使所述电子设备实现上述第一方面或第二方面中任一项所述的CAN通信方法。
第九方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被计算机执行时,使所述计算机实现上述第一方面或第二方面中任一项所述的CAN通信方法。
第十方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行上述第一方面或第二方面中任一项所述的CAN通信方法。
可以理解的是,上述第二方面至第十方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。
附图说明
图1是CAN总线广播的数据的结构示意图;
图2是本申请一实施例提供的CAN通信系统的结构示意图;
图3是本申请实施例提供的基于UDP协议传播的数据的结构示意图;
图4是本申请一实施例提供的CAN通信方法的示意性流程图;
图5是本申请另一实施例提供的CAN通信系统的结构示意图;
图6是本申请另一实施例提供的CAN通信方法的示意性流程图;
图7是本申请一实施例提供的电子设备的结构示意图。
具体实施方式
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。
还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
如在本申请说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实 施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
此外,本申请实施例中提到的“多个”应当被解释为两个或两个以上。
本申请实施例中提供的CAN通信方法中所涉及到的步骤仅仅作为示例,并非所有的步骤均是必须执行的步骤,或者并非各个信息或消息中的内容均是必选的,在使用过程中可以根据需要酌情增加或减少。本申请实施例中同一个步骤或者具有相同功能的步骤或者消息在不同实施例之间可以互相参考借鉴。
本申请实施例描述的业务场景是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定,本领域普通技术人员可知,随着网络架构的演变和新业务场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。
CAN通信系统可以广泛应用于汽车内部通信和其他工业领域场景。CAN通信系统可以包括CAN总线,以及至少两个与CAN总线连接的ECU/MCU等,即各个ECU/MCU工作时可以挂接到CAN总线上成为CAN总线的一个CAN节点。其中,各个CAN节点可以在CAN总线上发送数据,其他CAN节点可以接收CAN总线上广播的数据。应理解,CAN总线上广播的数据为CAN节点在CAN总线上发送的数据。上述所述与CAN总线连接的为ECU/MCU仅作示例性解释,不应理解为对本申请实施例的显示,本申请实施例中,与CAN总线连接的也可以为其他微处理单元等实体装置。
请参阅图1,图1示出了CAN总线广播的数据的结构示意图。如图1所示,CAN总线上广播的每一数据帧(以下称为CAN数据帧)可以包括起始(start of frame,SOF)段、仲裁(arbitration field,AF)段、控制段、数据(data)段、循环冗余校验(cyclic redundancy check,CRC)段、响应(acknowledge,ACK)段以及结束(end of frame,EOF)段。其中,AF段的内容主要为该CAN数据帧对应的报文标识符(message identifier,MsgID),MsgID决定着该CAN数据帧发送的优先级,也决定着其他CAN节点是否会接收该CAN数据帧。
在汽车等电子设备出厂时,生产者一般需定义CAN通信系统对应的通信矩阵(以下称为原始通信矩阵),汽车等电子设备内的各设备(即各设备对应的ECU/MCU)需遵循原始通信矩阵才能进行数据的收发,从而与其他设备进行交互。也就是说,原始通信矩阵定义了汽车等电子设备中的各个ECU/MCU可以接收哪些MsgID的CAN数据帧,和/或可以发送哪些MsgID的CAN数据帧,即各个ECU/MCU需要遵循原始通信矩阵的定义才能进行数据收发。
其中,当需要增加新设备至CAN通信系统时,由于原始通信矩阵中并未对该新设备进行定义,也就是说,原始通信矩阵中并未定义该新设备可以接收哪些MsgID的CAN数据帧,和/或可以发送哪些MsgID的CAN数据帧等,而且该新设备一般也不具有CAN总线接口,导致该新设备无法接入至CAN总线,无法与CAN总线上的CAN节点(即ECU/MCU)通信,从而使得该新设备无法与CAN总线上的其他设备进行交互等,极大地影响了用户体验。
为了解决上述问题,本申请实施例提供了一种CAN通信方法、电子设备及CAN通信系统,该方法中,当需要增加新设备(以下称为第一设备)至CAN总线时,可以通过通信网络将第一设备与CAN通信系统中的某一CAN节点(以下称为第一CAN节点)连接,并可以根据第一设备对CAN通信系统的原始通信矩阵进行扩展,得到虚拟通信矩阵。其中,虚拟通信矩阵中可以增加对第一设备的定义, 即可以增加对第一设备可以发送的数据的MsgID(以下将第一设备可以发送的数据的MsgID称为第一报文标识符,即第一MsgID),和/或可以接收的数据的MsgID(以下将第一设备可以接收的数据的MsgID称为第二报文标识符,即第二MsgID)的定义,并可以根据第一MsgID和/或第二MsgID修改了交互设备可以接收的数据的MsgID,和/或修改了交互设备所发送的数据可以被接收的CAN节点(即增加与第一设备连接的第一CAN节点)等,交互设备为CAN通信系统中需与第一设备进行交互的设备,以根据虚拟通信矩阵可以动态增加第一设备至CAN通信系统,使得第一设备可以与CAN总线上的其他CAN节点进行通信,从而使得第一设备可以与CAN总线上的其他设备进行交互,扩展CAN通信系统的应用范围,提升用户体验,具有较强的易用性和实用性。
需要说明的是,本申请实施例提供的CAN通信方法可以应用于汽车、工业设备和人工智能设备等。下面将以CAN通信方法应用于汽车为例,对本申请实施例中涉及的相关概念进行说明。
原始通信矩阵,为生产者根据汽车出厂时所具有的设备定义的通信矩阵,即原始通信矩阵定义了汽车出厂时具有的设备所对应的各个ECU/MCU可以接收的CAN数据帧的MsgID和/或可以发送的CAN数据帧的MsgID,以通过CAN总线实现汽车内的各设备之间的通信。应理解,一个ECU/MCU可以用于管理一个或者多个设备,因此,一个ECU/MCU可以接收多个不同MsgID的CAN数据帧和/或可以发送多个不同MsgID的CAN数据帧。
虚拟通信矩阵,为本申请实施例根据新增的第一设备对原始通信矩阵进行扩展,所得到的通信矩阵,即虚拟通信矩阵可以是在原始通信矩阵的基础上,增加了对第一MsgID和/或第二MsgID的定义,并根据第一MsgID和/或第二MsgID修改了交互设备可以接收的数据的MsgID,和/或修改了交互设备所发送的数据可以被接收的CAN节点等,其中,交互设备为CAN通信系统中需与第一设备进行交互的设备,使得第一设备根据虚拟通信矩阵可以加入至CAN通信系统,从而可以与CAN总线中原有的设备进行交互。
其中,增加对第一MsgID的定义是指增加第一设备可以发送的数据的MsgID,或者是指增加第一设备可以发送的数据的MsgID以及根据第一设备可以发送的数据在对应的MsgID中增加第一设备可以发送的信号的相关内容,使得第一设备可以向CAN总线发送第一MsgID的数据。增加对第二MsgID的定义是指可以根据第一设备需要获取的数据,在可以接收该数据的CAN节点中增加第一设备对应的第一CAN节点,或者是指可以根据第一设备需获取的数据,在该数据对应的MsgID中增加第一设备对应的信号的相关内容(例如在该MsgID中增加第一设备可以接收的信号的相关内容),使得第一设备可以从CAN总线上获取第二MsgID的数据。
由于,第一设备往往为不具有CAN总线接口的设备,因此,可以通过通信网络将第一设备与CAN通信系统中的第一CAN节点连接,以通过第一CAN节点将第一设备加入至CAN通信系统。示例性的,第一设备可以通过通信网络向第一CAN节点发送注册请求,以注册第一设备对应的第一MsgID和/或第二MsgID,使得第一设备可以通过第一CAN节点将数据发送至CAN总线,以便其他CAN节点可以从CAN总线获取第一设备发送的数据,或者使得第一设备可以通过第一CAN节点从CAN总线获取其他CAN节点发送的数据,从而使得第一设备可以与CAN通信系统中的其他设备进行交互。
应理解,第一设备对应的第一MsgID可以根据第一设备与第一CAN节点连接时,CAN通信系统中预留可用的MsgID来确定,例如可以将CAN通信系统中预留可用的MsgID中的任一个或多个确定为第一设备的第一MsgID。第一设备对应的第二MsgID可以根据第一设备所需要交互的设备可以发送至第一设备的数据的MsgID(即第一设备可以接收的数据)来确定。
例如,当需要增加香薰装置至CAN通信系统时,可以通过通信网络将香薰装置与车机ECU连接,以通过车机ECU将香薰装置加入至CAN通信系统。此时,可以根据CAN通信系统中预留可用的MsgID确定香薰装置对应的第一MsgID(例如0x0A4),和/或可以根据香薰装置对应的交互设备(例如表1中所述的空调、ECU1等)可以发送至香薰装置的数据的MsgID确定香薰装置对应的第二MsgID,另外,还可以根据第一MsgID和/或第二MsgID修改空调、ECU1等可以接收的数据的MsgID,和/或修改空调、ECU1等所发送的数据可以被接收的CAN节点等,以对原始通信矩阵进行扩展,得到表1所示的虚拟通信矩阵。
其中,表1中各MsgID对应的信号可以用于限制该MsgID所允许发送的数据。表1中仅对CAN数据帧的报文名称、报文标识符(即MsgID)、报文长度(单位为字节(byte))、信号名称、信号描述、信号长度(单位为比特(bit))、可以发送该CAN数据帧的CAN节点以及可以接收该CAN数据帧的CAN节点等部分内容进行示例性介绍,不应理解为对本申请实施例的限制,CAN数据帧还可以包括报文类型、报文发送类型、报文周期时间、信号排列格式等内容,具体内容可以参照现有通信矩阵的描述。
表1
Figure PCTCN2022141599-appb-000001
下面将结合附图和具体应用场景对本申请实施例提供的CAN通信方法进行详细说明。
请参阅图2,图2示出了本申请一实施例提供的CAN通信系统的结构示意图。如图2所示,CAN通信系统可以包括CAN总线,以及至少两个与CAN总线连接的CAN节点(图2中以CAN节点1、CAN节点2、CAN节点3和CAN节点4为例进行说明)。可以理解的是,每一个CAN节点可以是一个ECU或MCU等微处理单元。
当需新增第一设备至CAN通信系统时,可以通过通信网络将第一设备与至少两个CAN节点中的第一CAN节点(图2中以CAN节点3为第一CAN节点为例进行示例性说明)连接。应理解,CAN 通信系统中,根据第一设备对应的第一MsgID和/或第二MsgID可以设置有虚拟通信矩阵,以根据虚拟通信矩阵来进行数据收发。其中,虚拟通信矩阵的具体内容可以参照前述描述,在此不再赘述。
当还需新增第三设备至CAN通信系统时,也可以通过通信网络将第三设备与至少两个CAN节点中的某一CAN节点连接。此时,CAN通信系统中,可以根据第一设备对应的第一MsgID和/或第二MsgID,以及第三设备对应的第一MsgID和/或第二MsgID设置有虚拟通信矩阵,以根据虚拟通信矩阵来进行数据收发。应理解,第三设备连接的CAN节点与第一设备连接的第一CAN节点可以相同,也可以不同。其中,新增第一设备至CAN通信系统的过程与新增第三设备至CAN通信系统的过程类似,以下将以新增第一设备至CAN通信系统为例进行示例性说明。
需要说明的是,第一设备可以通过通用串行总线(universal serial bus,USB)接口或以太网(ethernet)等有线通信网络与第一CAN节点连接,或者可以通过无线局域网(wireless local area networks,WLAN)(例如无线保真(wireless fidelity,Wi-Fi)网络)、蓝牙(bluetooth,BT)、近距离无线通信技术(near field communication,NFC)、红外技术(infrared,IR)或2G/3G/4G/5G等无线通信网络与第一CAN节点连接。
本申请实施例中,第一CAN节点可以由技术人员根据实际场景具体设置。示例性的,技术人员可以根据第一设备所支持的通信网络和各CAN节点所支持的通信网络设置第一CAN节点。
例如,当第一设备支持的通信网络为以太网时,可以将至少两个CAN节点中支持以太网连接的CAN节点设置为第一CAN节点。
例如,当第一设备支持的通信网络为蓝牙时,可以将至少两个CAN节点中支持蓝牙连接的CAN节点设置为第一CAN节点。
例如,当第一设备支持的通信网络为WiFi时,可以将至少两个CAN节点中支持WiFi连接的CAN节点设置为第一CAN节点。
本申请实施例中,第一设备通过通信网络与第一CAN节点连接后,可以向第一CAN节点发送注册请求,以注册第一设备对应的第一MsgID和/或第二MsgID,使得可以通过第一CAN节点向CAN总线转发第一设备发送的数据,和/或可以通过第一CAN节点从CAN总线上获取第一设备所需的数据并转发给第一设备。也就是说,第一CAN节点中可以记录有第一设备对应的动态通信矩阵,且第一CAN节点记录的动态通信矩阵可以结合CAN总线系统的原始通信矩阵,形成一个动态的虚拟通信矩阵,以进行分布式信息同步。
示例性的,第一CAN节点中可以承载安全防护检查,以通过安全防护检查确定第一设备发送的数据是否可以发送至CAN总线,和/或确定CAN总线上广播的数据是否为第一设备所允许获取的数据。
应理解,为使得通过通信网络传输的数据可以在CAN总线上广播,或者为使得CAN总线上广播的数据可以通过通信网络传输至第一设备,可以修改第一设备与第一CAN节点之间的传输协议,即可以在基于通信网络传输的数据中增加CAN数据帧对应的MsgID和数据段(data)的内容,因此,在需要将第一设备发送的数据发送至CAN总线时,可以获取该数据中的MsgID和数据段(data)的内容,并根据图1所示的结构对MsgID和数据段(data)的内容进行封装,以得到CAN数据帧。或者,在需要将CAN总线上广播的数据发送给第一设备时,可以获取CAN数据帧中的MsgID和数据段(data)的内容,并可以根据通信网络对应的传输协议对MsgID和数据段(data)的内容进行封装,以得到可以通过通信网络传输的数据,从而可以通过通信网络将该数据发送给第一设备。
示例性的,在第一设备通过以太网或WiFi等通信网络与第一CAN节点连接时,第一设备与第 一CAN节点之间可以通过用户数据报(user datagram protocol,UDP)协议进行数据的收发。
请参阅图3,图3示出了本申请实施例提供的基于UDP协议传输的数据的结构示意图。如图3所示,UDP协议的每一帧数据(以下称为UDP数据帧)可以包括源端口、目的端口、报文长度、报文类型、数据段和校验段。其中,UDP数据帧的数据段可以包括UDP头部和UDP数据报。
由于CAN总线上广播的数据需为图1所示的CAN数据帧,因此,为使得第一CAN节点可以将第一设备发送的数据转发至CAN总线,和/或可以将CAN总线上广播的数据转发给第一设备,可以修改第一设备和第一CAN节点之间的UDP协议。即可以在UDP数据帧中增加CAN数据帧中MsgID和数据段(data)的内容。
示例性的,第一设备可以将UDP数据帧的UDP数据报划分为三个字段,第一个字段可以用于存放CAN数据帧中MsgID的内容,第二字段可以用于存放CAN数据帧中数据段(data)的内容,第三个字段可以为填充(padding)段。
因此,在第一CAN节点通过以太网或WiFi等通信网络接收到第一设备发送的UDP数据帧之后,第一CAN节点可以获取该UDP数据帧中MsgID和数据段(data)的内容,并按照图1所示的结构将该UDP数据帧中MsgID和数据段(data)的内容封装为CAN数据帧。然后,第一CAN节点可以将封装后的CAN数据帧转发至CAN总线。
类似的,在第一CAN节点从CAN总线获取CAN数据帧之后,第一CAN节点可以获取CAN数据帧中MsgID和数据段(data)的内容,并按照图3所示的结构将CAN数据帧中MsgID和数据段(data)的内容封装为UDP数据帧。然后,第一CAN节点可以通过以太网或WiFi等通信网络将封装后的UDP数据帧转发给第一设备。
以下将第一设备与第一CAN节点通过以太网连接为例,对本申请实施例提供的CAN通信方法进行说明。
请参阅图4,图4示出了本申请一实施例提供的CAN通信方法的示意性流程图。如图4所示,该方法可以包括:
S401、第一设备向第一CAN节点发送第一数据,第一数据用于第二设备执行交互操作,第二设备为CAN通信系统中的设备。
S402、第一CAN节点根据虚拟通信矩阵确定第一数据为可以在CAN总线上发送的数据。
S403、第一CAN节点将第一数据发送至CAN总线。
S404、CAN总线上广播第一数据。
S405、第二CAN节点获取CAN总线上广播的第一数据,第二CAN节点为第二设备对应的CAN节点。
S406、第二CAN节点根据第一数据控制第二设备执行交互操作。
本申请实施例中,当第一设备需要与CAN通信系统中的第二设备进行交互时,第一设备可以通过以太网向第一CAN节点发送图3所示结构的数据(本申请实施例将第一设备发送的数据称为第一数据),即第一数据可以为UDP数据帧。
第一CAN节点接收到第一数据后,可以进行安全防护检查。示例性的,第一CAN节点可以获取第一数据中的MsgID和data,并可以根据第一数据中的MsgID和虚拟通信矩阵确定第一数据是否为可在CAN总线上发送的数据,即确定第一数据的MsgID是否为虚拟通信矩阵中所定义的MsgID。
当第一数据的MsgID不是虚拟通信矩阵中定义的MsgID时,第一CAN节点将不向CAN总线发送第一数据,以避免将第一设备发送的恶意数据转发至CAN总线,对CAN通信系统带来安全威胁, 降低CAN通信系统的安全性。
当第一数据的MsgID是虚拟通信矩阵中所定义的MsgID时,第一CAN节点可以根据图1所示的结构对第一数据中的MsgID和data进行封装,得到第一数据封装后的第三数据,即第三数据可以为第一数据对应的CAN数据帧,也就是说,第一数据与第三数据的内容相同,但格式不相同。然后,第一CAN节点可以将第三数据发送至CAN总线,以在CAN总线上广播第三数据。
在CAN总线上广播第三数据时,CAN通信系统中的第二CAN节点(例如第二设备对应的ECU/MCU)可以从CAN总线上获取第三数据,并可以根据第三数据控制第二设备执行相应的交互操作,使得第一设备可以与第二设备进行交互。
例如,在图2所示的应用场景中,CAN节点1可以用于管理设备A,CAN节点1可以接收的数据的MsgID包括第一MsgID。当第一设备需要与设备A交互时,第一设备可以通过通信网络向CAN节点3发送第一数据。CAN节点3接收到第一数据后,获取第一数据中的MsgID和data,并根据虚拟通信矩阵和第一数据中的MsgID确定第一数据为可以在CAN总线上发送的数据,因此,CAN节点3可以对第一数据中的MsgID和data进行封装,得到第三数据,即得到CAN数据帧,并将第三数据发送至CAN总线。
在CAN总线上广播第三数据时,CAN节点1根据虚拟通信矩阵(即CAN节点1可以接收的数据的MsgID)确定第一数据为自身可以接收的数据,此时,CAN节点1可以从CAN总线上获取第三数据,并可以根据第三数据控制设备A执行对应的交互操作,从而实现第一设备与设备A之间的交互。
类似的,当CAN通信系统中的第二设备需要与第一设备进行交互时,第二设备对应的第二CAN节点可以向CAN总线发送数据(以下将第二CAN节点发送的数据称为第二数据),以在CAN总线上广播第二数据。此时,第一CAN节点可以根据第一设备对应的第二MsgID确定第二数据是否为第一设备可以接收的数据。应理解,第一设备通过通信网络与第一CAN节点连接后,可以向第一CAN节点注册第一设备对应的第一MsgID和/或第二MsgID,因此第一CAN节点中可以记录有第一设备对应的动态通信矩阵,即记录有第一设备对应的第一MsgID和/或第二MsgID,从而可以根据第二MsgID确定第二数据是否为第一设备可以接收的数据。
当第二数据为第一设备可以接收的数据时,即当第一设备对应的第二MsgID包含第二数据的MsgID时,第一CAN节点可以从CAN总线上获取第二数据,并可以获取第二数据中的MsgID和data。然后,第一CAN节点可以按照图3所示的结构对第二数据中的MsgID和data进行封装,得到第二数据封装后的第四数据,即第四数据可以为第二数据对应的UDP数据帧,也就是说,第二数据与第四数据的内容相同,但格式不相同。然后,第一CAN节点可以将第四数据转发给第一设备,使得第一设备可以根据第四数据执行对应的交互操作,从而实现第二设备与第一设备之间的交互。
例如,在图2所示的应用场景中,CAN节点2可以用于管理设备B。第一设备对应的第二MsgID可以包含第二数据的MsgID。当设备B需要与第一设备交互时,CAN节点2可以向CAN总线发送第二数据,以在CAN总线上广播第二数据。
在CAN总线上广播第二数据时,CAN节点3根据第一设备对应的第二MsgID确定第二数据为第一设备可以接收的数据,此时,CAN节点3可以从CAN总线上获取第二数据,并获取第二数据中的MsgID和data。然后,CAN节点3可以对第二数据中的MsgID和data进行封装,得到封装后的第四数据,并通过通信网络将第四数据发送给第一设备,以使得第一设备可以根据第四数据执行对应的交互操作,从而实现设备B与第一设备之间的交互。
请参阅图5,图5示出了本申请另一实施例提供的CAN通信系统的结构示意图。如图5所示, CAN通信系统可以包括至少两条CAN总线(图5中以CAN总线1和CAN总线2为例进行示例性说明)、至少两个CAN节点(图5中以CAN节点1、CAN节点2、CAN节点3、CAN节点4和CAN节点5为例进行示例性说明)和网关。其中,CAN节点1、CAN节点2和CAN节点3与CAN总线1连接,CAN节点4和CAN节点5与CAN总线2连接,CAN总线1和CAN总线2分别与网关连接。可以理解的是,每一个CAN节点可以是一个ECU或MCU等微处理单元。
网关可以对不同CAN总线上的数据进行转发,例如,网关可以将CAN总线1上广播的数据转发至CAN总线2,或者可以将CAN总线2上广播的数据转发至CAN总线1。应理解,网关还可以与云端服务器进行通信,例如,网关可以向云端服务器发送数据,或者可以从云端服务器接收数据等。
当需新增第一设备至CAN通信系统时,可以通过通信网络将第一设备与至少两个CAN节点中的第一CAN节点(图5中以CAN节点3为第一CAN节点为例进行示例性说明)连接。应理解,CAN通信系统中,根据第一设备对应的第一MsgID和/或第二MsgID可以设置有虚拟通信矩阵,以根据虚拟通信矩阵来进行数据收发。
请参阅图6,图6示出了本申请另一实施例提供的CAN通信方法的示意性流程图。如图6所示,该方法可以包括:
S601、第一设备向第一CAN节点发送第一数据,第一数据用于第二设备执行交互操作,第二设备为CAN通信系统中的设备。
S602、第一CAN节点根据虚拟通信矩阵确定第一数据为可以在CAN总线上发送的数据。
S603、第一CAN节点将第一数据发送至第一CAN总线。
S604、第一CAN总线广播第一数据。
S605、网关获取第一数据,并将第一数据转发至第二CAN总线。
S606、第二CAN总线广播第一数据。
S607、第二CAN节点获取第二CAN总线上广播的第一数据,第二CAN节点为第二设备对应的CAN节点。
S608、第二CAN节点根据第一数据控制第二设备执行交互操作。
本申请实施例中,当第一设备需要与CAN通信系统中的第二设备进行交互,且第二设备与第一CAN节点挂接在不同的CAN总线时,例如第一CAN节点挂接在第一CAN总线,第二设备挂接在第二CAN总线时,第一设备可以通过以太网向第一CAN节点发送图3所示结构的第一数据,即第一数据可以为UDP数据帧。
第一CAN节点接收到第一数据后,可以进行安全防护检查。示例性的,第一CAN节点可以获取第一数据中的MsgID和data,并根据第一数据中的MsgID和虚拟通信矩阵确定第一数据是否为可以在第一CAN总线上发送的数据,即确定第一数据的MsgID是否为虚拟通信矩阵中所定义的MsgID。
当第一数据的MsgID不是虚拟通信矩阵中定义的MsgID时,第一CAN节点将不向第一CAN总线发送第一数据,以避免将第一设备发送的恶意数据转发至第一CAN总线,对CAN通信系统带来安全威胁,降低CAN通信系统的安全性。
当第一数据的MsgID是虚拟通信矩阵中所定义的MsgID时,第一CAN节点可以根据图1所示的结构对第一数据中的MsgID和data进行封装,得到封装后的第三数据,即第三数据可以为CAN数据帧。然后,第一CAN节点将第三数据发送至第一CAN总线,以在第一CAN总线上广播第三数据。此时,网关可以将第一CAN总线上广播的第三数据转发至第二CAN总线,以在第二CAN总线 上广播第三数据。
在第二CAN总线上广播第三数据时,CAN通信系统中的第二CAN节点(例如第二设备对应的第二ECU)可以从第二CAN总线上获取第三数据,并根据第三数据控制第二设备执行相应的交互操作,使得第一设备可以与第二设备进行交互。
例如,在图5所示的应用场景中,CAN节点4可以用于管理设备D,CAN节点4可以接收的数据的MsgID可以包括第一MsgID。当第一设备需要与设备D交互时,第一设备可以通过通信网络向CAN节点3发送第一数据。CAN节点3接收到第一数据后,获取第一数据中的MsgID和data,并根据虚拟通信矩阵和第一数据中的MsgID确定第一数据为可以在CAN总线1上发送的数据,因此,CAN节点3可以对第一数据中的MsgID和data进行封装,得到封装后的第三数据,即得到CAN数据帧,并将第三数据发送至CAN总线1。此时,网关可以将CAN总线1上广播的第三数据转发至CAN总线2,以在CAN总线2上广播第三数据。
在CAN总线2上广播第三数据时,CAN节点4根据虚拟通信矩阵(即CAN节点4可以接收的数据的MsgID)确定第一数据为自身可以接收的数据,此时,CAN节点4可以从CAN总线2上获取第三数据,并可以根据第三数据控制设备D执行对应的交互操作,从而实现第一设备与设备D之间的交互。
类似的,当CAN通信系统中的第二设备需要与第一设备进行交互,且第二设备与第一CAN节点挂接在不同的CAN总线时,例如第一CAN节点挂接在第一CAN总线,第二设备挂接在第二CAN总线时,第二设备对应的第二CAN节点可以向第二CAN总线发送第二数据,以在第二CAN总线上广播第二数据。
此时,网关可以将第二CAN总线上广播的第二数据转发至第一CAN总线,以在第一CAN总线广播第二数据,第一CAN节点可以根据第一设备对应的第二MsgID确定第二数据是否为第一设备可以接收的数据。
当第二数据为第一设备可以接收的数据时,即当第一设备对应的第二MsgID包含第二数据的MsgID时,第一CAN节点可以从第一CAN总线上获取第二数据,并获取第二数据的中MsgID和data。然后,第一CAN节点可以按照图3所示的结构对第二数据中的MsgID和data进行封装,得到封装后的第四数据,即第四数据可以为UDP数据帧。然后,第一CAN节点可以将第四数据转发给第一设备,使得第一设备可以根据第四数据执行对应的交互操作,从而实现第二设备与第一设备之间的交互。
在一个示例中,为避免第一设备对CAN总线的非法使用,以确保CAN通信系统的安全性,在将第一设备加入CAN通信系统时,也可以对第一设备允许接收的具体数据和/或允许发送的具体数据进行限制。示例性的,第一CAN节点可以通过安全防护检查,来对第一设备允许接收的具体数据和/或允许发送的具体数据进行限制。
示例性的,如表1所示,可以在虚拟通信矩阵中定义第一MsgID可以发送的信号,以此对第一MsgID允许发送的数据(以下将允许发送的数据称为第一预留数据)进行限制,从而对允许第一设备发送的数据进行限制。类似的,可以在虚拟通信矩阵中对第一设备可以接收的信号进行限制,以此对允许第一设备接收的数据(以下将允许接收的数据称为第二预留数据)进行限制。因此,第一设备仅能向CAN总线发送第一预留数据,和/或仅能从CAN总线上获取第二预留数据,以避免第一设备发送恶意数据至CAN总线,和/或避免第一设备泄露或篡改CAN总线上广播的数据,提高CAN通信系统的安全性。
也就是说,在第一CAN节点接收到第一设备发送的第一数据时,第一CAN节点可以进行安全防护检查。示例性的,第一CAN节点可以确定第一数据的MsgID是否为虚拟通信矩阵中定义的MsgID,以及确定第一数据是否为虚拟通信矩阵中的第一预留数据,例如,可以对第一数据的报文头和报文内容等进行分析,确定第一数据对应的信号,从而确定第一数据是否为虚拟通信矩阵中的第一预留数据。当确定第一数据的MsgID不是虚拟通信矩阵中定义的MsgID,或者第一数据不是虚拟通信矩阵中的第一预留数据时,第一CAN节点可以不将第一数据发送至CAN总线,即可以不在CAN总线上广播第一数据,以避免第一设备发送恶意数据至CAN总线,对CAN通信系统带来安全威胁,从而降低了CAN通信系统的安全性。
当确定第一数据的MsgID为虚拟通信矩阵中定义的MsgID,且第一数据为虚拟通信矩阵中的第一预留数据时,第一CAN节点可以根据图1所示的结构对第一数据中的MsgID和data进行封装,得到封装后的第三数据,并将第三数据发送至CAN总线。因此,CAN通信系统中的其他CAN节点可以根据虚拟通信矩阵从CAN总线获取第三数据,并可以根据第三数据控制对应的设备执行相应的交互操作。
类似的,当第一CAN节点确定CAN总线上广播的第二数据为第一设备所需获取的数据时,第一CAN节点可以进行安全防护检查。示例性的,第一CAN节点可以确定第二数据是否为虚拟通信矩阵中的第二预留数据,即确定CAN总线上广播的第二数据是否为第一设备可以从CAN总线上获取的数据。当第二数据不是虚拟通信矩阵中的第二预留数据时,即第二数据不是第一设备可以获取的数据时,第一CAN节点可以不将第二数据发送给第一设备,以避免CAN总线中传输的数据被泄露或者被非法篡改,降低CAN通信系统的安全性。
当第二数据是虚拟通信矩阵中的第二预留数据时,第一CAN节点可以从CAN总线获取第二数据,并可以按照图3所示的结构对第二数据中的MsgID和data进行封装,得到第四数据,并通过通信网络将第四数据发送给第一设备,以使得第一设备可以根据第四数据执行相应的交互操作。
在一种可能的实现方式中,由于第一设备是通过以太网、蓝牙或WiFi等通信网络与第一CAN节点连接,以通过第一CAN节点加入至CAN通信系统,而由于通信网络的实时可靠性往往没有CAN总线的屏蔽双绞线的实时可靠性高,因此,本申请实施例中,可以修改第一设备的通信层和第一CAN节点的通信层,以此提升第一设备与第一CAN节点之间的实时可靠性,和/或增强时延抖动的容错性。
在一个示例中,可以修改通信层中,第一设备与第一CAN节点之间的连接方式,例如可以将第一设备与第一CAN节点之间的连接方式修改为多连接方式,以通过多连接来提升第一设备与第一CAN节点之间的实时可靠性。
例如,可以通过介质冗余协议(media redundancy protocol,MRP)、并行冗余协议(parallel redundancy protocol,PRP)或高可靠性无缝冗余(high-availability seamless redundancy,HSR)等多连接协议来进行第一设备与第一CAN节点之间的连接。
在另一个示例中,可以在第一设备发送的第一数据的起始段中添加冗余信息、纠错码或喷泉码等,和/或可以在第一数据的结束段中加冗余信息、纠错码或喷泉码等,以通过冗余实现、纠错、恢复等提升第一设备与第一CAN节点之间的实时可靠性。
在另一个示例中,可以在第一CAN节点的通信层构建速率调节缓冲区,以通过速率调节缓冲区获取第一设备发送的第一数据,并在确定正确的第一数据到达后,再将第一数据发送至CAN总线,以降低重发可能带来的时延,增强时延抖动的容错性。
示例性的,由于以太网、蓝牙或WiFi等通信网络的速率较快,为防止较快传输的第一数据对 CAN总线正在广播的其他数据造成冲击和/或干扰,第一CAN节点可以降低向CAN总线发送第一数据的速率,例如可以通过速率调节缓冲区对第一数据进行缓存,并以较低的速率向CAN总线发送第一数据。其中,第一CAN节点向CAN总线发送第一数据的速率可以根据实际场景具体确定,本申请实施例对此不作具体限制。
应理解,CAN通信系统中的虚拟通信矩阵可以根据实际应用场景进行升级更新,例如可以根据未来出现的实际应用场景增加或删除虚拟通信矩阵中所定义的部分内容,和/或修改虚拟通信矩阵中定义的部分内容等,以满足未来可能出现的应用场景的使用需求,可以有效提升用户体验。
下面结合一些可能的应用场景对本申请实施例提供的CAN通信方法进行示例性说明。
例如,当需要添加行车记录仪至汽车的CAN通信系统时,可以通过通信网络(例如车载以太网或者USB)将行车记录仪与CAN通信系统中的某一CAN节点(例如车机ECU)进行连接,以使得行车记录仪可以通过车机ECU与CAN通信系统中的车身控制域ECU等进行交互,从而实现紧急碰撞时,车身控制域ECU可以向行车记录仪发送拍照请求,以启动行车记录仪进行拍照,或在行车记录仪检测到行人或车辆较近时,可以向车身控制域ECU发送危险提醒,以通过车身控制域ECU执行相应的操作来避免事故发生。
此时,CAN通信系统中,虚拟通信矩阵可以是指在汽车的原始通信矩阵的基础上,定义有行车记录仪对应的第一MsgID(即行车记录仪可以发送的数据的MsgID)。同时,根据行车记录仪与车身控制域ECU的交互,虚拟通信矩阵还定义有行车记录仪对应的第二MsgID(即行车记录仪可以接收的数据的MsgID,例如可以包括车身控制域ECU等所发送的数据的MsgID),以及修改了车身控制域ECU可以接收的数据的MsgID(例如,修改车身控制域ECU可以接收的数据的MsgID,使得车身控制域ECU可以接收“危险提醒”的MsgID)和所发送的数据可以被接收的CAN节点(例如,修改“拍照请求”可以被接收的CAN节点包括行车记录仪)等。同时,虚拟通信矩阵中还可以定义有行车记录仪可以接收的数据(例如拍照请求等)和可以发送的数据(例如危险提醒等)。
其中,在行车记录仪通过车载以太网或者USB等通信网络与车机ECU连接后,行车记录仪可以向车机ECU发送注册请求,以向车机ECU注册行车记录仪对应的第一MsgID和第二MsgID,即通过注册告知车机ECU,行车记录仪可以发送的数据的MsgID和可以接收的数据的MsgID。
当出现碰撞时,车身控制域ECU可以向CAN总线发送数据(例如拍照请求),以告知行车记录仪进行拍照。此时,车机ECU根据行车记录仪对应的第二MsgID和该数据的MsgID确定该数据为行车记录仪可以接收的数据,并根据虚拟通信矩阵(即虚拟通信矩阵中定义的行车记录仪可以接收的数据)确定该数据为行车记录仪可接收的数据,因此,车机ECU可以从CAN总线获取该数据,并根据图3所示的结构将该数据转换为UDP数据帧。然后,车机ECU可以通过车载以太网或者USB等通信网络将该UDP数据帧发送给行车记录仪。行车记录仪接收到该UDP数据帧后,可以进行拍照。
或者,当行车记录仪检测到行人或车辆距离较近时,行车记录仪可以通过车载以太网或者USB等通信网络向车机ECU发送数据(例如危险提醒),以将感知到的危险情况告知车身控制域ECU。此时,车机ECU根据该数据的MsgID和虚拟通信矩阵(即虚拟通信矩阵中定义的行车记录仪可以发送的数据)确定该数据为可以在CAN总线上广播的数据,因此,车机ECU可以将该数据发送至CAN总线,以在CAN总线广播该数据。车身控制域ECU根据自身可以接收的数据的MsgID从CAN总线获取该数据,并根据该数据执行对应的交互操作,例如可以主动加大刹车力度等,以防止事故发生。
例如,当需要新增机器人至汽车的CAN通信系统来读取车内状况(例如车窗状态、遮阳帘状态 或车内温度等,具体可以读取的数据可以在虚拟通信矩阵中进行定义),以根据车内状况辅助告警和/或提示温度时,可以通过通信网络(例如WiFi)将机器人与CAN通信系统中的某一CAN节点(例如车机ECU)进行连接,使得机器人可通过车机ECU与CAN通信系统中的车身控制域ECU等进行交互。
此时,CAN通信系统中,根据机器人与车身控制域ECU等的交互,虚拟通信矩阵可以定义有机器人对应的第二MsgID(即机器人可以接收的数据的MsgID,例如可以包括车身控制域ECU所发送的数据的MsgID),同时对车身控制域ECU等所发送的数据可以接收的CAN节点进行了修改,即增加了机器人对应的车机ECU,使得机器人可以通过车机ECU获取车身控制域ECU等发送的数据。
其中,在机器人通过WiFi等通信网络与车机ECU连接后,机器人可以向车机ECU发送注册请求,以向车机ECU注册机器人对应的第二MsgID,即通过注册告知车机ECU,机器人可以接收的数据的MsgID。
因此,当CAN总线上广播的数据为车窗状态、遮阳帘状态或车内温度等数据时,车机ECU根据机器人对应的第二MsgID和该数据的MsgID确定该数据为机器人所需接收的数据,并根据虚拟通信矩阵(即虚拟通信矩阵中定义的机器人可以接收的数据)确定该数据为机器人可接收的数据,因此,车机ECU可以从CAN总线获取该数据,并根据图3所示的结构将该数据转换为UDP数据帧。然后,车机ECU可以通过WiFi等通信网络将该UDP数据帧发送给机器人。机器人接收到该UDP数据帧后,可以进行车窗状态或车内温度等的播报提示,或者可以进行车窗未关闭或温度过高或温度过低等的告警。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
对应于上文实施例所述的CAN通信方法,本申请实施例还提供了一种CAN通信装置,该装置的各个模块可以对应实现CAN通信方法的各个步骤。
需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例部分,此处不再赘述。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
请参阅图7,图7示出了本申请实施例提供的电子设备的结构示意图。如图7所示,该电子设备7可以包括至少一个处理器70、至少一个存储器71、控制器72(还可以称为CAN控制器)以及收发器73,收发器可以包括接收器和/或发送器。处理器70可以分别与控制器72和存储器71连接,控制器72还分别与存储器71和收发器73连接。
其中,存储器71可以存储应用数据、计算机程序等数据。处理器70是指具有运算能力的器件,例如处理器可以为微控制单元(Microcontroller Unit,MCU)、中央处理器(Central Processing Unit,CPU)等。处理器70可以从存储器71中读取并执行计算机程序,以使电子设备7实现上述任意各个方法实施例中的步骤。处理器70还可以对存储器71中的应用数据进行处理等。控制器72可以控制接收 器在CAN总线上接收数据,并将接收到的数据存储至存储器71或者发送给处理器70。控制器72还可以从处理器70或者存储器71获取数据,并控制发送器在CAN总线上发送该数据。
可选的,控制器72可以设置在处理器70的内部,也可以设置在处理器70的外部(图7中以设置在处理器70的外部为例进行示例性说明)。类似的,存储器71可以设置在处理器70的内部,也可以设置在处理器70的外部(图7中以设置在处理器70的外部为例进行示例性说明)。
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被计算机执行时,使所述计算机实现上述任意各个方法实施例中的步骤。
本申请实施例提供了一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备实现上述任意各个方法实施例中的步骤。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读存储介质至少可以包括:能够将计算机程序代码携带到装置/电子设备的任何实体或装置、记录介质、计算机存储器、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读存储介质不可以是电载波信号和电信信号。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
在本申请所提供的实施例中,应该理解到,所揭露的装置/电子设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/电子设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (25)

  1. 一种CAN通信方法,其特征在于,应用于控制器局域网CAN通信系统,所述CAN通信系统包括第一设备、第二设备、CAN总线以及与所述CAN总线连接的至少两个CAN节点,所述至少两个CAN节点包括第一CAN节点和第二CAN节点,所述第一设备通过通信网络与所述第一CAN节点连接,所述第二CAN节点用于控制所述第二设备,所述CAN通信系统中设置有虚拟通信矩阵,所述虚拟通信矩阵为根据所述第一设备对所述CAN通信系统的原始通信矩阵进行扩展得到,所述方法包括:
    所述第一CAN节点获取第一数据,所述第一数据是所述第一设备发送的,所述第一数据用于指示所述第二设备执行相应的交互操作;
    所述第一CAN节点根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据;
    当所述第一数据为允许在所述CAN总线上发送的数据时,所述第一CAN节点向所述CAN总线发送所述第一数据,以使得所述第二CAN节点从所述CAN总线获取所述第一数据,并根据所述第一数据控制所述第二设备执行相应的交互操作。
  2. 根据权利要求1所述的方法,其特征在于,所述至少两个CAN节点还包括第三CAN节点,所述方法还包括:
    所述第一CAN节点从所述CAN总线上获取第二数据,所述第二数据是所述第三CAN节点发送的,所述第二数据用于指示所述第一设备执行相应的交互操作;
    所述第一CAN节点根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据;
    当所述第二数据为允许所述第一设备接收的数据时,所述第一CAN节点向所述第一设备发送所述第二数据,以使得所述第一设备根据所述第二数据执行相应的交互操作。
  3. 根据权利要求1或2所述的方法,其特征在于,所述虚拟通信矩阵是在所述原始通信矩阵的基础上,增加对第一报文标识符的定义以及在第一交互设备接收的数据的报文标识符中增加所述第一报文标识符,和/或是在所述原始通信矩阵的基础上,增加对第二报文标识符的定义以及在第二交互设备发送的数据被接收的CAN节点中增加所述第一CAN节点;
    其中,所述第一报文标识符为允许所述第一设备发送的数据的报文标识符,所述第二报文标识符为允许所述第一设备接收的数据的报文标识符,所述第一交互设备和所述第二交互设备为所述CAN通信系统中与所述第一设备进行交互的设备,所述第一交互设备包括所述第二设备,和/或所述第二交互设备包括所述第二设备。
  4. 根据权利要求3所述的方法,其特征在于,所述虚拟通信矩阵中还定义有第一预留数据和/或第二预留数据,所述第一预留数据为允许所述第一设备通过所述第一CAN节点在所述CAN总线上发送的数据,所述第二预留数据为允许所述第一设备通过所述第一CAN节点从所述CAN总线获取的数据。
  5. 根据权利要求1至4中任一项所述的方法,其特征在于,所述第一CAN节点根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据,包括:
    所述第一CAN节点获取所述第一数据的报文标识符;
    所述第一CAN节点确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符;
    当所述第一数据的报文标识符为所述第一报文标识符时,所述第一CAN节点确定所述第一数据为允许在所述CAN总线上发送的数据。
  6. 根据权利要求1至4中任一项所述的方法,其特征在于,所述第一CAN节点根据所述虚拟通信矩阵, 确定所述第一数据是否为允许在所述CAN总线上发送的数据,包括:
    所述第一CAN节点获取所述第一数据的报文标识符;
    所述第一CAN节点确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符,以及确定所述第一数据是否为所述虚拟通信矩阵中定义的第一预留数据;
    当所述第一数据的报文标识符为所述第一报文标识符,且所述第一数据为所述第一预留数据时,所述第一CAN节点确定所述第一数据为允许在所述CAN总线上发送的数据。
  7. 根据权利要求1至6中任一项所述的方法,其特征在于,所述第一CAN节点向所述CAN总线发送所述第一数据,包括:
    所述第一CAN节点根据所述CAN总线对应的数据结构,对所述第一数据进行封装,得到第三数据;
    所述第一CAN节点向所述CAN总线发送所述第三数据。
  8. 根据权利要求2所述的方法,其特征在于,所述第一CAN节点根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据,包括:
    所述第一CAN节点获取所述第二数据的报文标识符;
    所述第一CAN节点确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符;
    当所述第二数据的报文标识符为所述第二报文标识符时,所述第一CAN节点确定所述第二数据为允许所述第一设备接收的数据。
  9. 根据权利要求2所述的方法,其特征在于,所述第一CAN节点根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据,包括:
    所述第一CAN节点获取所述第二数据的报文标识符;
    所述第一CAN节点确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符,以及确定所述第二数据是否为所述虚拟通信矩阵中定义的第二预留数据;
    当所述第二数据的报文标识符为所述第二报文标识符,且所述第二数据为所述第二预留数据时,所述第一CAN节点确定所述第二数据为允许所述第一设备接收的数据。
  10. 根据权利要求2、8至9中任一项所述的方法,其特征在于,所述第一CAN节点向所述第一设备发送所述第二数据,包括:
    所述第一CAN节点根据所述通信网络对应的数据结构,对所述第二数据进行封装,得到第四数据;
    所述第一CAN节点向所述第一设备发送所述第四数据。
  11. 一种CAN通信系统,其特征在于,包括第一设备、第二设备、CAN总线以及与所述CAN总线连接的至少两个CAN节点,所述至少两个CAN节点包括第一CAN节点和第二CAN节点,所述第一设备通过通信网络与所述第一CAN节点连接,所述第二CAN节点用于控制所述第二设备,所述CAN通信系统中设置有虚拟通信矩阵,所述虚拟通信矩阵为根据所述第一设备对所述CAN通信系统的原始通信矩阵进行扩展得到;
    所述第一设备用于向所述第一CAN节点发送第一数据,所述第一数据用于指示所述第二设备执行相应的交互操作;
    所述第一CAN节点用于获取第一数据,并根据所述虚拟通信矩阵,确定所述第一数据是否为允许在所述CAN总线上发送的数据;
    当所述第一数据为允许在所述CAN总线上发送的数据时,所述第一CAN节点还用于向所述CAN总线发送所述第一数据;
    所述第二CAN节点用于从所述CAN总线获取所述第一数据,并根据所述第一数据控制所述第二设备执行相应的交互操作。
  12. 根据权利要求11所述的系统,其特征在于,所述至少两个CAN节点还包括第三CAN节点;
    所述第三CAN节点用于向所述CAN总线发送第二数据,所述第二数据用于指示所述第一设备执行相应的交互操作;
    所述第一CAN节点还用于从所述CAN总线上获取所述第二数据,并根据所述虚拟通信矩阵,确定所述第二数据是否为允许所述第一设备接收的数据;
    当所述第二数据为允许所述第一设备接收的数据时,所述第一CAN节点还用于向所述第一设备发送所述第二数据;
    所述第一设备用于接收所述第二数据,并根据所述第二数据执行相应的交互操作。
  13. 根据权利要求11或12所述的系统,其特征在于,所述虚拟通信矩阵是在所述原始通信矩阵的基础上,增加对第一报文标识符的定义以及在第一交互设备接收的数据的报文标识符中增加所述第一报文标识符,和/或是在所述原始通信矩阵的基础上,增加对第二报文标识符的定义以及在第二交互设备发送的数据被接收的CAN节点中增加所述第一CAN节点;
    其中,所述第一报文标识符为允许所述第一设备发送的数据的报文标识符,所述第二报文标识符为允许所述第一设备接收的数据的报文标识符,所述第一交互设备和所述第二交互设备为所述CAN通信系统中与所述第一设备进行交互的设备,所述第一交互设备包括所述第二设备,和/或所述第二交互设备包括所述第二设备。
  14. 根据权利要求13所述的系统,其特征在于,所述虚拟通信矩阵中还定义有第一预留数据和/或第二预留数据,所述第一预留数据为允许所述第一设备通过所述第一CAN节点在CAN总线上发送的数据,所述第二预留数据为允许所述第一设备通过所述第一CAN节点从CAN总线获取的数据。
  15. 根据权利要求11至14中任一项所述的系统,其特征在于,所述第一CAN节点还用于获取所述第一数据的报文标识符,并确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符;
    当所述第一数据的报文标识符为所述第一报文标识符时,所述第一CAN节点还用于确定所述第一数据为允许在所述CAN总线上发送的数据。
  16. 根据权利要求11至14中任一项所述的系统,其特征在于,所述第一CAN节点还用于获取所述第一数据的报文标识符,并确定所述第一数据的报文标识符是否为所述虚拟通信矩阵中定义的第一报文标识符,以及确定所述第一数据是否为所述虚拟通信矩阵中定义的第一预留数据;
    当所述第一数据的报文标识符为所述第一报文标识符,且所述第一数据为所述第一预留数据时,所述第一CAN节点还用于确定所述第一数据为允许在所述CAN总线上发送的数据。
  17. 根据权利要求11至16中任一项所述的系统,其特征在于,所述第一CAN节点还用于根据所述CAN总线对应的数据结构,对所述第一数据进行封装,得到第三数据,并向所述CAN总线发送所述第三数据。
  18. 根据权利要求12所述的系统,其特征在于,所述第一CAN节点还用于获取所述第二数据的报文标识符;确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符;
    当所述第二数据的报文标识符为所述第二报文标识符时,所述第一CAN节点还用于确定所述第二数据为允许所述第一设备接收的数据。
  19. 根据权利要求12所述的系统,其特征在于,所述第一CAN节点还用于获取所述第二数据的报文标识符;确定所述第二数据的报文标识符是否为所述虚拟通信矩阵中定义的第二报文标识符,以及确定所述 第二数据是否为所述虚拟通信矩阵中定义的第二预留数据;
    当所述第二数据的报文标识符为所述第二报文标识符,且所述第二数据为所述第二预留数据时,所述第一CAN节点还用于确定所述第二数据为允许所述第一设备接收的数据。
  20. 根据权利要求12、18至19中任一项所述的系统,其特征在于,所述第一CAN节点还用于根据所述通信网络对应的数据结构,对所述第二数据进行封装,得到第四数据,并向所述第一设备发送所述第四数据。
  21. 根据权利要求11至20中任一项所述的系统,其特征在于,所述第一设备与所述第一CAN节点之间通过多连接方式连接。
  22. 根据权利要求11至21中任一项所述的系统,其特征在于,所述第一CAN节点中设置有速率调节缓冲区,所述速率调节缓冲区用于存储所述第一CAN节点获取的所述第一数据。
  23. 一种电子设备,其特征在于,所述电子设备中设置有CAN通信系统,所述CAN通信系统包括第一设备、第二设备、CAN总线以及与所述CAN总线连接的至少两个CAN节点,所述至少两个CAN节点包括第一CAN节点和第二CAN节点,所述第一设备通过通信网络与所述第一CAN节点连接,所述第二CAN节点用于控制所述第二设备,所述CAN通信系统中设置有虚拟通信矩阵,所述虚拟通信矩阵为根据所述第一设备对所述CAN通信系统的原始通信矩阵进行扩展得到,所述第一CAN节点用于执行权利要求1至10中任一项所述的CAN通信方法。
  24. 一种电子设备,包括存储器、处理器、控制器以及收发器,其特征在于,所述控制器用于控制所述收发器在CAN总线上接收数据,并将接收到的数据存储至所述存储器或者发送给所述处理器,所述控制器还用于从所述处理器或者所述存储器获取数据,并控制所述收发器向CAN总线上发送获取的数据,所述存储器中存储有可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时,使所述电子设备实现如权利要求1至10中任一项所述的CAN通信方法。
  25. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被计算机执行时,使所述计算机实现如权利要求1至10中任一项所述的CAN通信方法。
PCT/CN2022/141599 2022-01-14 2022-12-23 Can通信方法、电子设备及can通信系统 WO2023134428A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210046889.1A CN116488953A (zh) 2022-01-14 2022-01-14 Can通信方法、电子设备及can通信系统
CN202210046889.1 2022-01-14

Publications (1)

Publication Number Publication Date
WO2023134428A1 true WO2023134428A1 (zh) 2023-07-20

Family

ID=87212508

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/141599 WO2023134428A1 (zh) 2022-01-14 2022-12-23 Can通信方法、电子设备及can通信系统

Country Status (2)

Country Link
CN (1) CN116488953A (zh)
WO (1) WO2023134428A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180343326A1 (en) * 2017-05-26 2018-11-29 Cisco Technology, Inc. Can to ip internetworking
CN110808890A (zh) * 2019-09-26 2020-02-18 浙江欧康电子信息技术有限公司 通信处理方法、装置、存储介质及can总线通信系统
CN111628920A (zh) * 2020-05-28 2020-09-04 上海辰瞻医疗科技有限公司 多个串行接口设备间的相互通信方法
WO2021168859A1 (zh) * 2020-02-29 2021-09-02 华为技术有限公司 一种控制器区域网can总线安全通信方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180343326A1 (en) * 2017-05-26 2018-11-29 Cisco Technology, Inc. Can to ip internetworking
CN110808890A (zh) * 2019-09-26 2020-02-18 浙江欧康电子信息技术有限公司 通信处理方法、装置、存储介质及can总线通信系统
WO2021168859A1 (zh) * 2020-02-29 2021-09-02 华为技术有限公司 一种控制器区域网can总线安全通信方法及装置
CN111628920A (zh) * 2020-05-28 2020-09-04 上海辰瞻医疗科技有限公司 多个串行接口设备间的相互通信方法

Also Published As

Publication number Publication date
CN116488953A (zh) 2023-07-25

Similar Documents

Publication Publication Date Title
US11595422B2 (en) Method for preventing electronic control unit from executing process based on malicious frame transmitted to bus
US10693905B2 (en) Invalidity detection electronic control unit, in-vehicle network system, and communication method
Zeng et al. In-vehicle networks outlook: Achievements and challenges
EP3783847B1 (en) Vehicle-mounted gateway communication method, vehicle-mounted gateway, and smart vehicle
KR102023673B1 (ko) 직렬 통신 버스를 통해 데이터를 전송하기 위한 방법, 상응하게 설계된 버스 인터페이스 및 상응하게 설계된 컴퓨터 프로그램
US11256498B2 (en) Node, a vehicle, an integrated circuit and method for updating at least one rule in a controller area network
EP3206361B1 (en) Controller area network (can) message filtering
US9825918B2 (en) Controller area network (CAN) device and method for operating a CAN device
US10623291B2 (en) Operation method of communication node for detecting link errors in network
US10574348B2 (en) Method for time synchronization between communication nodes in network
US10511668B2 (en) Method of transmitting and receiving data in vehicle network and apparatus for the same
CN106453148B (zh) 网络中通信节点的操作方法
US20150124839A1 (en) Method of Packaging and Unpackaging Packet and Appartuses Using the Same
CN105388858A (zh) 网络中通信节点的操作方法
EP3124331B1 (en) Controller area network (can) device and method for operating a can device
US12003513B2 (en) Vehicle-to-X communication arrangement and method for receiving vehicle-to-X messages
KR20140124255A (ko) 이더넷 연동 차량 통신 게이트웨이 장치와, 그 장치에서의 메시지 전달 방법
JP7412506B2 (ja) 不正検知ルール更新方法、不正検知電子制御ユニット及び車載ネットワークシステム
WO2023134428A1 (zh) Can通信方法、电子设备及can通信系统
KR102362611B1 (ko) 차량 네트워크에서 데이터의 송수신 방법 및 장치
WO2017056395A1 (ja) 不正検知電子制御ユニット、車載ネットワークシステム及び通信方法
Kim et al. Routing Methods Considering Security and Real-Time of Vehicle Gateway System
Lee et al. A Study on Architecture of CAN over 3GPP Gateway in Vehicle Network
Chalini et al. UML Model of a Gateway for the Interconnection of IEEE 1609 and Controller Area Network

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22920058

Country of ref document: EP

Kind code of ref document: A1