CAN communication device supporting MODBUS protocol and operation method thereof
The CAN communication device facilitates MODBUS protocol integration in CAN networks by converting frames, addressing protocol compatibility issues and enhancing scalability and standardization.
Patent Information
- Application Number
- JP2024534379
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-12-23
- Filing Date
- 2022-11-23
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-11-23
Smart Images

Figure 0007786795000001 
Figure 0007786795000002 
Figure 0007786795000003
Abstract
Description
[Technical Field]
[0001] The present invention claims the benefit of priority based on Korean Patent Application No. 10-2021-0186534, filed December 23, 2021, and all contents disclosed in the documents of this Korean patent application are incorporated herein by reference.
[0002] The embodiments disclosed herein relate to a CAN communication device that supports the MODBUS protocol and a method of operating the same. [Background technology]
[0003] In recent years, the automotive electronics industry has grown rapidly as a result of advances in autonomous driving technology and electronic control systems. As electronic devices are utilized in a variety of areas of automobiles, such as engine and drive control, multimedia playback, information processing for autonomous driving, and safety device control, communication technologies for connecting electronic devices within a vehicle have also become important. In the past, all electronic devices were connected via dedicated wiring. However, as the number of electronic devices within a vehicle increases and their functions become more complex, communication technologies and protocols that can provide high bandwidth while reducing wiring complexity are required.
[0004] CAN (Controller Area Network) communication is a typical protocol for transmitting and receiving data between electronic devices within a vehicle. CAN communication is designed to allow controllers and devices within the system to communicate with each other without a host computer, and has the advantages of being resistant to electrical noise and allowing for inexpensive construction of a communication system. Most CAN communication devices use standard protocols or user-defined communication protocols. Standard protocols offer advantages in terms of scalability but are complex, while user-defined protocols are simple but lack scalability. Many industrial devices, in particular, use the MODBUS protocol, which boasts lightweight and high scalability. While MODBUS has established standards for serial and TCP / IP communication, there is no standard for CAN communication, making it difficult to directly utilize it. Summary of the Invention [Problem to be solved by the invention]
[0005] It is an object of the embodiments disclosed herein to provide a CAN communication device that supports the MODBUS protocol and a method of operating the same.
[0006] The technical problems of the embodiments disclosed in this specification are not limited to the technical problems mentioned above, and other technical problems not mentioned will be clearly understood by those skilled in the art from the following description. [Means for solving the problem]
[0007] According to one embodiment, a CAN (Controller Area Network) communication device supporting the MODBUS protocol includes a communication unit that receives a MODBUS data frame from a device, and a controller that converts the MODBUS data frame into at least one CAN data frame, each of which includes identification information corresponding to a transmission / reception type of the data frame and an order in which the data is configured.
[0008] In one embodiment of a CAN communication device, the MODBUS data frame includes a first data section including address information, a second data section including a function code, a third data section including MODBUS message data, and a fourth data section including a CRC value, and the at least one CAN data frame includes a fifth data section including identification information of the CAN data frame, a sixth data section including a function code, a seventh data section including CAN message data, and an eighth data section including a CRC value.
[0009] In one embodiment of a CAN communication device, the controller may be configured to map the first data portion of the MODBUS data frame to a portion of the fifth data portion of the CAN data frame, map the second data portion of the MODBUS data frame to the sixth data portion of the CAN data frame, map the third data portion of the MODBUS data frame to the seventh data portion of the CAN data frame, and map the fourth data portion of the MODBUS data frame to the eighth data portion of the CAN data frame.
[0010] In one embodiment of a CAN communication device, the controller may be configured to, when mapping the third data section to the seventh data section, if the size of the third data section exceeds a set value, map the excess portion of the third data section to the seventh data section of a new CAN data frame.
[0011] In one embodiment of a CAN communication device, the identification information of the CAN data frame may include at least one of address information mapped in the first data section of the MODBUS data frame, total frame number information of the at least one CAN data frame, sequence information of the frame currently being transmitted among the at least one CAN data frame, requester identification information for identifying the device that requested the CAN data frame among one or more receiving devices, transmission / reception identification information for identifying whether the CAN data frame corresponds to the requested data frame, and transmission / reception type information of the CAN data frame.
[0012] According to one embodiment, a CAN communication device supporting the MODBUS protocol includes a controller that checks sequence information of a CAN data frame transmitted via a CAN communication bus, and if the sequence of the CAN data frame is first, initializes a receive buffer and sets a receive flag based on the total frame number information, and if the sequence of the CAN data frame is not first, stores CAN message data of the CAN data frame while removing the receive flag corresponding to the sequence of the CAN data frame, and if all the receive flags have been removed, sequentially maps the stored CAN message data according to the sequence information to convert it into a MODBUS data frame, and a communication unit that transmits the MODBUS data frame to a device. In one embodiment of the CAN communication device, the devices may include multiple master devices or multiple slave devices.
[0013] According to one embodiment, a method for operating a CAN (Controller Area Network) communication device supporting the MODBUS protocol may include receiving a MODBUS data frame from a first device and converting the MODBUS data frame into at least one CAN data frame, each of which includes identification information corresponding to a transmission / reception type of the data frame and an order in which the data is configured.
[0014] In one embodiment of a method for operating a CAN communication device, the MODBUS data frame includes a first data section including address information, a second data section including a function code, a third data section including MODBUS message data, and a fourth data section including a CRC value, and the at least one CAN data frame includes a fifth data section including identification information of the CAN data frame, a sixth data section including a function code, a seventh data section including CAN message data, and an eighth data section including a CRC value.
[0015] In one embodiment of a method for operating a CAN communication device, the MODBUS data frame includes a first data section including address information, a second data section including a function code, a third data section including MODBUS message data, and a fourth data section including a CRC value, and the at least one CAN data frame includes a fifth data section including identification information of the CAN data frame, a sixth data section including a function code, a seventh data section including CAN message data, and an eighth data section including a CRC value.
[0016] In one embodiment, in a method for operating a CAN communication device, the step of converting the MODBUS data frame into at least one CAN data frame includes the steps of mapping the first data portion of the MODBUS data frame to a portion of the fifth data portion of the CAN data frame, mapping the second data portion of the MODBUS data frame to the sixth data portion of the CAN data frame, mapping the third data portion of the MODBUS data frame to the seventh data portion of the CAN data frame, and mapping the fourth data portion of the MODBUS data frame to the eighth data portion of the CAN data frame.
[0017] In one embodiment of a method for operating a CAN communication device, the step of mapping the third data portion to the seventh data portion may include a step of mapping the excess portion of the third data portion to the seventh data portion of a new CAN data frame if the size of the third data portion exceeds a set value.
[0018] In one embodiment of a method for operating a CAN communication device, the identification information of the CAN data frame may include at least one of address information mapped in the first data portion of the MODBUS data frame, total frame number information of the at least one CAN data frame, sequence information of a frame currently being transmitted among the at least one CAN data frame, requester identification information for identifying a device that has requested the CAN data frame among one or more receiving devices, transmission / reception identification information for identifying whether the CAN data frame corresponds to a requested data frame, and transmission / reception type information of the CAN data frame.
[0019] In one embodiment, a method for operating a CAN communication device may further include converting at least one CAN data frame transmitted over a CAN communication bus into a MODBUS data frame, and transmitting the MODBUS data frame to a second device.
[0020] In one embodiment of a method for operating a CAN communication device, the step of converting the at least one CAN data frame into a MODBUS data frame may include the steps of: checking order information of the CAN data frame; if the order of the CAN data frame is first, initializing a receive buffer and setting a receive flag based on the total frame number information; if the order of the CAN data frame is not first, removing the receive flag corresponding to the order of the CAN data frame and storing the CAN message data of the CAN data frame; and if all the receive flags have been removed, sequentially mapping the stored CAN message data according to the order information to convert it into a MODBUS data frame.
[0021] In one embodiment of a method for operating a CAN communication device, the step of converting the stored CAN message data into a MODBUS data frame by sequentially mapping the data according to the order information may include the steps of: mapping a portion of the fifth data section of the CAN data frame to a portion of the first data section of the MODBUS data frame; mapping the sixth data section of the CAN data frame to the second data section of the MODBUS data frame; mapping the seventh data section of the CAN data frame to the third data section of the MODBUS data frame; and mapping the eighth data section of the CAN data frame to the fourth data section of the MODBUS data frame.
[0022] In one embodiment of the method for operating a CAN communication device, the first device or the second device may include a plurality of master devices or a plurality of slave devices. [Effects of the Invention]
[0023] According to the above-described embodiment, communication can be performed using the MODBUS protocol when transmitting and receiving data between devices using CAN communication. In existing CAN communication methods, using a standard protocol is advantageous in terms of scalability but has the disadvantage of being complex, while a user-defined protocol is relatively simple but has the disadvantage of being disadvantageous in terms of scalability. By supporting the MODBUS communication protocol, the CAN communication device proposed in the embodiment can utilize the advantages of the MODBUS protocol, such as lightweight processes, increased data scalability, and the free provision of standard documentation. In addition, various other effects can be obtained directly or indirectly from this specification. [Brief explanation of the drawings]
[0024] In order to more clearly describe the embodiments disclosed in this specification or the technical solutions of the prior art, drawings necessary for describing the embodiments are briefly introduced below. It should be understood that the following drawings are only for describing the embodiments of this specification and are not intended to limit the scope of the invention. In addition, for the sake of clarity, the depiction of some components in the drawings may be exaggerated or omitted.
[0025] [Figure 1a] 1 is a block diagram illustrating a configuration of a CAN communication device that supports the MODBUS protocol according to an embodiment. [Figure 1b] 1 is a block diagram illustrating a configuration of a CAN communication device that supports the MODBUS protocol according to an embodiment. [Figure 2a] 1 illustrates communication between multiple devices using a CAN communication device that supports the MODBUS protocol according to one embodiment. [Figure 2b] 1 illustrates communication between multiple devices using a CAN communication device that supports the MODBUS protocol according to one embodiment. [Figure 3] 1 is a flowchart illustrating an operation method of a CAN communication device that supports the MODBUS protocol according to an embodiment. [Figure 4] 1 illustrates mapping of a MODBUS data frame to a CAN data frame at the transmitting end of a CAN communication device according to an embodiment. [Figure 5] 1 illustrates a structure of identifier (ID) data in a CAN data frame according to one embodiment. [Figure 6] 1 illustrates mapping a MODBUS data frame into two or more CAN data frames at the transmitting end of a CAN communication device according to an embodiment. [Figure 7] 10 is a flowchart illustrating a process of converting a CAN data frame into a MODBUS data frame at a receiving end of a CAN communication device according to an embodiment. DETAILED DESCRIPTION OF THE INVENTION
[0026] Hereinafter, the embodiments disclosed in this specification will be described in detail with reference to the exemplary drawings. When referring to components in each drawing, please note that the same components are referred to by the same reference numerals as much as possible when they appear in other drawings. Furthermore, when describing the embodiments disclosed in this specification, if a detailed description of related known structures or functions is deemed to hinder understanding of the embodiments disclosed in this specification, such detailed description will be omitted.
[0027] The terms used in this specification have been selected as widely used and general terms as possible while taking functionality into consideration, but these may vary depending on the intentions or practices of engineers in the field or the emergence of new technologies. In addition, in certain cases, the applicant has arbitrarily selected terms, and in such cases, the meanings thereof will be described in the explanation of the specification. Therefore, it is clear that the terms used in this specification should be interpreted not simply based on the name of the term, but based on the substantive meaning of the term and the overall content of this specification.
[0028] The terms used in this specification are merely used to describe particular embodiments and are not intended to limit the scope of other embodiments. The singular expression may include the plural expression unless otherwise clearly indicated in the context.
[0029] <Configuration of CAN communication device that supports MODBUS protocol> FIG. 1a is a block diagram showing the configuration of a CAN communication device that supports the MODBUS protocol according to an embodiment.
[0030] 1a, a CAN communication device 10 according to an embodiment includes a communication unit 110 that receives a MODBUS data frame from a first device 20 or transmits a MODBUS data frame to a second device 30, and a controller 120 that converts a MODBUS data frame into a CAN data frame or converts a CAN data frame into a MODBUS data frame. In this specification, terms such as "first" and "second" are used to distinguish components from each other and do not indicate an order or hierarchy between the components.
[0031] The first device 20 and the second device 30 are devices designed to exchange data via CAN communication, and may be, for example, but not limited to, electronic devices in a vehicle, general or industrial PCs, embedded devices, etc. Although not shown, each of the devices 20 and 30 may include a processor for processing data and a communication unit for communicating with other devices. The devices 20 and 30 can output or receive input of request / response message data as MODBUS data.
[0032] In one embodiment, the first device 20 may be a master device that requests responses from other devices, and the second device 30 may be a slave device that receives requests from other devices and responds to them, or conversely, the first device 20 may be a slave device and the second device 30 may be a master device.
[0033] At the transmitting end of the apparatus 10, the controller 120 converts the MODBUS data frame input from the first device 20 into at least one CAN data frame. The process by which the controller 120 converts the MODBUS data frame into the CAN data frame will be described later with reference to FIGS. 3 to 6.
[0034] At the receiving end of the device 10, the controller 120 converts the at least one CAN data frame transmitted over the CAN communication bus into a MODBUS data frame, as will be described later with reference to FIG.
[0035] In the structure shown in Fig. 1a, the first device 20 operates as a transmitting device that transmits MODBUS data frames, and the second device 30 operates as a receiving device, but the reverse is also possible. For example, in the structure shown in Fig. 1b, the first device 20 can operate as a receiving device that receives MODBUS data frames, and the second device 30 can operate as a transmitting device. In this way, each device 20, 30 can transmit and receive data in both directions, and the communication apparatus 10 can convert between MODBUS data frames and CAN data frames.
[0036] According to one embodiment, the first device 20 may be a plurality of master devices, and the second device 30 may be a plurality of slave devices. In this case, when one of the master devices requests a response from one of the slave devices, the communication unit 110 transmits a data frame to the slave device corresponding to the request via the CAN communication bus.
[0037] 2a shows communication between multiple devices using a CAN communication device 10 that supports the MODBUS protocol according to one embodiment. Referring to FIG. 2a, there are multiple master devices 21, 22, 23, etc. and multiple slave devices 31, 32, 33, 34, etc., and the CAN communication device 10 relays communication between the devices by mutually converting data frames.
[0038] For example, when the master device 21 requests a response from the slave device 32, the apparatus 10 receives a MODBUS data frame from the master device 21 and converts it into a CAN data frame. The apparatus 10 also converts the CAN data frame transmitted over the CAN communication bus back into a MODBUS data frame and transmits it to the slave device 32.
[0039] 2b shows the operation of the slave device 32 responding to a request from the master device 21, which is the opposite of that of FIG. 2a. In this case, the apparatus 10 receives a MODBUS data frame input from the slave device 32 and converts it into a CAN data frame. The apparatus 10 also converts the CAN data frame transmitted over the CAN communication bus back into a MODBUS data frame and transmits it to the master device 21. In this way, the apparatus can operate as either a transmitting end or a receiving end depending on the device's request and response.
[0040] <Operation method of CAN communication device that supports MODBUS protocol> The operation method of the CAN communication device supporting the MODBUS protocol will be described below. The configuration of the CAN communication device supporting the MODBUS protocol is as described with reference to Figures 1a-1b and 2a-2b.
[0041] FIG. 3 is a flowchart illustrating an operation method of a CAN communication device supporting the MODBUS protocol according to one embodiment. 3, first, a step (S310) of receiving a MODBUS data frame from a first device is performed. Step (S310) may be performed by the communication unit 110 of the apparatus 10, and the first device 20 may be a master device that requests a response from other devices, or a slave device that receives a request from other devices and responds to it.
[0042] The MODBUS data frame has a structure conforming to the MODBUS communication protocol standard. FIG. 4 illustrates the structure of a MODBUS data frame according to one embodiment. Referring to FIG. 4, the MODBUS data frame may include a first data section D1 containing address information, a second data section D2 containing a function code, a third data section D3 containing MODBUS message data, and a fourth data section D4 containing a CRC value. The function of each data section is as follows: the address information contains the IP addresses of the sending device (e.g., the first device) and the receiving device (e.g., the second device), and the function code is a command set code provided by the MODBUS protocol that allows values to be read or written to the device's memory. The MODBUS message data contains the contents of the message to be read or written. The CRC value is a check value used to check for errors in transmitted data when transmitting data over a network using a cyclic redundancy check (CRC). Before transmitting data, a CRC value is calculated based on the value of the given data and attached to the data before transmission. After the data transmission is complete, the CRC value is calculated again based on the value of the received data, and the two values are compared to detect errors.
[0043] 3, next, a step (S320) is performed in which the MODBUS data frame is converted into at least one CAN data frame. Step (S320) may be performed by the controller 120 of the device 10, and the controller 120 can appropriately convert the data frame so that data conforming to the MODBUS protocol standard can be exchanged using the CAN communication bus.
[0044] 4 illustrates mapping of a MODBUS data frame to a CAN data frame according to one embodiment. In the embodiment, the MODBUS message data (Message Data 1-5) of the third data section D3 occupies 5 bytes.
[0045] 4, the CAN data frame includes a fifth data section D5 containing identification information for the CAN data frame, a sixth data section D6 containing a function code, a seventh data section D7 containing CAN message data, and an eighth data section D8 containing a CRC value. The functions of the data areas (D5 to D8) are the same as those of the data areas (D1 to D4) of the MODBUS data frame described above, and therefore will not be repeated here.
[0046] According to a specific embodiment, the first data section D1 of the MODBUS data frame is mapped to a part of the fifth data section D5 of the CAN data frame, the second data section D2 is mapped to the sixth data section D5, the third data section D3 is mapped to the seventh data section D7, and the fourth data section D4 is mapped to the eighth data section D8. In addition to the address information (Slave Address) mapped in the first data section D1, the fifth data section D5 of the CAN data frame may further include identifier (ID) data for correctly identifying or receiving the data frame at the receiving end.
[0047] 5 shows the structure of the identifier data (fifth data section D5) of a CAN data frame according to one embodiment. In the embodiment, the fifth data section D5 is made up of 29 bits (0 to 28 bits), and the table shows the abbreviation of the field corresponding to each bit.
[0048] SA, which corresponds to bits 0 to 7, contains address information of the requesting and responding devices as a slave address. FC, which corresponds to bits 8 to 12, is a frame count that indicates the order of the currently transmitted frame when there are two or more CAN data frames, and can have a value between 0 and 31. For example, FC=0 indicates that it is the first frame of two or more CAN data frames.
[0049] The RID, which corresponds to bits 13 to 15, indicates a requester identifier for identifying the device that requested the CAN data frame and can have a value between 0 and 7. The RID is used, for example, as an identifier for requests during communication between multiple devices or during multi-processing within a single device. Using the RID identification information, communication between multiple MODBUS master and slave devices is possible.
[0050] FN, which corresponds to bits 16 to 21, is a Frame Number that indicates the total number of CAN data frames corresponding to the MODBUS request and response, and can have a value between 1 and 32. For example, if the number of MODBUS message data exceeds the set value and is converted into two or more CAN data frames, FN=2 means that the number of converted CAN data frames is two.
[0051] The TID corresponding to bits 24-25 is a transaction identifier that indicates transmission / reception identification information for identifying whether the CAN data frame corresponds to the requested data frame. For example, a slave device stores the TID included in the transmission data of a master device and returns it when responding, and the master device can use the returned TID to check whether the currently received response frame corresponds to the requested TID.
[0052] The 28-bit TT indicates the transaction type of the CAN data frame. For example, if the type of the CAN data frame corresponds to a request from the master device, it may be 0, and if it corresponds to a response from the slave device, it may be 1. By using this, the type of the CAN data frame currently being transmitted or received can be easily identified.
[0053] In the above embodiment, an example was given in which the MODBUS message data (Message Data 1 to 5) in the MODBUS data frame is 5 bytes, but if the message data exceeds the set value, it may be converted into two or more CAN data frames.
[0054] FIG. 6 illustrates how the controller 120 of the CAN communication device 10, according to one embodiment, maps a MODBUS data frame to two or more CAN data frames. In this embodiment, the MODBUS message data (Message Data 1-10) in the third data section D3 occupies 10 bytes. According to this embodiment, a CAN data frame can be mapped to up to 10 bytes of data, and can contain 7 bytes of data excluding the fifth data section D5 containing identification information and address information and the sixth data section D6 containing a function code. Therefore, only a portion of the 10 bytes of message data (Message Data 1-7) is mapped to the seventh data section D7 of the first CAN data frame, and the remaining message data (Message Data 8-10) and CRC value are mapped to the seventh data section D7' and eighth data section D8' of a new second CAN data frame, respectively.
[0055] In this case, the first and second CAN data frames contain identification information in the fifth data section D5 and D5', respectively, with FN=2, FC=0 (the first frame of the two total frames) for the first CAN data frame and FN=2, FC=1 (the second frame of the two total frames) for the second CAN data frame. Using the frame count (FC) identification information, multiple CAN data frames transmitted non-sequentially can be reconstructed in order and converted into a MODBUS data frame.
[0056] In another example, if the message data exceeds 14, the excess data can be mapped to a new third CAN data frame, where the first CAN data frame has FN=3, FC=0, the second CAN data frame has FN=3, FC=1, and the third CAN data frame has FN=3, FC=2.
[0057] 3, step (S320) is followed by step (S330) of converting at least one CAN data frame transmitted over the CAN communication bus into a MODBUS data frame. Step (S330) may be performed by controller 120 of device 10.
[0058] According to one embodiment, the step of converting the at least one CAN data frame into a MODBUS data frame (S330) may include the steps of checking sequence information of the CAN data frame; initializing a receive buffer and setting a receive flag based on the total frame number information if the sequence of the CAN data frame is first; storing CAN message data of the CAN data frame while removing a receive flag corresponding to the sequence of the CAN data frame if the sequence of the CAN data frame is not first; and sequentially mapping the stored CAN message data according to the sequence information to convert it into a MODBUS data frame if all the receive flags have been removed.
[0059] FIG. 7 is a flow chart illustrating a process for converting a CAN data frame to a MODBUS data frame, according to one embodiment. 7, first, it is determined whether a new CAN data frame has been received (S710). If a new CAN data frame has been received (S710 → Yes), the process proceeds to the next step (S720). If a new CAN data frame has not been received (S710 → No), the CAN message data already stored in the receive buffer is converted into MODBUS data (S760), and the process ends.
[0060] Next, it is determined whether the CAN data frame is the first in order (S720). When there are two or more CAN data frames, the order of the received frame can be determined from the Frame Count (FC) value included in the identification information (see FIG. 5). If the FC of the received CAN data frame is 0, it is determined that the data frame is the first in order (S720 → Yes), and the process proceeds to step S730 to initialize the receive buffer and set a receive flag based on the total frame number information. If the FC of the received CAN data frame is not 0, it is determined that the data frame is not the first in order (S720 → No), and the process proceeds to step S740 without going through step S730 (i.e., without initializing the receive buffer or setting the flag).
[0061] Next, the CAN data frame is stored while removing the reception flag corresponding to the order of the received CAN data frame (ie, corresponding to the FC value) (S740).
[0062] Next, it is checked whether all the receive flags have been cleared (S750). If all the receive flags have been cleared (S750 → Yes), one or more CAN data frames have been received, so the process proceeds to the next step (S760). If receive flags remain (S750 → No), there are still CAN data frames to receive, so the process returns to step (S710) and waits for the reception of a new CAN data frame.
[0063] If all CAN data frames have been received, the CAN message data stored in the receive buffer is converted into a MODBUS data frame by sequentially mapping the data according to the order information (FC value) (S760). The conversion process is the reverse of the conversion of the MODBUS data frame into the CAN data frame, and may include, for example, mapping a part of the fifth data section of the CAN data frame into a part of the first data section of the MODBUS data frame, mapping the sixth data section of the CAN data frame into the second data section of the MODBUS data frame, mapping the seventh data section of the CAN data frame into the third data section of the MODBUS data frame, and mapping the eighth data section of the CAN data frame into the fourth data section of the MODBUS data frame.
[0064] By performing the above steps (S710 to S760), one or more CAN data frames can be reconstructed in order and converted into a MODBUS data frame. In this way, the FC values of the CAN data frames can be used to reconstruct CAN data frames transmitted out of order into the correct order.
[0065] 3, the step (S340) of outputting the MODBUS data frame to the second device is performed by the communication unit 110 of the apparatus 10. The second device 30 may be a receiving device, a slave device that receives a response request from the master device, or a master device that receives a response in response to a request from the slave device.
[0066] The method for operating a CAN communication device supporting the MODBUS protocol according to the above-described embodiment may be implemented as an application or in the form of program instructions executable by various computer components and recorded on a computer-readable recording medium. The computer-readable recording medium may include program instructions, data files, data structures, and the like, singly or in combination.
[0067] According to the embodiment described above, communication can be performed using the MODBUS protocol when transmitting and receiving data between devices using CAN communication. In existing CAN communication methods, using a standard protocol is advantageous in terms of scalability but has the disadvantage of being complex, while a user-defined protocol is relatively simple but has the disadvantage of being disadvantageous in terms of scalability. The CAN communication device and communication system using the same proposed in the embodiment support the MODBUS communication protocol, thereby taking advantage of the advantages of the MODBUS protocol, such as lightweight processes, increased data scalability, and the free provision of standard documentation.
[0068] Although all components constituting the embodiments have been described above as being combined or operating in combination, this does not necessarily mean that the embodiments are limited to such embodiments, and all components may be selectively combined and operate in one or more combinations within the intended scope. Furthermore, unless otherwise specified, the terms "include," "comprise," "have," and the like used above mean that the component in question can be contained within them, and therefore should be interpreted as not excluding other components but as including other components.
[0069] The above description is merely an illustrative example of the technical concepts disclosed herein, and those skilled in the art to which the embodiments disclosed herein pertain may make various modifications and variations without departing from the essential characteristics of the embodiments disclosed herein. Therefore, the embodiments disclosed herein are intended to illustrate, rather than limit, the technical concepts disclosed herein, and such embodiments do not limit the scope of the technical concepts disclosed herein. The scope of protection of the technical concepts disclosed herein should be interpreted by the following claims, and all technical concepts within the scope equivalent thereto should be interpreted as being within the scope of the present specification. [Explanation of symbols]
[0070] 10 CAN communication device 20 First Device 21-23 Master Device 30 Secondary Device 31-34 Slave Devices 110 Communications Department 120 Controller
Claims
1. A communication unit that receives a MODBUS data frame from a first device; a controller that converts the MODBUS data frame into at least one CAN data frame, each of which includes identification information corresponding to a transmission / reception type of the data frame and an order of data configuration, and converts the at least one CAN data frame transmitted via the CAN communication bus into a MODBUS data frame; Including, the communication unit transmits the MODBUS data frame converted from the at least one CAN data frame to a second device; A CAN communication device supporting a MODBUS protocol, wherein the first device is one of a plurality of master devices and the second device is one of a plurality of slave devices, or the first device is one of a plurality of slave devices and the second device is one of a plurality of master devices.
2. The MODBUS data frame includes a first data section including address information, a second data section including a function code, a third data section including MODBUS message data, and a fourth data section including a CRC value, 2. The CAN communication device supporting the MODBUS protocol according to claim 1, wherein the at least one CAN data frame includes: a fifth data section including identification information of the CAN data frame; a sixth data section including a function code; a seventh data section including CAN message data; and an eighth data section including a CRC value.
3. The controller Mapping the first data portion of the MODBUS data frame to a part of the fifth data portion of the CAN data frame; mapping the second data portion of the MODBUS data frame to the sixth data portion of the CAN data frame; mapping the third data portion of the MODBUS data frame to the seventh data portion of the CAN data frame; 3. The CAN communication device supporting the MODBUS protocol according to claim 2, wherein the fourth data portion of the MODBUS data frame is mapped to the eighth data portion of the CAN data frame.
4. 4. The CAN communication device supporting the MODBUS protocol of claim 3, wherein, when mapping the third data portion to the seventh data portion, if a size of the third data portion exceeds a set value, the controller maps the excess portion of the third data portion to the seventh data portion of a new CAN data frame.
5. The identification information of the CAN data frame is Address information mapped in the first data portion of the MODBUS data frame; information on the total number of frames of the at least one CAN data frame; Sequence information of a currently transmitted frame among the at least one CAN data frame; requester identification information for identifying a device that has requested the CAN data frame among one or more receiving devices; Transmit / receive identification information for identifying whether the CAN data frame corresponds to a requested data frame; and The CAN communication device supporting the MODBUS protocol of claim 2 , further comprising at least one of transmission and reception type information of the CAN data frame.
6. A CAN communication device supporting the MODBUS protocol described in claim 1, wherein the controller checks sequence information of two or more CAN data frames transmitted via a CAN communication bus, and if the sequence of the CAN data frame is first, initializes a receive buffer and sets a receive flag based on total frame number information, and if the sequence of the CAN data frame is not first, stores CAN message data of the CAN data frame while removing the receive flag corresponding to the sequence of the CAN data frame, and if all the receive flags have been removed, sequentially maps the stored CAN message data according to the sequence information and converts it into a MODBUS data frame.
7. A method for operating a CAN (Controller Area Network) communication device supporting a MODBUS protocol, comprising: receiving a MODBUS data frame from a first device; converting the MODBUS data frame into at least one CAN data frame, each of which includes identification information corresponding to a transmission / reception type of the data frame and a data configuration order; converting the at least one CAN data frame transmitted over a CAN communication bus into a MODBUS data frame; transmitting a MODBUS data frame converted from the at least one CAN data frame to a second device; Including, A method for operating a CAN communication apparatus supporting a MODBUS protocol, wherein the first device or the second device includes a plurality of master devices or a plurality of slave devices.
8. The MODBUS data frame includes a first data section including address information, a second data section including a function code, a third data section including MODBUS message data, and a fourth data section including a CRC value, 8. The method of claim 7, wherein the at least one CAN data frame includes a fifth data section including identification information of the CAN data frame, a sixth data section including a function code, a seventh data section including CAN message data, and an eighth data section including a CRC value.
9. The step of converting the MODBUS data frame into the at least one CAN data frame comprises: mapping the first data portion of the MODBUS data frame onto a portion of the fifth data portion of the CAN data frame; mapping the second data portion of the MODBUS data frame to the sixth data portion of the CAN data frame; mapping the third data portion of the MODBUS data frame to the seventh data portion of the CAN data frame; and mapping the fourth data portion of the MODBUS data frame to the eighth data portion of the CAN data frame.
10. The step of mapping the third data portion to the seventh data portion comprises:
10. The method of claim 9, further comprising: if a size of the third data portion exceeds a set value, mapping the excess portion of the third data portion to a seventh data portion of a new CAN data frame.
11. The identification information of the CAN data frame is Address information mapped in the first data portion of the MODBUS data frame; information on the total number of frames of the at least one CAN data frame; Sequence information of a currently transmitted frame among the at least one CAN data frame; requester identification information for identifying a device that has requested the CAN data frame among one or more receiving devices; Transmit / receive identification information for identifying whether the CAN data frame corresponds to a requested data frame; and The method of claim 8 , further comprising the step of: providing at least one of the transmission and reception type information of the CAN data frame.
12. The step of converting at least one CAN data frame into a MODBUS data frame comprises: checking sequence information of the CAN data frame; If the CAN data frame is first, initializing a receive buffer and setting a receive flag based on the total frame number information; If the order of the CAN data frame is not first, storing CAN message data of the CAN data frame while removing a reception flag corresponding to the order of the CAN data frame; and if all of the reception flags are removed, converting the stored CAN message data into a MODBUS data frame by sequentially mapping the stored CAN message data according to the order information.
13. the step of converting the stored CAN message data into a MODBUS data frame by sequentially mapping the stored CAN message data according to the order information, mapping a portion of the fifth data portion of the CAN data frame onto a portion of the first data portion of the MODBUS data frame; mapping the sixth data portion of the CAN data frame to the second data portion of the MODBUS data frame; mapping the seventh data portion of the CAN data frame to the third data portion of the MODBUS data frame; and mapping the eighth data portion of the CAN data frame to the fourth data portion of the MODBUS data frame.
14. A computer program comprising instructions for causing the CAN communication device to perform the operating method of any one of claims 7 to 13.
Citation Information
Patent Citations
Monitor logging device
JP2000216798A
Method of communication of gateway device supporting intercommunication between can and modbus, and gateway device using the same
JP2013013083A
Cogeneration device and cogeneration method
JP2017533404A
Abnormality detector and abnormality detection method
JP2019029993A
Energy integration and supply device and method
JP2020518213A