Bus communication method, communication basic cycle determining method and device

文档序号:1616976 发布日期:2020-01-10 浏览:25次 中文

阅读说明:本技术 一种总线通信方法、通信基本周期确定方法及装置 (Bus communication method, communication basic cycle determining method and device ) 是由 王鹏 于 2019-09-29 设计创作,主要内容包括:本发明提供一种总线通信方法、通信基本周期确定方法及装置,在获得第一通信节点通过Canfd总线发送的第一报文情况下,响应于第一报文指示的第一通信机制,从当前通信基本周期中确定第二通信节点对应的时间片,通过Canfd总线在所确定的时间片内发送第二通信节点对应的报文。其中当前通信基本周期中每个第二通信节点对应的时间片相互独立,由此每个第二通信节点可以在各自的时间片内通过Canfd总线传输各自的报文,实现在一个通信基本周期内传输所有第二通信节点对应的报文,降低报文延时,并且一个通信基本周期中每个第二通信节点对应的时间片相互独立,使得每个第二通信节点占用Canfd总线的时间不会存在冲突,防止通过Canfd总线传输报文导致的报文冲突。(The invention provides a bus communication method, a communication basic cycle determining method and a device, under the condition of obtaining a first message sent by a first communication node through a Canfd bus, responding to a first communication mechanism indicated by the first message, determining a time slice corresponding to a second communication node from the current communication basic cycle, and sending the message corresponding to the second communication node in the determined time slice through the Canfd bus. The time slices corresponding to each second communication node in the current communication basic period are mutually independent, so that each second communication node can transmit respective messages in the respective time slices through the Canfd bus, the messages corresponding to all the second communication nodes can be transmitted in one communication basic period, the message delay is reduced, and the time slices corresponding to each second communication node in one communication basic period are mutually independent, so that the time that each second communication node occupies the Canfd bus cannot conflict, and the message conflict caused by message transmission through the Canfd bus is prevented.)

1. A method of bus communication, the method comprising:

acquiring a first message sent by a first communication node through a Canfd bus, wherein the first message is used for indicating a second communication node to send the message by adopting a first communication mechanism;

responding to the first communication mechanism, determining a time slice corresponding to a second communication node from a current communication basic cycle, wherein the time length of the current communication basic cycle is determined by the first communication node according to message parameters of messages corresponding to a plurality of second communication nodes, and the time slices corresponding to each second communication node in one current communication basic cycle are mutually independent;

and sending a message corresponding to the second communication node in the determined time slice through the Canfd bus.

2. The method of claim 1, further comprising: if the second communication node receives a first response for indicating that the message is missing through the Canfd bus, obtaining first content in the message, which is sent by the second communication node and corresponds to the first response, wherein the first content is content which is not transmitted through the Canfd bus in the message corresponding to the first response;

the sending, by the canvas bus, the message corresponding to the second communication node in the determined time slice includes: and sending first content in the message corresponding to the first response in the determined time slice through the Canfd bus.

3. The method according to claim 1, wherein the length of the time slice corresponding to the second communication node is determined according to the number of bytes of data bits in the message corresponding to the second communication node, the time taken for transmitting one byte, and the transmission time of non-data bits in the message corresponding to the second communication node;

the time length of the current communication basic period is determined by the length of the time slice corresponding to each second communication node and the number of the second communication nodes.

4. The method of claim 1, further comprising: obtaining a second message sent by the first communication node through the Canfd bus, where the second message is used to instruct the second communication node to send a message by using a second communication mechanism, and the second communication mechanism is different from the first communication mechanism;

and responding to the second communication mechanism, obtaining the priority of the second communication node, and sending a message corresponding to the second communication node through the Canfd bus based on the priority of the second communication node.

5. A communication fundamental period determination method, characterized in that the method comprises:

obtaining message parameters of messages corresponding to a plurality of second communication nodes;

determining the length of the time slice corresponding to each second communication node based on the message parameters of the messages corresponding to the plurality of second communication nodes;

obtaining the communication basic cycle and the time length of the communication basic cycle based on the length of the time slice corresponding to each second communication node, wherein the communication basic cycle comprises the time slice corresponding to each second communication node, and the time length of the communication basic cycle is not less than the sum of the lengths of the time slices corresponding to each second communication node;

and informing each second communication node of the time slice corresponding to each second communication node in the communication basic cycle and the length of the time slice corresponding to each second communication node through a Canfd bus.

6. A bus communication apparatus, the apparatus comprising:

the first obtaining unit is used for obtaining a first message sent by a first communication node through a Canfd bus, wherein the first message is used for indicating a second communication node to send the message by adopting a first communication mechanism;

a determining unit, configured to determine, in response to the first communication mechanism, a time slice corresponding to a second communication node in a current communication basic cycle, where a time length of the current communication basic cycle is determined by the first communication node according to message parameters of messages corresponding to a plurality of the second communication nodes, and the time slices corresponding to each of the second communication nodes in one current communication basic cycle are independent of each other;

and the first sending unit is used for sending the message corresponding to the second communication node in the determined time slice through the Canfd bus.

7. The bus communication apparatus according to claim 6, wherein the apparatus further comprises:

a third obtaining unit, configured to obtain a second message sent by the first communication node through the cantd bus, where the second message is used to instruct the second communication node to send a message by using a second communication mechanism, and the second communication mechanism is different from the first communication mechanism;

a fourth obtaining unit, configured to obtain a priority of the second communication node in response to the second communication mechanism;

and the second sending unit is used for sending the message corresponding to the second communication node through the Canfd bus based on the priority of the second communication node.

8. An apparatus for determining a communication fundamental period, the apparatus comprising:

the first obtaining module is used for obtaining message parameters of messages corresponding to the plurality of second communication nodes;

a determining module, configured to determine, based on the message parameters of the messages corresponding to the plurality of second communication nodes, a length of a time slice corresponding to each second communication node;

a second obtaining module, configured to obtain the basic communication cycle and the time length of the basic communication cycle based on the length of the time slice corresponding to each second communication node, where the basic communication cycle includes the time slice corresponding to each second communication node, and the time length of the basic communication cycle is not less than the sum of the lengths of the time slices corresponding to each second communication node;

and the notifying module is used for notifying each second communication node of the time slice corresponding to each second communication node and the length of the time slice corresponding to each second communication node in the communication basic cycle through a Canfd bus.

9. A communication node comprising a processor and a memory;

the memory having stored therein computer program code;

the processor executes the computer program code to implement the bus communication method of any one of claims 1 to 4 and/or the communication fundamental period determination method of claim 5.

10. A storage medium, characterized in that the storage medium has stored therein a computer program code, which when executed implements the bus communication method of any one of claims 1 to 4 and/or the communication fundamental period determination method of claim 5.

Technical Field

The invention belongs to the technical field of bus control, and particularly relates to a bus communication method, a communication basic cycle determining method and a communication basic cycle determining device.

Background

The Canfd (CAN with Flexible Data rate) bus is evolved based on a CAN (Controller area network) bus, integrates the main characteristics of the CAN bus, and makes up for the constraints of the CAN bus in terms of bandwidth and Data field length, for example, the maximum length of the Data field of each frame of message in the Canfd bus is 64 bytes.

If a plurality of communication nodes communicate through the Canfd bus, if the plurality of communication nodes send messages at the same time, the messages are sequentially transmitted on the Canfd bus according to the priorities of the communication nodes, so that the conflict caused by the simultaneous sending of the messages by the plurality of communication nodes can be prevented through the priority setting of the communication nodes, but the mode can delay the transmission of the messages of some communication nodes, for example, the messages of the communication nodes with low priorities.

Disclosure of Invention

In view of the above, the present invention provides a bus communication method, a communication fundamental period determining method and a device, which are used to reduce the message delay transmitted through a cantd bus. The technical scheme is as follows:

the invention provides a bus communication method, which comprises the following steps:

acquiring a first message sent by a first communication node through a Canfd bus, wherein the first message is used for indicating a second communication node to send the message by adopting a first communication mechanism;

responding to the first communication mechanism, determining a time slice corresponding to a second communication node from a current communication basic cycle, wherein the time length of the current communication basic cycle is determined by the first communication node according to message parameters of messages corresponding to a plurality of second communication nodes, and the time slices corresponding to each second communication node in one current communication basic cycle are mutually independent;

and sending a message corresponding to the second communication node in the determined time slice through the Canfd bus.

Preferably, the method further comprises: if the second communication node receives a first response for indicating that the message is missing through the Canfd bus, obtaining first content in the message, which is sent by the second communication node and corresponds to the first response, wherein the first content is content which is not transmitted through the Canfd bus in the message corresponding to the first response;

the sending, by the canvas bus, the message corresponding to the second communication node in the determined time slice includes: and sending first content in the message corresponding to the first response in the determined time slice through the Canfd bus.

Preferably, the length of the time slice corresponding to the second communication node is determined according to the number of bytes of the data bit in the message corresponding to the second communication node, the time taken for transmitting one byte and the transmission time of the non-data bit in the message corresponding to the second communication node;

the time length of the current communication basic period is determined by the length of the time slice corresponding to each second communication node and the number of the second communication nodes.

Preferably, the method further comprises: obtaining a second message sent by the first communication node through the Canfd bus, where the second message is used to instruct the second communication node to send a message by using a second communication mechanism, and the second communication mechanism is different from the first communication mechanism;

and responding to the second communication mechanism, obtaining the priority of the second communication node, and sending a message corresponding to the second communication node through the Canfd bus based on the priority of the second communication node.

The invention also provides a method for determining the basic communication period, which comprises the following steps:

obtaining message parameters of messages corresponding to a plurality of second communication nodes;

determining the length of the time slice corresponding to each second communication node based on the message parameters of the messages corresponding to the plurality of second communication nodes;

obtaining the communication basic cycle and the time length of the communication basic cycle based on the length of the time slice corresponding to each second communication node, wherein the communication basic cycle comprises the time slice corresponding to each second communication node, and the time length of the communication basic cycle is not less than the sum of the lengths of the time slices corresponding to each second communication node;

and informing each second communication node of the time slice corresponding to each second communication node in the communication basic cycle and the length of the time slice corresponding to each second communication node through a Canfd bus.

The present invention also provides a bus communication apparatus, comprising: the device comprises a first obtaining unit, a determining unit and a first sending unit;

the first obtaining unit is used for obtaining a first message sent by a first communication node through a Canfd bus, wherein the first message is used for indicating a second communication node to send the message by adopting a first communication mechanism;

a determining unit, configured to determine, in response to the first communication mechanism, a time slice corresponding to a second communication node in a current communication basic cycle, where a time length of the current communication basic cycle is determined by the first communication node according to message parameters of messages corresponding to a plurality of the second communication nodes, and the time slices corresponding to each of the second communication nodes in one current communication basic cycle are independent of each other;

and the first sending unit is used for sending the message corresponding to the second communication node in the determined time slice through the Canfd bus.

Preferably, the apparatus further comprises: a second obtaining unit, configured to, if a first response indicating that a packet is missing is received through the Canfd bus, obtain first content in the packet corresponding to the first response sent by the first sending unit, where the first content is content that is not transmitted through the Canfd bus in the packet corresponding to the first response;

the first sending unit is specifically configured to send, within the determined time slice, the first content in the message corresponding to the first response through the Canfd bus.

Preferably, the length of the time slice corresponding to the second communication node is determined according to the number of bytes of the data bit in the message corresponding to the second communication node, the time taken for transmitting one byte and the transmission time of the non-data bit in the message corresponding to the second communication node;

the time length of the current communication basic period is determined by the length of the time slice corresponding to each second communication node and the number of the second communication nodes.

Preferably, the apparatus further comprises: the device comprises a third obtaining unit, a fourth obtaining unit and a second sending unit.

A third obtaining unit, configured to obtain a second message sent by the first communication node through the cantd bus, where the second message is used to instruct the second communication node to send a message by using a second communication mechanism, and the second communication mechanism is different from the first communication mechanism;

a fourth obtaining unit, configured to obtain a priority of the second communication node in response to the second communication mechanism;

and the second sending unit is used for sending the message corresponding to the second communication node through the Canfd bus based on the priority of the second communication node.

The present invention further provides a communication fundamental period determining apparatus, including: the device comprises a first obtaining module, a determining module, a second obtaining module and a notifying module.

The first obtaining module is used for obtaining message parameters of messages corresponding to the plurality of second communication nodes;

a determining module, configured to determine, based on the message parameters of the messages corresponding to the plurality of second communication nodes, a length of a time slice corresponding to each second communication node;

a second obtaining module, configured to obtain the basic communication cycle and the time length of the basic communication cycle based on the length of the time slice corresponding to each second communication node, where the basic communication cycle includes the time slice corresponding to each second communication node, and the time length of the basic communication cycle is not less than the sum of the lengths of the time slices corresponding to each second communication node;

and the notifying module is used for notifying each second communication node of the time slice corresponding to each second communication node and the length of the time slice corresponding to each second communication node in the communication basic cycle through a Canfd bus.

The invention further provides a communication node, comprising a processor and a memory; the memory having stored therein computer program code; the processor executes the computer program code to implement the bus communication method and/or the communication fundamental period determination method as described above.

The present invention further provides a storage medium having stored therein a computer program code which, when executed, implements a bus communication method and/or a communication fundamental period determination method as described above.

According to the technical scheme, under the condition that the first message sent by the first communication node through the Canfd bus is obtained, the time slice corresponding to the second communication node is determined from the current communication basic cycle in response to the first communication mechanism indicated by the first message, and the message corresponding to the second communication node is sent in the determined time slice through the Canfd bus. The time slices corresponding to each second communication node in the current communication basic cycle are mutually independent, so that each second communication node can transmit respective messages in the respective time slices through the Canfd bus in one communication basic cycle, the messages corresponding to all the second communication nodes can be transmitted in one communication basic cycle, the message delay is reduced, and the time slices corresponding to each second communication node in one communication basic cycle are mutually independent, so that the time that each second communication node occupies the Canfd bus in one communication basic cycle does not conflict, and the message conflict caused by message transmission through the Canfd bus is prevented.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.

Fig. 1 is a schematic diagram of a communication system on which a bus communication method provided by an embodiment of the present invention is based;

fig. 2 is a schematic diagram of a basic communication cycle provided by an embodiment of the present invention;

FIG. 3 is a flow chart of a bus communication method according to an embodiment of the present invention;

FIG. 4 is a flow chart of another bus communication method provided by the embodiment of the invention;

fig. 5 is a flowchart of a communication basic cycle determining method according to an embodiment of the present invention;

fig. 6 is a schematic structural diagram of a bus communication apparatus according to an embodiment of the present invention;

FIG. 7 is a schematic structural diagram of another bus communication apparatus according to an embodiment of the present invention;

FIG. 8 is a schematic structural diagram of another bus communication device according to an embodiment of the present invention;

FIG. 9 is a schematic structural diagram of another bus communication apparatus according to an embodiment of the present invention;

fig. 10 is a schematic structural diagram of a communication fundamental period determining apparatus according to an embodiment of the present invention;

fig. 11 is a schematic structural diagram of a communication node according to an embodiment of the present invention.

Detailed Description

When a plurality of existing communication nodes send messages through the Canfd bus, the messages need to be sent based on the priority of each communication node, specifically, the messages are sent sequentially through the Canfd bus from high to low based on the priority of each communication node, but the messages with low priority are delayed in this way. For this reason, in this embodiment, a communication system with a plurality of existing communication nodes is modified, as shown in fig. 1, the communication system includes a plurality of communication nodes, the plurality of communication nodes send a message through a Canfd bus, one of the plurality of communication nodes is a first communication node, and the remaining communication nodes are second communication nodes.

The first communication node is used for calculating the length of the time slice corresponding to each second communication node, obtaining the time length of a basic communication cycle based on the length of the time slice corresponding to each second communication node, and distributing the time slices corresponding to each second communication node in the basic communication cycle, wherein the structure of the basic communication cycle is shown in fig. 2; the first communication node is further configured to send the time slice corresponding to each second communication node and the length of the time slice corresponding to each second communication node to the corresponding second communication node through the Canfd bus, and the second communication node sends the message in each time slice through the Canfd bus.

The points to be explained here are: the first communication node may have a function of the second communication node in addition to the function of calculating the basic communication cycle, that is, the first communication node is a special second communication node, and the special meaning is that the function of calculating the basic communication cycle is provided, so that the basic communication cycle in this embodiment may further include a time slice corresponding to the first communication node and a length of the time slice corresponding to the first communication node, so that the first communication node may also send a packet in the time slice corresponding to itself.

In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

Referring to fig. 3, a bus communication method according to an embodiment of the present invention is shown, where the bus communication method uses the second communication node as an execution main body, and includes the following steps:

301: and acquiring a first message sent by the first communication node through the Canfd bus, wherein the first message is used for indicating the second communication node to send the message by adopting a first communication mechanism. For example, the first packet carries identification information of the first communication mechanism, so that the second communication node can determine that the packet needs to be sent by using the first communication mechanism after receiving the first packet, where the identification information of the first communication mechanism may be represented by, but is not limited to, a digital manner, and for example, the identification information of the first communication mechanism may be 0.

In this embodiment, a feasible manner of the first packet is a time synchronization packet, where the time synchronization packet is used to synchronize the times of a plurality of second communication nodes, and the time synchronization packet may also represent the start of a basic communication cycle, so that the time synchronization packet may be used as a feasible manner of the first packet, and thus, the time synchronization packet may synchronize the times and may trigger the second communication nodes to adopt the first communication mechanism.

The time slice allocation information of any second communication node comprises a time slice corresponding to the second communication node and an identifier of the second communication node, and therefore after the second communication node receives the time synchronization message broadcast by the first communication node, the corresponding time slice is obtained from the time synchronization message based on the identifier (such as the name of the node).

302: responding to a first communication mechanism, determining time slices corresponding to second communication nodes in a current communication basic cycle, wherein the time length of the current communication basic cycle is determined by the first communication nodes according to message parameters of messages corresponding to the second communication nodes, and the time slices corresponding to each second communication node in one current communication basic cycle are independent from each other, so that the time slices corresponding to each second communication node are not overlapped.

The time slice corresponding to the second communication node indicates the starting time and the ending time of the message sent by the second communication node, the difference between the starting time and the ending time is the length of the time slice corresponding to the second communication node, and the starting time and the ending time of two adjacent time slices in one communication basic cycle are not overlapped, so that the time slices corresponding to each second communication node in one communication basic cycle are ensured to be independent.

In this embodiment, the message parameters of the message corresponding to the second communication node include, but are not limited to: the number of bytes of data bits in the message corresponding to the second communication node, the time taken for transmitting one byte, and the transmission time of a non-data bit in the message corresponding to the second communication node, so that the length of a time slice corresponding to one second communication node is determined according to the parameters, for example, the length of a time slice corresponding to each second communication node is obtained by the following method:

t1 n + dT (n/64), wherein: t1 is the time for transmitting a byte, n is the number of bytes of data bits in the message corresponding to the second communication node, dT is the transmission time of non-data bits in the message corresponding to the second communication node, and n/64 represents the carry integer. The length of a data field of a message is regulated to be 64 bytes at most in the Canfd bus, so that the value of n can be less than or equal to 64 when the length of the time slice corresponding to the second communication node is calculated, and the value of n/64 is 1. In practical applications, the value of n may be determined according to a message to be transmitted in an application scenario used by the bus communication method.

After the length of the time slice corresponding to each second communication node is obtained, the number of the second communication nodes is known, so that the time length of a basic communication cycle can be determined according to the length of the time slice corresponding to each second communication node and the number of the second communication nodes, for example, the time length of the basic communication cycle is T × M, and M is the number of the second communication nodes, and in the process of determining the basic communication cycle, the distribution of the time slices corresponding to each second communication node is configured in the basic communication cycle.

The distribution of the time slices corresponding to the second communication nodes may be set based on the priority of the second communication nodes, for example, the time slice corresponding to the second communication node with the highest priority is the first of the basic communication period. In addition, the starting time and the ending time of each time slice can be set through the first communication node, so that the distribution of the time slices corresponding to the second communication nodes can be set based on the starting time and the ending time of each time slice.

The points to be explained here are: if the start of a communication basic cycle is triggered by the time synchronization message, after the time synchronization message triggers the start of the communication basic cycle, the start time of a first time slice in the communication basic cycle may be the start time of the communication basic cycle, and the end time of the first time slice is delayed from the start time of the first time slice by the length of the time slice; the start time of the second time slice may be delayed from the end time of the first time slice by a preset time (set according to the requirement), the end time of the second time slice is delayed from the start time of the second time slice by the length of the time slice, and so on, the start time and the end time of each time slice are obtained.

303: and sending a message corresponding to the second communication node in the determined time slice through the Canfd bus. When a basic communication period is finished, the second communication node needs to stop sending the message no matter whether the message sent by the second communication node is sent successfully or not, and in a time slice corresponding to the second communication node, the second communication node sends the message through a Canfd bus, and other second communication nodes can receive the message in the time slice.

After any communication node receives a message, the communication node needs to determine whether the received message is complete, if the received message is complete, the communication node executes an instruction carried in the received message, and if the received message is missing, the communication node executes a preset instruction, for example, does not execute any action, and the embodiment is not limited to what operation the preset instruction triggers the communication node to execute.

One point to be pointed out here is: at the end of a basic communication period, all the second communication nodes stop sending messages, but the first communication node can still send messages, because the first communication node needs to trigger the start of the basic communication period.

According to the technical scheme, under the condition that the first message sent by the first communication node through the Canfd bus is obtained, the time slice corresponding to the second communication node is determined from the current communication basic cycle in response to the first communication mechanism indicated by the first message, and the message corresponding to the second communication node is sent in the determined time slice through the Canfd bus. The time slices corresponding to each second communication node in the current communication basic cycle are mutually independent, so that each second communication node can transmit respective messages in the respective time slices through the Canfd bus in one communication basic cycle, the messages corresponding to all the second communication nodes can be transmitted in one communication basic cycle, the message delay is reduced, and the time slices corresponding to each second communication node in one communication basic cycle are mutually independent, so that the time that each second communication node occupies the Canfd bus in one communication basic cycle does not conflict, and the message conflict caused by message transmission through the Canfd bus is prevented.

In the above, it is indicated that there is a message missing situation in the transmission through the cantd bus, and the second communication node that sends the message obtains the first response for indicating the message missing, and the bus communication method provided in this embodiment may further include the following steps:

and if the second communication node obtains a first response used for indicating the message missing, obtaining first content in the message which is sent by the second communication node and corresponds to the first response, wherein the first content is content which is not transmitted through a Canfd bus in the message corresponding to the first response, and sending the first content in the message corresponding to the first response in a time slice determined by the current communication basic cycle through the Canfd bus.

The content which is not transmitted through the Canfd bus refers to the content which is not transmitted through the Canfd bus in the last communication basic cycle adjacent to the current communication basic cycle, so that different contents in the same message can be transmitted through at least two adjacent communication basic cycles, and the probability of repeated transmission of the contents is reduced under the condition of ensuring the completeness of the message.

If different contents in the same message are transmitted through at least two adjacent communication basic periods, message identification information needs to be added into the contents transmitted through at least two adjacent communication basic periods, so that the message to which the contents belong is represented by the message identification information, and thus the different contents transmitted through at least two adjacent communication basic periods can be combined to obtain the complete content of one message.

Or in the case that there is a message missing in the transmission through the cantd bus, the bus communication method provided in this embodiment may further include the following steps:

if the second communication node obtains the first response for indicating that the message is missing, sending a time slice adjustment instruction to the first communication node, where the time slice adjustment instruction is used to indicate the first communication node to adjust the time slice length, and particularly, to adjust the time slice length corresponding to the second communication node that receives the first response, for example, to increase the time slice length corresponding to the second communication node that receives the first response, as to how much the time slice length is increased, for example, to allocate the time slice for transmitting the first content again on the basis of the time slice corresponding to the second communication node, where the first content is the content that is not transmitted through the Canfd bus in the message corresponding to the first response, that is, the missing content.

Of course, in addition to notifying the first communication node to adjust the time slice length when the second communication node obtains the first response, the second communication node can also send a time slice adjustment instruction to the first communication node when a second response for indicating that the packet is complete is obtained, and in particular, send a time slice adjustment instruction to the first communication node when the second communication node obtains the second response and the time slice corresponding to the second communication node is left (which indicates that the time slice corresponding to the second communication node is not occupied).

In this embodiment, if the second communication node obtains the first response, the time slice adjustment instruction may be immediately sent to the first communication node to prevent the subsequent message from being missing, and if the second communication node obtains the second response, the time slice adjustment instruction may be sent to the first communication node while waiting for a period of time (in other words, obtaining the second response multiple times) to prevent the time slice from being adjusted repeatedly. For the second communication node, the second communication node can perform self-check in the corresponding time slice, if the message success information is self-checked, the second response is obtained, and if the message success information is not self-checked, the first response is obtained.

Referring to fig. 4, another bus communication method according to an embodiment of the present invention is shown, and based on the foregoing fig. 3, the method further includes the following steps:

304: a second message sent by the first communication node through the Canfd bus is obtained, where the second message is used to indicate that the second communication node sends the message by using a second communication mechanism, and the second communication mechanism is different from the first communication mechanism, for example, the second message carries identification information of the second communication mechanism, so that the second communication node can determine that the message needs to be sent by using the second communication mechanism after receiving the second message, and the identification information of the second communication mechanism can be represented by, but is not limited to, a digital manner, for example, the identification information of the second communication mechanism can be 1, and the feasible manner of the second message is not limited in this embodiment.

305: and responding to the second communication mechanism, obtaining the priority of the second communication node, and sending a message corresponding to the second communication node through the Canfd bus based on the priority of the second communication node. The process of sending the message through the Canfd bus based on the priority of the second communication node may refer to the existing Canfd bus standard, and details of this embodiment are not described in detail.

According to the technical scheme, if the second communication node obtains the first message indicating that the first communication mechanism is adopted, the second communication node can determine the time slice corresponding to the second communication node from the communication basic cycle, and sends the message in the determined time slice through the Canfd bus, and if the second communication node obtains the second message indicating that the second communication mechanism is adopted, the second communication node sends the message through the Canfd bus based on the priority of the second communication node, so that the second communication node can send the message through two communication mechanisms, and the Canfd bus can also have two communication mechanisms, and thus different communication requirements can be met.

Referring to fig. 5, it shows a communication basic cycle determining method according to an embodiment of the present invention, where the communication basic cycle determining method is executed by the first communication node, and includes the following steps:

501: and obtaining message parameters of the messages corresponding to the plurality of second communication nodes.

502: and determining the length of the time slice corresponding to each second communication node based on the message parameters of the messages corresponding to the plurality of second communication nodes.

503: and obtaining a communication basic cycle and the time length of the communication basic cycle based on the length of the time slice corresponding to each second communication node, wherein the communication basic cycle comprises the time slice corresponding to each second communication node, and the time length of the communication basic cycle is not less than the sum of the lengths of the time slices corresponding to each second communication node.

In this embodiment, please refer to the relevant description in the above method embodiment for the description that the first communication node determines the length of the time slice corresponding to each second communication node, obtains the basic communication period, and obtains the time length of the basic communication period, which is not described again in this embodiment.

504: and informing each second communication node of the time slice corresponding to each second communication node in the basic communication period and the length of the time slice corresponding to each second communication node through the Canfd bus, so that each second communication node can send messages in the corresponding time slice, message collision is prevented, and each second communication node can send messages in one basic communication period, thereby reducing message delay.

While, for purposes of simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present invention is not limited by the illustrated ordering of acts, as some steps may occur in other orders or concurrently with other steps in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.

Referring to fig. 6, it shows a bus communication apparatus according to an embodiment of the present invention, including: a first obtaining unit 601, a determining unit 602, and a first sending unit 603.

A first obtaining unit 601, configured to obtain a first message sent by a first communication node through a Canfd bus, where the first message is used to instruct a second communication node to send a message by using a first communication mechanism. For example, the first packet carries identification information of the first communication mechanism, so that the first obtaining unit 601 of the bus communication device located in the second communication node, after receiving the first packet, may determine that the packet needs to be sent by using the first communication mechanism currently, where the identification information of the first communication mechanism may be represented in a digital manner, for example, the identification information of the first communication mechanism may be 0.

In this embodiment, please refer to the related description in the above method embodiment for the description of the first message, which is not further described in this embodiment.

A determining unit 602, configured to determine, in response to the first communication mechanism, a time slice corresponding to the second communication node in a current communication basic cycle, where a time length of the current communication basic cycle is determined by the first communication node according to message parameters of messages corresponding to the plurality of second communication nodes, and the time slices corresponding to each second communication node in one current communication basic cycle are independent of each other, so that the time slices corresponding to each second communication node are not overlapped.

The time slice corresponding to the second communication node indicates the starting time and the ending time of the message sent by the second communication node, the difference between the starting time and the ending time is the length of the time slice corresponding to the second communication node, and the starting time and the ending time of two adjacent time slices in one communication basic cycle are not overlapped, so that the time slices corresponding to each second communication node in one communication basic cycle are ensured to be independent. The length of the time slice corresponding to the second communication node is determined according to the byte number of the data bit in the message corresponding to the second communication node, the transmission time of one byte and the transmission time of the non-data bit in the message corresponding to the second communication node; the time length of the current communication basic period is determined by the length of the time slice corresponding to each second communication node and the number of the second communication nodes.

In this embodiment, please refer to the relevant description in the above method embodiment for the description that the first communication node determines the length of the time slice corresponding to each second communication node, obtains the basic communication period, and obtains the time length of the basic communication period, which is not described again in this embodiment.

A first sending unit 603, configured to send, in the determined time slice, a message corresponding to the second communication node through the cantd bus. When a basic communication cycle is finished, the first sending unit 603 needs to stop sending the message no matter whether the message sent by the first sending unit 603 is successfully sent or not, and in a time slice corresponding to a second communication node, the second communication node sends the message through the Canfd bus by means of the first sending unit 603 in the bus communication device in the second communication node, and other second communication nodes can receive the message in the time slice.

After any communication node receives a message, the communication node needs to determine whether the received message is complete, if the received message is complete, the communication node executes an instruction carried in the received message, and if the received message is missing, the communication node executes a preset instruction, for example, does not execute any action, and the embodiment is not limited to what operation the preset instruction triggers the communication node to execute.

According to the technical scheme, under the condition that the first message sent by the first communication node through the Canfd bus is obtained, the time slice corresponding to the second communication node is determined from the current communication basic cycle in response to the first communication mechanism indicated by the first message, and the message corresponding to the second communication node is sent in the determined time slice through the Canfd bus. The time slices corresponding to each second communication node in the current communication basic cycle are mutually independent, so that each second communication node can transmit respective messages in the respective time slices through the Canfd bus by means of the first sending unit 603 in the bus communication device in the second communication node in one communication basic cycle, the messages corresponding to all the second communication nodes are transmitted in one communication basic cycle, the message delay is reduced, the time slices corresponding to each second communication node in one communication basic cycle are mutually independent, the time that each second communication node occupies the Canfd bus in one communication basic cycle cannot conflict, and the message conflict caused by message transmission through the Canfd bus is prevented.

In the above, it is indicated that there is a message missing in the transmission through the cand bus, and the bus communication device in the second communication node that sends the message may also obtain the first response for indicating the message missing, and referring to fig. 7, the embodiment of the present invention further includes a second obtaining unit 604 on the basis of the device shown in fig. 6.

The second obtaining unit 604 is configured to, if a first response indicating that the message is missing is received through the Canfd bus, obtain first content in the message, which is sent by the first sending unit 603 and corresponds to the first response, where the first content is content that is not transmitted through the Canfd bus in the message corresponding to the first response, so that the first sending unit 603 sends the first content in the message corresponding to the first response through the Canfd bus within a time slice determined by the current communication basic cycle.

The content which is not transmitted through the Canfd bus refers to the content which is not transmitted through the Canfd bus in the last communication basic cycle adjacent to the current communication basic cycle, so that different contents in the same message can be transmitted through at least two adjacent communication basic cycles, and the probability of repeated transmission of the contents is reduced under the condition of ensuring the completeness of the message.

If different contents in the same message are transmitted through at least two adjacent communication basic periods, message identification information needs to be added into the contents transmitted through at least two adjacent communication basic periods, so that the message to which the contents belong is represented by the message identification information, and thus the different contents transmitted through at least two adjacent communication basic periods can be combined to obtain the complete content of one message.

Or in the case that there is a message missing in the transmission through the Canfd bus, the embodiment of the present invention solves this problem through another bus communication device, as shown in fig. 8, and further includes a sending instruction unit 605 on the basis of the device shown in fig. 7.

A sending instruction unit 605, configured to send, to the first communication node, a time slice adjustment instruction if a first response indicating that the packet is missing is received, where the time slice adjustment instruction is used to instruct the first communication node to adjust a time slice length, and particularly to adjust a time slice length corresponding to a second communication node that receives the first response, for example, to increase the time slice length corresponding to the second communication node that receives the first response, how much the time slice length is increased is not limited in this embodiment, for example, to allocate a time slice for transmitting first content again on the basis of the time slice corresponding to the second communication node, where the first content is content that is not transmitted through the cand bus in the packet corresponding to the first response, that is, missing content.

In this embodiment, please refer to the related description in the above method embodiment for the description of the working process of the command sending unit, which is not further described in this embodiment.

Referring to fig. 9, another bus communication apparatus according to an embodiment of the present invention is shown, and further includes, on the basis of the apparatus shown in fig. 6: a third obtaining unit 606, a fourth obtaining unit 607 and a second sending unit 608.

A third obtaining unit 606, configured to obtain a second message sent by the first communication node through the cantd bus, where the second message is used to indicate that the second communication node sends the message by using a second communication mechanism, and the second communication mechanism is different from the first communication mechanism, for example, the second message carries identification information of the second communication mechanism, so that the second communication node may determine that the second communication mechanism needs to be used to send the message after receiving the second message, and the identification information of the second communication mechanism may be represented in a digital manner, for example, the identification information of the second communication mechanism may be 1, and the feasible manner of the second message is not limited in this embodiment.

A fourth obtaining unit 607, configured to obtain the priority of the second communication node in response to the second communication mechanism;

a second sending unit 608, configured to send, based on the priority of the second communication node, the message corresponding to the second communication node through the candd bus. The process of sending the message through the Canfd bus based on the priority of the second communication node may refer to the existing Canfd bus standard, and details of this embodiment are not described in detail.

As can be seen from the foregoing technical solution, if the first obtaining unit 601 obtains a first message indicating that a first communication mechanism is adopted, the determining unit 602 can determine a time slice corresponding to itself from a communication basic cycle, the first sending unit 603 sends the message within the determined time slice through a Canfd bus, and if the third obtaining unit 606 obtains a second message indicating that a second communication mechanism is adopted, the second sending unit 608 sends the message through the Canfd bus based on its priority, so that a second communication node can send the message through the bus communication device by adopting two communication mechanisms, and the Canfd bus can also have two communication mechanisms, which can meet different communication requirements.

Referring to fig. 10, it shows a communication basic cycle determining apparatus according to an embodiment of the present invention, including: a first obtaining module 1001, a determining module 1002, a second obtaining module 1003 and a notifying module 1004.

A first obtaining module 1001, configured to obtain message parameters of messages corresponding to multiple second communication nodes.

The determining module 1002 is configured to determine, based on the message parameter of the message corresponding to the plurality of second communication nodes, a length of the time slice corresponding to each second communication node.

A second obtaining module 1003, configured to obtain a basic communication cycle and a time length of the basic communication cycle based on a length of the time slice corresponding to each second communication node, where the basic communication cycle includes the time slice corresponding to each second communication node, and the time length of the basic communication cycle is not less than a sum of the lengths of the time slices corresponding to each second communication node.

In this embodiment, the communication basic period determining device determines the length of the time slice corresponding to each second communication node, and please refer to the relevant description in the above method embodiment for the description of obtaining the communication basic period and the time length of the communication basic period, which is not further described in this embodiment.

A notifying module 1004, configured to notify each second communication node of the time slice corresponding to each second communication node and the length of the time slice corresponding to each second communication node in the basic communication cycle through the Canfd bus. Therefore, each second communication node can send the message in the corresponding time slice, message collision is prevented, and each second communication node can send the message in a basic communication period, so that message delay is reduced.

Referring to fig. 11, a communication node according to an embodiment of the present invention is shown, which includes a processor 1101 and a memory 1102. The memory 1102 has stored therein computer program code; the processor 1101 executes the computer program code to implement the bus communication method as described above.

An embodiment of the present invention further provides a storage medium, in which computer program codes are stored, and when the computer program codes are executed, the bus communication method as described above is implemented.

It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.

Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

20页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种交换设备端口数据的快速转发方法和装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!