CN110719218B - Multi-node interconnection protocol standard method based on CAN bus - Google Patents
Multi-node interconnection protocol standard method based on CAN bus Download PDFInfo
- Publication number
- CN110719218B CN110719218B CN201911048569.4A CN201911048569A CN110719218B CN 110719218 B CN110719218 B CN 110719218B CN 201911048569 A CN201911048569 A CN 201911048569A CN 110719218 B CN110719218 B CN 110719218B
- Authority
- CN
- China
- Prior art keywords
- node
- data
- function code
- bus
- function
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/40006—Architecture of a communication node
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/03—Protocol definition or specification
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/06—Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L2012/40208—Bus networks characterized by the use of a particular bus standard
- H04L2012/40215—Controller Area Network CAN
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Small-Scale Networks (AREA)
Abstract
The invention relates to a multi-node interconnection protocol standard method based on a CAN bus, which CAN ensure that CAN bus node equipment CAN normally run, the response speed and the processing efficiency are improved, the CAN bus data are more stable, and the working efficiency of the equipment is greatly improved. For an embedded system adopting a CAN bus as a system data architecture, the cooperation use among nodes in the system architecture CAN be obviously improved, the effective processing and response of data in the system are improved, and the quick execution of functions is realized.
Description
Technical Field
The invention relates to the technical field of data communication, in particular to a multi-node interconnection protocol standard method based on a CAN bus.
Background
The current communication data method of the CAN bus mainly adopts a traditional point-to-point data communication method, cannot meet the requirements of quick response and synchronous response for equipment with high requirements on execution efficiency and real-time performance, and seriously influences the execution efficiency and the processing speed of the equipment adopting the CAN bus as a communication bus. Under the condition that the current CAN bus protocol CAN not meet the technical requirements of the current industrial field, if the data communication CAN ensure that the equipment CAN realize synchronous execution and synchronous detection and processing, the operation performance and the working efficiency of the equipment CAN be greatly improved.
Disclosure of Invention
The invention aims to solve the defects of the prior art and provides a multi-node interconnection protocol standard method based on a CAN bus.
In order to achieve the purpose, the invention adopts the following technical scheme: a multi-node interconnection protocol standard method based on a CAN bus comprises the following steps:
a specifies the protocol standard data format
(1) The CAN bus adopts an extension frame and data frame mode, a protocol divides a 29-bit CAN extension ID, and the definition format of the extension frame ID is as follows:
source address: the sending address of the current data packet indicates which address node the current data packet comes from;
destination address: the receiving address of the current data packet indicates which address node the current data packet is received by;
counting frames: the frame position of the current data frame in the current data packet;
counting the packets: when the current data packet belongs to the data packet of the second group, when the same module sends the data packet, the packet counts of each data packet are different and count in an accumulation mode, and the data packet is counted again from zero after the accumulation count is full;
the data definition format of the data area is as follows:
data length: the total number of data nodes of the data area;
function code: the function number of the current data packet, the selection range of the command function code [0x 00-0 x7F ], the selection range of the reply function code [0x 80-0 xFF ], the command function code and the reply function code are paired and can not be used repeatedly or in a staggered way;
functional data: the data content of the current data packet;
(2) definition of function code
The protocol specifies that the range of [0x 00-0 x0F ] function codes is a special function code field, and a user can not define the special function code field any more but can use the special function code field;
the special function code segments are as follows:
function code [0x00 ]: the information reading function of the node ID and the SN code;
function code [0x01 ]: a node information setting function is carried out through SN codes;
function codes [0x 02-0 x0C ]: reserving;
function code [0x0D ]: the heartbeat detection function of the master control node detects whether the current bus node is on line or not in sequence at the frequency of 100 ms;
function code [0x0E ]: configuring a starting node to enter a working state;
function code [0x0F ]: configuring the starting node to exit the working state;
b node information acquisition
After power-on, the master control node automatically acquires SN codes and ID information of all nodes of the current bus through the function code [0x00 ].
c node information configuration and use
The main control node sets the information of all nodes through the function code [0x01], and enters a normal working state through the function code [0x0E ] after the setting is successful.
In the step a, each node is provided with a unique SN code according to the protocol, the length of the SN code is 6 bytes, and ID distribution of the online nodes can be realized through special function codes according to the protocol no matter whether the node IDs are the same or not.
In the step a, for the small MCU, the RAM resource is very limited, so the data protocol carries out sub-packet processing, and the single packet data only supports the data content of the three-frame CAN standard extended frame by default.
In step a, the protocol specifies that 256 nodes CAN be supported to be on line at the maximum on the current CAN bus where the device is located, no contact is available between the nodes, and free grouping of the nodes is also supported, but it is required to ensure that the IDs of all the nodes are different.
In step a, the transmission data is larger than 24 bytes, and the packet transmission can be selected.
The invention has the beneficial effects that: CAN bus node equipment CAN normal operating, and response speed and treatment effeciency obtain very high promotion, and CAN bus data is more stable, obtains very big promotion to the work efficiency of equipment. For an embedded system adopting a CAN bus as a system data architecture, the cooperation use among nodes in the system architecture CAN be obviously improved, the effective processing and response of data in the system are improved, and the quick execution of functions is realized.
Drawings
FIG. 1 illustrates the system architecture and coordination of the various nodes of the CAN bus protocol standard of the present invention;
the following detailed description will be made in conjunction with embodiments of the present invention with reference to the accompanying drawings.
Detailed Description
The invention is further illustrated by the following examples in conjunction with the accompanying drawings:
as shown in fig. 1, a multi-node interconnection and intercommunication protocol standard method based on CAN bus includes the following steps:
a specifies the protocol standard data format
Write data protocol format:
read data protocol format:
the CAN bus adopts an extension frame and data frame mode. No clear numerical value requirement is required for the data communication baud rate, only the cooperation of an internal running clock of the MCU and an external running speed is needed, and only the interrupt processing time of the MCU is required to be less than or equal to 1/2 of the transmission time of single-frame data of the CAN bus.
(1) The CAN bus adopts an extension frame and data frame mode, a protocol divides a 29-bit CAN extension ID, and the definition format of the extension frame ID is as follows:
source address: the sending address of the current data packet indicates which address node the current data packet comes from;
destination address: the receiving address of the current data packet indicates which address node the current data packet is received by;
counting frames: the frame position of the current data frame in the current data packet;
counting the packets: when the current data packet belongs to the data packet of the second group, when the same module sends the data packet, the packet counts of each data packet are different and count in an accumulation mode, and the data packet is counted again from zero after the accumulation count is full;
the data definition format of the data area is as follows:
data length: the total number of data nodes of the data area;
function code: the function number of the current data packet, the selection range of the command function code [0x 00-0 x7F ], the selection range of the reply function code [0x 80-0 xFF ], the command function code and the reply function code are paired and can not be used repeatedly or in a staggered way;
functional data: the data content of the current data packet;
(2) definition of function code
The protocol specifies that the range of [0x 00-0 x0F ] function codes is a special function code field, and a user can not define the special function code field any more but can use the special function code field;
the special function code segments are as follows:
function code [0x00 ]: the information reading function of the node ID and the SN code;
function code [0x01 ]: a node information setting function is carried out through SN codes;
function codes [0x 02-0 x0C ]: reserving;
function code [0x0D ]: the heartbeat detection function of the master control node detects whether the current bus node is on line or not in sequence at the frequency of 100 ms;
function code [0x0E ]: configuring a starting node to enter a working state;
function code [0x0F ]: configuring the starting node to exit the working state;
b node information acquisition
After power-on, the master control node automatically acquires SN codes and ID information of all nodes of the current bus through the function code [0x00 ].
c node information configuration and use
The main control node sets the information of all nodes through the function code [0x01], and enters a normal working state through the function code [0x0E ] after the setting is successful.
For a small MCU, the RAM resource is very limited, so the data protocol carries out packet processing, and single packet data only supports the data content of three frames of CAN standard extended frames by default. If the transmission data is larger than 24 bytes, the packet transmission can be selected so as to complete the function requirement, but the packet count is maximum and supports 255, which means that the single data supports 256 packet data at most. If the user needs more data, the maximum frame count of the single-packet data can be set, the frame count is 255 at most, and the maximum support of the single-packet data is 256 frames of data.
The protocol provides that 256 nodes CAN be simultaneously online at the maximum on the current CAN bus where the equipment is located, no contact CAN be made between the nodes, and free formation of the nodes is supported, but the IDs of all the nodes are different.
In order to realize the function of quickly setting the node ID and ensure the stability of data, the protocol provides a main control node (a non-essential node, which is determined according to actual conditions). Meanwhile, each node is provided with a unique SN code according to the protocol, the length of the SN code is 6 bytes, and ID distribution of the online nodes can be realized through special function codes specified by the protocol no matter whether the node IDs are the same or not.
The invention has been described in connection with the accompanying drawings, it is to be understood that the invention is not limited to the specific embodiments disclosed, but is intended to cover various modifications, adaptations or uses of the invention, and all such modifications and variations are within the scope of the invention.
Claims (5)
1. A multi-node interconnection protocol standard method based on a CAN bus is characterized by comprising the following steps:
a specifies the protocol standard data format
(1) The CAN bus adopts an extension frame and data frame mode, a protocol divides a 29-bit CAN extension ID, and the definition format of the extension frame ID is as follows:
source address: the sending address of the current data packet indicates which address node the current data packet comes from;
destination address: the receiving address of the current data packet indicates which address node the current data packet is received by;
counting frames: the frame position of the current data frame in the current data packet;
counting the packets: when the current data packet belongs to the data packet of the second group, when the same module sends the data packet, the packet counts of each data packet are different and count in an accumulation mode, and the data packet is counted again from zero after the accumulation count is full;
the data definition format of the data area is as follows:
data length: the total number of data nodes of the data area;
function code: the function number of the current data packet, the selection range of the command function code [0x 00-0 x7F ], the selection range of the reply function code [0x 80-0 xFF ], the command function code and the reply function code are paired and can not be used repeatedly or in a staggered way;
functional data: the data content of the current data packet;
(2) definition of function code
The protocol specifies that the range of [0x 00-0 x0F ] function codes is a special function code field, and a user can not define the special function code field any more but can use the special function code field;
the special function code segments are as follows:
function code [0x00 ]: the information reading function of the node ID and the SN code;
function code [0x01 ]: a node information setting function is carried out through SN codes;
function codes [0x 02-0 x0C ]: reserving;
function code [0x0D ]: the heartbeat detection function of the master control node detects whether the current bus node is on line or not in sequence at the frequency of 100 ms;
function code [0x0E ]: configuring a starting node to enter a working state;
function code [0x0F ]: configuring the starting node to exit the working state;
b node information acquisition
After power-on, the master control node automatically acquires SN (serial number) codes and ID (identity) information of all nodes of the current bus through the function code [0x00 ];
c node information configuration and use
The main control node sets the information of all nodes through the function code [0x01], and enters a normal working state through the function code [0x0E ] after the setting is successful.
2. The CAN-bus-based multi-node interconnection and interworking protocol standard method according to claim 1, wherein the protocol specifies that each node has its own unique SN code, the SN code has a length of 6 bytes, and ID distribution of on-line nodes CAN be realized through special function codes specified by the protocol regardless of whether the node IDs are the same or not.
3. The method as claimed in claim 1, wherein for small MCU, RAM resource is very limited, so that data protocol is sub-packaged, and single packet data only supports three frames of CAN standard extension frame data by default.
4. The method as claimed in claim 1, wherein the protocol specifies that 256 nodes CAN be supported on-line at the maximum on the current CAN bus where the device is located, there is no connection between nodes, and the nodes CAN be freely grouped together, but it is required to ensure that all nodes have different IDs.
5. The CAN-bus based multi-node interconnection and interworking protocol standard method of claim 1, wherein the transmission data is larger than 24 bytes, and the packetized transmission CAN be selected.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911048569.4A CN110719218B (en) | 2019-10-31 | 2019-10-31 | Multi-node interconnection protocol standard method based on CAN bus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911048569.4A CN110719218B (en) | 2019-10-31 | 2019-10-31 | Multi-node interconnection protocol standard method based on CAN bus |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110719218A CN110719218A (en) | 2020-01-21 |
CN110719218B true CN110719218B (en) | 2021-07-30 |
Family
ID=69213520
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911048569.4A Active CN110719218B (en) | 2019-10-31 | 2019-10-31 | Multi-node interconnection protocol standard method based on CAN bus |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110719218B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112667555B (en) * | 2021-03-17 | 2021-06-11 | 浙江飞旋科技有限公司 | Communication method and device of micro control unit |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101626333A (en) * | 2009-08-07 | 2010-01-13 | 北京和利时电机技术有限公司 | Controller area network (CAN) bus system and application layer communication method in same |
CN101977094A (en) * | 2010-10-18 | 2011-02-16 | 航天东方红卫星有限公司 | Satellite-borne controller area network (CAN) bus communication method applied to multi-master communication |
CN103780697A (en) * | 2014-01-23 | 2014-05-07 | 广州睿嵌电子技术有限公司 | Common platform system of vehicle-mounted electronic processing unit and data communication method of common platform system |
CN107147657A (en) * | 2017-05-31 | 2017-09-08 | 飞智控(天津)科技有限公司 | Suitable for the communication protocol of multimachine reliable communication, decoding method and communication apparatus |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6111888A (en) * | 1997-05-27 | 2000-08-29 | Micro Motion, Inc. | Deterministic serial bus communication system |
US20040176877A1 (en) * | 2003-03-05 | 2004-09-09 | Scott Hesse | Building automation system and method |
-
2019
- 2019-10-31 CN CN201911048569.4A patent/CN110719218B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101626333A (en) * | 2009-08-07 | 2010-01-13 | 北京和利时电机技术有限公司 | Controller area network (CAN) bus system and application layer communication method in same |
CN101977094A (en) * | 2010-10-18 | 2011-02-16 | 航天东方红卫星有限公司 | Satellite-borne controller area network (CAN) bus communication method applied to multi-master communication |
CN103780697A (en) * | 2014-01-23 | 2014-05-07 | 广州睿嵌电子技术有限公司 | Common platform system of vehicle-mounted electronic processing unit and data communication method of common platform system |
CN107147657A (en) * | 2017-05-31 | 2017-09-08 | 飞智控(天津)科技有限公司 | Suitable for the communication protocol of multimachine reliable communication, decoding method and communication apparatus |
Non-Patent Citations (5)
Title |
---|
CANopen协议研究及一体化适配器开发;赵峰;《中国优秀硕士学位论文全文数据库(电子期刊)•信息科技辑》;20100731;全文 * |
CAN总线应用层协议的研究与实现;王邦继,刘庆想,李相强,张健穹;《计算机工程与应用》;20111031;第47卷(第20期);第14-16页 * |
CAN总线网络报文标识符编码研究;孙招凤;《导弹与航天运载技术》;20090430(第2期);第31-36页 * |
一种基于CAN总线的通信系统设计与实现;魏立峰;《沈阳化工大学学报》;20150331;第29卷(第1期);第59-64页 * |
嵌入式设备电源控制系统的CAN通信软硬件设计;郭丽萍;《中国测试》;20171031;第43卷(第10期);第109-113页 * |
Also Published As
Publication number | Publication date |
---|---|
CN110719218A (en) | 2020-01-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108011814B (en) | Multi-protocol intelligent gateway based on narrowband Internet of things and implementation method thereof | |
CN103095607B (en) | A kind of real-time priority ethernet controller implementation method | |
US20080075019A1 (en) | Data Mapping and Sorting Method in Network Communication | |
CN113162931B (en) | Method for transmitting Modbus RTU protocol message in wide area network | |
CN113437998B (en) | Operation and maintenance debugging method and system, nonvolatile storage medium and processor | |
US10742252B2 (en) | Radio base station and system having said radio base station | |
CN112666905B (en) | Multichannel communication control system and channel control method | |
CN106936944A (en) | A kind of method and device for detecting and processing network address collision | |
CN110719218B (en) | Multi-node interconnection protocol standard method based on CAN bus | |
CN112929418B (en) | Rapid IO high-speed communication method and system based on publish-subscribe | |
CN103428677B (en) | The sending method and signaling channel of grouping busihess data send the method for reseptance of information | |
CN114095901A (en) | Communication data processing method and device | |
CN105515925A (en) | UART multi-master real-time communication system | |
CN115150223A (en) | Efficient multi-core heterogeneous system data synchronization method | |
CN204145528U (en) | The how main real-time communication system of a kind of UART | |
CN109327552A (en) | A kind of wisdom street lamp data transfer management method based on NB-IoT | |
CN110036670A (en) | A kind of method and apparatus of wake-up device | |
CN115277867A (en) | Collector and electric power communication method and system of Modbus protocol equipment based on collector | |
CN113992471A (en) | Communication system and method for multiple hosts and multiple slaves | |
CN113949600B (en) | Method and device for triggering network by 1553B bus access time | |
CN104469904A (en) | Wireless multi-terminal information collecting method | |
CN110505641B (en) | Method for improving ZigBee master-slave communication polling efficiency by utilizing full-duplex UART communication and coordinator thereof | |
CN114826816B (en) | CAN FD bus communication method and device and electronic equipment | |
US20020013805A1 (en) | LogNet: a low cost, high reliability network for embedded systems | |
CN111124969B (en) | Improved serial port conversion module based on FPGA |
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 |