CN115442177B - Data communication method and device of CAN (controller area network) - Google Patents

Data communication method and device of CAN (controller area network) Download PDF

Info

Publication number
CN115442177B
CN115442177B CN202211015404.9A CN202211015404A CN115442177B CN 115442177 B CN115442177 B CN 115442177B CN 202211015404 A CN202211015404 A CN 202211015404A CN 115442177 B CN115442177 B CN 115442177B
Authority
CN
China
Prior art keywords
data
information
communication
target node
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211015404.9A
Other languages
Chinese (zh)
Other versions
CN115442177A (en
Inventor
梁群
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yuanfeng Technology Co Ltd
Original Assignee
Yuanfeng Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yuanfeng Technology Co Ltd filed Critical Yuanfeng Technology Co Ltd
Priority to CN202211015404.9A priority Critical patent/CN115442177B/en
Publication of CN115442177A publication Critical patent/CN115442177A/en
Application granted granted Critical
Publication of CN115442177B publication Critical patent/CN115442177B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • 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
    • 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/40267Bus for use in transportation systems
    • H04L2012/40273Bus for use in transportation systems the transportation system being a vehicle

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a data communication method and device of a CAN network, comprising the following steps: the sending node sends communication request messages to a plurality of receiving nodes, wherein the communication request messages comprise first identification information; the target node sends a communication response message to the sending node according to the communication request message, wherein the communication response message comprises second identification information and first limit information, and the first limit information reflects the data receiving capability of the target node; the sending node identifies the second identification information to determine the communication response message as a message to be processed; and the sending node determines whether the application data to be transmitted accords with the range of the data receiving capability of the target node according to the first limit information, and if so, sends the application data to the target node. The invention can acquire the data receiving capability of the target node, avoid sending the application data exceeding the data receiving capability range to the target node, and is beneficial to reducing the possibility of abnormality.

Description

Data communication method and device of CAN (controller area network)
Technical Field
The invention relates to the technical field of vehicle-mounted equipment communication, in particular to a data communication method and device of a CAN (controller area network).
Background
CAN (Controller Area Network ) is a bus type serial communication network, which is mainly applied to data communication among a plurality of vehicle-mounted Electronic Control Units (ECU), at present, in order to ensure the reliability requirement of data communication, the technical specification of CAN specifies that data messages transmitted in CAN network adopt a short frame structure, generally the data length of a frame of message is not more than 8 bytes, when the data to be transmitted exceeds 8 bytes, the data needs to be split into multi-frame message transmission, and the multi-frame transmission of application messages in CAN network has no unified standard and specification, and is almost the communication protocol defined by each manufacturer, such as message analysis by setting up dbc file, so that the following maintenance and communication test are not facilitated, and the reliability and compatibility of data communication are also not ensured.
In addition, when the existing CAN network transmits the application message, the application message is directly transmitted to each node, and the node for processing the application message is determined by the identifier in the application message, so in the existing scheme, a handshake step is generally not performed on the sending node and the receiving node, that is, the sending node and the receiving node cannot know how the capacity of the opposite party to receive the data, and the communication abnormality is easily caused by overlarge data or overhigh frequency to be sent.
Therefore, it is necessary to provide a data communication method and apparatus of a CAN network to solve the above-mentioned problems.
Disclosure of Invention
The invention aims to provide a data communication method and device of a CAN network, which CAN acquire the data receiving capability of a target node in advance, avoid sending application data beyond the data receiving capability range of the target node to the target node, and are beneficial to reducing the possibility of abnormality of the target node.
In order to achieve the above object, the present invention provides a data communication method of a CAN network, including:
the method comprises the steps that a sending node sends communication request messages to a plurality of receiving nodes, wherein the communication request messages comprise first identification information;
the target node which is successfully matched with the first identification information in the plurality of receiving nodes sends a communication response message to the sending node according to the communication request message, wherein the communication response message comprises second identification information and first limit information, and the first limit information reflects the data receiving capability of the target node;
the sending node identifies the second identification information to determine that the communication response message is a message to be processed;
and the sending node determines whether the application data to be transmitted accords with the range of the data receiving capability of the target node according to the first limit information, and if so, the sending node sends the application data to the target node.
Optionally, when the data length of the application data is less than or equal to a preset length, the "sending the application data to the target node" includes:
generating a single-frame message based on the application data, wherein the single-frame message comprises the first identification information, frame type information and first data information;
sending the single-frame message to the target node;
the target node identifies the first identification information to determine that the single-frame message is a message to be processed, and identifies the frame type information to determine that the single-frame message comprises all the application data;
the target node works according to the first data information and returns a response frame message to the sending node, wherein the response frame message comprises the receiving state information of the target node.
Optionally, when the data length of the application data is greater than a preset length, the "sending the application data to the target node" includes:
carrying out data splitting on the application data according to a data splitting strategy, and respectively packaging the split data into a first frame message and a continuous frame message, wherein the first frame message comprises the first identification information, frame type information and second data information, the continuous frame message comprises the first identification information, frame type information, numbering information and third data information, and the numbering information reflects the sequence of the continuous frame message corresponding to the application data;
sending the first frame message to the target node;
the target node identifies the first identification information to determine that the first frame message is a message to be processed, and identifies frame type information of the first frame message to determine that the first frame message comprises part of the application data;
the target node generates a flow control frame message based on the first frame message and sends the flow control frame message to the sending node, wherein the flow control frame message comprises time interval information and the second identification information, and the time interval information reflects the shortest time interval of the target node for receiving the continuous frame message;
the sending node sends the continuous frame message to a target node according to the sequence interval represented by the number information according to the time greater than or equal to the shortest time interval;
the target node reorganizes the second data information and the third data information to generate fourth data information, works according to the fourth data information, and returns a response frame message to the sending node, wherein the response frame message comprises receiving state information of the target node.
Optionally, the first frame packet further includes data length information, where the data length information reflects a data length of the application data;
and the target node determines whether the data length of the fourth data information is complete according to the data length information.
Optionally, the communication method further includes:
in the communication process of the sending node and the target node, the sending node sends the communication request message to the target node once every preset time;
if the target node is in a normal communication state, returning the communication response message to the sending node;
and if the target node does not receive the communication request message from the sending node at intervals of the preset time, determining that the sending node is abnormal.
Optionally, the communication request message further includes first connection information, where the first connection information reflects a willingness to communicate with the sending node; the communication response message also comprises second connection information, and the second connection information reflects the communication willingness of the target node;
when the sending node sends the communication request message to the target node and the first connection information indicates a willingness to open communication, the target node returns the communication response message, of which the second connection information indicates the willingness to open communication, to the sending node so that the sending node and the target node establish communication connection;
and when the sending node sends the communication request message to the target node and the first connection information indicates the willingness to close communication, the target node returns the communication response message, the second connection information of which indicates the willingness to disconnect communication, to the sending node so as to disconnect the sending node and the target node which are in communication connection.
Optionally, the communication request message further includes second limitation information, where the second limitation information reflects the data receiving capability of the sending node;
and the target node limits data which is out of the data receiving capacity range of the sending node to be transmitted to the sending node according to the second limiting information.
In order to achieve the above object, the present invention also provides a data communication device of a CAN network, including:
the system comprises a transmitting node and a plurality of receiving nodes which are connected through a CAN, wherein the transmitting node comprises a request module, a determining module and a transmitting module;
the request module is used for sending communication request messages to a plurality of receiving nodes, wherein the communication request messages comprise first identification information;
the target node successfully matched with the first identification information in the plurality of receiving nodes comprises a response module;
the response module is configured to send a communication response message to the sending node according to the communication request message, where the communication response message includes second identification information and first limitation information, and the first limitation information reflects a data receiving capability of the target node;
the determining module is used for identifying the second identification information to determine that the communication response message is a message to be processed;
the sending module is configured to determine, according to the first constraint information, whether application data to be transmitted accords with a range of data receiving capability of the target node, and if so, send the application data to the target node.
To achieve the above object, the present invention also provides an electronic device, including:
a processor;
a memory having stored therein executable instructions of the processor;
wherein the processor is configured to perform the data communication method of the CAN network as described above via execution of the executable instructions.
To achieve the above object, the present invention also provides a computer-readable storage medium having stored thereon a computer program, characterized in that the computer program, when executed by a processor, implements a data communication method of a CAN network as described above.
The present invention also provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs the data communication method of the CAN network.
The invention enables a plurality of receiving nodes to determine target nodes in a plurality of receiving nodes according to first identification information after receiving the communication request message by the sending node through carrying first identification information in the communication request message sent by the sending node, and the target nodes return communication response messages to the sending node according to the communication request message, wherein the communication response messages carry second identification information and first limit information, the first limit information reflects the data receiving capability of the target nodes, when the sending node receives the communication response messages, the communication response messages are determined to be messages to be processed according to the second identification information, and whether the application data to be transmitted accords with the data receiving capability of the target nodes or not is determined according to the first limit information, if so, the application data are sent to the target nodes. The sending node obtains the communication response message reflecting the data receiving capability of the target node before sending the application data, and only sends the application data within the data receiving capability range of the target node to the target node, thereby being beneficial to reducing the possibility of abnormality of the target node.
Drawings
Fig. 1 is a flow chart of a data communication method of the CAN network of the present invention.
Fig. 2 is a schematic diagram of a sending node establishing a communication channel with a target node according to an embodiment of the present invention.
Fig. 3 is a schematic communication diagram of the embodiment of the present invention when the data length of the application data is less than or equal to the preset length.
Fig. 4 is a schematic communication diagram of the embodiment of the present invention when the data length of the application data is greater than the preset length.
Fig. 5 is a diagram illustrating the interaction of messages between an example sending node and a target node.
Fig. 6 is a schematic block diagram of a data communication device of a CAN network according to an embodiment of the present invention.
Fig. 7 is a schematic block diagram of an electronic device of an embodiment of the invention.
Detailed Description
In order to describe the technical content, the constructional features, the achieved objects and effects of the present invention in detail, the following description is made with reference to the embodiments in conjunction with the accompanying drawings.
Referring to fig. 1, the invention discloses a data communication method of a CAN network, comprising the following steps:
s1, a sending node sends a communication request message to a plurality of receiving nodes, wherein the communication request message comprises first identification information;
s2, the target node which is successfully matched with the first identification information in the plurality of receiving nodes sends a communication response message to the sending node according to the communication request message, wherein the communication response message comprises second identification information and first limit information, and the first limit information reflects the data receiving capability of the target node;
s3, the sending node identifies the second identification information to determine that the communication response message is a message to be processed;
and S4, the sending node determines whether the application data to be transmitted accords with the range of the data receiving capability of the target node according to the first limiting information, and if so, the sending node sends the application data to the target node.
The invention enables a plurality of receiving nodes to determine target nodes in a plurality of receiving nodes according to first identification information after receiving the communication request message by the sending node through carrying first identification information in the communication request message sent by the sending node, and the target nodes return communication response messages to the sending node according to the communication request message, wherein the communication response messages carry second identification information and first limit information, the first limit information reflects the data receiving capability of the target nodes, when the sending node receives the communication response messages, the communication response messages are determined to be messages to be processed according to the second identification information, and whether the application data to be transmitted accords with the data receiving capability of the target nodes or not is determined according to the first limit information, if so, the application data are sent to the target nodes. The sending node obtains the communication response message reflecting the data receiving capability of the target node before sending the application data, and only sends the application data within the data receiving capability range of the target node to the target node, thereby being beneficial to reducing the possibility of abnormality of the target node.
Specifically, the first identification information and the second identification information are CAN ID information with different data contents, and the data structure of the CAN ID information is shown in the following table:
the value of the Header is used for identifying which communication protocol the message carrying the CAN ID information is applied to, and the headers in the CAN ID information carried by the messages of the same communication protocol are the same; CD is Channel Direction abbreviation, which indicates that the message carrying the CAN ID information is in the direction of the communication channel, for example, CD in the CAN ID information carried by the message sent from the sending node to the target node is 0, and CD in the CAN ID information carried by the message sent from the target node to the sending node is 1; the Channel number indicates on which communication Channel the message carrying the CAN ID information is transmitted.
In the invention, in order to enable the messages sent by the sending node and the target node to be received and processed by each other, the messages sent by the sending node and the target node are required to carry CAN ID information, the messages sent by the sending node are required to carry CAN ID information expressed as first identification information, and the messages sent by the target node are required to carry CAN ID information expressed as second identification information.
In addition, the communication request message and the communication response message both comprise CMF frame data, and the data structure of the CMF frame data is shown in the following table:
wherein, n_pci Type represents the Type of the frame data, and the data frame with 1111 high four bits of the first byte is a CMF frame; the data receiving capability of the sender of the CMF frame data is the first limiting information in the invention, the RPS represents the maximum data amount which can be received by the sender, and the TTmin represents the time interval between receiving application data, namely the time interval between sending the next application data after the current application data is sent; m_cmd indicates willingness of the sender to communicate, and when M_cmd is 01, the sender initiates a communication request for opening the channel, and when M_cmd is 10, the sender initiates a communication request for closing the channel.
Further, the communication request message further includes first connection information, and the first connection information reflects a communication willingness of the sending node; the communication response message also comprises second connection information, and the second connection information reflects the communication willingness of the target node; therefore, the first connection information and the second connection information are m_cmd in the CMF frame data.
When the sending node sends a communication request message to the target node and the first connection information indicates the willingness to open communication, the target node returns a communication response message of which the second connection information indicates the willingness to open communication to the sending node so as to enable the sending node and the target node to establish communication connection;
when the sending node sends a communication request message to the target node and the first connection information indicates a willingness to close communication, the target node returns a communication response message of which the second connection information indicates a willingness to disconnect communication to the sending node, so that the sending node and the target node which are in communication connection are disconnected.
Specifically, as shown in fig. 2, when the two parties respectively receive a communication request message and a communication response message, which are indicated as open communication, the nodes are respectively configured so that the two parties communicate with each other in the established communication channel.
In addition, in the communication process of the sending node and the target node, the sending node sends a communication request message to the target node once every preset time interval;
if the target node is in a normal communication state, returning a communication response message to the sending node;
if the target node does not receive the communication request message from the sending node at preset intervals, determining that the sending node is abnormal.
The communication conditions of the two parties can be determined through the reciprocation of the communication request message and the communication response message between the sending node and the target node, so that the communication abnormality caused by the disconnection of one party is avoided, and the technician cannot be notified.
In some embodiments, the communication request message further includes second constraint information reflecting a data receiving capability of the transmitting node;
and the target node limits data transmission outside the data receiving capacity range of the sending node to the sending node according to the second limiting information.
When the target node receives the application data, the target node needs to return some data to the sending node or send the application data to the sending node, and at this time, the returned data needs to be judged whether to be in the data receiving capacity range of the sending node or not so as to avoid the abnormality of the sending node.
Referring to fig. 3, in some embodiments, when the data length of the application data is less than or equal to the preset length, "sending the application data to the target node" includes:
generating a single-frame message based on the application data, wherein the single-frame message comprises first identification information, frame type information and first data information;
transmitting the single frame message to a target node;
the target node identifies the first identification information to determine that the single-frame message is a message to be processed, and identifies the frame type information to determine that the single-frame message comprises all application data;
the target node works according to the first data information and returns a response frame message to the sending node, wherein the response frame message comprises the receiving state information of the target node.
Specifically, the single frame data structure included in the single frame message is shown in the following table:
the N_PCI Type is expressed as frame Type information, the frame Type information of the single-frame message is that the upper four bits of the first byte are 0000; sf_dl represents a data length of first data information generated based on application data; the first data information is from the second byte to the eighth byte in the single frame data structure; interrupt Level indicates the processing priority of the message at the receiving party; MN represents the message sequence number, PN represents the data packet sequence number of the corresponding message, namely, the sender can send a plurality of messages, each message can encapsulate a plurality of data packets, and the receiver can know which data packet and which message the message belongs to by marking the corresponding sequence number on the message; the connection ID, the Intelligent flag and the OP Type together represent the work required to be performed by the receiver after the receiver acquires the message.
After the target node acquires the single-frame message, the target node can determine that the single-frame message comprises all application data according to the frame type information, so that the single-frame message can be directly processed.
The response frame data structure of the response frame message is shown in the following table:
wherein, n_pci Type indicates the Type of the frame data, and the data frame with the upper four bits 1110 of the first byte is a response frame; ACK Status indicates whether the receiving side successfully receives the application data, that is, the receiving Status information of the node in the present invention, status is 0 when successfully received, and Status is 1 when unsuccessful; the definition of each field in the second byte is consistent with the single frame data structure described above, and will not be described in detail herein.
Referring to fig. 4, in some embodiments, when the data length of the application data is greater than the preset length, "sending the application data to the target node" includes:
according to a data splitting strategy, carrying out data splitting on application data, and respectively packaging the split data into a first frame message and a continuous frame message, wherein the first frame message comprises first identification information, frame type information and second data information, the continuous frame message comprises first identification information, frame type information, numbering information and third data information, and the numbering information reflects the sequence of the continuous frame message in the application data;
the first frame message is sent to a target node;
the target node identifies the first identification information to determine that the first frame message is a message to be processed, and identifies the frame type information of the first frame message to determine that the first frame message comprises part of application data;
the target node generates a flow control frame message based on the first frame message and sends the flow control frame message to the sending node, wherein the flow control frame message comprises time interval information and second identification information, and the time interval information reflects the shortest time interval of the target node for receiving the continuous frame message;
the transmitting node transmits continuous frame messages to the target node according to the time greater than or equal to the shortest time interval and the sequence interval represented by the serial number information;
the target node reorganizes the second data information and the third data information to generate fourth data information, works according to the fourth data information, and returns a response frame message to the sending node, wherein the response frame message comprises the receiving state information of the target node.
It can be understood that the preset length is the maximum data length that can be carried by the single frame data.
Specifically, the first frame data structure of the first frame message is shown in the following table:
wherein, n_pci Type represents the Type of the frame data, and the data frame with 0001 upper four bits of the first byte is the first frame data; ff_dl represents the sum of the data length of the second data information and the third data information generated based on the application data, that is, the data length information of the present invention; the second data information is the third byte to the eighth byte in the first frame data structure; the definition of each field in the third byte to the fifth byte is consistent with the single frame data structure described above, and will not be described here again.
The target node may determine whether the data length of the fourth data information is complete according to ff_dl.
The flow control frame data structure of the flow control frame message is shown in the following table:
wherein, n_pci Type represents the Type of the frame data, and the data frame with the upper four bits 0011 of the first byte is flow control frame data; FS indicates a data reception state of the sender, and when FS is 0, the receiver is allowed to send a continuous frame message to the sender, and when FS is 1, it is indicated that the sender is suspended from sending a continuous frame message to the sender, and when FS is 2, it is indicated that the sender cannot receive a continuous frame message from the receiver; BS represents the number of continuous frame messages that the sender can receive from the receiver; STmin represents the minimum interval time between two consecutive frame messages sent by the receiver, i.e. the time interval information in the present invention.
The continuous frame data structure of the continuous frame message is shown in the following table:
wherein, n_pci Type represents the Type of the frame data, and the data frame with the upper four bits 0010 of the first byte is continuous frame data; SN represents the sequence of consecutive frame messages, i.e. the numbering information in the present invention; the third data information is the second byte through the eighth byte in the continuous frame data structure.
It should be understood that the sending node and the receiving node of the present invention are relative concepts, which of the two nodes in the CAN network is determined as the sending node and the receiving node, and mainly see which node the sender of the application data is, that is, the sending node in the communication process when the destination node has the application data to send to the sending node, and also follow the above-mentioned transmission mode of the application data.
In the method, two corresponding application data transmission modes are adopted for application data with different data lengths, a communication protocol similar to an ISO15765 protocol is provided for transmission of the application data in the CAN network, a custom communication protocol is abandoned, communication is more stable, and the requirement of universality is met.
Referring to fig. 5, the following is a specific example to illustrate the present invention:
the first identification information carried by the message sent by the sending node is 0x683 (header=0x6, cd= 0x1,Channel number =0x3), and the second identification information carried by the message sent by the target node is 0x603 (header=0x6, cd= 0x0,Channel number =0x3).
The sequence number 38 message is a communication request message (F0 63 0A 01 FF FF FF FF) sent by the sending node, that is, the target node is requested to establish a Channel number=0x3 for communication connection;
the sequence number 39 message is a communication response message (F0 0B 0A 01 FF FF FF FF) returned by the target node after receiving the sequence number 38 message, and a communication Channel with Channel number=0x3 is established with the sending node;
the sequence number 40 message is a single frame message (03 30 42 21 FF FF FF FF) sent by the sending node to the target node, and is expressed as a state of acquiring time;
the sequence number 41 message is a response frame message (E0 30 FF FF FF FF FF FF) returned by the target node after receiving the sequence number 40 message, and indicates that the data is successfully received;
the sequence number 42 message is a first frame message (10 32 70 42 2C 00 44 04) replied after the target node analyzes the sequence number 41 message, and is represented as state data of time;
the sequence number 43 message is a flow control frame message (30 00 0A FF FF FF FF FF) returned by the sending node according to the sequence number 42 message;
the messages with the sequence numbers 44-50 are continuous frame messages which are sent to the sending node by the target node according to the message with the sequence number 43;
the sequence number 51 message is a response frame message (E0 70 FF FF FF FF FF FF) returned by the sending node after receiving the sequence number 50 message, and indicates that the data is successfully received;
the serial number 52 and the serial number 53 are communication request messages and communication response messages which are sent periodically.
Referring to fig. 6, the embodiment of the invention also discloses a data communication device of a CAN network, which comprises a transmitting node 100 and a plurality of receiving nodes 200 connected through a CAN, wherein the transmitting node 100 comprises a request module 500, a determination module 400 and a transmitting module 600;
the request module 500 is configured to send a communication request message to the plurality of receiving nodes 200, where the communication request message includes first identification information;
the target node 300 successfully matched with the first identification information in the plurality of receiving nodes 200, wherein the target node 300 comprises a response module 700;
the response module 700 is configured to send a communication response message to the sending node 100 according to the communication request message, where the communication response message includes second identification information and first limitation information, and the first limitation information reflects the data receiving capability of the target node 300;
the determining module 400 is configured to identify the second identification information to determine that the communication response message is a message to be processed;
the sending module 600 is configured to determine, according to the first constraint information, whether the application data to be transmitted is within a range of the data receiving capability of the target node 300, and if so, send the application data to the target node 300.
The sending node 100 of the present invention obtains the communication response message reflecting the data receiving capability of the target node 300 before sending the application data, and only sends the application data within the data receiving capability range of the target node 300 to the target node 300, which is beneficial to reducing the possibility of abnormality occurrence of the target node 300.
Referring to fig. 7, the embodiment of the invention also discloses an electronic device, which includes:
a processor 40;
a memory 50 having stored therein executable instructions of the processor 40;
wherein the processor 40 is configured to perform the data communication method of the CAN network as described above via execution of the executable instructions.
The embodiment of the invention also discloses a computer readable storage medium, which stores a computer program, and the computer program realizes the data communication method of the CAN network when being executed by a processor.
Embodiments of the present invention also disclose a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs the data communication method of the CAN network as described above.
It should be appreciated that in embodiments of the invention, the processor may be a central processing module (CentralProcessing Unit, CPU), which may also be other general purpose processors, digital signal processors (DigitalSignal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Those skilled in the art will appreciate that all or part of the processes in the methods of the embodiments described above may be implemented by hardware associated with computer program instructions, where the program may be stored on a computer readable storage medium, where the program, when executed, may include processes in embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random access Memory (Random AccessMemory, RAM), or the like.
The foregoing disclosure is only illustrative of the preferred embodiments of the present invention and is not to be construed as limiting the scope of the invention, which is defined by the appended claims.

Claims (9)

1. A data communication method of a CAN network, comprising:
the method comprises the steps that a sending node sends communication request messages to a plurality of receiving nodes, wherein the communication request messages comprise first identification information;
the target node sends a communication response message to the sending node according to the communication request message, wherein the communication response message comprises second identification information and first limit information, the first limit information reflects the data receiving capability of the target node, and the first limit information comprises the maximum data amount which can be received by the target node and the time interval between the target node and receiving application data;
the sending node identifies the second identification information to determine that the communication response message is a message to be processed;
the sending node determines whether the application data to be transmitted accords with the range of the data receiving capability of the target node according to the first limit information, and if so, the sending node sends the application data to the target node;
the communication request message further comprises second limit information, and the second limit information reflects the data receiving capability of the sending node;
and the target node limits data which is out of the data receiving capacity range of the sending node to be transmitted to the sending node according to the second limiting information.
2. The method for data communication in a CAN network of claim 1,
when the data length of the application data is less than or equal to a preset length, the "sending the application data to the target node" includes:
generating a single-frame message based on the application data, wherein the single-frame message comprises the first identification information, frame type information and first data information;
sending the single-frame message to the target node;
the target node identifies the first identification information to determine that the single-frame message is a message to be processed, and identifies the frame type information to determine that the single-frame message comprises all the application data;
the target node works according to the first data information and returns a response frame message to the sending node, wherein the response frame message comprises the receiving state information of the target node.
3. The method for data communication in a CAN network of claim 1,
when the data length of the application data is greater than a preset length, the "sending the application data to the target node" includes:
carrying out data splitting on the application data according to a data splitting strategy, and respectively packaging the split data into a first frame message and a continuous frame message, wherein the first frame message comprises the first identification information, frame type information and second data information, the continuous frame message comprises the first identification information, frame type information, numbering information and third data information, and the numbering information reflects the sequence of the continuous frame message corresponding to the application data;
sending the first frame message to the target node;
the target node identifies the first identification information to determine that the first frame message is a message to be processed, and identifies frame type information of the first frame message to determine that the first frame message comprises part of the application data;
the target node generates a flow control frame message based on the first frame message and sends the flow control frame message to the sending node, wherein the flow control frame message comprises time interval information and the second identification information, and the time interval information reflects the shortest time interval of the target node for receiving the continuous frame message;
the sending node sends the continuous frame message to a target node according to the sequence interval represented by the number information according to the time greater than or equal to the shortest time interval;
the target node reorganizes the second data information and the third data information to generate fourth data information, works according to the fourth data information, and returns a response frame message to the sending node, wherein the response frame message comprises receiving state information of the target node.
4. The method for data communication in a CAN network of claim 3,
the first frame message also comprises data length information, and the data length information reflects the data length of the application data;
and the target node determines whether the data length of the fourth data information is complete according to the data length information.
5. The data communication method of a CAN network of claim 1, further comprising:
in the communication process of the sending node and the target node, the sending node sends the communication request message to the target node once every preset time;
if the target node is in a normal communication state, returning the communication response message to the sending node;
and if the target node does not receive the communication request message from the sending node at intervals of the preset time, determining that the sending node is abnormal.
6. The method for data communication in a CAN network of claim 1,
the communication request message also comprises first connection information, and the first connection information reflects the communication willingness of the sending node; the communication response message also comprises second connection information, and the second connection information reflects the communication willingness of the target node;
when the sending node sends the communication request message to the target node and the first connection information indicates a willingness to open communication, the target node returns the communication response message, of which the second connection information indicates the willingness to open communication, to the sending node so that the sending node and the target node establish communication connection;
and when the sending node sends the communication request message to the target node and the first connection information indicates the willingness to close communication, the target node returns the communication response message, the second connection information of which indicates the willingness to disconnect communication, to the sending node so as to disconnect the sending node and the target node which are in communication connection.
7. The data communication device of the CAN network is characterized by comprising a transmitting node and a plurality of receiving nodes which are connected through the CAN, wherein the transmitting node comprises a request module, a determining module and a transmitting module;
the request module is used for sending communication request messages to a plurality of receiving nodes, wherein the communication request messages comprise first identification information;
the target node successfully matched with the first identification information in the plurality of receiving nodes comprises a response module;
the response module is configured to send a communication response message to the sending node according to the communication request message, where the communication response message includes second identification information and first limitation information, the first limitation information reflects a data receiving capability of the target node, and the first limitation information includes a maximum data amount that the target node can receive and a time interval between receiving application data by the target node;
the determining module is used for identifying the second identification information to determine that the communication response message is a message to be processed;
the sending module is configured to determine, according to the first constraint information, whether application data to be transmitted accords with a range of data receiving capability of the target node, and if so, send the application data to the target node;
the communication request message further comprises second limit information, and the second limit information reflects the data receiving capability of the sending node;
and the target node limits data which is out of the data receiving capacity range of the sending node to be transmitted to the sending node according to the second limiting information.
8. An electronic device, comprising:
a processor;
a memory having stored therein executable instructions of the processor;
wherein the processor is configured to perform the data communication method of the CAN network of any one of claims 1-6 via execution of the executable instructions.
9. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements a data communication method of a CAN network according to any one of claims 1-6.
CN202211015404.9A 2022-08-22 2022-08-22 Data communication method and device of CAN (controller area network) Active CN115442177B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211015404.9A CN115442177B (en) 2022-08-22 2022-08-22 Data communication method and device of CAN (controller area network)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211015404.9A CN115442177B (en) 2022-08-22 2022-08-22 Data communication method and device of CAN (controller area network)

Publications (2)

Publication Number Publication Date
CN115442177A CN115442177A (en) 2022-12-06
CN115442177B true CN115442177B (en) 2023-09-29

Family

ID=84244514

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211015404.9A Active CN115442177B (en) 2022-08-22 2022-08-22 Data communication method and device of CAN (controller area network)

Country Status (1)

Country Link
CN (1) CN115442177B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116781450B (en) * 2023-08-23 2023-10-27 长沙普洛电气设备有限公司 Communication method based on CAN bus and related device

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1499751A (en) * 2002-11-05 2004-05-26 �ղ��Զ�����ʽ���� Data transmitting device and method for transmitting and receiving data and data communication system
CN101489218A (en) * 2008-01-16 2009-07-22 大唐移动通信设备有限公司 Method for uploading capability and related processing apparatus
CN102958107A (en) * 2011-08-22 2013-03-06 华为技术有限公司 Capability query method, communication terminal and application server
CN103607421A (en) * 2013-10-10 2014-02-26 深圳市同洲电子股份有限公司 Data interaction method and intelligent terminal
CN105210345A (en) * 2013-08-30 2015-12-30 华为技术有限公司 Network capability information transmitting method and device
CN105681260A (en) * 2014-11-19 2016-06-15 中国移动通信集团公司 Cloud storage file transmission method, fusion communication platform, sending end and system
DE102018104865B3 (en) * 2018-03-02 2019-06-27 Elmos Semiconductor Aktiengesellschaft Device for controlling electrical and / or electronic components of a motor vehicle module and such a motor vehicle module with automatic module addressing with clock synchronization
CN111650916A (en) * 2020-04-27 2020-09-11 宝能(广州)汽车研究院有限公司 ECU (electronic control unit) refreshing method based on CAN (controller area network) bus
CN112910856A (en) * 2021-01-18 2021-06-04 南京理工大学 Communication protocol design method based on serial port communication
CN113079074A (en) * 2021-03-25 2021-07-06 成都纵横自动化技术股份有限公司 Protocol stack communication method, device and storage medium based on CAN bus
CN113950019A (en) * 2020-07-17 2022-01-18 华为技术有限公司 Resource scheduling method, communication device and system
CN114422289A (en) * 2022-01-11 2022-04-29 国网电力科学研究院有限公司 Transmission method and device for CAN (controller area network) message of electric vehicle

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1499751A (en) * 2002-11-05 2004-05-26 �ղ��Զ�����ʽ���� Data transmitting device and method for transmitting and receiving data and data communication system
CN101489218A (en) * 2008-01-16 2009-07-22 大唐移动通信设备有限公司 Method for uploading capability and related processing apparatus
CN102958107A (en) * 2011-08-22 2013-03-06 华为技术有限公司 Capability query method, communication terminal and application server
CN105210345A (en) * 2013-08-30 2015-12-30 华为技术有限公司 Network capability information transmitting method and device
CN103607421A (en) * 2013-10-10 2014-02-26 深圳市同洲电子股份有限公司 Data interaction method and intelligent terminal
CN105681260A (en) * 2014-11-19 2016-06-15 中国移动通信集团公司 Cloud storage file transmission method, fusion communication platform, sending end and system
DE102018104865B3 (en) * 2018-03-02 2019-06-27 Elmos Semiconductor Aktiengesellschaft Device for controlling electrical and / or electronic components of a motor vehicle module and such a motor vehicle module with automatic module addressing with clock synchronization
CN111650916A (en) * 2020-04-27 2020-09-11 宝能(广州)汽车研究院有限公司 ECU (electronic control unit) refreshing method based on CAN (controller area network) bus
CN113950019A (en) * 2020-07-17 2022-01-18 华为技术有限公司 Resource scheduling method, communication device and system
CN112910856A (en) * 2021-01-18 2021-06-04 南京理工大学 Communication protocol design method based on serial port communication
CN113079074A (en) * 2021-03-25 2021-07-06 成都纵横自动化技术股份有限公司 Protocol stack communication method, device and storage medium based on CAN bus
CN114422289A (en) * 2022-01-11 2022-04-29 国网电力科学研究院有限公司 Transmission method and device for CAN (controller area network) message of electric vehicle

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
移动传感器网络中一种基于接收者的跨层传输协议;李连;蒋文涛;孙利民;樊孝忠;;计算机研究与发展(第01期);全文 *

Also Published As

Publication number Publication date
CN115442177A (en) 2022-12-06

Similar Documents

Publication Publication Date Title
US10756930B2 (en) Gateway device, vehicle network system, transfer method, and non-transitory computer-readable recording medium storing program
CN108965484B (en) Internet of things data transmission method, system and terminal
CN110083088B (en) Signal control conversion device and signal control conversion method
US6654355B1 (en) Bridge for CAN to TCP/IP connection
US10129150B2 (en) Systems and methods for implementing a switched controller area network
CN109981435B (en) Gateway and communication system based on CAN-ModBus to MQTT
CN108848025B (en) Data processing method, intelligent gateway and Internet of things system
US20200382597A1 (en) Vehicle diagnostic communication apparatus, system including the same and method thereof
CN111245776A (en) Vehicle-mounted data transmission method, device, equipment and storage medium
CN115442177B (en) Data communication method and device of CAN (controller area network)
CN113196710B (en) Distribution node, automation network and method for transmitting messages
EP1808983A1 (en) Process and devices for selective collision detection
US20040264453A1 (en) Method and system establishing a data link layer protocol on a I2CTM physical layer connection
CN109639555B (en) Link layer message generation method, link layer message generation device and terminal equipment
KR20180059386A (en) Delegation server for connecting a plurality of lpwa devices to common cloud
KR20130016809A (en) Method for processing data of a gateway for a vehicle network system
CN111371668B (en) Method, device, equipment and storage medium for periodically sending based on free ARP
CN114301993A (en) Data transmission method, device, terminal equipment and storage medium
US20080133683A1 (en) Method of processing open asynchronous application service event and open web service gateway implementing the same
CN114650194B (en) Data communication method, device, electronic equipment and storage medium
CN117395327B (en) Method, apparatus and computer readable storage medium for Ethernet access EPA network
US20040088395A1 (en) Method for probing a server
CN117459612A (en) Message transmission method and device based on limited feedback, electronic equipment and storage medium
CN116886465A (en) Automatic routing method, device and system of gateway and Modbus gateway
JPH10262067A (en) Packet communication system

Legal Events

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