Disclosure of Invention
The present disclosure is directed to a network transmission method, a CAN bus network, a storage medium and an electronic device, so as to solve the problems of the related art.
In order to achieve the above object, a first aspect of the embodiments of the present disclosure provides a network transmission method, where the method is applied to a CAN bus network, where the method extends and defines a flow control frame, a first frame, and a continuous frame in the CAN bus network, where the extended flow control frame, the extended first frame, and the extended continuous frame all include a logical link field, and the method includes:
a first end sends an expanded first frame to a second end, wherein the expanded first frame comprises a first logic link identifier, and the first end and the second end comprise any two nodes in a CAN bus network;
and when receiving the expanded flow control frame sent by the second end, if the expanded flow control frame comprises the first logical link identifier, transmitting the continuous frame subsequent to the first frame to the second end according to the transmission control parameters in the expanded flow control frame.
Optionally, the expanded flow control frame includes a flow control frame added with a logical link identification field on the basis of a flow control frame defined by an ISO15765-2:2016(E) protocol;
the expanded first frame comprises a first frame which is added with a logical link identification field on the basis of the first frame defined by an ISO15765-2:2016(E) protocol;
the extended continuous frames comprise continuous frames with a logical link identification field added on the basis of continuous frames defined by the ISO15765-2:2016(E) protocol.
Optionally, the expanded flow control frame includes a flow control frame using a fourth byte of the flow control frame defined by the ISO15765-2:2016(E) protocol as a logical link identification field;
optionally, when a value of the logical link identifier field of the expanded flow control frame is a predetermined value, the expanded flow control frame is used for a flow control frame defined by a backward compatible ISO15765-2:2016(E) protocol. The predetermined value may be, for example, a value of 0.
A second aspect of the embodiments of the present disclosure provides a network transmission method, where the method is applied to a CAN bus network, where the method defines a flow control frame, a first frame, and a continuous frame in the CAN bus network in an extended manner, where the extended flow control frame, the extended first frame, and the extended continuous frame all include a logical link field, and the method includes:
the second end receives an expanded first frame sent by the first end, wherein the expanded first frame comprises a first logic link identifier;
and if the first end does not have a multi-frame sequence with a second logical link identifier and is not completely transmitted, sending the expanded flow control frame carrying the first logical link identifier to the first end so as to control the first end to transmit the continuous frames with the first logical link identifier.
Optionally, the method further comprises:
if the transmission of the multi-frame sequence with the second logical link identification is not completed at the first end, sending an expanded first flow control frame carrying the second logical link identification to the first end, wherein the first flow control frame further comprises first indication information used for indicating the second end to suspend sending continuous frames with the second logical link identification; and the number of the first and second electrodes,
and after the transmission of the multi-frame sequence with the first logical link identifier is finished, sending an expanded second flow control frame carrying the second logical link identifier to the first end, wherein the second flow control frame further comprises second indication information used for indicating the second end to continuously send continuous frames with the second logical link identifier.
Optionally, the expanded flow control frame includes a flow control frame added with a logical link identification field on the basis of a flow control frame defined by an ISO15765-2:2016(E) protocol;
the expanded first frame comprises a first frame which is added with a logical link identification field on the basis of the first frame defined by an ISO15765-2:2016(E) protocol;
the extended continuous frames comprise continuous frames with a logical link identification field added on the basis of continuous frames defined by the ISO15765-2:2016(E) protocol.
Optionally, the extended flow control frame includes a flow control frame using a fourth byte of the flow control frame defined by the ISO15765-2:2016(E) protocol as a logical link identification field.
Optionally, when a value of the logical link identifier field of the expanded flow control frame is a predetermined value, the expanded flow control frame is used for a flow control frame defined by a backward compatible ISO15765-2:2016(E) protocol.
A third aspect of the embodiments of the present disclosure provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method of the first aspect.
A fourth aspect of the embodiments of the present disclosure provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method of the second aspect.
A fifth aspect of an embodiment of the present disclosure provides an electronic device, including:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of the first aspect.
A sixth aspect of an embodiment of the present disclosure provides an electronic device, including:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of the second aspect.
A seventh aspect of the embodiments of the present disclosure provides a CAN bus network, including a CAN bus and a plurality of node devices connected to the CAN bus;
each node device, when transmitting data, performs the method of any one of the first aspect as a first end;
each of the node devices performs the method of any of the second aspects as a second end when receiving data.
By adopting the technical scheme, the method at least has the following technical effects:
the method comprises the steps of adding a logic link field into a first frame, a flow control frame and a continuous frame in a CAN bus network by extending and defining the first frame, the flow control frame and the continuous frame. Thus, when any two nodes in the CAN bus network communicate, the sending end CAN set the logical link field in the first frame sent to the receiving end, so as to inform the receiving end of the data needed to be sent and the logical link to which the data belongs. Similarly, the receiving end can also indicate the frame to be sent by the sending end by setting a corresponding logical link field in the flow control frame, so that the effect of selecting the logical link to be sent in the communication process is realized, the flexibility of data transmission is further improved, and the data transmission of a plurality of logical links is also supported.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Detailed Description
The following detailed description of specific embodiments of the present disclosure is provided in connection with the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present disclosure, are given by way of illustration and explanation only, not limitation.
The embodiment of the disclosure provides a network transmission method, which is applied to a CAN bus network, wherein the method defines a flow control frame, a first frame and a continuous frame in the CAN bus network in an expanded manner. And, the expanded flow control frame, the expanded first frame, and the expanded continuous frame all include a logical link field, as shown in fig. 1, the method includes:
and S11, the first end sends the expanded first frame to the second end, the expanded first frame comprises a first logic link identification, and the first end and the second end comprise any two nodes in the CAN bus network.
It should be understood that in the CAN bus network, different nodes CAN transmit data to each other to realize corresponding functions. This data transfer process thus forms the corresponding data link. In a specific implementation, the physical Link of the CAN bus network may be virtually divided into one or more Logical links according to such a data transmission manner, and the Logical links may be distinguished by corresponding Logical Link Identifiers (LLIDs).
For example, in one possible implementation, the first frame may be defined by extension, and the second byte of the first frame is used as a logical link identifier. In this way, when the first peer and the second peer communicate, the first peer may inform the second peer of the data to be sent and the logical link to which the data belongs by setting the logical link identifier in the first frame.
The foregoing is only an example of a possible application scenario of the embodiment of the disclosure, and in another possible implementation manner, the logical link identifier may also be defined in an extended manner in other manners, for example, the logical link identifier may be set in other bytes in the first frame, which is not limited in this disclosure.
And S12, when receiving the expanded flow control frame sent by the second end, if the expanded flow control frame includes the first logical link identifier, transmitting the successive frames subsequent to the first frame to the second end according to the transmission control parameter in the expanded flow control frame.
The expanded flow control frame may be sent by the second end to the first end when it is determined that the first end does not have the multi-frame sequence with the second logical link identifier and transmission is not completed.
By adopting the method, the logic link field is added into the first frame, the flow control frame and the continuous frame by expanding and defining the first frame, the flow control frame and the continuous frame in the CAN bus network. Thus, when any two nodes in the CAN bus network communicate, the sending end CAN set the logical link field in the first frame sent to the receiving end by the sending end, so as to inform the receiving end of the data to be sent and the logical link to which the data belongs. Similarly, the receiving end can also indicate the frame to be sent by the sending end by setting a corresponding logical link field in the flow control frame, so that the effect of selecting the logical link to be sent in the communication process is realized, the flexibility of data transmission is further improved, and the data transmission of a plurality of logical links is also supported.
In order to make those skilled in the art understand the technical solution provided by the embodiment of the present disclosure, the following describes the network transmission method provided by the embodiment of the present disclosure in detail.
First, the logical link identifier described in step S11 will be explained. When the first frame, the flow control frame, and the consecutive frame are defined by extension, the logical link identifier may be represented by one byte in the first frame, the flow control frame, or the consecutive frame (accordingly, the logical link identifier should also be included when defining the correlation length). Illustratively, the fourth byte of the flow control frame, the second byte of the first frame, and the second byte of the consecutive frame may be used as the logical link identifier. In this case, the Logical Link Identifier (LLID) may range from 0 to 255. The value 0 and the value 255 CAN be used as an LLID reserved by the CAN bus network, so that the network transmission method CAN be compatible with the current ISO15765-2:2016(E) standard. That is, values 1-254 may be statically or dynamically assigned for use by different logical links. In this way, when the first end and the second end communicate, the first end may inform the second end that the second end owner needs to send data and a logical link to which the data belongs by setting the logical link identifier in the first frame.
Specifically, referring to the data transmission diagram shown in fig. 2, Node 1(Node 1) and Node 2(Node 2) are any two nodes in the CAN bus network. It is assumed that node 1 is a transmitting end and node 2 is a receiving end. When the node 1 needs to send specified logical link data to the node 2 (in the figure, LLID is 254 for example), it may set LLID in the Extended First Frame (EFF for short) to be the corresponding logical link ID of the data that needs to be sent, so as to inform the node 2 of the data that the own party is going to send and the logical link to which the data belongs. After receiving the head Frame, the node 2 may determine an Extended Flow Control Frame (abbreviated EFC) including a corresponding logical link ID according to the data information included in the head Frame and the receiving capability of the node 2 itself, and send the Flow Control Frame to the node 1, so that the node 1 can send a continuous Frame (abbreviated ECF) according to the Flow Control Frame, thereby achieving an effect of sending data to a specified LLID.
In one possible embodiment, the extension defining the flow control frame, the first frame, and the consecutive frames in the CAN bus network includes:
the expanded flow control frame comprises a flow control frame which is added with a logical link identification field on the basis of the flow control frame defined by the ISO15765-2:2016(E) protocol.
The extended head frame is the head frame which is added with a logical link identification field on the basis of the head frame defined by the ISO15765-2:2016(E) protocol.
For example, on the basis of the First Frame defined by the protocol of ISO15765-2:2016(E), the 2 nd byte or the 3 rd byte of the First Frame may be used as the logical link identification field, specifically, for the First Frame defined by the protocol in which the Data Length (FF _ DL, First Frame Data Length) of the First Frame is less than or equal to 4095, the 2 nd byte may be used as the logical link identification field, and for the First Frame defined by the protocol in which FF _ DL is greater than 4095, the 3 rd byte may be used as the logical link identification field. Similarly, in a possible implementation, the data length CAN _ DL of a single frame may also be selected to use the 2 nd byte or the 3 rd byte as the logical link identification field, so as to obtain the extended single frame and the first frame as shown in table 1.
TABLE 1
The extended continuous frames comprise continuous frames with a logical link identification field added on the basis of continuous frames defined by the ISO15765-2:2016(E) protocol.
For example, the 2 nd byte of the continuous frame may be used as the logical link identification field, and the extended continuous frame is shown in table 2. Thus, the compatibility of the network transmission method to the ISO15765-2:2016(E) protocol is ensured by carrying out the extension definition on the basis of the ISO15765-2:2016(E) protocol definition.
TABLE 2
In another possible embodiment, the extended flow control frame includes a flow control frame using the fourth byte of the flow control frame defined by the ISO15765-2:2016(E) protocol as a logical link identification field. The expanded flow control frame is shown in table 3.
TABLE 3
Where STmin in the table above represents the shortest interval time for transmitting adjacent consecutive frames.
In addition, in order to work together with the flow control frame defined by the existing ISO15765-2:2016(E) protocol, the embodiment of the present disclosure may further use the extended flow control frame, in which the value of the logical link identification field is a predetermined value, for a flow control frame defined by a backward compatible ISO15765-2:2016(E) protocol. The predetermined value may be 0, for example. That is to say, the value 0 may be used as the reserved logical link identifier, the value 0 is not allocated to a specific logical link, and when the value of the logical link identifier field of the expanded flow control frame is 0, the expanded flow control frame is processed according to the flow control frame defined by the protocol ISO15765-2:2016 (E).
Fig. 3 is a schematic flow chart of another network transmission method according to an exemplary embodiment of the disclosure, which is applied to a CAN bus network, where the method extends and defines a flow control frame, a first frame, and a consecutive frame in the CAN bus network. And the expanded flow control frame, the expanded first frame and the expanded continuous frame all comprise a logical link field. As shown in fig. 3, the method includes:
and S31, the second end receives the expanded first frame sent by the first end, and the expanded first frame comprises a first logical link identifier.
S32, if there is no multi-frame sequence with a second logical link identifier at the first end and the transmission is not completed, sending an extended flow control frame carrying the first logical link identifier to the first end, so as to control the first end to transmit a continuous frame with the first logical link identifier.
By adopting the method, the logic link field is added into the first frame, the flow control frame and the continuous frame by expanding and defining the first frame, the flow control frame and the continuous frame in the CAN bus network. Thus, when any two nodes in the CAN bus network communicate, the sending end CAN set the logical link field in the first frame sent to the receiving end, so as to inform the receiving end of the data needed to be sent and the logical link to which the data belongs. Similarly, the receiving end can also determine the data to be sent by the sending end and the logical link to which the data belongs according to the received first frame, and indicate the frame to be sent by the sending end by setting the corresponding logical link field in the flow control frame, so that the effect of selecting the logical link to which the data is to be sent according to actual requirements in the communication process is realized, the flexibility of data transmission is further improved, and the data transmission of a plurality of logical links is also supported.
In a possible implementation, the network transmission method shown in fig. 3 further includes:
if the transmission of the multi-frame sequence with the second logical link identification is not completed at the first end, sending an expanded first flow control frame carrying the second logical link identification to the first end, wherein the first flow control frame further comprises first indication information used for indicating the second end to suspend sending continuous frames with the second logical link identification; and the number of the first and second electrodes,
and after the transmission of the multi-frame sequence with the first logical link identifier is finished, sending an expanded second flow control frame carrying the second logical link identifier to the first end, wherein the second flow control frame further comprises second indication information used for indicating the second end to continuously send continuous frames with the second logical link identifier.
Still taking fig. 2 as an example, when the node 2 receives the first frame with the logical link identifier 1 sent by the node 1, it may first detect the communication status between the node 1 and itself, and determine whether there is a multi-frame sequence with other logical link identifiers in transmission at the node 1. If the node 1 does not have a multi-frame sequence with other logical link identifiers being transmitted, the node 2 may send an extended flow control frame carrying a logical link identifier 1 to the node 1, thereby instructing the node 1 to transmit a continuous frame with the logical link identifier 1.
In an embodiment, when the node 2 receives the first frame with the logical link identifier of 1 sent by the node 1, it determines that the multi-frame sequence with the logical link identifier of 254 of the node 1 has not been transmitted yet by detecting the communication state between the node 1 and itself. In this case, the node 2 may send the expanded first streaming frame carrying the logical link identifier 254 to the node 1, thereby instructing the node 2 to suspend sending consecutive frames of the logical link identifier 254.
In specific implementation, as shown in fig. 2, the node 2 may also send, to the node 1, a flow control frame for instructing the node 1 to suspend sending of the consecutive frames with the logical link identifier 254 and a flow control frame for instructing the node 1 to send the consecutive frames with the logical link identifier 1, so as to modify data to be sent by the node 1, which is not limited in this disclosure.
In the previous embodiment, as shown in fig. 2, after the transmission of the multi-frame sequence with logical link id 1 is completed, the node 2 may further send an extended second flow control frame with logical link id 254 to the node 1, so as to instruct the node 1 to continue sending consecutive frames with logical link id 254.
That is, the first frame, the flow control frame, and the continuous frame in the CAN bus network are defined by extension, and the logical link field is added to the first frame, the flow control frame, and the continuous frame. When any two nodes in the CAN bus network communicate, the sending end and the receiving end CAN respectively set corresponding logical link fields in the first frame and the flow control frame sent by the sending end and the receiving end, so that the effect of suspending and changing the data being sent according to actual requirements is realized, and the flexibility of data transmission is improved.
In an embodiment, the extended flow control frame includes a flow control frame added with a logical link identification field on the basis of a flow control frame defined by an ISO15765-2:2016(E) protocol;
the expanded first frame is the first frame which comprises a logical link identification field added on the basis of the first frame defined by an ISO15765-2:2016(E) protocol;
the extended continuous frames comprise continuous frames with a logical link identification field added on the basis of continuous frames defined by the ISO15765-2:2016(E) protocol.
Specifically, the expanded flow control frame comprises a flow control frame using the fourth byte of the flow control frame defined by the ISO15765-2:2016(E) protocol as a logical link identification field. In addition, the expanded flow control frame with the value of the logical link identification field as the predetermined value can be used for a flow control frame defined by a backward compatible ISO15765-2:2016(E) protocol.
Regarding the form of the extended first frame, the flow control frame, and the continuous frame, which have been described in detail in the above embodiments, reference is made to the above description for tables 1 to 3, and details will not be described here.
The disclosed embodiments also provide a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the network transmission method as shown in fig. 1.
The disclosed embodiments also provide another computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the network transmission method as shown in fig. 3.
An embodiment of the present disclosure further provides an electronic device, including:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the network transmission method as shown in fig. 1.
An embodiment of the present disclosure further provides another electronic device, including:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the network transmission method as shown in fig. 3.
Fig. 4 is a block diagram illustrating an electronic device 400 according to an example embodiment. As shown in fig. 4, the electronic device 400 may be used as a transmitting end in a CAN bus network, and the electronic device 400 may include: a processor 401 and a memory 402. The electronic device 400 may also include one or more of an input/output (I/O) interface 403, and a communications component 404.
The processor 401 is configured to control the overall operation of the electronic device 400, so as to complete all or part of the steps in the network transmission method shown in fig. 1. The memory 402 is used to store various types of data to support operations at the electronic device 400, such as instructions for any application or method operating on the electronic device 400 and application-related data, such as data to be transmitted by a node, etc. The Memory 402 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. The I/O interface 403 provides an interface between the processor 401 and other interface modules. The communication component 404 is used for wired or wireless communication between the electronic device 400 and other devices.
In an exemplary embodiment, the electronic Device 400 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the network transmission method shown in fig. 1.
In another exemplary embodiment, a computer readable storage medium comprising program instructions which, when executed by a processor, implement the steps of the network transmission method as shown in fig. 1 is also provided. For example, the computer readable storage medium may be the memory 402 comprising program instructions executable by the processor 401 of the electronic device 400 to perform the network transmission method as shown in fig. 1.
Fig. 5 is a block diagram illustrating another electronic device 500 in accordance with an example embodiment. As shown in fig. 5, the electronic device 500 may be used as a receiving end in a CAN bus network, and the electronic device 500 may include: a processor 501 and a memory 502. The electronic device 500 may also include one or more of an input/output (I/O) interface 503, and a communications component 504.
The processor 501 is configured to control the overall operation of the electronic device 500, so as to complete all or part of the steps in the network transmission method shown in fig. 3. The memory 502 is used to store various types of data to support operations at the electronic device 500, such as instructions for any application or method operating on the electronic device 500, and application-related data, such as data received by a node. The Memory 502 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. The I/O interface 503 provides an interface between the processor 501 and other interface modules. The communication component 504 is used for wired or wireless communication between the electronic device 500 and other devices.
In an exemplary embodiment, the electronic Device 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the network transmission method shown in fig. 3.
In another exemplary embodiment, a computer readable storage medium comprising program instructions which, when executed by a processor, implement the steps of the network transmission method as shown in fig. 3 is also provided. For example, the computer readable storage medium may be the memory 502 described above comprising program instructions that are executable by the processor 501 of the electronic device 500 to perform the network transmission method as shown in fig. 3.
The embodiment of the present disclosure further provides a CAN bus network, referring to a CAN bus network schematic diagram shown in fig. 6, including a CAN bus and a plurality of node devices (illustrated by node device 1 to node device 5 in the diagram) connected to the CAN bus;
each node device is used as a first end to execute the network transmission method shown in fig. 1 when transmitting data;
when each of the node apparatuses receives the data, the network transmission method shown in fig. 3 is executed as the second end.
The method comprises the steps of adding a logic link field into a first frame, a flow control frame and a continuous frame in a CAN bus network by extending and defining the first frame, the flow control frame and the continuous frame. In this way, when any two nodes (for example, node 1 and node 2 shown in fig. 2) in the CAN bus network perform communication, the sending end CAN set the logical link field in the first frame sent to the receiving end, so as to inform the receiving end of the data that the sending end itself needs to send and the logical link to which the data belongs. Similarly, the receiving end can also determine the data to be sent by the sending end and the logical link to which the data belong according to the received first frame, and indicate the frame to be sent by the sending end by setting the corresponding logical link field in the flow control frame, so that the effect of selecting the logical link to which the data is to be sent according to actual requirements in the communication process is realized, the flexibility of data transmission is further improved, and the data transmission of a plurality of logical links is also supported.
The preferred embodiments of the present disclosure are described in detail with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solution of the present disclosure within the technical idea of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
It should be noted that, in the foregoing embodiments, various features described in the above embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, various combinations that are possible in the present disclosure are not described again.
In addition, any combination of various embodiments of the present disclosure may be made, and the same should be considered as the disclosure of the present disclosure, as long as it does not depart from the spirit of the present disclosure.