CN101552785A - CAN bus communication protocol based on message mechanism used for massive data transmission - Google Patents

CAN bus communication protocol based on message mechanism used for massive data transmission Download PDF

Info

Publication number
CN101552785A
CN101552785A CNA2009100984175A CN200910098417A CN101552785A CN 101552785 A CN101552785 A CN 101552785A CN A2009100984175 A CNA2009100984175 A CN A2009100984175A CN 200910098417 A CN200910098417 A CN 200910098417A CN 101552785 A CN101552785 A CN 101552785A
Authority
CN
China
Prior art keywords
message
data
communication protocol
mass data
data transfers
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.)
Granted
Application number
CNA2009100984175A
Other languages
Chinese (zh)
Other versions
CN101552785B (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.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
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 Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN200910098417A priority Critical patent/CN101552785B/en
Publication of CN101552785A publication Critical patent/CN101552785A/en
Application granted granted Critical
Publication of CN101552785B publication Critical patent/CN101552785B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention discloses a CAN bus communication protocol based on message mechanism used for massive data transmission, which is characterized in that: the equipments are connected in master slaver mode, and the data transmission is realized by non-connection mode; the message mechanism is adopted in the data transmission, and one message can send data of 65536 bytes; when the sent data contains more than 65536 bytes, packing mode is adopted to realize the transmission of massive data of maximal 4G. The invention aims at the application and demand of small-sized system, develops upper layer protocol, realizes the massive data transmission of maximal 4G, guarantees the high efficiency and accuracy of data transmission by utilizing message mechanism and massive data transmission mechanism; and the because has a simple structure, has the advantages of less resource occupation and high efficiency.

Description

The CAN bus communication protocol that is used for mass data transfers based on message mechanism
Technical field
The present invention relates to the embedded real time system of computer realm, in particular, relate to a kind of communication protocol that is applied to mass data based on the CAN bus that connects.
Background technology
Along with the development of Control Technique of Microcomputer and industrial field bus technology, Fieldbus Based communication mode is able to application more and more widely in Industry Control.Wherein the CAN bus is simple in structure with it, and is with low cost, good functional characteristics and high reliability, and on-the-spot antijamming capability reaches open characteristics by force and is subjected to numerous developers' favor.
The CAN universal serial bus has the advantage that transmission range is long, transmission speed is fast, and it has perfect error detection mechanism, adopts frame transmission means of " multiple access conflict arbitration " mechanism, can guarantee not drop-out; Can transmit 8 byte datas in each frame at most, very high real-time or the like can be provided.Advantage on the performance has guaranteed that CAN can be applied in a lot of fields, can see the application of CAN at auto industry, boats and ships transportation, mechanical control, factory automation, building automatic etc.
The CAN field bus system is made of for 3 layers physical layer, data link layer and application layer.The basic agreement standard of CAN has only physical layer protocol and data link layer protocol, is exactly the application layer protocol that designs the CAN bus and utilize the CAN bus as one of core missions of the system of transmission mechanism.Current Business agreement based on the CAN bus mainly contains DeviceNet and two kinds of agreements of CANopen, and these two kinds of bus protocols are universal agreements, and multiple functional, complex structure, very flexible, efficiency of transmission are lower, and occupying system resources is more.And current embedded system often function singleness, simple in structure, resource-constrained, but require that transmission speed is fast, reliability and efficient height, so a kind of new application layer protocol simple in structure of needs.A kind of communication protocol that is applied to mass data based on the CAN bus that connects of having been finished by people such as the Wu of Zhejiang University morning sunlight has realized the application layer protocol based on connection of data greater than the message transmission of 8 bytes at present.Though this agreement has realized the packing greater than 8 byte datas is sent, and lacks the response mechanism of transmission, therefore can not handle the situation of loading error occurring.Particularly this agreement can only realize maximum 256*7 byte data transmission, does not have mass data transfers mechanism, and can not guarantee the accuracy of transfer of data.This agreement is based on connection simultaneously, and each transmission need connect earlier, so efficiency of transmission is lower.
Summary of the invention
Main purpose of the present invention is to overcome deficiency of the prior art, and a kind of CAN bus communication protocol based on message mechanism that is applicable to mass data transfers is provided.
In order to solve the problems of the technologies described above, the present invention is achieved by the following technical solutions:
The CAN bus communication protocol that is used for mass data transfers based on message mechanism is characterized in that: adopt master-slave mode to connect between the equipment, data realize transmission with connectionless-mode; Transfer of data adopts message mechanism, and a piece of news can send 65536 byte datas at most; When sending greater than 65536 byte datas, adopt packing manner, realize maximum 4G mass data transfers.
As a kind of improvement, the frame number of described multiframe data from 0 to 255 sign, sequence number distributes since 1, and cycle assignment independent packet to the last that goes down continuously, and packet also should begin order from first independent packet and sends separately.
As a kind of improvement, the multiframe data are except that first frame, and every frame data must comprise a sequence number and 7 byte datas.And first frame comprises data length information.
As a kind of improvement, during mass data transfers, packet header from 0 to 65535 sign since 0 distribution, and distribute the bag to the last that goes down continuously, and single bag also begins the order transmission from first packet.
As a kind of improvement, described communication protocol comprises: principal and subordinate's connection management, transmission of messages management and mass data transfers management.
As a kind of improvement, described principal and subordinate's connection management comprises: main equipment initialization and slave unit initialization.
As a kind of improvement, described principal and subordinate's connection management implementation procedure is as follows: whole system can only have a main equipment, and 14 slave units can be arranged at most.Principal and subordinate's connection management comprises main equipment initialization and slave unit initialization, the initialization slave unit tabulation of main equipment initialization elder generation, and then initial message formation and broadcast registration message are waited for the slave unit response.The slave unit initialization then responds main equipment broadcasting from the initial message formation, enters message circulation and handles.All transmission are initiated by main equipment.
As a kind of improvement, every message of described message mechanism can be the single frames data, also can be the multiframe data.
As a kind of improvement, described transmission of messages management comprises: message transmission, wait-for-response and message sink.
As a kind of improvement, described transmission of messages management implementation procedure is as follows: according to function codes different in the message message is packaged into multiframe and sends, receiving terminal is same to unpack message according to different function code in the message that receives.After every message sends, wait for recipient's feedback message (if send be feedback message then no longer wait to be feedback), whether acknowledge message is correctly received, be that the recipient is after receiving entire message, the capital send a feedback message (if the message that receives be feedback message not to this message feedback), notice transmit leg content is correctly received.If transmit leg waits for that 1s does not receive feedback message or feedback message mistake, then resend this frame and wait for 1s once more.If be retransmitted to three times, then be judged to be fault, stop to send and pointing out and make mistakes.Otherwise continue to send a piece of news down.So just guaranteed every correctness that message sends.
As a kind of improvement, described mass data transfers management comprises: packing data, data transmission, Data Receiving and data unpack.
As a kind of improvement, described mass data transfers management implementation procedure is as follows: for the data greater than 65536 bytes, transmitting terminal is broken down into the multiple messages that is 65536 bytes to the maximum and sends, packet header of definition in every message, and receiving terminal unpacks the multiple messages that receives again according to this packet header.After receiving terminal is received a bag, carry out message response, reception makes mistakes if transmitting terminal is received receiving terminal prompting bag, then retransmits a bag.Packet header is made up of two byte datas, and the bag sequence number is up to 65535 since 0 distribution.
Compared with prior art, the invention has the beneficial effects as follows:
The present invention be directed to mini-system and use and demand, the upper-layer protocol of exploitation has been realized maximum 4GB mass data transfers.Utilize message mechanism and mass data transfers mechanism, ensured the high efficiency and the accuracy of transfer of data.Because protocol architecture is simple, it is few to have the resource of taking, the characteristics that efficient is high.
Description of drawings
Fig. 1 is a system construction drawing of the present invention.
Fig. 2 is the flow chart of transmission of messages of the present invention.
Fig. 3 is the flow chart of mass data transfers of the present invention.
Embodiment
In conjunction with the accompanying drawings, the present invention is described in detail below by specific embodiment.
MicroCAN adopts principal and subordinate's connected mode of server/client mode.The CAN bus is a kind of multi-master bus, and each node can send message to other nodes on the bus.And in mini-system is used, control the transmission of messages and the state of each node by main frame, and the real-time that guarantees message response, therefore adopt master slave mode can guarantee stability of data transmission and accuracy.
The CAN controller is judged priority, condition of acceptance, function etc. by identifier, so identifier is the core of CAN host-host protocol, the MicroCAN agreement is distributed 11 bit identifiers, and is as shown in table 1.
Table 1
Occupy-place number (high) to low 10 9~6 5~2 1~0
Implication 1 From node address Function code Subfunction
In the identifier agreement that MicroCAN distributes, 9~6bit represents node address, and host address is 0x0, slave addresses can be 0x1~0xE, 0xF represents broadcast frame, and 5~2bit and 1~0bit be presentation function code and subfunction respectively, and content is distributed as shown in table 2.
Table 2
Figure A20091009841700071
Figure A20091009841700081
MicroCAN message mechanism standard Data Transport Protocol between the master-slave equipment, transfer of data is to be the unit with message between the master-slave equipment, process such as transmission course comprises transmission, receives, replys, repeating transmission.Every message can be the single frames data, also can be the multiframe data, and maximum can send 65536 byte datas.
The definition message structure is as follows:
typedef struct__MCAN_MESSAGE_STRUCT{
BOOL bServerSend; The message that // sign main frame sends or receives
BYTE byAddress; // node address
MCANMajorFunction CommType; // the function of tonic chord is described
MCANDeviceType HostDeviceType; // main equipment type
MCANDeviceType ClientDeviceType; // slave unit type
BYTE byCommParam; // functional description
MCANMessageState MessageState; // message status
WORD wDataLen; // data length
BYTE*pData; // data
_ _ MCAN_MESSAGE_STRUCT*pNextMessage; // following a piece of news
}MCANMessage;
According to function codes different in the message message is packaged into multiframe and sends, receiving terminal is same to unpack message according to different function code in the message that receives.
After every message sends, wait for recipient's feedback message (if send be feedback message then no longer wait to be feedback), whether acknowledge message is correctly received, be that the recipient is after receiving entire message, the capital send a feedback message (if the message that receives be feedback message not to this message feedback), notice transmit leg content is correctly received.If transmit leg waits for that 1s does not receive feedback message or feedback message mistake, then resend this frame and wait for 1s once more.If be retransmitted to three times, then be judged as fault, stop to send and pointing out and make mistakes.Otherwise continue to send a piece of news down.So just guaranteed every correctness that message sends.As long as the content that sends is filled message structure as required, transmit leg will be packed to sending message automatically according to agreement, and the recipient equally also will unpack according to agreement butt joint collection of letters breath, so message mechanism can guarantee the correctness that message sends and receives.
Can ensure that based on MicroCAN message mechanism host-host protocol is not more than 65536 byte data transmission of messages successes, but, then can't realize for the big bag transfer of data more than the 65K.In view of the defective of this agreement in the existence of big data quantity transmission course, need expand, make it satisfy the big data quantity transmission requirements.
The MicroCAN protocol specification big data quantity host-host protocol, comprise to big data decompose, repack, send, receive, unpack, step such as data splitting.
Whether once be the detection of greatly wrapping data, if unpack data splitting after receiving for all bags such as big Bao Ze if doing earlier when the recipient receives data at every turn.Packet header is made up of two byte datas, and 0x0000 represents initial bag, and maximum is 0xFFFF, because every message can send the data of 65535 bytes at most, therefore a data transfer heap(ed) capacity can reach 4G.
The distributed system that constitutes based on the CAN bus is except that having higher real-time, and multiple error detection mechanism has guaranteed the reliability and the anti-interference of communication in its agreement, is fit to very much in the boats and ships cabin narrow and small application scenarios, space such as communication.The MicroCAN agreement is utilized message mechanism and big data quantity transmission mechanism under the prerequisite that guarantees higher reliability and stability, it is few to have the resource of taking, and the characteristics that efficiency of transmission is high particularly have good practicability in the built-in small system.
What should be understood that is: the foregoing description is just to explanation of the present invention, rather than limitation of the present invention, and any innovation and creation that do not exceed in the connotation scope of the present invention all fall within protection scope of the present invention.

Claims (10)

1, based on the CAN bus communication protocol that is used for mass data transfers of message mechanism, it is characterized in that: adopt master-slave mode to connect between the equipment, data realize transmission with connectionless-mode; Transfer of data adopts message mechanism, and a piece of news can send 65536 byte datas at most; When sending greater than 65536 byte datas, adopt packing manner, realize maximum 4G mass data transfers.
2, the CAN bus communication protocol that is used for mass data transfers based on message mechanism according to claim 1 is characterized in that, described principal and subordinate's connected mode can only have a main equipment, and 14 slave units can be arranged at most; All transmission are initiated by main equipment, and main equipment is inquired about each slave unit state by broadcast mode.
3, the CAN bus communication protocol that is used for mass data transfers based on message mechanism according to claim 2 is characterized in that described broadcast capability sends message by main equipment, and each slave unit is realized the connection of master-slave equipment by the response broadcast.
4, the CAN bus communication protocol that is used for mass data transfers based on message mechanism according to claim 1, it is characterized in that, described transfer of data realizes with connectionless-mode, all data send to same bus, and each equipment judges whether to be received in data on the bus by the frame identification code.
5, the CAN bus communication protocol that is used for mass data transfers based on message mechanism according to claim 1, it is characterized in that, described message mechanism comprises packing data, transmission, receives, unpacks, replys and retransmission process, and all message are all initiated by main equipment.
6, the CAN bus communication protocol that is used for mass data transfers based on message mechanism according to claim 5 is characterized in that every message of described message mechanism is the single frames data, or the multiframe data.
7, the CAN bus communication protocol that is used for mass data transfers based on message mechanism according to claim 5, it is characterized in that, described message mechanism according to function codes different in the message message is packaged into single frames or multiframe sends, and receiving terminal is same to unpack message according to different function code in the message that receives.
8, the CAN bus communication protocol that is used for mass data transfers based on message mechanism according to claim 5 is characterized in that described multiframe data comprise a frame number, and maximum can send 65536 byte datas; Multiframe Frame sequence number from 0 to 255 sign, sequence number distribute since 1, and cycle assignment independent packet to the last that goes down continuously, and packet also should begin order from first independent packet and sends separately; The multiframe data are except that first frame, and every frame data must comprise a sequence number and 7 byte datas.And first frame comprises data length information.
9, the CAN bus communication protocol that is used for mass data transfers based on message mechanism according to claim 5, it is characterized in that, described message mechanism is after every message sends, wait for recipient's feedback message, if what send is feedback message then no longer waits to be feedback, whether acknowledge message is correctly received, be that the recipient is after receiving entire message, the capital sends a feedback message, if the message that receives is feedback message then not to this message feedback, notifies the transmit leg content correctly to be received.If transmit leg waits for that 1s does not receive feedback message or feedback message mistake, then resend this frame and wait for 1s once more; If be retransmitted to three times, then be judged to be fault, stop to send and pointing out and make mistakes; Otherwise continue to send a piece of news down.
10, the CAN bus communication protocol that is used for mass data transfers based on message mechanism according to claim 1, it is characterized in that, described mass data transfers realizes greater than 65536 bytes less than the 4GB data volume, transmitting terminal becomes multiple messages to send data decomposition, packet header of definition in every message, and receiving terminal unpacks the multiple messages that receives again according to this packet header; The packet header of message is made up of two bytes in the described mass data transfers, and the bag sequence number is up to 65535 since 0 distribution; After described mass data transfers receiving terminal is received every bag, carry out message feedback one time,, then put in order bag and retransmit if transmitting terminal receives that the receiving terminal prompting receives one and contracts out mistake.
CN200910098417A 2009-05-07 2009-05-07 CAN bus communication method based on message mechanism used for massive data transmission Expired - Fee Related CN101552785B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200910098417A CN101552785B (en) 2009-05-07 2009-05-07 CAN bus communication method based on message mechanism used for massive data transmission

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200910098417A CN101552785B (en) 2009-05-07 2009-05-07 CAN bus communication method based on message mechanism used for massive data transmission

Publications (2)

Publication Number Publication Date
CN101552785A true CN101552785A (en) 2009-10-07
CN101552785B CN101552785B (en) 2012-10-10

Family

ID=41156776

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200910098417A Expired - Fee Related CN101552785B (en) 2009-05-07 2009-05-07 CAN bus communication method based on message mechanism used for massive data transmission

Country Status (1)

Country Link
CN (1) CN101552785B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102739651A (en) * 2011-04-04 2012-10-17 Wago管理有限责任公司 Automation system
CN103890747A (en) * 2011-06-29 2014-06-25 罗伯特·博世有限公司 Method and device for serial data transmission having a flexible message size and a variable bit length
CN104486145A (en) * 2014-12-03 2015-04-01 中国航空工业集团公司第六三一研究所 Test method for machine-borne network data sequence completeness
CN105634894A (en) * 2015-12-31 2016-06-01 深圳市科陆电源技术有限公司 Enhanced type CAN bus data resending method and device
CN106292403A (en) * 2015-06-01 2017-01-04 南京普爱医疗设备股份有限公司 A kind of CAN communication agreement of controlling system of medical equipments
CN106712907A (en) * 2017-02-16 2017-05-24 北京中航通用科技有限公司 Data transmission method and equipment
CN106788916A (en) * 2016-12-30 2017-05-31 深圳市优必选科技有限公司 For the data transmission method and data transmission device of bus
CN110077279A (en) * 2019-05-08 2019-08-02 威马智慧出行科技(上海)有限公司 CAN bus data transmission method
CN111638687A (en) * 2020-05-12 2020-09-08 牧星机器人(江苏)有限公司 AGV communication method based on simplified communication protocol
CN114143136A (en) * 2021-11-19 2022-03-04 山东新一代信息产业技术研究院有限公司 IROS-based CAN (controller area network) large message communication method, equipment and storage medium
CN114697155A (en) * 2022-03-10 2022-07-01 北京精雕科技集团有限公司 Multi-device data interaction method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6728892B1 (en) * 1999-09-15 2004-04-27 Koninklijke Philips Electronics N.V. Method for conserving power in a can microcontroller and a can microcontroller that implements this method
US7933998B2 (en) * 2002-01-11 2011-04-26 Motorola Mobility, Inc. Dynamic CAN bus system configuration and messaging
CN1216475C (en) * 2003-08-28 2005-08-24 东南大学 Embedded gate for realizing interconnection between networks with different structures

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102739651B (en) * 2011-04-04 2017-04-12 Wago管理有限责任公司 automation system
CN102739651A (en) * 2011-04-04 2012-10-17 Wago管理有限责任公司 Automation system
CN103890747A (en) * 2011-06-29 2014-06-25 罗伯特·博世有限公司 Method and device for serial data transmission having a flexible message size and a variable bit length
CN103890747B (en) * 2011-06-29 2016-11-16 罗伯特·博世有限公司 For the method and apparatus with the serial data transmission of message size and variable bit length flexibly
CN104486145B (en) * 2014-12-03 2017-09-08 中国航空工业集团公司第六三一研究所 A kind of method of testing of onboard networks data sequence integrality
CN104486145A (en) * 2014-12-03 2015-04-01 中国航空工业集团公司第六三一研究所 Test method for machine-borne network data sequence completeness
CN106292403A (en) * 2015-06-01 2017-01-04 南京普爱医疗设备股份有限公司 A kind of CAN communication agreement of controlling system of medical equipments
CN105634894A (en) * 2015-12-31 2016-06-01 深圳市科陆电源技术有限公司 Enhanced type CAN bus data resending method and device
CN105634894B (en) * 2015-12-31 2019-08-13 深圳市科陆智慧工业有限公司 A kind of enhanced CAN bus data re-transmitting method and device
CN106788916A (en) * 2016-12-30 2017-05-31 深圳市优必选科技有限公司 For the data transmission method and data transmission device of bus
CN106788916B (en) * 2016-12-30 2021-08-27 深圳市优必选科技股份有限公司 Data transmission method and data transmission device for bus
CN106712907A (en) * 2017-02-16 2017-05-24 北京中航通用科技有限公司 Data transmission method and equipment
CN110077279A (en) * 2019-05-08 2019-08-02 威马智慧出行科技(上海)有限公司 CAN bus data transmission method
CN111638687A (en) * 2020-05-12 2020-09-08 牧星机器人(江苏)有限公司 AGV communication method based on simplified communication protocol
CN111638687B (en) * 2020-05-12 2022-01-21 牧星机器人(江苏)有限公司 AGV communication method based on simplified communication protocol
CN114143136A (en) * 2021-11-19 2022-03-04 山东新一代信息产业技术研究院有限公司 IROS-based CAN (controller area network) large message communication method, equipment and storage medium
CN114697155A (en) * 2022-03-10 2022-07-01 北京精雕科技集团有限公司 Multi-device data interaction method and device

Also Published As

Publication number Publication date
CN101552785B (en) 2012-10-10

Similar Documents

Publication Publication Date Title
CN101552785B (en) CAN bus communication method based on message mechanism used for massive data transmission
CN105024861B (en) A kind of reliable remote communication means and its communicator based on big-dipper satellite
CN102833332B (en) A kind of distributed multi-to-multi devices communicating and management method
CN103310669B (en) A kind of data transmission method for interactive teaching and system
CN102780705B (en) Ethernet-(controller area network) CAN protocol converter
CN102624738B (en) Serial port server, protocol conversion chip and data transmission method
WO2014138536A2 (en) Enhanced acknowledgement and retransmission mechanism
CN103248467A (en) In-chip connection management-based RDMA communication method
CN106603506B (en) Data communication method, device and system based on multi-field bus
CN101488941A (en) Method and system for implementing USB equipment shared using
Moons et al. Using SCHC for an optimized protocol stack in multimodal LPWAN solutions
US11057158B2 (en) Delegation of management of acknowledgements and of transmission of frames
CN103701680A (en) Cross-PCIe domain message transmitting method, equipment and system
CN111092854A (en) Simple communication protocol for data transmission over constrained networks
TWI500298B (en) Techniques for forwarding or receiving data segments associated with a large data packet
CN101309169A (en) Network management method and network management system, network apparatus
CN106657377B (en) A kind of WIA-PA/ interconnects manufacture network information service adapter and implementation method entirely
CN101753486B (en) Industrial automation field bus gateway equipment
CN102238493B (en) Machine-to-machine (M2M)-platform-based message sequential transmission and receiving method and device
US9762353B2 (en) Data packet for bidirectional transmission of data packets during data transmission between a first and a second communication appliance, and method for transmitting such a data packet
CN101312412B (en) Ethernet transmission system based on embedded technique
CN116266800A (en) Multicast transmission method, device and system
US9661110B2 (en) System and method for enabling channel access enhancements in existing communication networks
WO2022141589A1 (en) Method and apparatus for determining hybrid automatic repeat request acknowledgement (harq-ack) codebook
CN102347955A (en) Reliable data transmission protocol based on virtual channels

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20121010

Termination date: 20140507