Data communication system and method therefor
By using destination indicators, data length indicators and output data counts in the CAN FD protocol, combining short data into long data, solving the problem of low efficiency in transmitting short data, and achieving more efficient data transmission.
Patent Information
- Application Number
- PCT/CN2024/106162
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-29
- Filing Date
- 2024-07-18
- Publication Date
- 2025-09-04
AI Technical Summary
The existing CAN 2.0 protocol is not efficient when transmitting short or longer information. The CAN FD protocol may take too long to transmit short data, resulting in inefficient data transmission.
In the data communication system between the master and slave devices group, multiple short data are combined into one long data by using information such as destination indicators, data length indicators, function codes and output data counts in the data communication system between the master and slave devices group, and efficient transmission is performed using the high bit rate of CAN FD.
The data communication between the master station device and multiple slave station devices is realized more efficiently, reducing transmission time and improving data transmission efficiency.
Smart Images

Figure CN2024106162_04092025_PF_FP_ABST
Abstract
Description
Data communication system and method thereof Technical Field
[0001] The present disclosure relates to a data communication system and a management method thereof; more particularly, to a data communication system using a controller area network (CAN) protocol. Background Art
[0002] The Controller Area Network (CAN) is a message-based communication system, and the CAN specification in ISO 11898 describes the protocol used to transmit this information. It has applications in a variety of fields, such as in-vehicle electronic networking, aircraft networking, process control systems, and medical devices. CAN 2.0 is currently one of the most widely used CAN protocols. As shown in Figure 1A, a CAN 2.0 frame includes a start of frame (SOF) field, an arbitration field, a control field, a data field, a cyclic redundancy check field (CRC field), an acknowledgement field (ACK field), and an end of frame field (EOF field). The CAN 2.0B bus can transmit data at a bit rate of up to 1 Mbit / s, and a data frame can carry 8 bytes of data. To support higher data rates and larger payloads, the Controller Area Network with Flexible Data Rate (CAN FD) was proposed. Figure 1B shows a CAN FD frame. A CAN FD frame consists of two phases: the arbitration phase and the data phase. During the arbitration phase, the first and third parts of the CAN FD frame are transmitted at the standard bit rate (i.e., 1 Mbit / s). During the data phase, the second part of the CAN FD frame can be transmitted at either the standard bit rate or a higher bit rate (e.g., 8 Mbit / s). However, CAN FD frames have longer control and CRC fields. If the data in the data phase is not long enough, the transmission time of a CAN FD frame may even be longer than that of a CAN 2.0 frame. Therefore, in a data communication system where only short data is transmitted, migrating from CAN 2.0 to CAN FD will not achieve the expected efficient data transmission.
[0003] Therefore, it is desirable to develop a new system for data communication using a controller area network (CAN), including but not limited to CAN FD, which can efficiently transmit both short and long messages.
[0004] Summary of the Invention
[0005] According to the present invention, a system for data communication using the Controller Area Network (CAN) protocol is provided. The system includes a master device and at least one slave device group. The at least one slave device group includes a plurality of slave devices connected to the master device to receive at least one outgoing data frame from the master device. The at least one outgoing data frame includes a destination indicator and a data length indicator. The destination indicator indicates the plurality of slave devices receiving the at least one outgoing frame. The data length indicator indicates the length of data received by each slave device in the at least one slave device group.
[0006] In one embodiment, the at least one outgoing data frame includes an arbitration field and a data field. The arbitration field includes at least one of the destination indicator, the data length indicator, an outgoing data count, and a function code. The outgoing data count indicates a sequence number of a refresh cycle executed by the master device. The function code indicates whether each slave device connected to the master device is required to send an incoming data frame to the master device.
[0007] In one embodiment, the at least one outgoing data frame includes an arbitration field and a data field, wherein the arbitration field includes the destination indicator, and the data field includes at least one of the data length indicator, an outgoing data count, and a function code.
[0008] In one embodiment, a length of data received by each slave device in the at least one slave device group is no greater than a maximum data length, and the maximum data length is four, five, or six words.
[0009] In one embodiment, the data field includes a function code for indicating whether each slave device connected to the master device is required to send an input data frame to the master device, or for indicating the configuration of output data from the master device to each slave device in the at least one slave device group.
[0010] In one embodiment, the data field includes an output data count for indicating a sequence number of output data received by the slave device.
[0011] In one embodiment, the slave device in the at least one slave device group updates its output data count if the slave device receives new output data in the at least one output data frame.
[0012] In one embodiment, the at least one slave device group includes a plurality of slave device groups, and the destination indicator is used to indicate at least one of the plurality of slave device groups.
[0013] In one embodiment, the master device requires each slave device connected to the master device to send an input data frame to the master device via a function code in the at least one output data frame.
[0014] In one embodiment, the slave device sends the input data frame to the master device, where the input data frame includes an output data count indicating a sequence number of a refresh cycle executed by the master device.
[0015] In one embodiment, after receiving a request in the at least one output data frame for sending the input data frame to the master device, each slave device sets a timeout period for sending its own input data frame to the master device.
[0016] In one embodiment, the master device determines whether the slave device has received its output data based on the output data count in the input data frame received from the slave device.
[0017] In one embodiment, if the master device determines that the slave device has not received its new output data because the output data count of the slave device is not equal to the output data count of the master device, the master device resends an output data frame to the slave device.
[0018] According to the present invention, a method for data communication between a master device and at least one group of slave devices connected to the master device using the Controller Area Network (CAN) protocol is provided. The method includes the master device sending an outbound data frame to the at least one group of slave devices and requesting each slave device connected to the master device to send an inbound data frame to the master device; and each slave device sending the inbound data frame to the master device. The at least one outbound data frame includes a data length indicator that indicates the length of data received by each slave device in the at least one group of slave devices.
[0019] In one embodiment, the data length received by each slave device in the at least one group is no greater than a maximum data length, and the maximum data length is four, five, or six words.
[0020] In one embodiment, the at least one outgoing data frame includes an arbitration field and a data field; the arbitration field includes a destination indicator, and the data field includes at least one of the data length indicator, an outgoing data count, and a function code.
[0021] In one embodiment, the data field includes a function code for indicating whether each slave device connected to the master device is required to send an input data frame to the master device, or for indicating the configuration of output data from the master device to each slave device in the at least one slave device group.
[0022] In one embodiment, the data field includes an output data count for indicating a sequence number of output data received from the slave device.
[0023] In one embodiment, the slave device in the at least one slave device group updates its output data count if the slave device receives new output data in the at least one output data frame.
[0024] In one embodiment, the at least one slave device group includes a plurality of slave device groups, and the destination indicator is used to indicate at least one of the plurality of slave device groups.
[0025] In one embodiment, the master device requires each slave device connected to the master device to send an input data frame to the master device through a function code in the at least one output data frame.
[0026] In one embodiment, the input data frame includes an output data count for indicating a sequence number of refresh cycles executed by the master device.
[0027] In one embodiment, after receiving a request in the at least one output data frame for sending the input data frame to the master device, each slave device sets a timeout period for sending its own input data frame to the master device.
[0028] In one embodiment, the master device determines whether the slave device has received its output data based on the output data count in the input data frame received from the slave device.
[0029] In one embodiment, if the master device determines that the slave device has not received its new output data because the output data count of the slave device is not equal to the output data count of the master device, the master device resends an output data frame to the slave device.
[0030] Through the system and method of the present invention, multiple short data items can be integrated into one long data item for transmission, thereby leveraging the high bit rate of CAN FD and achieving correspondingly efficient data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The present disclosure is best understood from the following detailed description when read in conjunction with the accompanying drawings. It should be emphasized that, in accordance with standard practice in the industry, various features are not drawn to scale and are used for illustration purposes only. In fact, the dimensions of the various features may be arbitrarily increased or reduced for clarity of discussion.
[0032] FIG1A is a schematic diagram illustrating a CAN 2.0B data frame;
[0033] FIG1B is a schematic diagram illustrating a CAN FD data frame;
[0034] FIG2 is a schematic diagram illustrating a system for data communication according to a first embodiment of the present disclosure;
[0035] FIG3A is a schematic diagram illustrating an output data frame according to a first embodiment of the present disclosure;
[0036] FIG3B shows an example of data fields according to the first embodiment of the present disclosure;
[0037] FIG3C is a schematic diagram illustrating an input data frame according to the first embodiment of the present disclosure;
[0038] FIG4A is a flow chart illustrating data communication according to the first embodiment of the present disclosure;
[0039] FIG4B is a flow chart illustrating data communication with a timeout mechanism according to the first embodiment of the present disclosure;
[0040] FIG5 is a schematic diagram illustrating a system for data communication according to a second embodiment of the present disclosure;
[0041] FIG6A is a schematic diagram illustrating an output data frame according to a second embodiment of the present disclosure;
[0042] FIG6B shows an example of data fields according to the second embodiment of the present disclosure;
[0043] FIG7 is a flow chart illustrating data communication according to a second embodiment of the present disclosure;
[0044] FIG8 is a schematic diagram showing a system for data communication according to a third embodiment of the present disclosure;
[0045] FIG9A is a schematic diagram illustrating an output data frame according to a third embodiment of the present disclosure;
[0046] FIG9B shows an example of data fields according to the first embodiment of the present disclosure;
[0047] FIG10 is a flow chart illustrating data communication according to the first embodiment of the present disclosure;
[0048] FIG11A is a schematic diagram illustrating an output data frame according to another embodiment of the present disclosure;
[0049] FIG. 11B shows an example of data fields according to another embodiment of the present disclosure.
[0050] DESCRIPTION OF REFERENCE NUMERALS 100, 500, 800: System 110, 510, 810: Master devices 210A to 210D, 260A, 520A to 520P, 530A to 530P, 820A to 820H, 830A to 830H, 840A to 840H, 850A to 850H, 860A: Slave devices 210, 520, 820: Group 1 530, 830: Group 2 840: Group 3 850: Group 4 VH, VL: Conducting wires DETAILED DESCRIPTION
[0051] Reference will now be made in detail to embodiments of the present disclosure, examples of which are described herein and shown in the accompanying drawings. Although the present disclosure will be described in conjunction with these embodiments, it should be understood that they are not intended to limit the present disclosure to these embodiments. The description of the operations is not intended to limit the order of operations. Any structure that has an equivalent effect derived from the recombinant device is within the scope of the present invention. It should be noted that, in accordance with standard practice in the industry, the illustrations are for understanding only and are not drawn to scale. Therefore, the illustrations are not intended to limit the actual embodiments of the present disclosure. In fact, for the sake of clarity of discussion, the dimensions of various features may be arbitrarily increased or reduced. For better understanding, whenever possible, the same element numbers are used to represent the same or similar parts in the drawings and description.
[0052] The terms used in this specification and claims, unless otherwise indicated, generally have their ordinary meanings in the art, in the context of the present disclosure, and in the specific context in which each term is used. Specific terms used to describe the present disclosure are discussed below or elsewhere in the specification to provide additional guidance to those skilled in the art regarding the description of the present disclosure.
[0053] In addition, it should be understood that the terms "include," "comprising," "having," "containing," "involving," and the like used herein are open ended, meaning including but not limited to. It will be understood that, as used herein, the word "and / or" includes any and all combinations of one or more of the associated listed items.
[0054] The described embodiments relate to one or more methods, systems, devices, and computer-readable media storing processor-executable process steps for communicating data between a master device and at least one group of slave devices. The data communication may adhere to a specific protocol, such as Controller Area Network (CAN) or Controller Area Network with Flexible Data Rate (CAN FD). The data communication described herein can be used in a variety of scenarios, including industrial automation, automotive (e.g., electric vehicles or self-driving cars) electronic networking and communications, building automation, electric vehicle charging stations, autonomous mobile robots, unmanned driving, smart logistics, aircraft networks, process control systems, and medical devices. By combining or consolidating multiple shorter data communications that would otherwise be sent individually by the master device to each device in the group of slave devices into a single group output data frame, data communication between the master device and the group of multiple slave devices can be made more efficient and less time-consuming. If the data length of the master device to transmit to a particular slave device within a group of slave devices is too long to be consolidated, the master device may send a separate outbound data frame to that slave device. In this case, the data length for that slave device in the outbound data frame sent by the master device to the group of multiple slave devices is zero. Furthermore, if the data length for a particular slave device is routinely long, that slave device need not be included in the group. During a refresh cycle, the master device sends information, such as in an outbound data format, to each slave device connected to the master device, either individually or in a consolidated manner, and requests a response. In one embodiment, the outbound data in the outbound data frame sent by the master device to the slave devices is also referred to as exchange data output (EDO). Each slave device should send information back to the master device, such as in an inbound data format. In one embodiment, the inbound data in the inbound data frame sent by a slave device to the master device is also referred to as exchange data input (EDI). However, in a specific cycle or under specific circumstances, one or more slave devices that do not need to be updated will not receive the output data transmitted by the master device.
[0055] At least one slave device group is connected to a master device to receive at least one output data frame from the master device. In some embodiments, the at least one slave device group includes one, two, three, four, five, or six slave device groups. As described above, when the data length for each slave device in the group does not exceed the maximum data length, the master device may send a combined output data frame to the slave device group, rather than sending a separate output data frame to each of the multiple slave devices in the group, to make data communication more efficient. In one embodiment, the maximum data length for each slave device is four, five, or six words. Each word is two bytes long. When the data length for a specific slave device in or outside the group exceeds the maximum data length, the master device sends a separate output data frame to the specific slave device. After receiving a request from the master device, the slave device may respond by sending an input data frame to the master device.
[0056] The at least one outgoing data frame includes a destination indicator and a data length indicator. In one embodiment, the outgoing data frame further includes a source indicator. The destination indicator is used to indicate one or more slave devices receiving the at least one outgoing data frame. The destination indicator may indicate a single slave device, a group of multiple slave devices, or all slave devices (broadcast). In one embodiment, the destination indicator indicates that the at least one group of slave devices is to receive the at least one outgoing data frame. In another embodiment, the destination indicator indicates that each slave device connected to the master device, including the at least one group of slave devices, is to receive the at least one outgoing data frame. When a slave device sends an incoming data frame to the master device, the destination indicator may indicate that the master device is the destination of the information. Conversely, the source indicator indicates the source of the information, whether it is the master device or the slave device sending the information. Each individual device, such as the master device and a specific device, may have a device ID. In one embodiment, when the individual device is the receiver, the destination indicator and the device ID are the same. Similarly, when an individual device is the sender, the source indicator is the same as the device ID. The data length indicator is used to indicate the length of data to be received by each slave device in the at least one slave device group. In one embodiment, the data length indicator is two, three, or four bytes, indicating the length of data to be received by each slave device in the at least one group. The data length indicator may have multiple parts, each part indicating the length of output data for a slave device in the slave device group. The data length indicators for each slave device may be consecutive or separate.
[0057] The at least one outgoing data frame may also include an arbitration field and a data field. The arbitration field is a section of the outgoing data frame that contains information used to determine the priority of data communications on the bus. The data field is another section of the outgoing data frame that contains information for a receiver, such as at least one group of slave devices. In one embodiment employing CAN FD, the at least one outgoing frame includes a sequence of a start-of-frame bit, an arbitration field, a control field, a data field, a CRC field, and an end-of-frame bit. The arbitration field may include a destination indicator; the data field may include a data length indicator and data for the receiver.
[0058] At least one outgoing data frame may further include a function code, which may be part of the arbitration field or the data field. The function code may be used to indicate how the data in the data field is to be interpreted and used. For example, the function code in the outgoing data frame may indicate the configuration of output data from the master device to each slave device in the at least one group. Furthermore, the function code may be used to indicate whether each slave device connected to the master device is required to send an incoming data frame to the master device. In one embodiment, function code 0A (hexadecimal) indicates that the data field is to be interpreted as follows: the first byte is the function code; the second byte is the output data count; the third and fourth bytes are data length indicators; and the remaining data fields are the output data from the master device to each slave device in the group. As described above, the output data in the outgoing data frame sent by the master device to the slave devices may be referred to as EDO(s). Function code 0B (HEX) also specifies that the data fields of the outgoing data frame should be interpreted as described above and requests that each slave device (connected to the master device via the bus) send a response to the master device. The input data in the incoming data frame sent by the slave device to the master device in response can be referred to as "exchange data input (EDI)." Therefore, function code 0A can be described as "Group EDO" and function code 0B as "Group EDO and all EDI requests."
[0059] In one embodiment, the data field of the output data frame may further include an output data count, which may be part of the arbitration field or the data field. The output data count indicates the sequence number of the refresh cycle executed by the master device. This sequence number typically increases by one after each refresh cycle. When the output data count reaches its maximum value, it is reset to zero. For example, the output data count may be one byte long and have a value between 0 and 255. During the first refresh cycle, the output data count of the output data frame is 0; during the second refresh cycle, the output data count of the output data frame is 1 (increased by one); and during the third refresh cycle, the output data count of the output data frame is 2 (increased by one again). In addition to the master device, each slave device also has its own output data count. When a slave device correctly receives new output data in an output data frame from the master device, it updates its output data count to the current value in the output data count of the output data frame. If a slave device incorrectly receives new output data or does not receive any new output data (e.g., its data length is zero), the slave device does not update its output data count. For example, after receiving new output data in an output data frame with an output data count of 5 from the master device, the slave device updates its output data count from 3 to 5.
[0060] As described above, the at least one outgoing data frame may include an arbitration field and a data field. Furthermore, the at least one outgoing data frame may include a destination indicator, a data length indicator, a function code, and an output data count, each of which may be a portion of the arbitration field or the data field. Alternatively, the arbitration field may include at least one of the destination indicator, the data length indicator, the function code, and the output data count. Similarly, the data field may include at least one of the destination indicator, the data length indicator, the function code, and the output data count.
[0061] After receiving a response request, as indicated by a function code in at least one output data frame, the slave device begins sending input data frames back to the master device in sequence. To handle the situation where a particular slave device does not respond when it is its turn, a timeout mechanism can be implemented to cause the next slave device in sequence to send the input data frame to the master device.
[0062] In one embodiment, an input data frame may include an output data count (ODC) that is the same as the output data count of the current slave device. The master device can use the output data count transmitted by the slave device and the master device's ODC to verify whether the slave device has correctly received its output data ("EDO") from the master device. Therefore, the ODC of the input data frame can, to a certain extent, replace the acknowledgment (ACK) that the slave device would otherwise need to respond with in the form of a data frame. If a slave device does not correctly receive its output data from the master device or does not respond by sending an input data frame at the scheduled time, the master device will resend an ODC to the slave device and request a response.
[0063] In the first embodiment shown in FIG2 , a data communication system 100 includes a master device 110 and five slave devices 210A, 210B, 210C, 210D, and 260A. The four slave devices 210A-210D are designated as Group 1 because they often receive output data shorter than the maximum data length. Slave device 260A does not belong to Group 1 because it often receives output data longer than the maximum data length. The master device 110 is connected to the slave devices via a differential pair of signal lines, where VH represents the line biased to a higher voltage level and VL represents the line biased to a lower voltage level. In one embodiment, the master device 110 is an industrial computer and the slave devices are distance sensors in vehicles. The master device 110 periodically transmits output data frames to the slave devices and requests input data frames from the slave devices in response. In one embodiment shown in FIG3A , the output data frame includes an arbitration field and a data field. The arbitration field also includes a source indicator and a destination indicator. The source indicator identifies the device that is sending information (input data frames or output data frames) onto the wire. The destination indicator identifies one or more slave devices receiving the output data frames or the master device receiving the input data frames. In one embodiment, the destination indicator may have four bits representing a value between 0 and 15. Each value may correspond to a master device, a single slave device, a group of multiple slave devices, or all slave devices (broadcast). Thus, system 110 can assign specific values to each individual device, including the master device and each slave device, a group of multiple slave devices, or all slave devices (broadcast). All devices connected to the wire / bus can listen to all input / output data frames transmitted on it, but only the device whose ID is included in the destination indicator actually receives and processes the data frame. The following is a table of destination indicators and the corresponding devices that receive the input / output data frames.
[0064] Table 1
[0065] In the first embodiment, as shown in Figures 3A and 3B , the outgoing data frame includes an arbitration field and a data field. The arbitration field includes a 4-bit destination indicator ranging from 0 to 15, which identifies the master device, each individual slave device, Group 1, and all slave devices (broadcast), respectively, as shown in Table 1. The data field includes a 1-byte function code that indicates how the data field is parsed and the function of the outgoing data frame. In other words, the function code tells the slave device how to interpret the data field and retrieve the data intended for it. In one embodiment, the function code is the first byte in the data field. Among other functions, function code 0A (HEX) indicates that the remaining data in the data field is allocated to the EDOs of the slave devices in Group 1 based on the data length indicator. In addition to this indication, function code 0B (HEX) requires all slave devices receiving this outgoing data frame to respond with an incoming data frame to the master device 110, as shown in Figure 3C . When the function code is 0B, the destination indicator is typically 15, indicating all slave devices (broadcast).
[0066] In one embodiment, the data field also includes a 1-byte output data count, which is the serial number of the refresh cycle executed by the master device, e.g., 0-255. The master device periodically refreshes all slave devices. During each cycle, the master device sends an output data frame to all slave devices and sequentially receives an input data frame from each slave device. After a complete cycle, the output data count is incremented by one. The output data count can be used to check whether the slave device correctly receives the output data frame. In one embodiment, the output data count is located directly after the function code in the data field.
[0067] As described above, the data field includes a data length indicator. In one embodiment, the data length indicator is 2 bytes (16 bits) long, with each 4 bits used to indicate the data length for one of the four slave devices in Group 1. In this embodiment, the maximum data length that can be received by a slave device in Group 1 is 8 words. Following the function code and output data count in the data field, in one embodiment, the data length indicator may be 0100 0000 1000 0110, indicating that the first slave device 210A receives 4 words; the second slave device 210B receives 0 words; the third slave device 210C receives 8 words; and the fourth slave device 210D receives 6 words. In this embodiment, the data length indicators for each slave device in the group are consecutive. The data length indicator for the first slave device immediately follows the data length indicator for the second slave device. The actual output data for each slave device may follow the data length indicator.
[0068] In one embodiment, as shown in FIG4A , during the fourth cycle (output data count = 3), because the output data length of slave device 260A exceeds 8 words, for example, 10 words, the master device sends a single first output data frame to slave device 260A. The master device then sends a second output data frame containing output data for the slave devices in Group 1 to all slave devices and requests a response from all of them. In the first output data frame, the destination indicator is 6, and therefore only slave device 260A receives the first output data frame. In the second output data frame, the destination indicator is 15 (broadcast), and therefore all slave devices receive the second output data frame. The function code in the second output data frame is 0B, indicating that the output data in the output data field is for the slave devices in Group 1 and simultaneously requests a response from all slave devices on the bus.
[0069] Each slave device connected to the master device (210A-210D and 260A) then responds sequentially by sending an input data frame to the master device 110. Each slave device can listen for input data frames sent (or transmitted) to the bus by any other slave device. After listening to the input data frame sent by its previous slave device, a slave device sends its own input data frame. For example, slave device 210A responds by sending a first input data frame. After listening to the first input data frame sent to the bus by slave device 210A, slave device 210B begins sending a second input data frame to the bus.
[0070] A timeout mechanism is provided to address the issue of slave devices failing to send input data frames. Therefore, even if a slave device fails to detect the previous slave device sending an input data frame, it still sends its input data frame after a timeout period. In one embodiment, the timeout period for the Nth slave device is set to (N-1)T, where T is a predetermined timeout period, such as 10 microseconds. If the Nth slave device detects the N-2th slave device sending its input data frame, the timeout period for the Nth slave device is reset to T. For example, as shown in FIG4B , when all slave devices receive a response request, the timeout periods for slave devices 210A-210D and 260A are set to 0, 1T, 2T, 3T, and 4T, respectively. After detecting the third slave device 210C sending its input data frame, the fifth slave device 260A resets its timeout period from 4T to T. Therefore, if the fourth slave device 210D does not send an input data frame as expected, the fifth slave device 260A sends its own input data frame within T time after monitoring the input data frame sent by the third slave device 210C. After noticing that the fourth slave device did not send an input data frame as expected, the master device then resends an outgoing data frame to the fourth slave device and requests a response, such as an input data frame.
[0071] As shown in Figure 3C , the data field of an input data frame includes an output data count. Typically, the output data count in an input data frame is the same as the current output data count of the slave device that sent the response input data frame. However, when a slave device receives an output data length of zero in an output data frame, its output data count remains unchanged and is not updated. Therefore, the slave device uses its original, current output data count as the output data count of the input data frame sent to the master device. For example, if the second slave device 210B receives an output data length of zero during the fourth refresh cycle (output data count of 3), the output data count of the input data frame responded by the second slave device 210B remains at 2. By checking the output data count of the input data frame, the master device can determine that the second slave device 210B has confirmed that it will not update its output data during the fourth refresh cycle, which is consistent with the master device's expected behavior during the fourth refresh cycle. Therefore, in the event that the output data count is not updated due to this situation, the master device will not resend the output data frame to the second slave device 210B.
[0072] The output data frames of all other slave devices that correctly receive the new output data during the fourth refresh cycle should be updated to 3, which is used as the output data count in the input data frame sent back to the master device 110. Therefore, if the output data count of the input data frame sent by the first slave device 210A is not 3, the master device notices that the first slave device did not correctly receive its output data. Therefore, in Figure 4A, after receiving responses (input data frames) from all other slave devices, the master device can resend the output data frame to the first slave device 210A and request a separate response.
[0073] In a second embodiment, as shown in FIG5 , a data communication system 500 includes a master device 510 and 32 slave devices 520A-520P, 530A-530P. The first group of 16 slave devices 520A-520P is designated as Group 1, and the second group of 16 slave devices 530A-530P is designated as Group 2. The master device 510 is connected to the slave devices via a differential pair of signal lines, where VH represents the line biased to a higher voltage level and VL represents the line biased to a lower voltage level. In one embodiment, the master device 510 is an industrial computer and the slave devices are robots for intelligent manufacturing. The master device 510 periodically transmits outbound data frames to the slave devices and requests inbound data frames from the slave devices in response. Compared to the master device needing to transmit outbound data frames to each of the 32 slave devices individually, in this embodiment, a single data communication cycle takes only 56% of the time.
[0074] In one embodiment shown in FIG6A and FIG6B , the outgoing data frame and the incoming data frame have an arbitration field and a data field. The arbitration field further includes a source indicator and a destination indicator. The following is an example of a destination indicator.
[0075] Table 2
[0076] In one embodiment, the data field of the output data frame also includes a 1-byte function code, a 1-byte output data count, a 4-byte data length indicator, and up to 29 words (58 bytes) of output data. Table 3 below illustrates an example of a 1-byte function code. The 1-byte output data count indicates the refresh cycle, e.g., 0-255. When a refresh cycle is completed, the output data count is incremented by 1. In this embodiment, the output data count of the output data frame may also be referred to as the EDO count. When the output data frame reaches 255, it is reset to 0 for the next cycle. The 4-byte data length indicator uses 2 bits to indicate the data length for each of the 16 slave devices in the group. For example, 00 indicates no data; 01 indicates a data length of one word; 10 indicates a data length of two words; and 11 indicates a data length of four words. The maximum data length is four words. Therefore, the data length indicators of 11 10 00 10 01 00 01 11 10 00 00 01 01 01 01 10 indicate that the data lengths of slave devices 520A-520P are 4, 2, 0, 2, 1, 0, 1, 4, 2, 0, 0, 1, 1, 1, 1, and 2 words, respectively. In this example, slave devices 520C, 520F, 520J, and 520K receive zero output data during this cycle and their output data counts remain the same, e.g., 9. The output data counts of the other slave devices in group 1 are updated to 10.
[0077] Table 3
[0078] In one embodiment shown in FIG7 , during the 11th refresh cycle (output data count = 10), because the data length exceeds 4 words, for example, 8 words, the master device 510 transmits a first output data frame to the slave device 530C. The function code of the first output data frame is 0E (HEX) and indicates "EDO and EDO count write." The master device then transmits a second output data frame to the slave devices in Group 1. The second output data frame has a destination indicator of 58, indicating Group 1, and a function code of 0A (HEX), indicating "Group 1 EDO." The master device then transmits a third output data frame containing output data for the slave devices in Group 2 to all slave devices. The third output data frame has a destination indicator of 63, indicating all slave devices (broadcast), and a function code of 0D (HEX), indicating "Group 2 EDO and All EDI Request." After all slave devices receive the input data frame request, each slave device begins sending input data frames to the master device in sequence. An input data frame includes a data field, which further includes a function code and an output data count. The output data count of an input data frame is equal to the current output data count of the slave device that sent the input data frame to the master device. The master device can check the output data count of the input data frame to determine whether the slave device correctly received its output data in the output data frame.
[0079] If the data length for a particular slave device exceeds the maximum data length, individual output data is sent to that slave device before the (broadcast) request response output data frame sent to each slave device connected to the master device. In this case, the data length for that particular slave device in the output data frame sent to the group to which it belongs is zero. For example, in the 11th cycle, because its data length is 8 words, which exceeds the maximum data length of 4 words, the first output data frame is sent individually to slave device 530C. The output data count of slave device 530C is updated to 10. Furthermore, in the third output data frame containing output data for the slave devices in Group 2, the data length for slave device 530C is zero.
[0080] After all slave devices receive the third outgoing data frame, a timeout period (N-1)T is set for each slave device. For example, the timeout periods for slave devices 520A-520E are 0, 1T, 2T, 3T, and 4T, respectively. Slave device 520A sends the first outgoing data frame back to master device 510. After monitoring the first incoming data frame sent by slave device 520A, slave device 520C resets its timeout period from 2T to 1T. If slave device 520B does not send an incoming data frame back to master device 510, 1T after the first slave device 520A sends its incoming data frame, the third slave device 520C sends its incoming data frame to master device 510.
[0081] In one embodiment shown in FIG7 , slave device 530P incorrectly receives its output data, which is two words long, and its output data count is not updated to 10. Therefore, the output data count in the input data frame sent by slave device 530P to the master device is not 10. The master device notices this error and sends only the fourth output data frame to slave device 530P. This fourth output data frame has a destination indicator of 41, representing slave device 530P, a function code of 0F (HEX), representing "EDO and EDO count write and EDI read," and an output data count of 10. After receiving the fourth output data frame, slave device 530P responds by sending an input data frame with an output data count of 10 back to the master device. The master device can then confirm that slave device 530P has correctly received its output data in the 11th refresh cycle.
[0082] In the third embodiment shown in FIG8 , a data communication system 800 includes a master device 810 and 33 slave devices 820A-820H, 830A-830H, 840A-840H, 850A-850H, and 860A. The first group of eight slave devices 820A-820H is designated as Group 1; the second group of eight slave devices 830A-830P is designated as Group 2; the third group of eight slave devices 840A-840H is designated as Group 3; and the fourth group of eight slave devices 850A-850H is designated as Group 4. Compared to the second embodiment, this embodiment performs better when most of the slave devices in the group typically receive data that is longer but still within the maximum data length. Therefore, each group can include only eight slave devices, rather than the 16 slave devices in the second embodiment. The master device 810 can be connected to the slave devices via a differential pair of signal lines, where VH represents a line biased to a higher voltage level and VL represents a line biased to a lower voltage level. The master device 110 can periodically send outbound data frames to the slave devices and request inbound data frames from the slave devices in response.
[0083] In one embodiment, both the outgoing data frame and the incoming data frame have an arbitration field and a data field. The arbitration field also includes a source indicator and a destination indicator. The following is an example of a destination indicator.
[0084] Table 4
[0085] In the embodiment shown in Figures 9A and 9B, the data field also includes a 1-byte function code, a 1-byte output data count, a 2-byte data length indicator, and up to 30 words (60 bytes) of output data. Table 5 below illustrates an example of a 1-byte function code. The 1-byte output data count indicates the sequence number of the refresh cycle performed by the master device, e.g., 0-255. The output data count increases by 1 upon completion of a refresh cycle. In this embodiment, the output data count of the output data frame may also be referred to as the EDO count. When the output data count reaches 255, it is reset to 0 for the next cycle. The 2-byte data length indicator uses 2 bits to indicate the data length for each of the 8 slave devices in the group. For example, 00 indicates no data; 01 indicates a data length of 1 word; 10 indicates a data length of 2 words; and 11 indicates a data length of 4 words. The maximum data length is 4 words. Therefore, the data length indicators of 11 10 00 10 11 11 11 11 indicate that the data lengths for slave devices 820A-820H are 4, 2, 0, 2, 4, 4, 4, and 4 words, respectively. In this example, the output data length received by slave device 820C in this cycle is zero and its output data count remains the same, e.g., 125. The output data counts of the other slave devices in group 1 that receive new output data are updated to 126.
[0086] Form 5
[0087] In one embodiment shown in FIG10 , during the 127th cycle (output data count = 126), because the data length of slave device 860A exceeds 4 words, for example, 8 words, the master device 810 transmits a first output data frame with a destination indicator of 42 to slave device 860A. The function code of the first output data frame is 12 (HEX), representing "EDO and EDO count write." Subsequently, because the data length of slave device 820B exceeds 4 words, for example, 6 words, the master device 810 transmits a second output data frame with a destination indicator of 11 to slave device 820B. The function code of the second output data frame is 12 (HEX), representing "EDO and EDO count write." The master device then transmits a third output data frame to the slave devices in Group 1. The third output data frame has a destination indicator of 58, indicating Group 1, and a function code of 0A, indicating "Group 1 EDO." The master device 810 continues to send the fourth output data frame to the slave devices in Group 2. This fourth output data frame has a destination indicator of 59, indicating Group 2, and a function code of 0C (HEX), indicating "Group 2 EDO." The master device 810 then sends the fifth output data frame to the slave devices in Group 3. The fifth output data frame has a destination indicator of 60, indicating Group 3, and a function code of 0E (HEX), indicating "Group 3 EDO." Finally, the master device 810 sends the sixth output data frame (broadcast) to all slave devices, with a destination indicator of 63 and a function code of 11 (HEX), indicating "Group 4 EDO and All EDI Request." After all slave devices receive the request for an input data frame, each slave device begins sending an input data frame to the master device in sequence. An input data frame includes a function code and an output data count. The output data count of the input data frame is the same as the current output data count of the slave device that sent the input data frame to the master device. The master device may check the output data count of the input data frame to determine whether the slave device correctly receives the output data belonging to the slave device in the output data frame during the refresh cycle.
[0088] As another example of an output data frame shown in FIG11A , after the function code and output data count in the data field, the data length indicator for each slave device in a group of eight slave devices, such as AH, is separate rather than continuous. The data length indicator for the first slave device A and the data length indicator for the second slave device B are separated by the output data of the first slave device A. In other words, the data length indicator for the first slave device is immediately followed by its output data, rather than the data length indicator for the second slave device. The same data field configuration applies to each slave device. Therefore, the data length indicator for each slave device is interleaved with the output data of each slave device. The data length indicator for each slave device can be the same or similar to the aforementioned embodiment, for example, 2, 3, or 4 bits long. Alternatively, the data length indicator for each slave device can have two parts. The first part is an identifier for the slave device. In one embodiment, the identifier (ID) can be the order of the slave devices in the group, such as 1-8, or a device ID. The second part indicates the actual data length of the slave device, similar to the original data length indicator for the slave device. If a two-part data length indicator is used, the data length indicator for a slave device receiving zero new output data can be omitted because the data length indicator for each slave device contains the identification of the slave device.
[0089] As shown in FIG11B , the data length indicator of slave device A includes the ID of slave device A and a data length of 11, indicating that the next four words are output data from slave device A. The data length indicator of slave device B includes the ID of slave device B and a data length of 10, indicating that the next two words are output data from slave device B. The data length indicator of slave device D includes the ID of slave device D and a data length of 10, indicating that the next two words are output data from slave device D. The data length indicator of slave device E includes the ID of slave device E and a data length of 11, indicating that the next four words are output data from slave device E. Because no output data is received in this output data frame, the data length indicator of slave device C is omitted here.
[0090] The description of the embodiments is provided to enable those skilled in the art to make and use the invention. Various modifications to the embodiments will be apparent to those skilled in the art, and the basic principles established herein can be applied to other embodiments without requiring any creative effort. The claimed subject matter is not limited to the embodiments shown herein, but is to be construed in the widest sense consistent with the principles and novel features disclosed herein. Other embodiments are contemplated within the spirit and scope of the invention. Therefore, the invention is intended to cover modifications and variations within the scope of the appended claims and their equivalents.
Claims
1. A system for data communication using a controller area network protocol, comprising: Master station device; as well as at least one slave device group, comprising a plurality of slave devices connected to the master device to receive at least one output data frame from the master device; The at least one output data frame includes a destination indicator and a data length indicator, wherein the destination indicator is used to indicate multiple slave station devices receiving the at least one output data frame, and the data length indicator is used to indicate the length of data received by each slave station device in the at least one slave station device group.
2. The system for data communication according to claim 1, wherein the at least one outgoing data frame comprises an arbitration field and a data field; the arbitration field comprises at least one of the destination indicator, the data length indicator, an outgoing data count, and a function code; the outgoing data count is used to indicate a sequence number of a refresh cycle executed by the master device; and the function code is used to indicate whether each slave device connected to the master device is required to send an incoming data frame to the master device.
3. The system for data communication of claim 1 , wherein the at least one outgoing data frame comprises an arbitration field and a data field; the arbitration field comprises the destination indicator; and the data field comprises at least one of the data length indicator, an outgoing data count, and a function code.
4. The system for data communication according to claim 1, wherein a length of data received by each slave device in the at least one slave device group is not greater than a maximum data length, the maximum data length being four, five, or six words.
5. The system for data communication according to claim 3, wherein the data field includes a function code for indicating whether each slave device connected to the master device is required to send an input data frame to the master device, or for indicating the configuration of output data from the master device to each slave device in the at least one slave device group.
6. The system for data communication according to claim 3, wherein the data field comprises an output data count for indicating a sequence number of output data received by the slave device. 7 . The system for data communication according to claim 6 , wherein the slave device in the at least one slave device group updates its output data count if the slave device receives new output data in the at least one output data frame. 8 . The system for data communication according to claim 3 , wherein the at least one slave device group comprises a plurality of slave device groups, and the destination indicator is used to indicate at least one of the plurality of slave device groups.
9. The system for data communication according to claim 1, wherein the master device requires each slave device connected to the master device to send an input data frame to the master device through a function code in the at least one output data frame.
10. The system for data communication according to claim 9, wherein the slave device transmits the input data frame to the master device, the input data frame including an output data count for indicating a sequence number of a refresh cycle executed by the master device.
11. The system for data communication according to claim 9, wherein after receiving the request for sending the input data frame to the master device in the at least one output data frame, each slave device sets a timeout period for sending its own input data frame to the master device.
12. The system for data communication according to claim 10, wherein the master device determines whether the slave device has received its output data based on the output data count in the input data frame received from the slave device.
13. The system for data communication according to claim 12, wherein if the master device determines that the slave device has not received its new output data because the output data count of the slave device is not equal to the output data count of the master device, the master device resends the output data frame to the slave device.
14. A method for data communication between a master device and at least one slave device group connected to the master device using a controller area network protocol, comprising: The master device sends an outgoing data frame to the at least one group of slave devices and requests each slave device connected to the master device to send an incoming data frame to the master device; as well as Each slave device sends the input data frame to the master device; The at least one outgoing data frame includes a data length indicator for indicating a length of data received by each slave device in the at least one slave device group.
15. The method for data communication according to claim 14, wherein the length of the data received by each slave device in the at least one group is not greater than a maximum data length, the maximum data length being four, five or six words.
16. The method for data communication according to claim 14, wherein the at least one outgoing data frame comprises an arbitration field and a data field; the arbitration field comprises a destination indicator, and the data field comprises at least one of the data length indicator, an outgoing data count, and a function code.
17. The method for data communication according to claim 16, wherein the data field includes a function code for indicating whether each slave device connected to the master device is required to send an input data frame to the master device, or for indicating the configuration of output data from the master device to each slave device in the at least one slave device group.
18. The method for data communication according to claim 16, wherein the data field comprises an output data count for indicating a sequence number of output data received from the slave device.
19. The method for data communication according to claim 18, wherein the slave devices in the at least one slave device group update their output data counts if the slave devices receive new output data in the at least one output data frame. 20 . The method for data communication according to claim 16 , wherein the at least one slave device group comprises a plurality of slave device groups, and the destination indicator is used to indicate at least one of the plurality of slave device groups.
21. The method for data communication according to claim 14, wherein the master device requires each slave device connected to the master device to send an input data frame to the master device through a function code in the at least one output data frame.
22. The method for data communication according to claim 21, wherein the input data frame comprises an output data count for indicating a sequence number of a refresh cycle executed by the master device.
23. The method for data communication according to claim 21, wherein after receiving the request for sending the input data frame in the at least one output data frame to the master device, each slave device sets a timeout period for sending its own input data frame to the master device.
24. The method for data communication according to claim 22, wherein the master device determines whether the slave device has received its output data based on the output data count in the input data frame received from the slave device.
25. The method for data communication according to claim 22, wherein if the master device determines that the slave device has not received its new output data because the output data count of the slave device is not equal to the output data count of the master device, the master device resends an output data frame to the slave device.
Citation Information
Patent Citations
Communication system and communication method based on CAN (Controller Area Network)
CN103188122A
Communication card based on CAN open communication protocol
CN109507931A
FPGA-based EtherCAT master-slave station design and implementation method
CN110177013A
Data interaction method and device, electronic equipment and storage medium
CN117424775A
Data transmission system
JP1996018579A