CN101808132A - Communication method of application layer in CAN bus system - Google Patents
Communication method of application layer in CAN bus system Download PDFInfo
- Publication number
- CN101808132A CN101808132A CN 201010130353 CN201010130353A CN101808132A CN 101808132 A CN101808132 A CN 101808132A CN 201010130353 CN201010130353 CN 201010130353 CN 201010130353 A CN201010130353 A CN 201010130353A CN 101808132 A CN101808132 A CN 101808132A
- Authority
- CN
- China
- Prior art keywords
- application layer
- bus
- data object
- virtual data
- equipment
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Small-Scale Networks (AREA)
Abstract
The invention discloses a communication method of an application layer in a CAN bus system and relates to a network bus in the field of controllers. The communication method comprises the following steps: taking a virtual data object on the CAN bus as a target recognition unit, and taking a data object table as reference for explaining the actual meaning of the virtual data object, the authorities of reading and writing and the data type thereof; and the protocol communication ways of the application layer comprise the ordinary communication way and the boost communication way. The communication method is simple, practical and conductive to promotion and transplantation, has low requirements on a memory of a device and the calculation speed and can be applicable to a large number of industrial automatic process devices using the CAN buses.
Description
Technical field:
The present invention relates to CAN (Controller Area Network, controller field network) bus, be specifically related to a kind of CAN bus system and application layer communication method wherein.
Background technology:
The CAN bus is (can be referring to Bosch.CAN Specification for a kind of serial data communications busses that solves the exchanges data between the numerous controllers and measuring equipment in the automobile and develop by German Bosch company at first, version 2.0,1991,9) develop into international standard ISO11898.The maximum characteristics of CAN bus are that data link layer has adopted the arbitration of message priority, automatic-answering back device, mechanism such as CRC (Cyclical Redundancy Check, CRC) verification automatically, mistake repeating transmission.Because the CAN bus has the reliability height, transmission rate is fast, and communication distance is far away, is easy to use, maintenance and extension of network, has been widely used in various industry spot controls field at present.
But CAN has only defined physical layer and the data link layer standard among the ISO/OSI, and this designing requirement user must define application layer protocol voluntarily when using the CAN agreement.Practice shows, even the simplest CAN distributed system, it is not enough only depending on two-layer protocol specification, and carry out high efficiency communication also needs further clear and definite application layer protocol.At present, CAN bus application layer protocol kind is a lot, but these agreements or very complicated universal agreement, such as CANopen, and DeviceNet, or based on the specialized protocol of specific application area, as the J1939 standard.Use complicated versatility agreement, generally can increase the expense of CAN bus node, increase construction cycle and cost.And certain protocol generally can make application have bigger limitation, has increased the cost of revising and transplanting.
Summary of the invention:
The purpose of this invention is to provide the application layer communication method in a kind of CAN bus system, it is according to CAN bus application layer design demand in industry spot is used is set out, characteristics in conjunction with CAN bus data link layer, CAN bus communication pattern and CAN node register model have proposed the complete general CAN bus application layer communication scheme of a cover, the efficient height, the agreement cost is little, simple and practical, be convenient to promote and transplant, can be suitable for much using on the industrial automation equipment or mobile device of CAN bus.
In order to solve existing problem in the background technology, the present invention is by the following technical solutions: the function of device interior is divided into several passages, each function passage all has the attribute of oneself, so just can come according to the function division clearly with the data object on the CAN bus.In conjunction with the characteristics of CAN bus communication, function and the attribute thereof with equipment is numbered again, and certain virtual data object will be corresponding fully by a channel number and a property value.Therefore, channel number and property value are called as the index of virtual data object.Sending application layer messages is that the index information of virtual data channel has been placed directly on the ID, has directly improved communication efficiency.Different equipment has different passages and attribute, therefore, needs the index that a corresponding virtual data object table writes down virtual data object.The actual physics meaning of each virtual data object, data type, access limit all will be recorded in the virtual data table.
The present invention is primarily aimed at widely used master-slave mode CAN bus topolopy in industry spot and the mobile device, has proposed a complete general application layer communication scheme based on virtual data object, is easy to promote and transplant, and applicability is strong.Technical scheme of the present invention has obtained using in the system-level integrated kinetic control system based on ARM and checking.Experimental result shows advantages such as this communication scheme has use concisely, and resource occupation is few.
Description of drawings:
Fig. 1 is the structural representation that the present invention is based on the application layer protocol of CAN bus;
Fig. 2 is the flow chart that application layer protocol of the present invention reads virtual data object;
Fig. 3 is the flow chart that application layer protocol of the present invention writes virtual data object;
Fig. 4 is that application layer protocol of the present invention uses the BOOST mode to read the flow chart of virtual data object.
Embodiment:
Referring to Fig. 1, this embodiment by the following technical solutions: it comprises the read-write operation of CAN bus virtual data object, virtual data object table, virtual data object.The process of data communication of described CAN bus application layer protocol is to finish by the Frame or the remote frame that send Extended Superframe Format on the CAN bus.
The link layer protocol of CAN bus system is an a kind of communication modes towards CAN ID, CAN bus data communication to as if CAN ID, rather than the address of certain equipment, therefore, how to distribute CAN ID to realize that the data interaction between the distinct device is exactly the problem that described virtual data object solves.
Virtual data object is the minimum unit of described CAN bus application layer protocol communication, and it has represented certain functional attributes of equipment.Each equipment of following described application layer protocol all must have a data Object table, has preserved index, implication, data type, the data length of each virtual data object in this table, and in this sense, each virtual objects is good by predefined.
The index value of described virtual data object is finished by passage and attribute.Channel value has been represented certain function of an equipment, and channel attributes has been represented the different attribute of this channel function.Each attribute has different data types and access limit.Equipment promptly may have access to the virtual data object of appointment by retrieval channel number and property value.
Each equipment of following described CAN bus application layer protocol all must have a special passage, i.e. system channel, and this system channel is used for the various configurations and the status attribute of indication equipment and application layer protocol.In these general-purpose attributes, some attribute is executed, and some is optional.
When equipment need carry out read operation or write operation to the virtual data object on the CAN bus, need on the CAN bus, send an application layer messages, application layer messages is to be carried by the Frame of a CAN or remote frame.Application layer messages has comprised the device address at virtual data object place, the priority of message, the index of virtual data object (channel number and property value) and the data (remote frame that is used for request of data is not carried data) of carrying.In order to make full use of the function that CAN bus links layer is provided, reduce protocol overhead, the device address in the application layer messages, message priority, the index of virtual data object has been placed directly on the ID of CAN bus data frame or remote frame.Priority has been placed on the high position of ID, is worth more for a short time, and priority is high more, and CAN bus links layer priority arbitration mechanism has directly been used in this design.
Further, the device address at described virtual data object place comprises conventional equipment address and broadcasting equipment address.When the device address was common address, application layer messages was only effective to the specified equipment in device address.When the device address was broadcast address, application layer messages was effective to equipment all on the CAN bus network.
The write operation of described virtual data object need use the CAN Frame to carry data, the CAN node at the virtual data object place that requirement is simultaneously write determines whether sending response message according to the configuration information in the system channel, the success that response message is used to refer to this time write operation whether, as shown in Figure 3.
The read operation of described virtual data object can be divided into two kinds of forms, i.e. query pattern and BOOST pattern.
Query pattern, as shown in Figure 1, the node that promptly needs to read virtual data object sends an application layer messages (remote frame of CAN bus) on the CAN bus, the priority that has comprised message in this message, the device address at data object to be read place, channel number, property value.The equipment that is read has been received after this application layer messages, according to channel number of being asked and property value, generates a Frame (this Frame has the CANID value identical with the remote frame of request msg), and this Frame is sent on the CAN bus.
Under query pattern, when reading virtual data object, need to send earlier a remote frame at every turn, wait for that again the equipment that is read sends the Frame of replying, total line use ratio is not high back and forth for one of whole process need, relatively is fit to small data quantity low speed and reads.
The BOOST pattern, as shown in Figure 4, promptly to read the node of virtual data object, on the CAN bus, send an application layer messages (CAN Frame) that carries the BOOST request, the priority that has comprised message in this message, the device address at data object to be read place, channel number, property value, and to being read the configuration information of equipment B OOST passage.
Further, the configuration information of BOOST passage comprises sending blanking time, sends number of times, the index of virtual data object to be sent, and the enable information of passage.
The equipment of being read has been received after the application layer messages that carries the BOOST request, according to the content of the configuration information of being asked, at a certain time interval, sends the data of the appointment virtual data object of some on bus.
Under the BOOST pattern, the side of reading only need ask the side of being read sending a BOOST at first, and the side of being read will ask the active of set mode to send Frame after the request of receiving according to BOOST on the CAN bus.This mode is higher to the utilance of bus bandwidth, is fit to high-speed data transmission.
Embodiment one: the application layer communication method in a kind of CAN bus system, described CAN bus system comprise CAN bus, several CAN nodes; By described CAN bus, receive and dispatch application layer messages according to the CAN application layer protocol, between each CAN node to carry out the application layer communication; To specifically describe described CAN application layer protocol below.
At first, the CAN bus protocol is supported four kinds of communication frames: Frame, remote frame, erroneous frame, and overload frame.Wherein Frame is realized the data passes of sending node to receiving node, in the present embodiment, described CAN node is when carrying out the application layer communication, and what write the virtual data object use is Frame, what read that virtual data object uses with inquiry mode is the remote frame request, and Frame returns.When practical application, do not get rid of yet and carry with other frame.According to the difference of CAN protocol version, the form of communication frames is divided into expansion frame and normal frames, and in this example, all communication frames are all used Extended Superframe Format.When practical application, do not get rid of yet and use normal frames and mode that both use with to transmit.
As shown in table 1, described CAN node is when carrying out the application layer communication, and 29 of the CAN communication frames of being received and dispatched ID number everybody implications define.
Table one, CAN bus ID implication table
??Bit | ??29 | ??28~25 | ??24~17 | ??16~8 | ??7~0 |
Implication | ??R | ??Priority | ??Device?ID | ??Channel | ??Property |
Wherein:
R: operative norm definition.Length: 1bit
R=0 represents that this ID observes described application layer protocol.
R=1 represents that this ID does not observe described application layer protocol.
Priority: message priority.Length: 4bits
This field is used to indicate the priority of message.Priority is big more, and field value is more little, and priority is the highest during as Priority=0.
Device ID: device id.Length: 8bits
Certain equipment that is used for identification bus.This field generally by equipment decision itself, as the toggle switch on the equipment, perhaps is solidificated in device interior.When Device ID value is 0xFF, be broadcasting ID.
Channel: channel number.Length: 8bits
Be used to represent the channel value of each functional module of device inside.
Property: channel attributes value.Length: 8bits
Be used to identify the attribute of certain function passage.
In described application layer protocol communication, certain property value of certain passage that minimum communication unit is certain equipment.This Attribute class is similar to certain address that memory interrupts, and some is read-only, and some is only write, and some is read-write.
The equipment that each observes described application layer protocol all needs to provide an attribute assignment table, be used for illustrating the represented meaning of each attribute with and data type and length.That is to say that each attribute of mentioning all is that predefined is good here.
When Device ID value is 0xFF, be broadcast, all devices all should respond this message on the bus.
When the Channel value is 0 to be, the expression system channel, system channel is used for representing the general-purpose attribute of system, and in these general-purpose attributes, some attribute is executed, and some is optional.
Property value in described application layer protocol communication reads by remote frame, writes by Frame.As want to read current rotating speed of motor in certain electric machine controller, and suppose that here device ID is 0x01, the channel value of motor passage 0 is 1, and the value of rotating speed attribute is 3, and then needing to send ID on the CAN bus is the remote frame of 0x00010103.Electric machine controller receives after the request of this remote frame, with reply one with send the identical Frame of ID, comprised in this Frame and worked as rotating speed of motor on the prepass 0.The data length of rotating speed of motor in the Frame, data type can check in by the attribute assignment table.
In some application scenario, need ceaselessly reading of data, perhaps need higher sample frequency.The mode that provides a kind of Boost of being called to read in described application layer protocol can effectively satisfy requirement above-mentioned.By Boost read mode can so that the CAN bus apparatus under the situation of not receiving remote request automatically according to certain time interval, send the property value of several times appointment.
It is to start or stop by the Frame that sends a Boost attribute in the system class that Boost reads mode.Can support maximum 8 Boost passages in the equipment, each passage can be opened individually, closes and disposes.Data format in the Boost Frame is as follows:
The BIT number | ?4 | ??3 | ??1 | ??8 | ??16 | ??32 |
Wherein:
On/Off: whether expression enables to specify the Boost channel number.0 closes, and 1 enables
Boost channel number: be used for specifying Boost channel number to be operated.
Number of repetition: span 1 ~ 255, this Boost passage need send the number of times of ID to be read on trend CAN bus.After the Boost passage is finished the transmission number of times of appointment, will close automatically.When the number of repetition value is: during 0xFF, represent unlimited.
Send at interval: span 1 ~ 65535, unit is ms, the blanking time between the each transmission of the expression data.
ID to be read: expression needs equipment to send the ID of data on the CAN bus.
Claims (7)
1. the application layer communication method in the CAN bus system is characterized in that it comprises the read-write operation of CAN bus virtual data object, virtual data object table, virtual data object; The process of data communication of described CAN bus application layer protocol is to finish by the Frame or the remote frame that send Extended Superframe Format on the CAN bus.
2. the application layer communication method in a kind of CAN bus system according to claim 1 is characterized in that the CAN bus system comprises CAN bus, several CAN nodes; Need send application layer messages to the CAN node that other CAN node is operated, in application layer messages, carry the operating data object functionality information for the treatment of to described CAN bus; The CAN bus sends application layer messages to corresponding C AN node according to described recipient's sign of carrying in the described application layer messages; The CAN node that receives application layer messages carries out corresponding operating according to the described function information that carries in the application layer messages.
3. the application layer communication method in a kind of CAN bus system according to claim 1, it is characterized in that described described read operation can use the CAN remote frame to initiate, it is query pattern, also can use BOOST to read mode carries out, it is the BOOST pattern, the CAN bus node receives after the request of reading, and will send the data that virtual data object comprised of being asked in the remote frame on the CAN bus; Write operation need use the CAN Frame to carry data, and the CAN node at the virtual data object place that requirement is simultaneously write sends response message as required, and response message has comprised the state of this time operation.
4. the application layer communication method in a kind of CAN bus system according to claim 1 is characterized in that described virtual data object is the minimum unit of described CAN bus application layer protocol communication, and it has represented certain functional attributes of equipment; Each equipment of following described application layer protocol all must have a data Object table, has preserved index, implication, data type, the data length of each virtual data object in this table, and in this sense, each virtual objects is good by predefined; The index value of virtual data object is finished by passage and attribute; Channel value has been represented certain function of an equipment, and channel attributes has been represented the different attribute of this channel function; Each attribute has different data types and access limit; Equipment promptly may have access to the virtual data object of appointment by retrieval channel number and property value; Each equipment of following described CAN bus application layer protocol all must have a special passage, i.e. system channel, and this system channel is used for the various configurations and the status attribute of indication equipment and application layer protocol; In these general-purpose attributes, some attribute is executed, and some is optional.
5. the application layer communication method in a kind of CAN bus system according to claim 3, it is characterized in that the BOOST pattern is used when virtual data object has enabled the BOOST communication after and, the CAN node at this object place will initiatively send the CAN Frame that comprises these virtual data object data according to agreement official hour interval and transmission number of times on the CAN bus.
6. the application layer communication method in a kind of CAN bus system according to claim 2, the described application layer messages of its feature uses the CAN Extended Superframe Format to transmit; Application layer messages has comprised the device address at operated virtual data object place, the classified index at virtual data object place, the priority of message; These information have been placed on the ID of CAN bus message.
7. the application layer communication method in a kind of CAN bus system according to claim 1 is characterized in that described device address comprises conventional equipment address and broadcasting equipment address; When the device address was common address, application layer messages was only effective to the specified equipment in device address; When the device address was broadcast address, application layer messages was effective to equipment all on the CAN bus network.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201010130353 CN101808132A (en) | 2010-03-23 | 2010-03-23 | Communication method of application layer in CAN bus system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201010130353 CN101808132A (en) | 2010-03-23 | 2010-03-23 | Communication method of application layer in CAN bus system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN101808132A true CN101808132A (en) | 2010-08-18 |
Family
ID=42609751
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 201010130353 Pending CN101808132A (en) | 2010-03-23 | 2010-03-23 | Communication method of application layer in CAN bus system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101808132A (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102932223A (en) * | 2012-10-12 | 2013-02-13 | 山东科技大学 | Method for distributing extended identifiers of CAN bus of storage battery management system |
CN104836636A (en) * | 2015-02-17 | 2015-08-12 | 华为技术有限公司 | Method, device and system for communication based on novel CAN frame |
CN110138581A (en) * | 2018-02-09 | 2019-08-16 | 湖南广大机电有限公司 | CAN bus ID number configuration method |
CN110505131A (en) * | 2018-05-18 | 2019-11-26 | 中国科学院声学研究所 | A kind of master-slave mode CAN bus application layer communication method |
CN110737505A (en) * | 2019-09-09 | 2020-01-31 | 江苏中云科技有限公司 | virtual storage access method using virtual channel |
CN111209240A (en) * | 2019-12-23 | 2020-05-29 | 深圳优地科技有限公司 | Data transmission method, electronic equipment and storage medium |
CN112527720A (en) * | 2020-12-05 | 2021-03-19 | 青岛鼎信通讯股份有限公司 | Data communication method applied to rack-mounted plant station terminal |
CN113824621A (en) * | 2021-09-22 | 2021-12-21 | 石家庄通合电子科技股份有限公司 | CAN communication method based on signals and CAN controller |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1560806A (en) * | 2004-03-04 | 2005-01-05 | 深圳市泛海三江电子有限公司 | Fire alarm application layer data transmission method based on CAN2.0B |
-
2010
- 2010-03-23 CN CN 201010130353 patent/CN101808132A/en active Pending
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1560806A (en) * | 2004-03-04 | 2005-01-05 | 深圳市泛海三江电子有限公司 | Fire alarm application layer data transmission method based on CAN2.0B |
Non-Patent Citations (1)
Title |
---|
《中国仪器仪表学会2008学术年会第二届智能检测控制技术及仪表装置发展研讨会论文集》 20081231 吴雄杰等 《CAN总线应用层协议在远程I/O上的设计与实现》 49-51 4 , * |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102932223A (en) * | 2012-10-12 | 2013-02-13 | 山东科技大学 | Method for distributing extended identifiers of CAN bus of storage battery management system |
CN102932223B (en) * | 2012-10-12 | 2016-08-03 | 山东科技大学 | The distribution method of lithium-ions battery management system CAN bus extension identifier |
CN104836636A (en) * | 2015-02-17 | 2015-08-12 | 华为技术有限公司 | Method, device and system for communication based on novel CAN frame |
WO2016131404A1 (en) * | 2015-02-17 | 2016-08-25 | 华为技术有限公司 | New type can frame based communication method, device and system |
CN104836636B (en) * | 2015-02-17 | 2019-02-26 | 华为技术有限公司 | The method, apparatus and system communicated based on novel CAN frame |
CN110138581A (en) * | 2018-02-09 | 2019-08-16 | 湖南广大机电有限公司 | CAN bus ID number configuration method |
CN110505131A (en) * | 2018-05-18 | 2019-11-26 | 中国科学院声学研究所 | A kind of master-slave mode CAN bus application layer communication method |
CN110737505A (en) * | 2019-09-09 | 2020-01-31 | 江苏中云科技有限公司 | virtual storage access method using virtual channel |
CN111209240A (en) * | 2019-12-23 | 2020-05-29 | 深圳优地科技有限公司 | Data transmission method, electronic equipment and storage medium |
CN112527720A (en) * | 2020-12-05 | 2021-03-19 | 青岛鼎信通讯股份有限公司 | Data communication method applied to rack-mounted plant station terminal |
CN113824621A (en) * | 2021-09-22 | 2021-12-21 | 石家庄通合电子科技股份有限公司 | CAN communication method based on signals and CAN controller |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101808132A (en) | Communication method of application layer in CAN bus system | |
CN101626333B (en) | Controller area network (CAN) bus system and application layer communication method in same | |
CN103036754B (en) | A kind of multi-gang air-conditioner communication system and communication means | |
CN110429708B (en) | Method and system for realizing plug and play of power distribution equipment | |
CN103716781A (en) | Card writing method, device and system for mobile terminal intelligent card | |
CN105392181A (en) | Intelligent equipment networking method and device, and system | |
CN111464419A (en) | Data transmission control method based on bus network communication | |
CN103747062A (en) | Method, device and system for managing a plurality of vehicle-mounted devices | |
CN112422485B (en) | Communication method and device of transmission control protocol | |
CN114710513A (en) | Network data processing system and method | |
CN103178943A (en) | Method, device and system for link adaption | |
CN111615154A (en) | 5G and NBIOT intelligence thing networking module | |
CN110932393B (en) | Substation information protection master station system and data initialization method thereof | |
CN101150832B (en) | Dynamic management method, device and system for WIMAX communication resource | |
CN102420809A (en) | terminal management system, server and method | |
CN206673956U (en) | Radio communication device | |
CN110493338B (en) | Equipment mutual control method, system and computer readable storage medium | |
CN111934787A (en) | 800MHz digital channel unit function test station and test method | |
CN102932208A (en) | Site monitoring method and device | |
CN110881181A (en) | Method, device and system for improving communication applied to new-generation information technology M2M Internet of things by adopting indexes | |
CN114520827B (en) | Message receiving method, pushing method, system and medium | |
CN104125622A (en) | Configuration method of access system, equipment and system | |
CN116074397A (en) | Data sharing system | |
CN101699420B (en) | Method for improving communication efficiency by improving equipment polling mode | |
CN111061355B (en) | Power supply data acquisition method and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20100818 |